diff options
-rw-r--r-- | builtin.cpp | 95 | ||||
-rw-r--r-- | common.cpp | 9 | ||||
-rw-r--r-- | common.h | 3 | ||||
-rwxr-xr-x | config.guess | 376 | ||||
-rwxr-xr-x | config.sub | 134 | ||||
-rw-r--r-- | doc_src/bind.txt | 8 | ||||
-rw-r--r-- | doc_src/function.txt | 2 | ||||
-rw-r--r-- | fish.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | input.cpp | 8 | ||||
-rw-r--r-- | input.h | 4 | ||||
-rwxr-xr-x | install-sh | 14 | ||||
-rw-r--r-- | mimedb.h | 4 | ||||
-rw-r--r-- | osx/config.h | 4 | ||||
-rw-r--r-- | reader.cpp | 40 | ||||
-rw-r--r-- | share/completions/git.fish | 15 | ||||
-rw-r--r-- | share/functions/fish_vi_key_bindings.fish | 62 | ||||
-rw-r--r-- | tests/function.in | 14 | ||||
-rw-r--r-- | tests/function.out | 4 | ||||
-rw-r--r-- | tokenizer.cpp | 55 | ||||
-rw-r--r-- | tokenizer.h | 4 |
20 files changed, 483 insertions, 380 deletions
diff --git a/builtin.cpp b/builtin.cpp index 71ba8a32..59778862 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1655,7 +1655,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv) return STATUS_BUILTIN_ERROR; } - if ((wcsfuncname(new_func.c_str()) != 0) || parser_keywords_is_reserved(new_func)) + if ((wcsfuncname(new_func) != 0) || parser_keywords_is_reserved(new_func)) { append_format(stderr_buffer, _(L"%ls: Illegal function name '%ls'\n"), @@ -2002,16 +2002,24 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr int res=STATUS_BUILTIN_OK; wchar_t *desc=0; std::vector<event_t> events; - std::auto_ptr<wcstring_list_t> named_arguments(NULL); + + bool has_named_arguments = false; + wcstring_list_t named_arguments; wcstring_list_t inherit_vars; - wchar_t *name = 0; bool shadows = true; woptind=0; wcstring_list_t wrap_targets; - + + /* If -a/--argument-names is specified before the function name, + then the function name is the last positional, e.g. `function -a arg1 arg2 name`. + If it is specified after the function name (or not specified at all) then the + function name is the first positional. This is the common case. */ + bool name_is_first_positional = true; + wcstring_list_t positionals; + const struct woption long_options[] = { { L"description", required_argument, 0, 'd' }, @@ -2032,9 +2040,10 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr { int opt_index = 0; + // The leading - here specifies RETURN_IN_ORDER int opt = wgetopt_long(argc, argv, - L"d:s:j:p:v:e:haSV:", + L"-d:s:j:p:v:e:haSV:", long_options, &opt_index); if (opt == -1) @@ -2176,8 +2185,9 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr } case 'a': - if (named_arguments.get() == NULL) - named_arguments.reset(new wcstring_list_t); + has_named_arguments = true; + /* The function name is the first positional unless -a comes before all positionals */ + name_is_first_positional = ! positionals.empty(); break; case 'S': @@ -2204,6 +2214,11 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr case 'h': builtin_print_help(parser, argv[0], stdout_buffer); return STATUS_BUILTIN_OK; + + case 1: + assert(woptarg != NULL); + positionals.push_back(woptarg); + break; case '?': builtin_unknown_option(parser, argv[0], argv[woptind-1]); @@ -2216,87 +2231,93 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr if (!res) { - - if (argc == woptind) + /* Determine the function name, and remove it from the list of positionals */ + wcstring function_name; + bool name_is_missing = positionals.empty(); + if (! name_is_missing) + { + if (name_is_first_positional) + { + function_name = positionals.front(); + positionals.erase(positionals.begin()); + } + else + { + function_name = positionals.back(); + positionals.erase(positionals.end() - 1); + } + } + + if (name_is_missing) { append_format(*out_err, _(L"%ls: Expected function name\n"), argv[0]); res=1; } - else if (wcsfuncname(argv[woptind])) + else if (wcsfuncname(function_name)) { append_format(*out_err, _(L"%ls: Illegal function name '%ls'\n"), argv[0], - argv[woptind]); + function_name.c_str()); res=1; } - else if (parser_keywords_is_reserved(argv[woptind])) + else if (parser_keywords_is_reserved(function_name)) { append_format(*out_err, _(L"%ls: The name '%ls' is reserved,\nand can not be used as a function name\n"), argv[0], - argv[woptind]); + function_name.c_str()); res=1; } - else if (! wcslen(argv[woptind])) + else if (function_name.empty()) { append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]); res=1; } else { - - name = argv[woptind++]; - - if (named_arguments.get()) + if (has_named_arguments) { - while (woptind < argc) + /* All remaining positionals are named arguments */ + named_arguments.swap(positionals); + for (size_t i=0; i < named_arguments.size(); i++) { - if (wcsvarname(argv[woptind])) + if (wcsvarname(named_arguments.at(i))) { append_format(*out_err, _(L"%ls: Invalid variable name '%ls'\n"), argv[0], - argv[woptind]); + named_arguments.at(i).c_str()); res = STATUS_BUILTIN_ERROR; break; } - - named_arguments->push_back(argv[woptind++]); } } - else if (woptind != argc) + else if (! positionals.empty()) { + // +1 because we already got the function name append_format(*out_err, _(L"%ls: Expected one argument, got %d\n"), argv[0], - argc); + positionals.size() + 1); res=1; - } } - } - if (res) - { - builtin_print_help(parser, argv[0], *out_err); - } - else - { + /* Here we actually define the function! */ function_data_t d; - d.name = name; + d.name = function_name; if (desc) d.description = desc; d.events.swap(events); d.shadows = shadows; - if (named_arguments.get()) - d.named_arguments.swap(*named_arguments); + d.named_arguments.swap(named_arguments); d.inherit_vars.swap(inherit_vars); for (size_t i=0; i<d.events.size(); i++) @@ -2312,7 +2333,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr // Handle wrap targets for (size_t w=0; w < wrap_targets.size(); w++) { - complete_add_wrapper(name, wrap_targets.at(w)); + complete_add_wrapper(function_name, wrap_targets.at(w)); } } @@ -481,9 +481,14 @@ const wchar_t *wcsvarname(const wchar_t *str) return NULL; } -const wchar_t *wcsfuncname(const wchar_t *str) +const wchar_t *wcsvarname(const wcstring &str) { - return wcschr(str, L'/'); + return wcsvarname(str.c_str()); +} + +const wchar_t *wcsfuncname(const wcstring &str) +{ + return wcschr(str.c_str(), L'/'); } @@ -696,6 +696,7 @@ void append_formatv(wcstring &str, const wchar_t *format, va_list ap); */ const wchar_t *wcsvarname(const wchar_t *str); +const wchar_t *wcsvarname(const wcstring &str); /** @@ -704,7 +705,7 @@ const wchar_t *wcsvarname(const wchar_t *str); \return null if this is a valid name, and a pointer to the first invalid character otherwise */ -const wchar_t *wcsfuncname(const wchar_t *str); +const wchar_t *wcsfuncname(const wcstring &str); /** Test if the given string is valid in a variable name diff --git a/config.guess b/config.guess index d622a44e..f7eb141e 100755 --- a/config.guess +++ b/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2015-03-04' # 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 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-02-10' # 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 Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. +# 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"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to <config-patches@gnu.org>. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 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." @@ -138,6 +132,27 @@ 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/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in 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. case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -182,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 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 @@ -198,7 +227,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` @@ -302,7 +335,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -560,8 +593,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -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 @@ -801,10 +835,13 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -852,21 +889,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -879,59 +916,57 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -950,54 +985,63 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1201,6 +1245,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,19 +1274,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$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 - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$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 + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1256,7 +1315,7 @@ EOF NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,157 +1389,6 @@ EOF exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#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 <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#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 <sys/param.h> -# 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 - printf ("vax-dec-ultrix\n"); exit (0); -# 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; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <<EOF $0: unable to guess system type @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-04-18' +timestamp='2015-03-08' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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 2 of the License, or +# 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. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. @@ -26,11 +20,12 @@ timestamp='2012-04-18' # 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. +# 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>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# 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. @@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 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." @@ -123,8 +116,8 @@ esac maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -156,7 +149,7 @@ case $os in -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) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,21 +252,24 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -287,23 +283,26 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -314,6 +313,7 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,7 +328,10 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -370,26 +373,28 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -403,18 +408,22 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -432,6 +441,7 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -508,6 +518,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -769,6 +782,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -788,11 +804,15 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -820,6 +840,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -828,7 +852,7 @@ case $basic_machine in basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -1019,7 +1043,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,29 +1374,29 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1492,9 +1520,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1543,6 +1568,9 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; diff --git a/doc_src/bind.txt b/doc_src/bind.txt index 5e5c90f1..8a099eb3 100644 --- a/doc_src/bind.txt +++ b/doc_src/bind.txt @@ -55,8 +55,12 @@ The following special input functions are available: - `backward-char`, moves one character to the left +- `backward-bigword`, move one whitespace-delimited word to the left + - `backward-delete-char`, deletes one character of input to the left of the cursor +- `backward-kill-bigword`, move the whitespace-delimited word to the left of the cursor to the killring + - `backward-kill-line`, move everything from the beginning of the line to the cursor to the killring - `backward-kill-word`, move the word to the left of the cursor to the killring @@ -85,6 +89,8 @@ The following special input functions are available: - `explain`, print a description of possible problems with the current command +- `forward-bigword`, move one whitespace-delimited word to the right + - `forward-char`, move one character to the right - `forward-word`, move one word to the right @@ -93,6 +99,8 @@ The following special input functions are available: - `history-search-forward`, search the history for the next match +- `kill-bigword`, move the next whitespace-delimited word to the killring + - `kill-line`, move everything from the cursor to the end of the line to the killring - `kill-whole-line`, move the line to the killring diff --git a/doc_src/function.txt b/doc_src/function.txt index 1f9fb47d..e58d6513 100644 --- a/doc_src/function.txt +++ b/doc_src/function.txt @@ -2,7 +2,7 @@ \subsection function-synopsis Synopsis \fish{synopsis} -function [OPTIONS] NAME; BODY; end +function NAME [OPTIONS]; BODY; end \endfish \subsection function-description Description diff --git a/fish.xcodeproj/project.pbxproj b/fish.xcodeproj/project.pbxproj index 037563bc..dd4f7262 100644 --- a/fish.xcodeproj/project.pbxproj +++ b/fish.xcodeproj/project.pbxproj @@ -397,7 +397,6 @@ D0A0851613B3ACEE0099B651 /* io.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io.h; sourceTree = "<group>"; }; D0A0851713B3ACEE0099B651 /* iothread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iothread.h; sourceTree = "<group>"; }; D0A0851813B3ACEE0099B651 /* kill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kill.h; sourceTree = "<group>"; }; - D0A0851913B3ACEE0099B651 /* mimedb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mimedb.h; sourceTree = "<group>"; }; D0A0851A13B3ACEE0099B651 /* output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = output.h; sourceTree = "<group>"; }; D0A0851B13B3ACEE0099B651 /* parse_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse_util.h; sourceTree = "<group>"; }; D0A0851C13B3ACEE0099B651 /* parser_keywords.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser_keywords.h; sourceTree = "<group>"; }; @@ -649,7 +648,6 @@ D0A0854F13B3ACEE0099B651 /* kill.cpp */, D0A0854E13B3ACEE0099B651 /* key_reader.cpp */, D03EE83814DF88B200FC7150 /* lru.h */, - D0A0851913B3ACEE0099B651 /* mimedb.h */, D0A0855013B3ACEE0099B651 /* mimedb.cpp */, D0A0851A13B3ACEE0099B651 /* output.h */, D0A0855113B3ACEE0099B651 /* output.cpp */, @@ -1327,7 +1325,7 @@ "SYSCONFDIR=L\\\"/usr/local/etc\\\"", "BINDIR=L\\\"/usr/local/bin\\\"", "DOCDIR=L\\\"/usr/local/share/doc\\\"", - "FISH_BUILD_VERSION=\\\"2.2b1\\\"", + "FISH_BUILD_VERSION=\\\"2.2b1-git\\\"", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -1455,7 +1453,7 @@ "SYSCONFDIR=L\\\"/usr/local/etc\\\"", "BINDIR=L\\\"/usr/local/bin\\\"", "DOCDIR=L\\\"/usr/local/share/doc\\\"", - "FISH_BUILD_VERSION=\\\"2.2b1\\\"", + "FISH_BUILD_VERSION=\\\"2.2b1-git\\\"", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1483,7 +1481,7 @@ "SYSCONFDIR=L\\\"/usr/local/etc\\\"", "BINDIR=L\\\"/usr/local/bin\\\"", "DOCDIR=L\\\"/usr/local/share/doc\\\"", - "FISH_BUILD_VERSION=\\\"2.2b1\\\"", + "FISH_BUILD_VERSION=\\\"2.2b1-git\\\"", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -112,6 +112,8 @@ static const wchar_t * const name_arr[] = L"backward-char", L"forward-word", L"backward-word", + L"forward-bigword", + L"backward-bigword", L"history-search-backward", L"history-search-forward", L"delete-char", @@ -126,8 +128,10 @@ static const wchar_t * const name_arr[] = L"backward-kill-line", L"kill-whole-line", L"kill-word", + L"kill-bigword", L"backward-kill-word", L"backward-kill-path-component", + L"backward-kill-bigword", L"history-token-search-backward", L"history-token-search-forward", L"self-insert", @@ -218,6 +222,8 @@ static const wchar_t code_arr[] = R_BACKWARD_CHAR, R_FORWARD_WORD, R_BACKWARD_WORD, + R_FORWARD_BIGWORD, + R_BACKWARD_BIGWORD, R_HISTORY_SEARCH_BACKWARD, R_HISTORY_SEARCH_FORWARD, R_DELETE_CHAR, @@ -232,8 +238,10 @@ static const wchar_t code_arr[] = R_BACKWARD_KILL_LINE, R_KILL_WHOLE_LINE, R_KILL_WORD, + R_KILL_BIGWORD, R_BACKWARD_KILL_WORD, R_BACKWARD_KILL_PATH_COMPONENT, + R_BACKWARD_KILL_BIGWORD, R_HISTORY_TOKEN_SEARCH_BACKWARD, R_HISTORY_TOKEN_SEARCH_FORWARD, R_SELF_INSERT, @@ -30,6 +30,8 @@ enum R_BACKWARD_CHAR, R_FORWARD_WORD, R_BACKWARD_WORD, + R_FORWARD_BIGWORD, + R_BACKWARD_BIGWORD, R_HISTORY_SEARCH_BACKWARD, R_HISTORY_SEARCH_FORWARD, R_DELETE_CHAR, @@ -44,8 +46,10 @@ enum R_BACKWARD_KILL_LINE, R_KILL_WHOLE_LINE, R_KILL_WORD, + R_KILL_BIGWORD, R_BACKWARD_KILL_WORD, R_BACKWARD_KILL_PATH_COMPONENT, + R_BACKWARD_KILL_BIGWORD, R_HISTORY_TOKEN_SEARCH_BACKWARD, R_HISTORY_TOKEN_SEARCH_FORWARD, R_SELF_INSERT, @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-01-19.21; # UTC +scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC # 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 +# '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 @@ -156,7 +156,7 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; -t) dst_arg=$2 - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -202,7 +202,7 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi @@ -240,7 +240,7 @@ fi for src do - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac @@ -354,7 +354,7 @@ do 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-writeable bit of parent directory when it shouldn't. + # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in diff --git a/mimedb.h b/mimedb.h deleted file mode 100644 index 8c5c4e61..00000000 --- a/mimedb.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef FISH_MIMEDB_H -#define FISH_MIMEDB_H - -#endif diff --git a/osx/config.h b/osx/config.h index a5b0df28..5a8e6b26 100644 --- a/osx/config.h +++ b/osx/config.h @@ -222,7 +222,7 @@ #define PACKAGE_NAME "fish" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "fish 2.2b1" +#define PACKAGE_STRING "fish 2.2b1-git" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "fish" @@ -231,7 +231,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.2b1" +#define PACKAGE_VERSION "2.2b1-git" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -1172,6 +1172,8 @@ static bool command_ends_paging(wchar_t c, bool focused_on_search_field) case R_END_OF_LINE: case R_FORWARD_WORD: case R_BACKWARD_WORD: + case R_FORWARD_BIGWORD: + case R_BACKWARD_BIGWORD: case R_DELETE_CHAR: case R_BACKWARD_DELETE_CHAR: case R_KILL_LINE: @@ -1180,8 +1182,10 @@ static bool command_ends_paging(wchar_t c, bool focused_on_search_field) case R_BACKWARD_KILL_LINE: case R_KILL_WHOLE_LINE: case R_KILL_WORD: + case R_KILL_BIGWORD: case R_BACKWARD_KILL_WORD: case R_BACKWARD_KILL_PATH_COMPONENT: + case R_BACKWARD_KILL_BIGWORD: case R_SELF_INSERT: case R_TRANSPOSE_CHARS: case R_TRANSPOSE_WORDS: @@ -3775,9 +3779,12 @@ const wchar_t *reader_readline(int nchars) /* kill one word left */ case R_BACKWARD_KILL_WORD: case R_BACKWARD_KILL_PATH_COMPONENT: + case R_BACKWARD_KILL_BIGWORD: { - move_word_style_t style = (c == R_BACKWARD_KILL_PATH_COMPONENT ? move_word_style_path_components : move_word_style_punctuation); - bool newv = (last_char != R_BACKWARD_KILL_WORD && last_char != R_BACKWARD_KILL_PATH_COMPONENT); + move_word_style_t style = + (c == R_BACKWARD_KILL_BIGWORD ? move_word_style_whitespace : + c == R_BACKWARD_KILL_PATH_COMPONENT ? move_word_style_path_components : move_word_style_punctuation); + bool newv = (last_char != R_BACKWARD_KILL_WORD && last_char != R_BACKWARD_KILL_PATH_COMPONENT && last_char != R_BACKWARD_KILL_BIGWORD); move_word(data->active_edit_line(), MOVE_DIR_LEFT, true /* erase */, style, newv); break; } @@ -3789,6 +3796,13 @@ const wchar_t *reader_readline(int nchars) break; } + /* kill one bigword right */ + case R_KILL_BIGWORD: + { + move_word(data->active_edit_line(), MOVE_DIR_RIGHT, true /* erase */, move_word_style_whitespace, last_char!=R_KILL_BIGWORD); + break; + } + /* move one word left*/ case R_BACKWARD_WORD: { @@ -3796,6 +3810,13 @@ const wchar_t *reader_readline(int nchars) break; } + /* move one bigword left */ + case R_BACKWARD_BIGWORD: + { + move_word(data->active_edit_line(), MOVE_DIR_LEFT, false /* do not erase */, move_word_style_whitespace, false); + break; + } + /* move one word right*/ case R_FORWARD_WORD: { @@ -3811,6 +3832,21 @@ const wchar_t *reader_readline(int nchars) break; } + /* move one bigword right */ + case R_FORWARD_BIGWORD: + { + editable_line_t *el = data->active_edit_line(); + if (el->position < el->size()) + { + move_word(el, MOVE_DIR_RIGHT, false /* do not erase */, move_word_style_whitespace, false); + } + else + { + accept_autosuggestion(false /* accept only one word */); + } + break; + } + case R_BEGINNING_OF_HISTORY: { if (data->is_navigating_pager_contents()) diff --git a/share/completions/git.fish b/share/completions/git.fish index 52ee206f..26f43077 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -132,6 +132,21 @@ complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches' # TODO other options +#### filter-branch +complete -f -c git -n '__fish_git_needs_command' -a filter-branch -d 'Rewrite branches' +complete -f -c git -n '__fish_git_using_command filter-branch' -l env-filter -d 'This filter may be used if you only need to modify the environment' +complete -f -c git -n '__fish_git_using_command filter-branch' -l tree-filter -d 'This is the filter for rewriting the tree and its contents.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l index-filter -d 'This is the filter for rewriting the index.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l parent-filter -d 'This is the filter for rewriting the commit\\(cqs parent list.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l msg-filter -d 'This is the filter for rewriting the commit messages.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l commit-filter -d 'This is the filter for performing the commit.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l tag-name-filter -d 'This is the filter for rewriting tag names.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l subdirectory-filter -d 'Only look at the history which touches the given subdirectory.' +complete -f -c git -n '__fish_git_using_command filter-branch' -l prune-empty -d 'Ignore empty commits generated by filters' +complete -f -c git -n '__fish_git_using_command filter-branch' -l original -d 'Use this option to set the namespace where the original commits will be stored' +complete -r -c git -n '__fish_git_using_command filter-branch' -s d -d 'Use this option to set the path to the temporary directory used for rewriting' +complete -c git -n '__fish_git_using_command filter-branch' -s f -l force -d 'Force filter branch to start even w/ refs in refs/original or existing temp directory' + ### remote complete -f -c git -n '__fish_git_needs_command' -a remote -d 'Manage set of tracked repositories' complete -f -c git -n '__fish_git_using_command remote' -a '(__fish_git_remotes)' diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index ba64f828..aa6dda6f 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -59,13 +59,13 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -k up up-or-search bind b backward-word - bind B backward-word - bind gE backward-word - bind gE backward-word + bind B backward-bigword + bind ge backward-word + bind gE backward-bigword bind w forward-word - bind W forward-word + bind W forward-bigword bind e forward-word - bind E forward-word + bind E forward-bigword bind x delete-char bind X backward-delete-char @@ -81,17 +81,17 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind d\x24 kill-line bind d\x5e backward-kill-line bind dw kill-word - bind dW kill-word + bind dW kill-bigword bind diw forward-char forward-char backward-word kill-word - bind diW forward-char forward-char backward-word kill-word + bind diW forward-char forward-char backward-bigword kill-bigword bind daw forward-char forward-char backward-word kill-word - bind daW forward-char forward-char backward-word kill-word + bind daW forward-char forward-char backward-bigword kill-bigword bind de kill-word - bind dE kill-word + bind dE kill-bigword bind db backward-kill-word - bind dB backward-kill-word - bind dgE backward-kill-word - bind dgE backward-kill-word + bind dB backward-kill-bigword + bind dge backward-kill-word + bind dgE backward-kill-bigword bind -m insert s delete-char force-repaint bind -m insert S kill-whole-line force-repaint @@ -100,17 +100,17 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -m insert c\x24 kill-line force-repaint bind -m insert c\x5e backward-kill-line force-repaint bind -m insert cw kill-word force-repaint - bind -m insert cW kill-word force-repaint + bind -m insert cW kill-bigword force-repaint bind -m insert ciw forward-char forward-char backward-word kill-word force-repaint - bind -m insert ciW forward-char forward-char backward-word kill-word force-repaint + bind -m insert ciW forward-char forward-char backward-bigword kill-bigword force-repaint bind -m insert caw forward-char forward-char backward-word kill-word force-repaint - bind -m insert caW forward-char forward-char backward-word kill-word force-repaint + bind -m insert caW forward-char forward-char backward-bigword kill-bigword force-repaint bind -m insert ce kill-word force-repaint - bind -m insert cE kill-word force-repaint + bind -m insert cE kill-bigword force-repaint bind -m insert cb backward-kill-word force-repaint - bind -m insert cB backward-kill-word force-repaint - bind -m insert cgE backward-kill-word force-repaint - bind -m insert cgE backward-kill-word force-repaint + bind -m insert cB backward-kill-bigword force-repaint + bind -m insert cge backward-kill-word force-repaint + bind -m insert cgE backward-kill-bigword force-repaint bind '~' capitalize-word bind gu downcase-word @@ -124,17 +124,17 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind y\x24 kill-line yank bind y\x5e backward-kill-line yank bind yw kill-word yank - bind yW kill-word yank + bind yW kill-bigword yank bind yiw forward-char forward-char backward-word kill-word yank - bind yiW forward-char forward-char backward-word kill-word yank + bind yiW forward-char forward-char backward-bigword kill-bigword yank bind yaw forward-char forward-char backward-word kill-word yank - bind yaW forward-char forward-char backward-word kill-word yank + bind yaW forward-char forward-char backward-bigword kill-bigword yank bind ye kill-word yank - bind yE kill-word yank + bind yE kill-bigword yank bind yb backward-kill-word yank - bind yB backward-kill-word yank - bind ygE backward-kill-word yank - bind ygE backward-kill-word yank + bind yB backward-kill-bigword yank + bind yge backward-kill-word yank + bind ygE backward-kill-bigword yank bind f forward-jump bind F backward-jump @@ -212,13 +212,13 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -M visual l forward-char bind -M visual b backward-word - bind -M visual B backward-word - bind -M visual gE backward-word - bind -M visual gE backward-word + bind -M visual B backward-bigword + bind -M visual ge backward-word + bind -M visual gE backward-bigword bind -M visual w forward-word - bind -M visual W forward-word + bind -M visual W forward-bigword bind -M visual e forward-word - bind -M visual E forward-word + bind -M visual E forward-bigword bind -M visual -m default d kill-selection end-selection force-repaint bind -M visual -m default x kill-selection end-selection force-repaint diff --git a/tests/function.in b/tests/function.in index e533b25b..747bbcec 100644 --- a/tests/function.in +++ b/tests/function.in @@ -30,3 +30,17 @@ set foo 'bad foo' set bar 'bad bar' set baz 'bad baz' frob + +# Test that -a does not mix up the function name with arguments +# See #2068 +function name1 -a arg1 arg2 ; end +function -a arg1 arg2 name2 ; end +function name3 --argument-names arg1 arg2 ; end +function --argument-names arg1 arg2 name4 ; end +for i in (seq 4) + if functions -q name$i + echo "Function name$i found" + else + echo "Function name$i not found, but should have been" + end +end diff --git a/tests/function.out b/tests/function.out index 3fa70990..5a3da619 100644 --- a/tests/function.out +++ b/tests/function.out @@ -18,3 +18,7 @@ $bar: (5) 4: '' 5: '3' $baz: (0) +Function name1 found +Function name2 found +Function name3 found +Function name4 found diff --git a/tokenizer.cpp b/tokenizer.cpp index 07253328..65908466 100644 --- a/tokenizer.cpp +++ b/tokenizer.cpp @@ -913,6 +913,59 @@ bool move_word_state_machine_t::consume_char_path_components(wchar_t c) return consumed; } +bool move_word_state_machine_t::consume_char_whitespace(wchar_t c) +{ + enum + { + s_always_one = 0, + s_blank, + s_graph, + s_end + }; + + bool consumed = false; + while (state != s_end && ! consumed) + { + switch (state) + { + case s_always_one: + /* Always consume the first character */ + consumed = true; + state = s_blank; + break; + + case s_blank: + if (iswblank(c)) + { + /* Consumed whitespace */ + consumed = true; + } + else + { + state = s_graph; + } + break; + + case s_graph: + if (iswgraph(c)) + { + /* Consumed printable non-space */ + consumed = true; + } + else + { + state = s_end; + } + break; + + case s_end: + default: + break; + } + } + return consumed; +} + bool move_word_state_machine_t::consume_char(wchar_t c) { switch (style) @@ -921,6 +974,8 @@ bool move_word_state_machine_t::consume_char(wchar_t c) return consume_char_punctuation(c); case move_word_style_path_components: return consume_char_path_components(c); + case move_word_style_whitespace: + return consume_char_whitespace(c); default: return false; } diff --git a/tokenizer.h b/tokenizer.h index d7e202ba..954957cc 100644 --- a/tokenizer.h +++ b/tokenizer.h @@ -192,7 +192,8 @@ int oflags_for_redirection_type(enum token_type type); enum move_word_style_t { move_word_style_punctuation, //stop at punctuation - move_word_style_path_components //stops at path components + move_word_style_path_components, //stops at path components + move_word_style_whitespace // stops at whitespace }; /* Our state machine that implements "one word" movement or erasure. */ @@ -203,6 +204,7 @@ private: bool consume_char_punctuation(wchar_t c); bool consume_char_path_components(wchar_t c); bool is_path_component_character(wchar_t c); + bool consume_char_whitespace(wchar_t c); int state; move_word_style_t style; |