diff --git a/.gitignore b/.gitignore
index 17b652862..217b16528 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,6 @@ share/config.fish
share/man/
toc.txt
user_doc/
-xsel-0.9.6/
+xsel-1.2.0/
+tests/*tmp.*
+tests/foo.txt
diff --git a/Doxyfile b/Doxyfile
index 29524351a..d25badb90 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -14,181 +14,181 @@
# Project related configuration options
#---------------------------------------------------------------------------
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = fish
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
+# 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 = 1
-# 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
+# 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 = doc
-# 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
+# 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:
-# 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, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
+# 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:
+# 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, Norwegian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
# Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
-# 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).
+# 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
+# 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"
+# 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 = YES
-# 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
+# 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
+# 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
+# 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 = YES
-# 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
+# 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 =
+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
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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 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
+# 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
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# 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 = 8
-# 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:".
+# 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 =
+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
+# 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
+# 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
-# 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
+# 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
@@ -197,168 +197,168 @@ 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
+# 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
+# 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
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
-# 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 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.
+# 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.
+# 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
+# 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
+# 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
+# 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.
+# 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 = NO
-# 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
+# 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 = YES
-# 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
+# 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
+# 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]
+# 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
+# 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
+# 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.
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
-ENABLED_SECTIONS =
+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
+# 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
+# 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
+# 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.
SHOW_DIRECTORIES = YES
@@ -367,134 +367,134 @@ SHOW_DIRECTORIES = YES
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-# The QUIET tag can be used to turn on/off the messages that are generated
+# 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
+# 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
+# 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
+# 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
-# 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
+# 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.
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
+# 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 =
+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
+# 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 =
+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
+# 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
-FILE_PATTERNS = *.h *.c
+FILE_PATTERNS = *.h *.c
-# 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.
+# 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
+# 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 = print_help.c xdgmimealias.c xdgmimealias.h xdgmime.c xdgmimeglob.c xdgmimeglob.h xdgmime.h xdgmimeint.c xdgmimeint.h xdgmimemagic.c xdgmimemagic.h xdgmimeparent.c xdgmimeparent.h
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
+# 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
+# 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.
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
-# 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 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 =
+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
+# 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 =
+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.
+# 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_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 =
+IMAGE_PATH =
-# 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 , where
-# is the value of the INPUT_FILTER tag, and 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
+# 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 , where
+# is the value of the INPUT_FILTER tag, and 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 =
+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
+# 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 =
+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
+# 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
@@ -503,38 +503,38 @@ 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
+# 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
+# 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
+# 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 = YES
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
+# 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 = YES
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
+# 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 = YES
-# 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
+# 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 = YES
@@ -543,133 +543,133 @@ VERBATIM_HEADERS = YES
# 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
+# 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
+# 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
+# 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 =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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 =
+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
+# 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)
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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
+# 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
+# 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 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])
+# 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
+# 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 = NO
-# 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
+# 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
@@ -678,74 +678,74 @@ TREEVIEW_WIDTH = 250
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = YES
-# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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 = YES
-# 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
+# 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 = YES
-# 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.
+# 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.)
+# 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
@@ -754,68 +754,68 @@ 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
+# 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
+# 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
+# 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.
+# 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
+# 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 =
+RTF_STYLESHEET_FILE =
-# Set optional variables used in the generation of an rtf document.
+# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
-RTF_EXTENSIONS_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
+# 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
+# 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 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
+# 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
@@ -824,33 +824,33 @@ 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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
@@ -859,10 +859,10 @@ 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
+# 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
@@ -871,266 +871,266 @@ 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
+# 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
+# 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
+# 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
+# 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 =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# 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
+# 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
+# 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
+# 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_PREDEFINED tags.
EXPAND_ONLY_PREDEF = NO
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# 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 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 =
+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
+# 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 =
+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
+# 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 =
+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.
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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 =
+TAGFILES =
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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
+# 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 = YES
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
+# 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
+# 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 = YES
-# 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
+# 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 = NO
-# 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
+# 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 UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# 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
+# 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
+# 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 = NO
-# 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
+# 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
+# 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 GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# 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
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# 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
+# 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 on the path.
-DOT_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
+# 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 =
+DOTFILE_DIRS =
-# 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).
+# 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
-# 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
+# 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
+# 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
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
-# The SEARCHENGINE tag specifies whether or not a search engine should be
+# 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
diff --git a/Doxyfile.help.in b/Doxyfile.help.in
index b300477b9..f5ed20c6a 100644
--- a/Doxyfile.help.in
+++ b/Doxyfile.help.in
@@ -14,191 +14,191 @@
# Project related configuration options
#---------------------------------------------------------------------------
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = fish
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
+# 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 = @PACKAGE_VERSION@
-# 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
+# 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 = help_doc
-# 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
+# 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:
-# 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, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
+# 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:
+# 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, 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
+# 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 = NO
-# 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).
+# 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
+# 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"
+# 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 = YES
-# 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
+# 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
+# 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
+# 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 = YES
-# 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
+# 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 =
+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
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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 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
+# 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
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# 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 = 8
-# 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:".
+# 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 =
+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
+# 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
+# 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
-# 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
+# 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
@@ -207,168 +207,168 @@ 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
+# 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
+# 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
+# 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 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.
+# 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.
+# 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
+# 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
+# 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
+# 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.
+# 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 = NO
-# 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
+# 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 = YES
-# 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
+# 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
+# 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]
+# 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
+# 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
+# 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.
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
-ENABLED_SECTIONS =
+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
+# 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
+# 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
+# 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.
SHOW_DIRECTORIES = YES
@@ -377,133 +377,133 @@ SHOW_DIRECTORIES = YES
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-# The QUIET tag can be used to turn on/off the messages that are generated
+# 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
+# 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
+# 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
+# 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
-# 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
+# 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.
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
+# 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 =
+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
+# 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 = doc_src
-# 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
+# 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
FILE_PATTERNS = *.doxygen
-# 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.
+# 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
+# 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 =
+EXCLUDE =
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
+# 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
+# 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.
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
-# 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 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 =
+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
+# 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 =
+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.
+# 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_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 =
+IMAGE_PATH =
-# 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 , where
-# is the value of the INPUT_FILTER tag, and 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
+# 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 , where
+# is the value of the INPUT_FILTER tag, and 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 =
+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
+# 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 =
+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
+# 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
@@ -512,38 +512,38 @@ 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
+# 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
+# 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
+# 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 = YES
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
+# 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 = YES
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
+# 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 = YES
-# 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
+# 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 = YES
@@ -552,133 +552,133 @@ VERBATIM_HEADERS = YES
# 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
+# 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
+# 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
+# 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 =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = NO
-# 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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 =
+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
+# 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)
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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
+# 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
+# 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 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])
+# 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
+# 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 = NO
-# 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
+# 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
@@ -687,74 +687,74 @@ TREEVIEW_WIDTH = 250
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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 = YES
-# 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
+# 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 = YES
-# 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.
+# 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.)
+# 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
@@ -763,68 +763,68 @@ 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
+# 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
+# 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
+# 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.
+# 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
+# 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 =
+RTF_STYLESHEET_FILE =
-# Set optional variables used in the generation of an rtf document.
+# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
-RTF_EXTENSIONS_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
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = YES
-# 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
+# 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 MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .1
-# 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
+# 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 = YES
@@ -833,33 +833,33 @@ MAN_LINKS = YES
# 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
+# 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
+# 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
+# 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 =
+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
+# 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 =
+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
+# 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
@@ -868,10 +868,10 @@ 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
+# 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
@@ -880,282 +880,282 @@ 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
+# 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
+# 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
+# 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
+# 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 =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# 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
+# 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
+# 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
+# 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_PREDEFINED tags.
EXPAND_ONLY_PREDEF = NO
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# 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 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 =
+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
+# 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 =
+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
+# 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 =
+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.
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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 =
+TAGFILES =
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# 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 =
+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
+# 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
+# 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
+# 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
+# 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
+# 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 = YES
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
+# 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
+# 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
+# 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
+# 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 UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# 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
+# 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
+# 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
+# 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
+# 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 GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# 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
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# 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
+# 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 on the path.
-DOT_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
+# 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 =
+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
+# 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
+# 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).
+# 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
-# 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
+# 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
+# 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
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
-# The SEARCHENGINE tag specifies whether or not a search engine should be
+# 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
diff --git a/Doxyfile.user b/Doxyfile.user
index f6acde7e0..99927595b 100644
--- a/Doxyfile.user
+++ b/Doxyfile.user
@@ -10,8 +10,8 @@ ABBREVIATE_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
@@ -19,7 +19,7 @@ DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
-ALIASES =
+ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
@@ -44,7 +44,7 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
@@ -53,19 +53,19 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-INPUT =
+WARN_LOGFILE =
+INPUT =
FILE_PATTERNS = doc.h
RECURSIVE = NO
-EXCLUDE =
+EXCLUDE =
EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
@@ -75,17 +75,17 @@ REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
+IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER = user_doc.head.html
-HTML_FOOTER =
-HTML_STYLESHEET =
+HTML_FOOTER =
+HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
+CHM_FILE =
+HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
@@ -99,8 +99,8 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
+EXTRA_PACKAGES =
+LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
@@ -109,33 +109,33 @@ GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
+XML_SCHEMA =
+XML_DTD =
XML_PROGRAMLISTING = YES
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
-TAGFILES =
-GENERATE_TAGFILE =
+TAGFILES =
+GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
@@ -151,8 +151,8 @@ INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
+DOT_PATH =
+DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 750
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
diff --git a/INSTALL b/INSTALL
index fefe0404e..3a039fb21 100644
--- a/INSTALL
+++ b/INSTALL
@@ -49,7 +49,7 @@ Then, use following commands to compile fish:
Finally, if you wish to use fish as your default shell, use the
following command:
- % chsh -s /usr/local/bin/fish
+ % chsh -s /usr/local/bin/fish
chsh will prompt you for your password, and change your default shell.
diff --git a/Makefile.in b/Makefile.in
index 897c5c3c1..f52b8a405 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,16 +53,16 @@ sysconfdir = @sysconfdir@
docdir = @docdir@
localedir = @localedir@
prefix = @prefix@
-optbindirs = @optbindirs@
+optbindirs = @optbindirs@
#
# Various flags
#
-MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\"
-CFLAGS = @CFLAGS@ $(MACROS)
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LIBS@ @LDFLAGS@
+MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\"
+CFLAGS = @CFLAGS@ $(MACROS) $(EXTRA_CFLAGS)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LIBS@ @LDFLAGS@
LDFLAGS_FISH = ${LDFLAGS} @LIBS_FISH@ @LDFLAGS_FISH@
LDFLAGS_FISH_INDENT = ${LDFLAGS} @LIBS_FISH_INDENT@
LDFLAGS_FISH_PAGER = ${LDFLAGS} @LIBS_FISH_PAGER@
@@ -158,7 +158,7 @@ HDR_FILES_SRC := doc_src/index.hdr.in doc_src/commands.hdr.in doc_src/design.hdr
HDR_FILES := $(subst .hdr.in,.hdr,$(HDR_FILES_SRC))
#
-# Files containing documentation for external commands.
+# Files containing documentation for external commands.
#
HELP_SRC := $(wildcard doc_src/*.txt)
@@ -208,7 +208,7 @@ MAIN_DIR_FILES := $(sort $(MAIN_DIR_FILES_UNSORTED))
# Files in ./etc/
#
-ETC_DIR_FILES :=etc/config.fish.in
+ETC_DIR_FILES :=etc/config.fish.in
#
@@ -245,7 +245,7 @@ FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
#
SIMPLE_PROGRAMS := fish set_color mimedb fish_pager fishd fish_indent
-PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL@ @SEQ_FALLBACK@
+PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL_BIN@ @SEQ_FALLBACK@
#
@@ -264,12 +264,19 @@ TRANSLATIONS_SRC := $(wildcard po/*.po)
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
+#
+# Extra util
+#
+
+XSEL := @XSEL@
+XSEL_BIN := @XSEL_BIN@
+
#
# Make everything needed for installing fish
#
all: $(PROGRAMS) user_doc share/man etc/config.fish share/config.fish $(TRANSLATIONS)
- @echo fish has now been built.
+ @echo fish has now been built.
@echo Use \'$(MAKE) install\' to install fish.
.PHONY: all
@@ -292,15 +299,18 @@ Makefile: Makefile.in configure
#
debug:
- $(MAKE) fish CFLAGS="@CFLAGS@ $(MACROS) -O0 -Wno-unused -Werror -g"
+ $(MAKE) all EXTRA_CFLAGS="-O0 -Wno-unused -Werror -g"
.PHONY: debug
+prof:
+ $(MAKE) all EXTRA_CFLAGS="-pg" LDFLAGS="-pg"
+.PHONY: prof
#
# User documentation, describing the features of the fish shell.
#
-# Depend on the sources (*.hdr.in) and manually make the
+# Depend on the sources (*.hdr.in) and manually make the
# intermediate *.hdr and doc.h files if needed
user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC)
@@ -313,19 +323,19 @@ user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC)
# Source code documentation. Also includes user documentation.
#
-doc: *.h *.c doc.h Doxyfile
- doxygen;
+doc: *.h *.c doc.h Doxyfile
+ doxygen;
#
# PDF version of the source code documentation.
#
-doc/refman.pdf: doc
- cd doc/latex;
- make;
- mv refman.pdf ..;
- cd ../..;
+doc/refman.pdf: doc
+ cd doc/latex;
+ make;
+ mv refman.pdf ..;
+ cd ../..;
rm -r doc/latex;
@@ -342,11 +352,8 @@ test: $(PROGRAMS) fish_tests
# Build the xsel program, which is maintained in its own tarball
#
-xsel-0.9.6:
- tar -xf xsel-0.9.6.tar
-
-xsel-0.9.6/xsel: xsel-0.9.6
- cd xsel-0.9.6; ./configure && make || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
+$(XSEL_BIN):
+ $(MAKE) -C $(XSEL) || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
#
@@ -362,7 +369,7 @@ doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in
echo >>command_list.tmp; \
echo >>command_list.tmp; \
echo "Back to index". >>command_list.tmp; \
- done
+ done
mv command_list.tmp command_list.txt
cat $@.in | awk '{if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@
@@ -400,19 +407,19 @@ doc.h: $(HDR_FILES)
#
%.doxygen:%.txt
- echo "/** \page " `basename $*` >$@;
- cat $*.txt >>$@;
+ echo "/** \page " `basename $*` >$@;
+ cat $*.txt >>$@;
echo "*/" >>$@
-%: %.in
+%: %.in
sed <$@.in >$@ \
-e "s,@sysconfdir\@,$(sysconfdir),g" \
-e "s,@datadir\@,$(datadir),g" \
-e "s,@docdir\@,$(docdir),g" \
-e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" \
-e "s,@prefix\@,$(prefix),g" \
- -e "s,@optbindirs\@,$(optbindirs),g"
-#-e "s,@\@,$(),"
+ -e "s,@optbindirs\@,$(optbindirs),g"
+#-e "s,@\@,$(),"
#
@@ -477,8 +484,8 @@ common.o: $(COMMON_FILES)
# (__fish_print_help)
# ||
# \/
-# formated text
-# with escape
+# formated text
+# with escape
# sequences
#
#
@@ -500,7 +507,7 @@ share/man: $(HELP_SRC)
for i in $(HELP_SRC); do \
CMD_NAME=`basename $$i .txt`; \
sed -e "s/\(.\)\\.SH/\1/" -e "s/$$CMD_NAME *\\\\- *\"\(.*\)\"/\1/" share/man/$$CMD_NAME.1; \
- done
+ done
rm doc_src/*.doxygen # Clean up intermediate files in doc_src/
rm -r help_doc # Clean up intermediate help_doc tree
@@ -565,7 +572,7 @@ install: all install-sh check-uninstall install-force
#
install-force: all install-translations
- $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
+ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
done;
@@ -595,7 +602,7 @@ install-force: all install-translations
for i in $(MANUALS); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \
done;
- @echo fish is now installed on your system.
+ @echo fish is now installed on your system.
@echo To run fish, type \'fish\' in your terminal.
@echo
@echo To use fish as your login shell:
@@ -652,7 +659,7 @@ uninstall-legacy: uninstall
-rmdir $(DESTDIR)$(sysconfdir)/fish.d/completions
-rmdir $(DESTDIR)$(sysconfdir)/fish.d
-rm $(DESTDIR)$(sysconfdir)/fish
- @echo The previous fish installation has been removed.
+ @echo The previous fish installation has been removed.
.PHONY: uninstall-legacy
install-translations: $(TRANSLATIONS)
@@ -665,7 +672,7 @@ install-translations: $(TRANSLATIONS)
fi;
.PHONY: install-translations
-uninstall-translations:
+uninstall-translations:
if test $(HAVE_GETTEXT) = 1; then \
for i in $(TRANSLATIONS_SRC); do \
rm -f $(DESTDIR)$(datadir)/locale/*/LC_MESSAGES/fish.mo; \
@@ -682,7 +689,7 @@ uninstall-translations:
# Build the fish program.
#
-fish: $(FISH_OBJS) fish.o
+fish: $(FISH_OBJS) fish.o
$(CC) $(FISH_OBJS) fish.o $(LDFLAGS_FISH) -o $@
@@ -698,7 +705,7 @@ fish_pager: $(FISH_PAGER_OBJS)
# Build the fishd program.
#
-fishd: $(FISHD_OBJS)
+fishd: $(FISHD_OBJS)
$(CC) $(FISHD_OBJS) $(LDFLAGS_FISHD) -o $@
@@ -756,7 +763,7 @@ key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_c
# Update dependencies
#
depend:
- makedepend -fMakefile.in -Y *.c
+ makedepend -fMakefile.in -Y *.c
./config.status
.PHONY: depend
@@ -765,7 +772,7 @@ depend:
# an archive from it. Simplest way I could think of to make an archive
# witout backups, autogenerated files, etc.
#
-# Uses install instead of mkdir so build won't fail if the directory
+# Uses install instead of mkdir so build won't fail if the directory
# exists
#
@@ -817,7 +824,7 @@ dist: fish-@PACKAGE_VERSION@.tar.bz2
.PHONY: dist
#
-# Build the RPM spec file.
+# Build the RPM spec file.
#
fish.spec: fish.spec.in
@@ -854,9 +861,10 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2 fish.spec
#
distclean: clean
- rm -f fish.spec Doxyfile.help
+ rm -f fish.spec Doxyfile.help
rm -f etc/config.fish seq share/config.fish
rm -f config.status config.log config.h Makefile
+ rm -rf $(XSEL)
.PHONY: distclean
@@ -868,15 +876,15 @@ distclean: clean
clean:
rm -f *.o doc.h doc.tmp doc_src/*.doxygen doc_src/*.c doc_src/*.o doc_src/commands.hdr
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
- rm -f $(PROGRAMS) fish_tests tokenizer_test key_reader
+ rm -f $(PROGRAMS) fish_tests tokenizer_test key_reader
rm -f share/config.fish etc/config.fish doc_src/index.hdr doc_src/commands.hdr
- rm -f fish-@PACKAGE_VERSION@.tar
- rm -f fish-@PACKAGE_VERSION@.tar.gz
+ rm -f fish-@PACKAGE_VERSION@.tar
+ rm -f fish-@PACKAGE_VERSION@.tar.gz
rm -f fish-@PACKAGE_VERSION@.tar.bz2
- rm -rf doc;
+ rm -rf doc;
rm -rf fish-@PACKAGE_VERSION@
- rm -rf xsel-0.9.6/
rm -f $(TRANSLATIONS)
+ -make -C $(XSEL) clean
.PHONY: clean
diff --git a/builtin.c b/builtin.c
index fe59ce292..13694aacb 100644
--- a/builtin.c
+++ b/builtin.c
@@ -83,7 +83,7 @@
#define FG_MSG _( L"Send job %d, '%ls' to foreground\n" )
/**
- Datastructure to describe a builtin.
+ Datastructure to describe a builtin.
*/
typedef struct builtin_data
{
@@ -152,7 +152,7 @@ static int builtin_count_args( wchar_t **argv )
return argc;
}
-/**
+/**
This function works like wperror, but it prints its result into
the sb_err string_buffer_t instead of to stderr. Used by the builtin
commands.
@@ -191,7 +191,7 @@ wchar_t *builtin_help_get( const wchar_t *name )
array_list_t lst;
string_buffer_t cmd;
wchar_t *name_esc;
-
+
/*
Because the contents of this buffer is returned by this
function, it must not be free'd on exit, so we allocate it
@@ -199,10 +199,10 @@ wchar_t *builtin_help_get( const wchar_t *name )
*/
static string_buffer_t *out = 0;
int i;
-
+
al_init( &lst );
sb_init( &cmd );
-
+
if( !out )
{
out = sb_halloc( global_context );
@@ -214,24 +214,24 @@ wchar_t *builtin_help_get( const wchar_t *name )
name_esc = escape( name, 1 );
sb_printf( &cmd, L"__fish_print_help %ls", name_esc );
-
+
if( exec_subshell( (wchar_t *)cmd.buff, &lst ) >= 0 )
- {
+ {
for( i=0; ibuff;
-
+
}
/**
@@ -242,15 +242,15 @@ wchar_t *builtin_help_get( const wchar_t *name )
message is about to be printed to an interactive screen, it may be
shortened to fit the screen.
-
+
*/
static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
{
-
+
const wchar_t *h;
int is_short = 0;
-
+
if( b == sb_err )
{
sb_append( sb_err,
@@ -268,12 +268,12 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
if( b==sb_err )
{
-
+
/*
Interactive mode help to screen - only print synopsis if
- the rest won't fit
+ the rest won't fit
*/
-
+
int screen_height, lines;
screen_height = common_get_height();
@@ -283,24 +283,24 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
wchar_t *pos;
int cut=0;
int i;
-
+
is_short = 1;
-
+
/*
First move down 4 lines
*/
-
+
pos = str;
for( i=0; (i<4) && pos && *pos; i++ )
{
pos = wcschr( pos+1, L'\n' );
}
-
+
if( pos && *pos )
{
-
- /*
- Then find the next empty line
+
+ /*
+ Then find the next empty line
*/
for( ; *pos; pos++ )
{
@@ -308,12 +308,12 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
{
wchar_t *pos2;
int is_empty = 1;
-
+
for( pos2 = pos+1; *pos2; pos2++ )
{
if( *pos2 == L'\n' )
break;
-
+
if( *pos2 != L'\t' && *pos2 !=L' ' )
{
is_empty = 0;
@@ -332,7 +332,7 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
}
}
}
-
+
/*
We did not find a good place to cut message to
shorten it - so we make sure we don't print
@@ -345,13 +345,13 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
}
}
-
+
sb_append( b, str );
if( is_short )
{
sb_printf( b, _(L"%ls: Type 'help %ls' for related documentation\n\n"), cmd, cmd );
}
-
+
free( str );
}
}
@@ -414,18 +414,18 @@ static void builtin_bind_list()
{
array_list_t lst;
int i;
-
-
+
+
al_init( &lst );
input_mapping_get_names( &lst );
-
+
for( i=0; itype != FUNCTION_CALL &&
block->type != FUNCTION_CALL_NO_SHADOW )
block = block->outer;
@@ -925,7 +925,7 @@ static int builtin_builtin( wchar_t **argv )
woptind=0;
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -991,11 +991,11 @@ static int builtin_builtin( wchar_t **argv )
al_init( &names );
builtin_get_names( &names );
sort_list( &names );
-
+
for( i=0; iparam1.param );
break;
}
-
+
}
}
al_destroy( &ev );
-
+
named = function_get_named_arguments( name );
if( named )
{
@@ -1230,7 +1230,7 @@ static void functions_def( wchar_t *name, string_buffer_t *out )
sb_printf( out, L" %ls", (wchar_t *)al_get( named, i ) );
}
}
-
+
sb_printf( out, L"\n\t%ls\nend\n", def );
}
@@ -1252,10 +1252,11 @@ static int builtin_functions( wchar_t **argv )
int show_hidden=0;
int res = STATUS_BUILTIN_OK;
int query = 0;
+ int copy = 0;
woptind=0;
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -1282,6 +1283,10 @@ static int builtin_functions( wchar_t **argv )
L"query", no_argument, 0, 'q'
}
,
+ {
+ L"copy", no_argument, 0, 'c'
+ }
+ ,
{
0, 0, 0, 0
}
@@ -1294,7 +1299,7 @@ static int builtin_functions( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
- L"ed:nahq",
+ L"ed:nahqc",
long_options,
&opt_index );
if( opt == -1 )
@@ -1305,10 +1310,10 @@ static int builtin_functions( wchar_t **argv )
case 0:
if(long_options[opt_index].flag != 0)
break;
- sb_printf( sb_err,
- BUILTIN_ERR_UNKNOWN,
- argv[0],
- long_options[opt_index].name );
+ sb_printf( sb_err,
+ BUILTIN_ERR_UNKNOWN,
+ argv[0],
+ long_options[opt_index].name );
builtin_print_help( argv[0], sb_err );
@@ -1338,6 +1343,10 @@ static int builtin_functions( wchar_t **argv )
query = 1;
break;
+ case 'c':
+ copy = 1;
+ break;
+
case '?':
builtin_unknown_option( argv[0], argv[woptind-1] );
return STATUS_BUILTIN_ERROR;
@@ -1347,9 +1356,9 @@ static int builtin_functions( wchar_t **argv )
}
/*
- Erase, desc, query and list are mutually exclusive
+ Erase, desc, query, copy and list are mutually exclusive
*/
- if( (erase + (!!desc) + list + query) > 1 )
+ if( (erase + (!!desc) + list + query + copy) > 1 )
{
sb_printf( sb_err,
_( L"%ls: Invalid combination of options\n" ),
@@ -1434,6 +1443,61 @@ static int builtin_functions( wchar_t **argv )
al_destroy( &names );
return STATUS_BUILTIN_OK;
}
+ else if( copy )
+ {
+ wchar_t *current_func;
+ wchar_t *new_func;
+
+ if( argc-woptind != 2 )
+ {
+ sb_printf( sb_err,
+ _( L"%ls: Expected exactly two names (current function name, and new function name)\n" ),
+ argv[0] );
+ builtin_print_help ( argv[0], sb_err );
+
+ return STATUS_BUILTIN_ERROR;
+ }
+ current_func = argv[woptind];
+ new_func = argv[woptind+1];
+
+ if( !function_exists( current_func ) )
+ {
+ sb_printf( sb_err,
+ _( L"%ls: Function '%ls' does not exist\n" ),
+ argv[0],
+ current_func );
+ builtin_print_help( argv[0], sb_err );
+
+ return STATUS_BUILTIN_ERROR;
+ }
+
+ if( (wcsfuncname( new_func ) != 0) || parser_keywords_is_reserved( new_func ) )
+ {
+ sb_printf( sb_err,
+ _( L"%ls: Illegal function name '%ls'\n"),
+ argv[0],
+ new_func );
+ builtin_print_help( argv[0], sb_err );
+ return STATUS_BUILTIN_ERROR;
+ }
+
+ // keep things simple: don't allow existing names to be copy targets.
+ if( function_exists( new_func ) )
+ {
+ sb_printf( sb_err,
+ _( L"%ls: Function '%ls' already exists. Cannot create copy '%ls'\n" ),
+ argv[0],
+ new_func,
+ current_func );
+ builtin_print_help( argv[0], sb_err );
+
+ return STATUS_BUILTIN_ERROR;
+ }
+
+ if( function_copy( current_func, new_func ) )
+ return STATUS_BUILTIN_OK;
+ return STATUS_BUILTIN_ERROR;
+ }
for( i=woptind; itype = EVENT_GENERIC;
e->param1.param = halloc_wcsdup( current_block, woptarg );
e->function_name=0;
@@ -1622,7 +1686,7 @@ static int builtin_function( wchar_t **argv )
e = halloc( current_block, sizeof(event_t));
if( !e )
DIE_MEM();
-
+
if( ( opt == 'j' ) &&
( wcscasecmp( woptarg, L"caller" ) == 0 ) )
{
@@ -1693,15 +1757,15 @@ static int builtin_function( wchar_t **argv )
if( !named_arguments )
named_arguments = al_halloc( current_block );
break;
-
+
case 'S':
shadows = 0;
break;
-
+
case 'h':
builtin_print_help( argv[0], sb_out );
return STATUS_BUILTIN_OK;
-
+
case '?':
builtin_unknown_option( argv[0], argv[woptind-1] );
res = 1;
@@ -1713,7 +1777,7 @@ static int builtin_function( wchar_t **argv )
if( !res )
{
-
+
if( argc == woptind )
{
sb_printf( sb_err,
@@ -1744,7 +1808,7 @@ static int builtin_function( wchar_t **argv )
{
name = argv[woptind++];
-
+
if( named_arguments )
{
while( woptind < argc )
@@ -1758,7 +1822,7 @@ static int builtin_function( wchar_t **argv )
res = STATUS_BUILTIN_ERROR;
break;
}
-
+
al_push( named_arguments, halloc_wcsdup( current_block, argv[woptind++] ) );
}
}
@@ -1769,7 +1833,7 @@ static int builtin_function( wchar_t **argv )
argv[0],
argc );
res=1;
-
+
}
}
}
@@ -1811,13 +1875,13 @@ static int builtin_function( wchar_t **argv )
else
{
function_data_t * d = halloc( current_block, sizeof( function_data_t ));
-
+
d->name=halloc_wcsdup( current_block, name);
d->description=desc?halloc_wcsdup( current_block, desc):0;
d->events = events;
d->named_arguments = named_arguments;
d->shadows = shadows;
-
+
for( i=0; idata = d;
-
+
}
-
+
current_block->tok_pos = parser_get_pos();
current_block->skip = 1;
@@ -1842,12 +1906,12 @@ static int builtin_random( wchar_t **argv )
{
static int seeded=0;
static struct drand48_data seed_buffer;
-
+
int argc = builtin_count_args( argv );
woptind=0;
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -1903,14 +1967,14 @@ static int builtin_random( wchar_t **argv )
case 0:
{
long res;
-
+
if( !seeded )
{
seeded=1;
srand48_r(time(0), &seed_buffer);
}
lrand48_r( &seed_buffer, &res );
-
+
sb_printf( sb_out, L"%d\n", abs(res%32767) );
break;
}
@@ -1965,12 +2029,12 @@ static int builtin_read( wchar_t **argv )
int exit_res=STATUS_BUILTIN_OK;
wchar_t *mode_name = READ_MODE_NAME;
int shell = 0;
-
+
woptind=0;
-
+
while( 1 )
{
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -2077,7 +2141,7 @@ static int builtin_read( wchar_t **argv )
case 's':
shell = 1;
break;
-
+
case 'h':
builtin_print_help( argv[0], sb_out );
return STATUS_BUILTIN_OK;
@@ -2146,7 +2210,7 @@ static int builtin_read( wchar_t **argv )
if( isatty(0) && builtin_stdin == 0 )
{
wchar_t *line;
-
+
reader_push( mode_name );
reader_set_prompt( prompt );
if( shell )
@@ -2155,10 +2219,10 @@ static int builtin_read( wchar_t **argv )
reader_set_highlight_function( &highlight_shell );
reader_set_test_function( &reader_shell_test );
}
-
+
reader_set_buffer( commandline, wcslen( commandline ) );
proc_push_interactive( 1 );
-
+
event_fire_generic(L"fish_prompt");
line = reader_readline( );
proc_pop_interactive();
@@ -2176,9 +2240,9 @@ static int builtin_read( wchar_t **argv )
{
string_buffer_t sb;
int eof=0;
-
+
sb_init( &sb );
-
+
while( 1 )
{
int finished=0;
@@ -2232,32 +2296,32 @@ static int builtin_read( wchar_t **argv )
{
exit_res = 1;
}
-
+
buff = wcsdup( (wchar_t *)sb.buff );
sb_destroy( &sb );
}
if( i != argc && !exit_res )
{
-
+
wchar_t *state;
ifs = env_get( L"IFS" );
if( ifs == 0 )
ifs = L"";
-
+
nxt = wcstok( buff, (iparam1.source_dest = fn_intern;
-
+
parse_util_set_argv( (argc>2)?(argv+2):(argv+1), 0);
-
+
res = reader_read( fd, real_io );
-
+
parser_pop_block();
-
+
if( res )
{
sb_printf( sb_err,
@@ -2855,12 +2919,12 @@ static int builtin_source( wchar_t ** argv )
{
res = proc_get_last_status();
}
-
+
/*
Do not close fd after calling reader_read. reader_read
automatically closes it before calling eval.
*/
-
+
reader_pop_current_filename();
return res;
@@ -2910,7 +2974,7 @@ static int builtin_fg( wchar_t **argv )
*/
for( j=first_job; j; j=j->next )
{
- if( job_get_flag( j, JOB_CONSTRUCTED ) && (!job_is_completed(j)) &&
+ if( job_get_flag( j, JOB_CONSTRUCTED ) && (!job_is_completed(j)) &&
( (job_is_stopped(j) || (!job_get_flag(j, JOB_FOREGROUND)) ) && job_get_flag( j, JOB_CONTROL) ) )
{
break;
@@ -2935,16 +2999,16 @@ static int builtin_fg( wchar_t **argv )
wchar_t *endptr;
int pid;
int found_job = 0;
-
+
errno = 0;
pid = wcstol( argv[1], &endptr, 10 );
if( !( *endptr || errno ) )
- {
+ {
j = job_get_from_pid( pid );
if( j )
found_job = 1;
}
-
+
if( found_job )
{
sb_printf( sb_err,
@@ -2966,11 +3030,11 @@ static int builtin_fg( wchar_t **argv )
}
else
{
- wchar_t *end;
+ wchar_t *end;
int pid;
errno = 0;
pid = abs(wcstol( argv[1], &end, 10 ));
-
+
if( *end || errno )
{
sb_printf( sb_err,
@@ -3095,7 +3159,7 @@ static int builtin_bg( wchar_t **argv )
break;
}
}
-
+
if( !j )
{
sb_printf( sb_err,
@@ -3114,7 +3178,7 @@ static int builtin_bg( wchar_t **argv )
int i;
int pid;
int err = 0;
-
+
for( i=1; argv[i]; i++ )
{
errno=0;
@@ -3127,7 +3191,7 @@ static int builtin_bg( wchar_t **argv )
argv[i] );
err = 1;
break;
- }
+ }
}
if( !err )
@@ -3139,7 +3203,7 @@ static int builtin_bg( wchar_t **argv )
}
}
}
-
+
return res;
}
@@ -3294,7 +3358,7 @@ static int builtin_end( wchar_t **argv )
env_set( current_block->param1.for_variable, val, ENV_LOCAL);
current_block->loop_status = LOOP_NORMAL;
current_block->skip = 0;
-
+
kill_block = 0;
parser_set_pos( current_block->tok_pos );
}
@@ -3303,9 +3367,9 @@ static int builtin_end( wchar_t **argv )
case FUNCTION_DEF:
{
-
+
function_data_t *d = (function_data_t *)current_block->data;
-
+
if( d )
{
/**
@@ -3317,13 +3381,13 @@ static int builtin_end( wchar_t **argv )
wchar_t *def = wcsndup( parser_get_buffer()+current_block->tok_pos,
parser_get_job_pos()-current_block->tok_pos );
d->definition = def;
-
- function_add( d );
+
+ function_add( d );
free( def );
}
else
{
- debug(0,
+ debug(0,
_(L"%ls: Missing function definition information."),
argv[0] );
bugreport();
@@ -3432,12 +3496,12 @@ static int builtin_break_continue( wchar_t **argv )
static int builtin_breakpoint( wchar_t **argv )
{
- parser_push_block( BREAKPOINT );
-
- reader_read( 0, real_io );
-
- parser_pop_block();
-
+ parser_push_block( BREAKPOINT );
+
+ reader_read( STDIN_FILENO, real_io );
+
+ parser_pop_block();
+
return proc_get_last_status();
}
@@ -3482,7 +3546,7 @@ static int builtin_return( wchar_t **argv )
while( (b != 0) &&
- ( b->type != FUNCTION_CALL &&
+ ( b->type != FUNCTION_CALL &&
b->type != FUNCTION_CALL_NO_SHADOW) )
{
b = b->outer;
@@ -3537,7 +3601,7 @@ static int builtin_switch( wchar_t **argv )
current_block->skip=1;
current_block->param2.switch_taken=0;
}
-
+
return res;
}
@@ -3550,7 +3614,7 @@ static int builtin_case( wchar_t **argv )
int argc = builtin_count_args( argv );
int i;
wchar_t *unescaped=0;
-
+
if( current_block->type != SWITCH )
{
sb_printf( sb_err,
@@ -3559,22 +3623,22 @@ static int builtin_case( wchar_t **argv )
builtin_print_help( argv[0], sb_err );
return STATUS_BUILTIN_ERROR;
}
-
+
current_block->skip = 1;
-
+
if( current_block->param2.switch_taken )
{
return STATUS_BUILTIN_OK;
}
-
+
for( i=1; iparam1.switch_value, unescaped );
free( unescaped );
-
+
if( match )
{
current_block->skip = 0;
@@ -3582,7 +3646,7 @@ static int builtin_case( wchar_t **argv )
break;
}
}
-
+
return STATUS_BUILTIN_OK;
}
@@ -3595,7 +3659,7 @@ static int builtin_case( wchar_t **argv )
/**
Data about all the builtin commands in fish
*/
-const static builtin_data_t builtin_data[]=
+static const builtin_data_t builtin_data[]=
{
{
L"block", &builtin_block, N_( L"Temporarily block delivery of events" )
@@ -3606,15 +3670,15 @@ const static builtin_data_t builtin_data[]=
}
,
{
- L"cd", &builtin_cd, N_( L"Change working directory" )
+ L"cd", &builtin_cd, N_( L"Change working directory" )
}
,
{
- L"count", &builtin_count, N_( L"Count the number of arguments" )
+ L"count", &builtin_count, N_( L"Count the number of arguments" )
}
,
{
- L"contains", &builtin_contains, N_( L"Search for a specified string in a list" )
+ L"contains", &builtin_contains, N_( L"Search for a specified string in a list" )
}
,
{
@@ -3626,99 +3690,99 @@ const static builtin_data_t builtin_data[]=
}
,
{
- L"function", &builtin_function, N_( L"Define a new function" )
+ L"function", &builtin_function, N_( L"Define a new function" )
}
,
{
- L"functions", &builtin_functions, N_( L"List or remove functions" )
+ L"functions", &builtin_functions, N_( L"List or remove functions" )
}
,
{
- L"complete", &builtin_complete, N_( L"Edit command specific completions" )
+ L"complete", &builtin_complete, N_( L"Edit command specific completions" )
}
,
{
- L"end", &builtin_end, N_( L"End a block of commands" )
+ L"end", &builtin_end, N_( L"End a block of commands" )
}
,
{
- L"else", &builtin_else, N_( L"Evaluate block if condition is false" )
+ L"else", &builtin_else, N_( L"Evaluate block if condition is false" )
}
,
{
- L"for", &builtin_for, N_( L"Perform a set of commands multiple times" )
+ L"for", &builtin_for, N_( L"Perform a set of commands multiple times" )
}
,
{
- L".", &builtin_source, N_( L"Evaluate contents of file" )
+ L".", &builtin_source, N_( L"Evaluate contents of file" )
}
,
{
- L"set", &builtin_set, N_( L"Handle environment variables" )
+ L"set", &builtin_set, N_( L"Handle environment variables" )
}
,
{
- L"fg", &builtin_fg, N_( L"Send job to foreground" )
+ L"fg", &builtin_fg, N_( L"Send job to foreground" )
}
,
{
- L"bg", &builtin_bg, N_( L"Send job to background" )
+ L"bg", &builtin_bg, N_( L"Send job to background" )
}
,
{
- L"jobs", &builtin_jobs, N_( L"Print currently running jobs" )
+ L"jobs", &builtin_jobs, N_( L"Print currently running jobs" )
}
,
{
- L"read", &builtin_read, N_( L"Read a line of input into variables" )
+ L"read", &builtin_read, N_( L"Read a line of input into variables" )
}
,
{
- L"break", &builtin_break_continue, N_( L"Stop the innermost loop" )
+ L"break", &builtin_break_continue, N_( L"Stop the innermost loop" )
}
,
{
- L"continue", &builtin_break_continue, N_( L"Skip the rest of the current lap of the innermost loop" )
+ L"continue", &builtin_break_continue, N_( L"Skip the rest of the current lap of the innermost loop" )
}
,
{
- L"return", &builtin_return, N_( L"Stop the currently evaluated function" )
+ L"return", &builtin_return, N_( L"Stop the currently evaluated function" )
}
,
{
- L"commandline", &builtin_commandline, N_( L"Set or get the commandline" )
+ L"commandline", &builtin_commandline, N_( L"Set or get the commandline" )
}
,
{
- L"switch", &builtin_switch, N_( L"Conditionally execute a block of commands" )
+ L"switch", &builtin_switch, N_( L"Conditionally execute a block of commands" )
}
,
{
- L"case", &builtin_case, N_( L"Conditionally execute a block of commands" )
+ L"case", &builtin_case, N_( L"Conditionally execute a block of commands" )
}
,
{
- L"bind", &builtin_bind, N_( L"Handle fish key bindings" )
+ L"bind", &builtin_bind, N_( L"Handle fish key bindings" )
}
,
{
- L"random", &builtin_random, N_( L"Generate random number" )
+ L"random", &builtin_random, N_( L"Generate random number" )
}
,
{
- L"status", &builtin_status, N_( L"Return status information about fish" )
+ L"status", &builtin_status, N_( L"Return status information about fish" )
}
,
{
- L"ulimit", &builtin_ulimit, N_( L"Set or get the shells resource usage limits" )
+ L"ulimit", &builtin_ulimit, N_( L"Set or get the shells resource usage limits" )
}
,
{
- L"begin", &builtin_begin, N_( L"Create a block of code" )
+ L"begin", &builtin_begin, N_( L"Create a block of code" )
}
,
{
- L"breakpoint", &builtin_breakpoint, N_( L"Temporarily halt execution of a script and launch an interactive debug prompt" )
+ L"breakpoint", &builtin_breakpoint, N_( L"Temporarily halt execution of a script and launch an interactive debug prompt" )
}
,
@@ -3728,31 +3792,31 @@ const static builtin_data_t builtin_data[]=
listings of builtin commands, etc..
*/
{
- L"command", &builtin_generic, N_( L"Run a program instead of a function or builtin" )
+ L"command", &builtin_generic, N_( L"Run a program instead of a function or builtin" )
}
,
{
- L"if", &builtin_generic, N_( L"Evaluate block if condition is true" )
+ L"if", &builtin_generic, N_( L"Evaluate block if condition is true" )
}
,
{
- L"while", &builtin_generic, N_( L"Perform a command multiple times" )
+ L"while", &builtin_generic, N_( L"Perform a command multiple times" )
}
,
{
- L"not", &builtin_generic, N_( L"Negate exit status of job" )
+ L"not", &builtin_generic, N_( L"Negate exit status of job" )
}
,
{
- L"and", &builtin_generic, N_( L"Execute command if previous command suceeded" )
+ L"and", &builtin_generic, N_( L"Execute command if previous command suceeded" )
}
,
{
- L"or", &builtin_generic, N_( L"Execute command if previous command failed" )
+ L"or", &builtin_generic, N_( L"Execute command if previous command failed" )
}
,
{
- L"exec", &builtin_generic, N_( L"Run command in current process" )
+ L"exec", &builtin_generic, N_( L"Run command in current process" )
}
,
{
@@ -3760,13 +3824,13 @@ const static builtin_data_t builtin_data[]=
}
}
;
-
+
void builtin_init()
{
-
+
int i;
-
+
wopterr = 0;
al_init( &io_stack );
@@ -3795,7 +3859,7 @@ void builtin_destroy()
int builtin_exists( wchar_t *cmd )
{
CHECK( cmd, 0 );
-
+
return !!hash_get(&builtin, cmd);
}
@@ -3815,12 +3879,12 @@ int builtin_run( wchar_t **argv, io_data_t *io )
{
int (*cmd)(wchar_t **argv)=0;
real_io = io;
-
+
CHECK( argv, STATUS_BUILTIN_ERROR );
CHECK( argv[0], STATUS_BUILTIN_ERROR );
-
+
cmd = (int (*)(wchar_t **))hash_get( &builtin, argv[0] );
-
+
if( argv[1] != 0 && !internal_help(argv[0]) )
{
if( argv[2] == 0 && (parser_is_help( argv[1], 0 ) ) )
@@ -3848,14 +3912,14 @@ int builtin_run( wchar_t **argv, io_data_t *io )
void builtin_get_names( array_list_t *list )
{
- CHECK( list, );
+ CHECK( list, );
hash_get_keys( &builtin, list );
}
const wchar_t *builtin_get_desc( const wchar_t *b )
{
CHECK( b, 0 );
-
+
if( !desc )
{
int i;
diff --git a/builtin.h b/builtin.h
index 245fe16c1..876c5d389 100644
--- a/builtin.h
+++ b/builtin.h
@@ -64,7 +64,7 @@ enum
#define BUILTIN_FOR_ERR_IN _( L"%ls: Second argument must be 'in'\n" )
/**
- Error message for insufficient number of arguments
+ Error message for insufficient number of arguments
*/
#define BUILTIN_FOR_ERR_COUNT _( L"%ls: Expected at least two arguments, got %d\n")
@@ -108,7 +108,7 @@ extern int builtin_err_redirect;
/**
- Initialize builtin data.
+ Initialize builtin data.
*/
void builtin_init();
@@ -123,11 +123,11 @@ void builtin_destroy();
int builtin_exists( wchar_t *cmd );
/**
- Execute a builtin command
+ Execute a builtin command
- \param argv Array containing the command and parameters
+ \param argv Array containing the command and parameters
of the builtin. The list is terminated by a
- null pointer. This syntax resembles the syntax
+ null pointer. This syntax resembles the syntax
for exec.
\param io the io redirections to perform on this builtin.
diff --git a/builtin_commandline.c b/builtin_commandline.c
index db43a18d7..f23e1153f 100644
--- a/builtin_commandline.c
+++ b/builtin_commandline.c
@@ -1,6 +1,6 @@
/** \file builtin_commandline.c Functions defining the commandline builtin
-Functions used for implementing the commandline builtin.
+Functions used for implementing the commandline builtin.
*/
#include "config.h"
@@ -96,20 +96,20 @@ static void replace_part( const wchar_t *begin,
const wchar_t *buff = get_buffer();
string_buffer_t out;
int out_pos=get_cursor_pos();
-
+
sb_init( &out );
sb_append_substring( &out, buff, begin-buff );
-
+
switch( append_mode)
{
case REPLACE_MODE:
{
-
+
sb_append( &out, insert );
- out_pos = wcslen( insert ) + (begin-buff);
+ out_pos = wcslen( insert ) + (begin-buff);
break;
-
+
}
case APPEND_MODE:
{
@@ -123,7 +123,7 @@ static void replace_part( const wchar_t *begin,
sb_append_substring( &out, begin, cursor );
sb_append( &out, insert );
sb_append_substring( &out, begin+cursor, end-begin-cursor );
- out_pos += wcslen( insert );
+ out_pos += wcslen( insert );
break;
}
}
@@ -131,7 +131,7 @@ static void replace_part( const wchar_t *begin,
reader_set_buffer( (wchar_t *)out.buff, out_pos );
sb_destroy( &out );
}
-
+
/**
Output the specified selection.
@@ -140,11 +140,11 @@ static void replace_part( const wchar_t *begin,
\param cut_at_cursor whether printing should stop at the surrent cursor position
\param tokenize whether the string should be tokenized, printing one string token on every line and skipping non-string tokens
*/
-static void write_part( const wchar_t *begin,
- const wchar_t *end,
- int cut_at_cursor,
+static void write_part( const wchar_t *begin,
+ const wchar_t *end,
+ int cut_at_cursor,
int tokenize )
-{
+{
tokenizer tok;
string_buffer_t out;
wchar_t *buff;
@@ -157,7 +157,7 @@ static void write_part( const wchar_t *begin,
buff = wcsndup( begin, end-begin );
// fwprintf( stderr, L"Subshell: %ls, end char %lc\n", buff, *end );
sb_init( &out );
-
+
for( tok_init( &tok, buff, TOK_ACCEPT_UNFINISHED );
tok_has_next( &tok );
tok_next( &tok ) )
@@ -165,7 +165,7 @@ static void write_part( const wchar_t *begin,
if( (cut_at_cursor) &&
(tok_get_pos( &tok)+wcslen(tok_last( &tok)) >= pos) )
break;
-
+
switch( tok_last_type( &tok ) )
{
case TOK_STRING:
@@ -175,13 +175,13 @@ static void write_part( const wchar_t *begin,
free( tmp );
break;
}
-
- }
+
+ }
}
sb_append( sb_out,
(wchar_t *)out.buff );
-
+
free( buff );
tok_destroy( &tok );
sb_destroy( &out );
@@ -189,10 +189,10 @@ static void write_part( const wchar_t *begin,
else
{
wchar_t *buff, *esc;
-
+
if( cut_at_cursor )
{
- end = begin+pos;
+ end = begin+pos;
}
buff = wcsndup( begin, end-begin );
@@ -202,10 +202,10 @@ static void write_part( const wchar_t *begin,
sb_append( sb_out, esc );
sb_append( sb_out, L"\n" );
-
+
free( esc );
free( buff );
-
+
}
}
@@ -219,14 +219,14 @@ static int builtin_commandline( wchar_t **argv )
int buffer_part=0;
int cut_at_cursor=0;
-
+
int argc = builtin_count_args( argv );
int append_mode=0;
int function_mode = 0;
-
- int tokenize = 0;
-
+
+ int tokenize = 0;
+
int cursor_mode = 0;
int line_mode = 0;
int search_mode = 0;
@@ -254,7 +254,7 @@ static int builtin_commandline( wchar_t **argv )
*/
return 1;
}
-
+
sb_append( sb_err,
argv[0],
L": Can not set commandline in non-interactive mode\n",
@@ -267,7 +267,7 @@ static int builtin_commandline( wchar_t **argv )
while( 1 )
{
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -293,11 +293,11 @@ static int builtin_commandline( wchar_t **argv )
{
L"current-token", no_argument, 0, 't'
}
- ,
+ ,
{
L"current-buffer", no_argument, 0, 'b'
}
- ,
+ ,
{
L"cut-at-cursor", no_argument, 0, 'c'
}
@@ -314,7 +314,7 @@ static int builtin_commandline( wchar_t **argv )
L"help", no_argument, 0, 'h'
}
,
- {
+ {
L"input", required_argument, 0, 'I'
}
,
@@ -331,21 +331,21 @@ static int builtin_commandline( wchar_t **argv )
}
,
{
- 0, 0, 0, 0
+ 0, 0, 0, 0
}
}
- ;
-
+ ;
+
int opt_index = 0;
-
+
int opt = wgetopt_long( argc,
- argv,
- L"abijpctwforhI:CLS",
- long_options,
+ argv,
+ L"abijpctwforhI:CLS",
+ long_options,
&opt_index );
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
@@ -358,7 +358,7 @@ static int builtin_commandline( wchar_t **argv )
builtin_print_help( argv[0], sb_err );
return 1;
-
+
case L'a':
append_mode = APPEND_MODE;
break;
@@ -366,8 +366,8 @@ static int builtin_commandline( wchar_t **argv )
case L'b':
buffer_part = STRING_MODE;
break;
-
-
+
+
case L'i':
append_mode = INSERT_MODE;
break;
@@ -375,11 +375,11 @@ static int builtin_commandline( wchar_t **argv )
case L'r':
append_mode = REPLACE_MODE;
break;
-
+
case 'c':
cut_at_cursor=1;
break;
-
+
case 't':
buffer_part = TOKEN_MODE;
break;
@@ -404,33 +404,33 @@ static int builtin_commandline( wchar_t **argv )
current_buffer = woptarg;
current_cursor_pos = wcslen( woptarg );
break;
-
+
case 'C':
cursor_mode = 1;
break;
-
+
case 'L':
line_mode = 1;
break;
-
+
case 'S':
search_mode = 1;
break;
-
+
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case L'?':
builtin_unknown_option( argv[0], argv[woptind-1] );
- return 1;
+ return 1;
}
- }
+ }
if( function_mode )
{
int i;
-
+
/*
Check for invalid switch combinations
*/
@@ -439,18 +439,18 @@ static int builtin_commandline( wchar_t **argv )
sb_printf(sb_err,
BUILTIN_ERR_COMBO,
argv[0] );
-
+
builtin_print_help( argv[0], sb_err );
return 1;
}
-
+
if( argc == woptind )
{
sb_printf( sb_err,
BUILTIN_ERR_MISSING,
argv[0] );
-
+
builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -476,16 +476,16 @@ static int builtin_commandline( wchar_t **argv )
return 1;
}
}
-
- return 0;
+
+ return 0;
}
-
+
/*
Check for invalid switch combinations
*/
if( (search_mode || line_mode || cursor_mode) && (argc-woptind > 1) )
{
-
+
sb_append( sb_err,
argv[0],
L": Too many arguments\n",
@@ -495,15 +495,15 @@ static int builtin_commandline( wchar_t **argv )
}
if( (buffer_part || tokenize || cut_at_cursor) && (cursor_mode || line_mode || search_mode) )
- {
+ {
sb_printf( sb_err,
BUILTIN_ERR_COMBO,
argv[0] );
builtin_print_help( argv[0], sb_err );
return 1;
- }
-
+ }
+
if( (tokenize || cut_at_cursor) && (argc-woptind) )
{
@@ -511,7 +511,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_COMBO2,
argv[0],
L"--cut-at-cursor and --tokenize can not be used when setting the commandline" );
-
+
builtin_print_help( argv[0], sb_err );
return 1;
@@ -524,7 +524,7 @@ static int builtin_commandline( wchar_t **argv )
argv[0],
L"insertion mode switches can not be used when not in insertion mode" );
- builtin_print_help( argv[0], sb_err );
+ builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -535,7 +535,7 @@ static int builtin_commandline( wchar_t **argv )
{
append_mode = REPLACE_MODE;
}
-
+
if( !buffer_part )
{
buffer_part = STRING_MODE;
@@ -548,7 +548,7 @@ static int builtin_commandline( wchar_t **argv )
wchar_t *endptr;
int new_pos;
errno = 0;
-
+
new_pos = wcstol( argv[woptind], &endptr, 10 );
if( *endptr || errno )
{
@@ -558,7 +558,7 @@ static int builtin_commandline( wchar_t **argv )
argv[woptind] );
builtin_print_help( argv[0], sb_err );
}
-
+
current_buffer = reader_get_buffer();
new_pos = maxi( 0, mini( new_pos, wcslen( current_buffer ) ) );
reader_set_buffer( current_buffer, new_pos );
@@ -569,98 +569,98 @@ static int builtin_commandline( wchar_t **argv )
sb_printf( sb_out, L"%d\n", reader_get_cursor_pos() );
return 0;
}
-
+
}
-
+
if( line_mode )
{
int pos = reader_get_cursor_pos();
wchar_t *buff = reader_get_buffer();
sb_printf( sb_out, L"%d\n", parse_util_lineno( buff, pos ) );
return 0;
-
+
}
-
+
if( search_mode )
{
return !reader_search_mode();
}
-
-
+
+
switch( buffer_part )
{
case STRING_MODE:
- {
+ {
begin = get_buffer();
end = begin+wcslen(begin);
- break;
+ break;
}
case PROCESS_MODE:
{
parse_util_process_extent( get_buffer(),
get_cursor_pos(),
- &begin,
+ &begin,
&end );
break;
}
-
+
case JOB_MODE:
{
parse_util_job_extent( get_buffer(),
get_cursor_pos(),
&begin,
- &end );
- break;
+ &end );
+ break;
}
-
+
case TOKEN_MODE:
{
parse_util_token_extent( get_buffer(),
get_cursor_pos(),
- &begin,
- &end,
+ &begin,
+ &end,
0, 0 );
- break;
+ break;
}
-
+
}
switch(argc-woptind)
{
case 0:
- {
+ {
write_part( begin, end, cut_at_cursor, tokenize );
break;
}
-
+
case 1:
{
replace_part( begin, end, argv[woptind], append_mode );
break;
- }
+ }
default:
{
string_buffer_t sb;
int i;
-
+
sb_init( &sb );
-
+
sb_append( &sb, argv[woptind] );
-
+
for( i=woptind+1; iflags & COMPLETE_NO_CASE )
{
prepend = L"";
@@ -571,7 +571,7 @@ static int builtin_complete( wchar_t **argv )
{
prepend = token;
}
-
+
if( next->description )
{
@@ -582,17 +582,17 @@ static int builtin_complete( wchar_t **argv )
sb_printf( sb_out, L"%ls%ls\n", prepend, next->completion );
}
}
-
+
halloc_free( comp );
recursion_level--;
}
-
- temporary_buffer = prev_temporary_buffer;
-
+
+ temporary_buffer = prev_temporary_buffer;
+
}
else if( woptind != argc )
{
- sb_printf( sb_err,
+ sb_printf( sb_err,
_( L"%ls: Too many arguments\n" ),
argv[0] );
builtin_print_help( argv[0], sb_err );
@@ -603,7 +603,7 @@ static int builtin_complete( wchar_t **argv )
{
/* No arguments specified, meaning we print the definitions of
* all specified completions to stdout.*/
- complete_print( sb_out );
+ complete_print( sb_out );
}
else
{
@@ -613,26 +613,26 @@ static int builtin_complete( wchar_t **argv )
&path,
(wchar_t *)short_opt.buff,
&gnu_opt,
- &old_opt );
+ &old_opt );
}
else
{
- builtin_complete_add( &cmd,
+ builtin_complete_add( &cmd,
&path,
(wchar_t *)short_opt.buff,
&gnu_opt,
- &old_opt,
- result_mode,
+ &old_opt,
+ result_mode,
authoritative,
condition,
comp,
desc,
- flags );
+ flags );
}
- }
+ }
}
-
+
al_foreach( &cmd, &free );
al_foreach( &path, &free );
diff --git a/builtin_jobs.c b/builtin_jobs.c
index ec6ba21b7..8d17dba14 100644
--- a/builtin_jobs.c
+++ b/builtin_jobs.c
@@ -173,7 +173,7 @@ static int builtin_jobs( wchar_t **argv )
while( 1 )
{
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -248,7 +248,7 @@ static int builtin_jobs( wchar_t **argv )
case 'h':
builtin_print_help( argv[0], sb_out );
- return 0;
+ return 0;
case '?':
builtin_unknown_option( argv[0], argv[woptind-1] );
diff --git a/builtin_set.c b/builtin_set.c
index 3eaca346e..7fa41fa97 100644
--- a/builtin_set.c
+++ b/builtin_set.c
@@ -1,6 +1,6 @@
/** \file builtin_set.c Functions defining the set builtin
-Functions used for implementing the set builtin.
+Functions used for implementing the set builtin.
*/
#include "config.h"
@@ -61,19 +61,19 @@ static int my_env_set( const wchar_t *key, array_list_t *val, int scope )
int i;
int retcode = 0;
wchar_t *val_str=0;
-
+
if( is_path_variable( key ) )
{
int error = 0;
-
+
for( i=0; i 64 )
{
shorten = 1;
@@ -384,12 +384,12 @@ static void print_variables(int include_values, int esc, int scope)
DIE_MEM();
}
}
-
+
e_value = esc ? expand_escape_variable(value) : wcsdup(value);
-
+
sb_append(sb_out, L" ", e_value, (void *)0);
free(e_value);
-
+
if( shorten )
{
sb_append(sb_out, L"\u2026");
@@ -398,7 +398,7 @@ static void print_variables(int include_values, int esc, int scope)
}
}
-
+
sb_append(sb_out, L"\n");
free(e_key);
}
@@ -411,57 +411,57 @@ static void print_variables(int include_values, int esc, int scope)
The set builtin. Creates, updates and erases environment variables
and environemnt variable arrays.
*/
-static int builtin_set( wchar_t **argv )
+static int builtin_set( wchar_t **argv )
{
-
+
/**
Variables used for parsing the argument list
*/
- const static struct woption
- long_options[] =
+ static const struct woption
+ long_options[] =
{
- {
- L"export", no_argument, 0, 'x'
+ {
+ L"export", no_argument, 0, 'x'
}
,
- {
- L"global", no_argument, 0, 'g'
+ {
+ L"global", no_argument, 0, 'g'
}
,
- {
- L"local", no_argument, 0, 'l'
+ {
+ L"local", no_argument, 0, 'l'
}
,
- {
- L"erase", no_argument, 0, 'e'
+ {
+ L"erase", no_argument, 0, 'e'
}
,
- {
- L"names", no_argument, 0, 'n'
- }
+ {
+ L"names", no_argument, 0, 'n'
+ }
,
- {
- L"unexport", no_argument, 0, 'u'
- }
+ {
+ L"unexport", no_argument, 0, 'u'
+ }
,
- {
- L"universal", no_argument, 0, 'U'
- }
+ {
+ L"universal", no_argument, 0, 'U'
+ }
,
- {
- L"query", no_argument, 0, 'q'
- }
+ {
+ L"query", no_argument, 0, 'q'
+ }
,
- {
- L"help", no_argument, 0, 'h'
- }
+ {
+ L"help", no_argument, 0, 'h'
+ }
,
- {
- 0, 0, 0, 0
+ {
+ 0, 0, 0, 0
}
}
;
-
+
const wchar_t *short_options = L"+xglenuUqh";
int argc = builtin_count_args(argv);
@@ -472,7 +472,7 @@ static int builtin_set( wchar_t **argv )
int local = 0, global = 0, export = 0;
int erase = 0, list = 0, unexport=0;
int universal = 0, query=0;
-
+
/*
Variables used for performing the actual work
@@ -482,22 +482,22 @@ static int builtin_set( wchar_t **argv )
int scope;
int slice=0;
int i;
-
+
wchar_t *bad_char;
-
-
+
+
/* Parse options to obtain the requested operation and the modifiers */
woptind = 0;
- while (1)
+ while (1)
{
int c = wgetopt_long(argc, argv, short_options, long_options, 0);
- if (c == -1)
+ if (c == -1)
{
break;
}
-
- switch(c)
+
+ switch(c)
{
case 0:
break;
@@ -561,18 +561,18 @@ static int builtin_set( wchar_t **argv )
sb_printf(sb_err,
BUILTIN_ERR_COMBO,
argv[0] );
-
+
builtin_print_help( argv[0], sb_err );
return 1;
}
-
+
/* We can't both list and erase varaibles */
- if( erase && list )
+ if( erase && list )
{
sb_printf(sb_err,
BUILTIN_ERR_COMBO,
- argv[0] );
+ argv[0] );
builtin_print_help( argv[0], sb_err );
return 1;
@@ -581,7 +581,7 @@ static int builtin_set( wchar_t **argv )
/*
Variables can only have one scope
*/
- if( local + global + universal > 1 )
+ if( local + global + universal > 1 )
{
sb_printf( sb_err,
BUILTIN_ERR_GLOCAL,
@@ -593,7 +593,7 @@ static int builtin_set( wchar_t **argv )
/*
Variables can only have one export status
*/
- if( export && unexport )
+ if( export && unexport )
{
sb_printf( sb_err,
BUILTIN_ERR_EXPUNEXP,
@@ -605,7 +605,7 @@ static int builtin_set( wchar_t **argv )
/*
Calculate the scope value for variable assignement
*/
- scope = (local ? ENV_LOCAL : 0) | (global ? ENV_GLOBAL : 0) | (export ? ENV_EXPORT : 0) | (unexport ? ENV_UNEXPORT : 0) | (universal ? ENV_UNIVERSAL:0) | ENV_USER;
+ scope = (local ? ENV_LOCAL : 0) | (global ? ENV_GLOBAL : 0) | (export ? ENV_EXPORT : 0) | (unexport ? ENV_UNEXPORT : 0) | (universal ? ENV_UNIVERSAL:0) | ENV_USER;
if( query )
{
@@ -621,7 +621,7 @@ static int builtin_set( wchar_t **argv )
if( !(dest = wcsdup(arg)))
{
- DIE_MEM();
+ DIE_MEM();
}
if( wcschr( dest, L'[' ) )
@@ -629,18 +629,18 @@ static int builtin_set( wchar_t **argv )
slice = 1;
*wcschr( dest, L'[' )=0;
}
-
+
if( slice )
{
array_list_t indexes;
array_list_t result;
int j;
-
+
al_init( &result );
al_init( &indexes );
tokenize_variable_array( env_get( dest ), &result );
-
+
if( !parse_index( &indexes, arg, dest, al_get_count( &result ) ) )
{
builtin_print_help( argv[0], sb_err );
@@ -663,32 +663,32 @@ static int builtin_set( wchar_t **argv )
retcode++;
}
}
-
+
free( dest );
-
+
}
return retcode;
}
-
- if( list )
+
+ if( list )
{
/* Maybe we should issue an error if there are any other arguments? */
print_variables(0, 0, scope);
return 0;
- }
-
+ }
+
if( woptind == argc )
{
/*
Print values of variables
*/
- if( erase )
+ if( erase )
{
sb_printf( sb_err,
- _(L"%ls: Erase needs a variable name\n%ls\n"),
+ _(L"%ls: Erase needs a variable name\n%ls\n"),
argv[0] );
-
+
builtin_print_help( argv[0], sb_err );
retcode = 1;
}
@@ -696,13 +696,13 @@ static int builtin_set( wchar_t **argv )
{
print_variables( 1, 1, scope );
}
-
+
return retcode;
}
if( !(dest = wcsdup(argv[woptind])))
{
- DIE_MEM();
+ DIE_MEM();
}
if( wcschr( dest, L'[' ) )
@@ -710,7 +710,7 @@ static int builtin_set( wchar_t **argv )
slice = 1;
*wcschr( dest, L'[' )=0;
}
-
+
if( !wcslen( dest ) )
{
free( dest );
@@ -718,7 +718,7 @@ static int builtin_set( wchar_t **argv )
builtin_print_help( argv[0], sb_err );
return 1;
}
-
+
if( (bad_char = wcsvarname( dest ) ) )
{
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, argv[0], *bad_char );
@@ -726,7 +726,7 @@ static int builtin_set( wchar_t **argv )
free( dest );
return 1;
}
-
+
if( slice && erase && (scope != ENV_USER) )
{
free( dest );
@@ -734,12 +734,12 @@ static int builtin_set( wchar_t **argv )
builtin_print_help( argv[0], sb_err );
return 1;
}
-
+
/*
set assignment can work in two modes, either using slices or
using the whole array. We detect which mode is used here.
*/
-
+
if( slice )
{
@@ -750,22 +750,22 @@ static int builtin_set( wchar_t **argv )
array_list_t values;
array_list_t indexes;
array_list_t result;
-
+
al_init(&values);
al_init(&indexes);
al_init(&result);
-
+
tokenize_variable_array( env_get(dest), &result );
-
+
for( ; woptind ls.rlim_max))
{
ls.rlim_cur = ls.rlim_max;
- }
+ }
}
-
+
if( setrlimit( resource, &ls ) )
{
if( errno == EPERM )
@@ -244,8 +244,8 @@ static int set( int resource, int hard, int soft, rlim_t value )
else
builtin_wperror( L"ulimit" );
return 1;
- }
- return 0;
+ }
+ return 0;
}
/**
@@ -256,17 +256,17 @@ static int builtin_ulimit( wchar_t ** argv )
{
int hard=0;
int soft=0;
-
+
int what = RLIMIT_FSIZE;
int report_all = 0;
int argc = builtin_count_args( argv );
-
+
woptind=0;
-
+
while( 1 )
{
- const static struct woption
+ static const struct woption
long_options[] =
{
{
@@ -321,27 +321,27 @@ static int builtin_ulimit( wchar_t ** argv )
L"virtual-memory-size", no_argument, 0, 'v'
}
,
- {
- L"help", no_argument, 0, 'h'
- }
+ {
+ L"help", no_argument, 0, 'h'
+ }
,
{
- 0, 0, 0, 0
+ 0, 0, 0, 0
}
}
- ;
-
+ ;
+
int opt_index = 0;
-
+
int opt = wgetopt_long( argc,
- argv,
- L"aHScdflmnstuvh",
- long_options,
+ argv,
+ L"aHScdflmnstuvh",
+ long_options,
&opt_index );
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
@@ -354,7 +354,7 @@ static int builtin_ulimit( wchar_t ** argv )
builtin_print_help( argv[0], sb_err );
return 1;
-
+
case L'a':
report_all=1;
break;
@@ -364,17 +364,17 @@ static int builtin_ulimit( wchar_t ** argv )
break;
case L'S':
- soft=1;
+ soft=1;
break;
case L'c':
what=RLIMIT_CORE;
break;
-
+
case L'd':
what=RLIMIT_DATA;
break;
-
+
case L'f':
what=RLIMIT_FSIZE;
break;
@@ -384,45 +384,45 @@ static int builtin_ulimit( wchar_t ** argv )
break;
#endif
-#ifdef RLIMIT_RSS
+#ifdef RLIMIT_RSS
case L'm':
what=RLIMIT_RSS;
break;
#endif
-
+
case L'n':
what=RLIMIT_NOFILE;
break;
-
+
case L's':
what=RLIMIT_STACK;
break;
-
+
case L't':
what=RLIMIT_CPU;
break;
-
-#ifdef RLIMIT_NPROC
+
+#ifdef RLIMIT_NPROC
case L'u':
what=RLIMIT_NPROC;
break;
#endif
-
-#ifdef RLIMIT_AS
+
+#ifdef RLIMIT_AS
case L'v':
what=RLIMIT_AS;
break;
#endif
-
+
case L'h':
- builtin_print_help( argv[0], sb_out );
+ builtin_print_help( argv[0], sb_out );
return 0;
case L'?':
builtin_unknown_option( argv[0], argv[woptind-1] );
- return 1;
+ return 1;
}
- }
+ }
if( report_all )
{
@@ -442,7 +442,7 @@ static int builtin_ulimit( wchar_t ** argv )
return 0;
}
-
+
switch( argc - woptind )
{
case 0:
@@ -453,7 +453,7 @@ static int builtin_ulimit( wchar_t ** argv )
print( what, hard );
break;
}
-
+
case 1:
{
/*
@@ -469,7 +469,7 @@ static int builtin_ulimit( wchar_t ** argv )
{
hard=soft=1;
}
-
+
if( wcscasecmp( argv[woptind], L"unlimited" )==0)
{
new_limit = RLIM_INFINITY;
@@ -484,23 +484,23 @@ static int builtin_ulimit( wchar_t ** argv )
}
else
{
- errno=0;
+ errno=0;
new_limit = wcstol( argv[woptind], &end, 10 );
if( errno || *end )
{
- sb_printf( sb_err,
- L"%ls: Invalid limit '%ls'\n",
- argv[0],
+ sb_printf( sb_err,
+ L"%ls: Invalid limit '%ls'\n",
+ argv[0],
argv[woptind] );
builtin_print_help( argv[0], sb_err );
return 1;
}
new_limit *= get_multiplier( what );
}
-
+
return set( what, hard, soft, new_limit );
}
-
+
default:
{
sb_append( sb_err,
@@ -510,7 +510,7 @@ static int builtin_ulimit( wchar_t ** argv )
builtin_print_help( argv[0], sb_err );
return 1;
}
-
+
}
- return 0;
+ return 0;
}
diff --git a/common.c b/common.c
index 2dd125b8d..fa5ce6465 100644
--- a/common.c
+++ b/common.c
@@ -1,5 +1,5 @@
/** \file common.c
-
+
Various functions, mostly string utilities, that are used by most
parts of fish.
*/
@@ -38,7 +38,7 @@ parts of fish.
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -89,12 +89,12 @@ parts of fish.
#include "fallback.c"
/**
- The number of milliseconds to wait between polls when attempting to acquire
+ The number of milliseconds to wait between polls when attempting to acquire
a lockfile
*/
#define LOCKPOLLINTERVAL 10
-struct termios shell_modes;
+struct termios shell_modes;
wchar_t ellipsis_char;
@@ -115,7 +115,7 @@ static struct winsize termsize;
static string_buffer_t *setlocale_buff=0;
-void show_stackframe()
+void show_stackframe()
{
void *trace[32];
char **messages = (char **)NULL;
@@ -145,18 +145,18 @@ wchar_t **list_to_char_arr( array_list_t *l )
DIE_MEM();
}
for( i=0; iarr,
+ qsort( comp->arr,
al_get_count( comp ),
sizeof( void*),
&str_cmp );
@@ -233,7 +233,7 @@ wchar_t *str2wcs( const char *in )
{
wchar_t *out;
size_t len = strlen(in);
-
+
out = malloc( sizeof(wchar_t)*(len+1) );
if( !out )
@@ -254,7 +254,7 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
CHECK( in, 0 );
CHECK( out, 0 );
-
+
len = strlen(in);
memset( &state, 0, sizeof(state) );
@@ -274,7 +274,7 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
}
else
{
-
+
switch( res )
{
case (size_t)(-2):
@@ -285,12 +285,12 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
memset( &state, 0, sizeof(state) );
break;
}
-
+
case 0:
{
return out;
}
-
+
default:
{
in_pos += res;
@@ -299,17 +299,17 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
}
out_pos++;
}
-
+
}
out[out_pos] = 0;
-
- return out;
+
+ return out;
}
char *wcs2str( const wchar_t *in )
{
- char *out;
-
+ char *out;
+
out = malloc( MAX_UTF8_BYTES*wcslen(in)+1 );
if( !out )
@@ -329,9 +329,9 @@ char *wcs2str_internal( const wchar_t *in, char *out )
CHECK( in, 0 );
CHECK( out, 0 );
-
+
memset( &state, 0, sizeof(state) );
-
+
while( in[in_pos] )
{
if( in[in_pos] == INTERNAL_SEPARATOR )
@@ -345,7 +345,7 @@ char *wcs2str_internal( const wchar_t *in, char *out )
else
{
res = wcrtomb( &out[out_pos], in[in_pos], &state );
-
+
if( res == (size_t)(-1) )
{
debug( 1, L"Wide character %d has no narrow representation", in[in_pos] );
@@ -359,8 +359,8 @@ char *wcs2str_internal( const wchar_t *in, char *out )
in_pos++;
}
out[out_pos] = 0;
-
- return out;
+
+ return out;
}
char **wcsv2strv( const wchar_t **in )
@@ -373,7 +373,7 @@ char **wcsv2strv( const wchar_t **in )
char **res = malloc( sizeof( char *)*(count+1));
if( res == 0 )
{
- DIE_MEM();
+ DIE_MEM();
}
for( i=0; i 2 )
w=1;
-
- res += w;
+
+ res += w;
}
return res;
}
@@ -488,14 +488,14 @@ int my_wcswidth( const wchar_t *c )
wchar_t *quote_end( const wchar_t *pos )
{
wchar_t c = *pos;
-
+
while( 1 )
{
pos++;
-
+
if( !*pos )
return 0;
-
+
if( *pos == L'\\')
{
pos++;
@@ -511,36 +511,36 @@ wchar_t *quote_end( const wchar_t *pos )
}
}
return 0;
-
+
}
-
+
const wchar_t *wsetlocale(int category, const wchar_t *locale)
{
char *lang = locale?wcs2str( locale ):0;
char * res = setlocale(category,lang);
-
+
free( lang );
/*
Use ellipsis if on known unicode system, otherwise use $
*/
char *ctype = setlocale( LC_CTYPE, (void *)0 );
- ellipsis_char = (strstr( ctype, ".UTF")||strstr( ctype, ".utf") )?L'\u2026':L'$';
-
+ ellipsis_char = (strstr( ctype, ".UTF")||strstr( ctype, ".utf") )?L'\u2026':L'$';
+
if( !res )
return 0;
-
+
if( !setlocale_buff )
{
setlocale_buff = sb_halloc( global_context);
}
-
+
sb_clear( setlocale_buff );
sb_printf( setlocale_buff, L"%s", res );
-
- return (wchar_t *)setlocale_buff->buff;
+
+ return (wchar_t *)setlocale_buff->buff;
}
int contains_internal( const wchar_t *a, ... )
@@ -550,59 +550,59 @@ int contains_internal( const wchar_t *a, ... )
int res = 0;
CHECK( a, 0 );
-
+
va_start( va, a );
- while( (arg=va_arg(va, wchar_t *) )!= 0 )
+ while( (arg=va_arg(va, wchar_t *) )!= 0 )
{
if( wcscmp( a,arg) == 0 )
{
res=1;
break;
}
-
+
}
va_end( va );
- return res;
+ return res;
}
int read_blocked(int fd, void *buf, size_t count)
{
- int res;
- sigset_t chldset, oldset;
+ int res;
+ sigset_t chldset, oldset;
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
sigprocmask(SIG_BLOCK, &chldset, &oldset);
res = read( fd, buf, count );
sigprocmask( SIG_SETMASK, &oldset, 0 );
- return res;
+ return res;
}
ssize_t write_loop(int fd, char *buff, size_t count)
{
ssize_t out=0;
ssize_t out_cum=0;
- while( 1 )
+ while( 1 )
{
- out = write( fd,
+ out = write( fd,
&buff[out_cum],
count - out_cum );
- if (out == -1)
+ if (out == -1)
{
if( errno != EAGAIN &&
- errno != EINTR )
+ errno != EINTR )
{
return -1;
}
- } else
+ } else
{
out_cum += out;
}
- if( out_cum >= count )
+ if( out_cum >= count )
{
break;
}
- }
+ }
return out_cum;
}
@@ -616,26 +616,26 @@ void debug( int level, const wchar_t *msg, ... )
string_buffer_t sb2;
int errno_old = errno;
-
+
if( level > debug_level )
return;
CHECK( msg, );
-
+
sb_init( &sb );
sb_init( &sb2 );
sb_printf( &sb, L"%ls: ", program_name );
- va_start( va, msg );
+ va_start( va, msg );
sb_vprintf( &sb, msg, va );
- va_end( va );
+ va_end( va );
write_screen( (wchar_t *)sb.buff, &sb2 );
- fwprintf( stderr, L"%ls", sb2.buff );
+ fwprintf( stderr, L"%ls", sb2.buff );
- sb_destroy( &sb );
- sb_destroy( &sb2 );
+ sb_destroy( &sb );
+ sb_destroy( &sb2 );
errno = errno_old;
}
@@ -646,17 +646,17 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
int line_width = 0;
int tok_width = 0;
int screen_width = common_get_width();
-
+
CHECK( msg, );
CHECK( buff, );
-
+
if( screen_width )
{
start = pos = msg;
while( 1 )
{
int overflow = 0;
-
+
tok_width=0;
/*
@@ -664,7 +664,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
*/
while( *pos && ( !wcschr( L" \n\r\t", *pos ) ) )
{
-
+
/*
Check is token is wider than one line.
If so we mark it as an overflow and break the token.
@@ -672,9 +672,9 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
if((tok_width + wcwidth(*pos)) > (screen_width-1))
{
overflow = 1;
- break;
+ break;
}
-
+
tok_width += wcwidth( *pos );
pos++;
}
@@ -713,7 +713,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
free( token );
line_width += (line_width!=0?1:0) + tok_width;
}
-
+
/*
Break on end of string
*/
@@ -721,7 +721,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
{
break;
}
-
+
start=pos;
}
}
@@ -744,7 +744,7 @@ static wchar_t *escape_simple( const wchar_t *in )
out = malloc( sizeof(wchar_t)*(len+3));
if( !out )
DIE_MEM();
-
+
out[0] = L'\'';
wcscpy(&out[1], in );
out[len+1]=L'\'';
@@ -753,14 +753,14 @@ static wchar_t *escape_simple( const wchar_t *in )
}
-wchar_t *escape( const wchar_t *in_orig,
+wchar_t *escape( const wchar_t *in_orig,
int flags )
{
const wchar_t *in = in_orig;
-
+
int escape_all = flags & ESCAPE_ALL;
int no_quoted = flags & ESCAPE_NO_QUOTED;
-
+
wchar_t *out;
wchar_t *pos;
@@ -780,14 +780,14 @@ wchar_t *escape( const wchar_t *in_orig,
DIE_MEM();
return out;
}
-
-
+
+
out = malloc( sizeof(wchar_t)*(wcslen(in)*4 + 1));
pos = out;
-
+
if( !out )
DIE_MEM();
-
+
while( *in != 0 )
{
@@ -796,53 +796,53 @@ wchar_t *escape( const wchar_t *in_orig,
{
int val = *in - ENCODE_DIRECT_BASE;
int tmp;
-
+
*(pos++) = L'\\';
*(pos++) = L'X';
-
- tmp = val/16;
+
+ tmp = val/16;
*pos++ = tmp > 9? L'a'+(tmp-10):L'0'+tmp;
-
- tmp = val%16;
+
+ tmp = val%16;
*pos++ = tmp > 9? L'a'+(tmp-10):L'0'+tmp;
need_escape=need_complex_escape=1;
-
+
}
else
{
-
+
switch( *in )
{
case L'\t':
*(pos++) = L'\\';
- *(pos++) = L't';
+ *(pos++) = L't';
need_escape=need_complex_escape=1;
break;
-
+
case L'\n':
*(pos++) = L'\\';
- *(pos++) = L'n';
+ *(pos++) = L'n';
need_escape=need_complex_escape=1;
break;
-
+
case L'\b':
*(pos++) = L'\\';
- *(pos++) = L'b';
+ *(pos++) = L'b';
need_escape=need_complex_escape=1;
break;
-
+
case L'\r':
*(pos++) = L'\\';
- *(pos++) = L'r';
+ *(pos++) = L'r';
need_escape=need_complex_escape=1;
break;
-
+
case L'\x1b':
*(pos++) = L'\\';
- *(pos++) = L'e';
+ *(pos++) = L'e';
need_escape=need_complex_escape=1;
break;
-
+
case L'\\':
case L'\'':
@@ -881,7 +881,7 @@ wchar_t *escape( const wchar_t *in_orig,
*pos++ = *in;
break;
}
-
+
default:
{
if( *in < 32 )
@@ -891,12 +891,12 @@ wchar_t *escape( const wchar_t *in_orig,
*(pos++) = L'\\';
*(pos++) = L'c';
*(pos++) = L'a' + *in -1;
-
+
need_escape=need_complex_escape=1;
break;
-
+
}
-
+
int tmp = (*in)%16;
*pos++ = L'\\';
@@ -913,47 +913,47 @@ wchar_t *escape( const wchar_t *in_orig,
}
}
}
-
+
in++;
}
*pos = 0;
/*
Use quoted escaping if possible, since most people find it
- easier to read.
+ easier to read.
*/
if( !no_quoted && need_escape && !need_complex_escape && escape_all )
{
free( out );
out = escape_simple( in_orig );
}
-
+
return out;
}
wchar_t *unescape( const wchar_t * orig, int flags )
{
-
- int mode = 0;
+
+ int mode = 0;
int in_pos, out_pos, len;
int c;
int bracket_count=0;
- wchar_t prev=0;
+ wchar_t prev=0;
wchar_t *in;
int unescape_special = flags & UNESCAPE_SPECIAL;
int allow_incomplete = flags & UNESCAPE_INCOMPLETE;
-
+
CHECK( orig, 0 );
-
+
len = wcslen( orig );
in = wcsdup( orig );
if( !in )
DIE_MEM();
-
- for( in_pos=0, out_pos=0;
- in_pos=0)?in[out_pos]:0), out_pos++, in_pos++ )
{
c = in[in_pos];
@@ -969,7 +969,7 @@ wchar_t *unescape( const wchar_t * orig, int flags )
{
switch( in[++in_pos] )
{
-
+
/*
A null character after a backslash is an
error, return null
@@ -982,12 +982,12 @@ wchar_t *unescape( const wchar_t * orig, int flags )
return 0;
}
}
-
+
/*
Numeric escape sequences. No prefix means
octal escape, otherwise hexadecimal.
*/
-
+
case L'0':
case L'1':
case L'2':
@@ -1005,10 +1005,10 @@ wchar_t *unescape( const wchar_t * orig, int flags )
long long res=0;
int chars=2;
int base=16;
-
+
int byte = 0;
wchar_t max_val = ASCII_MAX;
-
+
switch( in[in_pos] )
{
case L'u':
@@ -1017,45 +1017,45 @@ wchar_t *unescape( const wchar_t * orig, int flags )
max_val = UCS2_MAX;
break;
}
-
+
case L'U':
{
chars=8;
max_val = WCHAR_MAX;
break;
}
-
+
case L'x':
{
break;
}
-
+
case L'X':
{
byte=1;
max_val = BYTE_MAX;
break;
}
-
+
default:
{
base=8;
chars=3;
in_pos--;
break;
- }
+ }
}
-
+
for( i=0; i= timeout || elapsed < 0 )
@@ -1670,7 +1670,7 @@ int acquire_lock_file( const char *lockfile, const int timeout, int force )
else
{
/*
- Timed out and final try was unsuccessful or
+ Timed out and final try was unsuccessful or
force was not specified
*/
debug( 1, L"acquire_lock_file: timed out "
@@ -1729,7 +1729,7 @@ void tokenize_variable_array( const wchar_t *val, array_list_t *out )
{
if( *pos == ARRAY_SEP )
{
-
+
*pos=0;
next = start==cpy?cpy:wcsdup(start);
if( !next )
@@ -1751,13 +1751,13 @@ int create_directory( wchar_t *d )
int ok = 0;
struct stat buf;
int stat_res = 0;
-
+
while( (stat_res = wstat(d, &buf ) ) != 0 )
{
if( errno != EAGAIN )
break;
}
-
+
if( stat_res == 0 )
{
if( S_ISDIR( buf.st_mode ) )
@@ -1781,7 +1781,7 @@ int create_directory( wchar_t *d )
free(dir);
}
}
-
+
return ok?0:-1;
}
@@ -1818,7 +1818,7 @@ void sb_format_size( string_buffer_t *sb,
else
{
int i;
-
+
for( i=0; sz_name[i]; i++ )
{
if( sz < (1024*1024) || !sz_name[i+1] )
@@ -1831,19 +1831,19 @@ void sb_format_size( string_buffer_t *sb,
break;
}
sz /= 1024;
-
+
}
- }
+ }
}
double timef()
{
int time_res;
struct timeval tv;
-
+
time_res = gettimeofday(&tv, 0);
-
- if( time_res )
+
+ if( time_res )
{
/*
Fixme: What on earth is the correct parameter value for NaN?
@@ -1854,6 +1854,6 @@ double timef()
*/
return nan("");
}
-
+
return (double)tv.tv_sec + 0.000001*tv.tv_usec;
}
diff --git a/common.h b/common.h
index 115785f3d..24c360880 100644
--- a/common.h
+++ b/common.h
@@ -60,10 +60,10 @@
#define ESCAPE_NO_QUOTED 2
-/**
+/**
Save the shell mode on startup so we can restore them on exit
*/
-extern struct termios shell_modes;
+extern struct termios shell_modes;
/**
The character to use where the text has been truncated. Is an
@@ -116,7 +116,7 @@ extern wchar_t *program_name;
exit_read_count=read( 0, &exit_read_buff, 1 ); \
exit( 1 ); \
} \
-
+
/**
Exit program at once, leaving an error message about running out of memory.
@@ -144,7 +144,7 @@ extern wchar_t *program_name;
show_stackframe(); \
return retval; \
}
-
+
/**
Shorthand for wgettext call
*/
@@ -152,7 +152,7 @@ extern wchar_t *program_name;
/**
Noop, used to tell xgettext that a string should be translated,
- even though it is not directly sent to wgettext.
+ even though it is not directly sent to wgettext.
*/
#define N_(wstr) wstr
@@ -181,7 +181,7 @@ wchar_t **list_to_char_arr( array_list_t *l );
Read a line from the stream f into the buffer buff of length len. If
buff is to small, it will be reallocated, and both buff and len will
be updated to reflect this. Returns the number of bytes read or -1
- on failiure.
+ on failiure.
If the carriage return character is encountered, it is
ignored. fgetws() considers the line to end if reading the file
@@ -258,7 +258,7 @@ __sentinel wchar_t *wcsdupcat_internal( const wchar_t *a, ... );
/**
- Test if the given string is a valid variable name.
+ Test if the given string is a valid variable name.
\return null if this is a valid name, and a pointer to the first invalid character otherwise
*/
@@ -267,7 +267,7 @@ wchar_t *wcsvarname( const wchar_t *str );
/**
- Test if the given string is a valid function name.
+ Test if the given string is a valid function name.
\return null if this is a valid name, and a pointer to the first invalid character otherwise
*/
@@ -275,7 +275,7 @@ wchar_t *wcsvarname( const wchar_t *str );
wchar_t *wcsfuncname( const wchar_t *str );
/**
- Test if the given string is valid in a variable name
+ Test if the given string is valid in a variable name
\return 1 if this is a valid name, 0 otherwise
*/
@@ -311,14 +311,14 @@ void error_reset();
This function behaves exactly like a wide character equivalent of
the C function setlocale, except that it will also try to detect if
the user is using a Unicode character set, and if so, use the
- unicode ellipsis character as ellipsis, instead of '$'.
+ unicode ellipsis character as ellipsis, instead of '$'.
*/
const wchar_t *wsetlocale( int category, const wchar_t *locale );
/**
Checks if \c needle is included in the list of strings specified. A warning is printed if needle is zero.
- \param needle the string to search for in the list
+ \param needle the string to search for in the list
\return zero if needle is not found, of if needle is null, non-zero otherwise
*/
@@ -346,9 +346,9 @@ ssize_t write_loop(int fd, char *buff, size_t count);
Because debug is often called to tell the user about an error,
before using wperror to give a specific error message, debug will
never ever modify the value of errno.
-
+
\param level the priority of the message. Lower number means higher priority. Messages with a priority_number higher than \c debug_level will be ignored..
- \param msg the message format string.
+ \param msg the message format string.
Example:
@@ -360,7 +360,7 @@ void debug( int level, const wchar_t *msg, ... );
/**
Replace special characters with backslash escape sequences. Newline is
- replaced with \n, etc.
+ replaced with \n, etc.
\param in The string to be escaped
\param escape_all Whether all characters wich hold special meaning in fish (Pipe, semicolon, etc,) should be escaped, or only unprintable characters
@@ -380,21 +380,21 @@ wchar_t *escape( const wchar_t *in, int escape_all );
an invalid sequence is specified, 0 is returned.
*/
-wchar_t *unescape( const wchar_t * in,
+wchar_t *unescape( const wchar_t * in,
int escape_special );
/**
- Attempt to acquire a lock based on a lockfile, waiting LOCKPOLLINTERVAL
- milliseconds between polls and timing out after timeout seconds,
+ Attempt to acquire a lock based on a lockfile, waiting LOCKPOLLINTERVAL
+ milliseconds between polls and timing out after timeout seconds,
thereafter forcibly attempting to obtain the lock if force is non-zero.
Returns 1 on success, 0 on failure.
To release the lock the lockfile must be unlinked.
- A unique temporary file named by appending characters to the lockfile name
+ A unique temporary file named by appending characters to the lockfile name
is used; any pre-existing file of the same name is subject to deletion.
*/
int acquire_lock_file( const char *lockfile, const int timeout, int force );
-/**
+/**
Returns the width of the terminal window, so that not all
functions that use these values continually have to keep track of
it separately.
@@ -428,9 +428,9 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff );
Tokenize the specified string into the specified array_list_t.
Each new element is allocated using malloc and must be freed by the
caller.
-
+
\param val the input string. The contents of this string is not changed.
- \param out the list in which to place the elements.
+ \param out the list in which to place the elements.
*/
void tokenize_variable_array( const wchar_t *val, array_list_t *out );
diff --git a/complete.c b/complete.c
index 9193be148..3853e8700 100644
--- a/complete.c
+++ b/complete.c
@@ -124,7 +124,7 @@
If either short_opt or long_opt are non-zero, they specify a switch
for the command. If \c comp is also not empty, it contains a list
of non-switch arguments that may only follow directly after the
- specified switch.
+ specified switch.
*/
typedef struct complete_entry_opt
{
@@ -202,12 +202,12 @@ void completion_allocate( array_list_t *context,
int len = wcslen(comp);
flags = flags & (~COMPLETE_AUTO_SPACE);
-
+
if( ( len > 0 ) && ( wcschr( L"/=@:", comp[ len - 1 ] ) != 0 ) )
flags |= COMPLETE_NO_SPACE;
-
+
}
-
+
res->flags = flags;
al_push( context, res );
}
@@ -218,7 +218,7 @@ void completion_allocate( array_list_t *context,
static void complete_destroy()
{
complete_entry_t *i=first_entry, *prev;
-
+
while( i )
{
prev = i;
@@ -226,9 +226,9 @@ static void complete_destroy()
complete_free_entry( prev );
}
first_entry = 0;
-
+
parse_util_load_reset( L"fish_complete_path", 0 );
-
+
}
/**
@@ -318,7 +318,7 @@ static void complete_free_opt_recursive( complete_entry_opt_t *o )
{
if( !o )
return;
-
+
complete_free_opt_recursive( o->next );
halloc_free( o );
}
@@ -369,7 +369,7 @@ static complete_entry_t *complete_get_exact_entry( const wchar_t *cmd,
{
DIE_MEM();
}
-
+
c->next = first_entry;
first_entry = c;
@@ -416,7 +416,7 @@ void complete_add( const wchar_t *cmd,
c = complete_get_exact_entry( cmd, cmd_type );
opt = halloc( 0, sizeof( complete_entry_opt_t ) );
-
+
opt->next = c->first_option;
c->first_option = opt;
if( short_opt != L'\0' )
@@ -432,7 +432,7 @@ void complete_add( const wchar_t *cmd,
wcscat( c->short_opt_str, L":" );
}
}
-
+
opt->short_opt = short_opt;
opt->result_mode = result_mode;
opt->old_mode=old_mode;
@@ -441,7 +441,7 @@ void complete_add( const wchar_t *cmd,
opt->condition = condition?halloc_wcsdup(opt, condition):L"";
opt->long_opt = long_opt?halloc_wcsdup(opt, long_opt):L"" ;
opt->flags = flags;
-
+
if( desc && wcslen( desc ) )
{
opt->desc = halloc_wcsdup( opt, desc );
@@ -450,7 +450,7 @@ void complete_add( const wchar_t *cmd,
{
opt->desc = L"";
}
-
+
}
/**
@@ -463,7 +463,7 @@ static complete_entry_t *complete_remove_entry( complete_entry_t *e,
{
complete_entry_opt_t *o, *oprev=0, *onext=0;
-
+
if(( short_opt == 0 ) && (long_opt == 0 ) )
{
complete_free_opt_recursive( e->first_option );
@@ -471,11 +471,11 @@ static complete_entry_t *complete_remove_entry( complete_entry_t *e,
}
else
{
-
+
for( o= e->first_option; o; o=onext )
{
onext=o->next;
-
+
if( ( short_opt==o->short_opt ) ||
( wcscmp( long_opt, o->long_opt ) == 0 ) )
{
@@ -496,13 +496,13 @@ static complete_entry_t *complete_remove_entry( complete_entry_t *e,
{
pos2++;
}
-
+
memmove( pos,
pos2,
sizeof(wchar_t)*wcslen(pos2) );
}
}
-
+
if( oprev == 0 )
{
e->first_option = o->next;
@@ -519,14 +519,14 @@ static complete_entry_t *complete_remove_entry( complete_entry_t *e,
}
}
}
-
+
if( e && (e->first_option == 0) )
{
free( e->short_opt_str );
free( e );
e=0;
}
-
+
return e;
}
@@ -540,7 +540,7 @@ void complete_remove( const wchar_t *cmd,
complete_entry_t *e, *eprev=0, *enext=0;
CHECK( cmd, );
-
+
for( e = first_entry; e; e=enext )
{
enext=e->next;
@@ -566,7 +566,7 @@ void complete_remove( const wchar_t *cmd,
first_entry = enext;
}
}
-
+
}
}
@@ -575,7 +575,7 @@ void complete_remove( const wchar_t *cmd,
pointers are allocated using halloc and will be free'd when\c
context is halloc_free'd.
*/
-static void parse_cmd_string( void *context,
+static void parse_cmd_string( void *context,
const wchar_t *str,
wchar_t **pathp,
wchar_t **cmdp )
@@ -592,7 +592,7 @@ static void parse_cmd_string( void *context,
*/
path = halloc_wcsdup( context, L"");
}
-
+
/* Make sure the path is not included in the command */
cmd = wcsrchr( str, L'/' );
if( cmd != 0 )
@@ -603,7 +603,7 @@ static void parse_cmd_string( void *context,
{
cmd = (wchar_t *)str;
}
-
+
*pathp=path;
*cmdp=cmd;
}
@@ -627,10 +627,10 @@ int complete_is_valid_option( const wchar_t *str,
char *short_validated;
void *context;
-
+
CHECK( str, 0 );
CHECK( opt, 0 );
-
+
/*
Check some generic things like -- and - options.
*/
@@ -642,7 +642,7 @@ int complete_is_valid_option( const wchar_t *str,
{
return 1;
}
-
+
case 2:
{
if( wcscmp( L"--", opt ) == 0 )
@@ -652,7 +652,7 @@ int complete_is_valid_option( const wchar_t *str,
break;
}
}
-
+
if( opt[0] != L'-' )
{
if( errors )
@@ -668,7 +668,7 @@ int complete_is_valid_option( const wchar_t *str,
{
DIE_MEM();
}
-
+
memset( short_validated, 0, wcslen( opt ) );
@@ -690,14 +690,14 @@ int complete_is_valid_option( const wchar_t *str,
gnu_opt_len = wcslen(opt)-2;
}
}
-
+
parse_cmd_string( context, str, &path, &cmd );
/*
Make sure completions are loaded for the specified command
*/
complete_load( cmd, 0 );
-
+
for( i=first_entry; i; i=i->next )
{
wchar_t *match = i->cmd_type?path:cmd;
@@ -707,7 +707,7 @@ int complete_is_valid_option( const wchar_t *str,
{
continue;
}
-
+
found_match = 1;
if( !i->authoritative )
@@ -726,7 +726,7 @@ int complete_is_valid_option( const wchar_t *str,
{
continue;
}
-
+
if( wcsncmp( &opt[2], o->long_opt, gnu_opt_len )==0)
{
hash_put( &gnu_match_hash, o->long_opt, L"" );
@@ -845,7 +845,7 @@ int complete_is_valid_option( const wchar_t *str,
hash_destroy( &gnu_match_hash );
halloc_free( context );
-
+
return (authoritative && found_match)?opt_found:1;
}
@@ -893,7 +893,7 @@ static void complete_strings( array_list_t *comp_out,
wc = parse_util_unescape_wildcards( tmp );
free(tmp);
-
+
for( i=0; icompletion) || (c->completion[wcslen(c->completion)-1] != L'/' ))
+
+ if( !wcslen( c->completion) || (c->completion[wcslen(c->completion)-1] != L'/' ))
{
skip = 0;
break;
}
-
+
}
-
+
if( skip )
{
return;
}
-
+
esc = escape( cmd_start, 1 );
@@ -985,7 +985,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
*/
if( exec_subshell( lookup_cmd, &list ) != -1 )
{
-
+
/*
Then discard anything that is not a possible completion and put
the result into a hashtable with the completion as key and the
@@ -997,7 +997,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
{
wchar_t *el = (wchar_t *)al_get( &list, i );
wchar_t *key, *key_end, *val_begin;
-
+
if( !el )
continue;
@@ -1006,7 +1006,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
if( !key_end )
continue;
-
+
*key_end = 0;
val_begin = key_end+1;
@@ -1016,7 +1016,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
things.
*/
val_begin[0]=towupper(val_begin[0]);
-
+
hash_put( &lookup, key, val_begin );
}
@@ -1031,19 +1031,19 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
{
completion_t *c = (completion_t *)al_get( comp, i );
const wchar_t *el = c->completion;
-
+
wchar_t *new_desc;
-
+
new_desc = (wchar_t *)hash_get( &lookup,
el );
-
+
if( new_desc )
{
c->description = halloc_wcsdup( comp, new_desc );
}
}
}
-
+
hash_destroy( &lookup );
al_foreach( &list,
&free );
@@ -1095,7 +1095,7 @@ static void complete_cmd( const wchar_t *cmd,
if( use_command )
{
-
+
if( expand_string( 0,
wcsdup(cmd),
comp,
@@ -1109,13 +1109,13 @@ static void complete_cmd( const wchar_t *cmd,
{
if( use_command )
{
-
+
path = env_get(L"PATH");
if( path )
{
-
+
path_cpy = wcsdup( path );
-
+
for( nxt_path = wcstok( path_cpy, ARRAY_SEP_STR, &state );
nxt_path != 0;
nxt_path = wcstok( 0, ARRAY_SEP_STR, &state) )
@@ -1124,21 +1124,21 @@ static void complete_cmd( const wchar_t *cmd,
int i;
int path_len = wcslen(nxt_path);
int add_slash;
-
+
if( !path_len )
{
continue;
}
-
+
add_slash = nxt_path[path_len-1]!=L'/';
nxt_completion = wcsdupcat( nxt_path,
add_slash?L"/":L"",
cmd );
if( ! nxt_completion )
continue;
-
+
prev_count = al_get_count( comp );
-
+
if( expand_string( 0,
nxt_completion,
comp,
@@ -1159,7 +1159,7 @@ static void complete_cmd( const wchar_t *cmd,
complete_cmd_desc( cmd, comp );
}
}
-
+
/*
These return the original strings - don't free them
*/
@@ -1173,7 +1173,7 @@ static void complete_cmd( const wchar_t *cmd,
}
al_truncate( &possible_comp, 0 );
-
+
if( use_builtin )
{
builtin_get_names( &possible_comp );
@@ -1202,7 +1202,7 @@ static void complete_cmd( const wchar_t *cmd,
{
continue;
}
-
+
if( expand_string( 0,
nxt_completion,
comp,
@@ -1242,7 +1242,7 @@ static void complete_from_args( const wchar_t *str,
proc_push_interactive(0);
eval_args( args, &possible_comp );
proc_pop_interactive();
-
+
complete_strings( comp_out, str, desc, 0, &possible_comp, flags );
al_foreach( &possible_comp, &free );
@@ -1355,10 +1355,10 @@ static void complete_load_handler( const wchar_t *cmd )
void complete_load( const wchar_t *name, int reload )
{
CHECK( name, );
- parse_util_load( name,
+ parse_util_load( name,
L"fish_complete_path",
- &complete_load_handler,
- reload );
+ &complete_load_handler,
+ reload );
}
/**
@@ -1380,7 +1380,7 @@ static int complete_param( const wchar_t *cmd_orig,
int use_common=1, use_files=1;
void *context = halloc( 0, 0 );
-
+
parse_cmd_string( context, cmd_orig, &path, &cmd );
complete_load( cmd, 1 );
@@ -1395,11 +1395,11 @@ static int complete_param( const wchar_t *cmd_orig,
{
continue;
}
-
+
use_common=1;
if( use_switches )
{
-
+
if( str[0] == L'-' )
{
/* Check if we are entering a combined option and argument
@@ -1420,7 +1420,7 @@ static int complete_param( const wchar_t *cmd_orig,
{
/* Set to true if we found a matching old-style switch */
int old_style_match = 0;
-
+
/*
If we are using old style long options, check for them
first
@@ -1438,7 +1438,7 @@ static int complete_param( const wchar_t *cmd_orig,
}
}
}
-
+
/*
No old style option matched, or we are not using old
style options. We check if any short (or gnu style
@@ -1467,7 +1467,7 @@ static int complete_param( const wchar_t *cmd_orig,
}
}
}
-
+
if( use_common )
{
@@ -1487,7 +1487,7 @@ static int complete_param( const wchar_t *cmd_orig,
use_files &= ((o->result_mode & NO_FILES )==0);
complete_from_args( str, o->comp, C_(o->desc), comp_out, o->flags );
}
-
+
if( wcslen(str) > 0 && use_switches )
{
/*
@@ -1500,7 +1500,7 @@ static int complete_param( const wchar_t *cmd_orig,
wchar_t completion[2];
completion[0] = o->short_opt;
completion[1] = 0;
-
+
completion_allocate( comp_out, completion, desc, 0 );
}
@@ -1511,7 +1511,7 @@ static int complete_param( const wchar_t *cmd_orig,
if( o->long_opt[0] != L'\0' )
{
int match=0, match_no_case=0;
-
+
string_buffer_t *whole_opt = sb_halloc( context );
sb_append( whole_opt, o->old_mode?L"-":L"--", o->long_opt, (void *)0 );
@@ -1521,7 +1521,7 @@ static int complete_param( const wchar_t *cmd_orig,
{
match_no_case = wcsncasecmp( str, (wchar_t *)whole_opt->buff, wcslen(str) )==0;
}
-
+
if( match || match_no_case )
{
int has_arg=0; /* Does this switch have any known arguments */
@@ -1530,7 +1530,7 @@ static int complete_param( const wchar_t *cmd_orig,
int offset = 0;
int flags = 0;
-
+
if( match )
offset = wcslen( str );
else
@@ -1541,7 +1541,7 @@ static int complete_param( const wchar_t *cmd_orig,
if( !o->old_mode && ( has_arg && !req_arg ) )
{
-
+
/*
Optional arguments to a switch can
only be handled using the '=', so we
@@ -1555,31 +1555,31 @@ static int complete_param( const wchar_t *cmd_orig,
sb_init( &completion );
sb_printf( &completion,
- L"%ls=",
+ L"%ls=",
((wchar_t *)whole_opt->buff)+offset );
-
+
completion_allocate( comp_out,
(wchar_t *)completion.buff,
C_(o->desc),
- flags );
-
+ flags );
+
sb_destroy( &completion );
-
+
}
-
+
completion_allocate( comp_out,
((wchar_t *)whole_opt->buff) + offset,
C_(o->desc),
flags );
- }
+ }
}
}
}
}
}
-
+
halloc_free( context );
-
+
return use_files;
}
@@ -1592,7 +1592,7 @@ static void complete_param_expand( wchar_t *str,
{
wchar_t *comp_str;
int flags;
-
+
if( (wcsncmp( str, L"--", 2 )) == 0 && (comp_str = wcschr(str, L'=' ) ) )
{
comp_str++;
@@ -1602,18 +1602,18 @@ static void complete_param_expand( wchar_t *str,
comp_str = str;
}
- flags = EXPAND_SKIP_CMDSUBST |
- ACCEPT_INCOMPLETE |
+ flags = EXPAND_SKIP_CMDSUBST |
+ ACCEPT_INCOMPLETE |
(do_file?0:EXPAND_SKIP_WILDCARDS);
-
- if( expand_string( 0,
+
+ if( expand_string( 0,
wcsdup(comp_str),
comp_out,
flags ) == EXPAND_ERROR )
{
debug( 3, L"Error while expanding string '%ls'", comp_str );
}
-
+
}
@@ -1636,13 +1636,13 @@ static int complete_variable( const wchar_t *whole_var,
{
wchar_t *name = (wchar_t *)al_get( &names, i );
int namelen = wcslen( name );
- int match=0, match_no_case=0;
+ int match=0, match_no_case=0;
if( varlen > namelen )
continue;
match = ( wcsncmp( var, name, varlen) == 0 );
-
+
if( !match )
{
match_no_case = ( wcsncasecmp( var, name, varlen) == 0 );
@@ -1659,11 +1659,11 @@ static int complete_variable( const wchar_t *whole_var,
string_buffer_t comp;
int flags = 0;
int offset = 0;
-
+
sb_init( &comp );
if( match )
{
- sb_append( &comp, &name[varlen] );
+ sb_append( &comp, &name[varlen] );
offset = varlen;
}
else
@@ -1672,23 +1672,23 @@ static int complete_variable( const wchar_t *whole_var,
sb_append( &comp, name );
flags = COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE;
}
-
+
value = expand_escape_variable( value_unescaped );
sb_init( &desc );
sb_printf( &desc, COMPLETE_VAR_DESC_VAL, value );
-
- completion_allocate( comp_list,
+
+ completion_allocate( comp_list,
(wchar_t *)comp.buff,
(wchar_t *)desc.buff,
flags );
res =1;
-
+
free( value );
sb_destroy( &desc );
sb_destroy( &comp );
}
-
+
}
}
@@ -1698,7 +1698,7 @@ static int complete_variable( const wchar_t *whole_var,
/**
Search the specified string for the \$ sign. If found, try to
- complete as an environment variable.
+ complete as an environment variable.
\return 0 if unable to complete, 1 otherwise
*/
@@ -1735,7 +1735,7 @@ static int try_complete_user( const wchar_t *cmd,
const wchar_t *first_char=cmd;
int res=0;
double start_time = timef();
-
+
if( *first_char ==L'~' && !wcschr(first_char, L'/'))
{
const wchar_t *user_name = first_char+1;
@@ -1744,19 +1744,19 @@ static int try_complete_user( const wchar_t *cmd,
{
struct passwd *pw;
int name_len = wcslen( user_name );
-
+
setpwent();
-
+
while((pw=getpwent()) != 0)
{
double current_time = timef();
wchar_t *pw_name;
- if( current_time - start_time > 0.2 )
+ if( current_time - start_time > 0.2 )
{
return 1;
}
-
+
pw_name = str2wcs( pw->pw_name );
if( pw_name )
@@ -1764,26 +1764,26 @@ static int try_complete_user( const wchar_t *cmd,
if( wcsncmp( user_name, pw_name, name_len )==0 )
{
string_buffer_t desc;
-
+
sb_init( &desc );
sb_printf( &desc,
COMPLETE_USER_DESC,
pw_name );
-
- completion_allocate( comp,
+
+ completion_allocate( comp,
&pw_name[name_len],
(wchar_t *)desc.buff,
COMPLETE_NO_SPACE );
-
+
res=1;
-
+
sb_destroy( &desc );
}
else if( wcsncasecmp( user_name, pw_name, name_len )==0 )
{
- string_buffer_t name;
- string_buffer_t desc;
-
+ string_buffer_t name;
+ string_buffer_t desc;
+
sb_init( &name );
sb_init( &desc );
sb_printf( &name,
@@ -1792,16 +1792,16 @@ static int try_complete_user( const wchar_t *cmd,
sb_printf( &desc,
COMPLETE_USER_DESC,
pw_name );
-
- completion_allocate( comp,
+
+ completion_allocate( comp,
(wchar_t *)name.buff,
(wchar_t *)desc.buff,
COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE );
res=1;
-
+
sb_destroy( &desc );
sb_destroy( &name );
-
+
}
free( pw_name );
}
@@ -1862,9 +1862,9 @@ void complete( const wchar_t *cmd,
if( !done )
{
pos = cursor_pos-(cmdsubst_begin-cmd);
-
+
buff = wcsndup( cmdsubst_begin, cmdsubst_end-cmdsubst_begin );
-
+
if( !buff )
done=1;
}
@@ -1887,7 +1887,7 @@ void complete( const wchar_t *cmd,
wchar_t *ncmd = tok_last( &tok );
int is_ddash = (wcscmp( ncmd, L"--" ) == 0) && ( (tok_get_pos( &tok )+2) < pos );
-
+
if( !had_cmd )
{
@@ -1908,17 +1908,17 @@ void complete( const wchar_t *cmd,
break;
}
-
+
if( !is_ddash ||
( (use_command && use_function && use_builtin ) ) )
{
int token_end;
-
+
free( current_command );
current_command = wcsdup( ncmd );
-
+
token_end = tok_get_pos( &tok ) + wcslen( ncmd );
-
+
on_command = (pos <= token_end );
had_cmd=1;
}
@@ -1931,10 +1931,10 @@ void complete( const wchar_t *cmd,
had_ddash = 1;
}
}
-
+
break;
}
-
+
case TOK_END:
case TOK_PIPE:
case TOK_BACKGROUND:
@@ -1946,20 +1946,20 @@ void complete( const wchar_t *cmd,
use_builtin = 1;
break;
}
-
+
case TOK_ERROR:
{
end_loop=1;
break;
}
-
+
}
if( tok_get_pos( &tok ) >= pos )
{
end_loop=1;
}
-
+
tok_next( &tok );
}
@@ -1974,7 +1974,7 @@ void complete( const wchar_t *cmd,
current_token = wcsndup( tok_begin, cursor_pos-(tok_begin-cmd) );
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
-
+
// debug( 0, L"on_command: %d, %ls %ls\n", on_command, current_command, current_token );
/*
@@ -1983,9 +1983,9 @@ void complete( const wchar_t *cmd,
case, complete using the builtins completions, not using a
subcommand.
*/
-
+
if( (on_command || (wcscmp( current_token, L"--" ) == 0 ) ) &&
- (current_token[0] == L'-') &&
+ (current_token[0] == L'-') &&
!(use_command && use_function && use_builtin ) )
{
free( current_command );
@@ -1993,11 +1993,11 @@ void complete( const wchar_t *cmd,
current_command = wcsdup( L"builtin" );
else
current_command = wcsdup( L"command" );
-
+
had_cmd = 1;
on_command = 0;
}
-
+
/*
Use command completions if in between commands
*/
@@ -2005,7 +2005,7 @@ void complete( const wchar_t *cmd,
{
on_command=1;
}
-
+
/*
We don't want these to be null
*/
@@ -2014,12 +2014,12 @@ void complete( const wchar_t *cmd,
{
current_token = wcsdup(L"");
}
-
+
if( !current_command )
{
current_command = wcsdup(L"");
}
-
+
if( !prev_token )
{
prev_token = wcsdup(L"");
@@ -2036,31 +2036,31 @@ void complete( const wchar_t *cmd,
else
{
int do_file=0;
-
+
wchar_t *current_command_unescape = unescape( current_command, 0 );
wchar_t *prev_token_unescape = unescape( prev_token, 0 );
wchar_t *current_token_unescape = unescape( current_token, UNESCAPE_INCOMPLETE );
-
+
if( current_token_unescape && prev_token_unescape && current_token_unescape )
{
- do_file = complete_param( current_command_unescape,
- prev_token_unescape,
- current_token_unescape,
- !had_ddash,
+ do_file = complete_param( current_command_unescape,
+ prev_token_unescape,
+ current_token_unescape,
+ !had_ddash,
comp );
}
-
+
free( current_command_unescape );
free( prev_token_unescape );
free( current_token_unescape );
-
+
/*
If we have found no command specific completions at
all, fall back to using file completions.
*/
if( !al_get_count( comp ) )
do_file = 1;
-
+
/*
This function wants the unescaped string
*/
@@ -2068,7 +2068,7 @@ void complete( const wchar_t *cmd,
}
}
}
-
+
free( current_token );
free( current_command );
free( prev_token );
diff --git a/complete.h b/complete.h
index 74c2b5a0d..36d10e3a0 100644
--- a/complete.h
+++ b/complete.h
@@ -16,39 +16,39 @@
#include "util.h"
-/**
- Use all completions
+/**
+ Use all completions
*/
#define SHARED 0
-/**
- Do not use file completion
+/**
+ Do not use file completion
*/
#define NO_FILES 1
-/**
- Require a parameter after completion
+/**
+ Require a parameter after completion
*/
#define NO_COMMON 2
-/**
+/**
Only use the argument list specifies with completion after
option. This is the same as (NO_FILES & NO_COMMON)
*/
#define EXCLUSIVE 3
-/**
- Command is a path
+/**
+ Command is a path
*/
#define PATH 1
-/**
- Command is not a path
+/**
+ Command is not a path
*/
#define COMMAND 0
-/**
+/**
Separator between completion and description
*/
#define COMPLETE_SEP L'\004'
-/**
+/**
Separator between completion and description
*/
#define COMPLETE_SEP_STR L"\004"
@@ -73,7 +73,7 @@
#define COMPLETE_NO_SPACE 1
/**
- This compeltion is case insensitive.
+ This compeltion is case insensitive.
Warning: The contents of the completion_t structure is actually
different if this flag is set! Specifically, the completion string
@@ -115,7 +115,7 @@ typedef struct
const wchar_t *description;
/**
- Flags determining the completion behaviour.
+ Flags determining the completion behaviour.
Determines whether a space should be inserted after this
compeltion if it is the only possible completion using the
@@ -132,17 +132,17 @@ typedef struct
/**
- Add a completion.
+ Add a completion.
All supplied values are copied, they should be freed by or otherwise
disposed by the caller.
- Examples:
-
+ Examples:
+
The command 'gcc -o' requires that a file follows it, so the
NO_COMMON option is suitable. This can be done using the following
line:
-
+
complete -c gcc -s o -r
The command 'grep -d' required that one of the strings 'read',
@@ -159,7 +159,7 @@ typedef struct
will be interpreted as the command name.
\param short_opt The single character name of an option. (-a is a short option, --all and -funroll are long options)
\param long_opt The multi character name of an option. (-a is a short option, --all and -funroll are long options)
- \param long_mode Whether to use old style, single dash long options.
+ \param long_mode Whether to use old style, single dash long options.
\param result_mode Whether to search further completions when this
completion has been succesfully matched. If result_mode is SHARED,
any other completions may also be used. If result_mode is NO_FILES,
@@ -172,16 +172,16 @@ typedef struct
\param condition a command to be run to check it this completion should be used. If \c condition is empty, the completion is always used.
\param flags A set of completion flags
*/
-void complete_add( const wchar_t *cmd,
- int cmd_type,
+void complete_add( const wchar_t *cmd,
+ int cmd_type,
wchar_t short_opt,
const wchar_t *long_opt,
- int long_mode,
- int result_mode,
+ int long_mode,
+ int result_mode,
const wchar_t *condition,
const wchar_t *comp,
const wchar_t *desc,
- int flags );
+ int flags );
/**
Sets whether the completion list for this command is complete. If
true, any options not matching one of the provided options will be
@@ -194,8 +194,8 @@ void complete_set_authoritative( const wchar_t *cmd,
/**
Remove a previously defined completion
*/
-void complete_remove( const wchar_t *cmd,
- int cmd_type,
+void complete_remove( const wchar_t *cmd,
+ int cmd_type,
wchar_t short_opt,
const wchar_t *long_opt );
@@ -212,7 +212,7 @@ void complete_remove( const wchar_t *cmd,
void complete( const wchar_t *cmd, array_list_t *out );
/**
- Print a list of all current completions into the string_buffer_t.
+ Print a list of all current completions into the string_buffer_t.
\param out The string_buffer_t to write completions to
*/
@@ -221,16 +221,16 @@ void complete_print( string_buffer_t *out );
/**
Tests if the specified option is defined for the specified command
*/
-int complete_is_valid_option( const wchar_t *str,
- const wchar_t *opt,
+int complete_is_valid_option( const wchar_t *str,
+ const wchar_t *opt,
array_list_t *errors );
/**
Tests if the specified argument is valid for the specified option
and command
*/
-int complete_is_valid_argument( const wchar_t *str,
- const wchar_t *opt,
+int complete_is_valid_argument( const wchar_t *str,
+ const wchar_t *opt,
const wchar_t *arg );
diff --git a/configure.ac b/configure.ac
index 7862b48ba..377ab5ebe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,11 @@
AC_INIT(fish,1.23.1,fish-users@lists.sf.net)
+#
+# preserve configure arguments for xsel
+#
+
+conf_arg=$@
#
# List of output variables produced by this configure script
@@ -31,6 +36,7 @@ AC_SUBST(prefix)
AC_SUBST(SEQ_FALLBACK)
AC_SUBST(XSEL)
AC_SUBST(XSEL_MAN)
+AC_SUBST(XSEL_BIN)
AC_SUBST(XSEL_MAN_PATH)
#
@@ -54,7 +60,7 @@ if test configure -ot configure.ac; then
fi
exit 1
else
- AC_MSG_ERROR(
+ AC_MSG_ERROR(
[cannot find the autoconf program in your path.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.]
@@ -79,7 +85,7 @@ if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
AC_MSG_NOTICE([running autoheader])
autoheader || exit 1
else
- AC_MSG_ERROR(
+ AC_MSG_ERROR(
[cannot find the autoheader program in your path.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.]
@@ -130,7 +136,7 @@ done
#
-# Tell autoconf to create config.h header
+# Tell autoconf to create config.h header
#
AC_CONFIG_HEADERS(config.h)
@@ -144,8 +150,8 @@ AH_BOTTOM([#if __GNUC__ >= 3
#define __warn_unused __attribute__ ((warn_unused_result))
#define __sentinel __attribute__ ((sentinel))
#else
-#define __warn_unused
-#define __sentinel
+#define __warn_unused
+#define __sentinel
#endif])
@@ -195,20 +201,22 @@ fi
# Optionally drop xsel command
#
-AC_ARG_WITH(
- xsel,
+AC_ARG_WITH(
+ xsel,
AC_HELP_STRING(
[--without-xsel],
- [do not build the xsel program needed for X clipboard integration]
+ [do not build the xsel program needed for X clipboard integration.
+ If build xsel, it will be configured with the same options as fish.]
),
[xsel=$withval],
- [xsel=with_xsel]
+ [xsel=with_xsel]
)
if [[ "$xsel" = "with_xsel" ]]; then
- XSEL=xsel-0.9.6/xsel
+ XSEL=xsel-1.2.0
+ XSEL_BIN=$XSEL/xsel
XSEL_MAN=xsel.1x
- XSEL_MAN_PATH=xsel-0.9.6/xsel.1x
+ XSEL_MAN_PATH=$XSEL/xsel.1x
fi
@@ -226,7 +234,7 @@ AC_ARG_WITH(
[local_gettext=yes]
)
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_DEFINE([USE_GETTEXT],[1],[Perform string translations with gettext])
fi
@@ -338,9 +346,9 @@ AC_RUN_IFELSE(
return STATUS;
]
)
- ],
- [glibc=yes],
- [glibc=no]
+ ],
+ [glibc=yes],
+ [glibc=no]
)
if test "$glibc" = yes; then
@@ -383,7 +391,7 @@ fi
AC_MSG_CHECKING([if we are under Solaris])
case $target_os in
- solaris*)
+ solaris*)
AC_DEFINE( __EXTENSIONS__, 1, [Macro to enable additional prototypes under Solaris])
AC_MSG_RESULT(yes)
;;
@@ -397,7 +405,7 @@ AC_MSG_CHECKING([if we are using non varargs tparm.])
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
- [
+ [
#include
#include
],
@@ -406,8 +414,8 @@ AC_COMPILE_IFELSE(
]
)
],
- [tparm_solaris_kludge=no],
- [tparm_solaris_kludge=yes]
+ [tparm_solaris_kludge=no],
+ [tparm_solaris_kludge=yes]
)
if test "x$tparm_solaris_kludge" = "xyes"; then
AC_MSG_RESULT(yes)
@@ -427,7 +435,7 @@ fi
AC_MSG_CHECKING([if we are under BSD])
case $target_os in
- *bsd*)
+ *bsd*)
AC_DEFINE( __BSD_VISIBLE, 1, [Macro to enable additional prototypes under BSD])
AC_DEFINE( _NETBSD_SOURCE, 1, [Macro to enable additional prototypes under BSD])
AC_MSG_RESULT(yes)
@@ -486,7 +494,7 @@ AC_CHECK_FILES([/proc/self/stat])
#
AC_DEFINE(
- [HAVE_TRANSLATE_H],
+ [HAVE_TRANSLATE_H],
[1],
[Define to 1 if the wgettext function should be used for translating strings.]
)
@@ -510,12 +518,12 @@ LIBS_SHARED=$LIBS
LIBS=$LIBS_COMMON
#
-# Check for libraries needed by fish.
+# Check for libraries needed by fish.
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
@@ -527,24 +535,24 @@ LIBS_FISH=$LIBS
LIBS=$LIBS_COMMON
#
-# Check for libraries needed by fish_indent.
+# Check for libraries needed by fish_indent.
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
LIBS_FISH_INDENT=$LIBS
LIBS=$LIBS_COMMON
#
-# Check for libraries needed by fish_pager.
+# Check for libraries needed by fish_pager.
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
@@ -552,12 +560,12 @@ LIBS_FISH_PAGER=$LIBS
LIBS=$LIBS_COMMON
#
-# Check for libraries needed by fishd.
+# Check for libraries needed by fishd.
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
@@ -565,12 +573,12 @@ LIBS_FISHD=$LIBS
LIBS=$LIBS_COMMON
#
-# Check for libraries needed by mimedb.
+# Check for libraries needed by mimedb.
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
LIBS_MIMEDB=$LIBS
@@ -578,12 +586,12 @@ LIBS=$LIBS_COMMON
#
-# Check for libraries needed by set_color
+# Check for libraries needed by set_color
#
LIBS_COMMON=$LIBS
LIBS="$LIBS_SHARED"
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
LIBS_SET_COLOR=$LIBS
@@ -599,8 +607,8 @@ AC_CHECK_HEADER(
[regex.h],
[
AC_DEFINE(
- [HAVE_REGEX_H],
- [1],
+ [HAVE_REGEX_H],
+ [1],
[Define to 1 if you have the header file.]
)
],
@@ -697,10 +705,10 @@ for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=2
/* Extended-POSIX: might be unhidden by _XOPEN_SOURCE. */
ret += killpg( 0, 0 );
/* Non-standard: might be hidden by the macros. */
- {
+ {
struct winsize termsize;
ret += (int)(void *)&termsize;
- ret += SIGWINCH + TIOCGWINSZ + SIGIO;
+ ret += SIGWINCH + TIOCGWINSZ + SIGIO;
}
return ret;
@@ -744,7 +752,7 @@ AC_CHECK_FUNCS( dcgettext backtrace backtrace_symbols sysconf )
# the translations should be installed.
#
-if test x$local_gettext != xno; then
+if test x$local_gettext != xno; then
AC_CHECK_FUNC( gettext, HAVE_GETTEXT=1, HAVE_GETTEXT=0 )
fi
@@ -768,22 +776,22 @@ AC_RUN_IFELSE(
#include
],
[
- int status;
- char *res;
- res = realpath( "somefile", 0 );
- status = !(res != 0 || errno == ENOENT);
+ int status;
+ char *res;
+ res = realpath( "somefile", 0 );
+ status = !(res != 0 || errno == ENOENT);
exit( status );
]
)
- ],
- [have_realpath_null=yes],
- [have_realpath_null=no]
+ ],
+ [have_realpath_null=yes],
+ [have_realpath_null=no]
)
if test "$have_realpath_null" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
- [HAVE_REALPATH_NULL],
+ [HAVE_REALPATH_NULL],
[1],
[Define to 1 if realpath accepts null for its second argument.]
)
@@ -810,15 +818,15 @@ AC_LINK_IFELSE(
#endif
],
[
- struct winsize termsize = {0};
+ struct winsize termsize = {0};
TIOCGWINSZ;
]
)
- ],
+ ],
[
- AC_MSG_RESULT(yes);
+ AC_MSG_RESULT(yes);
AC_DEFINE([HAVE_WINSIZE], [1], [Define to 1 if the winsize struct and TIOCGWINSZ macro exist])
- ],
+ ],
[
AC_MSG_RESULT(no)
]
@@ -854,7 +862,7 @@ if test "$ac_cv_func_fwprintf" = yes; then
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken])
- ]
+ ]
)
fi
@@ -870,19 +878,19 @@ AC_TRY_LINK(
],
[
extern int _nl_msg_cat_cntr;
- int tmp = _nl_msg_cat_cntr;
+ int tmp = _nl_msg_cat_cntr;
exit(tmp);
],
- have__nl_msg_cat_cntr=yes,
+ have__nl_msg_cat_cntr=yes,
have__nl_msg_cat_cntr=no
)
if test "$have__nl_msg_cat_cntr" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
- [HAVE__NL_MSG_CAT_CNTR],
+ [HAVE__NL_MSG_CAT_CNTR],
[1],
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.]
- )
+ )
else
AC_MSG_RESULT(no)
fi
@@ -895,19 +903,19 @@ AC_TRY_LINK(
],
[
extern char **__environ;
- char **tmp = __environ;
+ char **tmp = __environ;
exit(tmp!=0);
],
- have___environ=yes,
+ have___environ=yes,
have___environ=no
)
if test "$have___environ" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
- [HAVE___ENVIRON],
+ [HAVE___ENVIRON],
[1],
[Define to 1 if the __environ symbol is exported.]
- )
+ )
else
AC_MSG_RESULT(no)
fi
@@ -924,26 +932,26 @@ AC_TRY_LINK(
static struct option
long_options[] =
{
- 0, 0, 0, 0
+ 0, 0, 0, 0
}
;
int opt = getopt_long( 0,
- 0,
0,
- long_options,
+ 0,
+ long_options,
0 );
-
+
],
- have_working_getopt_long=yes,
+ have_working_getopt_long=yes,
have_working_getopt_long=no
)
if test "$have_working_getopt_long" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(
- [HAVE_WORKING_GETOPT_LONG],
+ [HAVE_WORKING_GETOPT_LONG],
[1],
[Define to 1 if getopt_long exists and works.]
- )
+ )
else
AC_MSG_RESULT(no)
fi
@@ -975,6 +983,12 @@ if test ! x$local_found_posix_switch = xyes; then
echo "Some fish features may be disabled."
fi
+if [[ "$xsel" = "with_xsel" ]]; then
+ echo "Now configure xsel with $conf_arg"
+ rm -rf $XSEL
+ tar xf $XSEL.tar.gz
+ cd $XSEL && ./configure $conf_arg
+fi
echo "fish is now configured."
echo "Use 'make' and 'make install' to build and install fish."
diff --git a/doc_src/alias.txt b/doc_src/alias.txt
index 523e47772..2ab277e9f 100644
--- a/doc_src/alias.txt
+++ b/doc_src/alias.txt
@@ -12,7 +12,7 @@ shells. For other uses, it is recommended to define a function.
Alias does not keep track of which functions have been defined using
-alias, nor does it allow erasing of aliases.
+alias, nor does it allow erasing of aliases.
- NAME is the name of the function to define
- DEFINITION is the body of the function. The string " $argv" will be appended to the body.
diff --git a/doc_src/begin.txt b/doc_src/begin.txt
index b4a822c3b..f5f7f53e0 100644
--- a/doc_src/begin.txt
+++ b/doc_src/begin.txt
@@ -37,7 +37,7 @@ In the following code, all output is redirected to the file out.html.
begin
echo $xml_header
echo $html_header
- if test -e $file
+ if test -e $file
...
end
...
diff --git a/doc_src/commandline.txt b/doc_src/commandline.txt
index 0202bbb34..df03ab13f 100644
--- a/doc_src/commandline.txt
+++ b/doc_src/commandline.txt
@@ -13,9 +13,9 @@
The following switches change what the commandline builtin does
-- \c -C or \c --cursor set or get the current cursor position, not
+- \c -C or \c --cursor set or get the current cursor position, not
the contents of the buffer. If no argument is given, the current
- cursor position is printed, otherwise the argument is interpreted
+ cursor position is printed, otherwise the argument is interpreted
as the new cursor position.
- \c -f or \c --function inject readline functions into the
reader. This option can not be combined with any other option. It
@@ -44,7 +44,7 @@ or updated
- \c -t or \c --current-token select the current token.
The following switch changes the way \c commandline prints the current
-commandline buffer
+commandline buffer
- \c -c or \c --cut-at-cursor only print selection up until the
current cursor position
diff --git a/doc_src/commands.hdr.in b/doc_src/commands.hdr.in
index 188d5d8d9..b62a6d568 100644
--- a/doc_src/commands.hdr.in
+++ b/doc_src/commands.hdr.in
@@ -1,5 +1,5 @@
/** \page commands Commands, functions and builtins bundled with fish
-Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
+Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
@command_list@
diff --git a/doc_src/design.hdr b/doc_src/design.hdr
index db93fa175..c6fea80a7 100644
--- a/doc_src/design.hdr
+++ b/doc_src/design.hdr
@@ -7,8 +7,8 @@ design fish. The fish design has three high level goals. These are:
-# Everything that can be done in other shell languages should be
possible to do in fish, though fish may rely on external commands in
-doing so.
--# Fish should be user friendly, but not at the expense of expressiveness.
+doing so.
+-# Fish should be user friendly, but not at the expense of expressiveness.
Most tradeoffs between power and ease of use can be avoided with careful design.
-# Whenever possible without breaking the above goals, fish should
follow the Posix syntax.
@@ -33,7 +33,7 @@ program harder to maintain and update.
Examples:
- Here documents are too similar to using echo inside of a pipeline.
-- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achived either using a block or the psub shellscript function.
+- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achived either using a block or the psub shellscript function.
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish functions have none of the drawbacks of either syntax.
- The many Posix quoting styles are silly, especially \$''.
@@ -57,14 +57,14 @@ take the whole system down.
Examples:
- Builtin commands should only be created when it cannot be
-avoided. \c echo, \c kill, \c printf and \c time are among the commands
-that fish does not implement internally since they can be provided as
-external commands. Several other commands that are commonly implemented
+avoided. \c echo, \c kill, \c printf and \c time are among the commands
+that fish does not implement internally since they can be provided as
+external commands. Several other commands that are commonly implemented
as builtins and can not be implemented as external commands,
including \c type, \c vared, \c pushd and \c popd are implemented as shellscript
functions in fish.
- Mathematical calculations, regex matching, generating lists of numbers
-and many other funtions can easily be done in external programs. They
+and many other funtions can easily be done in external programs. They
should not be supported internally by the shell.
The law of minimalism does not imply that a large feature set is
diff --git a/doc_src/dirh.txt b/doc_src/dirh.txt
index 0a65bdb62..efd4ac79f 100644
--- a/doc_src/dirh.txt
+++ b/doc_src/dirh.txt
@@ -3,6 +3,6 @@
\subsection dirh-synopsis Synopsis
dirh
-\subsection dirh-description Description
+\subsection dirh-description Description
dirh prints the current directory history. The current position in the
history is highlighted using $fish_color_history_current.
diff --git a/doc_src/dirs.txt b/doc_src/dirs.txt
index 0419440ca..b5b9c0aea 100644
--- a/doc_src/dirs.txt
+++ b/doc_src/dirs.txt
@@ -3,5 +3,5 @@
\subsection dirs-synopsis Synopsis
dirs
-\subsection dirs-description Description
+\subsection dirs-description Description
dirs prints the current directory stack.
diff --git a/doc_src/else.txt b/doc_src/else.txt
index 035abd624..e0f8b85bb 100644
--- a/doc_src/else.txt
+++ b/doc_src/else.txt
@@ -13,5 +13,5 @@ status is 0, the commands COMMANDS_TRUE will execute. If it is not 0 and
The command if test -f foo.txt; echo foo.txt exists; else; echo foo.txt does not exist; end
will print foo.txt exists if the file foo.txt
-exists and is a regular file, otherwise it will print
+exists and is a regular file, otherwise it will print
foo.txt does not exist.
diff --git a/doc_src/emit.txt b/doc_src/emit.txt
index 78d36917c..f28217487 100644
--- a/doc_src/emit.txt
+++ b/doc_src/emit.txt
@@ -5,7 +5,7 @@
\subsection emit-description Description
-The emit builtin fires a generic fish event. Such events can be caught by special functions called event handlers.
+The emit builtin fires a generic fish event. Such events can be caught by special functions called event handlers.
\subsection emit-example Example
diff --git a/doc_src/faq.hdr b/doc_src/faq.hdr
index d8058ab1b..0fc746344 100644
--- a/doc_src/faq.hdr
+++ b/doc_src/faq.hdr
@@ -33,7 +33,7 @@ parent is ~. This issue is not possible to fix without either making
every single command into a builtin, breaking Unix semantics or
implementing kludges in every single command.
-This issue can also be seen when doing IO redirection.
+This issue can also be seen when doing IO redirection.
Another related issue is that many programs that operate on recursive
directory trees, like the find command, silently ignore symlinked
@@ -56,7 +56,7 @@ feature, write set CDPATH .
on the commandline.
If fish is unable to locate a command with a given name, fish will
test if a directory of that name exists. If it does, it is implicitly
-assumed that you want to change working directory. For example, the
+assumed that you want to change working directory. For example, the
fastest way to switch to your home directory is to simply press
~
and enter.
@@ -141,21 +141,21 @@ set fish_greeting
\section faq-history Why doesn't history substitution ("!$" etc.) work?
-Because history substitution is an awkward interface that was invented before
-interactive line editing was even possible. Fish drops it in favor of
-perfecting the interactive history recall interface. Switching requires a
-small change of habits: if you want to modify an old line/word, first recall
-it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
+Because history substitution is an awkward interface that was invented before
+interactive line editing was even possible. Fish drops it in favor of
+perfecting the interactive history recall interface. Switching requires a
+small change of habits: if you want to modify an old line/word, first recall
+it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
type "sudo ".
Fish history recall is very simple yet effective:
- As in any modern shell, the Up arrow recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
- - If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
+ - If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
- Alt+Up recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press Alt+Up. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (Alt+D and Alt+Backspace are your friends).
-
+
See documentation for more details about line editing in fish.
*/
diff --git a/doc_src/for.txt b/doc_src/for.txt
index b4b3dfaf1..2ffffe40a 100644
--- a/doc_src/for.txt
+++ b/doc_src/for.txt
@@ -11,7 +11,7 @@ not be executed at all.
\subsection for-example Example
-The command
+The command
for i in foo bar baz; echo $i; end
@@ -21,5 +21,5 @@ would output:
foo
bar
baz
-
+
diff --git a/doc_src/functions.txt b/doc_src/functions.txt
index 7643bfc68..928cd545a 100644
--- a/doc_src/functions.txt
+++ b/doc_src/functions.txt
@@ -8,6 +8,7 @@
This builtin command is used to print or erase functions.
- -a
or --all
list all functions, even those whose name start with an underscore.
+- -c OLDNAME NEWNAME
or --copy OLDNAME NEWNAME
creates a new function named NEWNAME, using the definition of the OLDNAME function.
- -d DESCRIPTION
or --description=DESCRIPTION
change the description of this function
- -e
or --erase
causes the specified functions to be erased.
- -h
or --help
display a help message and exit
@@ -17,11 +18,14 @@ This builtin command is used to print or erase functions.
The default behavior of \c functions when called with no arguments,
is to print the names and definitions of all defined functions. If any
non-switch parameters are given, only the definition of the specified
-functions are printed.
+functions are printed.
Automatically loaded functions can not be removed using functions
-e. Either remove the definition file or change the
$fish_function_path variable to remove autoloaded functions.
+Function copies, created with -c, will not have any event/signal/on-exit
+notifications that the original may have had.
+
The exit status of the functions builtin is the number functions
specified in the argument list that do not exist.
diff --git a/doc_src/if.txt b/doc_src/if.txt
index dbbd378f4..afad53843 100644
--- a/doc_src/if.txt
+++ b/doc_src/if.txt
@@ -8,7 +8,7 @@
if will execute the command CONDITION. If the condition's
exit status is 0, the commands COMMANDS_TRUE will execute. If the
exit status is not 0 and else is given, COMMANDS_FALSE will
-be executed.
+be executed.
In order to use the exit status of multiple commands as the condition
of an if block, use begin; ...; end and
@@ -29,5 +29,5 @@ else
end
will print foo.txt exists if the file foo.txt
-exists and is a regular file, otherwise it will print
+exists and is a regular file, otherwise it will print
foo.txt does not exist.
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index fc8226f58..84dc0a034 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -59,7 +59,7 @@ Here is a list of some useful commands:
- \c mv, move (rename) files
- \c cp, copy files
- \c open, open files with the default application associated with each filetype
-- \c less, list the contents of files
+- \c less, list the contents of files
Commands and parameters are separated by the space character
( ). Every command ends with either a newline (i.e. by pressing
@@ -147,7 +147,7 @@ these characters, so called escape sequences are provided. These are:
Most program use three types of input/output (IO), each represented by
a number called a file descriptor (FD). These are:
-- Standard input, FD 0, for reading, defaults to reading from the keyboard.
+- Standard input, FD 0, for reading, defaults to reading from the keyboard.
- Standard output, FD 1, for writing, defaults to writing to the screen.
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
@@ -160,13 +160,13 @@ default through a simple mechanism called a redirection.
An example of a file redirection is echo hello \>output.txt
,
which directs the output of the echo command to the file error.txt.
-- To redirect standard input, write \
-- To redirect standard output, write \>DESTINATION
-- To redirect standard error, write ^DESTINATION
+- To redirect standard input, write \
+- To redirect standard output, write \>DESTINATION
+- To redirect standard error, write ^DESTINATION
- To redirect standard output to a file which will be appended, write \>\>DESTINATION_FILE
-- To redirect standard error to a file which will be appended, write ^^DESTINATION_FILE
+- To redirect standard error to a file which will be appended, write ^^DESTINATION_FILE
-DESTINATION
can be one of the following:
+DESTINATION
can be one of the following:
- A filename. The output will be written to the specified file.
- An ampersand (\&) followed by the number of another file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
@@ -182,7 +182,7 @@ Any FD can be redirected in an arbitrary way by prefixing the
redirection with the number of the FD.
- To redirect input of FD number N, write N\
-- To redirect output of FD number N, write N\>DESTINATION
+- To redirect output of FD number N, write N\>DESTINATION
- To redirect output of FD number N to a file which will be appended, write N\>\>DESTINATION_FILE
Example: echo Hello 2\>-
and echo Hello ^-
are
@@ -230,7 +230,7 @@ Example:
emacs \&
-will start the emacs text editor in the background.
+will start the emacs text editor in the background.
\subsection syntax-job-control Job control
@@ -323,10 +323,10 @@ function already be loaded, i.e. a circular dependency.
\subsection syntax-conditional Conditional execution of code
There are four fish builtins that let you execute commands only if a
-specific criterion is met. These builtins are
-if,
-switch,
-and and
+specific criterion is met. These builtins are
+if,
+switch,
+and and
or.
The \c switch command is used to execute one of possibly many blocks
@@ -335,7 +335,7 @@ for switch for more information.
The other conditionals use the exit
status of a command to decide if a command or a block of commands
-should be executed. See the documentation for
+should be executed. See the documentation for
if, and
and or for more information.
@@ -392,13 +392,13 @@ These are the general purpose tab completions that \c fish provides:
of these completions are simple options like the \c -l option for \c
ls, but some are more advanced. The latter include:
-- The programs 'man' and 'whatis' show all installed
+- The programs 'man' and 'whatis' show all installed
manual pages as completions.
-- The 'make' program uses all targets in the Makefile in
+- The 'make' program uses all targets in the Makefile in
the current directory as completions.
- The 'mount' command uses all mount points specified in fstab as completions.
-- The 'ssh' command uses all hosts that are stored
-in the known_hosts file as completions. (see the ssh documentation for more information)
+- The 'ssh' command uses all hosts that are stored
+in the known_hosts file as completions. (see the ssh documentation for more information)
- The 'su' command uses all users on the system as completions.
- The \c apt-get, \c rpm and \c yum commands use all installed packages as completions.
@@ -415,7 +415,7 @@ this can be specified as complete -c myprog -a 'start
stop'
. The argument to the \c -a switch is always a single
string. At completion time, it will be tokenized on spaces and tabs,
and variable expansion, command substitution and other forms of
-parameter expansion will take place.
+parameter expansion will take place.
Fish has a special syntax to support specifying switches accepted by a
command. The switches \c -s, \c -l and \c -o are used to specify a
@@ -532,7 +532,7 @@ performing wildcard matching on files, inserting the value of
environment variables into the parameter or even using the output of
another command as a parameter list.
-\subsection expand-wildcard Wildcards
+\subsection expand-wildcard Wildcards
If a star (*) or a question mark (?) is present in the parameter, \c
fish attempts to match the given parameter to any files in such a
@@ -609,7 +609,7 @@ href="#variables"> Environment variables section.
Example:
echo \$HOME
prints the home directory of the current
-user.
+user.
If you wish to combine environment variables with text, you can
encase the variables within braces to embed a variable inside running
@@ -687,9 +687,9 @@ performed:
- If the string is the entire word \c self, the shells pid is the result
- Otherwise, if the string is the id of a job, the result is the process
group id of the job.
-- Otherwise, if any child processes match the specified string, their
-pids are the result of the expansion.
-- Otherwise, if any processes owned by the user match the specified
+- Otherwise, if any child processes match the specified string, their
+pids are the result of the expansion.
+- Otherwise, if any processes owned by the user match the specified
string, their pids are the result of the expansion.
This form of expansion is useful for commands like kill and fg, which
@@ -739,7 +739,7 @@ expansion.
To set a variable value, use the \c set
command.
-Example:
+Example:
To set the variable \c smurf_color to the value \c blue, use the command
set smurf_color blue
.
@@ -869,7 +869,7 @@ echo $PATH[3]
Note that array indices start at 1 in fish, not 0, as is more common
in other languages. This is because many common Unix tools like seq
-are more suited to such use.
+are more suited to such use.
If you do not use any brackets, all the elements of the array will be
written as separate items. This means you can easily iterate over an
@@ -921,13 +921,13 @@ certain environment variables.
\c fish also sends additional information to the user through the
values of certain environment variables. The user can not change the
-values of most of these variables.
+values of most of these variables.
- \c _, which is the name of the currently running command.
- \c argv, which is an array of arguments to the shell or function. \c argv is only defined when inside a function call, or if fish was invoked with a list of arguments, like 'fish myscript.fish foo bar'. This variable can be changed by the user.
- \c history, which is an array containing the last commands that where entered.
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
-- \c PWD, which is the current working directory.
+- \c PWD, which is the current working directory.
- \c status, which is the exit status of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
- \c USER, which is the username. This variable can only be changed by the root user.
@@ -1024,7 +1024,7 @@ variables set the specified aspect of the locale information. LANG
is a fallback value, it will be used if none of the LC_ variables are
specified.
-\section builtin-overview Builtins
+\section builtin-overview Builtins
Many other shells have a large library of builtin commands. Most of
these commands are also available as standalone commands, but have
@@ -1042,7 +1042,7 @@ switch of the command.
The \c fish editor features copy and paste, a searchable history and
many editor functions that can be bound to special keyboard
-shortcuts. The most important keybinding is probably the tab key, which is bound to the complete function.
+shortcuts. The most important keybinding is probably the tab key, which is bound to the complete function.
Here are some of the commands available in the editor:
- Tab completes the current token
@@ -1060,12 +1060,12 @@ Here are some of the commands available in the editor:
- Ctrl-l clear and repaint screen
- Ctrl-w move previous word to the killring
- Alt-d move next word to the killring
-- Alt-w prints a short description of the command under the cursor
-- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
+- Alt-w prints a short description of the command under the cursor
+- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
- Alt-p adds the string '| less;' to the end of the job under the cursor. The result is that the output of the command will be paged.
-You can change these key bindings using the
-bind builtin command.
+You can change these key bindings using the
+bind builtin command.
- \c backward-char, moves one character to the left
@@ -1096,7 +1096,7 @@ If such a script produces output, the script needs to finish by
calling 'commandline -f repaint' in order to tell fish that a repaint
is in order.
-\subsection killring Copy and paste (Kill Ring)
+\subsection killring Copy and paste (Kill Ring)
\c fish uses an Emacs style kill ring for copy and paste
functionality. Use Ctrl-K to cut from the current cursor position to
@@ -1107,7 +1107,7 @@ Meta-Y to rotate to the previous kill.
If the environment variable DISPLAY is set, \c fish will try to
connect to the X-windows server specified by this variable, and use
-the clipboard on the X server for copying and pasting.
+the clipboard on the X server for copying and pasting.
\subsection history Searchable history
@@ -1158,7 +1158,7 @@ graphical user interface from the terminal, and then be able to
continue using the shell. In such cases, there are several ways in
which the user can change fish
's behavior.
--# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
+-# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
-# By pressing ^Z, the user stops a currently running foreground program and returns control to \c fish. Some programs do not support this feature, or remap it to another key. Gnu emacs uses ^X z to stop running.
-# By using the fg and bg builtin commands, the user can send any currently running job into the foreground or background.
@@ -1247,7 +1247,7 @@ returning to the shell) when the \c fish_prompt function is called.
Example:
-The default \c fish title is
+The default \c fish title is
@@ -1379,9 +1379,9 @@ href='fish-users@lists.sf.net'>fish-users@lists.sf.net.
\subsection todo-features Missing features
- Complete vi-mode key bindings
-- More completions (for example konsole, gnome-terminal,
+- More completions (for example konsole, gnome-terminal,
rlogin, rsync, arch, finger, bibtex, aspell, xpdf,
-compress, wine, dig, batch,
+compress, wine, dig, batch,
g++, javac, java, gcj, lpr, doxygen, whois)
- Undo support
- wait shellscript
@@ -1391,7 +1391,7 @@ g++, javac, java, gcj, lpr, doxygen, whois)
\subsection todo-possible Possible features
-- mouse support like zsh has with http://stchaz.free.fr/mouse.zsh
+- mouse support like zsh has with http://stchaz.free.fr/mouse.zsh
installed would be awesome
- suggest a completion on unique matches by writing it out in an understated color
- Highlight beginning/end of block when moving over a block command
@@ -1408,7 +1408,7 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- History could reload itself when the file is updated. This would need to be done in a clever way to avoid chain reactions
- The error function should probably be moved into it's own library, and be made mere general purpose.
- The code validation functions should be moved from the parser to parse_util.
-- Try to remove more malloc calls to reduce memory usage. The time_t arrays used by the autoloader sound like a good candidate.
+- Try to remove more malloc calls to reduce memory usage. The time_t arrays used by the autoloader sound like a good candidate.
- The code validator should warn about unknown commands.
- Auto-newlines
- A fault injector could be written to increase robustness and testing of error recovery paths
@@ -1417,7 +1417,7 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- exec_subshell should be either merged with eval or moved to parser.c
- Don't use expand_string to perform completions. wildcard_complete can be called directly, the brace expansion handling should be universal, and the process expansion can be moved to complete.c.
- Make the history search support incremental searching
-- An automatic logout feature
+- An automatic logout feature
- Make tab completions completely silent by default, i.e. kill stderr when running completion commands. This needs to be overridalbe for debugging purposes.
- Move history to an environment variable
@@ -1426,8 +1426,8 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- Suspending and then resuming pipelines containing a builtin or a shellscript function is broken. Ideally, the exec function in exec.c should be able to resume execution of a partially executed job.
- delete-word is broken on the commandline 'sudo update-alternatives --config x-'
- Sometimes autoheader needs to be run on a fresh tarball. Fix dates before creating tarballs.
-- The completion autoloader does not remember which completions where actually autoloaded, and may unload manually specified completions.
-- There have been stray reports of issues with strange values of the PATH variable during startup.
+- The completion autoloader does not remember which completions where actually autoloaded, and may unload manually specified completions.
+- There have been stray reports of issues with strange values of the PATH variable during startup.
- bindings in config.fish are overwritten by default key bindings.
- Adding 'bind -k ...' doesn't overwrite non-keybinding binds of the same sequence.
- History file does not remove duplicates.
diff --git a/doc_src/license.hdr b/doc_src/license.hdr
index 5a5654c23..a05927b99 100644
--- a/doc_src/license.hdr
+++ b/doc_src/license.hdr
@@ -14,7 +14,7 @@ Version 2, June 1991
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
@@ -447,7 +447,7 @@ PERFORMANCE OF THIS SOFTWARE.
License for XSel
The XSel command, written and copyrighted by Conrad Parker, is
-distributed together with \c fish.
+distributed together with \c fish.
It is Copyright (C) 2001 Conrad Parker
@@ -802,7 +802,7 @@ of these things:
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
-
+
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
diff --git a/doc_src/math.txt b/doc_src/math.txt
index 0bef1437b..9455e0da0 100644
--- a/doc_src/math.txt
+++ b/doc_src/math.txt
@@ -9,7 +9,7 @@
math is used to perform mathematical calculations. It is only a very
thin wrapper for the bc program, that makes it possible to specify an
expression from the command line without using non-standard extensions
-or a pipeline. Simply use a command like math 1+1
.
+or a pipeline. Simply use a command like math 1+1
.
For a description of the syntax supported by math, see the manual for
the bc program. Keep in mind that parameter expansion takes place on
diff --git a/doc_src/mimedb.txt b/doc_src/mimedb.txt
index fbfcdf9ee..6a4e99446 100644
--- a/doc_src/mimedb.txt
+++ b/doc_src/mimedb.txt
@@ -5,7 +5,7 @@
\subsection mimedb-description Description
-- \c FILES is a list of files to analyse
+- \c FILES is a list of files to analyse
- \c -t, \c --input-file-data the specified files type should be determined both by their filename and by their contents (Default)
- \c -f, \c --input-filename the specified files type should be determined by their filename
- \c -i, \c --input-mime the arguments are not files but mimetypes
diff --git a/doc_src/not.txt b/doc_src/not.txt
index 5adedc3a9..bb053da74 100644
--- a/doc_src/not.txt
+++ b/doc_src/not.txt
@@ -5,7 +5,7 @@
\subsection not-description Description
-The \c not builtin is used to negate the exit status of another command.
+The \c not builtin is used to negate the exit status of another command.
\subsection not-example Example
diff --git a/doc_src/popd.txt b/doc_src/popd.txt
index 521059abb..b3c87584d 100644
--- a/doc_src/popd.txt
+++ b/doc_src/popd.txt
@@ -3,6 +3,6 @@
\subsection popd-synopsis Synopsis
popd
-\subsection popd-description Description
-popd removes the top directory from the directory stack and
+\subsection popd-description Description
+popd removes the top directory from the directory stack and
cd's to the new top directory.
diff --git a/doc_src/prevd.txt b/doc_src/prevd.txt
index 57917f105..83d6b9093 100644
--- a/doc_src/prevd.txt
+++ b/doc_src/prevd.txt
@@ -3,7 +3,7 @@
\subsection prevd-synopsis Synopsis
prevd [-l | --list] [pos]
-\subsection prevd-description Description
+\subsection prevd-description Description
prevd moves backwards pos positions in the history
of visited directories; if the beginning of the history has been hit,
diff --git a/doc_src/pushd.txt b/doc_src/pushd.txt
index 4a208791e..525690720 100644
--- a/doc_src/pushd.txt
+++ b/doc_src/pushd.txt
@@ -3,7 +3,7 @@
\subsection pushd-synopsis Synopsis
pushd [DIRECTORY]
-\subsection pushd-description Description
+\subsection pushd-description Description
The pushd function adds DIRECTORY to the top of the directory stack
and makes it the current directory. Use popd to pop it off and and
return to the original directory.
diff --git a/doc_src/random.txt b/doc_src/random.txt
index f6dd0928f..ad9b658a0 100644
--- a/doc_src/random.txt
+++ b/doc_src/random.txt
@@ -21,4 +21,4 @@ for i in (seq (random) -1 1)
echo $i
sleep
end
-
+
diff --git a/doc_src/read.txt b/doc_src/read.txt
index 564b890a8..b85b5fd8f 100644
--- a/doc_src/read.txt
+++ b/doc_src/read.txt
@@ -6,12 +6,12 @@
\subsection read-description Description
The read builtin causes fish to read one line from standard
-input and store the result in one or more environment variables.
+input and store the result in one or more environment variables.
- -c CMD or --command=CMD specifies that the initial string in the interactive mode command buffer should be CMD.
- -e or --export specifies that the variables will be exported to subshells.
- -g or --global specifies that the variables will be made global.
-- -m NAME or --mode-name=NAME specifies that the name NAME should be used to save/load the history file. If NAME is fish, the regular fish history will be available.
+- -m NAME or --mode-name=NAME specifies that the name NAME should be used to save/load the history file. If NAME is fish, the regular fish history will be available.
- -p PROMPT_CMD or --prompt=PROMPT_CMD specifies that the output of the shell command PROMPT_CMD should be used as the prompt for the interactive mode prompt. The default prompt command is set_color green; echo read; set_color normal; echo "> ".
- -s
or --shell
Use syntax highlighting, tab completions and command termination suitable for entering shellscript code
- -u
or --unexport
causes the specified environment not to be exported to child processes
diff --git a/doc_src/return.txt b/doc_src/return.txt
index e7883f37f..2cfd5ab62 100644
--- a/doc_src/return.txt
+++ b/doc_src/return.txt
@@ -3,7 +3,7 @@
\subsection return-synopsis Synopsis
function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end
-\subsection return-description Description
+\subsection return-description Description
The \c return builtin is used to halt a currently running function. It
is usually added inside of a conditional block such as an set_color --bold white will
result in a white font color.
Not all terminal emulators support all these features. This is not a
-bug in set_color but a missing feature in the terminal emulator.
+bug in set_color but a missing feature in the terminal emulator.
set_color uses the terminfo database to look up how to change terminal
colors on whatever terminal is in use. Some systems have old and
diff --git a/doc_src/source.txt b/doc_src/source.txt
index 05abc4fc1..9c6f11d3e 100644
--- a/doc_src/source.txt
+++ b/doc_src/source.txt
@@ -3,7 +3,7 @@
\subsection source-synopsis Synopsis
. FILENAME [ARGUMENTS...]
-\subsection source-description Description
+\subsection source-description Description
Evaluates the commands of the specified file in the current
shell. This is different from starting a new process to perform the
diff --git a/doc_src/ulimit.txt b/doc_src/ulimit.txt
index ebed0f09b..6e21eba30 100644
--- a/doc_src/ulimit.txt
+++ b/doc_src/ulimit.txt
@@ -27,7 +27,7 @@ Note that not all these limits are available in all operating systems.
The value of limit can be a number in the unit specified for
the resource or one of the special values hard, soft, or unlimited,
which stand for the current hard limit, the current soft limit, and no
-limit, respectively.
+limit, respectively.
If limit is given, it is the new value of the specified resource. If
no option is given, then -f is assumed. Values are in kilobytes,
diff --git a/doc_src/vared.txt b/doc_src/vared.txt
index bf383560e..9f1cef531 100644
--- a/doc_src/vared.txt
+++ b/doc_src/vared.txt
@@ -1,4 +1,4 @@
-\section vared vared - interactively edit the value of an environment variable
+\section vared vared - interactively edit the value of an environment variable
\subsection vared-synopsis Synopsis
vared VARIABLE_NAME
@@ -7,7 +7,7 @@
vared is used to interactively edit the value of an environment
variable. Array variables as a whole can not be edited using vared,
-but individual array elements can.
+but individual array elements can.
\subsection vared-example Example
diff --git a/env.c b/env.c
index 321251851..b7c848e3a 100644
--- a/env.c
+++ b/env.c
@@ -83,11 +83,11 @@ extern char **__environ;
*/
typedef struct env_node
{
- /**
- Variable table
+ /**
+ Variable table
*/
hash_table_t env;
- /**
+ /**
Does this node imply a new variable scope? If yes, all
non-global variables below this one in the stack are
invisible. If new_scope is set for the global variable node,
@@ -98,8 +98,8 @@ typedef struct env_node
Does this node contain any variables which are exported to subshells
*/
int export;
-
- /**
+
+ /**
Pointer to next level
*/
struct env_node *next;
@@ -115,7 +115,7 @@ typedef struct var_entry
{
int export; /**< Whether the variable should be exported */
size_t size; /**< The maximum length (excluding the NULL) that will fit into this var_entry_t */
-
+
#if __STDC_VERSION__ < 199901L
wchar_t val[1]; /**< The value of the variable */
#else
@@ -206,12 +206,12 @@ static const wchar_t *locale_variable[] =
*/
static void clear_hash_entry( void *key, void *data )
{
- var_entry_t *entry = (var_entry_t *)data;
+ var_entry_t *entry = (var_entry_t *)data;
if( entry->export )
{
has_changed = 1;
}
-
+
free( (void *)key );
free( (void *)data );
}
@@ -227,20 +227,20 @@ static void start_fishd()
{
string_buffer_t cmd;
struct passwd *pw;
-
+
sb_init( &cmd );
pw = getpwuid(getuid());
-
+
debug( 3, L"Spawning new copy of fishd" );
-
+
if( !pw )
{
debug( 0, _( L"Could not get user information" ) );
return;
}
-
+
sb_printf( &cmd, FISHD_CMD, pw->pw_name );
-
+
eval( (wchar_t *)cmd.buff,
0,
TOP );
@@ -287,10 +287,10 @@ static void handle_locale()
/*
Array of locale constants corresponding to the local variable names defined in locale_variable
*/
- static const int cat[] =
+ static const int cat[] =
{
- 0,
- LC_ALL,
+ 0,
+ LC_ALL,
LC_COLLATE,
LC_CTYPE,
LC_MESSAGES,
@@ -299,7 +299,7 @@ static void handle_locale()
LC_TIME
}
;
-
+
if( lc_all )
{
wsetlocale( LC_ALL, lc_all );
@@ -311,7 +311,7 @@ static void handle_locale()
{
wsetlocale( LC_ALL, lang );
}
-
+
for( i=2; locale_variable[i]; i++ )
{
const wchar_t *val = env_get( locale_variable[i] );
@@ -322,11 +322,11 @@ static void handle_locale()
}
}
}
-
+
if( wcscmp( wsetlocale( LC_MESSAGES, (void *)0 ), old ) != 0 )
{
- /*
+ /*
Try to make change known to gettext. Both changing
_nl_msg_cat_cntr and calling dcgettext might potentially
tell some gettext implementation that the translation
@@ -338,14 +338,14 @@ static void handle_locale()
_nl_msg_cat_cntr++;
dcgettext( "fish", "Changing language to English", LC_MESSAGES );
-
+
if( is_interactive )
{
debug( 0, _(L"Changing language to English") );
}
}
free( old );
-
+
}
@@ -354,16 +354,16 @@ static void handle_locale()
proper events are triggered when an event occurs.
*/
static void universal_callback( int type,
- const wchar_t *name,
+ const wchar_t *name,
const wchar_t *val )
{
wchar_t *str=0;
-
+
if( is_locale( name ) )
{
handle_locale();
}
-
+
switch( type )
{
case SET:
@@ -372,29 +372,29 @@ static void universal_callback( int type,
str=L"SET";
break;
}
-
+
case ERASE:
{
str=L"ERASE";
break;
}
}
-
+
if( str )
{
event_t ev;
-
+
has_changed=1;
-
+
ev.type=EVENT_VARIABLE;
ev.param1.variable=name;
ev.function_name=0;
-
+
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, str );
al_push( &ev.arguments, name );
- event_fire( &ev );
+ event_fire( &ev );
al_destroy( &ev.arguments );
}
}
@@ -405,11 +405,11 @@ static void universal_callback( int type,
static void setup_path()
{
wchar_t *path;
-
+
int i, j;
array_list_t l;
- const wchar_t *path_el[] =
+ const wchar_t *path_el[] =
{
L"/bin",
L"/usr/bin",
@@ -419,19 +419,19 @@ static void setup_path()
;
path = env_get( L"PATH" );
-
+
al_init( &l );
-
+
if( path )
{
tokenize_variable_array( path, &l );
}
-
+
for( j=0; path_el[j]; j++ )
{
int has_el=0;
-
+
for( i=0; ipw_dir );
env_set( L"HOME", dir, ENV_GLOBAL );
- free( dir );
+ free( dir );
free( unam_narrow );
- }
+ }
env_set_pwd();
-
+
}
void env_init()
@@ -527,15 +527,16 @@ void env_init()
struct passwd *pw;
wchar_t *uname;
wchar_t *version;
-
+ wchar_t *shlvl;
+
sb_init( &dyn_var );
b_init( &export_buffer );
-
+
/*
These variables can not be altered directly by the user
*/
hash_init( &env_read_only, &hash_wcs_func, &hash_wcs_cmp );
-
+
hash_put( &env_read_only, L"status", L"" );
hash_put( &env_read_only, L"history", L"" );
hash_put( &env_read_only, L"version", L"" );
@@ -543,7 +544,8 @@ void env_init()
hash_put( &env_read_only, L"LINES", L"" );
hash_put( &env_read_only, L"COLUMNS", L"" );
hash_put( &env_read_only, L"PWD", L"" );
-
+ hash_put( &env_read_only, L"SHLVL", L"" );
+
/*
Names of all dynamically calculated variables
*/
@@ -561,20 +563,20 @@ void env_init()
hash_put( &env_read_only, L"HOME", L"" );
hash_put( &env_read_only, L"USER", L"" );
}
-
+
top = malloc( sizeof(env_node_t) );
top->next = 0;
top->new_scope = 0;
top->export=0;
hash_init( &top->env, &hash_wcs_func, &hash_wcs_cmp );
global_env = top;
- global = &top->env;
-
+ global = &top->env;
+
/*
Now the environemnt variable handling is set up, the next step
is to insert valid data
*/
-
+
/*
Import environment variables
*/
@@ -582,14 +584,14 @@ void env_init()
{
wchar_t *key, *val;
wchar_t *pos;
-
+
key = str2wcs(*p);
if( !key )
{
continue;
}
-
+
val = wcschr( key, L'=' );
if( val == 0 )
@@ -597,7 +599,7 @@ void env_init()
env_set( key, L"", ENV_EXPORT );
}
else
- {
+ {
*val = L'\0';
val++;
pos=val;
@@ -612,10 +614,10 @@ void env_init()
}
env_set( key, val, ENV_EXPORT | ENV_GLOBAL );
- }
+ }
free(key);
}
-
+
/*
Set up the PATH variable
*/
@@ -638,12 +640,44 @@ void env_init()
version = str2wcs( PACKAGE_VERSION );
env_set( L"version", version, ENV_GLOBAL );
free( version );
-
- env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
+
+ env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
env_get( L"USER" ),
&start_fishd,
&universal_callback );
+ /*
+ Set up SHLVL variable
+ */
+ shlvl = env_get( L"SHLVL" );
+ if ( shlvl )
+ {
+ wchar_t *nshlvl, **end_nshlvl;
+ /* add an extra space for digit dump (9+1=10) */
+ size_t i = wcslen( shlvl ) + 2 * sizeof(wchar_t);
+
+ nshlvl = malloc(i);
+ end_nshlvl = calloc( 1, sizeof(nshlvl) );
+ if ( !nshlvl || !end_nshlvl )
+ DIE_MEM();
+
+ if ( nshlvl && swprintf( nshlvl, i,
+ L"%ld", wcstoul( shlvl, end_nshlvl, 10 )+1 ) != -1 )
+ {
+ env_set( L"SHLVL",
+ nshlvl,
+ ENV_GLOBAL | ENV_EXPORT );
+ }
+ free( end_nshlvl );
+ free( nshlvl );
+ }
+ else
+ {
+ env_set( L"SHLVL",
+ L"1",
+ ENV_GLOBAL | ENV_EXPORT );
+ }
+
/*
Set correct defaults for e.g. USER and HOME variables
*/
@@ -653,26 +687,26 @@ void env_init()
void env_destroy()
{
env_universal_destroy();
-
+
sb_destroy( &dyn_var );
b_destroy( &export_buffer );
-
+
while( &top->env != global )
{
env_pop();
}
-
+
hash_destroy( &env_read_only );
hash_destroy( &env_electric );
-
+
hash_foreach( global, &clear_hash_entry );
hash_destroy( global );
free( top );
-
+
free( export_arr );
-
+
}
/**
@@ -687,7 +721,7 @@ static env_node_t *env_get_node( const wchar_t *key )
while( env != 0 )
{
- res = (var_entry_t *) hash_get( &env->env,
+ res = (var_entry_t *) hash_get( &env->env,
key );
if( res != 0 )
{
@@ -698,17 +732,17 @@ static env_node_t *env_get_node( const wchar_t *key )
{
env = global_env;
}
- else
+ else
{
env = env->next;
}
}
-
+
return 0;
}
-int env_set( const wchar_t *key,
- const wchar_t *val,
+int env_set( const wchar_t *key,
+ const wchar_t *val,
int var_mode )
{
int free_val = 0;
@@ -716,14 +750,14 @@ int env_set( const wchar_t *key,
env_node_t *node;
int has_changed_old = has_changed;
int has_changed_new = 0;
- var_entry_t *e=0;
+ var_entry_t *e=0;
int done=0;
event_t ev;
- int is_universal = 0;
-
+ int is_universal = 0;
+
CHECK( key, ENV_INVALID );
-
+
if( val && contains( key, L"PWD", L"HOME" ) )
{
void *context = halloc( 0, 0 );
@@ -737,12 +771,12 @@ int env_set( const wchar_t *key,
halloc_free( context );
}
- if( (var_mode & ENV_USER ) &&
+ if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
return ENV_PERM;
}
-
+
if( wcscmp( key, L"umask" ) == 0)
{
wchar_t *end;
@@ -752,10 +786,10 @@ int env_set( const wchar_t *key,
Set the new umask
*/
if( val && wcslen(val) )
- {
+ {
errno=0;
mask = wcstol( val, &end, 8 );
-
+
if( !errno && (!*end) && (mask <= 0777) && (mask >= 0) )
{
umask( mask );
@@ -776,7 +810,7 @@ int env_set( const wchar_t *key,
{
val = ENV_NULL;
}
-
+
if( var_mode & ENV_UNIVERSAL )
{
int export = 0;
@@ -786,31 +820,31 @@ int env_set( const wchar_t *key,
{
env_universal_get_export( key );
}
- else
+ else
{
export = (var_mode & ENV_EXPORT );
}
-
+
env_universal_set( key, val, export );
is_universal = 1;
}
else
{
-
+
node = env_get_node( key );
if( node && &node->env != 0 )
{
- e = (var_entry_t *) hash_get( &node->env,
+ e = (var_entry_t *) hash_get( &node->env,
key );
-
+
if( e->export )
{
has_changed_new = 1;
}
}
- if( (var_mode & ENV_LOCAL) ||
+ if( (var_mode & ENV_LOCAL) ||
(var_mode & ENV_GLOBAL) )
{
node = ( var_mode & ENV_GLOBAL )?global_env:top;
@@ -821,7 +855,7 @@ int env_set( const wchar_t *key,
{
if( !(var_mode & ENV_EXPORT ) &&
!(var_mode & ENV_UNEXPORT ) )
- {
+ {
var_mode = e->export?ENV_EXPORT:0;
}
}
@@ -832,26 +866,26 @@ int env_set( const wchar_t *key,
proc_had_barrier=1;
env_universal_barrier();
}
-
+
if( env_universal_get( key ) )
{
int export = 0;
-
+
if( !(var_mode & ENV_EXPORT ) &&
!(var_mode & ENV_UNEXPORT ) )
{
env_universal_get_export( key );
}
- else
+ else
{
export = (var_mode & ENV_EXPORT );
}
-
+
env_universal_set( key, val, export );
is_universal = 1;
-
+
done = 1;
-
+
}
else
{
@@ -859,7 +893,7 @@ int env_set( const wchar_t *key,
New variable with unspecified scope. The default
scope is the innermost scope that is shadowing,
which will be either the current function or the
- global scope.
+ global scope.
*/
node = top;
while( node->next && !node->new_scope )
@@ -869,7 +903,7 @@ int env_set( const wchar_t *key,
}
}
}
-
+
if( !done )
{
void *k, *v;
@@ -885,46 +919,46 @@ int env_set( const wchar_t *key,
{
k = wcsdup(key);
}
-
+
old_entry = (var_entry_t *)v;
if( old_entry && old_entry->size >= val_len )
{
entry = old_entry;
-
+
if( !!(var_mode & ENV_EXPORT) || entry->export )
{
entry->export = !!(var_mode & ENV_EXPORT);
- has_changed_new = 1;
+ has_changed_new = 1;
}
}
else
{
free( v );
- entry = malloc( sizeof( var_entry_t ) +
+ entry = malloc( sizeof( var_entry_t ) +
sizeof(wchar_t )*(val_len+1));
-
+
if( !entry )
{
DIE_MEM();
}
-
+
entry->size = val_len;
-
+
if( var_mode & ENV_EXPORT)
{
entry->export = 1;
- has_changed_new = 1;
+ has_changed_new = 1;
}
else
{
entry->export = 0;
}
-
+
}
wcscpy( entry->val, val );
-
+
hash_put( &node->env, k, entry );
if( entry->export )
@@ -936,10 +970,10 @@ int env_set( const wchar_t *key,
{
free((void *)val);
}
-
+
has_changed = has_changed_old || has_changed_new;
}
-
+
}
if( !is_universal )
@@ -947,16 +981,16 @@ int env_set( const wchar_t *key,
ev.type=EVENT_VARIABLE;
ev.param1.variable = key;
ev.function_name = 0;
-
+
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, L"SET" );
al_push( &ev.arguments, key );
-
-// debug( 1, L"env_set: fire events on variable %ls", key );
+
+// debug( 1, L"env_set: fire events on variable %ls", key );
event_fire( &ev );
-// debug( 1, L"env_set: return from event firing" );
- al_destroy( &ev.arguments );
+// debug( 1, L"env_set: return from event firing" );
+ al_destroy( &ev.arguments );
}
if( is_locale( key ) )
@@ -985,15 +1019,15 @@ static int try_remove( env_node_t *n,
{
return 0;
}
-
- hash_remove( &n->env,
+
+ hash_remove( &n->env,
key,
- &old_key_void,
+ &old_key_void,
&old_val_void );
old_key = (wchar_t *)old_key_void;
old_val = (wchar_t *)old_val_void;
-
+
if( old_key != 0 )
{
var_entry_t * v = (var_entry_t *)old_val;
@@ -1001,7 +1035,7 @@ static int try_remove( env_node_t *n,
{
has_changed = 1;
}
-
+
free(old_key);
free(old_val);
return 1;
@@ -1011,7 +1045,7 @@ static int try_remove( env_node_t *n,
{
return 0;
}
-
+
if( n->new_scope )
{
return try_remove( global_env, key, var_mode );
@@ -1027,48 +1061,48 @@ int env_remove( const wchar_t *key, int var_mode )
{
env_node_t *first_node;
int erased = 0;
-
+
CHECK( key, 1 );
-
- if( (var_mode & ENV_USER ) &&
+
+ if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
return 2;
}
-
+
first_node = top;
-
+
if( ! (var_mode & ENV_UNIVERSAL ) )
{
-
+
if( var_mode & ENV_GLOBAL )
{
first_node = global_env;
}
-
+
if( try_remove( first_node, key, var_mode ) )
- {
+ {
event_t ev;
-
+
ev.type=EVENT_VARIABLE;
ev.param1.variable=key;
ev.function_name=0;
-
+
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, L"ERASE" );
al_push( &ev.arguments, key );
-
- event_fire( &ev );
-
+
+ event_fire( &ev );
+
al_destroy( &ev.arguments );
erased = 1;
}
}
-
- if( !erased &&
+
+ if( !erased &&
!(var_mode & ENV_GLOBAL) &&
- !(var_mode & ENV_LOCAL) )
+ !(var_mode & ENV_LOCAL) )
{
erased = !env_universal_remove( key );
}
@@ -1077,8 +1111,8 @@ int env_remove( const wchar_t *key, int var_mode )
{
handle_locale();
}
-
- return !erased;
+
+ return !erased;
}
@@ -1087,23 +1121,23 @@ wchar_t *env_get( const wchar_t *key )
var_entry_t *res;
env_node_t *env = top;
wchar_t *item;
-
+
CHECK( key, 0 );
if( wcscmp( key, L"history" ) == 0 )
{
wchar_t *current;
- int i;
+ int i;
int add_current=0;
- sb_clear( &dyn_var );
-
+ sb_clear( &dyn_var );
+
current = reader_get_buffer();
if( current && wcslen( current ) )
{
add_current=1;
sb_append( &dyn_var, current );
}
-
+
for( i=add_current;; i++ )
{
wchar_t *next = history_get( i-add_current );
@@ -1111,7 +1145,7 @@ wchar_t *env_get( const wchar_t *key )
{
break;
}
-
+
if( i!=0)
{
sb_append( &dyn_var, ARRAY_SEP_STR );
@@ -1124,45 +1158,45 @@ wchar_t *env_get( const wchar_t *key )
}
else if( wcscmp( key, L"COLUMNS" )==0 )
{
- sb_clear( &dyn_var );
- sb_printf( &dyn_var, L"%d", common_get_width() );
- return (wchar_t *)dyn_var.buff;
- }
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", common_get_width() );
+ return (wchar_t *)dyn_var.buff;
+ }
else if( wcscmp( key, L"LINES" )==0 )
{
- sb_clear( &dyn_var );
- sb_printf( &dyn_var, L"%d", common_get_height() );
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", common_get_height() );
return (wchar_t *)dyn_var.buff;
}
else if( wcscmp( key, L"status" )==0 )
{
- sb_clear( &dyn_var );
- sb_printf( &dyn_var, L"%d", proc_get_last_status() );
- return (wchar_t *)dyn_var.buff;
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", proc_get_last_status() );
+ return (wchar_t *)dyn_var.buff;
}
else if( wcscmp( key, L"umask" )==0 )
{
- sb_clear( &dyn_var );
- sb_printf( &dyn_var, L"0%0.3o", get_umask() );
- return (wchar_t *)dyn_var.buff;
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"0%0.3o", get_umask() );
+ return (wchar_t *)dyn_var.buff;
}
-
+
while( env != 0 )
{
- res = (var_entry_t *) hash_get( &env->env,
+ res = (var_entry_t *) hash_get( &env->env,
key );
if( res != 0 )
{
- if( wcscmp( res->val, ENV_NULL )==0)
+ if( wcscmp( res->val, ENV_NULL )==0)
{
return 0;
}
else
{
- return res->val;
+ return res->val;
}
}
-
+
if( env->new_scope )
{
env = global_env;
@@ -1171,15 +1205,15 @@ wchar_t *env_get( const wchar_t *key )
{
env = env->next;
}
- }
+ }
if( !proc_had_barrier)
{
proc_had_barrier=1;
env_universal_barrier();
}
-
+
item = env_universal_get( key );
-
+
if( !item || (wcscmp( item, ENV_NULL )==0))
{
return 0;
@@ -1197,7 +1231,7 @@ int env_exist( const wchar_t *key, int mode )
wchar_t *item=0;
CHECK( key, 0 );
-
+
/*
Read only variables all exist, and they are all global. A local
version can not exist.
@@ -1213,21 +1247,21 @@ int env_exist( const wchar_t *key, int mode )
if( ! (mode & ENV_UNIVERSAL) )
{
env = (mode & ENV_GLOBAL)?global_env:top;
-
+
while( env != 0 )
{
- res = (var_entry_t *) hash_get( &env->env,
+ res = (var_entry_t *) hash_get( &env->env,
key );
if( res != 0 )
{
return 1;
}
-
+
if( mode & ENV_LOCAL )
{
break;
}
-
+
if( env->new_scope )
{
env = global_env;
@@ -1236,9 +1270,9 @@ int env_exist( const wchar_t *key, int mode )
{
env = env->next;
}
- }
+ }
}
-
+
if( ! (mode & ENV_LOCAL) && ! (mode & ENV_GLOBAL) )
{
if( !proc_had_barrier)
@@ -1246,9 +1280,9 @@ int env_exist( const wchar_t *key, int mode )
proc_had_barrier=1;
env_universal_barrier();
}
-
+
item = env_universal_get( key );
-
+
}
return item != 0;
@@ -1259,16 +1293,16 @@ int env_exist( const wchar_t *key, int mode )
*/
static int local_scope_exports( env_node_t *n )
{
-
+
if( n==global_env )
return 0;
-
+
if( n->export )
return 1;
-
+
if( n->new_scope )
return 0;
-
+
return local_scope_exports( n->next );
}
@@ -1283,7 +1317,7 @@ void env_push( int new_scope )
{
has_changed |= local_scope_exports(top);
}
- top = node;
+ top = node;
}
@@ -1294,7 +1328,7 @@ void env_pop()
{
int i;
int locale_changed = 0;
-
+
env_node_t *killme = top;
for( i=0; locale_variable[i]; i++ )
@@ -1310,7 +1344,7 @@ void env_pop()
{
has_changed |= killme->export || local_scope_exports( killme->next );
}
-
+
top = top->next;
hash_foreach( &killme->env, &clear_hash_entry );
hash_destroy( &killme->env );
@@ -1318,14 +1352,14 @@ void env_pop()
if( locale_changed )
handle_locale();
-
+
}
else
{
debug( 0,
_( L"Tried to pop empty environment stack." ) );
sanity_lose();
- }
+ }
}
@@ -1333,12 +1367,12 @@ void env_pop()
Function used with hash_foreach to insert keys of one table into
another
*/
-static void add_key_to_hash( void *key,
+static void add_key_to_hash( void *key,
void *data,
void *aux )
{
var_entry_t *e = (var_entry_t *)data;
- if( ( e->export && get_names_show_exported) ||
+ if( ( e->export && get_names_show_exported) ||
( !e->export && get_names_show_unexported) )
{
hash_put( (hash_table_t *)aux, key, 0 );
@@ -1358,8 +1392,8 @@ static void add_to_hash( void *k, void *aux )
/**
Add key to list
*/
-static void add_key_to_list( void * key,
- void * val,
+static void add_key_to_list( void * key,
+ void * val,
void *aux )
{
al_push( (array_list_t *)aux, key );
@@ -1376,10 +1410,10 @@ void env_get_names( array_list_t *l, int flags )
env_node_t *n=top;
CHECK( l, );
-
- get_names_show_exported =
+
+ get_names_show_exported =
flags & ENV_EXPORT|| (!(flags & ENV_UNEXPORT));
- get_names_show_unexported =
+ get_names_show_unexported =
flags & ENV_UNEXPORT|| (!(flags & ENV_EXPORT));
if( !show_local && !show_global && !show_universal )
@@ -1388,58 +1422,58 @@ void env_get_names( array_list_t *l, int flags )
}
hash_init( &names, &hash_wcs_func, &hash_wcs_cmp );
-
+
if( show_local )
{
while( n )
{
if( n == global_env )
break;
-
- hash_foreach2( &n->env,
+
+ hash_foreach2( &n->env,
add_key_to_hash,
&names );
if( n->new_scope )
- break;
+ break;
else
n = n->next;
}
}
-
+
if( show_global )
{
- hash_foreach2( &global_env->env,
+ hash_foreach2( &global_env->env,
add_key_to_hash,
&names );
if( get_names_show_unexported )
hash_foreach2( &env_electric, &add_key_to_list, l );
-
+
if( get_names_show_exported )
{
al_push( l, L"COLUMNS" );
al_push( l, L"LINES" );
}
-
+
}
-
+
if( show_universal )
{
array_list_t uni_list;
al_init( &uni_list );
-
- env_universal_get_names( &uni_list,
+
+ env_universal_get_names( &uni_list,
get_names_show_exported,
get_names_show_unexported );
al_foreach2( &uni_list, &add_to_hash, &names );
al_destroy( &uni_list );
}
-
+
hash_get_keys( &names, l );
- hash_destroy( &names );
+ hash_destroy( &names );
}
/**
@@ -1453,10 +1487,10 @@ static void export_func1( void *k, void *v, void *aux )
hash_remove( h, k, 0, 0 );
if( val_entry->export && wcscmp( val_entry->val, ENV_NULL ) )
- {
+ {
hash_put( h, k, val_entry->val );
}
-
+
}
/**
@@ -1466,14 +1500,14 @@ static void get_exported( env_node_t *n, hash_table_t *h )
{
if( !n )
return;
-
+
if( n->new_scope )
get_exported( global_env, h );
else
get_exported( n->next, h );
- hash_foreach2( &n->env, &export_func1, h );
-}
+ hash_foreach2( &n->env, &export_func1, h );
+}
/**
@@ -1483,10 +1517,10 @@ static void export_func2( void *k, void *v, void *aux )
{
wchar_t *key = (wchar_t *)k;
wchar_t *val = (wchar_t *)v;
-
+
char *ks = wcs2str( key );
char *vs = wcs2str( val );
-
+
char *pos = vs;
buffer_t *out = (buffer_t *)aux;
@@ -1495,18 +1529,18 @@ static void export_func2( void *k, void *v, void *aux )
{
DIE_MEM();
}
-
+
/*
Make arrays into colon-separated lists
*/
while( *pos )
{
if( *pos == ARRAY_SEP )
- *pos = ':';
+ *pos = ':';
pos++;
}
int nil = 0;
-
+
b_append( out, ks, strlen(ks) );
b_append( out, "=", 1 );
b_append( out, vs, strlen(vs) );
@@ -1523,21 +1557,21 @@ char **env_export_arr( int recalc )
proc_had_barrier=1;
env_universal_barrier();
}
-
+
if( has_changed )
{
array_list_t uni;
hash_table_t vals;
int prev_was_null=1;
- int pos=0;
+ int pos=0;
int i;
debug( 4, L"env_export_arr() recalc" );
-
+
hash_init( &vals, &hash_wcs_func, &hash_wcs_cmp );
-
+
get_exported( top, &vals );
-
+
al_init( &uni );
env_universal_get_names( &uni, 1, 0 );
for( i=0; ipw_name );
}
-
+
name = malloc( strlen(dir) +
- strlen(uname) +
- strlen(SOCK_FILENAME) +
+ strlen(uname) +
+ strlen(SOCK_FILENAME) +
2 );
-
+
strcpy( name, dir );
strcat( name, "/" );
strcat( name, SOCK_FILENAME );
strcat( name, uname );
-
+
free( dir );
free( uname );
-
+
debug( 3, L"Connect to socket %s at fd %2", name, s );
-
+
local.sun_family = AF_UNIX;
strcpy(local.sun_path, name );
free( name );
len = sizeof(local);
-
- if( connect( s, (struct sockaddr *)&local, len) == -1 )
+
+ if( connect( s, (struct sockaddr *)&local, len) == -1 )
{
close( s );
if( fork_ok && start_fishd )
{
debug( 2, L"Could not connect to socket %d, starting fishd", s );
-
+
start_fishd();
-
+
return get_socket( 0 );
}
-
+
debug( 1, L"Could not connect to universal variable server, already tried manual restart (or no command supplied). You will not be able to share variable values between fish sessions. Is fish properly installed?" );
return -1;
}
-
- if( (fcntl( s, F_SETFL, O_NONBLOCK ) != 0) || (fcntl( s, F_SETFD, FD_CLOEXEC ) != 0) )
+
+ if( (fcntl( s, F_SETFL, O_NONBLOCK ) != 0) || (fcntl( s, F_SETFD, FD_CLOEXEC ) != 0) )
{
wperror( L"fcntl" );
- close( s );
-
+ close( s );
+
return -1;
}
debug( 3, L"Connected to fd %d", s );
-
+
return s;
}
@@ -166,7 +166,7 @@ static int get_socket( int fork_ok )
Callback function used whenever a new fishd message is recieved
*/
static void callback( int type, const wchar_t *name, const wchar_t *val )
-{
+{
if( type == BARRIER_REPLY )
{
barrier_reply = 1;
@@ -174,8 +174,8 @@ static void callback( int type, const wchar_t *name, const wchar_t *val )
else
{
if( external_callback )
- external_callback( type, name, val );
- }
+ external_callback( type, name, val );
+ }
}
/**
@@ -186,21 +186,21 @@ static void check_connection()
{
if( !init )
return;
-
+
if( env_universal_server.killme )
{
debug( 3, L"Lost connection to universal variable server." );
-
+
if( close( env_universal_server.fd ) )
{
wperror( L"close" );
}
-
+
env_universal_server.fd = -1;
env_universal_server.killme=0;
- env_universal_server.input.used=0;
+ env_universal_server.input.used=0;
env_universal_read_all();
- }
+ }
}
/**
@@ -210,10 +210,10 @@ static void env_universal_remove_all()
{
array_list_t lst;
int i;
-
+
al_init( &lst );
-
- env_universal_common_get_names( &lst,
+
+ env_universal_common_get_names( &lst,
1,
1 );
@@ -224,7 +224,7 @@ static void env_universal_remove_all()
}
al_destroy( &lst );
-
+
}
@@ -237,9 +237,9 @@ static void reconnect()
{
if( get_socket_count >= RECONNECT_COUNT )
return;
-
+
debug( 3, L"Get new fishd connection" );
-
+
init = 0;
env_universal_server.buffer_consumed = env_universal_server.buffer_used = 0;
env_universal_server.fd = get_socket(1);
@@ -252,22 +252,22 @@ static void reconnect()
}
-void env_universal_init( wchar_t * p,
- wchar_t *u,
+void env_universal_init( wchar_t * p,
+ wchar_t *u,
void (*sf)(),
void (*cb)( int type, const wchar_t *name, const wchar_t *val ))
{
path=p;
user=u;
- start_fishd=sf;
+ start_fishd=sf;
external_callback = cb;
connection_init( &env_universal_server, -1 );
-
+
env_universal_server.fd = get_socket(1);
env_universal_common_init( &callback );
- env_universal_read_all();
- init = 1;
+ env_universal_read_all();
+ init = 1;
if( env_universal_server.fd >= 0 )
{
env_universal_barrier();
@@ -285,7 +285,7 @@ void env_universal_destroy()
{
wperror( L"fcntl" );
}
- try_send_all( &env_universal_server );
+ try_send_all( &env_universal_server );
}
connection_destroy( &env_universal_server );
@@ -305,22 +305,22 @@ int env_universal_read_all()
if( env_universal_server.fd == -1 )
{
- reconnect();
+ reconnect();
if( env_universal_server.fd == -1 )
- return 0;
+ return 0;
}
-
+
if( env_universal_server.fd != -1 )
{
read_message( &env_universal_server );
- check_connection();
+ check_connection();
return 1;
}
else
{
debug( 2, L"No connection to universal variable server" );
return 0;
- }
+ }
}
wchar_t *env_universal_get( const wchar_t *name )
@@ -329,7 +329,7 @@ wchar_t *env_universal_get( const wchar_t *name )
return 0;
CHECK( name, 0 );
-
+
return env_universal_common_get( name );
}
@@ -339,7 +339,7 @@ int env_universal_get_export( const wchar_t *name )
return 0;
CHECK( name, 0 );
-
+
return env_universal_common_get_export( name );
}
@@ -366,19 +366,19 @@ void env_universal_barrier()
debug( 3, L"Create barrier" );
while( 1 )
{
- try_send_all( &env_universal_server );
- check_connection();
-
+ try_send_all( &env_universal_server );
+ check_connection();
+
if( q_empty( &env_universal_server.unsent ) )
break;
-
+
if( env_universal_server.fd == -1 )
{
reconnect();
debug( 2, L"barrier interrupted, exiting" );
- return;
+ return;
}
-
+
FD_ZERO( &fds );
FD_SET( env_universal_server.fd, &fds );
select( env_universal_server.fd+1, 0, &fds, 0, 0 );
@@ -394,10 +394,10 @@ void env_universal_barrier()
{
reconnect();
debug( 2, L"barrier interrupted, exiting (2)" );
- return;
- }
+ return;
+ }
FD_ZERO( &fds );
- FD_SET( env_universal_server.fd, &fds );
+ FD_SET( env_universal_server.fd, &fds );
select( env_universal_server.fd+1, &fds, 0, 0, 0 );
env_universal_read_all();
}
@@ -408,12 +408,12 @@ void env_universal_barrier()
void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
{
message_t *msg;
-
+
if( !init )
return;
CHECK( name, );
-
+
debug( 3, L"env_universal_set( \"%ls\", \"%ls\" )", name, value );
if( is_dead() )
@@ -422,8 +422,8 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
}
else
{
- msg = create_message( export?SET_EXPORT:SET,
- name,
+ msg = create_message( export?SET_EXPORT:SET,
+ name,
value);
if( !msg )
@@ -431,7 +431,7 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
debug( 1, L"Could not create universal variable message" );
return;
}
-
+
msg->count=1;
q_put( &env_universal_server.unsent, msg );
env_universal_barrier();
@@ -441,18 +441,18 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
int env_universal_remove( const wchar_t *name )
{
int res;
-
+
message_t *msg;
if( !init )
return 1;
-
+
CHECK( name, 1 );
res = !env_universal_common_get( name );
debug( 3,
L"env_universal_remove( \"%ls\" )",
name );
-
+
if( is_dead() )
{
env_universal_common_remove( name );
@@ -464,7 +464,7 @@ int env_universal_remove( const wchar_t *name )
q_put( &env_universal_server.unsent, msg );
env_universal_barrier();
}
-
+
return res;
}
@@ -476,8 +476,8 @@ void env_universal_get_names( array_list_t *l,
return;
CHECK( l, );
-
- env_universal_common_get_names( l,
+
+ env_universal_common_get_names( l,
show_exported,
- show_unexported );
+ show_unexported );
}
diff --git a/env_universal.h b/env_universal.h
index bd76491d9..25e8fc99f 100644
--- a/env_universal.h
+++ b/env_universal.h
@@ -40,7 +40,7 @@ int env_universal_get_export( const wchar_t *name );
void env_universal_set( const wchar_t *name, const wchar_t *val, int export );
/**
Erase a universal variable
-
+
\return zero if the variable existed, and non-zero if the variable did not exist
*/
int env_universal_remove( const wchar_t *name );
@@ -52,7 +52,7 @@ int env_universal_read_all();
/**
Get the names of all universal variables
-
+
\param l the list to insert the names into
\param show_exported whether exported variables should be shown
\param show_unexported whether unexported variables should be shown
diff --git a/env_universal_common.c b/env_universal_common.c
index dde329be1..3cd58c0db 100644
--- a/env_universal_common.c
+++ b/env_universal_common.c
@@ -109,8 +109,8 @@ hash_table_t env_universal_var;
/**
Callback function, should be called on all events
*/
-void (*callback)( int type,
- const wchar_t *key,
+void (*callback)( int type,
+ const wchar_t *key,
const wchar_t *val );
/**
@@ -140,8 +140,8 @@ static char *iconv_utf8_names[]=
*/
static char *iconv_wide_names_unknown[]=
{
- "wchar_t", "WCHAR_T",
- "wchar", "WCHAR",
+ "wchar_t", "WCHAR_T",
+ "wchar", "WCHAR",
0
}
;
@@ -151,12 +151,12 @@ static char *iconv_wide_names_unknown[]=
*/
static char *iconv_wide_names_4[]=
{
- "wchar_t", "WCHAR_T",
- "wchar", "WCHAR",
- "ucs-4", "UCS-4",
- "ucs4", "UCS4",
- "utf-32", "UTF-32",
- "utf32", "UTF32",
+ "wchar_t", "WCHAR_T",
+ "wchar", "WCHAR",
+ "ucs-4", "UCS-4",
+ "ucs4", "UCS4",
+ "utf-32", "UTF-32",
+ "utf32", "UTF32",
0
}
;
@@ -166,12 +166,12 @@ static char *iconv_wide_names_4[]=
*/
static char *iconv_wide_names_2[]=
{
- "wchar_t", "WCHAR_T",
- "wchar", "WCHAR",
- "ucs-2", "UCS-2",
- "ucs2", "UCS2",
- "utf-16", "UTF-16",
- "utf16", "UTF16",
+ "wchar_t", "WCHAR_T",
+ "wchar", "WCHAR",
+ "ucs-2", "UCS-2",
+ "ucs2", "UCS2",
+ "utf-16", "UTF-16",
+ "utf16", "UTF16",
0
}
;
@@ -196,7 +196,7 @@ static wchar_t *utf2wcs( const char *in )
switch (sizeof (wchar_t))
{
-
+
case 2:
to_name = iconv_wide_names_2;
break;
@@ -204,15 +204,15 @@ static wchar_t *utf2wcs( const char *in )
case 4:
to_name = iconv_wide_names_4;
break;
-
+
default:
to_name = iconv_wide_names_unknown;
break;
}
-
+
/*
- The line protocol fish uses is always utf-8.
+ The line protocol fish uses is always utf-8.
*/
char **from_name = iconv_utf8_names;
@@ -220,13 +220,13 @@ static wchar_t *utf2wcs( const char *in )
size_t out_len = sizeof( wchar_t )*(in_len+2);
size_t nconv;
char *nout;
-
+
out = malloc( out_len );
nout = (char *)out;
if( !out )
return 0;
-
+
for( i=0; to_name[i]; i++ )
{
for( j=0; from_name[j]; j++ )
@@ -236,7 +236,7 @@ static wchar_t *utf2wcs( const char *in )
if( cd != (iconv_t) -1)
{
goto start_conversion;
-
+
}
}
}
@@ -246,23 +246,23 @@ static wchar_t *utf2wcs( const char *in )
if (cd == (iconv_t) -1)
{
/* Something went wrong. */
- debug( 0, L"Could not perform utf-8 conversion" );
+ debug( 0, L"Could not perform utf-8 conversion" );
if(errno != EINVAL)
wperror( L"iconv_open" );
-
+
/* Terminate the output string. */
free(out);
- return 0;
+ return 0;
}
-
+
nconv = iconv( cd, (char **)&in, &in_len, &nout, &out_len );
-
+
if (nconv == (size_t) -1)
{
debug( 0, L"Error while converting from utf string" );
return 0;
}
-
+
*((wchar_t *) nout) = L'\0';
/*
@@ -281,12 +281,12 @@ static wchar_t *utf2wcs( const char *in )
}
free( out_old );
}
-
-
+
+
if (iconv_close (cd) != 0)
wperror (L"iconv_close");
-
- return out;
+
+ return out;
}
/**
@@ -296,7 +296,7 @@ static char *wcs2utf( const wchar_t *in )
{
iconv_t cd=(iconv_t) -1;
int i,j;
-
+
char *char_in = (char *)in;
char *out;
@@ -310,7 +310,7 @@ static char *wcs2utf( const wchar_t *in )
switch (sizeof (wchar_t))
{
-
+
case 2:
from_name = iconv_wide_names_2;
break;
@@ -318,7 +318,7 @@ static char *wcs2utf( const wchar_t *in )
case 4:
from_name = iconv_wide_names_4;
break;
-
+
default:
from_name = iconv_wide_names_unknown;
break;
@@ -330,24 +330,24 @@ static char *wcs2utf( const wchar_t *in )
size_t out_len = sizeof( char )*( (MAX_UTF8_BYTES*in_len)+1);
size_t nconv;
char *nout;
-
+
out = malloc( out_len );
nout = (char *)out;
in_len *= sizeof( wchar_t );
if( !out )
return 0;
-
+
for( i=0; to_name[i]; i++ )
{
for( j=0; from_name[j]; j++ )
{
cd = iconv_open ( to_name[i], from_name[j] );
-
+
if( cd != (iconv_t) -1)
{
goto start_conversion;
-
+
}
}
}
@@ -357,17 +357,17 @@ static char *wcs2utf( const wchar_t *in )
if (cd == (iconv_t) -1)
{
/* Something went wrong. */
- debug( 0, L"Could not perform utf-8 conversion" );
+ debug( 0, L"Could not perform utf-8 conversion" );
if(errno != EINVAL)
wperror( L"iconv_open" );
-
+
/* Terminate the output string. */
free(out);
- return 0;
+ return 0;
}
-
+
nconv = iconv( cd, &char_in, &in_len, &nout, &out_len );
-
+
if (nconv == (size_t) -1)
{
@@ -375,13 +375,13 @@ static char *wcs2utf( const wchar_t *in )
debug( 0, L"Error while converting from to string" );
return 0;
}
-
+
*nout = '\0';
-
+
if (iconv_close (cd) != 0)
wperror (L"iconv_close");
-
- return out;
+
+ return out;
}
@@ -421,9 +421,9 @@ static int read_byte( connection_t *src )
int res;
res = read( src->fd, src->buffer, ENV_UNIVERSAL_BUFFER_SIZE );
-
+
// debug(4, L"Read chunk '%.*s'", res, src->buffer );
-
+
if( res < 0 )
{
@@ -432,20 +432,20 @@ static int read_byte( connection_t *src )
{
return ENV_UNIVERSAL_AGAIN;
}
-
+
return ENV_UNIVERSAL_ERROR;
}
-
+
if( res == 0 )
{
return ENV_UNIVERSAL_EOF;
}
-
+
src->buffer_consumed = 0;
src->buffer_used = res;
}
-
+
return src->buffer[src->buffer_consumed++];
}
@@ -455,10 +455,10 @@ void read_message( connection_t *src )
{
while( 1 )
{
-
+
int ib = read_byte( src );
char b;
-
+
switch( ib )
{
case ENV_UNIVERSAL_AGAIN:
@@ -483,43 +483,43 @@ void read_message( connection_t *src )
{
char c = 0;
b_append( &src->input, &c, 1 );
- debug( 1,
- L"Universal variable connection closed while reading command. Partial command recieved: '%s'",
+ debug( 1,
+ L"Universal variable connection closed while reading command. Partial command recieved: '%s'",
(wchar_t *)src->input.buff );
}
return;
}
}
-
+
b = (char)ib;
-
+
if( b == '\n' )
{
wchar_t *msg;
-
+
b = 0;
b_append( &src->input, &b, 1 );
-
+
msg = utf2wcs( src->input.buff );
-
+
/*
Before calling parse_message, we must empty reset
everything, since the callback function could
potentially call read_message.
*/
src->input.used=0;
-
+
if( msg )
{
- parse_message( msg, src );
+ parse_message( msg, src );
}
else
{
debug( 0, _(L"Could not convert message '%s' to wide character string"), src->input.buff );
}
-
+
free( msg );
-
+
}
else
{
@@ -534,7 +534,7 @@ void read_message( connection_t *src )
void env_universal_common_remove( const wchar_t *name )
{
void *k, *v;
- hash_remove( &env_universal_var,
+ hash_remove( &env_universal_var,
name,
&k,
&v );
@@ -553,7 +553,7 @@ static int match( const wchar_t *msg, const wchar_t *cmd )
if( msg[len] && msg[len]!= L' ' && msg[len] != L'\t' )
return 0;
-
+
return 1;
}
@@ -564,20 +564,20 @@ void env_universal_common_set( const wchar_t *key, const wchar_t *val, int expor
CHECK( key, );
CHECK( val, );
-
- entry = malloc( sizeof(var_uni_entry_t) + sizeof(wchar_t)*(wcslen(val)+1) );
+
+ entry = malloc( sizeof(var_uni_entry_t) + sizeof(wchar_t)*(wcslen(val)+1) );
name = wcsdup(key);
-
+
if( !entry || !name )
DIE_MEM();
-
+
entry->export=export;
-
+
wcscpy( entry->val, val );
env_universal_common_remove( name );
-
+
hash_put( &env_universal_var, name, entry );
-
+
if( callback )
{
callback( export?SET_EXPORT:SET, name, val );
@@ -588,67 +588,67 @@ void env_universal_common_set( const wchar_t *key, const wchar_t *val, int expor
/**
Parse message msg
*/
-static void parse_message( wchar_t *msg,
+static void parse_message( wchar_t *msg,
connection_t *src )
{
// debug( 3, L"parse_message( %ls );", msg );
-
+
if( msg[0] == L'#' )
return;
-
+
if( match( msg, SET_STR ) || match( msg, SET_EXPORT_STR ))
{
wchar_t *name, *tmp;
int export = match( msg, SET_EXPORT_STR );
-
+
name = msg+(export?wcslen(SET_EXPORT_STR):wcslen(SET_STR));
while( wcschr( L"\t ", *name ) )
name++;
-
+
tmp = wcschr( name, L':' );
if( tmp )
{
wchar_t *key;
wchar_t *val;
-
+
key = malloc( sizeof( wchar_t)*(tmp-name+1));
memcpy( key, name, sizeof( wchar_t)*(tmp-name));
key[tmp-name]=0;
-
+
val = tmp+1;
val = unescape( val, 0 );
-
+
env_universal_common_set( key, val, export );
-
+
free( val );
free( key );
}
else
{
debug( 1, PARSE_ERR, msg );
- }
+ }
}
else if( match( msg, ERASE_STR ) )
{
wchar_t *name, *tmp;
-
+
name = msg+wcslen(ERASE_STR);
while( wcschr( L"\t ", *name ) )
name++;
-
+
tmp = name;
while( iswalnum( *tmp ) || *tmp == L'_')
tmp++;
-
+
*tmp = 0;
-
+
if( !wcslen( name ) )
{
debug( 1, PARSE_ERR, msg );
}
env_universal_common_remove( name );
-
+
if( callback )
{
callback( ERASE, name, 0 );
@@ -671,7 +671,7 @@ static void parse_message( wchar_t *msg,
else
{
debug( 1, PARSE_ERR, msg );
- }
+ }
}
/**
@@ -684,7 +684,7 @@ static int try_send( message_t *msg,
{
debug( 3,
- L"before write of %d chars to fd %d", strlen(msg->body), fd );
+ L"before write of %d chars to fd %d", strlen(msg->body), fd );
int res = write( fd, msg->body, strlen(msg->body) );
@@ -696,26 +696,26 @@ static int try_send( message_t *msg,
{
debug( 4, L"Failed to write message '%s'", msg->body );
}
-
+
if( res == -1 )
{
switch( errno )
{
case EAGAIN:
return 0;
-
+
default:
debug( 2,
L"Error while sending universal variable message to fd %d. Closing connection",
fd );
if( debug_level > 2 )
wperror( L"write" );
-
+
return -1;
- }
+ }
}
msg->count--;
-
+
if( !msg->count )
{
free( msg );
@@ -726,7 +726,7 @@ static int try_send( message_t *msg,
void try_send_all( connection_t *c )
{
/* debug( 3,
- L"Send all updates to connection on fd %d",
+ L"Send all updates to connection on fd %d",
c->fd );*/
while( !q_empty( &c->unsent) )
{
@@ -735,12 +735,12 @@ void try_send_all( connection_t *c )
case 1:
q_get( &c->unsent);
break;
-
+
case 0:
debug( 4,
- L"Socket full, send rest later" );
+ L"Socket full, send rest later" );
return;
-
+
case -1:
c->killme = 1;
return;
@@ -779,16 +779,16 @@ static wchar_t *full_escape( const wchar_t *in )
message_t *create_message( int type,
- const wchar_t *key_in,
+ const wchar_t *key_in,
const wchar_t *val_in )
{
message_t *msg=0;
-
+
char *key=0;
size_t sz;
// debug( 4, L"Crete message of type %d", type );
-
+
if( key_in )
{
if( wcsvarname( key_in ) )
@@ -796,7 +796,7 @@ message_t *create_message( int type,
debug( 0, L"Illegal variable name: '%ls'", key_in );
return 0;
}
-
+
key = wcs2utf(key_in);
if( !key )
{
@@ -806,8 +806,8 @@ message_t *create_message( int type,
return 0;
}
}
-
-
+
+
switch( type )
{
case SET:
@@ -817,29 +817,29 @@ message_t *create_message( int type,
{
val_in=L"";
}
-
+
wchar_t *esc = full_escape( val_in );
if( !esc )
break;
-
+
char *val = wcs2utf(esc );
free(esc);
-
+
sz = strlen(type==SET?SET_MBS:SET_EXPORT_MBS) + strlen(key) + strlen(val) + 4;
msg = malloc( sizeof( message_t ) + sz );
-
+
if( !msg )
DIE_MEM();
-
+
strcpy( msg->body, (type==SET?SET_MBS:SET_EXPORT_MBS) );
strcat( msg->body, " " );
strcat( msg->body, key );
strcat( msg->body, ":" );
strcat( msg->body, val );
strcat( msg->body, "\n" );
-
+
free( val );
-
+
break;
}
@@ -850,7 +850,7 @@ message_t *create_message( int type,
if( !msg )
DIE_MEM();
-
+
strcpy( msg->body, ERASE_MBS " " );
strcat( msg->body, key );
strcat( msg->body, "\n" );
@@ -859,14 +859,14 @@ message_t *create_message( int type,
case BARRIER:
{
- msg = malloc( sizeof( message_t ) +
+ msg = malloc( sizeof( message_t ) +
strlen( BARRIER_MBS ) +2);
if( !msg )
DIE_MEM();
strcpy( msg->body, BARRIER_MBS "\n" );
break;
}
-
+
case BARRIER_REPLY:
{
msg = malloc( sizeof( message_t ) +
@@ -876,7 +876,7 @@ message_t *create_message( int type,
strcpy( msg->body, BARRIER_REPLY_MBS "\n" );
break;
}
-
+
default:
{
debug( 0, L"create_message: Unknown message type" );
@@ -890,19 +890,19 @@ message_t *create_message( int type,
// debug( 4, L"Message body is '%s'", msg->body );
- return msg;
+ return msg;
}
/**
Function used with hash_foreach to insert keys of one table into
another
*/
-static void add_key_to_hash( void *key,
+static void add_key_to_hash( void *key,
void *data,
void *aux )
{
var_uni_entry_t *e = (var_uni_entry_t *)data;
- if( ( e->export && get_names_show_exported) ||
+ if( ( e->export && get_names_show_exported) ||
( !e->export && get_names_show_unexported) )
al_push( (array_list_t *)aux, key );
}
@@ -913,18 +913,18 @@ void env_universal_common_get_names( array_list_t *l,
{
get_names_show_exported = show_exported;
get_names_show_unexported = show_unexported;
-
- hash_foreach2( &env_universal_var,
+
+ hash_foreach2( &env_universal_var,
add_key_to_hash,
l );
}
wchar_t *env_universal_common_get( const wchar_t *name )
{
- var_uni_entry_t *e = (var_uni_entry_t *)hash_get( &env_universal_var, name );
+ var_uni_entry_t *e = (var_uni_entry_t *)hash_get( &env_universal_var, name );
if( e )
return e->val;
- return 0;
+ return 0;
}
int env_universal_common_get_export( const wchar_t *name )
@@ -952,17 +952,17 @@ static void enqueue( void *k,
const wchar_t *key = (const wchar_t *)k;
const var_uni_entry_t *val = (const var_uni_entry_t *)v;
dyn_queue_t *queue = (dyn_queue_t *)q;
-
+
message_t *msg = create_message( val->export?SET_EXPORT:SET, key, val->val );
msg->count=1;
-
+
q_put( queue, msg );
}
void enqueue_all( connection_t *c )
{
hash_foreach2( &env_universal_var,
- &enqueue,
+ &enqueue,
(void *)&c->unsent );
try_send_all( c );
}
@@ -974,7 +974,7 @@ void connection_init( connection_t *c, int fd )
c->fd = fd;
b_init( &c->input );
q_init( &c->unsent );
- c->buffer_consumed = c->buffer_used = 0;
+ c->buffer_consumed = c->buffer_used = 0;
}
void connection_destroy( connection_t *c)
diff --git a/env_universal_common.h b/env_universal_common.h
index 97edd7119..ed56b4156 100644
--- a/env_universal_common.h
+++ b/env_universal_common.h
@@ -76,9 +76,9 @@ typedef struct connection
newline is encountered, the buffer is parsed and cleared.
*/
buffer_t input;
-
+
/**
- The read buffer.
+ The read buffer.
*/
char buffer[ENV_UNIVERSAL_BUFFER_SIZE];
@@ -86,12 +86,12 @@ typedef struct connection
Number of bytes that have already been consumed.
*/
int buffer_consumed;
-
+
/**
- Number of bytes that have been read into the buffer.
+ Number of bytes that have been read into the buffer.
*/
int buffer_used;
-
+
/**
Link to the next connection
@@ -103,7 +103,7 @@ typedef struct connection
/**
A struct representing a message to be sent between client and server
*/
-typedef struct
+typedef struct
{
/**
Number of queues that contain this message. Once this reaches zero, the message should be deleted
@@ -163,7 +163,7 @@ void env_universal_common_get_names( array_list_t *l,
void env_universal_common_set( const wchar_t *key, const wchar_t *val, int export );
/**
- Remove the specified variable.
+ Remove the specified variable.
This function operate agains the local copy of all universal
variables, it does not communicate with any other process.
diff --git a/etc/config.fish.in b/etc/config.fish.in
index 9ccf99b12..e32dc8bcc 100644
--- a/etc/config.fish.in
+++ b/etc/config.fish.in
@@ -39,7 +39,7 @@ if status --is-login
end
#
-# There are variables that contain colons that are not arrays. This
+# There are variables that contain colons that are not arrays. This
# reverts them back to regular strings.
#
diff --git a/event.c b/event.c
index 38ef9a730..6a53254f0 100644
--- a/event.c
+++ b/event.c
@@ -44,11 +44,11 @@ typedef struct
/**
Whether signals have been skipped
*/
- int overflow;
+ int overflow;
/**
Array of signal events
*/
- int signal[SIG_UNHANDLED_MAX];
+ int signal[SIG_UNHANDLED_MAX];
}
signal_list_t;
@@ -95,23 +95,23 @@ static int event_match( event_t *class, event_t *instance )
if( class->type == EVENT_ANY )
return 1;
-
+
if( class->type != instance->type )
return 0;
-
+
switch( class->type )
{
-
+
case EVENT_SIGNAL:
if( class->param1.signal == EVENT_ANY_SIGNAL )
return 1;
return class->param1.signal == instance->param1.signal;
-
+
case EVENT_VARIABLE:
return wcscmp( instance->param1.variable,
class->param1.variable )==0;
-
+
case EVENT_EXIT:
if( class->param1.pid == EVENT_ANY_PID )
return 1;
@@ -125,11 +125,11 @@ static int event_match( event_t *class, event_t *instance )
class->param1.param )==0;
}
-
+
/**
This should never be reached
*/
- return 0;
+ return 0;
}
@@ -140,10 +140,10 @@ static int event_match( event_t *class, event_t *instance )
static event_t *event_copy( event_t *event, int copy_arguments )
{
event_t *e = malloc( sizeof( event_t ) );
-
+
if( !e )
DIE_MEM();
-
+
memcpy( e, event, sizeof(event_t));
if( e->function_name )
@@ -153,7 +153,7 @@ static event_t *event_copy( event_t *event, int copy_arguments )
e->param1.variable = wcsdup( e->param1.variable );
else if( e->type == EVENT_GENERIC )
e->param1.param = wcsdup( e->param1.param );
-
+
al_init( &e->arguments );
if( copy_arguments )
{
@@ -162,9 +162,9 @@ static event_t *event_copy( event_t *event, int copy_arguments )
{
al_push( &e->arguments, wcsdup( (wchar_t *)al_get( &event->arguments, i ) ) );
}
-
+
}
-
+
return e;
}
@@ -175,7 +175,7 @@ static int event_is_blocked( event_t *e )
{
block_t *block;
event_block_t *eb;
-
+
for( block = current_block; block; block = block->outer )
{
for( eb = block->first_event_block; eb; eb=eb->next )
@@ -193,9 +193,9 @@ static int event_is_blocked( event_t *e )
if( eb->type & (1<type) )
return 1;
return 1;
-
+
}
-
+
return 0;
}
@@ -217,18 +217,18 @@ const wchar_t *event_get_desc( event_t *e )
{
sb_clear( get_desc_buff );
}
-
+
switch( e->type )
{
-
+
case EVENT_SIGNAL:
sb_printf( get_desc_buff, _(L"signal handler for %ls (%ls)"), sig2wcs(e->param1.signal ), signal_get_desc( e->param1.signal ) );
break;
-
+
case EVENT_VARIABLE:
sb_printf( get_desc_buff, _(L"handler for variable '%ls'"), e->param1.variable );
break;
-
+
case EVENT_EXIT:
if( e->param1.pid > 0 )
{
@@ -242,9 +242,9 @@ const wchar_t *event_get_desc( event_t *e )
else
sb_printf( get_desc_buff, _(L"exit handler for job with process group %d"), -e->param1.pid );
}
-
+
break;
-
+
case EVENT_JOB_ID:
{
job_t *j = job_get( e->param1.job_id );
@@ -255,17 +255,17 @@ const wchar_t *event_get_desc( event_t *e )
break;
}
-
+
case EVENT_GENERIC:
sb_printf( get_desc_buff, _(L"handler for generic event '%ls'"), e->param1.param );
break;
-
+
default:
sb_printf( get_desc_buff, _(L"Unknown event type") );
break;
-
+
}
-
+
return (const wchar_t *)get_desc_buff->buff;
}
@@ -275,7 +275,7 @@ void event_add_handler( event_t *event )
event_t *e;
CHECK( event, );
-
+
e = event_copy( event, 0 );
if( !events )
@@ -285,8 +285,8 @@ void event_add_handler( event_t *event )
{
signal_handle( e->param1.signal, 1 );
}
-
- al_push( events, e );
+
+ al_push( events, e );
}
void event_remove( event_t *criterion )
@@ -294,7 +294,7 @@ void event_remove( event_t *criterion )
int i;
array_list_t *new_list=0;
event_t e;
-
+
CHECK( criterion, );
/*
@@ -305,19 +305,19 @@ void event_remove( event_t *criterion )
that shouldn't be killed to new_list, and then drops the empty
events-list.
*/
-
+
if( !events )
return;
for( i=0; iparam1.signal;
e.function_name = 0;
-
+
if( event_get( &e, 0 ) == 1 )
{
signal_handle( e.param1.signal, 0 );
- }
+ }
}
}
else
@@ -344,7 +344,7 @@ void event_remove( event_t *criterion )
}
}
al_destroy( events );
- free( events );
+ free( events );
events = new_list;
}
@@ -352,21 +352,21 @@ int event_get( event_t *criterion, array_list_t *out )
{
int i;
int found = 0;
-
+
if( !events )
- return 0;
+ return 0;
CHECK( criterion, 0 );
-
+
for( i=0; ifunction_name );
-
+
for( j=0; jarguments); j++ )
{
- wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 1 );
+ wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 1 );
sb_append( b, L" " );
sb_append( b, arg_esc );
- free( arg_esc );
+ free( arg_esc );
}
// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff );
-
+
/*
Event handlers are not part of the main flow of code, so
they are marked as non-interactive
@@ -500,27 +500,27 @@ static void event_fire_internal( event_t *event )
current_block->param1.event = event;
eval( (wchar_t *)b->buff, 0, TOP );
parser_pop_block();
- proc_pop_interactive();
+ proc_pop_interactive();
proc_set_last_status( prev_status );
}
if( b )
{
sb_destroy( b );
- free( b );
+ free( b );
}
-
+
if( fire )
{
al_destroy( fire );
free( fire );
}
-
+
/*
Free killed events
*/
- event_free_kills();
-
+ event_free_kills();
+
}
/**
@@ -532,7 +532,7 @@ static void event_fire_delayed()
int i;
/*
- If is_event is one, we are running the event-handler non-recursively.
+ If is_event is one, we are running the event-handler non-recursively.
When the event handler has called a piece of code that triggers
another event, we do not want to fire delayed events because of
@@ -541,7 +541,7 @@ static void event_fire_delayed()
if( blocked && is_event==1)
{
array_list_t *new_blocked = 0;
-
+
for( i=0; i 0 )
{
signal_list_t *lst;
event_t e;
- al_init( &e.arguments );
+ al_init( &e.arguments );
/*
Switch signal lists
@@ -576,47 +576,47 @@ static void event_fire_delayed()
active_list=1-active_list;
/*
- Set up
+ Set up
*/
e.type=EVENT_SIGNAL;
e.function_name=0;
-
+
lst = &sig_list[1-active_list];
-
+
if( lst->overflow )
{
debug( 0, _( L"Signal list overflow. Signals have been ignored." ) );
}
-
+
/*
Send all signals in our private list
*/
for( i=0; icount; i++ )
{
e.param1.signal = lst->signal[i];
- al_set( &e.arguments, 0, sig2wcs( e.param1.signal ) );
+ al_set( &e.arguments, 0, sig2wcs( e.param1.signal ) );
if( event_is_blocked( &e ) )
{
if( !blocked )
blocked = al_new();
- al_push( blocked, event_copy(&e, 1) );
+ al_push( blocked, event_copy(&e, 1) );
}
else
{
event_fire_internal( &e );
}
}
-
+
al_destroy( &e.arguments );
-
- }
+
+ }
}
void event_fire( event_t *event )
{
is_event++;
-
+
if( event && (event->type == EVENT_SIGNAL) )
{
/*
@@ -636,14 +636,14 @@ void event_fire( event_t *event )
Fire events triggered by signals
*/
event_fire_delayed();
-
+
if( event )
{
if( event_is_blocked( event ) )
{
if( !blocked )
blocked = al_new();
-
+
al_push( blocked, event_copy(event, 1) );
}
else
@@ -651,8 +651,8 @@ void event_fire( event_t *event )
event_fire_internal( event );
}
}
-
- }
+
+ }
is_event--;
}
@@ -668,7 +668,7 @@ void event_destroy()
{
al_foreach( events, (void (*)(void *))&event_free );
al_destroy( events );
- free( events );
+ free( events );
events=0;
}
@@ -676,9 +676,9 @@ void event_destroy()
{
al_foreach( killme, (void (*)(void *))&event_free );
al_destroy( killme );
- free( killme );
- killme=0;
- }
+ free( killme );
+ killme=0;
+ }
}
void event_free( event_t *e )
@@ -711,11 +711,11 @@ void event_fire_generic_internal(const wchar_t *name, ...)
wchar_t *arg;
CHECK( name, );
-
+
ev.type = EVENT_GENERIC;
ev.param1.param = name;
ev.function_name=0;
-
+
al_init( &ev.arguments );
va_start( va, name );
while( (arg=va_arg(va, wchar_t *) )!= 0 )
@@ -723,9 +723,9 @@ void event_fire_generic_internal(const wchar_t *name, ...)
al_push( &ev.arguments, arg );
}
va_end( va );
-
+
event_fire( &ev );
}
-
+
diff --git a/event.h b/event.h
index 6e3423c65..80a46dc12 100644
--- a/event.h
+++ b/event.h
@@ -7,7 +7,7 @@
functions produce output or perform memory allocations, since
such functions may not be safely called by signal handlers.
-
+
*/
#ifndef FISH_EVENT_H
#define FISH_EVENT_H
@@ -44,7 +44,7 @@ enum
- When used as a parameter to event_add, it represents a class of events, and function_name is the name of the function which will be called whenever an event matching the specified class occurs. This is also how events are stored internally.
- When used as a parameter to event_get, event_remove and event_fire, it represents a class of events, and if the function_name field is non-zero, only events which call the specified function will be returned.
*/
-typedef struct
+typedef struct
{
/**
Type of event
@@ -78,13 +78,13 @@ typedef struct
The parameter describing this generic event
*/
const wchar_t *param;
-
+
} param1;
/**
The name of the event handler function
*/
- const wchar_t *function_name;
+ const wchar_t *function_name;
/**
The argument list. Only used when sending a new event using
@@ -96,28 +96,28 @@ typedef struct
event_t;
/**
- Add an event handler
+ Add an event handler
May not be called by a signal handler, since it may allocate new memory.
*/
void event_add_handler( event_t *event );
/**
- Remove all events matching the specified criterion.
+ Remove all events matching the specified criterion.
May not be called by a signal handler, since it may free allocated memory.
*/
void event_remove( event_t *event );
/**
- Return all events which match the specified event class
+ Return all events which match the specified event class
This function is safe to call from a signal handler _ONLY_ if the
out parameter is null.
\param criterion Is the class of events to return. If the criterion has a non-null function_name, only events which trigger the specified function will return.
\param out the list to add events to. May be 0, in which case no events will be added, but the result count will still be valid
-
+
\return the number of found matches
*/
int event_get( event_t *criterion, array_list_t *out );
diff --git a/exec.c b/exec.c
index 921002eae..13fb81b5f 100644
--- a/exec.c
+++ b/exec.c
@@ -99,7 +99,7 @@ static int set_child_group( job_t *j, process_t *p, int print_errors );
static void exec_write_and_exit( int fd, char *buff, size_t count, int status )
{
- if( write_loop(fd, buff, count) == -1 )
+ if( write_loop(fd, buff, count) == -1 )
{
debug( 0, WRITE_ERROR);
wperror( L"write" );
@@ -118,7 +118,7 @@ void exec_close( int fd )
debug( 0, L"Called close on invalid file descriptor " );
return;
}
-
+
while( close(fd) == -1 )
{
if( errno != EINTR )
@@ -128,7 +128,7 @@ void exec_close( int fd )
break;
}
}
-
+
if( open_fds )
{
for( i=0; iio_mode == IO_BUFFER ) ||
+
+ if( ( io->io_mode == IO_BUFFER ) ||
( io->io_mode == IO_PIPE ) )
{
if( io->param1.pipe_fd[0] == fd ||
io->param1.pipe_fd[1] == fd )
return 1;
}
-
+
return use_fd_in_pipe( fd, io->next );
}
@@ -201,14 +201,14 @@ static int use_fd_in_pipe( int fd, io_data_t *io )
Close all fds in open_fds, except for those that are mentioned in
the redirection list io. This should make sure that there are no
stray opened file descriptors in the child.
-
+
\param io the list of io redirections for this job. Pipes mentioned
here should not be closed.
*/
static void close_unused_internal_pipes( io_data_t *io )
{
int i=0;
-
+
if( open_fds )
{
for( ;iio_mode == IO_PIPE ) || ( io->io_mode == IO_BUFFER ) )
{
int i;
@@ -245,9 +245,9 @@ void free_fd( io_data_t *io, int fd )
{
if( errno != EINTR )
{
- debug( 1,
+ debug( 1,
FD_ERROR,
- fd );
+ fd );
wperror( L"dup" );
FATAL_EXIT();
}
@@ -292,11 +292,11 @@ static int handle_child_io( io_data_t *io )
if( io->fd > 2 )
{
/*
- Make sure the fd used by this redirection is not used by e.g. a pipe.
+ Make sure the fd used by this redirection is not used by e.g. a pipe.
*/
free_fd( io, io->fd );
}
-
+
switch( io->io_mode )
{
case IO_CLOSE:
@@ -317,19 +317,19 @@ static int handle_child_io( io_data_t *io )
if( ( io->param2.flags & O_EXCL ) &&
( errno ==EEXIST ) )
{
- debug( 1,
+ debug( 1,
NOCLOB_ERROR,
io->param1.filename );
}
else
{
- debug( 1,
+ debug( 1,
FILE_ERROR,
io->param1.filename );
-
+
wperror( L"open" );
}
-
+
return -1;
}
else if( tmp != io->fd)
@@ -339,20 +339,20 @@ static int handle_child_io( io_data_t *io )
this is just a precausion.
*/
close(io->fd);
-
+
if(dup2( tmp, io->fd ) == -1 )
{
- debug( 1,
+ debug( 1,
FD_ERROR,
io->fd );
wperror( L"dup2" );
return -1;
}
exec_close( tmp );
- }
+ }
break;
}
-
+
case IO_FD:
{
/*
@@ -363,7 +363,7 @@ static int handle_child_io( io_data_t *io )
if( dup2( io->param1.old_fd, io->fd ) == -1 )
{
- debug( 1,
+ debug( 1,
FD_ERROR,
io->fd );
wperror( L"dup2" );
@@ -371,17 +371,17 @@ static int handle_child_io( io_data_t *io )
}
break;
}
-
+
case IO_BUFFER:
case IO_PIPE:
{
int write_pipe;
-
+
write_pipe = !io->is_input;
/*
debug( 0,
- L"%ls %ls on fd %d (%d %d)",
- write_pipe?L"write":L"read",
+ L"%ls %ls on fd %d (%d %d)",
+ write_pipe?L"write":L"read",
(io->io_mode == IO_BUFFER)?L"buffer":L"pipe",
io->fd,
io->param1.pipe_fd[0],
@@ -394,7 +394,7 @@ static int handle_child_io( io_data_t *io )
return -1;
}
- if( write_pipe )
+ if( write_pipe )
{
exec_close( io->param1.pipe_fd[0]);
exec_close( io->param1.pipe_fd[1]);
@@ -405,12 +405,12 @@ static int handle_child_io( io_data_t *io )
}
break;
}
-
+
}
}
return 0;
-
+
}
/**
@@ -432,13 +432,13 @@ static int handle_child_io( io_data_t *io )
static int setup_child_process( job_t *j, process_t *p )
{
int res=0;
-
+
if( p )
{
res = set_child_group( j, p, 1 );
}
-
- if( !res )
+
+ if( !res )
{
res = handle_child_io( j->io );
if( p != 0 && res )
@@ -446,18 +446,18 @@ static int setup_child_process( job_t *j, process_t *p )
exit( 1 );
}
}
-
+
/* Set the handling for job control signals back to the default. */
if( !res )
{
signal_reset_handlers();
}
-
+
/* Remove all signal blocks */
- signal_unblock();
-
+ signal_unblock();
+
return res;
-
+
}
/**
@@ -484,9 +484,9 @@ static wchar_t *get_interpreter( wchar_t *file )
sb_append_char( &sb, (wchar_t)ch );
}
}
-
+
res = (wchar_t *)sb.buff;
-
+
if( !wcsncmp( L"#! /", res, 4 ) )
return res+3;
if( !wcsncmp( L"#!/", res, 3 ) )
@@ -494,7 +494,7 @@ static wchar_t *get_interpreter( wchar_t *file )
return 0;
}
-
+
/**
This function is executed by the child process created by a call to
fork(). It should be called after \c setup_child_process. It calls
@@ -505,19 +505,19 @@ static void launch_process( process_t *p )
{
FILE* f;
int err;
-
+
// debug( 1, L"exec '%ls'", p->argv[0] );
char **argv = wcsv2strv( (const wchar_t **) p->argv);
char **envv = env_export_arr( 0 );
-
- execve ( wcs2str(p->actual_cmd),
+
+ execve ( wcs2str(p->actual_cmd),
argv,
envv );
-
+
err = errno;
-
- /*
+
+ /*
Something went wrong with execve, check for a ":", and run
/bin/sh if encountered. This is a weird predecessor to the shebang
that is still sometimes used since it is supported on Windows.
@@ -527,49 +527,49 @@ static void launch_process( process_t *p )
{
char begin[1] = {0};
size_t read;
-
+
read = fread(begin, 1, 1, f);
fclose( f );
-
+
if( (read==1) && (begin[0] == ':') )
{
int count = 0;
int i = 1;
wchar_t **res;
char **res_real;
-
+
while( p->argv[count] != 0 )
count++;
-
+
res = malloc( sizeof(wchar_t*)*(count+2));
-
+
res[0] = L"/bin/sh";
res[1] = p->actual_cmd;
-
+
for( i=1; p->argv[i]; i++ ){
res[i+1] = p->argv[i];
}
-
+
res[i+1] = 0;
p->argv = res;
p->actual_cmd = L"/bin/sh";
res_real = wcsv2strv( (const wchar_t **) res);
-
- execve ( wcs2str(p->actual_cmd),
+
+ execve ( wcs2str(p->actual_cmd),
res_real,
envv );
}
}
-
+
errno = err;
- debug( 0,
+ debug( 0,
_( L"Failed to execute process '%ls'. Reason:" ),
p->actual_cmd );
-
+
switch( errno )
{
-
+
case E2BIG:
{
size_t sz = 0;
@@ -577,31 +577,31 @@ static void launch_process( process_t *p )
string_buffer_t sz1;
string_buffer_t sz2;
-
+
long arg_max = -1;
-
+
sb_init( &sz1 );
sb_init( &sz2 );
-
+
for(p=argv; *p; p++)
{
sz += strlen(*p)+1;
}
-
+
for(p=envv; *p; p++)
{
sz += strlen(*p)+1;
}
-
+
sb_format_size( &sz1, sz );
arg_max = sysconf( _SC_ARG_MAX );
-
+
if( arg_max > 0 )
{
-
+
sb_format_size( &sz2, arg_max );
-
+
debug( 0,
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit of %ls.",
(wchar_t *)sz1.buff,
@@ -613,21 +613,21 @@ static void launch_process( process_t *p )
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit.",
(wchar_t *)sz1.buff);
}
-
- debug( 0,
+
+ debug( 0,
L"Try running the command again with fewer arguments.");
sb_destroy( &sz1 );
sb_destroy( &sz2 );
-
+
exit(STATUS_EXEC_FAIL);
-
+
break;
}
case ENOEXEC:
{
wperror(L"exec");
-
+
debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
exit(STATUS_EXEC_FAIL);
}
@@ -635,7 +635,7 @@ static void launch_process( process_t *p )
case ENOENT:
{
wchar_t *interpreter = get_interpreter( p->actual_cmd );
-
+
if( interpreter && waccess( interpreter, X_OK ) )
{
debug(0, L"The file '%ls' specified the interpreter '%ls', which is not an executable command.", p->actual_cmd, interpreter );
@@ -644,7 +644,7 @@ static void launch_process( process_t *p )
{
debug(0, L"The file '%ls' or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.", p->actual_cmd);
}
-
+
exit(STATUS_EXEC_FAIL);
}
@@ -657,12 +657,12 @@ static void launch_process( process_t *p )
default:
{
wperror(L"exec");
-
+
// debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
exit(STATUS_EXEC_FAIL);
}
}
-
+
}
@@ -691,7 +691,7 @@ static void io_untransmogrify( io_data_t * in, io_data_t *out )
case IO_FILE:
exec_close( out->param1.old_fd );
break;
- }
+ }
free(out);
}
@@ -711,16 +711,16 @@ static io_data_t *io_transmogrify( io_data_t * in )
if( !in )
return 0;
-
+
out = malloc( sizeof( io_data_t ) );
if( !out )
DIE_MEM();
-
+
out->fd = in->fd;
out->io_mode = IO_FD;
out->param2.close_old = 1;
out->next=0;
-
+
switch( in->io_mode )
{
/*
@@ -741,23 +741,23 @@ static io_data_t *io_transmogrify( io_data_t * in )
case IO_FILE:
{
int fd;
-
+
if( (fd=wopen( in->param1.filename, in->param2.flags, OPEN_MASK ) )==-1 )
{
- debug( 1,
+ debug( 1,
FILE_ERROR,
in->param1.filename );
-
+
wperror( L"open" );
free( out );
return 0;
- }
+ }
out->param1.old_fd = fd;
break;
}
}
-
+
if( in->next)
{
out->next = io_transmogrify( in->next );
@@ -767,7 +767,7 @@ static io_data_t *io_transmogrify( io_data_t * in )
return 0;
}
}
-
+
return out;
}
@@ -780,14 +780,14 @@ static io_data_t *io_transmogrify( io_data_t * in )
\param io the io redirections to be performed on this block
*/
-static void internal_exec_helper( const wchar_t *def,
+static void internal_exec_helper( const wchar_t *def,
int block_type,
io_data_t *io )
{
io_data_t *io_internal = io_transmogrify( io );
int is_block_old=is_block;
is_block=1;
-
+
/*
Did the transmogrification fail - if so, set error status and return
*/
@@ -796,13 +796,13 @@ static void internal_exec_helper( const wchar_t *def,
proc_set_last_status( STATUS_EXEC_FAIL );
return;
}
-
+
signal_unblock();
-
- eval( def, io_internal, block_type );
-
+
+ eval( def, io_internal, block_type );
+
signal_block();
-
+
io_untransmogrify( io, io_internal );
job_reap( 0 );
is_block=is_block_old;
@@ -818,24 +818,24 @@ static void internal_exec_helper( const wchar_t *def,
exit. The parent process may safely ignore the exit status of this
call.
- Returns 0 on sucess, -1 on failiure.
+ Returns 0 on sucess, -1 on failiure.
*/
static int set_child_group( job_t *j, process_t *p, int print_errors )
{
int res = 0;
-
+
if( job_get_flag( j, JOB_CONTROL ) )
{
if (!j->pgid)
{
j->pgid = p->pid;
}
-
+
if( setpgid (p->pid, j->pgid) )
{
if( getpgid( p->pid) != j->pgid && print_errors )
{
- debug( 1,
+ debug( 1,
_( L"Could not send process %d, '%ls' in job %d, '%ls' from group %d to group %d" ),
p->pid,
p->argv[0],
@@ -858,8 +858,8 @@ static int set_child_group( job_t *j, process_t *p, int print_errors )
{
if( tcsetpgrp (0, j->pgid) && print_errors )
{
- debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
- j->job_id,
+ debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
+ j->job_id,
j->command );
wperror( L"tcsetpgrp" );
res = -1;
@@ -880,7 +880,7 @@ static pid_t exec_fork()
pid_t pid;
struct timespec pollint;
int i;
-
+
for( i=0; icommand, j->job_id );
-
+
+ debug( 4, L"Exec job '%ls' with id %d", j->command, j->job_id );
+
if( block_io )
{
if( j->io )
@@ -985,16 +985,16 @@ void exec( job_t *j )
}
else
{
- j->io=io_duplicate( j, block_io);
+ j->io=io_duplicate( j, block_io);
}
}
-
+
io_data_t *input_redirect;
for( input_redirect = j->io; input_redirect; input_redirect = input_redirect->next )
{
- if( (input_redirect->io_mode == IO_BUFFER) &&
+ if( (input_redirect->io_mode == IO_BUFFER) &&
input_redirect->is_input )
{
/*
@@ -1010,7 +1010,7 @@ void exec( job_t *j )
break;
}
}
-
+
if( j->first_process->type==INTERNAL_EXEC )
{
/*
@@ -1036,7 +1036,7 @@ void exec( job_t *j )
return;
}
- }
+ }
pipe_read.fd=0;
pipe_write.fd=1;
@@ -1050,9 +1050,9 @@ void exec( job_t *j )
pipe_read.next=0;
pipe_write.next=0;
pipe_write.param1.pipe_fd[0]=pipe_write.param1.pipe_fd[1]=-1;
-
+
j->io = io_add( j->io, &pipe_write );
-
+
signal_block();
/*
@@ -1064,7 +1064,7 @@ void exec( job_t *j )
continuing in the pipeline, causing the group leader to
exit.
*/
-
+
if( job_get_flag( j, JOB_CONTROL ) )
{
for( p=j->first_process; p; p = p->next )
@@ -1081,12 +1081,12 @@ void exec( job_t *j )
needs_keepalive = 1;
break;
}
-
+
}
-
+
}
}
-
+
if( needs_keepalive )
{
keepalive.pid = exec_fork();
@@ -1095,15 +1095,15 @@ void exec( job_t *j )
{
keepalive.pid = getpid();
set_child_group( j, &keepalive, 1 );
- pause();
+ pause();
exit(0);
}
else
{
- set_child_group( j, &keepalive, 0 );
+ set_child_group( j, &keepalive, 0 );
}
}
-
+
/*
This loop loops over every process_t in the job, starting it as
appropriate. This turns out to be rather complex, since a
@@ -1116,13 +1116,13 @@ void exec( job_t *j )
{
mypipe[1]=-1;
skip_fork=0;
-
+
pipe_write.fd = p->pipe_write_fd;
pipe_read.fd = p->pipe_read_fd;
// debug( 0, L"Pipe created from fd %d to fd %d", pipe_write.fd, pipe_read.fd );
-
- /*
+
+ /*
This call is used so the global environment variable array
is regenerated, if needed, before the fork. That way, we
avoid a lot of duplicate work where EVERY child would need
@@ -1133,21 +1133,21 @@ void exec( job_t *j )
*/
if( p->type == EXTERNAL )
env_export_arr( 1 );
-
-
+
+
/*
- Set up fd:s that will be used in the pipe
+ Set up fd:s that will be used in the pipe
*/
-
+
if( p == j->first_process->next )
{
j->io = io_add( j->io, &pipe_read );
}
-
+
if( p->next )
{
// debug( 1, L"%ls|%ls" , p->argv[0], p->next->argv[0]);
-
+
if( exec_pipe( mypipe ) == -1 )
{
debug( 1, PIPE_ERROR );
@@ -1165,7 +1165,7 @@ void exec( job_t *j )
Remove the io redirection for pipe output.
*/
j->io = io_remove( j->io, &pipe_write );
-
+
}
switch( p->type )
@@ -1176,7 +1176,7 @@ void exec( job_t *j )
wchar_t * def=0;
array_list_t *named_arguments;
int shadows;
-
+
/*
Calls to function_get_definition might need to
@@ -1190,7 +1190,7 @@ void exec( job_t *j )
shadows = function_get_shadows( p->argv[0] );
signal_block();
-
+
if( orig_def )
{
def = halloc_register( j, wcsdup(orig_def) );
@@ -1202,10 +1202,10 @@ void exec( job_t *j )
}
parser_push_block( shadows?FUNCTION_CALL:FUNCTION_CALL_NO_SHADOW );
-
+
current_block->param2.function_call_process = p;
current_block->param1.function_call_name = halloc_register( current_block, wcsdup( p->argv[0] ) );
-
+
/*
set_argv might trigger an event
@@ -1215,34 +1215,34 @@ void exec( job_t *j )
signal_unblock();
parse_util_set_argv( p->argv+1, named_arguments );
signal_block();
-
+
parser_forbid_function( p->argv[0] );
if( p->next )
{
- io_buffer = io_buffer_create( 0 );
+ io_buffer = io_buffer_create( 0 );
j->io = io_add( j->io, io_buffer );
}
-
+
internal_exec_helper( def, TOP, j->io );
-
+
parser_allow_function();
parser_pop_block();
-
- break;
+
+ break;
}
-
+
case INTERNAL_BLOCK:
{
if( p->next )
{
- io_buffer = io_buffer_create( 0 );
+ io_buffer = io_buffer_create( 0 );
j->io = io_add( j->io, io_buffer );
}
-
- internal_exec_helper( p->argv[0], TOP, j->io );
+
+ internal_exec_helper( p->argv[0], TOP, j->io );
break;
-
+
}
case INTERNAL_BUILTIN:
@@ -1259,12 +1259,12 @@ void exec( job_t *j )
if( p == j->first_process )
{
io_data_t *in = io_get( j->io, 0 );
-
+
if( in )
{
switch( in->io_mode )
{
-
+
case IO_FD:
{
builtin_stdin = in->param1.old_fd;
@@ -1275,14 +1275,14 @@ void exec( job_t *j )
builtin_stdin = in->param1.pipe_fd[0];
break;
}
-
+
case IO_FILE:
{
builtin_stdin=wopen( in->param1.filename,
in->param2.flags, OPEN_MASK );
if( builtin_stdin == -1 )
{
- debug( 1,
+ debug( 1,
FILE_ERROR,
in->param1.filename );
wperror( L"open" );
@@ -1291,10 +1291,10 @@ void exec( job_t *j )
{
close_stdin = 1;
}
-
+
break;
}
-
+
case IO_CLOSE:
{
/*
@@ -1317,19 +1317,19 @@ void exec( job_t *j )
handled?
*/
builtin_stdin = -1;
-
+
break;
}
-
+
default:
{
builtin_stdin=-1;
- debug( 1,
+ debug( 1,
_( L"Unknown input redirection type %d" ),
in->io_mode);
break;
}
-
+
}
}
}
@@ -1348,7 +1348,7 @@ void exec( job_t *j )
int old_out = builtin_out_redirect;
int old_err = builtin_err_redirect;
- /*
+ /*
Since this may be the foreground job, and since
a builtin may execute another foreground job,
we need to pretend to suspend this job while
@@ -1362,24 +1362,24 @@ void exec( job_t *j )
walking the job list, but it seems more robust
to make exec handle things.
*/
-
+
builtin_push_io( builtin_stdin );
-
+
builtin_out_redirect = has_fd( j->io, 1 );
- builtin_err_redirect = has_fd( j->io, 2 );
+ builtin_err_redirect = has_fd( j->io, 2 );
fg = job_get_flag( j, JOB_FOREGROUND );
job_set_flag( j, JOB_FOREGROUND, 0 );
-
+
signal_unblock();
-
+
p->status = builtin_run( p->argv, j->io );
-
+
builtin_out_redirect=old_out;
builtin_err_redirect=old_err;
-
+
signal_block();
-
+
/*
Restore the fg flag, which is temporarily set to
false during builtin execution so as not to confuse
@@ -1387,7 +1387,7 @@ void exec( job_t *j )
*/
job_set_flag( j, JOB_FOREGROUND, fg );
}
-
+
/*
If stdin has been redirected, close the redirection
stream.
@@ -1395,16 +1395,16 @@ void exec( job_t *j )
if( close_stdin )
{
exec_close( builtin_stdin );
- }
- break;
+ }
+ break;
}
}
-
+
if( exec_error )
{
break;
}
-
+
switch( p->type )
{
@@ -1412,7 +1412,7 @@ void exec( job_t *j )
case INTERNAL_FUNCTION:
{
int status = proc_get_last_status();
-
+
/*
Handle output from a block or function. This usually
means do nothing, but in the case of pipes, we have
@@ -1434,39 +1434,39 @@ void exec( job_t *j )
}
j->io = io_remove( j->io, io_buffer );
-
+
io_buffer_read( io_buffer );
-
+
if( io_buffer->param2.out_buffer->used != 0 )
{
pid = exec_fork();
if( pid == 0 )
{
-
+
/*
This is the child process. Write out the contents of the pipeline.
*/
p->pid = getpid();
setup_child_process( j, p );
- exec_write_and_exit(io_buffer->fd,
+ exec_write_and_exit(io_buffer->fd,
io_buffer->param2.out_buffer->buff,
io_buffer->param2.out_buffer->used,
status);
}
else
{
- /*
+ /*
This is the parent process. Store away
information on the child, and possibly give
it control over the terminal.
*/
- p->pid = pid;
+ p->pid = pid;
set_child_group( j, p, 0 );
-
- }
-
+
+ }
+
}
else
{
@@ -1476,20 +1476,20 @@ void exec( job_t *j )
}
p->completed = 1;
}
-
+
io_buffer_destroy( io_buffer );
-
+
io_buffer=0;
break;
-
+
}
case INTERNAL_BUFFER:
{
-
+
pid = exec_fork();
-
+
if( pid == 0 )
{
/*
@@ -1498,30 +1498,30 @@ void exec( job_t *j )
*/
p->pid = getpid();
setup_child_process( j, p );
-
+
exec_write_and_exit( 1,
- input_redirect->param2.out_buffer->buff,
+ input_redirect->param2.out_buffer->buff,
input_redirect->param2.out_buffer->used,
0);
}
else
{
- /*
+ /*
This is the parent process. Store away
information on the child, and possibly give
it control over the terminal.
*/
- p->pid = pid;
- set_child_group( j, p, 0 );
- }
+ p->pid = pid;
+ set_child_group( j, p, 0 );
+ }
- break;
+ break;
}
-
+
case INTERNAL_BUILTIN:
{
int skip_fork;
-
+
/*
Handle output from builtin commands. In the general
case, this means forking of a worker process, that
@@ -1539,7 +1539,7 @@ void exec( job_t *j )
( !sb_out->used ) &&
( !sb_err->used ) &&
( !p->next );
-
+
/*
If the output of a builtin is to be sent to an internal
buffer, there is no need to fork. This helps out the
@@ -1548,10 +1548,10 @@ void exec( job_t *j )
io_data_t *io = io_get( j->io, 1 );
int buffer_stdout = io && io->io_mode == IO_BUFFER;
-
- if( ( !sb_err->used ) &&
+
+ if( ( !sb_err->used ) &&
( !p->next ) &&
- ( sb_out->used ) &&
+ ( sb_out->used ) &&
( buffer_stdout ) )
{
char *res = wcs2str( (wchar_t *)sb_out->buff );
@@ -1567,14 +1567,14 @@ void exec( job_t *j )
skip_fork = 0;
}
}
-
+
if( skip_fork )
{
p->completed=1;
if( p->next == 0 )
{
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
-
+
int status = proc_format_status(p->status);
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!status):status );
}
@@ -1584,7 +1584,7 @@ void exec( job_t *j )
/*
Ok, unfortunatly, we have to do a real fork. Bummer.
*/
-
+
pid = exec_fork();
if( pid == 0 )
{
@@ -1597,45 +1597,45 @@ void exec( job_t *j )
p->pid = getpid();
setup_child_process( j, p );
do_builtin_io( sb_out->used ? (wchar_t *)sb_out->buff : 0, sb_err->used ? (wchar_t *)sb_err->buff : 0 );
-
+
exit( p->status );
-
+
}
else
{
- /*
+ /*
This is the parent process. Store away
information on the child, and possibly give
it control over the terminal.
*/
p->pid = pid;
-
+
set_child_group( j, p, 0 );
-
- }
-
+
+ }
+
break;
}
-
+
case EXTERNAL:
{
pid = exec_fork();
if( pid == 0 )
{
/*
- This is the child process.
+ This is the child process.
*/
p->pid = getpid();
setup_child_process( j, p );
launch_process( p );
-
+
/*
launch_process _never_ returns...
*/
}
else
{
- /*
+ /*
This is the parent process. Store away
information on the child, and possibly fice
it control over the terminal.
@@ -1643,30 +1643,30 @@ void exec( job_t *j )
p->pid = pid;
set_child_group( j, p, 0 );
-
+
}
break;
}
-
+
}
if( p->type == INTERNAL_BUILTIN )
builtin_pop_io();
-
- /*
+
+ /*
Close the pipe the current process uses to read from the
previous process_t
*/
if( pipe_read.param1.pipe_fd[0] >= 0 )
exec_close( pipe_read.param1.pipe_fd[0] );
- /*
+ /*
Set up the pipe the next process uses to read from the
current process_t
*/
if( p->next )
pipe_read.param1.pipe_fd[0] = mypipe[0];
-
- /*
+
+ /*
If there is a next process in the pipeline, close the
output end of the current pipe (the surrent child
subprocess already has a copy of the pipe - this makes sure
@@ -1676,7 +1676,7 @@ void exec( job_t *j )
if( p->next )
{
exec_close(mypipe[1]);
- }
+ }
}
/*
@@ -1687,8 +1687,8 @@ void exec( job_t *j )
{
kill( keepalive.pid, SIGKILL );
}
-
- signal_unblock();
+
+ signal_unblock();
debug( 3, L"Job is constructed" );
@@ -1696,7 +1696,7 @@ void exec( job_t *j )
for( tmp = block_io; tmp; tmp=tmp->next )
j->io = io_remove( j->io, tmp );
-
+
job_set_flag( j, JOB_CONSTRUCTED, 1 );
if( !job_get_flag( j, JOB_FOREGROUND ) )
@@ -1708,10 +1708,10 @@ void exec( job_t *j )
{
job_continue (j, 0);
}
-
+
}
-int exec_subshell( const wchar_t *cmd,
+int exec_subshell( const wchar_t *cmd,
array_list_t *lst )
{
char *begin, *end;
@@ -1721,7 +1721,7 @@ int exec_subshell( const wchar_t *cmd,
io_data_t *io_buffer;
const wchar_t *ifs;
char sep=0;
-
+
CHECK( cmd, -1 );
ifs = env_get(L"IFS");
@@ -1737,14 +1737,14 @@ int exec_subshell( const wchar_t *cmd,
sep = 0;
debug( 0, L"Warning - invalid command substitution separator '%lc'. Please change the firsta character of IFS", ifs[0] );
}
-
+
}
-
- is_subshell=1;
+
+ is_subshell=1;
io_buffer= io_buffer_create( 0 );
-
+
prev_status = proc_get_last_status();
-
+
if( eval( cmd, io_buffer, SUBST ) )
{
status = -1;
@@ -1753,16 +1753,16 @@ int exec_subshell( const wchar_t *cmd,
{
status = proc_get_last_status();
}
-
+
io_buffer_read( io_buffer );
-
+
proc_set_last_status( prev_status );
-
+
is_subshell = prev_subshell;
-
+
b_append( io_buffer->param2.out_buffer, &z, 1 );
-
- begin=end=io_buffer->param2.out_buffer->buff;
+
+ begin=end=io_buffer->param2.out_buffer->buff;
if( lst )
{
@@ -1781,9 +1781,9 @@ int exec_subshell( const wchar_t *cmd,
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
}
- }
+ }
io_buffer_destroy( io_buffer );
-
+
return status;
}
else if( *end == sep )
@@ -1804,8 +1804,8 @@ int exec_subshell( const wchar_t *cmd,
end++;
}
}
-
+
io_buffer_destroy( io_buffer );
- return status;
+ return status;
}
diff --git a/exec.h b/exec.h
index 63e0d0a36..ac051da31 100644
--- a/exec.h
+++ b/exec.h
@@ -19,7 +19,7 @@
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
/**
- Execute the processes specified by j.
+ Execute the processes specified by j.
I've put a fair bit of work into making builtins behave like other
programs as far as pipes are concerned. Unlike i.e. bash, builtins
@@ -51,7 +51,7 @@ void exec( job_t *j );
\return the status of the last job to exit, or -1 if en error was encountered.
*/
-__warn_unused int exec_subshell( const wchar_t *cmd,
+__warn_unused int exec_subshell( const wchar_t *cmd,
array_list_t *l );
diff --git a/expand.c b/expand.c
index f731c772d..e871691bf 100644
--- a/expand.c
+++ b/expand.c
@@ -1,7 +1,7 @@
/**\file expand.c
String expansion functions. These functions perform several kinds of
-parameter expansion.
+parameter expansion.
*/
@@ -195,7 +195,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
case 0:
sb_append( &buff, L"''");
break;
-
+
case 1:
{
wchar_t *el = (wchar_t *)al_get( &l, 0 );
@@ -276,14 +276,14 @@ static int match_pid( const wchar_t *cmd,
int *offset)
{
/* Test for direct match */
-
+
if( wcsncmp( cmd, proc, wcslen( proc ) ) == 0 )
{
if( offset )
*offset = 0;
return 1;
}
-
+
/*
Test if the commandline is a path to the command, if so we try
to match against only the command part
@@ -313,7 +313,7 @@ static int match_pid( const wchar_t *cmd,
{
if( offset )
*offset = start+1-first_token;
-
+
free( first_token );
return 1;
@@ -373,14 +373,14 @@ static int find_process( const wchar_t *proc,
if( wcsncmp( proc, jid, wcslen(proc ) )==0 )
{
string_buffer_t desc_buff;
-
+
sb_init( &desc_buff );
-
- sb_printf( &desc_buff,
+
+ sb_printf( &desc_buff,
COMPLETE_JOB_DESC_VAL,
j->command );
-
- completion_allocate( out,
+
+ completion_allocate( out,
jid+wcslen(proc),
(wchar_t *)desc_buff.buff,
0 );
@@ -395,7 +395,7 @@ static int find_process( const wchar_t *proc,
int jid;
wchar_t *end;
-
+
errno = 0;
jid = wcstol( proc, &end, 10 );
if( jid > 0 && !errno && !*end )
@@ -403,7 +403,7 @@ static int find_process( const wchar_t *proc,
j = job_get( jid );
if( (j != 0) && (j->command != 0 ) )
{
-
+
{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
@@ -420,15 +420,15 @@ static int find_process( const wchar_t *proc,
for( j=first_job; j != 0; j=j->next )
{
int offset;
-
+
if( j->command == 0 )
continue;
-
+
if( match_pid( j->command, proc, flags, &offset ) )
{
if( flags & ACCEPT_INCOMPLETE )
{
- completion_allocate( out,
+ completion_allocate( out,
j->command + offset + wcslen(proc),
COMPLETE_JOB_DESC,
0 );
@@ -456,7 +456,7 @@ static int find_process( const wchar_t *proc,
for( p=j->first_process; p; p=p->next )
{
int offset;
-
+
if( p->actual_cmd == 0 )
continue;
@@ -464,7 +464,7 @@ static int find_process( const wchar_t *proc,
{
if( flags & ACCEPT_INCOMPLETE )
{
- completion_allocate( out,
+ completion_allocate( out,
p->actual_cmd + offset + wcslen(proc),
COMPLETE_CHILD_PROCESS_DESC,
0 );
@@ -496,7 +496,7 @@ static int find_process( const wchar_t *proc,
pdir_name = malloc( sizeof(wchar_t)*256 );
pfile_name = malloc( sizeof(wchar_t)*64 );
wcscpy( pdir_name, L"/proc/" );
-
+
while( (next=wreaddir(dir))!=0 )
{
wchar_t *name = next->d_name;
@@ -533,7 +533,7 @@ static int find_process( const wchar_t *proc,
signal_block();
fgetws2( &cmd, &sz, cmdfile );
signal_unblock();
-
+
fclose( cmdfile );
}
else
@@ -574,12 +574,12 @@ static int find_process( const wchar_t *proc,
if( cmd != 0 )
{
int offset;
-
+
if( match_pid( cmd, proc, flags, &offset ) )
{
if( flags & ACCEPT_INCOMPLETE )
{
- completion_allocate( out,
+ completion_allocate( out,
cmd + offset + wcslen(proc),
COMPLETE_PROCESS_DESC,
0 );
@@ -615,7 +615,7 @@ static int expand_pid( wchar_t *in,
CHECK( in, 0 );
CHECK( out, 0 );
-
+
if( *in != PROCESS_EXPAND )
{
al_push( out, in );
@@ -626,16 +626,16 @@ static int expand_pid( wchar_t *in,
{
if( wcsncmp( in+1, SELF_STR, wcslen(in+1) )==0 )
{
- completion_allocate( out,
+ completion_allocate( out,
SELF_STR+wcslen(in+1),
- COMPLETE_SELF_DESC,
+ COMPLETE_SELF_DESC,
0 );
}
else if( wcsncmp( in+1, LAST_STR, wcslen(in+1) )==0 )
{
- completion_allocate( out,
- LAST_STR+wcslen(in+1),
- COMPLETE_LAST_DESC,
+ completion_allocate( out,
+ LAST_STR+wcslen(in+1),
+ COMPLETE_LAST_DESC,
0 );
}
}
@@ -692,7 +692,7 @@ static int expand_pid( wchar_t *in,
void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
{
int stop_pos = token_pos+1;
-
+
switch( token[stop_pos] )
{
case BRACKET_BEGIN:
@@ -707,13 +707,13 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
{
post = end+1;
*end = 0;
-
+
if( !wcsvarname( name ) )
{
is_var = 1;
}
}
-
+
if( is_var )
{
error( SYNTAX_ERROR,
@@ -721,7 +721,7 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
COMPLETE_VAR_BRACKET_DESC,
cpy,
name,
- post );
+ post );
}
else
{
@@ -733,18 +733,18 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
L"" );
}
free( cpy );
-
+
break;
}
-
+
case INTERNAL_SEPARATOR:
{
error( SYNTAX_ERROR,
error_pos,
- COMPLETE_VAR_PARAN_DESC );
+ COMPLETE_VAR_PARAN_DESC );
break;
}
-
+
case 0:
{
error( SYNTAX_ERROR,
@@ -752,7 +752,7 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
COMPLETE_VAR_NULL_DESC );
break;
}
-
+
default:
{
error( SYNTAX_ERROR,
@@ -769,28 +769,28 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
*/
static int parse_slice( wchar_t *in, wchar_t **end_ptr, array_list_t *idx )
{
-
-
+
+
wchar_t *end;
-
+
int pos = 1;
// debug( 0, L"parse_slice on '%ls'", in );
-
+
while( 1 )
{
long tmp;
-
+
while( iswspace(in[pos]) || (in[pos]==INTERNAL_SEPARATOR))
- pos++;
-
+ pos++;
+
if( in[pos] == L']' )
{
pos++;
break;
}
-
+
errno=0;
tmp = wcstol( &in[pos], &end, 10 );
if( ( errno ) || ( end == &in[pos] ) )
@@ -798,19 +798,19 @@ static int parse_slice( wchar_t *in, wchar_t **end_ptr, array_list_t *idx )
return 1;
}
// debug( 0, L"Push idx %d", tmp );
-
+
al_push_long( idx, tmp );
pos = end-in;
}
-
+
if( end_ptr )
{
// debug( 0, L"Remainder is '%ls', slice def was %d characters long", in+pos, pos );
-
+
*end_ptr = in+pos;
}
// debug( 0, L"ok, done" );
-
+
return 0;
}
@@ -843,7 +843,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
CHECK( in, 0 );
CHECK( out, 0 );
-
+
if( !var_tmp )
{
var_tmp = sb_halloc( global_context );
@@ -878,7 +878,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
wchar_t * new_in;
int is_single = (c==VARIABLE_EXPAND_SINGLE);
int var_name_stop_pos;
-
+
stop_pos = start_pos;
while( 1 )
@@ -892,15 +892,15 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
stop_pos++;
}
var_name_stop_pos = stop_pos;
-
+
/* printf( "Stop for '%c'\n", in[stop_pos]);*/
var_len = stop_pos - start_pos;
if( var_len == 0 )
{
- expand_variable_error( in, stop_pos-1, -1 );
-
+ expand_variable_error( in, stop_pos-1, -1 );
+
is_ok = 0;
break;
}
@@ -919,17 +919,17 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
{
wchar_t *slice_end;
all_vars=0;
-
+
if( parse_slice( &in[stop_pos], &slice_end, var_idx_list ) )
{
error( SYNTAX_ERROR,
-1,
- L"Invalid index value" );
+ L"Invalid index value" );
is_ok = 0;
- }
+ }
stop_pos = (slice_end-in);
- }
-
+ }
+
if( is_ok )
{
tokenize_variable_array( var_val, &var_item_list );
@@ -974,12 +974,12 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
if( is_ok )
{
-
+
if( is_single )
{
string_buffer_t res;
in[i]=0;
-
+
sb_init( &res );
sb_append( &res, in );
sb_append_char( &res, INTERNAL_SEPARATOR );
@@ -987,7 +987,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
for( j=0; j1 && new_in[start_pos-2]!=VARIABLE_EXPAND)
@@ -1032,20 +1032,20 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
}
else
new_in[start_pos-1]=L'\0';
-
+
wcscat( new_in, next );
wcscat( new_in, &in[stop_pos] );
-
+
is_ok &= expand_variables( new_in, out, i );
}
}
free( next );
}
-
+
}
}
}
-
+
free(in);
al_destroy( &var_item_list );
return is_ok;
@@ -1116,7 +1116,7 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
CHECK( in, 0 );
CHECK( out, 0 );
-
+
for( pos=in;
(*pos) && !syntax_error;
pos++ )
@@ -1138,7 +1138,7 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
{
bracket_end = pos;
}
-
+
if( bracket_count < 0 )
{
syntax_error = 1;
@@ -1246,12 +1246,12 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
array_list_t *sub_res, *tail_expand;
int i, j;
const wchar_t *item_begin;
- wchar_t *tail_begin = 0;
+ wchar_t *tail_begin = 0;
void *context;
CHECK( in, 0 );
CHECK( out, 0 );
-
+
switch( parse_util_locate_cmdsubst(in,
@@ -1281,7 +1281,7 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
sub_res = al_halloc( context );
if( !(subcmd = halloc( context, sizeof(wchar_t)*(paran_end-paran_begin) )))
{
- halloc_free( context );
+ halloc_free( context );
return 0;
}
@@ -1300,10 +1300,10 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
{
array_list_t *slice_idx = al_halloc( context );
wchar_t *slice_end;
-
+
if( parse_slice( tail_begin, &slice_end, slice_idx ) )
{
- halloc_free( context );
+ halloc_free( context );
error( SYNTAX_ERROR, -1, L"Invalid index value" );
return 0;
}
@@ -1318,23 +1318,23 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
{
idx = al_get_count( sub_res ) + idx + 1;
}
-
+
if( idx < 1 || idx > al_get_count( sub_res ) )
{
halloc_free( context );
error( SYNTAX_ERROR, -1, L"Invalid index value" );
return 0;
}
-
+
idx = idx-1;
-
+
al_push( sub_res2, al_get( sub_res, idx ) );
// debug( 0, L"Pushing item '%ls' with index %d onto sliced result", al_get( sub_res, idx ), idx );
-
+
al_set( sub_res, idx, 0 );
}
al_foreach( sub_res, &free );
- sub_res = sub_res2;
+ sub_res = sub_res2;
}
}
@@ -1371,16 +1371,16 @@ static int expand_cmdsubst( wchar_t *in, array_list_t *out )
sb_append_substring( &whole_item, sub_item2, item_len );
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
sb_append( &whole_item, tail_item );
-
+
al_push( out, whole_item.buff );
}
-
+
free( sub_item2 );
}
free(in);
al_foreach( tail_expand, &free );
- halloc_free( context );
+ halloc_free( context );
return 1;
}
@@ -1481,7 +1481,7 @@ static wchar_t * expand_tilde_internal( wchar_t *in )
wchar_t *expand_tilde( wchar_t *in)
{
CHECK( in, 0 );
-
+
if( in[0] == L'~' )
{
in[0] = HOME_DIRECTORY;
@@ -1498,7 +1498,7 @@ static void remove_internal_separator( const void *s, int conv )
{
wchar_t *in = (wchar_t *)s;
wchar_t *out=in;
-
+
CHECK( s, );
while( *in )
@@ -1508,7 +1508,7 @@ static void remove_internal_separator( const void *s, int conv )
case INTERNAL_SEPARATOR:
in++;
break;
-
+
case ANY_CHAR:
in++;
*out++ = conv?L'?':ANY_CHAR;
@@ -1564,7 +1564,7 @@ int expand_string( void *context,
if( EXPAND_SKIP_CMDSUBST & flags )
{
wchar_t *begin, *end;
-
+
if( parse_util_locate_cmdsubst( str,
&begin,
&end,
@@ -1611,7 +1611,7 @@ int expand_string( void *context,
if( !next )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- continue;
+ continue;
}
if( EXPAND_SKIP_VARIABLES & flags )
@@ -1645,8 +1645,8 @@ int expand_string( void *context,
if( !next )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- continue;
- }
+ continue;
+ }
if( !expand_brackets( next, flags, out ))
{
@@ -1667,8 +1667,8 @@ int expand_string( void *context,
if( !next )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- continue;
- }
+ continue;
+ }
if( !(next=expand_tilde_internal( next ) ) )
{
@@ -1719,11 +1719,11 @@ int expand_string( void *context,
if( !next )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- continue;
- }
+ continue;
+ }
remove_internal_separator( next, EXPAND_SKIP_WILDCARDS & flags );
-
+
if( ((flags & ACCEPT_INCOMPLETE) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
wildcard_has( next, 1 ) )
{
@@ -1745,14 +1745,14 @@ int expand_string( void *context,
{
list = end_out;
}
-
+
wc_res = wildcard_expand( rest, start, flags, list );
free( next );
if( !(flags & ACCEPT_INCOMPLETE) )
{
-
+
switch( wc_res )
{
case 0:
@@ -1764,7 +1764,7 @@ int expand_string( void *context,
break;
}
}
-
+
case 1:
{
int j;
@@ -1777,8 +1777,8 @@ int expand_string( void *context,
if( !next )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- continue;
- }
+ continue;
+ }
al_push( end_out, next );
}
al_truncate( out, 0 );
@@ -1792,10 +1792,10 @@ int expand_string( void *context,
al_destroy( out );
return EXPAND_ERROR;
}
-
+
}
}
-
+
}
else
{
@@ -1822,7 +1822,7 @@ int expand_string( void *context,
}
}
-
+
return res;
}
@@ -1835,13 +1835,13 @@ wchar_t *expand_one( void *context, wchar_t *string, int flags )
wchar_t *one;
CHECK( string, 0 );
-
+
if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string ) )
{
halloc_register( context, string );
return string;
}
-
+
al_init( &l );
res = expand_string( 0, string, &l, flags );
if( !res )
diff --git a/expand.h b/expand.h
index 767a372ee..3c2cad826 100644
--- a/expand.h
+++ b/expand.h
@@ -6,7 +6,7 @@
benefit from using a more clever memory allocation scheme, perhaps
an evil combination of talloc, string buffers and reference
counting.
-
+
*/
#ifndef FISH_EXPAND_H
@@ -70,7 +70,7 @@ enum
/** Character represeting process expansion */
PROCESS_EXPAND,
-
+
/** Character representing variable expansion */
VARIABLE_EXPAND,
@@ -86,7 +86,7 @@ enum
/** Character representing separation between two bracket elements */
BRACKET_SEP,
/**
- Separate subtokens in a token with this character.
+ Separate subtokens in a token with this character.
*/
INTERNAL_SEPARATOR,
@@ -128,7 +128,7 @@ enum
(\$VAR_NAME becomes the value of the environment variable VAR_NAME),
cmdsubst expansion and wildcard expansion. The results are inserted
into the list out.
-
+
If the parameter does not need expansion, it is copied into the list
out. If expansion is performed, the original parameter is freed and
newly allocated strings are inserted into the list out.
@@ -136,7 +136,7 @@ enum
If \c context is non-null, all the strings contained in the
array_list_t \c out will be registered to be free'd when context is
free'd.
-
+
\param context the halloc context to use for automatic deallocation
\param in The parameter to expand
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_CMDSUBST EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
@@ -152,8 +152,8 @@ __warn_unused int expand_string( void *context, wchar_t *in, array_list_t *out,
If \c context is non-null, the returning string ill be registered
to be free'd when context is free'd.
-
- \param context the halloc context to use for automatic deallocation
+
+ \param context the halloc context to use for automatic deallocation
\param in The parameter to expand
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_CMDSUBST EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
\return The expanded parameter, or 0 on failiure
diff --git a/fallback.c b/fallback.c
index 004e198fe..452ac6643 100644
--- a/fallback.c
+++ b/fallback.c
@@ -60,7 +60,7 @@ int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t))
while( *str )
{
fish_putc( *str++ );
- }
+ }
}
#endif
@@ -81,26 +81,26 @@ char *tparm_solaris_kludge( char *str, ... )
if( ( set_a_foreground && ! strcmp( str, set_a_foreground ) )
|| ( set_a_background && ! strcmp( str, set_a_background ) )
- || ( set_foreground && ! strcmp( str, set_foreground ) )
+ || ( set_foreground && ! strcmp( str, set_foreground ) )
|| ( set_background && ! strcmp( str, set_background ) )
- || ( enter_underline_mode && ! strcmp( str, enter_underline_mode ) )
- || ( exit_underline_mode && ! strcmp( str, exit_underline_mode ) )
- || ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
- || ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
- || ( flash_screen && ! strcmp( str, flash_screen ) )
- || ( enter_subscript_mode && ! strcmp( str, enter_subscript_mode ) )
- || ( exit_subscript_mode && ! strcmp( str, exit_subscript_mode ) )
- || ( enter_superscript_mode && ! strcmp( str, enter_superscript_mode ) )
- || ( exit_superscript_mode && ! strcmp( str, exit_superscript_mode ) )
- || ( enter_blink_mode && ! strcmp( str, enter_blink_mode ) )
- || ( enter_italics_mode && ! strcmp( str, enter_italics_mode ) )
- || ( exit_italics_mode && ! strcmp( str, exit_italics_mode ) )
- || ( enter_reverse_mode && ! strcmp( str, enter_reverse_mode ) )
- || ( enter_shadow_mode && ! strcmp( str, enter_shadow_mode ) )
- || ( exit_shadow_mode && ! strcmp( str, exit_shadow_mode ) )
- || ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
- || ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
- || ( enter_secure_mode && ! strcmp( str, enter_secure_mode ) )
+ || ( enter_underline_mode && ! strcmp( str, enter_underline_mode ) )
+ || ( exit_underline_mode && ! strcmp( str, exit_underline_mode ) )
+ || ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
+ || ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
+ || ( flash_screen && ! strcmp( str, flash_screen ) )
+ || ( enter_subscript_mode && ! strcmp( str, enter_subscript_mode ) )
+ || ( exit_subscript_mode && ! strcmp( str, exit_subscript_mode ) )
+ || ( enter_superscript_mode && ! strcmp( str, enter_superscript_mode ) )
+ || ( exit_superscript_mode && ! strcmp( str, exit_superscript_mode ) )
+ || ( enter_blink_mode && ! strcmp( str, enter_blink_mode ) )
+ || ( enter_italics_mode && ! strcmp( str, enter_italics_mode ) )
+ || ( exit_italics_mode && ! strcmp( str, exit_italics_mode ) )
+ || ( enter_reverse_mode && ! strcmp( str, enter_reverse_mode ) )
+ || ( enter_shadow_mode && ! strcmp( str, enter_shadow_mode ) )
+ || ( exit_shadow_mode && ! strcmp( str, exit_shadow_mode ) )
+ || ( enter_standout_mode && ! strcmp( str, enter_standout_mode ) )
+ || ( exit_standout_mode && ! strcmp( str, exit_standout_mode ) )
+ || ( enter_secure_mode && ! strcmp( str, enter_secure_mode ) )
|| ( enter_bold_mode && ! strcmp ( str, enter_bold_mode ) ) )
{
param[0] = va_arg( ap, long int );
@@ -140,11 +140,11 @@ char *tparm_solaris_kludge( char *str, ... )
*/
static void pad( void (*writer)(wchar_t), int count)
{
-
+
int i;
if( count < 0 )
return;
-
+
for( i=0; i= L'0') && (*filter <= L'9'))
{
width=10*width+(*filter++ - L'0');
- }
+ }
}
while( loop )
{
-
+
switch(*filter)
{
case L'l':
@@ -219,9 +219,9 @@ static int vgwprintf( void (*writer)(wchar_t),
filter++;
pad_left=0;
break;
-
+
case L'.':
- /*
+ /*
Set precision.
*/
filter++;
@@ -235,10 +235,10 @@ static int vgwprintf( void (*writer)(wchar_t),
while( (*filter >= L'0') && (*filter <= L'9'))
{
precision=10*precision+(*filter++ - L'0');
- }
+ }
}
break;
-
+
default:
loop=0;
break;
@@ -253,8 +253,8 @@ static int vgwprintf( void (*writer)(wchar_t),
if( (width >= 0) && pad_left )
{
- pad( writer, width-1 );
- count += maxi( width-1, 0 );
+ pad( writer, width-1 );
+ count += maxi( width-1, 0 );
}
c = is_long?va_arg(va, wint_t):btowc(va_arg(va, int));
@@ -265,16 +265,16 @@ static int vgwprintf( void (*writer)(wchar_t),
if( (width >= 0) && !pad_left )
{
pad( writer, width-1 );
- count += maxi( width-1, 0 );
+ count += maxi( width-1, 0 );
}
-
+
count++;
-
+
break;
}
case L's':
- {
-
+ {
+
wchar_t *ss=0;
if( is_long )
{
@@ -287,41 +287,41 @@ static int vgwprintf( void (*writer)(wchar_t),
if( ns )
{
ss = str2wcs( ns );
- }
+ }
}
-
+
if( !ss )
{
return -1;
}
-
+
if( (width >= 0) && pad_left )
{
- pad( writer, width-wcslen(ss) );
- count += maxi(width-wcslen(ss), 0);
+ pad( writer, width-wcslen(ss) );
+ count += maxi(width-wcslen(ss), 0);
}
-
+
wchar_t *s=ss;
int precount = count;
-
+
while( *s )
{
if( (precision > 0) && (precision <= (count-precount) ) )
break;
-
+
writer( *(s++) );
count++;
}
-
+
if( (width >= 0) && !pad_left )
{
- pad( writer, width-wcslen(ss) );
- count += maxi( width-wcslen(ss), 0 );
+ pad( writer, width-wcslen(ss) );
+ count += maxi( width-wcslen(ss), 0 );
}
-
+
if( !is_long )
free( ss );
-
+
break;
}
@@ -336,7 +336,7 @@ static int vgwprintf( void (*writer)(wchar_t),
char *pos;
char format[16];
int len;
-
+
format[0]=0;
strcat( format, "%");
if( precision >= 0 )
@@ -350,7 +350,7 @@ static int vgwprintf( void (*writer)(wchar_t),
strcat( format, "l" );
break;
}
-
+
len = strlen(format);
format[len++]=(char)*filter;
format[len]=0;
@@ -360,7 +360,7 @@ static int vgwprintf( void (*writer)(wchar_t),
case L'd':
case L'i':
{
-
+
switch( is_long )
{
case 0:
@@ -370,10 +370,10 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, precision, d );
else
snprintf( str, 32, format, d );
-
+
break;
}
-
+
case 1:
{
long d = va_arg( va, long );
@@ -383,7 +383,7 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, d );
break;
}
-
+
case 2:
{
long long d = va_arg( va, long long );
@@ -393,21 +393,21 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, d );
break;
}
-
+
default:
debug( 0, L"Invalid length modifier in string %ls\n", filter_org );
return -1;
}
break;
-
+
}
-
+
case L'u':
case L'o':
case L'x':
case L'X':
{
-
+
switch( is_long )
{
case 0:
@@ -419,7 +419,7 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, d );
break;
}
-
+
case 1:
{
unsigned long d = va_arg( va, unsigned long );
@@ -429,7 +429,7 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, d );
break;
}
-
+
case 2:
{
unsigned long long d = va_arg( va, unsigned long long );
@@ -439,43 +439,43 @@ static int vgwprintf( void (*writer)(wchar_t),
snprintf( str, 32, format, d );
break;
}
-
+
default:
debug( 0, L"Invalid length modifier in string %ls\n", filter_org );
return -1;
}
break;
-
+
}
-
+
default:
debug( 0, L"Invalid filter %ls in string %ls\n", *filter, filter_org );
return -1;
-
+
}
-
+
if( (width >= 0) && pad_left )
{
int l = maxi(width-strlen(str), 0 );
pad( writer, l );
count += l;
}
-
+
pos = str;
-
+
while( *pos )
{
writer( *(pos++) );
count++;
}
-
+
if( (width >= 0) && !pad_left )
{
int l = maxi(width-strlen(str), 0 );
pad( writer, l );
count += l;
}
-
+
break;
}
@@ -484,7 +484,7 @@ static int vgwprintf( void (*writer)(wchar_t),
char str[32];
char *pos;
double val = va_arg( va, double );
-
+
if( precision>= 0 )
{
if( width>= 0 )
@@ -509,21 +509,21 @@ static int vgwprintf( void (*writer)(wchar_t),
}
pos = str;
-
+
while( *pos )
{
writer( *(pos++) );
count++;
}
-
+
break;
}
case L'n':
{
int *n = va_arg( va, int *);
-
- *n = count;
+
+ *n = count;
break;
}
case L'%':
@@ -564,14 +564,14 @@ sw_data;
static void sw_writer( wchar_t c )
{
if( sw_data.count < sw_data.max )
- *(sw_data.pos++)=c;
+ *(sw_data.pos++)=c;
sw_data.count++;
}
int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va )
{
int written;
-
+
sw_data.pos=out;
sw_data.max=n;
sw_data.count=0;
@@ -586,7 +586,7 @@ int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va )
{
written=-1;
}
-
+
return written;
}
@@ -594,7 +594,7 @@ int swprintf( wchar_t *out, size_t n, const wchar_t *filter, ... )
{
va_list va;
int written;
-
+
va_start( va, filter );
written = vswprintf( out, n, filter, va );
va_end( va );
@@ -624,7 +624,7 @@ int fwprintf( FILE *f, const wchar_t *filter, ... )
{
va_list va;
int written;
-
+
va_start( va, filter );
written = vfwprintf( f, filter, va );
va_end( va );
@@ -640,7 +640,7 @@ int wprintf( const wchar_t *filter, ... )
{
va_list va;
int written;
-
+
va_start( va, filter );
written=vwprintf( filter, va );
va_end( va );
@@ -661,16 +661,16 @@ wint_t fgetwc(FILE *stream)
{
int b = fgetc( stream );
char bb;
-
+
int sz;
-
+
if( b == EOF )
return WEOF;
bb=b;
-
+
sz = mbrtowc( &res, &bb, 1, &state );
-
+
switch( sz )
{
case -1:
@@ -733,13 +733,13 @@ static size_t fish_wcsspn (const wchar_t *wcs,
for (a = accept; *a != L'\0'; ++a)
if (*p == *a)
break;
-
+
if (*a == L'\0')
return count;
else
++count;
}
- return count;
+ return count;
}
/*
@@ -752,7 +752,7 @@ static wchar_t *fish_wcspbrk (const wchar_t *wcs, const wchar_t *accept)
++wcs;
else
return (wchar_t *) wcs;
- return NULL;
+ return NULL;
}
/*
@@ -775,18 +775,18 @@ wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **save_ptr)
/* Scan leading delimiters. */
wcs += fish_wcsspn (wcs, delim);
-
+
if (*wcs == L'\0')
{
- *save_ptr = NULL;
+ *save_ptr = NULL;
return NULL;
}
/* Find the end of the token. */
result = wcs;
-
+
wcs = fish_wcspbrk (result, delim);
-
+
if (wcs == NULL)
{
/* This token finishes the string. */
@@ -815,7 +815,7 @@ wchar_t *wcsdup( const wchar_t *in )
memcpy( out, in, sizeof( wchar_t)*(len+1));
return out;
-
+
}
#endif
@@ -855,7 +855,7 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
{
if( count == 0 )
return 0;
-
+
if( *a == 0 )
{
return (*b==0)?0:-1;
@@ -892,7 +892,7 @@ wchar_t *wcsndup( const wchar_t *in, int c )
return 0;
}
wcslcpy( res, in, c+1 );
- return res;
+ return res;
}
#endif
@@ -905,22 +905,22 @@ long convert_digit( wchar_t d, int base )
}
else if( (d <= L'z') && (d >= L'a') )
{
- res = d + 10 - L'a';
+ res = d + 10 - L'a';
}
else if( (d <= L'Z') && (d >= L'A') )
{
- res = d + 10 - L'A';
+ res = d + 10 - L'A';
}
if( res >= base )
{
res = -1;
}
-
+
return res;
}
#ifndef HAVE_WCSTOL
-long wcstol(const wchar_t *nptr,
+long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base)
{
@@ -943,7 +943,7 @@ long wcstol(const wchar_t *nptr,
{
errno = EINVAL;
}
- return res;
+ return res;
}
res = (res*base)+nxt;
is_set = 1;
@@ -985,25 +985,25 @@ long wcstol(const wchar_t *nptr,
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
{
-
+
register wchar_t *d = dst;
register const wchar_t *s = src;
- register size_t n = siz;
+ register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
-
+
dlen = d - dst;
- n = siz - dlen;
+ n = siz - dlen;
if (n == 0)
return(dlen + wcslen(s));
- while (*s != '\0')
+ while (*s != '\0')
{
- if (n != 1)
+ if (n != 1)
{
*d++ = *s;
n--;
@@ -1043,12 +1043,12 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
-
+
/* Copy as many bytes as will fit */
- if (n != 0 && --n != 0)
- {
- do
- {
+ if (n != 0 && --n != 0)
+ {
+ do
+ {
if ((*d++ = *s++) == 0)
break;
}
@@ -1056,8 +1056,8 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
}
/* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0)
- {
+ if (n == 0)
+ {
if (siz != 0)
*d = '\0';
/* NUL-terminate dst */
@@ -1074,7 +1074,7 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
int lrand48_r(struct drand48_data *buffer, long int *result)
{
- *result = rand_r( &buffer->seed );
+ *result = rand_r( &buffer->seed );
return 0;
}
@@ -1143,10 +1143,10 @@ int killpg( int pgr, int sig )
#ifndef HAVE_WORKING_GETOPT_LONG
-int getopt_long( int argc,
+int getopt_long( int argc,
char * const argv[],
const char *optstring,
- const struct option *longopts,
+ const struct option *longopts,
int *longindex )
{
return getopt( argc, argv, optstring );
@@ -1181,7 +1181,7 @@ long sysconf(int name)
}
return -1;
-
+
}
#endif
diff --git a/fallback.h b/fallback.h
index e4813fb2f..62175ca5c 100644
--- a/fallback.h
+++ b/fallback.h
@@ -57,12 +57,12 @@ typedef char tputs_arg_t;
/**
Structure used to get the size of a terminal window
*/
-struct winsize
+struct winsize
{
/**
Number of rows
*/
- unsigned short ws_row;
+ unsigned short ws_row;
/**
Number of columns
*/
@@ -193,7 +193,7 @@ wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
/**
Return the number of columns used by a character. This is a libc
function, but the prototype for this function is missing in some libc
- implementations.
+ implementations.
Fish has a fallback implementation in case the implementation is
missing altogether. In locales without a native wcwidth, Unicode
@@ -320,7 +320,7 @@ size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
- and renamed to reflect this change.
+ and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
@@ -390,7 +390,7 @@ char * textdomain( const char * domainname );
/**
Fallback implementation of dcgettext. Just returns the original string.
*/
-char * dcgettext ( const char * domainname,
+char * dcgettext ( const char * domainname,
const char * msgid,
int category );
@@ -421,7 +421,7 @@ int killpg( int pgr, int sig );
/**
Struct describing a long getopt option
*/
-struct option
+struct option
{
/**
Name of option
@@ -438,7 +438,7 @@ struct option
/**
Return value
*/
- int val;
+ int val;
}
;
@@ -454,10 +454,10 @@ struct option
#define optional_argument 2
#endif
-int getopt_long(int argc,
+int getopt_long(int argc,
char * const argv[],
const char *optstring,
- const struct option *longopts,
+ const struct option *longopts,
int *longindex);
#endif
diff --git a/fish.c b/fish.c
index fbc9ffbf4..062c9a729 100644
--- a/fish.c
+++ b/fish.c
@@ -80,7 +80,7 @@ static int read_init()
eval( L"builtin . " DATADIR "/fish/config.fish 2>/dev/null", 0, TOP );
eval( L"builtin . " SYSCONFDIR L"/fish/config.fish 2>/dev/null", 0, TOP );
-
+
/*
We need to get the configuration directory before we can source the user configuration file
*/
@@ -99,9 +99,9 @@ static int read_init()
eval( (wchar_t *)eval_buff->buff, 0, TOP );
free( config_dir_escaped );
}
-
+
halloc_free( context );
-
+
return 1;
}
@@ -114,83 +114,83 @@ static int fish_parse_opt( int argc, char **argv, char **cmd_ptr )
{
int my_optind;
int force_interactive=0;
-
+
while( 1 )
{
static struct option
long_options[] =
{
{
- "command", required_argument, 0, 'c'
+ "command", required_argument, 0, 'c'
}
,
{
- "debug-level", required_argument, 0, 'd'
+ "debug-level", required_argument, 0, 'd'
}
,
{
- "interactive", no_argument, 0, 'i'
+ "interactive", no_argument, 0, 'i'
}
,
{
- "login", no_argument, 0, 'l'
+ "login", no_argument, 0, 'l'
}
,
{
- "no-execute", no_argument, 0, 'n'
+ "no-execute", no_argument, 0, 'n'
}
,
{
- "profile", required_argument, 0, 'p'
+ "profile", required_argument, 0, 'p'
}
,
{
- "help", no_argument, 0, 'h'
+ "help", no_argument, 0, 'h'
}
,
{
- "version", no_argument, 0, 'v'
+ "version", no_argument, 0, 'v'
}
,
- {
- 0, 0, 0, 0
+ {
+ 0, 0, 0, 0
}
}
;
-
+
int opt_index = 0;
-
+
int opt = getopt_long( argc,
- argv,
+ argv,
GETOPT_STRING,
- long_options,
+ long_options,
&opt_index );
-
+
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
{
break;
}
-
- case 'c':
+
+ case 'c':
{
- *cmd_ptr = optarg;
+ *cmd_ptr = optarg;
is_interactive_session = 0;
break;
}
-
- case 'd':
+
+ case 'd':
{
char *end;
int tmp;
errno = 0;
tmp = strtol(optarg, &end, 10);
-
+
if( tmp >= 0 && tmp <=10 && !*end && !errno )
{
debug_level=tmp;
@@ -202,65 +202,65 @@ static int fish_parse_opt( int argc, char **argv, char **cmd_ptr )
}
break;
}
-
+
case 'h':
{
*cmd_ptr = "__fish_print_help fish";
break;
}
-
+
case 'i':
{
force_interactive = 1;
- break;
+ break;
}
-
+
case 'l':
{
is_login=1;
- break;
+ break;
}
-
+
case 'n':
{
no_exec=1;
- break;
+ break;
}
-
+
case 'p':
{
profile = optarg;
- break;
+ break;
}
-
+
case 'v':
{
- fwprintf( stderr,
- _(L"%s, version %s\n"),
+ fwprintf( stderr,
+ _(L"%s, version %s\n"),
PACKAGE_NAME,
PACKAGE_VERSION );
- exit( 0 );
+ exit( 0 );
}
-
+
case '?':
{
exit( 1 );
}
-
- }
+
+ }
}
my_optind = optind;
-
+
is_login |= (strcmp( argv[0], "-fish") == 0);
-
+
/*
We are an interactive session if we have not been given an
explicit command to execute, _and_ stdin is a tty.
*/
is_interactive_session &= (*cmd_ptr == 0);
is_interactive_session &= (my_optind == argc);
- is_interactive_session &= isatty(STDIN_FILENO);
+ is_interactive_session &= isatty(STDIN_FILENO);
/*
We are also an interactive session if we have are forced-
@@ -282,7 +282,7 @@ int main( int argc, char **argv )
char *cmd=0;
int my_optind=0;
- halloc_util_init();
+ halloc_util_init();
wsetlocale( LC_ALL, L"" );
is_interactive_session=1;
@@ -299,9 +299,9 @@ int main( int argc, char **argv )
debug( 1, _(L"Can not use the no-execute mode when running an interactive session") );
no_exec = 0;
}
-
- proc_init();
- event_init();
+
+ proc_init();
+ event_init();
wutil_init();
parser_init();
builtin_init();
@@ -323,28 +323,28 @@ int main( int argc, char **argv )
{
if( my_optind == argc )
{
- res = reader_read( 0, 0 );
+ res = reader_read( STDIN_FILENO, 0 );
}
else
{
- char **ptr;
- char *file = *(argv+1);
- int i;
+ char **ptr;
+ char *file = *(argv+(my_optind++));
+ int i;
string_buffer_t sb;
int fd;
wchar_t *rel_filename, *abs_filename;
-
+
if( ( fd = open(file, O_RDONLY) ) == -1 )
{
wperror( L"open" );
return 1;
}
- if( *(argv+2))
+ if( *(argv+my_optind))
{
sb_init( &sb );
-
- for( i=1,ptr = argv+2; *ptr; i++, ptr++ )
+
+ for( i=1,ptr = argv+my_optind; *ptr; i++, ptr++ )
{
if( i != 1 )
sb_append( &sb, ARRAY_SEP_STR );
@@ -352,7 +352,7 @@ int main( int argc, char **argv )
sb_append( &sb, val );
free( val );
}
-
+
env_set( L"argv", (wchar_t *)sb.buff, 0 );
sb_destroy( &sb );
}
@@ -373,17 +373,17 @@ int main( int argc, char **argv )
if( res )
{
- debug( 1,
- _(L"Error while reading file %ls\n"),
+ debug( 1,
+ _(L"Error while reading file %ls\n"),
reader_current_filename()?reader_current_filename(): _(L"Standard input") );
- }
+ }
reader_pop_current_filename();
}
}
}
-
+
proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, getpid(), res );
-
+
history_destroy();
proc_destroy();
builtin_destroy();
@@ -392,12 +392,12 @@ int main( int argc, char **argv )
parser_destroy();
wutil_destroy();
event_destroy();
-
+
halloc_util_destroy();
-
+
env_destroy();
-
+
intern_free_all();
-
- return res?STATUS_UNKNOWN_COMMAND:proc_get_last_status();
+
+ return res?STATUS_UNKNOWN_COMMAND:proc_get_last_status();
}
diff --git a/fish.spec.in b/fish.spec.in
index a7403ffef..b16365597 100644
--- a/fish.spec.in
+++ b/fish.spec.in
@@ -11,7 +11,7 @@ URL: http://www.fishshell.org
Source0: http://www.fishshell.org/files/%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: ncurses-devel gettext groff
+BuildRequires: ncurses-devel gettext groff
# Locate correct build time-dependencies for providing X headers
@@ -50,10 +50,10 @@ BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h
%endif
-%description
+%description
-fish is a shell geared towards interactive use. Its features are
-focused on user friendliness and discoverability. The language syntax
+fish is a shell geared towards interactive use. Its features are
+focused on user friendliness and discoverability. The language syntax
is simple but incompatible with other shell languages.
@@ -75,7 +75,7 @@ make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
-make install DESTDIR="$RPM_BUILD_ROOT"
+make install DESTDIR="$RPM_BUILD_ROOT"
# Find translation files
%find_lang %{name}.\*
diff --git a/fish_indent.c b/fish_indent.c
index 59226ad81..5e709f2b8 100644
--- a/fish_indent.c
+++ b/fish_indent.c
@@ -64,10 +64,10 @@ static void read_file( FILE *f, string_buffer_t *b )
wperror(L"fgetwc");
exit(1);
}
-
+
break;
}
-
+
sb_append_char( b, c );
}
}
@@ -78,12 +78,12 @@ static void read_file( FILE *f, string_buffer_t *b )
static void insert_tabs( string_buffer_t *out, int indent )
{
int i;
-
+
for( i=0; i " );
break;
-
+
case TOK_REDIRECT_APPEND:
sb_append( out, L">> " );
break;
-
+
case TOK_REDIRECT_IN:
sb_append( out, L"< " );
break;
-
+
case TOK_REDIRECT_FD:
sb_append( out, L">& " );
break;
-
+
}
break;
}
-
+
case TOK_BACKGROUND:
{
@@ -202,7 +202,7 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
is_command = 1;
break;
}
-
+
case TOK_COMMENT:
{
@@ -210,24 +210,24 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
{
insert_tabs( out, indent );
}
-
+
sb_printf( out, L"%ls", last );
do_indent = 1;
- break;
+ break;
}
-
+
default:
{
debug( 0, L"Unknown token '%ls'", last );
exit(1);
- }
+ }
}
-
+
prev_prev_type = prev_type;
prev_type = type;
-
+
}
-
+
tok_destroy( &tok );
return res;
@@ -241,27 +241,27 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
static wchar_t *trim( wchar_t *in )
{
wchar_t *end;
-
+
while( *in == L'\n' )
{
in++;
}
-
+
end = in + wcslen(in);
-
+
while( 1 )
{
if( end < in+2 )
break;
end--;
-
+
if( (*end == L'\n' ) && ( *(end-1) == L'\n' ) )
*end=0;
else
break;
}
-
+
return in;
}
@@ -273,9 +273,9 @@ int main( int argc, char **argv )
{
string_buffer_t sb_in;
string_buffer_t sb_out;
-
+
int do_indent=1;
-
+
wsetlocale( LC_ALL, L"" );
program_name=L"fish_indent";
@@ -285,55 +285,55 @@ int main( int argc, char **argv )
long_options[] =
{
{
- "no-indent", no_argument, 0, 'i'
+ "no-indent", no_argument, 0, 'i'
}
,
{
- "help", no_argument, 0, 'h'
+ "help", no_argument, 0, 'h'
}
,
{
- "version", no_argument, 0, 'v'
+ "version", no_argument, 0, 'v'
}
,
- {
- 0, 0, 0, 0
+ {
+ 0, 0, 0, 0
}
}
;
-
+
int opt_index = 0;
-
+
int opt = getopt_long( argc,
- argv,
+ argv,
GETOPT_STRING,
- long_options,
+ long_options,
&opt_index );
-
+
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
{
break;
}
-
+
case 'h':
{
print_help( "fish_indent", 1 );
- exit( 0 );
+ exit( 0 );
break;
}
-
+
case 'v':
{
- fwprintf( stderr,
- _(L"%ls, version %s\n"),
+ fwprintf( stderr,
+ _(L"%ls, version %s\n"),
program_name,
PACKAGE_VERSION );
- exit( 0 );
+ exit( 0 );
}
case 'i':
@@ -341,23 +341,23 @@ int main( int argc, char **argv )
do_indent = 0;
break;
}
-
-
+
+
case '?':
{
exit( 1 );
}
-
- }
+
+ }
}
- halloc_util_init();
+ halloc_util_init();
sb_init( &sb_in );
sb_init( &sb_out );
read_file( stdin, &sb_in );
-
+
wutil_init();
if( !indent( &sb_out, (wchar_t *)sb_in.buff, do_indent ) )
@@ -371,7 +371,7 @@ int main( int argc, char **argv )
*/
fwprintf( stdout, L"%ls", (wchar_t *)sb_in.buff );
}
-
+
wutil_destroy();
diff --git a/fish_pager.c b/fish_pager.c
index 49c154c89..1ed646126 100644
--- a/fish_pager.c
+++ b/fish_pager.c
@@ -61,7 +61,7 @@
#include "halloc_util.h"
#include "print_help.h"
-enum
+enum
{
LINE_UP = R_NULL+1,
LINE_DOWN,
@@ -146,7 +146,7 @@ static buffer_t *pager_buffer;
The environment variables used to specify the color of different
tokens.
*/
-static wchar_t *hightlight_var[] =
+static wchar_t *hightlight_var[] =
{
L"fish_pager_color_prefix",
L"fish_pager_color_completion",
@@ -167,7 +167,7 @@ static FILE *out_file;
/**
Data structure describing one or a group of related completions
*/
-typedef struct
+typedef struct
{
/**
The list of all completin strings this entry applies to
@@ -180,11 +180,11 @@ typedef struct
/**
On-screen width of the completion string
*/
- int comp_width;
+ int comp_width;
/**
On-screen width of the description information
*/
- int desc_width;
+ int desc_width;
/**
Preffered total width
*/
@@ -208,20 +208,20 @@ static int get_color( int highlight )
return FISH_COLOR_NORMAL;
if( highlight >= (4) )
return FISH_COLOR_NORMAL;
-
+
val = wgetenv( hightlight_var[highlight]);
if( !val )
{
val = env_universal_get( hightlight_var[highlight]);
}
-
+
if( !val )
{
return FISH_COLOR_NORMAL;
}
-
- return output_color_code( val );
+
+ return output_color_code( val );
}
/**
@@ -236,11 +236,11 @@ static void recalc_width( array_list_t *l, const wchar_t *prefix )
for( i=0; imin_width = mini( c->desc_width, maxi(0,termsize.ws_col/3 - 2)) +
mini( c->desc_width, maxi(0,termsize.ws_col/5 - 4)) +4;
}
-
+
}
/**
@@ -251,14 +251,14 @@ static int try_sequence( char *seq )
{
int j, k;
wint_t c=0;
-
- for( j=0;
- seq[j] != '\0' && seq[j] == (c=input_common_readch( j>0 ));
+
+ for( j=0;
+ seq[j] != '\0' && seq[j] == (c=input_common_readch( j>0 ));
j++ )
;
if( seq[j] == '\0' )
- {
+ {
return 1;
}
else
@@ -281,10 +281,10 @@ static wint_t readch()
wint_t bnd;
}
;
-
+
struct mapping m[]=
{
- {
+ {
"\x1b[A", LINE_UP
}
,
@@ -292,7 +292,7 @@ static wint_t readch()
key_up, LINE_UP
}
,
- {
+ {
"\x1b[B", LINE_DOWN
}
,
@@ -319,18 +319,18 @@ static wint_t readch()
{
0, 0
}
-
+
}
;
int i;
-
+
for( i=0; m[i].bnd; i++ )
{
if( !m[i].seq )
{
continue;
}
-
+
if( try_sequence(m[i].seq ) )
return m[i].bnd;
}
@@ -369,7 +369,7 @@ static int print_max( const wchar_t *str, int max, int has_more )
int written = 0;
for( i=0; str[i]; i++ )
{
-
+
if( written + wcwidth(str[i]) > max )
break;
if( ( written + wcwidth(str[i]) == max) && (has_more || str[i+1]) )
@@ -378,7 +378,7 @@ static int print_max( const wchar_t *str, int max, int has_more )
written += wcwidth(ellipsis_char );
break;
}
-
+
writech( str[i] );
written+= wcwidth( str[i] );
}
@@ -393,7 +393,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
int comp_width=0, desc_width=0;
int i;
int written=0;
-
+
if( c->pref_width <= width )
{
/*
@@ -411,7 +411,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
the description.
*/
int desc_all = c->desc_width?c->desc_width+4:0;
-
+
comp_width = maxi( mini( c->comp_width,
2*(width-4)/3 ),
width - desc_all );
@@ -419,9 +419,9 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
desc_width = width-comp_width-4;
else
c->desc_width=0;
-
+
}
-
+
for( i=0; icomp ); i++ )
{
const wchar_t *comp = (const wchar_t *)al_get( c->comp, i );
@@ -455,7 +455,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
writech( L' ');
}
}
-
+
}
/**
@@ -490,14 +490,14 @@ static void completion_print( int cols,
comp_t *el;
int is_last = (j==(cols-1));
-
+
if( al_get_count( l ) <= j*rows + i )
continue;
el = (comp_t *)al_get( l, j*rows + i );
-
+
completion_print_item( prefix, el, width[j] - (is_last?0:2) );
-
+
if( !is_last)
writestr( L" " );
}
@@ -545,24 +545,24 @@ static int completion_try_print( int cols,
Set to one if the list should be printed at this width
*/
int print=0;
-
+
int i, j;
-
+
int rows = (al_get_count( l )-1)/cols+1;
-
+
int pref_tot_width=0;
int min_tot_width = 0;
int res=PAGER_RETRY;
/*
Skip completions on tiny terminals
*/
-
+
if( termsize.ws_col < PAGER_MIN_WIDTH )
return PAGER_DONE;
-
+
memset( pref_width, 0, sizeof(pref_width) );
memset( min_width, 0, sizeof(min_width) );
-
+
/* Calculate how wide the list would be */
for( j = 0; j < cols; j++ )
{
@@ -576,7 +576,7 @@ static int completion_try_print( int cols,
c = (comp_t *)al_get( l, j*rows + i );
pref = c->pref_width;
min = c->min_width;
-
+
if( j != cols-1 )
{
pref += 2;
@@ -632,7 +632,7 @@ static int completion_try_print( int cols,
be helped, but it is not uncommon for the completions to
_almost_ fit on one screen. In those cases, it is almost
always desirable to 'squeeze' the completions into a
- single page.
+ single page.
If we are using N columns and can get everything to
fit using squeezing, but everything would also fit
@@ -668,7 +668,7 @@ static int completion_try_print( int cols,
is_ca_mode = 0;
writembs(exit_ca_mode);
}
-
+
completion_print( cols, width, 0, rows, prefix, is_quoted, l);
pager_flush();
}
@@ -687,7 +687,7 @@ static int completion_try_print( int cols,
is_ca_mode=1;
writembs(enter_ca_mode);
}
-
+
completion_print( cols,
width,
@@ -704,18 +704,18 @@ static int completion_try_print( int cols,
{
string_buffer_t msg;
sb_init( &msg );
-
+
set_color( FISH_COLOR_BLACK,
get_color(HIGHLIGHT_PAGER_PROGRESS) );
sb_printf( &msg,
_(L" %d to %d of %d"),
pos,
- pos+termsize.ws_row-1,
+ pos+termsize.ws_row-1,
rows );
-
+
sb_printf( &msg,
L" \r" );
-
+
writestr((wchar_t *)msg.buff);
sb_destroy( &msg );
set_color( FISH_COLOR_NORMAL, FISH_COLOR_NORMAL );
@@ -817,15 +817,15 @@ static int completion_try_print( int cols,
do_loop=0;
res=PAGER_RESIZE;
break;
-
+
}
-
+
default:
{
sb_append_char( &out_buff, c );
do_loop = 0;
break;
- }
+ }
}
}
writembs(clr_eol);
@@ -847,31 +847,31 @@ static void mangle_descriptions( array_list_t *l )
wchar_t *next = (wchar_t *)al_get(l, i);
wchar_t *in, *out;
skip=1;
-
+
while( *next != COMPLETE_SEP && *next )
next++;
-
+
if( !*next )
continue;
-
+
in=out=(next+1);
-
+
while( *in != 0 )
{
if( *in == L' ' || *in==L'\t' || *in<32 )
{
if( !skip )
*out++=L' ';
- skip=1;
+ skip=1;
}
else
{
- *out++ = *in;
+ *out++ = *in;
skip=0;
}
in++;
}
- *out=0;
+ *out=0;
}
}
@@ -883,7 +883,7 @@ static void join_completions( array_list_t *l )
long i;
int in, out;
hash_table_t desc_table;
-
+
hash_init( &desc_table, &hash_wcs_func, &hash_wcs_cmp );
for( i=0; icomp = al_halloc( global_context );
-
+
for( start=end=next; 1; end++ )
{
wchar_t c = *end;
-
+
if( (c == COMPLETE_ITEM_SEP) || (c==COMPLETE_SEP) || !c)
{
*end = 0;
wchar_t * str = escape( start, ESCAPE_ALL | ESCAPE_NO_QUOTED );
-
+
comp->comp_width += my_wcswidth( str );
halloc_register( global_context, str );
al_push( comp->comp, str );
@@ -973,22 +973,22 @@ static void mangle_completions( array_list_t *l, const wchar_t *prefix )
{
comp->desc = halloc_wcsdup( global_context, start );
break;
- }
-
+ }
+
if( !c )
break;
-
+
}
comp->comp_width += my_wcswidth(prefix)*al_get_count(comp->comp) + 2*(al_get_count(comp->comp)-1);
comp->desc_width = comp->desc?my_wcswidth( comp->desc ):0;
-
+
comp->pref_width = comp->comp_width + comp->desc_width + (comp->desc_width?4:0);
-
+
free( next );
al_set( l, i, comp );
}
-
+
recalc_width( l, prefix );
}
@@ -1026,10 +1026,10 @@ static void init( int mangle_descriptors, int out )
static struct termios pager_modes;
char *term;
-
+
if( mangle_descriptors )
{
-
+
/*
Make fd 1 output to screen, and use some other fd for writing
the resulting output back to the caller
@@ -1042,13 +1042,13 @@ static void init( int mangle_descriptors, int out )
if( (in = open( ttyname(2), O_RDWR )) != -1 )
{
if( dup2( 2, 1 ) == -1 )
- {
+ {
debug( 0, _(L"Could not set up output file descriptors for pager") );
exit( 1 );
}
-
+
if( dup2( in, 0 ) == -1 )
- {
+ {
debug( 0, _(L"Could not set up input file descriptors for pager") );
exit( 1 );
}
@@ -1059,13 +1059,13 @@ static void init( int mangle_descriptors, int out )
exit( 1 );
}
}
-
+
if( !(out_file = fdopen( out, "w" )) )
{
debug( 0, _(L"Could not initialize result pipe" ) );
exit( 1 );
}
-
+
/**
Init the stringbuffer used to keep any output in
@@ -1088,7 +1088,7 @@ static void init( int mangle_descriptors, int out )
wperror( L"sigaction" );
exit(1);
}
-
+
handle_winch( 0 ); /* Set handler for window change events */
tcgetattr(0,&pager_modes); /* get the current terminal modes */
@@ -1102,14 +1102,14 @@ static void init( int mangle_descriptors, int out )
pager_modes.c_cc[VTIME]=0;
/*
-
+
*/
if( tcsetattr(0,TCSANOW,&pager_modes)) /* set the new modes */
{
wperror(L"tcsetattr");
exit(1);
}
-
+
if( setupterm( 0, STDOUT_FILENO, 0) == ERR )
{
@@ -1124,7 +1124,7 @@ static void init( int mangle_descriptors, int out )
output_set_term( wterm );
free( wterm );
}
-
+
}
/**
@@ -1137,9 +1137,9 @@ static void destroy()
wutil_destroy();
if( del_curterm( cur_term ) == ERR )
{
- debug( 0, _(L"Error while closing terminfo") );
+ debug( 0, _(L"Error while closing terminfo") );
}
-
+
sb_destroy( &out_buff );
fclose( out_file );
}
@@ -1164,7 +1164,7 @@ static void read_array( FILE* file, array_list_t *comp )
while( 1 )
{
c = getc( file );
- if( c == EOF )
+ if( c == EOF )
{
break;
}
@@ -1175,7 +1175,7 @@ static void read_array( FILE* file, array_list_t *comp )
}
cc=c;
-
+
b_append( &buffer, &cc, 1 );
}
@@ -1183,15 +1183,15 @@ static void read_array( FILE* file, array_list_t *comp )
{
cc=0;
b_append( &buffer, &cc, 1 );
-
+
wcs = str2wcs( buffer.buff );
- if( wcs )
+ if( wcs )
{
unescaped = unescape( wcs, 0 );
if( unescaped )
{
al_push( comp, unescaped );
- }
+ }
free( wcs );
}
}
@@ -1203,9 +1203,9 @@ static void read_array( FILE* file, array_list_t *comp )
static int get_fd( const char *str )
{
- char *end;
+ char *end;
long fd;
-
+
errno = 0;
fd = strtol( str, &end, 10 );
if( fd < 0 || *end || errno )
@@ -1220,13 +1220,13 @@ static int get_fd( const char *str )
int main( int argc, char **argv )
{
int i;
- int is_quoted=0;
+ int is_quoted=0;
array_list_t *comp;
wchar_t *prefix = 0;
int mangle_descriptors = 0;
int result_fd = -1;
-
+
/*
This initialization is made early, so that the other init code
can use global_context for memory managment
@@ -1252,69 +1252,69 @@ int main( int argc, char **argv )
/*
Third mode
*/
-
+
int completion_fd = -1;
FILE *completion_file;
-
+
while( 1 )
{
static struct option
long_options[] =
{
{
- "result-fd", required_argument, 0, 'r'
+ "result-fd", required_argument, 0, 'r'
}
,
{
- "completion-fd", required_argument, 0, 'c'
+ "completion-fd", required_argument, 0, 'c'
}
,
{
- "prefix", required_argument, 0, 'p'
+ "prefix", required_argument, 0, 'p'
}
,
{
- "is-quoted", no_argument, 0, 'q'
+ "is-quoted", no_argument, 0, 'q'
}
,
{
- "help", no_argument, 0, 'h'
+ "help", no_argument, 0, 'h'
}
,
{
- "version", no_argument, 0, 'v'
+ "version", no_argument, 0, 'v'
}
,
- {
- 0, 0, 0, 0
+ {
+ 0, 0, 0, 0
}
}
;
-
+
int opt_index = 0;
-
+
int opt = getopt_long( argc,
- argv,
+ argv,
GETOPT_STRING,
- long_options,
+ long_options,
&opt_index );
-
+
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
{
break;
}
-
+
case 'r':
{
result_fd = get_fd( optarg );
break;
}
-
+
case 'c':
{
completion_fd = get_fd( optarg );
@@ -1330,20 +1330,20 @@ int main( int argc, char **argv )
case 'h':
{
print_help( argv[0], 1 );
- exit(0);
+ exit(0);
}
case 'v':
{
debug( 0, L"%ls, version %s\n", program_name, PACKAGE_VERSION );
- exit( 0 );
+ exit( 0 );
}
-
+
case 'q':
{
is_quoted = 1;
}
-
+
}
}
@@ -1352,7 +1352,7 @@ int main( int argc, char **argv )
debug( 0, _(L"Unspecified file descriptors") );
exit( 1 );
}
-
+
if( (completion_file = fdopen( completion_fd, "r" ) ) )
{
@@ -1370,8 +1370,8 @@ int main( int argc, char **argv )
{
prefix = wcsdup( L"" );
}
-
-
+
+
}
else
{
@@ -1385,7 +1385,7 @@ int main( int argc, char **argv )
forward. A reasonable time frame for removal of the code
below has yet to be determined.
*/
-
+
if( argc < 3 )
{
print_help( argv[0], 1 );
@@ -1394,10 +1394,10 @@ int main( int argc, char **argv )
else
{
mangle_descriptors = 1;
-
+
prefix = str2wcs( argv[2] );
is_quoted = strcmp( "1", argv[1] )==0;
-
+
if( argc > 3 )
{
/*
@@ -1420,11 +1420,11 @@ int main( int argc, char **argv )
read_array( stdin, comp );
}
}
-
+
}
-
+
// debug( 3, L"prefix is '%ls'", prefix );
-
+
init( mangle_descriptors, result_fd );
mangle_descriptions( comp );
@@ -1462,9 +1462,9 @@ int main( int argc, char **argv )
i=PAGER_MAX_COLS+1;
break;
- }
+ }
}
-
+
free(prefix );
fwprintf( out_file, L"%ls", (wchar_t *)out_buff.buff );
@@ -1476,6 +1476,6 @@ int main( int argc, char **argv )
destroy();
halloc_util_destroy();
-
+
}
diff --git a/fish_tests.c b/fish_tests.c
index 38e4eb105..a5c3d943a 100644
--- a/fish_tests.c
+++ b/fish_tests.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
#ifdef HAVE_GETOPT_H
#include
@@ -85,7 +85,7 @@ static void say( wchar_t *blah, ... )
va_list va;
va_start( va, blah );
vwprintf( blah, va );
- va_end( va );
+ va_end( va );
wprintf( L"\n" );
}
@@ -97,10 +97,10 @@ static void err( wchar_t *blah, ... )
va_list va;
va_start( va, blah );
err_count++;
-
+
wprintf( L"Error: " );
vwprintf( blah, va );
- va_end( va );
+ va_end( va );
wprintf( L"\n" );
}
@@ -119,13 +119,13 @@ static void pq_test( int elements )
{
int i;
int prev;
-
+
int *count = calloc( sizeof(int), 100 );
-
+
priority_queue_t q;
pq_init( &q, pq_compare );
-
+
for( i=0; i prev )
err( L"Wrong order of elements in priority_queue_t" );
prev = pos;
-
+
}
for( i=0; i<100; i++ )
@@ -163,10 +163,10 @@ static int stack_test( int elements )
long i;
int res=1;
-
+
array_list_t s;
- al_init( &s );
+ al_init( &s );
for( i=0; i&1 'nested \"quoted\" '(string containing subshells ){and,brackets}$as[$well (as variable arrays)]";
- const int types[] =
+ const int types[] =
{
TOK_STRING, TOK_REDIRECT_IN, TOK_STRING, TOK_REDIRECT_FD, TOK_STRING, TOK_STRING, TOK_END
}
;
int i;
-
+
say( L"Test correct tokenization" );
for( i=0, tok_init( &t, str, 0 ); i<(sizeof(types)/sizeof(int)); i++,tok_next( &t ) )
@@ -603,7 +603,7 @@ static void test_tok()
if( types[i] != tok_last_type( &t ) )
{
err( L"Tokenization error:");
- wprintf( L"Token number %d of string \n'%ls'\n, expected token type %ls, got token '%ls' of type %ls\n",
+ wprintf( L"Token number %d of string \n'%ls'\n, expected token type %ls, got token '%ls' of type %ls\n",
i+1,
str,
tok_get_desc(types[i]),
@@ -612,9 +612,9 @@ static void test_tok()
}
}
}
-
-
+
+
}
/**
@@ -623,8 +623,8 @@ static void test_tok()
static void test_parser()
{
say( L"Testing parser" );
-
-
+
+
say( L"Testing null input to parser" );
if( !parser_test( 0, 0, 0, 0 ) )
{
@@ -634,51 +634,51 @@ static void test_parser()
say( L"Testing block nesting" );
if( !parser_test( L"if; end", 0, 0, 0 ) )
{
- err( L"Incomplete if statement undetected" );
+ err( L"Incomplete if statement undetected" );
}
if( !parser_test( L"if test; echo", 0, 0, 0 ) )
{
- err( L"Missing end undetected" );
+ err( L"Missing end undetected" );
}
if( !parser_test( L"if test; end; end", 0, 0, 0 ) )
{
- err( L"Unbalanced end undetected" );
+ err( L"Unbalanced end undetected" );
}
say( L"Testing detection of invalid use of builtin commands" );
if( !parser_test( L"case foo", 0, 0, 0 ) )
{
- err( L"'case' command outside of block context undetected" );
+ err( L"'case' command outside of block context undetected" );
}
if( !parser_test( L"switch ggg; if true; case foo;end;end", 0, 0, 0 ) )
{
- err( L"'case' command outside of switch block context undetected" );
+ err( L"'case' command outside of switch block context undetected" );
}
if( !parser_test( L"else", 0, 0, 0 ) )
{
- err( L"'else' command outside of conditional block context undetected" );
+ err( L"'else' command outside of conditional block context undetected" );
}
if( !parser_test( L"break", 0, 0, 0 ) )
{
- err( L"'break' command outside of loop block context undetected" );
+ err( L"'break' command outside of loop block context undetected" );
}
if( !parser_test( L"exec ls|less", 0, 0, 0 ) || !parser_test( L"echo|return", 0, 0, 0 ))
{
- err( L"Invalid pipe command undetected" );
- }
+ err( L"Invalid pipe command undetected" );
+ }
say( L"Testing basic evaluation" );
if( !eval( 0, 0, TOP ) )
{
err( L"Null input when evaluating undetected" );
- }
+ }
if( !eval( L"ls", 0, WHILE ) )
{
err( L"Invalid block mode when evaluating undetected" );
}
-
+
}
-
+
/**
Perform parameter expansion and test if the output equals the zero-terminated parameter list supplied.
@@ -688,42 +688,42 @@ static void test_parser()
static int expand_test( const wchar_t *in, int flags, ... )
{
- array_list_t out;
+ array_list_t out;
va_list va;
int i=0;
int res=1;
wchar_t *arg;
-
+
al_init( &out );
if( expand_string( 0, wcsdup(in), &out, flags) )
{
-
+
}
-
-
+
+
va_start( va, flags );
- while( (arg=va_arg(va, wchar_t *) )!= 0 )
+ while( (arg=va_arg(va, wchar_t *) )!= 0 )
{
if( al_get_count( &out ) == i )
{
res=0;
break;
}
-
+
if( wcscmp( al_get( &out, i ),arg) != 0 )
{
res=0;
break;
}
-
- i++;
+
+ i++;
}
va_end( va );
-
+
al_foreach( &out, &free );
return res;
-
+
}
/**
@@ -732,7 +732,7 @@ static int expand_test( const wchar_t *in, int flags, ... )
static void test_expand()
{
say( L"Testing parameter expansion" );
-
+
if( !expand_test( L"foo", 0, L"foo", 0 ))
{
err( L"Strings do not expand to themselves" );
@@ -747,7 +747,7 @@ static void test_expand()
{
err( L"Cannot skip wildcard expansion" );
}
-
+
}
/**
@@ -758,17 +758,17 @@ static void test_path()
say( L"Testing path functions" );
void *context = halloc( 0, 0 );
-
+
wchar_t *can = path_make_canonical( context, L"//foo//////bar/" );
-
+
if( wcscmp( can, L"/foo/bar" ) )
{
err( L"Bug in canonical PATH code" );
}
-
+
halloc_free( context );
-
+
}
@@ -785,72 +785,72 @@ void perf_complete()
double t;
wchar_t str[3]=
{
- 0, 0, 0
+ 0, 0, 0
}
;
int i;
-
-
+
+
say( L"Testing completion performance" );
al_init( &out );
-
+
reader_push(L"");
say( L"Here we go" );
-
+
t1 = get_time();
-
-
+
+
for( c=L'a'; c<=L'z'; c++ )
{
str[0]=c;
reader_set_buffer( str, 0 );
-
+
complete( str, &out );
-
+
matches += al_get_count( &out );
-
+
al_foreach( &out, &free );
al_truncate( &out, 0 );
}
t2=get_time();
-
+
t = (double)(t2-t1)/(1000000*26);
-
+
say( L"One letter command completion took %f seconds per completion, %f microseconds/match", t, (double)(t2-t1)/matches );
-
+
matches=0;
t1 = get_time();
for( i=0; inext )
{
msg->count++;
q_put( &c->unsent, msg );
- }
-
+ }
+
for( c = conn; c; c=c->next )
{
try_send_all( c );
- }
+ }
}
/**
@@ -345,7 +345,7 @@ static void daemonize()
debug( 0, L"Could not put fishd in background. Quitting" );
wperror( L"fork" );
exit(1);
-
+
case 0:
{
/*
@@ -366,19 +366,19 @@ static void daemonize()
sigaction( SIGTERM, &act, 0);
break;
}
-
+
default:
- {
+ {
debug( 0, L"Parent process exiting (This is normal)" );
exit(0);
- }
+ }
}
-
+
/*
Put ourself in out own processing group
*/
setsid();
-
+
/*
Close stdin and stdout. We only use stderr, anyway.
*/
@@ -394,7 +394,7 @@ static wchar_t *fishd_env_get( wchar_t *key )
{
char *nres, *nkey;
wchar_t *res;
-
+
nkey = wcs2str( key );
nres = getenv( nkey );
free( nkey );
@@ -407,7 +407,7 @@ static wchar_t *fishd_env_get( wchar_t *key )
res = env_universal_common_get( key );
if( res )
res = wcsdup( res );
-
+
return env_universal_common_get( key );
}
}
@@ -423,7 +423,7 @@ static wchar_t *fishd_get_config()
wchar_t *xdg_dir, *home;
int done = 0;
wchar_t *res = 0;
-
+
xdg_dir = fishd_env_get( L"XDG_CONFIG_HOME" );
if( xdg_dir )
{
@@ -439,7 +439,7 @@ static wchar_t *fishd_get_config()
free( xdg_dir );
}
else
- {
+ {
home = fishd_env_get( L"HOME" );
if( home )
{
@@ -455,7 +455,7 @@ static wchar_t *fishd_get_config()
free( home );
}
}
-
+
if( done )
{
return res;
@@ -465,7 +465,7 @@ static wchar_t *fishd_get_config()
debug( 0, _(L"Unable to create a configuration directory for fish. Your personal settings will not be saved. Please set the $XDG_CONFIG_HOME variable to a directory where the current user has write access." ));
return 0;
}
-
+
}
/**
@@ -475,22 +475,22 @@ static void load_or_save( int save)
{
char *name;
wchar_t *wdir = fishd_get_config();
- char *dir;
+ char *dir;
char hostname[HOSTNAME_LEN];
connection_t c;
int fd;
-
+
if( !wdir )
{
return;
}
-
+
dir = wcs2str( wdir );
free( wdir );
-
+
gethostname( hostname, HOSTNAME_LEN );
-
+
name = malloc( strlen(dir)+ strlen(FILE)+ strlen(hostname) + 2 );
strcpy( name, dir );
strcat( name, "/" );
@@ -499,20 +499,20 @@ static void load_or_save( int save)
free( dir );
-
- debug( 4, L"Open file for %s: '%s'",
- save?"saving":"loading",
+
+ debug( 4, L"Open file for %s: '%s'",
+ save?"saving":"loading",
name );
-
+
fd = open( name, save?(O_CREAT | O_TRUNC | O_WRONLY):O_RDONLY, 0600);
-
+
free( name );
-
+
if( fd == -1 )
{
debug( 1, L"Could not open load/save file. No previous saves?" );
wperror( L"open" );
- return;
+ return;
}
debug( 4, L"File open on fd %d", c.fd );
@@ -520,14 +520,14 @@ static void load_or_save( int save)
if( save )
{
-
+
write_loop( c.fd, SAVE_MSG, strlen(SAVE_MSG) );
enqueue_all( &c );
}
else
read_message( &c );
- connection_destroy( &c );
+ connection_destroy( &c );
}
/**
@@ -553,10 +553,10 @@ static void init()
{
sock = get_socket();
- daemonize();
+ daemonize();
env_universal_common_init( &broadcast );
-
- load();
+
+ load();
}
/**
@@ -569,13 +569,13 @@ int main( int argc, char ** argv )
socklen_t t;
int max_fd;
int update_count=0;
-
+
fd_set read_fd, write_fd;
halloc_util_init();
-
+
program_name=L"fishd";
- wsetlocale( LC_ALL, L"" );
+ wsetlocale( LC_ALL, L"" );
/*
Parse options
@@ -586,57 +586,57 @@ int main( int argc, char ** argv )
long_options[] =
{
{
- "help", no_argument, 0, 'h'
+ "help", no_argument, 0, 'h'
}
,
{
- "version", no_argument, 0, 'v'
+ "version", no_argument, 0, 'v'
}
,
- {
- 0, 0, 0, 0
+ {
+ 0, 0, 0, 0
}
}
;
-
+
int opt_index = 0;
-
+
int opt = getopt_long( argc,
- argv,
+ argv,
GETOPT_STRING,
- long_options,
+ long_options,
&opt_index );
-
+
if( opt == -1 )
break;
-
+
switch( opt )
{
case 0:
- break;
+ break;
case 'h':
print_help( argv[0], 1 );
- exit(0);
-
+ exit(0);
+
case 'v':
debug( 0, L"%ls, version %s\n", program_name, PACKAGE_VERSION );
- exit( 0 );
-
+ exit( 0 );
+
case '?':
return 1;
-
- }
+
+ }
}
-
+
init();
- while(1)
+ while(1)
{
connection_t *c;
int res;
- t = sizeof( remote );
-
+ t = sizeof( remote );
+
FD_ZERO( &read_fd );
FD_ZERO( &write_fd );
FD_SET( sock, &read_fd );
@@ -645,7 +645,7 @@ int main( int argc, char ** argv )
{
FD_SET( c->fd, &read_fd );
max_fd = maxi( max_fd, c->fd+1);
-
+
if( ! q_empty( &c->unsent ) )
{
FD_SET( c->fd, &write_fd );
@@ -661,22 +661,22 @@ int main( int argc, char ** argv )
save();
exit(0);
}
-
+
if( res != -1 )
break;
-
+
if( errno != EINTR )
{
wperror( L"select" );
exit(1);
}
}
-
+
if( FD_ISSET( sock, &read_fd ) )
{
- if( (child_socket =
- accept( sock,
- (struct sockaddr *)&remote,
+ if( (child_socket =
+ accept( sock,
+ (struct sockaddr *)&remote,
&t) ) == -1) {
wperror( L"accept" );
exit(1);
@@ -688,20 +688,20 @@ int main( int argc, char ** argv )
if( fcntl( child_socket, F_SETFL, O_NONBLOCK ) != 0 )
{
wperror( L"fcntl" );
- close( child_socket );
+ close( child_socket );
}
else
{
connection_t *new = malloc( sizeof(connection_t));
- connection_init( new, child_socket );
+ connection_init( new, child_socket );
new->next = conn;
send( new->fd, GREETING, strlen(GREETING), MSG_DONTWAIT );
- enqueue_all( new );
+ enqueue_all( new );
conn=new;
}
}
}
-
+
for( c=conn; c; c=c->next )
{
if( FD_ISSET( c->fd, &write_fd ) )
@@ -709,7 +709,7 @@ int main( int argc, char ** argv )
try_send_all( c );
}
}
-
+
for( c=conn; c; c=c->next )
{
if( FD_ISSET( c->fd, &read_fd ) )
@@ -728,10 +728,10 @@ int main( int argc, char ** argv )
}
}
}
-
+
connection_t *prev=0;
c=conn;
-
+
while( c )
{
if( c->killme )
@@ -745,7 +745,7 @@ int main( int argc, char ** argv )
if( !msg->count )
free( msg );
}
-
+
connection_destroy( c );
if( prev )
{
@@ -755,11 +755,11 @@ int main( int argc, char ** argv )
{
conn=c->next;
}
-
+
free(c);
-
+
c=(prev?prev->next:conn);
-
+
}
else
{
@@ -771,10 +771,10 @@ int main( int argc, char ** argv )
if( !conn )
{
debug( 0, L"No more clients. Quitting" );
- save();
+ save();
env_universal_common_destroy();
break;
- }
+ }
}
halloc_util_destroy();
diff --git a/function.c b/function.c
index 246974dfc..576465a5d 100644
--- a/function.c
+++ b/function.c
@@ -43,7 +43,7 @@ typedef struct
/** Function definition */
wchar_t *definition;
/** Function description */
- wchar_t *description;
+ wchar_t *description;
/**
File where this function was defined
*/
@@ -51,14 +51,14 @@ typedef struct
/**
Line where definition started
*/
- int definition_offset;
-
+ int definition_offset;
+
/**
List of all named arguments for this function
*/
array_list_t *named_arguments;
-
-
+
+
/**
Flag for specifying that this function was automatically loaded
*/
@@ -96,8 +96,8 @@ static int load( const wchar_t *name )
data = (function_internal_data_t *)hash_get( &function, name );
if( data && !data->is_autoload )
return 0;
-
- is_autoload = 1;
+
+ is_autoload = 1;
res = parse_util_load( name,
L"fish_function_path",
&function_remove,
@@ -113,13 +113,13 @@ static int load( const wchar_t *name )
static void autoload_names( array_list_t *out, int get_hidden )
{
int i;
-
+
array_list_t path_list;
const wchar_t *path_var = env_get( L"fish_function_path" );
-
+
if( ! path_var )
return;
-
+
al_init( &path_list );
tokenize_variable_array( path_var, &path_list );
@@ -129,7 +129,7 @@ static void autoload_names( array_list_t *out, int get_hidden )
DIR *dir = wopendir( ndir );
if( !dir )
continue;
-
+
struct wdirent *next;
while( (next=wreaddir(dir))!=0 )
{
@@ -137,7 +137,7 @@ static void autoload_names( array_list_t *out, int get_hidden )
wchar_t *suffix;
if( !get_hidden && fn[0] == L'_' )
continue;
-
+
suffix = wcsrchr( fn, L'.' );
if( suffix && (wcscmp( suffix, L".fish" ) == 0 ) )
{
@@ -148,7 +148,7 @@ static void autoload_names( array_list_t *out, int get_hidden )
DIE_MEM();
al_push( out, dup );
}
- }
+ }
closedir(dir);
}
al_foreach( &path_list, &free );
@@ -182,12 +182,12 @@ void function_add( function_data_t *data )
int i;
wchar_t *cmd_end;
function_internal_data_t *d;
-
+
CHECK( data->name, );
CHECK( data->definition, );
-
+
function_remove( data->name );
-
+
d = halloc( 0, sizeof( function_internal_data_t ) );
d->definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos )-1;
d->definition = halloc_wcsdup( d, data->definition );
@@ -201,31 +201,68 @@ void function_add( function_data_t *data )
al_push( d->named_arguments, halloc_wcsdup( d, (wchar_t *)al_get( data->named_arguments, i ) ) );
}
}
-
+
cmd_end = d->definition + wcslen(d->definition)-1;
-
+
d->description = data->description?halloc_wcsdup( d, data->description ):0;
d->definition_file = intern(reader_current_filename());
d->is_autoload = is_autoload;
d->shadows = data->shadows;
-
+
hash_put( &function, intern(data->name), d );
-
+
for( i=0; ievents ); i++ )
{
event_add_handler( (event_t *)al_get( data->events, i ) );
}
-
+
}
+int function_copy( const wchar_t *name, const wchar_t *new_name )
+{
+ int i;
+ function_internal_data_t *d, *orig_d;
+
+ CHECK( name, 0 );
+ CHECK( new_name, 0 );
+
+ orig_d = (function_internal_data_t *)hash_get(&function, name);
+ if( !orig_d )
+ return 0;
+
+ d = halloc(0, sizeof( function_internal_data_t ) );
+ d->definition_offset = orig_d->definition_offset;
+ d->definition = halloc_wcsdup( d, orig_d->definition );
+ if( orig_d->named_arguments )
+ {
+ d->named_arguments = al_halloc( d );
+ for( i=0; inamed_arguments ); i++ )
+ {
+ al_push( d->named_arguments, halloc_wcsdup( d, (wchar_t *)al_get( orig_d->named_arguments, i ) ) );
+ }
+ d->description = orig_d->description?halloc_wcsdup(d, orig_d->description):0;
+ d->shadows = orig_d->shadows;
+
+ // This new instance of the function shouldn't be tied to the def
+ // file of the original.
+ d->definition_file = 0;
+ d->is_autoload = 0;
+ }
+
+ hash_put( &function, intern(new_name), d );
+
+ return 1;
+}
+
+
int function_exists( const wchar_t *cmd )
{
-
+
CHECK( cmd, 0 );
-
+
if( parser_keywords_is_reserved(cmd) )
return 0;
-
+
load( cmd );
return (hash_get(&function, cmd) != 0 );
}
@@ -236,7 +273,7 @@ void function_remove( const wchar_t *name )
void *dv;
function_internal_data_t *d;
event_t ev;
-
+
CHECK( name, );
hash_remove( &function,
@@ -245,12 +282,12 @@ void function_remove( const wchar_t *name )
&dv );
d=(function_internal_data_t *)dv;
-
+
if( !key )
return;
ev.type=EVENT_ANY;
- ev.function_name=name;
+ ev.function_name=name;
event_remove( &ev );
halloc_free( d );
@@ -265,13 +302,13 @@ void function_remove( const wchar_t *name )
parse_util_unload( name, L"fish_function_path", 0 );
}
}
-
+
const wchar_t *function_get_definition( const wchar_t *name )
{
function_internal_data_t *data;
-
+
CHECK( name, 0 );
-
+
load( name );
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
@@ -282,9 +319,9 @@ const wchar_t *function_get_definition( const wchar_t *name )
array_list_t *function_get_named_arguments( const wchar_t *name )
{
function_internal_data_t *data;
-
+
CHECK( name, 0 );
-
+
load( name );
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
@@ -295,9 +332,9 @@ array_list_t *function_get_named_arguments( const wchar_t *name )
int function_get_shadows( const wchar_t *name )
{
function_internal_data_t *data;
-
+
CHECK( name, 0 );
-
+
load( name );
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
@@ -305,28 +342,28 @@ int function_get_shadows( const wchar_t *name )
return data->shadows;
}
-
+
const wchar_t *function_get_desc( const wchar_t *name )
{
function_internal_data_t *data;
-
+
CHECK( name, 0 );
-
+
load( name );
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
return 0;
-
+
return _(data->description);
}
void function_set_desc( const wchar_t *name, const wchar_t *desc )
{
function_internal_data_t *data;
-
+
CHECK( name, );
CHECK( desc, );
-
+
load( name );
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
@@ -344,7 +381,7 @@ static int al_contains_str( array_list_t *list, const wchar_t * str )
CHECK( list, 0 );
CHECK( str, 0 );
-
+
for( i=0; idefinition_file;
}
@@ -420,11 +457,11 @@ int function_get_definition_offset( const wchar_t *name )
function_internal_data_t *data;
CHECK( name, -1 );
-
+
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
return -1;
-
+
return data->definition_offset;
}
diff --git a/function.h b/function.h
index 7e1729486..15c35afe7 100644
--- a/function.h
+++ b/function.h
@@ -1,4 +1,4 @@
-/** \file function.h
+/** \file function.h
Prototypes for functions for storing and retrieving function
information. These functions also take care of autoloading
@@ -53,7 +53,7 @@ typedef struct function_data
/**
- Initialize function data
+ Initialize function data
*/
void function_init();
@@ -96,11 +96,11 @@ int function_exists( const wchar_t *name );
/**
Insert all function names into l. These are not copies of the
strings and should not be freed after use.
-
+
\param list the list to add the names to
\param get_hidden whether to include hidden functions, i.e. ones starting with an underscore
*/
-void function_get_names( array_list_t *list,
+void function_get_names( array_list_t *list,
int get_hidden );
/**
@@ -131,4 +131,10 @@ array_list_t *function_get_named_arguments( const wchar_t *name );
*/
int function_get_shadows( const wchar_t *name );
+/**
+ Creates a new function using the same definition as the specified function.
+ Returns non-zero if copy is successful.
+*/
+int function_copy( const wchar_t *name, const wchar_t *new_name );
+
#endif
diff --git a/halloc.c b/halloc.c
index 15793990a..786e3059c 100644
--- a/halloc.c
+++ b/halloc.c
@@ -125,37 +125,37 @@ static void halloc_report()
{
if( getpid() == pid )
{
- debug( 1, L"%d parents, %d children with average child size of %.2f bytes caused %d allocs, average spill of %.2f bytes",
+ debug( 1, L"%d parents, %d children with average child size of %.2f bytes caused %d allocs, average spill of %.2f bytes",
parent_count, child_count, (double)child_size/child_count,
- parent_count+alloc_count, (double)alloc_spill/(parent_count+alloc_count) );
+ parent_count+alloc_count, (double)alloc_spill/(parent_count+alloc_count) );
}
}
#endif
void *halloc( void *context, size_t size )
-{
+{
halloc_t *me, *parent;
if( context )
{
char *res;
char *aligned;
-
+
#ifdef HALLOC_DEBUG
-
+
if( !child_count )
{
pid = getpid();
atexit( &halloc_report );
}
-
+
child_count++;
child_size += size;
-#endif
+#endif
parent = halloc_from_data( context );
/*
- Align memory address
+ Align memory address
*/
aligned = align_ptr( parent->scratch );
@@ -163,7 +163,7 @@ void *halloc( void *context, size_t size )
if( parent->scratch_free < 0 )
parent->scratch_free=0;
-
+
parent->scratch = aligned;
if( size <= parent->scratch_free )
@@ -177,8 +177,8 @@ void *halloc( void *context, size_t size )
#ifdef HALLOC_DEBUG
alloc_count++;
-#endif
-
+#endif
+
if( parent->scratch_free < HALLOC_SCRAP_SIZE )
{
#ifdef HALLOC_DEBUG
@@ -198,23 +198,23 @@ void *halloc( void *context, size_t size )
}
al_push_func( &parent->children, &late_free );
al_push( &parent->children, res );
-
+
}
return res;
-
+
}
else
{
me = (halloc_t *)calloc( 1, align_sz(sizeof(halloc_t)) + align_sz(size) + HALLOC_BLOCK_SIZE );
-
+
if( !me )
DIE_MEM();
#ifdef HALLOC_DEBUG
parent_count++;
-#endif
+#endif
me->scratch = ((char *)me) + align_sz(sizeof(halloc_t)) + align_sz(size);
me->scratch_free = HALLOC_BLOCK_SIZE;
-
+
al_init( &me->children );
return ((char *)me) + align_sz(sizeof(halloc_t));
}
@@ -225,7 +225,7 @@ void halloc_register_function( void *context, void (*func)(void *), void *data )
halloc_t *me;
if( !context )
return;
-
+
me = halloc_from_data( context );
al_push_func( &me->children, func );
al_push( &me->children, data );
@@ -235,11 +235,11 @@ void halloc_free( void *context )
{
halloc_t *me;
int i;
-
+
if( !context )
return;
-
+
me = halloc_from_data( context );
#ifdef HALLOC_DEBUG
diff --git a/halloc.h b/halloc.h
index 1cdf89c07..80dc9a482 100644
--- a/halloc.h
+++ b/halloc.h
@@ -1,4 +1,4 @@
-/** \file halloc.h
+/** \file halloc.h
A hierarchical memory allocation system. Works mostly like talloc
used in Samba, except that an arbitrary block allocated with
diff --git a/halloc_util.c b/halloc_util.c
index f195dca0b..e55b791cb 100644
--- a/halloc_util.c
+++ b/halloc_util.c
@@ -69,7 +69,7 @@ void *halloc_register( void *context, void *data )
{
if( !data )
return 0;
-
+
halloc_register_function( context, &free, data );
return data;
}
@@ -78,7 +78,7 @@ wchar_t *halloc_wcsdup( void *context, const wchar_t *in )
{
size_t len=wcslen(in);
wchar_t *out = halloc( context, sizeof( wchar_t)*(len+1));
-
+
if( out == 0 )
{
DIE_MEM();
@@ -95,6 +95,6 @@ wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c )
DIE_MEM();
}
wcslcpy( res, in, c+1 );
- res[c] = L'\0';
- return res;
+ res[c] = L'\0';
+ return res;
}
diff --git a/highlight.c b/highlight.c
index 625d8e50a..223fc082f 100644
--- a/highlight.c
+++ b/highlight.c
@@ -41,15 +41,15 @@
*/
#define VAR_COUNT ( sizeof(highlight_var)/sizeof(wchar_t *) )
-static void highlight_universal_internal( wchar_t * buff,
- int *color,
- int pos,
+static void highlight_universal_internal( wchar_t * buff,
+ int *color,
+ int pos,
array_list_t *error );
/**
The environment variables used to specify the color of different tokens.
*/
-static wchar_t *highlight_var[] =
+static wchar_t *highlight_var[] =
{
L"fish_color_normal",
L"fish_color_error",
@@ -68,7 +68,7 @@ static wchar_t *highlight_var[] =
;
/**
- Tests if the specified string is the prefix of any valid path in the system.
+ Tests if the specified string is the prefix of any valid path in the system.
\return zero it this is not a valid prefix, non-zero otherwise
*/
@@ -85,15 +85,15 @@ static int is_potential_path( const wchar_t *path )
if( tilde )
{
halloc_register( context, tilde );
-
+
unescaped = unescape( tilde, 1 );
if( unescaped )
{
-
+
// debug( 1, L"%ls -> %ls ->%ls", path, tilde, unescaped );
-
+
halloc_register( context, unescaped );
-
+
for( in = out = unescaped; *in; in++ )
{
switch( *in )
@@ -109,25 +109,25 @@ static int is_potential_path( const wchar_t *path )
case ANY_STRING_RECURSIVE:
{
has_magic = 1;
- break;
+ break;
}
-
+
case INTERNAL_SEPARATOR:
{
break;
}
-
+
default:
{
*(out++) = *in;
break;
}
-
+
}
-
+
}
*out = 0;
-
+
if( !has_magic && wcslen( unescaped ) )
{
int must_be_dir = 0;
@@ -146,10 +146,10 @@ static int is_potential_path( const wchar_t *path )
{
wchar_t *dir_name, *base;
struct wdirent *ent;
-
+
dir_name = wdirname( halloc_wcsdup(context, unescaped) );
- base = wbasename( halloc_wcsdup(context, unescaped) );
-
+ base = wbasename( halloc_wcsdup(context, unescaped) );
+
if( (wcscmp( dir_name, L"/" ) == 0 ) &&
(wcscmp( base, L"/" ) == 0 ) )
{
@@ -157,7 +157,7 @@ static int is_potential_path( const wchar_t *path )
}
else if( (dir = wopendir( dir_name )) )
{
-
+
while( (ent = wreaddir( dir )) )
{
if( wcsncmp( ent->d_name, base, wcslen(base) ) == 0 )
@@ -166,19 +166,19 @@ static int is_potential_path( const wchar_t *path )
break;
}
}
-
+
closedir( dir );
}
}
-
+
}
}
}
-
+
halloc_free( context );
-
+
return res;
-
+
}
@@ -188,7 +188,7 @@ int highlight_get_color( int highlight )
int i;
int idx=0;
int result = 0;
-
+
if( highlight < 0 )
return FISH_COLOR_NORMAL;
if( highlight >= (1< %d -> %ls", highlight, idx, val );
-
+// debug( 1, L"%d -> %d -> %ls", highlight, idx, val );
+
if( val == 0 )
val = env_get( highlight_var[0]);
-
+
if( val )
result = output_color_code( val );
-
+
if( highlight & HIGHLIGHT_VALID_PATH )
{
wchar_t *val2 = env_get( L"fish_color_valid_path" );
int result2 = output_color_code( val2 );
if( result == FISH_COLOR_NORMAL )
result = result2;
- else
+ else
{
if( result2 & FISH_COLOR_BOLD )
result |= FISH_COLOR_BOLD;
if( result2 & FISH_COLOR_UNDERLINE )
result |= FISH_COLOR_UNDERLINE;
}
-
+
}
return result;
-
+
}
/**
@@ -240,16 +240,16 @@ static void highlight_param( const wchar_t * buff,
int pos,
array_list_t *error )
{
-
-
- int mode = 0;
+
+
+ int mode = 0;
int in_pos, len = wcslen( buff );
int bracket_count=0;
wchar_t c;
int normal_status = *color;
-
+
for( in_pos=0;
- in_pos= 0 && pos <= len )
{
-
+
wchar_t *tok_begin, *tok_end;
wchar_t *token;
-
+
parse_util_token_extent( buff, pos, &tok_begin, &tok_end, 0, 0 );
if( tok_begin && tok_end )
{
token = halloc_wcsndup( context, tok_begin, tok_end-tok_begin );
-
+
if( is_potential_path( token ) )
{
for( i=tok_begin-buff; i < (tok_end-buff); i++ )
@@ -993,7 +993,7 @@ void highlight_shell( wchar_t * buff,
}
}
}
-
+
highlight_universal_internal( buff, color, pos, error );
@@ -1009,21 +1009,21 @@ void highlight_shell( wchar_t * buff,
}
halloc_free( context );
-
+
}
/**
Perform quote and parenthesis highlighting on the specified string.
*/
-static void highlight_universal_internal( wchar_t * buff,
- int *color,
- int pos,
+static void highlight_universal_internal( wchar_t * buff,
+ int *color,
+ int pos,
array_list_t *error )
{
-
+
if( (pos >= 0) && (pos < wcslen(buff)) )
{
-
+
/*
Highlight matching quotes
*/
@@ -1032,14 +1032,14 @@ static void highlight_universal_internal( wchar_t * buff,
array_list_t l;
al_init( &l );
-
+
int level=0;
wchar_t prev_q=0;
-
+
wchar_t *str=buff;
int match_found=0;
-
+
while(*str)
{
switch( *str )
@@ -1060,7 +1060,7 @@ static void highlight_universal_internal( wchar_t * buff,
if( prev_q == *str )
{
long pos1, pos2;
-
+
level--;
pos1 = al_pop_long( &l );
pos2 = str-buff;
@@ -1069,7 +1069,7 @@ static void highlight_universal_internal( wchar_t * buff,
color[pos1]|=HIGHLIGHT_MATCH<<16;
color[pos2]|=HIGHLIGHT_MATCH<<16;
match_found = 1;
-
+
}
prev_q = *str==L'\"'?L'\'':L'\"';
}
@@ -1080,7 +1080,7 @@ static void highlight_universal_internal( wchar_t * buff,
prev_q = *str;
}
}
-
+
break;
}
if( (*str == L'\0'))
@@ -1090,7 +1090,7 @@ static void highlight_universal_internal( wchar_t * buff,
}
al_destroy( &l );
-
+
if( !match_found )
color[pos] = HIGHLIGHT_ERROR<<16;
}
@@ -1105,7 +1105,7 @@ static void highlight_universal_internal( wchar_t * buff,
wchar_t inc_char = buff[pos];
int level = 0;
wchar_t *str = &buff[pos];
- int match_found=0;
+ int match_found=0;
while( (str >= buff) && *str)
{
@@ -1123,22 +1123,22 @@ static void highlight_universal_internal( wchar_t * buff,
}
str+= step;
}
-
+
if( !match_found )
color[pos] = HIGHLIGHT_ERROR<<16;
}
}
}
-void highlight_universal( wchar_t * buff,
- int *color,
- int pos,
+void highlight_universal( wchar_t * buff,
+ int *color,
+ int pos,
array_list_t *error )
{
int i;
-
+
for( i=0; buff[i]; i++ )
color[i] = 0;
-
+
highlight_universal_internal( buff, color, pos, error );
}
diff --git a/highlight.h b/highlight.h
index eefd3c3b0..5484b4eaa 100644
--- a/highlight.h
+++ b/highlight.h
@@ -56,7 +56,7 @@
/**
Internal value representing highlighting of an IO redirection
*/
-#define HIGHLIGHT_REDIRECTION 0x800
+#define HIGHLIGHT_REDIRECTION 0x800
/**
Internal value representing highlighting a potentially valid path
*/
@@ -68,7 +68,7 @@
for each character in buff.
\param buff The buffer on which to perform syntax highlighting
- \param color The array in wchich to store the color codes. The first 8 bits are used for fg color, the next 8 bits for bg color.
+ \param color The array in wchich to store the color codes. The first 8 bits are used for fg color, the next 8 bits for bg color.
\param pos the cursor position. Used for quote matching, etc.
\param error a list in which a description of each error will be inserted. May be 0, in whcich case no error descriptions will be generated.
*/
@@ -80,7 +80,7 @@ void highlight_shell( wchar_t * buff, int *color, int pos, array_list_t *error )
for each character in buff.
\param buff The buffer on which to perform syntax highlighting
- \param color The array in wchich to store the color codes. The first 8 bits are used for fg color, the next 8 bits for bg color.
+ \param color The array in wchich to store the color codes. The first 8 bits are used for fg color, the next 8 bits for bg color.
\param pos the cursor position. Used for quote matching, etc.
\param error a list in which a description of each error will be inserted. May be 0, in whcich case no error descriptions will be generated.
*/
@@ -90,7 +90,7 @@ void highlight_universal( wchar_t * buff, int *color, int pos, array_list_t *err
Translate from HIGHLIGHT_* to FISH_COLOR_* according to environment
variables. Defaults to FISH_COLOR_NORMAL.
- Example:
+ Example:
If the environment variable FISH_FISH_COLOR_ERROR is set to 'red', a
call to highlight_get_color( HIGHLIGHT_ERROR) will return
diff --git a/history.c b/history.c
index 4a85ce7e0..c02fe4dde 100644
--- a/history.c
+++ b/history.c
@@ -43,13 +43,13 @@
/**
A struct representiong a history list
*/
-typedef struct
+typedef struct
{
/**
The name of this list. Used for picking a suitable filename and for switching modes.
*/
const wchar_t *name;
-
+
/**
The items of the list. Each entry may be either a pointer to an
item_t struct or a pointer to an mmaped memory region where a
@@ -66,12 +66,12 @@ typedef struct
this session.
*/
hash_table_t session_item;
-
+
/**
The current history position
*/
int pos;
-
+
/**
This flag is set nonzero if the file containing earlier saves has ben mmaped in
*/
@@ -91,7 +91,7 @@ typedef struct
A list of indices of all previous search maches. This is used to eliminate duplicate search results.
*/
array_list_t used;
-
+
/**
Timestamp of last save
*/
@@ -114,13 +114,13 @@ typedef struct
/**
This struct represents a history item
*/
-typedef struct
+typedef struct
{
/**
The actual contents of the entry
*/
wchar_t *data;
-
+
/**
Original creation time for the entry
*/
@@ -154,7 +154,7 @@ static int hash_item_cmp( void *v1, void *v2 )
{
item_t *i1 = (item_t *)v1;
item_t *i2 = (item_t *)v2;
- return (i1->timestamp == i2->timestamp) && (wcscmp( i1->data, i2->data )==0);
+ return (i1->timestamp == i2->timestamp) && (wcscmp( i1->data, i2->data )==0);
}
/**
@@ -198,7 +198,7 @@ static wchar_t *history_escape_newlines( wchar_t *in )
*/
sb_append_char( out, L'\n' );
}
-
+
}
else if( *in == L'\n' )
{
@@ -209,7 +209,7 @@ static wchar_t *history_escape_newlines( wchar_t *in )
{
sb_append_char( out, *in );
}
-
+
}
return (wchar_t *)out->buff;
}
@@ -256,14 +256,14 @@ static wchar_t *history_unescape_newlines( wchar_t *in )
Check if the specified item is already loaded
*/
static int item_is_new( history_mode_t *m, void *d )
-{
+{
char *begin = (char *)d;
if( !m->has_loaded || !m->mmap_start || (m->mmap_start == MAP_FAILED ) )
{
- return 1;
+ return 1;
}
-
+
if( (begin < m->mmap_start) || (begin > (m->mmap_start+m->mmap_length) ) )
{
return 1;
@@ -277,7 +277,7 @@ static int item_is_new( history_mode_t *m, void *d )
Later calls to this function may erase the output of a previous call to this function.
*/
static item_t *item_get( history_mode_t *m, void *d )
-{
+{
char *begin = (char *)d;
if( item_is_new( m, d ) )
@@ -286,18 +286,18 @@ static item_t *item_get( history_mode_t *m, void *d )
}
else
{
-
+
char *end = m->mmap_start + m->mmap_length;
char *pos=begin;
-
- int was_backslash = 0;
+
+ int was_backslash = 0;
static string_buffer_t *out = 0;
static item_t narrow_item;
- int first_char = 1;
+ int first_char = 1;
int timestamp_mode = 0;
narrow_item.timestamp = 0;
-
+
if( !out )
{
out = sb_halloc( global_context );
@@ -310,17 +310,17 @@ static item_t *item_get( history_mode_t *m, void *d )
{
sb_clear( out );
}
-
+
while( 1 )
{
wchar_t c;
mbstate_t state;
size_t res;
-
+
memset( &state, 0, sizeof(state) );
-
+
res = mbrtowc( &c, pos, end-pos, &state );
-
+
if( res == (size_t)-1 )
{
pos++;
@@ -336,7 +336,7 @@ static item_t *item_get( history_mode_t *m, void *d )
continue;
}
pos += res;
-
+
if( c == L'\n' )
{
if( timestamp_mode )
@@ -345,21 +345,21 @@ static item_t *item_get( history_mode_t *m, void *d )
while( *time_string && !iswdigit(*time_string))
time_string++;
errno=0;
-
+
if( *time_string )
{
time_t tm;
wchar_t *end;
-
+
errno = 0;
tm = (time_t)wcstol( time_string, &end, 10 );
-
+
if( tm && !errno && !*end )
{
narrow_item.timestamp = tm;
}
- }
+ }
sb_clear( out );
timestamp_mode = 0;
@@ -368,21 +368,21 @@ static item_t *item_get( history_mode_t *m, void *d )
if( !was_backslash )
break;
}
-
+
if( first_char )
{
- if( c == L'#' )
+ if( c == L'#' )
timestamp_mode = 1;
}
-
+
first_char = 0;
-
+
sb_append_char( out, c );
-
+
was_backslash = ( (c == L'\\') && !was_backslash);
-
+
}
-
+
narrow_item.data = history_unescape_newlines((wchar_t *)out->buff);
return &narrow_item;
}
@@ -404,12 +404,12 @@ static int item_write( FILE *f, history_mode_t *m, void *v )
static void history_destroy_mode( history_mode_t *m )
{
halloc_free( m->item_context );
-
+
if( m->mmap_start && (m->mmap_start != MAP_FAILED ))
{
munmap( m->mmap_start, m->mmap_length);
- }
-
+ }
+
}
/**
@@ -421,11 +421,11 @@ static void history_destroy_mode_wrapper( void *n, history_mode_t *m )
}
/**
- Create a new empty mode with the specified name.
+ Create a new empty mode with the specified name.
The mode is a halloc context, and the entire mode can be destroyed using halloc_free().
*/
static history_mode_t *history_create_mode( const wchar_t *name )
-{
+{
history_mode_t *new_mode = halloc( 0, sizeof( history_mode_t ));
new_mode->name = intern(name);
@@ -434,16 +434,16 @@ static history_mode_t *history_create_mode( const wchar_t *name )
al_init( &new_mode->used );
halloc_register_function( new_mode, (void (*)(void *))&al_destroy, &new_mode->item );
halloc_register_function( new_mode, (void (*)(void *))&al_destroy, &new_mode->used );
-
+
hash_init( &new_mode->session_item, &hash_item_func, &hash_item_cmp );
halloc_register_function( new_mode, (void (*)(void *))&hash_destroy, &new_mode->session_item );
-
+
new_mode->save_timestamp=time(0);
new_mode->item_context = halloc( 0,0 );
halloc_register_function( new_mode, (void (*)(void *))&history_destroy_mode, new_mode );
- return new_mode;
+ return new_mode;
}
/**
@@ -464,16 +464,16 @@ static int history_test( const wchar_t *needle, const wchar_t *haystack )
static wchar_t *history_filename( void *context, const wchar_t *name, const wchar_t *suffix )
{
wchar_t *path;
- wchar_t *res;
+ wchar_t *res;
if( !current_mode )
return 0;
-
+
path = path_get_config( context );
if( !path )
return 0;
-
+
res = wcsdupcat( path, L"/", name, L"_history", suffix?suffix:(void *)0);
halloc_register_function( context, &free, res );
return res;
@@ -483,24 +483,24 @@ static wchar_t *history_filename( void *context, const wchar_t *name, const wcha
Go through the mmaped region and insert pointers to suitable loacations into the item list
*/
static void history_populate_from_mmap( history_mode_t *m )
-{
+{
char *begin = m->mmap_start;
char *end = begin + m->mmap_length;
char *pos;
-
+
array_list_t old_item;
array_list_t session_item_list;
int ignore_newline = 0;
int do_push = 1;
-
+
al_init( &old_item );
al_init( &session_item_list );
al_push_all( &old_item, &m->item );
al_truncate( &m->item, 0 );
-
+
for( pos = begin; pos session_item, i ) ) )
{
/*
This item comes from this session. Insert the
original item at the end of the item list.
*/
- al_push( &session_item_list, i_orig );
+ al_push( &session_item_list, i_orig );
}
else
{
@@ -525,10 +525,10 @@ static void history_populate_from_mmap( history_mode_t *m )
*/
al_push( &m->item, pos );
}
-
+
do_push = 0;
}
-
+
switch( *pos )
{
case '\\':
@@ -536,7 +536,7 @@ static void history_populate_from_mmap( history_mode_t *m )
pos++;
break;
}
-
+
case '\n':
{
if( ignore_newline )
@@ -546,12 +546,12 @@ static void history_populate_from_mmap( history_mode_t *m )
else
{
do_push = 1;
- }
+ }
break;
}
}
- }
-
+ }
+
al_push_all( &m->item, &session_item_list );
m->pos += al_get_count( &m->item );
al_push_all( &m->item, &old_item );
@@ -568,20 +568,20 @@ static void history_load( history_mode_t *m )
{
int fd;
int ok=0;
-
+
void *context;
wchar_t *filename;
if( !m )
- return;
-
+ return;
+
m->has_loaded=1;
signal_block();
context = halloc( 0, 0 );
filename = history_filename( context, m->name, 0 );
-
+
if( filename )
{
if( ( fd = wopen( filename, O_RDONLY ) ) > 0 )
@@ -602,7 +602,7 @@ static void history_load( history_mode_t *m )
close( fd );
}
}
-
+
halloc_free( context );
signal_unblock();
}
@@ -633,12 +633,12 @@ static void history_save_mode( void *n, history_mode_t *m )
break;
}
}
-
+
if( !has_new )
{
return;
}
-
+
signal_block();
/*
@@ -647,19 +647,19 @@ static void history_save_mode( void *n, history_mode_t *m )
*/
on_disk = history_create_mode( m->name );
history_load( on_disk );
-
+
tmp_name = history_filename( on_disk, m->name, L".tmp" );
if( tmp_name )
{
tmp_name = wcsdup(tmp_name );
-
+
if( (out=wfopen( tmp_name, "w" ) ) )
{
hash_table_t mine;
-
+
hash_init( &mine, &hash_item_func, &hash_item_cmp );
-
+
for( i=0; iitem); i++ )
{
void *ptr = al_get( &m->item, i );
@@ -669,7 +669,7 @@ static void history_save_mode( void *n, history_mode_t *m )
hash_put( &mine, item_get( m, ptr ), L"" );
}
}
-
+
/*
Re-save the old history
*/
@@ -685,14 +685,14 @@ static void history_save_mode( void *n, history_mode_t *m )
break;
}
}
-
+
}
-
+
hash_destroy( &mine );
-
+
/*
Add our own items last
- */
+ */
for( i=0; ok && (iitem)); i++ )
{
void *ptr = al_get( &m->item, i );
@@ -700,12 +700,12 @@ static void history_save_mode( void *n, history_mode_t *m )
if( is_new )
{
if( item_write( out, m, ptr ) == -1 )
- {
+ {
ok = 0;
}
}
}
-
+
if( fclose( out ) || !ok )
{
/*
@@ -720,8 +720,8 @@ static void history_save_mode( void *n, history_mode_t *m )
}
}
free( tmp_name );
- }
-
+ }
+
halloc_free( on_disk);
if( ok )
@@ -733,23 +733,23 @@ static void history_save_mode( void *n, history_mode_t *m )
hash table. On reload, they will be automatically inserted at
the end of the history list.
*/
-
+
if( m->mmap_start && (m->mmap_start != MAP_FAILED ) )
{
munmap( m->mmap_start, m->mmap_length );
}
-
+
al_truncate( &m->item, 0 );
al_truncate( &m->used, 0 );
m->pos = 0;
m->has_loaded = 0;
m->mmap_start=0;
m->mmap_length=0;
-
+
m->save_timestamp=time(0);
m->new_count = 0;
}
-
+
signal_unblock();
}
@@ -757,27 +757,27 @@ static void history_save_mode( void *n, history_mode_t *m )
void history_add( const wchar_t *str )
{
item_t *i;
-
+
if( !current_mode )
return;
-
+
i = halloc( current_mode->item_context, sizeof(item_t));
i->data = (wchar_t *)halloc_wcsdup( current_mode->item_context, str );
i->timestamp = time(0);
-
+
al_push( ¤t_mode->item, i );
hash_put( ¤t_mode->session_item, i, i );
-
+
al_truncate( ¤t_mode->used, 0 );
current_mode->pos = al_get_count( ¤t_mode->item );
current_mode->new_count++;
-
+
if( (time(0) > current_mode->save_timestamp+SAVE_INTERVAL) || (current_mode->new_count >= SAVE_COUNT) )
{
history_save_mode( 0, current_mode );
}
-
+
}
/**
@@ -796,9 +796,9 @@ static int history_is_used( const wchar_t *str )
if( wcscmp( it->data, str ) == 0 )
{
res = 1;
- break;
+ break;
}
-
+
}
return res;
}
@@ -813,11 +813,11 @@ const wchar_t *history_prev_match( const wchar_t *needle )
{
item_t *i = item_get( current_mode, al_get( ¤t_mode->item, current_mode->pos ) );
wchar_t *haystack = (wchar_t *)i->data;
-
+
if( history_test( needle, haystack ) )
{
int is_used;
-
+
/*
This is ugly. Whenever we call item_get(),
there is a chance that the return value of any
@@ -829,11 +829,11 @@ const wchar_t *history_prev_match( const wchar_t *needle )
*/
haystack = wcsdup(haystack );
-
+
is_used = history_is_used( haystack );
-
+
free( haystack );
-
+
if( !is_used )
{
i = item_get( current_mode, al_get( ¤t_mode->item, current_mode->pos ) );
@@ -843,7 +843,7 @@ const wchar_t *history_prev_match( const wchar_t *needle )
}
}
}
-
+
if( !current_mode->has_loaded )
{
/*
@@ -864,9 +864,9 @@ const wchar_t *history_prev_match( const wchar_t *needle )
if( al_peek_long( ¤t_mode->used ) != -1 )
al_push_long( ¤t_mode->used, -1 );
}
-
+
}
-
+
return needle;
}
@@ -877,7 +877,7 @@ wchar_t *history_get( int idx )
if( !current_mode )
return 0;
-
+
len = al_get_count( ¤t_mode->item );
if( (idx >= len ) && !current_mode->has_loaded )
@@ -885,13 +885,13 @@ wchar_t *history_get( int idx )
history_load( current_mode );
len = al_get_count( ¤t_mode->item );
}
-
+
if( idx < 0 )
return 0;
-
+
if( idx >= len )
return 0;
-
+
return item_get( current_mode, al_get( ¤t_mode->item, len - 1 - idx ) )->data;
}
@@ -903,9 +903,9 @@ void history_first()
{
history_load( current_mode );
}
-
+
current_mode->pos = 0;
- }
+ }
}
void history_reset()
@@ -917,7 +917,7 @@ void history_reset()
Clear list of search matches
*/
al_truncate( ¤t_mode->used, 0 );
- }
+ }
}
const wchar_t *history_next_match( const wchar_t *needle)
@@ -939,7 +939,7 @@ const wchar_t *history_next_match( const wchar_t *needle)
return i->data;
}
}
-
+
/*
The used-list is empty. Set position to 'past end of list'
and return the search string.
@@ -947,7 +947,7 @@ const wchar_t *history_next_match( const wchar_t *needle)
current_mode->pos = al_get_count( ¤t_mode->item );
}
- return needle;
+ return needle;
}
@@ -956,16 +956,16 @@ void history_set_mode( const wchar_t *name )
if( !mode_table )
{
mode_table = malloc( sizeof(hash_table_t ));
- hash_init( mode_table, &hash_wcs_func, &hash_wcs_cmp );
+ hash_init( mode_table, &hash_wcs_func, &hash_wcs_cmp );
}
-
+
current_mode = (history_mode_t *)hash_get( mode_table, name );
-
+
if( !current_mode )
{
current_mode = history_create_mode( name );
- hash_put( mode_table, name, current_mode );
- }
+ hash_put( mode_table, name, current_mode );
+ }
}
void history_init()
diff --git a/history.h b/history.h
index 9c54cda13..f3a7dc291 100644
--- a/history.h
+++ b/history.h
@@ -50,7 +50,7 @@ void history_reset();
/**
Find next history item starting with str. If this moves past
- the end of the history, str is returned.
+ the end of the history, str is returned.
*/
const wchar_t *history_next_match( const wchar_t *str);
diff --git a/input.c b/input.c
index 985240ca3..b0ebc0c67 100644
--- a/input.c
+++ b/input.c
@@ -88,7 +88,7 @@ typedef struct
{
const wchar_t *seq; /**< Character sequence which generates this event */
const wchar_t *command; /**< command that should be evaluated by this mapping */
-
+
}
input_mapping_t;
@@ -99,7 +99,7 @@ typedef struct
{
const wchar_t *name; /**< Name of key */
const char *seq; /**< Character sequence generated on keypress */
-
+
}
terminfo_mapping_t;
@@ -107,7 +107,7 @@ typedef struct
/**
Names of all the input functions supported
*/
-static const wchar_t *name_arr[] =
+static const wchar_t *name_arr[] =
{
L"beginning-of-line",
L"end-of-line",
@@ -188,7 +188,7 @@ static const wchar_t *desc_arr[] =
/**
Internal code for each supported input function
*/
-static const wchar_t code_arr[] =
+static const wchar_t code_arr[] =
{
R_BEGINNING_OF_LINE,
R_END_OF_LINE,
@@ -230,7 +230,7 @@ static const wchar_t code_arr[] =
/**
Mappings for the current input mode
*/
-static array_list_t mappings = {0,0,0};
+static array_list_t mappings = {0,0,0};
/**
List of all terminfo mappings
@@ -239,7 +239,7 @@ static array_list_t *terminfo_mappings = 0;
/**
- Set to one when the input subsytem has been initialized.
+ Set to one when the input subsytem has been initialized.
*/
static int is_init = 0;
@@ -263,9 +263,9 @@ void input_mapping_add( const wchar_t *sequence,
CHECK( sequence, );
CHECK( command, );
-
+
// debug( 0, L"Add mapping from %ls to %ls", escape(sequence, 1), escape(command, 1 ) );
-
+
for( i=0; iseq = intern( sequence );
m->command = intern(command);
- al_push( &mappings, m );
-
+ al_push( &mappings, m );
+
}
/**
@@ -293,14 +293,14 @@ static int interrupt_handler()
/*
Fire any pending events
*/
- event_fire( 0 );
-
+ event_fire( NULL );
+
/*
Reap stray processes, including printing exit status messages
*/
if( job_reap( 1 ) )
reader_repaint_needed();
-
+
/*
Tell the reader an event occured
*/
@@ -312,14 +312,14 @@ static int interrupt_handler()
return 3;
}
- return R_NULL;
+ return R_NULL;
}
int input_init()
{
if( is_init )
return 1;
-
+
is_init = 1;
input_common_init( &interrupt_handler );
@@ -330,7 +330,7 @@ int input_init()
exit(1);
}
output_set_term( env_get( L"TERM" ) );
-
+
input_terminfo_init();
/*
@@ -353,22 +353,22 @@ void input_destroy()
{
if( !is_init )
return;
-
+
is_init=0;
-
- al_foreach( &mappings, &free );
+
+ al_foreach( &mappings, &free );
al_destroy( &mappings );
input_common_destroy();
-
+
if( del_curterm( cur_term ) == ERR )
{
debug( 0, _(L"Error while closing terminfo") );
}
input_terminfo_destroy();
-
+
}
/**
@@ -378,7 +378,7 @@ static wint_t input_exec_binding( input_mapping_t *m, const wchar_t *seq )
{
wchar_t code = input_function_get_code( m->command );
if( code != -1 )
- {
+ {
switch( code )
{
@@ -386,37 +386,37 @@ static wint_t input_exec_binding( input_mapping_t *m, const wchar_t *seq )
{
return seq[0];
}
-
+
default:
{
return code;
}
-
+
}
}
else
{
-
+
/*
This key sequence is bound to a command, which
is sent to the parser for evaluation.
*/
int last_status = proc_get_last_status();
-
+
eval( m->command, 0, TOP );
-
+
proc_set_last_status( last_status );
-
+
/*
We still need to return something to the caller, R_NULL
- tells the reader that no key press needs to be handled,
+ tells the reader that no key press needs to be handled,
and no repaint is needed.
Bindings that produce output should emit a R_REPAINT
function by calling 'commandline -f repaint' to tell
- fish that a repaint is in order.
+ fish that a repaint is in order.
*/
-
+
return R_NULL;
}
@@ -441,14 +441,14 @@ static wint_t input_try_mapping( input_mapping_t *m)
return input_exec_binding( m, m->seq );
}
input_unreadch( c );
-
+
if( m->seq != 0 )
{
- for( j=0; m->seq[j] != L'\0' &&
+ for( j=0; m->seq[j] != L'\0' &&
m->seq[j] == (c=input_common_readch( j>0 )); j++ )
;
-
+
if( m->seq[j] == L'\0' )
{
return input_exec_binding( m, m->seq );
@@ -466,7 +466,7 @@ static wint_t input_try_mapping( input_mapping_t *m)
}
}
return 0;
-
+
}
void input_unreadch( wint_t ch )
@@ -476,16 +476,16 @@ void input_unreadch( wint_t ch )
wint_t input_readch()
{
-
+
int i;
CHECK_BLOCK( R_NULL );
-
+
/*
Clear the interrupted flag
*/
reader_interrupted();
-
+
/*
Search for sequence in mapping tables
*/
@@ -496,51 +496,51 @@ wint_t input_readch()
for( i=0; iseq) == 0 )
{
generic = m;
}
-
+
}
-
+
/*
No matching exact mapping, try to find generic mapping.
*/
if( generic )
- {
+ {
wchar_t arr[2]=
{
- 0,
+ 0,
0
}
;
arr[0] = input_common_readch(0);
-
- return input_exec_binding( generic, arr );
+
+ return input_exec_binding( generic, arr );
}
-
+
/*
No action to take on specified character, ignore it
and move to next one.
*/
- input_common_readch( 0 ); }
+ input_common_readch( 0 ); }
}
void input_mapping_get_names( array_list_t *list )
{
int i;
-
+
for( i=0; iseq );
}
-
+
}
@@ -549,7 +549,7 @@ int input_mapping_erase( const wchar_t *sequence )
int ok = 0;
int i;
size_t sz = al_get_count( &mappings );
-
+
for( i=0; iname ) )
{
res = m->seq;
@@ -786,71 +786,71 @@ const wchar_t *input_terminfo_get_sequence( const wchar_t *name )
break;
}
}
-
+
if( !res )
{
errno = err;
return 0;
}
-
+
if( !buff )
{
buff = sb_halloc( global_context );
}
-
+
sb_clear( buff );
sb_printf( buff, L"%s", res );
return (wchar_t *)buff->buff;
-
+
}
const wchar_t *input_terminfo_get_name( const wchar_t *seq )
{
- int i;
+ int i;
static string_buffer_t *buff = 0;
CHECK( seq, 0 );
input_init();
-
+
if( !buff )
{
buff = sb_halloc( global_context );
}
-
+
for( i=0; iseq )
{
continue;
}
-
+
sb_clear( buff );
sb_printf( buff, L"%s", m->seq );
-
+
if( !wcscmp( seq, (wchar_t *)buff->buff ) )
{
return m->name;
}
}
-
+
return 0;
-
+
}
void input_terminfo_get_names( array_list_t *lst, int skip_null )
{
- int i;
+ int i;
CHECK( lst, );
input_init();
-
+
for( i=0; iseq )
{
continue;
@@ -861,10 +861,10 @@ void input_terminfo_get_names( array_list_t *lst, int skip_null )
void input_function_get_names( array_list_t *lst )
{
- int i;
+ int i;
CHECK( lst, );
-
+
for( i=0; i<(sizeof(name_arr)/sizeof(wchar_t *)); i++ )
{
al_push( lst, name_arr[i] );
@@ -882,6 +882,6 @@ wchar_t input_function_get_code( const wchar_t *name )
return code_arr[i];
}
}
- return -1;
+ return -1;
}
diff --git a/input.h b/input.h
index cd275674f..e37108d5d 100644
--- a/input.h
+++ b/input.h
@@ -83,7 +83,7 @@ wint_t input_readch();
/**
Push a character or a readline function onto the stack of unread
characters that input_readch will return before actually reading from fd
- 0.
+ 0.
*/
void input_unreadch( wint_t ch );
diff --git a/input_common.c b/input_common.c
index 1a2d2d212..117b464d5 100644
--- a/input_common.c
+++ b/input_common.c
@@ -1,5 +1,5 @@
/** \file input_common.c
-
+
Implementation file for the low level input library
*/
@@ -55,7 +55,7 @@ void input_common_init( int (*ih)() )
void input_common_destroy()
{
-
+
}
/**
@@ -66,13 +66,13 @@ static wint_t readb()
{
unsigned char arr[1];
int do_loop = 0;
-
+
do
{
- fd_set fd;
+ fd_set fd;
int fd_max=1;
int res;
-
+
FD_ZERO( &fd );
FD_SET( 0, &fd );
if( env_universal_server.fd > 0 )
@@ -80,9 +80,9 @@ static wint_t readb()
FD_SET( env_universal_server.fd, &fd );
fd_max = env_universal_server.fd+1;
}
-
- do_loop = 0;
-
+
+ do_loop = 0;
+
res = select( fd_max, &fd, 0, 0, 0 );
if( res==-1 )
{
@@ -102,10 +102,10 @@ static wint_t readb()
{
return lookahead_arr[--lookahead_count];
}
-
+
}
-
-
+
+
do_loop = 1;
break;
}
@@ -116,7 +116,7 @@ static wint_t readb()
*/
return R_EOF;
}
- }
+ }
}
else
{
@@ -124,7 +124,7 @@ static wint_t readb()
{
if( FD_ISSET( env_universal_server.fd, &fd ) )
{
- debug( 3, L"Wake up on universal variable event" );
+ debug( 3, L"Wake up on universal variable event" );
env_universal_read_all();
do_loop = 1;
@@ -132,7 +132,7 @@ static wint_t readb()
{
return lookahead_arr[--lookahead_count];
}
- }
+ }
}
if( FD_ISSET( 0, &fd ) )
{
@@ -144,11 +144,11 @@ static wint_t readb()
return R_EOF;
}
do_loop = 0;
- }
+ }
}
}
while( do_loop );
-
+
return arr[0];
}
@@ -167,16 +167,16 @@ wchar_t input_common_readch( int timed )
1000 * WAIT_ON_ESCAPE
}
;
-
+
FD_ZERO( &fds );
FD_SET( 0, &fds );
count = select(1, &fds, 0, 0, &tm);
-
+
switch( count )
{
case 0:
return WEOF;
-
+
case -1:
return WEOF;
break;
@@ -185,7 +185,7 @@ wchar_t input_common_readch( int timed )
}
}
-
+
wchar_t res;
static mbstate_t state;
@@ -193,33 +193,33 @@ wchar_t input_common_readch( int timed )
{
wint_t b = readb();
char bb;
-
+
int sz;
-
+
if( (b >= R_NULL) && (b < R_NULL + 1000) )
return b;
bb=b;
-
+
sz = mbrtowc( &res, &bb, 1, &state );
-
+
switch( sz )
{
case -1:
memset (&state, '\0', sizeof (state));
- debug( 2, L"Illegal input" );
- return R_NULL;
+ debug( 2, L"Illegal input" );
+ return R_NULL;
case -2:
break;
case 0:
return 0;
default:
-
+
return res;
}
}
}
- else
+ else
{
if( !timed )
{
@@ -228,7 +228,7 @@ wchar_t input_common_readch( int timed )
if( lookahead_count == 0 )
return input_common_readch(0);
}
-
+
return lookahead_arr[--lookahead_count];
}
}
diff --git a/input_common.h b/input_common.h
index a2b361f79..07abb8924 100644
--- a/input_common.h
+++ b/input_common.h
@@ -1,5 +1,5 @@
/** \file input_common.h
-
+
Header file for the low level input library
*/
diff --git a/install-sh b/install-sh
index e9de23842..594a4edbf 100755
--- a/install-sh
+++ b/install-sh
@@ -115,7 +115,7 @@ fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
-
+
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
@@ -125,7 +125,7 @@ if [ x"$dir_arg" != x ]; then
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
+# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
@@ -135,7 +135,7 @@ else
echo "install: $src does not exist"
exit 1
fi
-
+
if [ x"$dst" = x ]
then
echo "install: no destination specified"
@@ -163,7 +163,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
-defaultIFS='
+defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
@@ -202,17 +202,17 @@ else
# If we're going to rename the final executable, determine the name now.
- if [ x"$transformarg" = x ]
+ if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
- dstfile=`basename $dst $transformbasename |
+ dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
- if [ x"$dstfile" = x ]
+ if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
@@ -243,7 +243,7 @@ else
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
diff --git a/intern.c b/intern.c
index 554635d86..87332b097 100644
--- a/intern.c
+++ b/intern.c
@@ -33,10 +33,10 @@ const wchar_t *intern( const wchar_t *in )
const wchar_t *res=0;
// debug( 0, L"intern %ls", in );
-
+
if( !in )
return 0;
-
+
if( !intern_table )
{
intern_table = malloc( sizeof( hash_table_t ) );
@@ -46,16 +46,16 @@ const wchar_t *intern( const wchar_t *in )
}
hash_init( intern_table, &hash_wcs_func, &hash_wcs_cmp );
}
-
+
if( intern_static_table )
{
res = hash_get( intern_static_table, in );
}
-
+
if( !res )
{
res = hash_get( intern_table, in );
-
+
if( !res )
{
res = wcsdup( in );
@@ -63,39 +63,39 @@ const wchar_t *intern( const wchar_t *in )
{
DIE_MEM();
}
-
+
hash_put( intern_table, res, res );
}
}
-
+
return res;
}
const wchar_t *intern_static( const wchar_t *in )
{
const wchar_t *res=0;
-
+
if( !in )
return 0;
-
+
if( !intern_static_table )
{
intern_static_table = malloc( sizeof( hash_table_t ) );
if( !intern_static_table )
{
- DIE_MEM();
+ DIE_MEM();
}
hash_init( intern_static_table, &hash_wcs_func, &hash_wcs_cmp );
}
-
+
res = hash_get( intern_static_table, in );
-
+
if( !res )
{
res = in;
hash_put( intern_static_table, res, res );
}
-
+
return res;
}
@@ -104,7 +104,7 @@ const wchar_t *intern_static( const wchar_t *in )
*/
static void clear_value( void *key, void *data )
{
- debug( 3, L"interned string: '%ls'", data );
+ debug( 3, L"interned string: '%ls'", data );
free( (void *)data );
}
@@ -112,17 +112,17 @@ void intern_free_all()
{
if( intern_table )
{
- hash_foreach( intern_table, &clear_value );
- hash_destroy( intern_table );
+ hash_foreach( intern_table, &clear_value );
+ hash_destroy( intern_table );
free( intern_table );
- intern_table=0;
+ intern_table=0;
}
if( intern_static_table )
{
- hash_destroy( intern_static_table );
+ hash_destroy( intern_static_table );
free( intern_static_table );
- intern_static_table=0;
+ intern_static_table=0;
}
-
+
}
diff --git a/io.c b/io.c
index 967c785f0..0d9fb7c19 100644
--- a/io.c
+++ b/io.c
@@ -1,7 +1,7 @@
/** \file io.c
Utilities for io redirection.
-
+
*/
#include "config.h"
@@ -56,7 +56,7 @@ void io_buffer_read( io_data_t *d )
exec_close(d->param1.pipe_fd[1] );
if( d->io_mode == IO_BUFFER )
- {
+ {
/* if( fcntl( d->param1.pipe_fd[0], F_SETFL, 0 ) )
{
wperror( L"fcntl" );
@@ -83,17 +83,17 @@ void io_buffer_read( io_data_t *d )
*/
if( errno != EAGAIN )
{
- debug( 1,
- _(L"An error occured while reading output from code block on file descriptor %d"),
+ debug( 1,
+ _(L"An error occured while reading output from code block on file descriptor %d"),
d->param1.pipe_fd[0] );
- wperror( L"io_buffer_read" );
+ wperror( L"io_buffer_read" );
}
-
- break;
+
+ break;
}
else
- {
- b_append( d->param2.out_buffer, b, l );
+ {
+ b_append( d->param2.out_buffer, b, l );
}
}
}
@@ -103,14 +103,14 @@ void io_buffer_read( io_data_t *d )
io_data_t *io_buffer_create( int is_input )
{
io_data_t *buffer_redirect = malloc( sizeof( io_data_t ));
-
+
buffer_redirect->io_mode=IO_BUFFER;
buffer_redirect->next=0;
buffer_redirect->param2.out_buffer= malloc( sizeof(buffer_t));
buffer_redirect->is_input = is_input;
b_init( buffer_redirect->param2.out_buffer );
buffer_redirect->fd=is_input?0:1;
-
+
if( exec_pipe( buffer_redirect->param1.pipe_fd ) == -1 )
{
debug( 1, PIPE_ERROR );
@@ -150,9 +150,9 @@ void io_buffer_destroy( io_data_t *io_buffer )
Dont free fd for writing. This should already be free'd before
calling exec_read_io_buffer on the buffer
*/
-
+
b_destroy( io_buffer->param2.out_buffer );
-
+
free( io_buffer->param2.out_buffer );
free( io_buffer );
}
@@ -174,7 +174,7 @@ io_data_t *io_remove( io_data_t *list, io_data_t *element )
{
io_data_t *curr, *prev=0;
for( curr=list; curr; curr = curr->next )
- {
+ {
if( element == curr )
{
if( prev == 0 )
@@ -198,32 +198,32 @@ io_data_t *io_remove( io_data_t *list, io_data_t *element )
io_data_t *io_duplicate( void *context, io_data_t *l )
{
io_data_t *res;
-
+
if( l == 0 )
return 0;
res = halloc( context, sizeof( io_data_t) );
-
+
if( !res )
{
DIE_MEM();
-
+
}
-
+
memcpy( res, l, sizeof(io_data_t ));
res->next=io_duplicate( context, l->next );
- return res;
+ return res;
}
io_data_t *io_get( io_data_t *io, int fd )
{
if( io == 0 )
return 0;
-
+
io_data_t *res = io_get( io->next, fd );
if( res )
return res;
-
+
if( io->fd == fd )
return io;
@@ -237,14 +237,14 @@ void io_print( io_data_t *io )
{
return;
}
-
+
debug( 1, L"IO fd %d, type ", io->fd );
switch( io->io_mode )
{
case IO_PIPE:
debug( 1, L"PIPE, data %d", io->param1.pipe_fd[io->fd?1:0] );
break;
-
+
case IO_FD:
debug( 1, L"FD, copy %d", io->param1.old_fd );
break;
@@ -252,11 +252,11 @@ void io_print( io_data_t *io )
case IO_BUFFER:
debug( 1, L"BUFFER" );
break;
-
+
default:
debug( 1, L"OTHER" );
}
io_print( io->next );
-
+
}
diff --git a/io.h b/io.h
index c2e2d5309..a48b5aed9 100644
--- a/io.h
+++ b/io.h
@@ -17,8 +17,8 @@ typedef struct io_data
int io_mode;
/** FD to redirect */
int fd;
- /**
- Type-specific parameter for redirection
+ /**
+ Type-specific parameter for redirection
*/
union
{
@@ -30,7 +30,7 @@ typedef struct io_data
int old_fd;
} param1
;
- /**
+ /**
Second type-specific paramter for redirection
*/
union
@@ -38,7 +38,7 @@ typedef struct io_data
/** file creation flags to send to open for IO_FILE */
int flags;
/** buffer to save output in for IO_BUFFER */
- buffer_t *out_buffer;
+ buffer_t *out_buffer;
/** Whether to close old_fd for IO_FD */
int close_old;
} param2
@@ -48,13 +48,13 @@ typedef struct io_data
Set to true if this is an input io redirection
*/
int is_input;
-
+
/** Pointer to the next IO redirection */
struct io_data *next;
}
io_data_t;
-
+
/**
Join two chains of io redirections
*/
diff --git a/key_reader.c b/key_reader.c
index e7d6611f7..1cf42a1ca 100644
--- a/key_reader.c
+++ b/key_reader.c
@@ -29,7 +29,7 @@ int main( int argc, char **argv)
{
setlocale( LC_ALL, "" );
-
+
if( argc == 2 )
{
@@ -37,24 +37,24 @@ int main( int argc, char **argv)
char *termtype = getenv ("TERM");
char *tbuff = malloc( sizeof(char)*9999);
char *res;
-
+
tgetent( term_buffer, termtype );
- res = tgetstr( argv[1], &tbuff );
+ res = tgetstr( argv[1], &tbuff );
if( res != 0 )
{
while( *res != 0 )
- {
+ {
printf("%d ", *res );
res++;
}
- printf( "\n" );
+ printf( "\n" );
}
else
{
printf("Undefined sequence\n");
- }
+ }
}
else
{
@@ -65,11 +65,11 @@ int main( int argc, char **argv)
savemodes; /* so we can reset the modes when we're done */
input_common_init(0);
-
+
tcgetattr(0,&modes); /* get the current terminal modes */
savemodes = modes; /* save a copy so we can reset them */
-
+
modes.c_lflag &= ~ICANON; /* turn off canonical mode */
modes.c_lflag &= ~ECHO; /* turn off echo mode */
modes.c_cc[VMIN]=1;
@@ -83,13 +83,13 @@ int main( int argc, char **argv)
sprintf( scratch, "dec: %d hex: %x char: %c\n", c, c, c );
else
sprintf( scratch, "dec: %d hex: %x\n", c, c );
- writestr( scratch );
+ writestr( scratch );
}
/* reset the terminal to the saved mode */
- tcsetattr(0,TCSANOW,&savemodes);
+ tcsetattr(0,TCSANOW,&savemodes);
input_common_destroy();
- }
+ }
return 0;
}
diff --git a/kill.c b/kill.c
index c80bbbe9e..f8843ca2d 100644
--- a/kill.c
+++ b/kill.c
@@ -45,21 +45,21 @@ static ll_node_t /** Last kill string */*kill_last=0, /** Current kill string */
static wchar_t *cut_buffer=0;
/**
- Test if the xsel command is installed. Since this is called often,
+ Test if the xsel command is installed. Since this is called often,
cache the result.
*/
static int has_xsel()
{
- static int called=0;
+ static int called=0;
static int res = 0;
- if (!called) {
- void *context = halloc(0, 0);
- wchar_t *path = path_get_path( context, L"xsel" );
- res = !!path;
- halloc_free( context );
- called = 1;
- }
+ if (!called) {
+ void *context = halloc(0, 0);
+ wchar_t *path = path_get_path( context, L"xsel" );
+ res = !!path;
+ halloc_free( context );
+ called = 1;
+ }
return res;
}
@@ -71,7 +71,7 @@ static void kill_add_internal( wchar_t *str )
{
if( wcslen( str ) == 0 )
return;
-
+
if( kill_last == 0 )
{
kill_current = kill_last=malloc( sizeof( ll_node_t ) );
@@ -93,51 +93,51 @@ static void kill_add_internal( wchar_t *str )
void kill_add( wchar_t *str )
{
wchar_t *cmd = NULL;
- wchar_t *escaped_str;
+ wchar_t *escaped_str;
kill_add_internal(str);
- /*
- Check to see if user has set the FISH_CLIPBOARD_CMD variable,
- and, if so, use it instead of checking the display, etc.
-
- I couldn't think of a safe way to allow overide of the echo
- command too, so, the command used must accept the input via stdin.
- */
- wchar_t *clipboard;
- if( (clipboard = env_get(L"FISH_CLIPBOARD_CMD")) )
- {
- escaped_str = escape( str, 1 );
+ /*
+ Check to see if user has set the FISH_CLIPBOARD_CMD variable,
+ and, if so, use it instead of checking the display, etc.
+
+ I couldn't think of a safe way to allow overide of the echo
+ command too, so, the command used must accept the input via stdin.
+ */
+ wchar_t *clipboard;
+ if( (clipboard = env_get(L"FISH_CLIPBOARD_CMD")) )
+ {
+ escaped_str = escape( str, 1 );
cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard);
- }
- else
- {
- /* This is for sending the kill to the X copy-and-paste buffer */
- if( !has_xsel() ) {
- return;
- }
+ }
+ else
+ {
+ /* This is for sending the kill to the X copy-and-paste buffer */
+ if( !has_xsel() ) {
+ return;
+ }
- wchar_t *disp;
- if( (disp = env_get( L"DISPLAY" )) )
- {
- escaped_str = escape( str, 1 );
- cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
- }
- }
+ wchar_t *disp;
+ if( (disp = env_get( L"DISPLAY" )) )
+ {
+ escaped_str = escape( str, 1 );
+ cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
+ }
+ }
- if (cmd != NULL)
- {
- if( exec_subshell( cmd, 0 ) == -1 )
- {
- /*
- Do nothing on failiure
- */
- }
-
- free( cut_buffer );
- free( cmd );
-
- cut_buffer = escaped_str;
+ if (cmd != NULL)
+ {
+ if( exec_subshell( cmd, 0 ) == -1 )
+ {
+ /*
+ Do nothing on failiure
+ */
+ }
+
+ free( cut_buffer );
+ free( cmd );
+
+ cut_buffer = escaped_str;
}
}
@@ -164,8 +164,8 @@ static void kill_remove_node( ll_node_t *n )
}
kill_current=kill_last;
free( n->data );
- free( n );
- }
+ free( n );
+ }
}
/**
@@ -174,13 +174,13 @@ static void kill_remove_node( ll_node_t *n )
static void kill_remove( wchar_t *s )
{
ll_node_t *n, *next=0;
-
+
if( !kill_last )
{
return;
}
-
- for( n=kill_last;
+
+ for( n=kill_last;
n!=kill_last || next == 0 ;
n=n->prev )
{
@@ -192,13 +192,13 @@ static void kill_remove( wchar_t *s )
next = n;
}
}
-
-
+
+
void kill_replace( wchar_t *old, wchar_t *new )
{
kill_remove( old );
- kill_add( new );
+ kill_add( new );
}
wchar_t *kill_yank_rotate()
@@ -214,13 +214,13 @@ wchar_t *kill_yank_rotate()
clipboard contents to the fish killring.
*/
static void kill_check_x_buffer()
-{
+{
wchar_t *disp;
-
+
if( !has_xsel() )
return;
-
-
+
+
if( (disp = env_get( L"DISPLAY" )) )
{
int i;
@@ -230,7 +230,7 @@ static void kill_check_x_buffer()
al_init( &list );
if( exec_subshell( cmd, &list ) != -1 )
{
-
+
for( i=0; idata == 0 )
break;
-
+
if( tmp == kill_current )
{
kill_ok = 1;
break;
}
- tmp = tmp->prev;
+ tmp = tmp->prev;
}
if( !kill_ok )
{
- debug( 0,
+ debug( 0,
L"Killring inconsistent" );
sanity_lose();
}
}
-
+
}
}
@@ -334,12 +334,12 @@ void kill_destroy()
{
if( cut_buffer )
free( cut_buffer );
-
+
if( kill_current != 0 )
{
kill_current = kill_last->prev;
kill_last->prev = 0;
-
+
while( kill_current )
{
ll_node_t *tmp = kill_current;
@@ -347,7 +347,7 @@ void kill_destroy()
free( tmp->data );
free( tmp );
}
- }
-
+ }
+
}
diff --git a/make_completions.py b/make_completions.py
index 215999cd0..2a960ccb2 100755
--- a/make_completions.py
+++ b/make_completions.py
@@ -39,13 +39,13 @@ def print_completion( cmd, switch_arr, arg, desc ):
if len(switch_arr)==0:
return
-
+
res = "complete -c %s" % (cmd)
for sw in switch_arr:
-
+
offset=1
switch_type = "o"
-
+
if len(sw) == 2:
switch_type = "s"
@@ -98,7 +98,7 @@ for c in man:
can_be_switch = True
elif before_switch.find(c)<0:
can_be_switch = False
-
+
elif mode == MODE_SWITCH:
if not switch_end.find(c)>=0:
@@ -106,7 +106,7 @@ for c in man:
else:
if len(sw) > 1:
sw_arr.append(sw)
-
+
if switch_between_ignore.find(c) >= 0:
mode=MODE_BETWEEN_IGNORE
else:
@@ -124,7 +124,7 @@ for c in man:
elif not switch_between_continue.find(c) >= 0:
mode = MODE_DESC
desc = c
-
+
elif mode == MODE_BETWEEN_IGNORE:
if between_ignore.find(c)>=0:
mode = MODE_BETWEEN
@@ -139,20 +139,20 @@ for c in man:
if c == '\n' and pc == '\n':
stop=True
- if stop:
+ if stop:
mode=MODE_NONE
-
+
print_completion( cmd, sw_arr, None, desc )
sw_arr = []
desc = ''
-
+
else:
desc += c
else:
print "Unknown mode", mode
-
+
pc = c
diff --git a/make_vcs_completions.fish b/make_vcs_completions.fish
index 25c694147..b28e62cc2 100755
--- a/make_vcs_completions.fish
+++ b/make_vcs_completions.fish
@@ -21,7 +21,7 @@ end
#
# This function formats a list of completion information into a set of fish completions
-#
+#
# The first argument is the condition string, which will be copied to
# the resulting commandline verbatim
#
@@ -42,7 +42,7 @@ function complete_from_list
set arg $exploded[3]
set desc (cap (esc $exploded[4]))
- set str
+ set str
switch $short
case '-?'
@@ -65,7 +65,7 @@ function complete_from_list
set str $str -x -a "'(__fish_complete_users)'"
case '=FILENAME' '=FILE' ' '
- set str $str -r
+ set str $str -r
case ' arg'
set str $str -x
@@ -89,7 +89,7 @@ function complete_from_list
set str $str --description \'$desc\'
end
- echo complete -c $cmd $condition $str
+ echo complete -c $cmd $condition $str
end
@@ -101,7 +101,7 @@ function write_completions
set -g cmd $argv[1]; or return 1
echo "Making completions for $cmd" >&2
-
+
echo '
#
@@ -129,7 +129,7 @@ function write_completions
switch $cmd
case svn
- function list_subcommand
+ function list_subcommand
set cmd1 '\([^ ]*\)'
set cmd2 '\([^,)]*\)'
set cmdn '\(, \([^,)]*\)\|\)'
@@ -155,7 +155,7 @@ function write_completions
case cvs
- function list_subcommand
+ function list_subcommand
cmd --help-commands 2>| sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
end
@@ -167,7 +167,7 @@ function write_completions
function list_subcommand_help
#'s/^[ \t]*\(-.\)[ \t]\([^- \t][^ \t]*\)*[ \t]*\([^-].*\)$/\1\t\2\t\3/p'
- cmd -H $argv 2>| sed -n -e 's/'$re'/\1\t\t\2\t\4/p'
+ cmd -H $argv 2>| sed -n -e 's/'$re'/\1\t\t\2\t\4/p'
end
echo '
@@ -181,12 +181,12 @@ function write_completions
set cmd_str_internal (cmd --help-commands 2>| sed -n -e 's/^ *\([^ ][^ ]*\)[\t ]*\([^ ].*\)$/\1\t\2/p')
for i in $cmd_str_internal
set exploded (echo $i|tr \t \n)
- set cmd_str $cmd_str "-a $exploded[1] --description '"(esc $exploded[2])"'"
+ set cmd_str $cmd_str "-a $exploded[1] --description '"(esc $exploded[2])"'"
end
case '*'
- function list_subcommand
+ function list_subcommand
cmd help | sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
end
@@ -203,7 +203,7 @@ function write_completions
set cmd_str (cmd help | sed -n -e 's/^ *\([^ ][^ ]*\)[\t ]*\([^ ].*[^.]\)\(\|\\.\)$/-a \1 --description \'\2\'/p')
end
-
+
echo '
#
# subcommands
@@ -228,8 +228,8 @@ function write_completions
end
-set darcs_comp 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"'
-set darcs_comp $darcs_comp 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x'
+set darcs_comp 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"'
+set darcs_comp $darcs_comp 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x'
write_completions darcs $darcs_comp >share/completions/darcs.fish
write_completions hg >share/completions/hg.fish
diff --git a/mimedb.c b/mimedb.c
index 46061ec3e..b62d4ebb4 100644
--- a/mimedb.c
+++ b/mimedb.c
@@ -1,8 +1,8 @@
-/** \file mimedb.c
+/** \file mimedb.c
mimedb is a program for checking the mimetype, description and
default action associated with a file or mimetype. It uses the
-xdgmime library written by the fine folks at freedesktop.org. There does
+xdgmime library written by the fine folks at freedesktop.org. There does
not seem to be any standard way for the user to change the preferred
application yet.
@@ -97,7 +97,7 @@ license. Read the source code of the library for more information.
/**
Error message if system call goes wrong.
*/
-#define ERROR_SYSTEM "%s: Could not execute command \"%s\"\n"
+#define ERROR_SYSTEM "%s: Could not execute command \"%s\"\n"
/**
Exit code if system call goes wrong.
@@ -194,8 +194,8 @@ static char * search_ini( const char *filename, const char *match )
FILE *f = fopen( filename, "r" );
char buf[4096];
int len=strlen(match);
- int done = 0;
-
+ int done = 0;
+
if(!f )
{
perror( "fopen" );
@@ -210,14 +210,14 @@ static char * search_ini( const char *filename, const char *match )
{
perror( "fgets" );
error=1;
- }
+ }
buf[0]=0;
done = 1;
}
else if( strncmp( buf, match,len )==0)
{
done=1;
- }
+ }
}
fclose( f );
if( buf[0] )
@@ -245,29 +245,29 @@ static char *file_exists( const char *dir, const char *in )
struct stat buf;
// fprintf( stderr, "Check %s%s\n", dir, in );
-
+
if( !filename )
{
return 0;
- }
+ }
strcpy( filename, dir );
- strcat( filename, in );
-
+ strcat( filename, in );
+
if( !stat( filename, &buf ) )
return filename;
free( filename );
-
+
/*
DOH! File does not exist. But all is not lost. KDE sometimes uses
a slash in the name as a directory separator. We try to replace
- a dash with a slash and try again.
+ a dash with a slash and try again.
*/
- replaceme = strchr( in, '-' );
+ replaceme = strchr( in, '-' );
if( replaceme )
{
char *res;
-
+
*replaceme = '/';
res = file_exists( dir, in );
*replaceme = '-';
@@ -296,7 +296,7 @@ static char *get_filename( char *f )
xdg_data_home = getenv ("XDG_DATA_HOME");
if (xdg_data_home)
{
- result = file_exists( xdg_data_home, f );
+ result = file_exists( xdg_data_home, f );
if (result)
return result;
}
@@ -312,10 +312,10 @@ static char *get_filename( char *f )
guessed_xdg_home = my_malloc (strlen (home) + strlen ("/.local/share/") + 1);
if( !guessed_xdg_home )
return 0;
-
+
strcpy (guessed_xdg_home, home);
strcat (guessed_xdg_home, "/.local/share/");
- result = file_exists( guessed_xdg_home, f );
+ result = file_exists( guessed_xdg_home, f );
free (guessed_xdg_home);
if (result)
@@ -352,11 +352,11 @@ static char *get_filename( char *f )
dir = my_malloc (len + 1);
if( !dir )
return 0;
-
+
strncpy (dir, ptr, len);
dir[len] = '\0';
- result = file_exists( dir, f );
-
+ result = file_exists( dir, f );
+
free (dir);
if (result)
@@ -364,7 +364,7 @@ static char *get_filename( char *f )
ptr = end_ptr;
}
- return 0;
+ return 0;
}
/**
@@ -382,11 +382,11 @@ static char *munge( char *in )
{
return 0;
}
-
+
while( 1 )
{
// fprintf( stderr, "%c\n", *in );
-
+
switch( *in )
{
case ' ':
@@ -407,7 +407,7 @@ static char *munge( char *in )
*(p++)=' ';
}
printed=1;
- had_whitespace=0;
+ had_whitespace=0;
*(p++)=*in;
break;
}
@@ -424,19 +424,19 @@ static char *munge( char *in )
*/
static char *get_lang_re()
{
-
+
static char buff[BUFF_SIZE];
const char *lang = setlocale( LC_MESSAGES, 0 );
int close=0;
char *out=buff;
-
+
if( (1+strlen(lang)*4) >= BUFF_SIZE )
{
fprintf( stderr, _( "%s: Locale string too long\n"), MIMEDB );
error = 1;
return 0;
}
-
+
for( ; *lang; lang++ )
{
switch( *lang )
@@ -449,17 +449,17 @@ static char *get_lang_re()
*out++ = ')';
*out++ = '?';
}
-
+
close=1;
*out++ = '(';
*out++ = *lang;
break;
-
+
default:
*out++ = *lang;
}
}
-
+
if( close )
{
*out++ = ')';
@@ -471,12 +471,12 @@ static char *get_lang_re()
}
/**
- Get description for a specified mimetype.
+ Get description for a specified mimetype.
*/
static char *get_description( const char *mimetype )
{
char *fn_part;
-
+
char *fn;
int fd;
struct stat st;
@@ -491,12 +491,12 @@ static char *get_description( const char *mimetype )
lang = get_lang_re();
if( !lang )
return 0;
-
+
snprintf( buff, BUFF_SIZE, START_TAG, lang, lang );
start_re = my_malloc( sizeof(regex_t));
stop_re = my_malloc( sizeof(regex_t));
-
+
int reg_status;
if( ( reg_status = regcomp( start_re, buff, REG_EXTENDED ) ) )
{
@@ -504,7 +504,7 @@ static char *get_description( const char *mimetype )
regerror(reg_status, start_re, regerrbuf, BUFF_SIZE);
fprintf( stderr, _( "%s: Could not compile regular expressions %s with error %s\n"), MIMEDB, buff, regerrbuf);
error=1;
-
+
}
else if ( ( reg_status = regcomp( stop_re, STOP_TAG, REG_EXTENDED ) ) )
{
@@ -512,7 +512,7 @@ static char *get_description( const char *mimetype )
regerror(reg_status, stop_re, regerrbuf, BUFF_SIZE);
fprintf( stderr, _( "%s: Could not compile regular expressions %s with error %s\n"), MIMEDB, buff, regerrbuf);
error=1;
-
+
}
if( error )
@@ -524,7 +524,7 @@ static char *get_description( const char *mimetype )
return 0;
}
}
-
+
fn_part = my_malloc( strlen(MIME_DIR) + strlen( mimetype) + strlen(MIME_SUFFIX) + 1 );
if( !fn_part )
@@ -538,7 +538,7 @@ static char *get_description( const char *mimetype )
fn = get_filename(fn_part); //malloc( strlen(MIME_DIR) +strlen( MIME_SUFFIX)+ strlen( mimetype ) + 1 );
free(fn_part );
-
+
if( !fn )
{
return 0;
@@ -547,14 +547,14 @@ static char *get_description( const char *mimetype )
fd = open( fn, O_RDONLY );
// fprintf( stderr, "%s\n", fn );
-
+
if( fd == -1 )
{
perror( "open" );
error=1;
return 0;
}
-
+
if( stat( fn, &st) )
{
perror( "stat" );
@@ -567,7 +567,7 @@ static char *get_description( const char *mimetype )
{
return 0;
}
-
+
if( read( fd, contents, st.st_size ) != st.st_size )
{
perror( "read" );
@@ -584,9 +584,9 @@ static char *get_description( const char *mimetype )
contents[st.st_size]=0;
regmatch_t match[1];
int w = -1;
-
+
start=contents;
-
+
/*
On multiple matches, use the longest match, should be a pretty
good heuristic for best match...
@@ -595,10 +595,10 @@ static char *get_description( const char *mimetype )
{
int new_w = match[0].rm_eo - match[0].rm_so;
start += match[0].rm_eo;
-
+
if( new_w > w )
{
- /*
+ /*
New match is for a longer match then the previous
match, so we use the new match
*/
@@ -606,7 +606,7 @@ static char *get_description( const char *mimetype )
best_start = start;
}
}
-
+
if( w != -1 )
{
start = best_start;
@@ -633,36 +633,36 @@ static char *get_description( const char *mimetype )
/**
- Get default action for a specified mimetype.
+ Get default action for a specified mimetype.
*/
static char *get_action( const char *mimetype )
{
char *res=0;
-
+
char *launcher;
char *end;
char *mime_filename;
-
+
char *launcher_str;
char *launcher_filename, *launcher_command_str, *launcher_command;
char *launcher_full;
-
+
mime_filename = get_filename( DESKTOP_DEFAULT );
if( !mime_filename )
return 0;
-
+
launcher_str = search_ini( mime_filename, mimetype );
free( mime_filename );
-
+
if( !launcher_str )
{
/*
This type does not have a launcher. Try the supertype!
*/
-// fprintf( stderr, "mimedb: %s does not have launcher, try supertype\n", mimetype );
+// fprintf( stderr, "mimedb: %s does not have launcher, try supertype\n", mimetype );
const char ** parents = xdg_mime_get_mime_parents(mimetype);
-
+
const char **p;
if( parents )
{
@@ -677,26 +677,26 @@ static char *get_action( const char *mimetype )
Just in case subclassing doesn't work, (It doesn't on Fedora
Core 3) we also test some common subclassings.
*/
-
+
if( strncmp( mimetype, "text/plain", 10) != 0 && strncmp( mimetype, "text/", 5 ) == 0 )
return get_action( "text/plain" );
return 0;
}
-
-// fprintf( stderr, "WOOT %s\n", launcher_str );
+
+// fprintf( stderr, "WOOT %s\n", launcher_str );
launcher = strchr( launcher_str, '=' );
-
+
if( !launcher )
{
- fprintf( stderr, _("%s: Could not parse launcher string '%s'\n"), MIMEDB, launcher_str );
+ fprintf( stderr, _("%s: Could not parse launcher string '%s'\n"), MIMEDB, launcher_str );
error=1;
return 0;
}
-
+
/* Skip the = */
launcher++;
-
+
/* Only use first launcher */
end = strchr( launcher, ';' );
if( end )
@@ -708,34 +708,34 @@ static char *get_action( const char *mimetype )
free( launcher_str );
return 0;
}
-
+
strcpy( launcher_full, APPLICATIONS_DIR );
strcat( launcher_full, launcher );
free( launcher_str );
-
+
launcher_filename = get_filename( launcher_full );
-
+
free( launcher_full );
-
+
launcher_command_str = search_ini( launcher_filename, "Exec=" );
-
+
if( !launcher_command_str )
{
- fprintf( stderr,
- _( "%s: Default launcher '%s' does not specify how to start\n"), MIMEDB,
+ fprintf( stderr,
+ _( "%s: Default launcher '%s' does not specify how to start\n"), MIMEDB,
launcher_filename );
free( launcher_filename );
- return 0;
+ return 0;
}
free( launcher_filename );
-
+
launcher_command = strchr( launcher_command_str, '=' );
launcher_command++;
-
+
res = my_strdup( launcher_command );
-
- free( launcher_command_str );
+
+ free( launcher_command_str );
return res;
}
@@ -748,7 +748,7 @@ static void writer( char c )
{
if( launch_len == -1 )
return;
-
+
if( launch_len <= launch_pos )
{
int new_len = launch_len?2*launch_len:256;
@@ -762,7 +762,7 @@ static void writer( char c )
}
launch_buff = new_buff;
launch_len = new_len;
-
+
}
launch_buff[launch_pos++]=c;
}
@@ -785,7 +785,7 @@ static void writer_hex( int num )
*/
static char *my_getcwd ()
{
- size_t size = 100;
+ size_t size = 100;
while (1)
{
char *buffer = (char *) malloc (size);
@@ -804,7 +804,7 @@ static char *my_getcwd ()
static char *get_fullfile( char *file )
{
char *fullfile;
-
+
if( file[0] == '/' )
{
fullfile = file;
@@ -818,9 +818,9 @@ static char *get_fullfile( char *file )
perror( "getcwd" );
return 0;
}
-
+
int l = strlen(cwd);
-
+
fullfile = my_malloc( l + strlen(file)+2 );
if( !fullfile )
{
@@ -831,7 +831,7 @@ static char *get_fullfile( char *file )
if( cwd[l-1] != '/' )
strcat(fullfile, "/" );
strcat( fullfile, file );
-
+
free(cwd);
}
return fullfile;
@@ -845,13 +845,13 @@ static void write_url( char *file )
{
char *fullfile = get_fullfile( file );
char *str = fullfile;
-
+
if( str == 0 )
{
launch_len = -1;
return;
}
-
+
writer( 'f');
writer( 'i');
writer( 'l');
@@ -866,9 +866,9 @@ static void write_url( char *file )
((*str >= '0') && (*str <='9')) ||
(strchr( "-_.~/",*str) != 0) )
{
- writer(*str);
+ writer(*str);
}
- else if(strchr( "()?&=",*str) != 0)
+ else if(strchr( "()?&=",*str) != 0)
{
writer('\\');
writer(*str);
@@ -882,7 +882,7 @@ static void write_url( char *file )
}
if( fullfile != file )
free( fullfile );
-
+
}
/**
@@ -906,7 +906,7 @@ static void write_file( char *file, int print_path )
}
str = basename( fullfile );
}
-
+
if( !str )
{
error = 1;
@@ -979,7 +979,7 @@ static void write_file( char *file, int print_path )
}
/**
- Use the specified launch filter to launch all the files in the specified list.
+ Use the specified launch filter to launch all the files in the specified list.
\param filter the action to take
\param files the list of files for which to perform the action
@@ -990,11 +990,11 @@ static void launch( char *filter, array_list_t *files, int fileno )
char *filter_org=filter;
int count=0;
int launch_again=0;
-
+
if( al_get_count( files ) <= fileno )
return;
-
-
+
+
launch_pos=0;
for( ;*filter && !error; filter++)
@@ -1009,7 +1009,7 @@ static void launch( char *filter, array_list_t *files, int fileno )
launch_again = 1;
write_url( (char *)al_get( files, fileno ) );
break;
- }
+ }
case 'U':
{
int i;
@@ -1021,10 +1021,10 @@ static void launch( char *filter, array_list_t *files, int fileno )
if( error )
break;
}
-
+
break;
}
-
+
case 'f':
case 'n':
{
@@ -1032,7 +1032,7 @@ static void launch( char *filter, array_list_t *files, int fileno )
write_file( (char *)al_get( files, fileno ), *filter == 'f' );
break;
}
-
+
case 'F':
case 'N':
{
@@ -1047,14 +1047,14 @@ static void launch( char *filter, array_list_t *files, int fileno )
}
break;
}
-
+
case 'd':
{
char *cpy = get_fullfile( (char *)al_get( files, fileno ) );
char *dir;
- launch_again=1;
+ launch_again=1;
/*
We wish to modify this string, make sure it is only a copy
*/
@@ -1068,16 +1068,16 @@ static void launch( char *filter, array_list_t *files, int fileno )
dir=dirname( cpy );
write_file( dir, 1 );
free( cpy );
-
+
break;
}
-
+
case 'D':
{
int i;
for( i=0; i=3;
is_bold |= wcscmp( next, L"-o" ) == 0;
@@ -577,14 +577,14 @@ int output_color_code( const wchar_t *val )
break;
}
}
-
+
}
-
+
al_foreach( &el, &free );
al_destroy( &el );
return color | (is_bold?FISH_COLOR_BOLD:0) | (is_underline?FISH_COLOR_UNDERLINE:0);
-
+
}
void output_set_term( wchar_t *term )
diff --git a/output.h b/output.h
index 0c8faa4b1..86ec5e021 100644
--- a/output.h
+++ b/output.h
@@ -11,7 +11,7 @@
#include
/**
- Constants for various colors as used by the set_color function.
+ Constants for various colors as used by the set_color function.
*/
enum
{
diff --git a/parse_util.c b/parse_util.c
index 4011d52c7..b4b46d353 100644
--- a/parse_util.c
+++ b/parse_util.c
@@ -5,7 +5,7 @@
This library can be seen as a 'toolbox' for functions that are
used in many places in fish and that are somehow related to
- parsing the code.
+ parsing the code.
*/
#include "config.h"
@@ -108,7 +108,7 @@ int parse_util_lineno( const wchar_t *str, int len )
prev_str = prev_str2;
i=i2;
res=res2;
-
+
prev_str2 = tmp_str;
i2 = tmp_i;
res2 = tmp_res;
@@ -118,13 +118,13 @@ int parse_util_lineno( const wchar_t *str, int len )
prev_str2 = prev_str;
i2 = i;
res2=res;
-
+
prev_str = (wchar_t *)str;
i=0;
res=1;
}
}
-
+
for( ; str[i] && i= off2-off-1 )
{
line_offset2 = off2-off-1;
}
-
+
return off + line_offset2;
-
+
}
-int parse_util_locate_cmdsubst( const wchar_t *in,
- wchar_t **begin,
+int parse_util_locate_cmdsubst( const wchar_t *in,
+ wchar_t **begin,
wchar_t **end,
int allow_incomplete )
{
wchar_t *pos;
wchar_t prev=0;
int syntax_error=0;
- int paran_count=0;
+ int paran_count=0;
wchar_t *paran_begin=0, *paran_end=0;
CHECK( in, 0 );
-
+
for( pos = (wchar_t *)in; *pos; pos++ )
{
if( prev != '\\' )
@@ -264,7 +264,7 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
{
paran_begin = pos;
}
-
+
paran_count++;
}
else if( *pos == ')' )
@@ -277,7 +277,7 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
paran_end = pos;
break;
}
-
+
if( paran_count < 0 )
{
syntax_error = 1;
@@ -285,19 +285,19 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
}
}
}
-
+
}
prev = *pos;
}
-
+
syntax_error |= (paran_count < 0 );
syntax_error |= ((paran_count>0)&&(!allow_incomplete));
-
+
if( syntax_error )
{
return -1;
}
-
+
if( paran_begin == 0 )
{
return 0;
@@ -312,20 +312,20 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
{
*end = paran_count?(wchar_t *)in+wcslen(in):paran_end;
}
-
+
return 1;
}
void parse_util_cmdsubst_extent( const wchar_t *buff,
int cursor_pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b )
{
wchar_t *begin, *end;
wchar_t *pos;
const wchar_t *cursor = buff + cursor_pos;
-
+
CHECK( buff, );
if( a )
@@ -337,9 +337,9 @@ void parse_util_cmdsubst_extent( const wchar_t *buff,
{
*b = (wchar_t *)buff+wcslen(buff);
}
-
+
pos = (wchar_t *)buff;
-
+
while( 1 )
{
if( parse_util_locate_cmdsubst( pos,
@@ -379,10 +379,10 @@ void parse_util_cmdsubst_extent( const wchar_t *buff,
{
break;
}
-
+
pos = end+1;
}
-
+
}
/**
@@ -390,19 +390,19 @@ void parse_util_cmdsubst_extent( const wchar_t *buff,
*/
static void job_or_process_extent( const wchar_t *buff,
int cursor_pos,
- wchar_t **a,
- wchar_t **b,
+ wchar_t **a,
+ wchar_t **b,
int process )
{
wchar_t *begin, *end;
int pos;
wchar_t *buffcpy;
int finished=0;
-
+
tokenizer tok;
CHECK( buff, );
-
+
if( a )
{
*a=0;
@@ -412,20 +412,20 @@ static void job_or_process_extent( const wchar_t *buff,
{
*b = 0;
}
-
+
parse_util_cmdsubst_extent( buff, cursor_pos, &begin, &end );
if( !end || !begin )
{
return;
}
-
+
pos = cursor_pos - (begin - buff);
if( a )
{
*a = begin;
}
-
+
if( b )
{
*b = end;
@@ -453,14 +453,14 @@ static void job_or_process_extent( const wchar_t *buff,
break;
}
}
-
+
case TOK_END:
case TOK_BACKGROUND:
{
-
+
if( tok_begin >= pos )
{
- finished=1;
+ finished=1;
if( b )
{
*b = (wchar_t *)buff + tok_begin;
@@ -474,31 +474,31 @@ static void job_or_process_extent( const wchar_t *buff,
}
}
- break;
+ break;
}
}
}
free( buffcpy);
-
+
tok_destroy( &tok );
}
void parse_util_process_extent( const wchar_t *buff,
int pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b )
{
- job_or_process_extent( buff, pos, a, b, 1 );
+ job_or_process_extent( buff, pos, a, b, 1 );
}
void parse_util_job_extent( const wchar_t *buff,
int pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b )
{
- job_or_process_extent( buff,pos,a, b, 0 );
+ job_or_process_extent( buff,pos,a, b, 0 );
}
@@ -506,7 +506,7 @@ void parse_util_token_extent( const wchar_t *buff,
int cursor_pos,
wchar_t **tok_begin,
wchar_t **tok_end,
- wchar_t **prev_begin,
+ wchar_t **prev_begin,
wchar_t **prev_end )
{
wchar_t *begin, *end;
@@ -516,34 +516,34 @@ void parse_util_token_extent( const wchar_t *buff,
tokenizer tok;
wchar_t *a, *b, *pa, *pb;
-
+
CHECK( buff, );
-
+
assert( cursor_pos >= 0 );
a = b = pa = pb = 0;
-
+
parse_util_cmdsubst_extent( buff, cursor_pos, &begin, &end );
if( !end || !begin )
{
return;
}
-
+
pos = cursor_pos - (begin - buff);
-
+
a = (wchar_t *)buff + pos;
b = a;
pa = (wchar_t *)buff + pos;
pb = pa;
-
+
assert( begin >= buff );
assert( begin <= (buff+wcslen(buff) ) );
assert( end >= begin );
assert( end <= (buff+wcslen(buff) ) );
-
+
buffcpy = wcsndup( begin, end-begin );
-
+
if( !buffcpy )
{
DIE_MEM();
@@ -563,7 +563,7 @@ void parse_util_token_extent( const wchar_t *buff,
{
tok_end +=wcslen(tok_last(&tok));
}
-
+
/*
Cursor was before beginning of this token, means that the
cursor is between two tokens, so we set it to a zero element
@@ -580,12 +580,12 @@ void parse_util_token_extent( const wchar_t *buff,
looking for. If so, set a and b and break
*/
if( (tok_last_type( &tok ) == TOK_STRING) && (tok_end >= pos ) )
- {
+ {
a = begin + tok_get_pos( &tok );
b = a + wcslen(tok_last(&tok));
break;
}
-
+
/*
Remember previous string token
*/
@@ -597,7 +597,7 @@ void parse_util_token_extent( const wchar_t *buff,
}
free( buffcpy);
-
+
tok_destroy( &tok );
if( tok_begin )
@@ -619,7 +619,7 @@ void parse_util_token_extent( const wchar_t *buff,
{
*prev_end = pb;
}
-
+
assert( pa >= buff );
assert( pa <= (buff+wcslen(buff) ) );
assert( pb >= pa );
@@ -648,14 +648,14 @@ static void clear_hash_value( void *key, void *data, void *aux )
handler( name );
}
}
-
+
free( (void *)data );
}
/**
- Part of the autoloader cleanup
+ Part of the autoloader cleanup
*/
-static void clear_loaded_entry( void *key,
+static void clear_loaded_entry( void *key,
void *data,
void *handler )
{
@@ -667,7 +667,7 @@ static void clear_loaded_entry( void *key,
hash_destroy( &loaded->is_loading );
free( loaded->old_path );
- free( loaded );
+ free( loaded );
free( (void *)key );
}
@@ -683,9 +683,9 @@ static void parse_util_destroy()
hash_foreach2( all_loaded,
&clear_loaded_entry,
0 );
-
+
hash_destroy( all_loaded );
- free( all_loaded );
+ free( all_loaded );
all_loaded = 0;
}
}
@@ -704,7 +704,7 @@ void parse_util_load_reset( const wchar_t *path_var_name,
clear_loaded_entry( key, data, (void *)on_load );
}
}
-
+
}
int parse_util_unload( const wchar_t *cmd,
@@ -721,14 +721,14 @@ int parse_util_unload( const wchar_t *cmd,
{
return 0;
}
-
+
loaded = (autoload_t *)hash_get( all_loaded, path_var_name );
-
+
if( !loaded )
{
return 0;
}
-
+
hash_remove( &loaded->load_time, cmd, 0, &val );
if( val )
{
@@ -738,7 +738,7 @@ int parse_util_unload( const wchar_t *cmd,
}
free( val );
}
-
+
return !!val;
}
@@ -763,13 +763,13 @@ static void parse_util_autounload( const wchar_t *path_var_name,
{
return;
}
-
+
loaded = (autoload_t *)hash_get( all_loaded, path_var_name );
if( !loaded )
{
return;
}
-
+
if( hash_get_count( &loaded->load_time ) >= AUTOLOAD_MAX )
{
time_t oldest_access = time(0) - AUTOLOAD_MIN_AGE;
@@ -787,19 +787,19 @@ static void parse_util_autounload( const wchar_t *path_var_name,
{
continue;
}
-
+
if( !tm[0] )
{
continue;
}
-
+
if( hash_get( &loaded->is_loading, item ) )
{
continue;
}
-
+
loaded_count++;
-
+
if( tm[1] < oldest_access )
{
oldest_access = tm[1];
@@ -807,7 +807,7 @@ static void parse_util_autounload( const wchar_t *path_var_name,
}
}
al_destroy( &key );
-
+
if( oldest_item && loaded_count > AUTOLOAD_MAX)
{
parse_util_unload( oldest_item, path_var_name, on_load );
@@ -835,17 +835,17 @@ int parse_util_load( const wchar_t *cmd,
int res;
int c, c2;
-
+
CHECK( path_var_name, 0 );
CHECK( cmd, 0 );
CHECK_BLOCK( 0 );
-
+
// debug( 0, L"Autoload %ls in %ls", cmd, path_var_name );
parse_util_autounload( path_var_name, cmd, on_load );
- path_var = env_get( path_var_name );
-
+ path_var = env_get( path_var_name );
+
/*
Do we know where to look?
*/
@@ -859,7 +859,7 @@ int parse_util_load( const wchar_t *cmd,
*/
if( !all_loaded )
{
- all_loaded = malloc( sizeof( hash_table_t ) );
+ all_loaded = malloc( sizeof( hash_table_t ) );
halloc_register_function_void( global_context, &parse_util_destroy );
if( !all_loaded )
{
@@ -867,7 +867,7 @@ int parse_util_load( const wchar_t *cmd,
}
hash_init( all_loaded, &hash_wcs_func, &hash_wcs_cmp );
}
-
+
loaded = (autoload_t *)hash_get( all_loaded, path_var_name );
if( loaded )
@@ -888,13 +888,13 @@ int parse_util_load( const wchar_t *cmd,
*/
if( hash_get( &loaded->is_loading, cmd ) )
{
- debug( 0,
- _( L"Could not autoload item '%ls', it is already being autoloaded. "
- L"This is a circular dependency in the autoloading scripts, please remove it."),
+ debug( 0,
+ _( L"Could not autoload item '%ls', it is already being autoloaded. "
+ L"This is a circular dependency in the autoloading scripts, please remove it."),
cmd );
return 1;
}
-
+
}
else
@@ -911,7 +911,7 @@ int parse_util_load( const wchar_t *cmd,
}
hash_init( &loaded->load_time, &hash_wcs_func, &hash_wcs_cmp );
hash_put( all_loaded, wcsdup(path_var_name), loaded );
-
+
hash_init( &loaded->is_loading, &hash_wcs_func, &hash_wcs_cmp );
loaded->old_path = wcsdup( path_var );
@@ -919,11 +919,11 @@ int parse_util_load( const wchar_t *cmd,
path_list = al_new( global_context);
-
+
tokenize_variable_array( path_var, path_list );
-
+
c = al_get_count( path_list );
-
+
hash_put( &loaded->is_loading, cmd, cmd );
/*
@@ -940,7 +940,7 @@ int parse_util_load( const wchar_t *cmd,
*/
hash_remove( &loaded->is_loading, cmd, 0, 0 );
}
-
+
c2 = al_get_count( path_list );
al_foreach( path_list, &free );
@@ -950,9 +950,9 @@ int parse_util_load( const wchar_t *cmd,
/**
Make sure we didn't 'drop' something
*/
-
+
assert( c == c2 );
-
+
return res;
}
@@ -977,7 +977,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
Get modification time of file
*/
tm = (time_t *)hash_get( &loaded->load_time, cmd );
-
+
/*
Did we just check this?
*/
@@ -988,7 +988,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
return 0;
}
}
-
+
/*
Return if already loaded and we are skipping reloading
*/
@@ -996,7 +996,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
{
return 0;
}
-
+
if( !path )
{
path = sb_halloc( global_context );
@@ -1005,7 +1005,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
{
sb_clear( path );
}
-
+
/*
Iterate over path searching for suitable completion files
*/
@@ -1024,7 +1024,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
wchar_t *esc = escape( (wchar_t *)path->buff, 1 );
wchar_t *src_cmd = wcsdupcat( L". ", esc );
free( esc );
-
+
if( !tm )
{
tm = malloc(sizeof(time_t)*2);
@@ -1044,7 +1044,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
{
on_load(cmd );
}
-
+
/*
Source the completion file for the specified completion
*/
@@ -1054,7 +1054,7 @@ static int parse_util_load_internal( const wchar_t *cmd,
Do nothing on failiure
*/
}
-
+
free(src_cmd);
reloaded = 1;
}
@@ -1064,9 +1064,9 @@ static int parse_util_load_internal( const wchar_t *cmd,
If we are rechecking an autoload file, and it hasn't
changed, update the 'last check' timestamp.
*/
- tm[1] = time(0);
+ tm[1] = time(0);
}
-
+
break;
}
}
@@ -1083,13 +1083,13 @@ static int parse_util_load_internal( const wchar_t *cmd,
{
DIE_MEM();
}
-
+
tm[0] = 0;
tm[1] = time(0);
hash_put( &loaded->load_time, intern( cmd ), tm );
}
- return reloaded;
+ return reloaded;
}
void parse_util_set_argv( wchar_t **argv, array_list_t *named_arguments )
@@ -1099,7 +1099,7 @@ void parse_util_set_argv( wchar_t **argv, array_list_t *named_arguments )
wchar_t **arg;
string_buffer_t sb;
sb_init( &sb );
-
+
for( arg=argv; *arg; arg++ )
{
if( arg != argv )
@@ -1108,20 +1108,20 @@ void parse_util_set_argv( wchar_t **argv, array_list_t *named_arguments )
}
sb_append( &sb, *arg );
}
-
+
env_set( L"argv", (wchar_t *)sb.buff, ENV_LOCAL );
sb_destroy( &sb );
}
else
{
env_set( L"argv", 0, ENV_LOCAL );
- }
+ }
if( named_arguments )
{
wchar_t **arg;
int i;
-
+
for( i=0, arg=argv; i < al_get_count( named_arguments ); i++ )
{
env_set( al_get( named_arguments, i ), *arg, ENV_LOCAL );
@@ -1129,10 +1129,10 @@ void parse_util_set_argv( wchar_t **argv, array_list_t *named_arguments )
if( *arg )
arg++;
}
-
-
+
+
}
-
+
}
wchar_t *parse_util_unescape_wildcards( const wchar_t *str )
@@ -1141,14 +1141,14 @@ wchar_t *parse_util_unescape_wildcards( const wchar_t *str )
wchar_t *unescaped;
CHECK( str, 0 );
-
+
unescaped = wcsdup(str);
if( !unescaped )
{
DIE_MEM();
}
-
+
for( in=out=unescaped; *in; in++ )
{
switch( *in )
@@ -1163,25 +1163,25 @@ wchar_t *parse_util_unescape_wildcards( const wchar_t *str )
*(out++)=*in;
break;
}
-
+
case L'*':
{
- *(out++)=ANY_STRING;
+ *(out++)=ANY_STRING;
break;
}
-
+
case L'?':
{
- *(out++)=ANY_CHAR;
+ *(out++)=ANY_CHAR;
break;
}
-
+
default:
{
*(out++)=*in;
break;
}
- }
+ }
}
return unescaped;
}
diff --git a/parse_util.h b/parse_util.h
index a1b0b74ec..2b888daac 100644
--- a/parse_util.h
+++ b/parse_util.h
@@ -11,7 +11,7 @@
/**
Find the beginning and end of the first subshell in the specified string.
-
+
\param in the string to search for subshells
\param begin the starting paranthesis of the subshell
\param end the ending paranthesis of the subshell
@@ -19,8 +19,8 @@
\return -1 on syntax error, 0 if no subshells exist and 1 on sucess
*/
-int parse_util_locate_cmdsubst( const wchar_t *in,
- wchar_t **begin,
+int parse_util_locate_cmdsubst( const wchar_t *in,
+ wchar_t **begin,
wchar_t **end,
int flags );
@@ -38,7 +38,7 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
*/
void parse_util_cmdsubst_extent( const wchar_t *buff,
int cursor_pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b );
/**
@@ -51,7 +51,7 @@ void parse_util_cmdsubst_extent( const wchar_t *buff,
*/
void parse_util_process_extent( const wchar_t *buff,
int cursor_pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b );
@@ -65,7 +65,7 @@ void parse_util_process_extent( const wchar_t *buff,
*/
void parse_util_job_extent( const wchar_t *buff,
int cursor_pos,
- wchar_t **a,
+ wchar_t **a,
wchar_t **b );
/**
@@ -84,7 +84,7 @@ void parse_util_token_extent( const wchar_t *buff,
int cursor_pos,
wchar_t **tok_begin,
wchar_t **tok_end,
- wchar_t **prev_begin,
+ wchar_t **prev_begin,
wchar_t **prev_end );
@@ -115,7 +115,7 @@ int parse_util_get_offset( wchar_t *buff, int line, int line_offset );
not load it multiple times unless it's timestamp changes or
parse_util_unload is called.
- Autoloading one file may unload another.
+ Autoloading one file may unload another.
\param cmd the filename to search for. The suffix '.fish' is always added to this name
\param path_var_name the environment variable giving the search path
@@ -153,7 +153,7 @@ int parse_util_unload( const wchar_t *cmd,
/**
Set the argv environment variable to the specified null-terminated
- array of strings.
+ array of strings.
*/
void parse_util_set_argv( wchar_t **argv, array_list_t *named_arguments );
diff --git a/parser.c b/parser.c
index 2f214136a..702392b69 100644
--- a/parser.c
+++ b/parser.c
@@ -181,7 +181,7 @@ The fish parser. Contains functions for parsing and evaluating code.
/**
While block description
-*/
+*/
#define WHILE_BLOCK N_( L"'while' block" )
/**
@@ -189,10 +189,10 @@ The fish parser. Contains functions for parsing and evaluating code.
*/
#define FOR_BLOCK N_( L"'for' block" )
-/**
- Breakpoint block
+/**
+ Breakpoint block
*/
-#define BREAKPOINT_BLOCK N_( L"Block created by breakpoint" )
+#define BREAKPOINT_BLOCK N_( L"Block created by breakpoint" )
@@ -278,10 +278,10 @@ struct block_lookup_entry
int type;
/**
- The name of the builtin that creates this type of block, if any.
+ The name of the builtin that creates this type of block, if any.
*/
const wchar_t *name;
-
+
/**
A description of this block type
*/
@@ -292,62 +292,62 @@ struct block_lookup_entry
/**
List of all legal block types
*/
-const static struct block_lookup_entry block_lookup[]=
+static const struct block_lookup_entry block_lookup[]=
{
{
- WHILE, L"while", WHILE_BLOCK
+ WHILE, L"while", WHILE_BLOCK
}
,
{
- FOR, L"for", FOR_BLOCK
+ FOR, L"for", FOR_BLOCK
}
,
{
- IF, L"if", IF_BLOCK
+ IF, L"if", IF_BLOCK
}
,
{
- FUNCTION_DEF, L"function", FUNCTION_DEF_BLOCK
+ FUNCTION_DEF, L"function", FUNCTION_DEF_BLOCK
}
,
{
- FUNCTION_CALL, 0, FUNCTION_CALL_BLOCK
+ FUNCTION_CALL, 0, FUNCTION_CALL_BLOCK
}
,
{
- FUNCTION_CALL_NO_SHADOW, 0, FUNCTION_CALL_NO_SHADOW_BLOCK
+ FUNCTION_CALL_NO_SHADOW, 0, FUNCTION_CALL_NO_SHADOW_BLOCK
}
,
{
- SWITCH, L"switch", SWITCH_BLOCK
+ SWITCH, L"switch", SWITCH_BLOCK
}
,
{
- FAKE, 0, FAKE_BLOCK
+ FAKE, 0, FAKE_BLOCK
}
,
{
- TOP, 0, TOP_BLOCK
+ TOP, 0, TOP_BLOCK
}
,
{
- SUBST, 0, SUBST_BLOCK
+ SUBST, 0, SUBST_BLOCK
}
,
{
- BEGIN, L"begin", BEGIN_BLOCK
+ BEGIN, L"begin", BEGIN_BLOCK
}
,
{
- SOURCE, L".", SOURCE_BLOCK
+ SOURCE, L".", SOURCE_BLOCK
}
,
{
- EVENT, 0, EVENT_BLOCK
+ EVENT, 0, EVENT_BLOCK
}
,
{
- BREAKPOINT, L"breakpoint", BREAKPOINT_BLOCK
+ BREAKPOINT, L"breakpoint", BREAKPOINT_BLOCK
}
,
{
@@ -449,20 +449,20 @@ static int block_count( block_t *b )
void parser_push_block( int type )
{
block_t *new = halloc( 0, sizeof( block_t ));
-
+
new->src_lineno = parser_get_lineno();
new->src_filename = parser_current_filename()?intern(parser_current_filename()):0;
-
+
new->outer = current_block;
new->type = (current_block && current_block->skip)?FAKE:type;
-
+
/*
New blocks should be skipped if the outer block is skipped,
except TOP ans SUBST block, which open up new environments. Fake
blocks should always be skipped. Rather complicated... :-(
*/
new->skip=current_block?current_block->skip:0;
-
+
/*
Type TOP and SUBST are never skipped
*/
@@ -478,7 +478,7 @@ void parser_push_block( int type )
{
new->skip = 1;
}
-
+
new->job = 0;
new->loop_status=LOOP_NORMAL;
@@ -504,7 +504,7 @@ void parser_pop_block()
bugreport();
return;
}
-
+
current_block = current_block->outer;
halloc_free( old );
}
@@ -512,7 +512,7 @@ void parser_pop_block()
const wchar_t *parser_get_block_desc( int block )
{
int i;
-
+
for( i=0; block_lookup[i].desc; i++ )
{
if( block_lookup[i].type == block )
@@ -650,18 +650,18 @@ void error( int ec, int p, const wchar_t *str, ... )
va_list va;
CHECK( str, );
-
+
if( !err_buff )
err_buff = sb_halloc( global_context );
- sb_clear( err_buff );
+ sb_clear( err_buff );
error_code = ec;
err_pos = p;
va_start( va, str );
-
+
sb_vprintf( err_buff, str, va );
-
+
va_end( va );
}
@@ -690,7 +690,7 @@ static void print_profile( array_list_t *p,
{
return;
}
-
+
me= (profile_element_t *)al_get( p, pos );
if( !me->skipped )
{
@@ -703,7 +703,7 @@ static void print_profile( array_list_t *p,
{
continue;
}
-
+
if( prev->level <= me->level )
{
break;
@@ -725,7 +725,7 @@ static void print_profile( array_list_t *p,
wperror( L"fwprintf" );
return;
}
-
+
for( i=0; ilevel; i++ )
{
if( fwprintf( out, L"-" ) < 0 )
@@ -774,7 +774,7 @@ void parser_destroy()
{
print_profile( &profile_data, 0, f );
}
-
+
if( fclose( f ) )
{
wperror( L"fclose" );
@@ -805,7 +805,7 @@ static void print_errors( string_buffer_t *target, const wchar_t *prefix )
{
CHECK( target, );
CHECK( prefix, );
-
+
if( error_code && err_buff )
{
int tmp;
@@ -830,15 +830,15 @@ static void print_errors_stderr()
{
debug( 0, L"%ls", (wchar_t *)err_buff->buff );
int tmp;
-
+
tmp = current_tokenizer_pos;
current_tokenizer_pos = err_pos;
-
+
fwprintf( stderr, L"%ls", parser_current_line() );
-
+
current_tokenizer_pos=tmp;
}
-
+
}
int eval_args( const wchar_t *line, array_list_t *args )
@@ -854,11 +854,11 @@ int eval_args( const wchar_t *line, array_list_t *args )
CHECK( line, 1 );
CHECK( args, 1 );
-
- proc_push_interactive(0);
+
+ proc_push_interactive(0);
current_tokenizer = &tok;
current_tokenizer_pos = 0;
-
+
tok_init( &tok, line, 0 );
error_code=0;
@@ -870,12 +870,12 @@ int eval_args( const wchar_t *line, array_list_t *args )
case TOK_STRING:
{
wchar_t *tmp = wcsdup(tok_last( &tok ));
-
+
if( !tmp )
{
DIE_MEM();
}
-
+
if( expand_string( 0, tmp, args, 0 ) == EXPAND_ERROR )
{
err_pos=tok_get_pos( &tok );
@@ -883,12 +883,12 @@ int eval_args( const wchar_t *line, array_list_t *args )
}
break;
}
-
+
case TOK_END:
{
break;
}
-
+
case TOK_ERROR:
{
error( SYNTAX_ERROR,
@@ -914,24 +914,24 @@ int eval_args( const wchar_t *line, array_list_t *args )
}
print_errors_stderr();
-
+
tok_destroy( &tok );
-
+
current_tokenizer=previous_tokenizer;
current_tokenizer_pos = previous_pos;
proc_pop_interactive();
-
+
return 1;
}
void parser_stack_trace( block_t *b, string_buffer_t *buff)
{
-
+
/*
Validate input
*/
CHECK( buff, );
-
+
/*
Check if we should end the recursion
*/
@@ -957,7 +957,7 @@ void parser_stack_trace( block_t *b, string_buffer_t *buff)
*/
return;
}
-
+
if( b->type == FUNCTION_CALL || b->type==SOURCE || b->type==SUBST)
{
/*
@@ -999,24 +999,24 @@ void parser_stack_trace( block_t *b, string_buffer_t *buff)
sb_printf( buff,
_(L"\tcalled on standard input,\n") );
}
-
+
if( b->type == FUNCTION_CALL )
- {
+ {
if( b->param2.function_call_process->argv[1] )
{
string_buffer_t tmp;
sb_init( &tmp );
-
+
for( i=1; b->param2.function_call_process->argv[i]; i++ )
{
sb_append( &tmp, i>1?L" ":L"", b->param2.function_call_process->argv[i], (void *)0 );
}
sb_printf( buff, _(L"\twith parameter list '%ls'\n"), (wchar_t *)tmp.buff );
-
+
sb_destroy( &tmp );
}
}
-
+
sb_printf( buff,
L"\n" );
}
@@ -1057,19 +1057,19 @@ int parser_get_lineno()
const wchar_t *function_name;
int lineno;
-
+
/* static const wchar_t *prev_str = 0;
static int i=0;
static int lineno=1;
*/
if( !current_tokenizer )
return -1;
-
+
whole_str = tok_string( current_tokenizer );
if( !whole_str )
return -1;
-
+
lineno = parse_util_lineno( whole_str, current_tokenizer_pos );
if( (function_name = is_function()) )
@@ -1173,7 +1173,7 @@ wchar_t *parser_current_line()
}
// lineno = current_tokenizer_pos;
-
+
current_line_width=printed_width( whole_str+current_line_start,
current_tokenizer_pos-current_line_start );
@@ -1276,7 +1276,7 @@ int parser_is_help( wchar_t *s, int min_match )
len = wcslen(s);
min_match = maxi( min_match, 3 );
-
+
return ( wcscmp( L"-h", s ) == 0 ) ||
( len >= min_match && (wcsncmp( L"--help", s, len ) == 0) );
}
@@ -1311,7 +1311,7 @@ static void parse_job_argument_list( process_t *p,
alternatives are worse.
*/
proc_is_count = (wcscmp( (wchar_t *)al_get( args, 0 ), L"count" )==0);
-
+
while( 1 )
{
@@ -1320,7 +1320,7 @@ static void parse_job_argument_list( process_t *p,
case TOK_PIPE:
{
wchar_t *end;
-
+
if( (p->type == INTERNAL_EXEC) )
{
error( SYNTAX_ERROR,
@@ -1339,13 +1339,13 @@ static void parse_job_argument_list( process_t *p,
tok_last( tok ) );
return;
}
-
+
if( !p->argv )
halloc_register( j, p->argv = list_to_char_arr( args ) );
p->next = halloc( j, sizeof( process_t ) );
tok_next( tok );
-
+
/*
Don't do anything on failiure. parse_job will notice
the error flag and report any errors for us
@@ -1355,12 +1355,12 @@ static void parse_job_argument_list( process_t *p,
is_finished = 1;
break;
}
-
+
case TOK_BACKGROUND:
{
job_set_flag( j, JOB_FOREGROUND, 0 );
}
-
+
case TOK_END:
{
if( !p->argv )
@@ -1469,7 +1469,7 @@ static void parse_job_argument_list( process_t *p,
io_data_t *new_io;
wchar_t *target = 0;
wchar_t *end;
-
+
/*
Don't check redirections in skipped part
@@ -1507,14 +1507,16 @@ static void parse_job_argument_list( process_t *p,
}
else
{
-
+
tok_next( tok );
switch( tok_last_type( tok ) )
{
case TOK_STRING:
{
- target = (wchar_t *)expand_one( j, wcsdup( tok_last( tok ) ), 0);
+ target = (wchar_t *)expand_one( j,
+ wcsdup( tok_last( tok ) ),
+ no_exec ? EXPAND_SKIP_VARIABLES : 0);
if( target == 0 && error_code == 0 )
{
@@ -1580,14 +1582,14 @@ static void parse_job_argument_list( process_t *p,
else
{
wchar_t *end;
-
+
new_io->io_mode = IO_FD;
errno = 0;
-
+
new_io->param1.old_fd = wcstol( target,
&end,
10 );
-
+
if( ( new_io->param1.old_fd < 0 ) ||
errno || *end )
{
@@ -1602,12 +1604,12 @@ static void parse_job_argument_list( process_t *p,
break;
}
}
-
+
}
}
j->io = io_add( j->io, new_io );
-
+
}
break;
@@ -1668,11 +1670,11 @@ static void parse_job_argument_list( process_t *p,
if( !b )
return;
print_block_stack( b->outer );
-
- debug( 0, L"Block type %ls, skip: %d", parser_get_block_desc( b->type ), b->skip );
+
+ debug( 0, L"Block type %ls, skip: %d", parser_get_block_desc( b->type ), b->skip );
}
*/
-
+
/**
Fully parse a single job. Does not call exec on it, but any command substitutions in the job will be executed.
@@ -1693,7 +1695,7 @@ static int parse_job( process_t *p,
int is_new_block=0; // Does this command create a new block?
block_t *prev_block = current_block;
- int prev_tokenizer_pos = current_tokenizer_pos;
+ int prev_tokenizer_pos = current_tokenizer_pos;
current_tokenizer_pos = tok_get_pos( tok );
@@ -1702,7 +1704,7 @@ static int parse_job( process_t *p,
wchar_t *nxt=0;
int consumed = 0; // Set to one if the command requires a second command, like e.g. while does
int mark; // Use to save the position of the beginning of the token
-
+
switch( tok_last_type( tok ))
{
case TOK_STRING:
@@ -1710,15 +1712,15 @@ static int parse_job( process_t *p,
nxt = expand_one( j,
wcsdup(tok_last( tok )),
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES);
-
+
if( nxt == 0 )
{
error( SYNTAX_ERROR,
tok_get_pos( tok ),
ILLEGAL_CMD_ERR_MSG,
tok_last( tok ) );
-
- current_tokenizer_pos = prev_tokenizer_pos;
+
+ current_tokenizer_pos = prev_tokenizer_pos;
return 0;
}
break;
@@ -1731,7 +1733,7 @@ static int parse_job( process_t *p,
TOK_ERR_MSG,
tok_last(tok) );
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
return 0;
}
@@ -1753,7 +1755,7 @@ static int parse_job( process_t *p,
tok_get_desc( tok_last_type(tok) ) );
}
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
return 0;
}
@@ -1764,11 +1766,11 @@ static int parse_job( process_t *p,
CMD_ERR_MSG,
tok_get_desc( tok_last_type(tok) ) );
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
return 0;
}
}
-
+
mark = tok_get_pos( tok );
if( contains( nxt,
@@ -1778,22 +1780,22 @@ static int parse_job( process_t *p,
L"and",
L"or",
L"exec" ) )
- {
+ {
int sw;
int is_exec = (wcscmp( L"exec", nxt )==0);
-
+
if( is_exec && (p != j->first_process) )
{
error( SYNTAX_ERROR,
tok_get_pos( tok ),
EXEC_ERR_MSG );
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
return 0;
}
tok_next( tok );
sw = parser_keywords_is_switch( tok_last( tok ) );
-
+
if( sw == ARG_SWITCH )
{
tok_set_pos( tok, mark);
@@ -1804,7 +1806,7 @@ static int parse_job( process_t *p,
{
tok_next( tok );
}
-
+
consumed=1;
if( ( wcscmp( L"command", nxt )==0 ) ||
@@ -1815,11 +1817,11 @@ static int parse_job( process_t *p,
{
use_builtin = 0;
use_command = 1;
- }
+ }
else
{
- use_builtin = 1;
- use_command = 0;
+ use_builtin = 1;
+ use_command = 0;
}
}
else if( wcscmp( L"not", nxt )==0 )
@@ -1839,7 +1841,7 @@ static int parse_job( process_t *p,
use_function = 0;
use_builtin=0;
p->type=INTERNAL_EXEC;
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
}
}
}
@@ -1882,7 +1884,7 @@ static int parse_job( process_t *p,
current_block->tok_pos = mark;
is_new_block=1;
- consumed=1;
+ consumed=1;
}
/*
@@ -1895,7 +1897,7 @@ static int parse_job( process_t *p,
*/
continue;
}
-
+
if( use_function && !current_block->skip )
{
int nxt_forbidden=0;
@@ -1910,11 +1912,11 @@ static int parse_job( process_t *p,
block scopes are pushed on function invocation changes,
then this check will break.
*/
- if( ( current_block->type == TOP ) &&
- ( current_block->outer ) &&
+ if( ( current_block->type == TOP ) &&
+ ( current_block->outer ) &&
( current_block->outer->type == FUNCTION_CALL ) )
is_function_call = 1;
-
+
/*
If we are directly in a function, and this is the first
command of the block, then the function we are executing
@@ -1926,7 +1928,7 @@ static int parse_job( process_t *p,
forbid = (wchar_t *)(al_get_count( forbidden_function)?al_peek( forbidden_function ):0);
nxt_forbidden = forbid && (wcscmp( forbid, nxt) == 0 );
}
-
+
if( !nxt_forbidden && function_exists( nxt ) )
{
/*
@@ -1958,7 +1960,7 @@ static int parse_job( process_t *p,
is_new_block |= parser_keywords_is_block( (wchar_t *)al_get( args, 0 ) );
}
}
-
+
if( (!p->type || (p->type == INTERNAL_EXEC) ) )
{
/*
@@ -1972,10 +1974,10 @@ static int parse_job( process_t *p,
else
{
int err;
-
+
p->actual_cmd = path_get_path( j, (wchar_t *)al_get( args, 0 ) );
err = errno;
-
+
/*
Check if the specified command exists
*/
@@ -2010,10 +2012,10 @@ static int parse_job( process_t *p,
{
int tmp;
wchar_t *cmd = (wchar_t *)al_get( args, 0 );
-
- /*
+
+ /*
We couldn't find the specified command.
-
+
What we want to happen now is that the
specified job won't get executed, and an
error message is printed on-screen, but
@@ -2033,13 +2035,13 @@ static int parse_job( process_t *p,
wchar_t *cpy = halloc_wcsdup( j, cmd );
wchar_t *valpart = wcschr( cpy, L'=' );
*valpart++=0;
-
+
debug( 0,
COMMAND_ASSIGN_ERR_MSG,
cmd,
cpy,
valpart);
-
+
}
else if(cmd[0]==L'$')
{
@@ -2057,7 +2059,7 @@ static int parse_job( process_t *p,
debug( 0,
_(L"Variables may not be used as commands. Instead, define a function. See the help section for the function command by typing 'help function'." ),
cmd );
- }
+ }
}
else if(wcschr( cmd, L'$' ))
{
@@ -2073,17 +2075,17 @@ static int parse_job( process_t *p,
cmd?cmd:L"UNKNOWN" );
}
else
- {
+ {
debug( 0,
_(L"Unknown command '%ls'"),
cmd?cmd:L"UNKNOWN" );
}
-
+
tmp = current_tokenizer_pos;
current_tokenizer_pos = tok_get_pos(tok);
-
+
fwprintf( stderr, L"%ls", parser_current_line() );
-
+
current_tokenizer_pos=tmp;
job_set_flag( j, JOB_SKIP, 1 );
@@ -2093,7 +2095,7 @@ static int parse_job( process_t *p,
}
}
}
-
+
if( (p->type == EXTERNAL) && !use_command )
{
error( SYNTAX_ERROR,
@@ -2102,11 +2104,11 @@ static int parse_job( process_t *p,
al_get( args, al_get_count( args ) -1 ) );
}
}
-
-
+
+
if( is_new_block )
{
-
+
const wchar_t *end=parser_find_end( tok_string( tok ) +
current_tokenizer_pos );
tokenizer subtok;
@@ -2117,26 +2119,26 @@ static int parse_job( process_t *p,
error( SYNTAX_ERROR,
tok_get_pos( tok ),
BLOCK_END_ERR_MSG );
-
+
}
else
{
-
+
if( !make_sub_block )
{
int done=0;
-
- for( tok_init( &subtok, end, 0 );
- !done && tok_has_next( &subtok );
+
+ for( tok_init( &subtok, end, 0 );
+ !done && tok_has_next( &subtok );
tok_next( &subtok ) )
{
-
+
switch( tok_last_type( &subtok ) )
{
case TOK_END:
done = 1;
break;
-
+
case TOK_REDIRECT_OUT:
case TOK_REDIRECT_NOCLOB:
case TOK_REDIRECT_APPEND:
@@ -2148,12 +2150,12 @@ static int parse_job( process_t *p,
make_sub_block = 1;
break;
}
-
+
case TOK_STRING:
{
break;
}
-
+
default:
{
done = 1;
@@ -2163,21 +2165,21 @@ static int parse_job( process_t *p,
}
}
}
-
+
tok_destroy( &subtok );
}
-
+
if( make_sub_block )
{
-
+
int end_pos = end-tok_string( tok );
wchar_t *sub_block= halloc_wcsndup( j,
tok_string( tok ) + current_tokenizer_pos,
end_pos - current_tokenizer_pos);
-
+
p->type = INTERNAL_BLOCK;
al_set( args, 0, sub_block );
-
+
tok_set_pos( tok,
end_pos );
@@ -2189,14 +2191,14 @@ static int parse_job( process_t *p,
}
else tok_next( tok );
}
-
+
}
else tok_next( tok );
if( !error_code )
{
if( p->type == INTERNAL_BUILTIN && parser_keywords_skip_arguments( (wchar_t *)al_get(args, 0) ) )
- {
+ {
if( !p->argv )
halloc_register( j, p->argv = list_to_char_arr( args ) );
}
@@ -2224,7 +2226,7 @@ static int parse_job( process_t *p,
parser_pop_block();
}
}
- current_tokenizer_pos = prev_tokenizer_pos;
+ current_tokenizer_pos = prev_tokenizer_pos;
return !error_code;
}
@@ -2298,7 +2300,7 @@ static void eval_job( tokenizer *tok )
profile_element_t *p=0;
int skip = 0;
int job_begin_pos, prev_tokenizer_pos;
-
+
if( profile )
{
p=malloc( sizeof(profile_element_t));
@@ -2319,9 +2321,9 @@ static void eval_job( tokenizer *tok )
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) );
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) && (!is_subshell && !is_event));
job_set_flag( j, JOB_SKIP_NOTIFICATION, is_subshell || is_block || is_event || (!is_interactive));
-
+
current_block->job = j;
-
+
if( is_interactive )
{
if( tcgetattr (0, &j->tmodes) )
@@ -2336,7 +2338,7 @@ static void eval_job( tokenizer *tok )
j->first_process = halloc( j, sizeof( process_t ) );
job_begin_pos = tok_get_pos( tok );
-
+
if( parse_job( j->first_process, j, tok ) &&
j->first_process->argv )
{
@@ -2361,21 +2363,21 @@ static void eval_job( tokenizer *tok )
p->cmd = wcsdup( j->command );
p->skipped=current_block->skip;
}
-
+
skip |= current_block->skip;
skip |= job_get_flag( j, JOB_WILDCARD_ERROR );
skip |= job_get_flag( j, JOB_SKIP );
-
+
if(!skip )
{
int was_builtin = 0;
// if( j->first_process->type==INTERNAL_BUILTIN && !j->first_process->next)
// was_builtin = 1;
prev_tokenizer_pos = current_tokenizer_pos;
- current_tokenizer_pos = job_begin_pos;
+ current_tokenizer_pos = job_begin_pos;
exec( j );
current_tokenizer_pos = prev_tokenizer_pos;
-
+
/* Only external commands require a new fishd barrier */
if( !was_builtin )
proc_had_barrier=0;
@@ -2500,9 +2502,9 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
{
forbidden_function = al_new();
}
-
+
CHECK_BLOCK( 1 );
-
+
forbid_count = al_get_count( forbidden_function );
block_io = io;
@@ -2538,7 +2540,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
error_code = 0;
- event_fire( 0 );
+ event_fire( NULL );
while( tok_has_next( current_tokenizer ) &&
!error_code &&
@@ -2546,7 +2548,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
!exit_status() )
{
eval_job( current_tokenizer );
- event_fire( 0 );
+ event_fire( NULL );
}
int prev_block_type = current_block->type;
@@ -2623,7 +2625,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
int parser_get_block_type( const wchar_t *cmd )
{
int i;
-
+
for( i=0; block_lookup[i].desc; i++ )
{
if( block_lookup[i].name && (wcscmp( block_lookup[i].name, cmd ) == 0) )
@@ -2640,7 +2642,7 @@ int parser_get_block_type( const wchar_t *cmd )
const wchar_t *parser_get_block_command( int type )
{
int i;
-
+
for( i=0; block_lookup[i].desc; i++ )
{
if( block_lookup[i].type == type )
@@ -2661,15 +2663,15 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
wchar_t *unesc;
wchar_t *pos;
int err=0;
-
+
wchar_t *paran_begin, *paran_end;
wchar_t *arg_cpy;
int do_loop = 1;
-
+
CHECK( arg, 1 );
-
+
arg_cpy = wcsdup( arg );
-
+
while( do_loop )
{
switch( parse_util_locate_cmdsubst(arg_cpy,
@@ -2688,37 +2690,37 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
}
free( arg_cpy );
return 1;
-
+
case 0:
do_loop = 0;
break;
case 1:
{
-
+
wchar_t *subst = wcsndup( paran_begin+1, paran_end-paran_begin-1 );
string_buffer_t tmp;
sb_init( &tmp );
-
+
sb_append_substring( &tmp, arg_cpy, paran_begin - arg_cpy);
sb_append_char( &tmp, INTERNAL_SEPARATOR);
sb_append( &tmp, paran_end+1);
-
+
// debug( 1, L"%ls -> %ls %ls", arg_cpy, subst, tmp.buff );
-
+
err |= parser_test( subst, 0, out, prefix );
-
+
free( subst );
free( arg_cpy );
arg_cpy = (wchar_t *)tmp.buff;
-
+
/*
Do _not_ call sb_destroy on this stringbuffer - it's
buffer is used as the new 'arg_cpy'. It is free'd at
the end of the loop.
*/
break;
- }
+ }
}
}
@@ -2735,7 +2737,7 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
return 1;
}
else
- {
+ {
/*
Check for invalid variable expansions
*/
@@ -2747,7 +2749,7 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
case VARIABLE_EXPAND_SINGLE:
{
wchar_t n = *(pos+1);
-
+
if( n != VARIABLE_EXPAND &&
n != VARIABLE_EXPAND_SINGLE &&
!wcsvarchr(n) )
@@ -2759,18 +2761,18 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
print_errors( out, prefix);
}
}
-
+
break;
}
- }
+ }
}
}
free( arg_cpy );
-
+
free( unesc );
return err;
-
+
}
int parser_test_args(const wchar_t * buff,
@@ -2781,11 +2783,11 @@ int parser_test_args(const wchar_t * buff,
int previous_pos = current_tokenizer_pos;
int do_loop = 1;
int err = 0;
-
+
CHECK( buff, 1 );
-
+
current_tokenizer = &tok;
-
+
for( tok_init( &tok, buff, 0 );
do_loop && tok_has_next( &tok );
tok_next( &tok ) )
@@ -2793,18 +2795,18 @@ int parser_test_args(const wchar_t * buff,
current_tokenizer_pos = tok_get_pos( &tok );
switch( tok_last_type( &tok ) )
{
-
+
case TOK_STRING:
{
err |= parser_test_argument( tok_last( &tok ), out, prefix, tok_get_pos( &tok ) );
break;
}
-
+
case TOK_END:
{
break;
}
-
+
case TOK_ERROR:
{
if( out )
@@ -2819,7 +2821,7 @@ int parser_test_args(const wchar_t * buff,
do_loop=0;
break;
}
-
+
default:
{
if( out )
@@ -2830,44 +2832,44 @@ int parser_test_args(const wchar_t * buff,
tok_get_desc( tok_last_type(&tok)) );
print_errors( out, prefix );
}
- err=1;
+ err=1;
do_loop=0;
break;
- }
+ }
}
}
-
+
tok_destroy( &tok );
-
+
current_tokenizer=previous_tokenizer;
current_tokenizer_pos = previous_pos;
-
+
error_code=0;
-
+
return err;
}
int parser_test( const wchar_t * buff,
- int *block_level,
+ int *block_level,
string_buffer_t *out,
const wchar_t *prefix )
{
tokenizer tok;
- /*
+ /*
Set to one if a command name has been given for the currently
- parsed process specification
+ parsed process specification
*/
- int had_cmd=0;
+ int had_cmd=0;
int count = 0;
int err=0;
int unfinished = 0;
-
+
tokenizer *previous_tokenizer=current_tokenizer;
int previous_pos=current_tokenizer_pos;
static int block_pos[BLOCK_MAX_COUNT];
static int block_type[BLOCK_MAX_COUNT];
int res = 0;
-
+
/*
Set to 1 if the current command is inside a pipeline
*/
@@ -2878,10 +2880,10 @@ int parser_test( const wchar_t * buff,
*/
int forbid_pipeline = 0;
- /*
- Set to one if an additional process specification is needed
+ /*
+ Set to one if an additional process specification is needed
*/
- int needs_cmd=0;
+ int needs_cmd=0;
/*
halloc context used for calls to expand() and other memory
@@ -2896,12 +2898,12 @@ int parser_test( const wchar_t * buff,
expand to more/less arguemtns then 1.
*/
int arg_count=0;
-
+
/*
The currently validated command.
*/
wchar_t *cmd=0;
-
+
CHECK( buff, 1 );
if( block_level )
@@ -2912,9 +2914,9 @@ int parser_test( const wchar_t * buff,
{
block_level[i] = -1;
}
-
+
}
-
+
context = halloc( 0, 0 );
current_tokenizer = &tok;
@@ -2926,7 +2928,7 @@ int parser_test( const wchar_t * buff,
int last_type = tok_last_type( &tok );
int end_of_cmd = 0;
-
+
switch( last_type )
{
case TOK_STRING:
@@ -2937,9 +2939,9 @@ int parser_test( const wchar_t * buff,
int mark = tok_get_pos( &tok );
had_cmd = 1;
arg_count=0;
-
- if( !(cmd = expand_one( context,
- wcsdup( tok_last( &tok ) ),
+
+ if( !(cmd = expand_one( context,
+ wcsdup( tok_last( &tok ) ),
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES ) ) )
{
err=1;
@@ -2949,12 +2951,12 @@ int parser_test( const wchar_t * buff,
tok_get_pos( &tok ),
ILLEGAL_CMD_ERR_MSG,
tok_last( &tok ) );
-
+
print_errors( out, prefix );
}
break;
}
-
+
if( needs_cmd )
{
/*
@@ -2971,14 +2973,14 @@ int parser_test( const wchar_t * buff,
error( SYNTAX_ERROR,
tok_get_pos( &tok ),
COND_ERR_MSG );
-
+
print_errors( out, prefix );
}
}
-
+
needs_cmd=0;
}
-
+
/*
Decrement block count on end command
*/
@@ -2990,7 +2992,7 @@ int parser_test( const wchar_t * buff,
}
is_else = wcscmp(cmd, L"else")==0;
-
+
/*
Store the block level. This needs to be done
_after_ checking for end commands, but _before_
@@ -3000,7 +3002,7 @@ int parser_test( const wchar_t * buff,
{
block_level[tok_get_pos( &tok )] = count + (is_else?-1:0);
}
-
+
/*
Handle block commands
*/
@@ -3035,7 +3037,7 @@ int parser_test( const wchar_t * buff,
needs_cmd = 1;
had_cmd = 0;
}
-
+
if( contains( cmd,
L"or",
L"and" ) )
@@ -3057,7 +3059,7 @@ int parser_test( const wchar_t * buff,
}
}
}
-
+
/*
There are a lot of situations where pipelines
are forbidden, including when using the exec
@@ -3133,22 +3135,22 @@ int parser_test( const wchar_t * buff,
wchar_t *first_arg;
int old_pos = tok_get_pos( &tok );
int is_help = 0;
-
+
tok_next( &tok );
if( tok_last_type( &tok ) == TOK_STRING )
{
first_arg = expand_one( context,
- wcsdup( tok_last( &tok ) ),
+ wcsdup( tok_last( &tok ) ),
EXPAND_SKIP_CMDSUBST);
-
+
if( first_arg && parser_is_help( first_arg, 3) )
{
is_help = 1;
}
}
-
+
tok_set_pos( &tok, old_pos );
-
+
if( !is_help )
{
err=1;
@@ -3165,7 +3167,7 @@ int parser_test( const wchar_t * buff,
}
-
+
/*
Test that break and continue are only used within loop blocks
@@ -3195,22 +3197,22 @@ int parser_test( const wchar_t * buff,
wchar_t *first_arg;
int old_pos = tok_get_pos( &tok );
int is_help = 0;
-
+
tok_next( &tok );
if( tok_last_type( &tok ) == TOK_STRING )
{
first_arg = expand_one( context,
- wcsdup( tok_last( &tok ) ),
+ wcsdup( tok_last( &tok ) ),
EXPAND_SKIP_CMDSUBST);
-
- if( first_arg && parser_is_help( first_arg, 3 ) )
+
+ if( first_arg && parser_is_help( first_arg, 3 ) )
{
is_help = 1;
}
}
-
+
tok_set_pos( &tok, old_pos );
-
+
if( !is_help )
{
err=1;
@@ -3224,7 +3226,7 @@ int parser_test( const wchar_t * buff,
}
}
}
-
+
}
/*
@@ -3256,7 +3258,7 @@ int parser_test( const wchar_t * buff,
if( out )
{
wchar_t *h;
-
+
error( SYNTAX_ERROR,
tok_get_pos( &tok ),
INVALID_END_ERR_MSG );
@@ -3266,12 +3268,12 @@ int parser_test( const wchar_t * buff,
sb_printf( out, L"%ls", h );
}
}
-
+
}
else
{
err |= parser_test_argument( tok_last( &tok ), out, prefix, tok_get_pos( &tok ) );
-
+
/*
If possible, keep track of number of supplied arguments
*/
@@ -3283,10 +3285,10 @@ int parser_test( const wchar_t * buff,
{
arg_count = -1;
}
-
+
if( cmd )
{
-
+
/*
Try to make sure the second argument to 'for' is 'in'
*/
@@ -3294,12 +3296,12 @@ int parser_test( const wchar_t * buff,
{
if( arg_count == 1 )
{
-
+
if( wcsvarname( tok_last( &tok )) )
{
-
+
err = 1;
-
+
if( out )
{
error( SYNTAX_ERROR,
@@ -3307,25 +3309,25 @@ int parser_test( const wchar_t * buff,
BUILTIN_FOR_ERR_NAME,
L"for",
tok_last( &tok ) );
-
+
print_errors( out, prefix );
- }
+ }
}
-
+
}
else if( arg_count == 2 )
{
if( wcscmp( tok_last( &tok ), L"in" ) != 0 )
{
err = 1;
-
+
if( out )
{
error( SYNTAX_ERROR,
tok_get_pos( &tok ),
BUILTIN_FOR_ERR_IN,
L"for" );
-
+
print_errors( out, prefix );
}
}
@@ -3334,7 +3336,7 @@ int parser_test( const wchar_t * buff,
}
}
-
+
break;
}
@@ -3377,7 +3379,7 @@ int parser_test( const wchar_t * buff,
is_pipeline=0;
forbid_pipeline=0;
end_of_cmd = 1;
-
+
break;
}
@@ -3394,7 +3396,7 @@ int parser_test( const wchar_t * buff,
tok_get_pos( &tok ),
CMD_OR_ERR_MSG,
tok_get_desc( tok_last_type(&tok) ) );
-
+
}
else
{
@@ -3403,7 +3405,7 @@ int parser_test( const wchar_t * buff,
CMD_ERR_MSG,
tok_get_desc( tok_last_type(&tok)));
}
-
+
print_errors( out, prefix );
}
}
@@ -3415,7 +3417,7 @@ int parser_test( const wchar_t * buff,
error( SYNTAX_ERROR,
tok_get_pos( &tok ),
EXEC_ERR_MSG );
-
+
print_errors( out, prefix );
}
}
@@ -3425,11 +3427,11 @@ int parser_test( const wchar_t * buff,
is_pipeline=1;
had_cmd=0;
end_of_cmd = 1;
-
+
}
break;
}
-
+
case TOK_BACKGROUND:
{
if( !had_cmd )
@@ -3443,7 +3445,7 @@ int parser_test( const wchar_t * buff,
tok_get_pos( &tok ),
CMD_AND_ERR_MSG,
tok_get_desc( tok_last_type(&tok) ) );
-
+
}
else
{
@@ -3452,14 +3454,14 @@ int parser_test( const wchar_t * buff,
CMD_ERR_MSG,
tok_get_desc( tok_last_type(&tok)));
}
-
+
print_errors( out, prefix );
}
}
-
+
had_cmd = 0;
end_of_cmd = 1;
-
+
break;
}
@@ -3478,12 +3480,12 @@ int parser_test( const wchar_t * buff,
tok_get_pos( &tok ),
TOK_ERR_MSG,
tok_last(&tok) );
-
-
+
+
print_errors( out, prefix );
}
}
-
+
break;
}
@@ -3497,7 +3499,7 @@ int parser_test( const wchar_t * buff,
Not enough arguments to the for builtin
*/
err = 1;
-
+
if( out )
{
error( SYNTAX_ERROR,
@@ -3505,18 +3507,18 @@ int parser_test( const wchar_t * buff,
BUILTIN_FOR_ERR_COUNT,
L"for",
arg_count );
-
+
print_errors( out, prefix );
}
}
-
+
}
-
+
}
-
+
if( !tok_has_next( &tok ) )
break;
-
+
}
if( needs_cmd )
@@ -3537,7 +3539,7 @@ int parser_test( const wchar_t * buff,
{
const wchar_t *h;
const wchar_t *cmd;
-
+
error( SYNTAX_ERROR,
block_pos[count-1],
BLOCK_END_ERR_MSG );
@@ -3553,8 +3555,8 @@ int parser_test( const wchar_t * buff,
sb_printf( out, L"%ls", h );
}
}
-
-
+
+
}
/*
@@ -3599,9 +3601,9 @@ int parser_test( const wchar_t * buff,
break;
block_level[j] = count;
}
-
- }
+
+ }
/*
Calculate exit status
@@ -3618,18 +3620,18 @@ int parser_test( const wchar_t * buff,
/*
Cleanup
*/
-
+
halloc_free( context );
-
+
tok_destroy( &tok );
current_tokenizer=previous_tokenizer;
current_tokenizer_pos = previous_pos;
-
+
error_code=0;
-
+
return res;
-
+
}
diff --git a/parser.h b/parser.h
index 0c82f2aae..3cd6e31da 100644
--- a/parser.h
+++ b/parser.h
@@ -1,5 +1,5 @@
/** \file parser.h
- The fish parser.
+ The fish parser.
*/
#ifndef FISH_PARSER_H
@@ -24,12 +24,12 @@ typedef struct event_block
The types of events to block. This is interpreted as a bitset
whete the value is 1 for every bit corresponding to a blocked
event type. For example, if EVENT_VARIABLE type events should
- be blocked, (type & 1<&%d'", c, fd );
-
+
if( printed < CMD_LEN )
{
if( (system( cmd ) == -1) )
{
write_loop(2, HELP_ERR, strlen(HELP_ERR));
}
-
+
}
-
+
}
diff --git a/print_help.h b/print_help.h
index 570b43a6a..b57459b02 100644
--- a/print_help.h
+++ b/print_help.h
@@ -6,7 +6,7 @@
#ifndef FISH_PRINT_HELP_H
#define FISH_PRINT_HELP_H
-/**
+/**
Print help message for the specified command
*/
diff --git a/proc.c b/proc.c
index 09d018bb1..b98de61fc 100644
--- a/proc.c
+++ b/proc.c
@@ -7,7 +7,7 @@ will call proc to create representations of the running jobs as
needed.
Some of the code in this file is based on code from the Glibc manual.
-
+
*/
#include "config.h"
@@ -76,7 +76,7 @@ Some of the code in this file is based on code from the Glibc manual.
#include "output.h"
/**
- Size of message buffer
+ Size of message buffer
*/
#define MESS_SIZE 256
@@ -85,13 +85,13 @@ Some of the code in this file is based on code from the Glibc manual.
*/
#define BUFFER_SIZE 4096
-/**
- Status of last process to exit
+/**
+ Status of last process to exit
*/
static int last_status=0;
/**
- Signal flag
+ Signal flag
*/
static sig_atomic_t got_signal=0;
@@ -139,7 +139,7 @@ void proc_init()
/**
- Remove job from list of jobs
+ Remove job from list of jobs
*/
static int job_remove( job_t *j )
{
@@ -156,7 +156,7 @@ static int job_remove( job_t *j )
sanity_lose();
return 0;
}
-
+
if( prev == 0 )
first_job = j->next;
else
@@ -184,7 +184,7 @@ void proc_destroy()
{
debug( 2, L"freeing leaked job %ls", first_job->command );
job_free( first_job );
- }
+ }
}
void proc_set_last_status( int s )
@@ -201,7 +201,7 @@ job_t *job_create()
{
int free_id=1;
job_t *res;
-
+
while( job_get( free_id ) != 0 )
free_id++;
res = halloc( 0, sizeof(job_t) );
@@ -209,17 +209,17 @@ job_t *job_create()
res->job_id = free_id;
first_job = res;
- job_set_flag( res,
- JOB_CONTROL,
- (job_control_mode==JOB_CONTROL_ALL) ||
+ job_set_flag( res,
+ JOB_CONTROL,
+ (job_control_mode==JOB_CONTROL_ALL) ||
((job_control_mode == JOB_CONTROL_INTERACTIVE) && (is_interactive)) );
// if( res->job_id > 2 )
-// fwprintf( stderr, L"Create job %d\n", res->job_id );
+// fwprintf( stderr, L"Create job %d\n", res->job_id );
return res;
}
-
+
job_t *job_get( int id )
{
job_t *res = first_job;
@@ -227,7 +227,7 @@ job_t *job_get( int id )
{
return res;
}
-
+
while( res != 0 )
{
if( res->job_id == id )
@@ -240,7 +240,7 @@ job_t *job_get( int id )
job_t *job_get_from_pid( int pid )
{
job_t *res = first_job;
-
+
while( res != 0 )
{
if( res->pgid == pid )
@@ -251,8 +251,8 @@ job_t *job_get_from_pid( int pid )
}
-/*
- Return true if all processes in the job have stopped or completed.
+/*
+ Return true if all processes in the job have stopped or completed.
\param j the job to test
*/
@@ -271,20 +271,20 @@ int job_is_stopped( const job_t *j )
}
-/*
- Return true if the last processes in the job has completed.
+/*
+ Return true if the last processes in the job has completed.
\param j the job to test
*/
int job_is_completed( const job_t *j )
{
process_t *p;
-
+
for (p = j->first_process; p->next; p = p->next)
;
-
+
return p->completed;
-
+
}
void job_set_flag( job_t *j, int flag, int set )
@@ -301,10 +301,10 @@ int job_get_flag( job_t *j, int flag )
}
int job_signal( job_t *j, int signal )
-{
+{
pid_t my_pid = getpid();
int res = 0;
-
+
if( j->pgid != my_pid )
{
res = killpg( j->pgid, SIGHUP );
@@ -337,7 +337,7 @@ int job_signal( job_t *j, int signal )
/**
Store the status of the process pid that was returned by waitpid.
- Return 0 if all went well, nonzero otherwise.
+ Return 0 if all went well, nonzero otherwise.
*/
static void mark_process_status( job_t *j,
process_t *p,
@@ -345,19 +345,19 @@ static void mark_process_status( job_t *j,
{
// debug( 0, L"Process %ls %ls", p->argv[0], WIFSTOPPED (status)?L"stopped":(WIFEXITED( status )?L"exited":(WIFSIGNALED( status )?L"signaled to exit":L"BLARGH")) );
p->status = status;
-
+
if (WIFSTOPPED (status))
{
p->stopped = 1;
}
- else if (WIFSIGNALED(status) || WIFEXITED(status))
+ else if (WIFSIGNALED(status) || WIFEXITED(status))
{
p->completed = 1;
}
else
{
ssize_t ignore;
-
+
/* This should never be reached */
p->completed = 1;
@@ -388,10 +388,10 @@ static void handle_child_status( pid_t pid, int status )
int found_proc = 0;
job_t *j=0;
process_t *p=0;
-// char mess[MESS_SIZE];
- found_proc = 0;
+// char mess[MESS_SIZE];
+ found_proc = 0;
/*
- snprintf( mess,
+ snprintf( mess,
MESS_SIZE,
"Process %d\n",
(int) pid );
@@ -410,8 +410,8 @@ static void handle_child_status( pid_t pid, int status )
"Process %d is %ls from job %ls\n",
(int) pid, p->actual_cmd, j->command );
write( 2, mess, strlen(mess ));
-*/
-
+*/
+
mark_process_status ( j, p, status);
if( p->completed && prev != 0 )
{
@@ -420,7 +420,7 @@ static void handle_child_status( pid_t pid, int status )
/* snprintf( mess,
MESS_SIZE,
"Kill previously uncompleted process %ls (%d)\n",
- prev->actual_cmd,
+ prev->actual_cmd,
prev->pid );
write( 2, mess, strlen(mess ));
*/
@@ -435,15 +435,15 @@ static void handle_child_status( pid_t pid, int status )
}
- if( WIFSIGNALED( status ) &&
- ( WTERMSIG(status)==SIGINT ||
+ if( WIFSIGNALED( status ) &&
+ ( WTERMSIG(status)==SIGINT ||
WTERMSIG(status)==SIGQUIT ) )
{
if( !is_interactive_session )
- {
+ {
struct sigaction act;
sigemptyset( & act.sa_mask );
- act.sa_flags=0;
+ act.sa_flags=0;
act.sa_handler=SIG_DFL;
sigaction( SIGINT, &act, 0 );
sigaction( SIGQUIT, &act, 0 );
@@ -458,34 +458,34 @@ static void handle_child_status( pid_t pid, int status )
{
c->skip=1;
c=c->outer;
- }
- }
+ }
+ }
}
}
-
+
if( !found_proc )
{
- /*
+ /*
A child we lost track of?
-
+
There have been bugs in both subshell handling and in
builtin handling that have caused this previously...
*/
-/* snprintf( mess,
+/* snprintf( mess,
MESS_SIZE,
"Process %d not found by %d\n",
(int) pid, (int)getpid() );
write( 2, mess, strlen(mess ));
*/
- }
+ }
return;
}
void job_handle_signal ( int signal, siginfo_t *info, void *con )
{
-
+
int status;
pid_t pid;
int errno_old = errno;
@@ -503,19 +503,19 @@ void job_handle_signal ( int signal, siginfo_t *info, void *con )
{
errno=errno_old;
return;
- }
+ }
default:
handle_child_status( pid, status );
break;
}
- }
+ }
kill( 0, SIGIO );
errno=errno_old;
}
-/**
- Format information about job status for the user to look at.
+/**
+ Format information about job status for the user to look at.
\param j the job to test
\param status a string description of the job exit type
@@ -531,46 +531,46 @@ static void format_job_info( const job_t *j, const wchar_t *status )
void proc_fire_event( const wchar_t *msg, int type, pid_t pid, int status )
{
-
+
event.type=type;
event.param1.pid = pid;
-
- al_push( &event.arguments, msg );
+
+ al_push( &event.arguments, msg );
sb_printf( &event_pid, L"%d", pid );
al_push( &event.arguments, event_pid.buff );
-
- sb_printf( &event_status, L"%d", status );
+
+ sb_printf( &event_status, L"%d", status );
al_push( &event.arguments, event_status.buff );
event_fire( &event );
al_truncate( &event.arguments, 0 );
- sb_clear( &event_pid );
- sb_clear( &event_status );
-}
+ sb_clear( &event_pid );
+ sb_clear( &event_status );
+}
int job_reap( int interactive )
{
- job_t *j, *jnext;
+ job_t *j, *jnext;
int found=0;
-
+
static int locked = 0;
-
- locked++;
-
+
+ locked++;
+
/*
job_read may fire an event handler, we do not want to call
ourselves recursively (to avoid infinite recursion).
*/
if( locked>1 )
return 0;
-
+
for( j=first_job; j; j=jnext)
- {
+ {
process_t *p;
jnext = j->next;
-
+
/*
If we are reaping only jobs who do not need status messages
sent to the console, do not consider reaping jobs that need
@@ -580,28 +580,28 @@ int job_reap( int interactive )
{
continue;
}
-
+
for( p=j->first_process; p; p=p->next )
{
int s;
if( !p->completed )
continue;
-
+
if( !p->pid )
- continue;
-
+ continue;
+
s = p->status;
-
- proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, p->pid, ( WIFSIGNALED(s)?-1:WEXITSTATUS( s )) );
-
+
+ proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, p->pid, ( WIFSIGNALED(s)?-1:WEXITSTATUS( s )) );
+
if( WIFSIGNALED(s) )
{
- /*
+ /*
Ignore signal SIGPIPE.We issue it ourselves to the pipe
writer when the pipe reader dies.
*/
if( WTERMSIG(s) != SIGPIPE )
- {
+ {
int proc_is_job = ((p==j->first_process) && (p->next == 0));
if( proc_is_job )
job_set_flag( j, JOB_NOTIFIED, 1 );
@@ -611,7 +611,7 @@ int job_reap( int interactive )
fwprintf( stdout,
_( L"%ls: Job %d, \'%ls\' terminated by signal %ls (%ls)" ),
program_name,
- j->job_id,
+ j->job_id,
j->command,
sig2wcs(WTERMSIG(p->status)),
signal_get_desc( WTERMSIG(p->status) ) );
@@ -627,43 +627,43 @@ int job_reap( int interactive )
signal_get_desc( WTERMSIG(p->status) ) );
tputs(clr_eol,1,&writeb);
fwprintf (stdout, L"\n" );
- found=1;
+ found=1;
}
-
- /*
+
+ /*
Clear status so it is not reported more than once
*/
p->status = 0;
}
- }
+ }
}
-
- /*
+
+ /*
If all processes have completed, tell the user the job has
- completed and delete it from the active job list.
+ completed and delete it from the active job list.
*/
- if( job_is_completed( j ) )
+ if( job_is_completed( j ) )
{
if( !job_get_flag( j, JOB_FOREGROUND) && !job_get_flag( j, JOB_NOTIFIED ) && !job_get_flag( j, JOB_SKIP_NOTIFICATION ) )
{
format_job_info( j, _( L"ended" ) );
found=1;
}
- proc_fire_event( L"JOB_EXIT", EVENT_EXIT, -j->pgid, 0 );
- proc_fire_event( L"JOB_EXIT", EVENT_JOB_ID, j->job_id, 0 );
+ proc_fire_event( L"JOB_EXIT", EVENT_EXIT, -j->pgid, 0 );
+ proc_fire_event( L"JOB_EXIT", EVENT_JOB_ID, j->job_id, 0 );
job_free(j);
- }
- else if( job_is_stopped( j ) && !job_get_flag( j, JOB_NOTIFIED ) )
+ }
+ else if( job_is_stopped( j ) && !job_get_flag( j, JOB_NOTIFIED ) )
{
- /*
- Notify the user about newly stopped jobs.
+ /*
+ Notify the user about newly stopped jobs.
*/
if( !job_get_flag( j, JOB_SKIP_NOTIFICATION ) )
{
format_job_info( j, _( L"stopped" ) );
found=1;
- }
+ }
job_set_flag( j, JOB_NOTIFIED, 1 );
}
}
@@ -672,8 +672,8 @@ int job_reap( int interactive )
fflush( stdout );
locked = 0;
-
- return found;
+
+ return found;
}
@@ -692,36 +692,36 @@ unsigned long proc_get_jiffies( process_t *p )
wchar_t fn[FN_SIZE];
char state;
- int pid, ppid, pgrp,
+ int pid, ppid, pgrp,
session, tty_nr, tpgid,
- exit_signal, processor;
-
- long int cutime, cstime, priority,
- nice, placeholder, itrealvalue,
+ exit_signal, processor;
+
+ long int cutime, cstime, priority,
+ nice, placeholder, itrealvalue,
rss;
- unsigned long int flags, minflt, cminflt,
- majflt, cmajflt, utime,
- stime, starttime, vsize,
+ unsigned long int flags, minflt, cminflt,
+ majflt, cmajflt, utime,
+ stime, starttime, vsize,
rlim, startcode, endcode,
startstack, kstkesp, kstkeip,
signal, blocked, sigignore,
sigcatch, wchan, nswap, cnswap;
char comm[1024];
-
+
if( p->pid <= 0 )
return 0;
-
+
swprintf( fn, FN_SIZE, L"/proc/%d/stat", p->pid );
-
+
FILE *f = wfopen( fn, "r" );
if( !f )
return 0;
-
- int count = fscanf( f,
- "%d %s %c "
+
+ int count = fscanf( f,
+ "%d %s %c "
"%d %d %d "
"%d %d %lu "
-
+
"%lu %lu %lu "
"%lu %lu %lu "
"%ld %ld %ld "
@@ -735,15 +735,15 @@ unsigned long proc_get_jiffies( process_t *p )
"%lu %lu %lu "
"%lu %d %d ",
-
- &pid, comm, &state,
- &ppid, &pgrp, &session,
+
+ &pid, comm, &state,
+ &ppid, &pgrp, &session,
&tty_nr, &tpgid, &flags,
&minflt, &cminflt, &majflt,
&cmajflt, &utime, &stime,
&cutime, &cstime, &priority,
-
+
&nice, &placeholder, &itrealvalue,
&starttime, &vsize, &rss,
&rlim, &startcode, &endcode,
@@ -765,7 +765,7 @@ unsigned long proc_get_jiffies( process_t *p )
*/
fclose( f );
return utime+stime+cutime+cstime;
-
+
}
/**
@@ -775,14 +775,14 @@ void proc_update_jiffies()
{
job_t *j;
process_t *p;
-
+
for( j=first_job; j; j=j->next )
{
for( p=j->first_process; p; p=p->next )
{
gettimeofday( &p->last_time, 0 );
p->last_jiffies = proc_get_jiffies( p );
- }
+ }
}
}
@@ -791,8 +791,8 @@ void proc_update_jiffies()
/**
Check if there are buffers associated with the job, and select on
- them for a while if available.
-
+ them for a while if available.
+
\param j the job to test
\return 1 if buffers were avaialble, zero otherwise
@@ -804,7 +804,7 @@ static int select_try( job_t *j )
io_data_t *d;
FD_ZERO(&fds);
-
+
for( d = j->io; d; d=d->next )
{
if( d->io_mode == IO_BUFFER )
@@ -816,15 +816,15 @@ static int select_try( job_t *j )
debug( 3, L"select_try on %d\n", fd );
}
}
-
+
if( maxfd >= 0 )
{
int retval;
struct timeval tv;
-
+
tv.tv_sec=0;
tv.tv_usec=10000;
-
+
retval =select( maxfd+1, &fds, 0, 0, &tv );
return retval > 0;
}
@@ -833,7 +833,7 @@ static int select_try( job_t *j )
}
/**
- Read from descriptors until they are empty.
+ Read from descriptors until they are empty.
\param j the job to test
*/
@@ -846,13 +846,13 @@ static void read_try( job_t *j )
*/
for( d = j->io; d; d=d->next )
{
-
+
if( d->io_mode == IO_BUFFER )
{
buff=d;
}
}
-
+
if( buff )
{
debug( 3, L"proc::read_try('%ls')\n", j->command );
@@ -860,7 +860,7 @@ static void read_try( job_t *j )
{
char b[BUFFER_SIZE];
int l;
-
+
l=read_blocked( buff->param1.pipe_fd[0],
b, BUFFER_SIZE );
if( l==0 )
@@ -871,23 +871,23 @@ static void read_try( job_t *j )
{
if( errno != EAGAIN )
{
- debug( 1,
+ debug( 1,
_( L"An error occured while reading output from code block" ) );
- wperror( L"read_try" );
- }
+ wperror( L"read_try" );
+ }
break;
}
else
{
b_append( buff->param2.out_buffer, b, l );
- }
+ }
}
}
}
/**
- Give ownership of the terminal to the specified job.
+ Give ownership of the terminal to the specified job.
\param j The job to give the terminal to.
@@ -897,19 +897,19 @@ static void read_try( job_t *j )
*/
static int terminal_give_to_job( job_t *j, int cont )
{
-
+
if( tcsetpgrp (0, j->pgid) )
{
- debug( 1,
- _( L"Could not send job %d ('%ls') to foreground" ),
- j->job_id,
+ debug( 1,
+ _( L"Could not send job %d ('%ls') to foreground" ),
+ j->job_id,
j->command );
wperror( L"tcsetpgrp" );
return 0;
}
-
+
if( cont )
- {
+ {
if( tcsetattr (0, TCSADRAIN, &j->tmodes))
{
debug( 1,
@@ -926,20 +926,20 @@ static int terminal_give_to_job( job_t *j, int cont )
/**
Returns contol of the terminal to the shell, and saves the terminal
attribute state to the job, so that we can restore the terminal
- ownership to the job at a later time .
+ ownership to the job at a later time .
*/
static int terminal_return_from_job( job_t *j)
{
-
+
if( tcsetpgrp (0, getpid()) )
{
debug( 1, _( L"Could not return shell to foreground" ) );
wperror( L"tcsetpgrp" );
return 0;
}
-
- /*
- Save jobs terminal modes.
+
+ /*
+ Save jobs terminal modes.
*/
if( tcgetattr (0, &j->tmodes) )
{
@@ -947,9 +947,9 @@ static int terminal_return_from_job( job_t *j)
wperror( L"tcgetattr" );
return 0;
}
-
- /*
- Restore the shell's terminal modes.
+
+ /*
+ Restore the shell's terminal modes.
*/
if( tcsetattr (0, TCSADRAIN, &shell_modes))
{
@@ -972,35 +972,35 @@ void job_continue (job_t *j, int cont)
job_set_flag( j, JOB_NOTIFIED, 0 );
CHECK_BLOCK();
-
+
debug( 4,
L"Continue job %d, gid %d (%ls), %ls, %ls",
- j->job_id,
+ j->job_id,
j->pgid,
- j->command,
- job_is_completed( j )?L"COMPLETED":L"UNCOMPLETED",
+ j->command,
+ job_is_completed( j )?L"COMPLETED":L"UNCOMPLETED",
is_interactive?L"INTERACTIVE":L"NON-INTERACTIVE" );
-
+
if( !job_is_completed( j ) )
{
if( job_get_flag( j, JOB_TERMINAL ) && job_get_flag( j, JOB_FOREGROUND ) )
- {
+ {
/* Put the job into the foreground. */
int ok;
-
+
signal_block();
-
+
ok = terminal_give_to_job( j, cont );
-
- signal_unblock();
+
+ signal_unblock();
if( !ok )
return;
-
+
}
-
- /*
- Send the job a continue signal, if necessary.
+
+ /*
+ Send the job a continue signal, if necessary.
*/
if( cont )
{
@@ -1025,16 +1025,16 @@ void job_continue (job_t *j, int cont)
{
wperror (L"kill (SIGCONT)");
return;
- }
+ }
}
}
}
-
+
if( job_get_flag( j, JOB_FOREGROUND ) )
{
int quit = 0;
-
- /*
+
+ /*
Wait for job to report. Looks a bit ugly because it has to
handle the possibility that a signal is dispatched while
running job_is_stopped().
@@ -1052,16 +1052,16 @@ void job_continue (job_t *j, int cont)
if( !quit )
{
-
-// debug( 1, L"select_try()" );
+
+// debug( 1, L"select_try()" );
switch( select_try(j) )
{
- case 1:
+ case 1:
{
read_try( j );
break;
}
-
+
case -1:
{
/*
@@ -1072,7 +1072,7 @@ void job_continue (job_t *j, int cont)
improvement on my 300 MHz machine) on
short-lived jobs.
*/
- int status;
+ int status;
pid_t pid = waitpid(-1, &status, WUNTRACED );
if( pid > 0 )
{
@@ -1091,20 +1091,20 @@ void job_continue (job_t *j, int cont)
{
quit = 1;
}
-
+
}
break;
}
-
+
}
- }
+ }
}
- }
+ }
}
-
+
if( job_get_flag( j, JOB_FOREGROUND ) )
{
-
+
if( job_is_completed( j ))
{
process_t *p = j->first_process;
@@ -1113,51 +1113,51 @@ void job_continue (job_t *j, int cont)
if( WIFEXITED( p->status ) || WIFSIGNALED(p->status))
{
- /*
+ /*
Mark process status only if we are in the foreground
and the last process in a pipe, and it is not a short circuted builtin
*/
if( p->pid )
{
int status = proc_format_status(p->status);
-
+
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?!status:status);
}
- }
+ }
}
- /*
- Put the shell back in the foreground.
+ /*
+ Put the shell back in the foreground.
*/
if( job_get_flag( j, JOB_TERMINAL ) && job_get_flag( j, JOB_FOREGROUND ) )
{
int ok;
-
+
signal_block();
ok = terminal_return_from_job( j );
-
+
signal_unblock();
-
+
if( !ok )
return;
-
+
}
}
-
+
}
-int proc_format_status(int status)
+int proc_format_status(int status)
{
- if( WIFSIGNALED( status ) )
+ if( WIFSIGNALED( status ) )
{
return 128+WTERMSIG(status);
- }
- else if( WIFEXITED( status ) )
+ }
+ else if( WIFEXITED( status ) )
{
return WEXITSTATUS(status);
}
return status;
-
+
}
@@ -1165,22 +1165,22 @@ void proc_sanity_check()
{
job_t *j;
job_t *fg_job=0;
-
+
for( j = first_job; j ; j=j->next )
{
process_t *p;
if( !job_get_flag( j, JOB_CONSTRUCTED ) )
continue;
-
-
- validate_pointer( j->command,
- _( L"Job command" ),
+
+
+ validate_pointer( j->command,
+ _( L"Job command" ),
0 );
validate_pointer( j->first_process,
_( L"Process list pointer" ),
0 );
- validate_pointer( j->next,
+ validate_pointer( j->next,
_( L"Job list pointer" ),
1 );
@@ -1191,7 +1191,7 @@ void proc_sanity_check()
{
if( fg_job != 0 )
{
- debug( 0,
+ debug( 0,
_( L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"),
fg_job->command,
j->command );
@@ -1199,39 +1199,39 @@ void proc_sanity_check()
}
fg_job = j;
}
-
+
p = j->first_process;
while( p )
- {
+ {
validate_pointer( p->argv, _( L"Process argument list" ), 0 );
validate_pointer( p->argv[0], _( L"Process name" ), 0 );
validate_pointer( p->next, _( L"Process list pointer" ), 1 );
validate_pointer( p->actual_cmd, _( L"Process command" ), 1 );
-
+
if ( (p->stopped & (~0x00000001)) != 0 )
{
debug( 0,
_( L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d" ),
- j->command,
+ j->command,
p->argv[0],
p->stopped );
sanity_lose();
}
-
+
if ( (p->completed & (~0x00000001)) != 0 )
{
debug( 0,
_( L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d" ),
- j->command,
+ j->command,
p->argv[0],
p->completed );
sanity_lose();
}
-
+
p=p->next;
}
-
- }
+
+ }
}
void proc_push_interactive( int value )
diff --git a/proc.h b/proc.h
index e9c87da89..dd46bc073 100644
--- a/proc.h
+++ b/proc.h
@@ -1,11 +1,11 @@
-/** \file proc.h
+/** \file proc.h
Prototypes for utilities for keeping track of jobs, processes and subshells, as
well as signal handling functions for tracking children. These
functions do not themselves launch new processes, the exec library
will call proc to create representations of the running jobs as
needed.
-
+
*/
#ifndef FISH_PROC_H
@@ -78,19 +78,19 @@ enum
A buffer
*/
INTERNAL_BUFFER,
-
+
}
;
enum
{
- JOB_CONTROL_ALL,
+ JOB_CONTROL_ALL,
JOB_CONTROL_INTERACTIVE,
JOB_CONTROL_NONE,
}
;
-/**
+/**
A structure representing a single fish process. Contains variables
for tracking process state and the process argument
list. Actually, a fish process can be either a regular externa
@@ -125,7 +125,7 @@ enum
*/
typedef struct process
{
- /**
+ /**
Type of process. Can be one of \c EXTERNAL, \c
INTERNAL_BUILTIN, \c INTERNAL_FUNCTION, \c INTERNAL_BLOCK,
INTERNAL_EXEC, or INTERNAL_BUFFER
@@ -136,7 +136,7 @@ typedef struct process
wchar_t **argv;
/** actual command to pass to exec in case of EXTERNAL or INTERNAL_EXEC */
- wchar_t *actual_cmd;
+ wchar_t *actual_cmd;
/** process ID */
pid_t pid;
@@ -160,29 +160,29 @@ typedef struct process
int count_help_magic;
/** next process in pipeline */
- struct process *next;
+ struct process *next;
#ifdef HAVE__PROC_SELF_STAT
/** Last time of cpu time check */
struct timeval last_time;
/** Number of jiffies spent in process at last cpu time check */
- unsigned long last_jiffies;
+ unsigned long last_jiffies;
#endif
-}
+}
process_t;
-/**
+/**
Constant for the flag variable in the job struct
- true if user was told about stopped job
+ true if user was told about stopped job
*/
#define JOB_NOTIFIED 1
-/**
+/**
Constant for the flag variable in the job struct
- Whether this job is in the foreground
+ Whether this job is in the foreground
*/
#define JOB_FOREGROUND 2
-/**
+/**
Constant for the flag variable in the job struct
Whether the specified job is completely constructed,
@@ -196,130 +196,130 @@ typedef struct process
Whether the specified job is a part of a subshell, event handler or some other form of special job that should not be reported
*/
#define JOB_SKIP_NOTIFICATION 8
-/**
+/**
Constant for the flag variable in the job struct
- Should the exit status be negated? This flag can only be set by the not builtin.
+ Should the exit status be negated? This flag can only be set by the not builtin.
*/
#define JOB_NEGATE 16
-/**
+/**
Constant for the flag variable in the job struct
- This flag is set to one on wildcard expansion errors. It means that the current command should not be executed
+ This flag is set to one on wildcard expansion errors. It means that the current command should not be executed
*/
#define JOB_WILDCARD_ERROR 32
-/**
+/**
Constant for the flag variable in the job struct
- Skip executing this job. This flag is set by the short-circut builtins, i.e. and and or
+ Skip executing this job. This flag is set by the short-circut builtins, i.e. and and or
*/
#define JOB_SKIP 64
-/**
+/**
Constant for the flag variable in the job struct
- Whether the job is under job control
+ Whether the job is under job control
*/
#define JOB_CONTROL 128
-/**
+/**
Constant for the flag variable in the job struct
- Whether the job wants to own the terminal when in the foreground
+ Whether the job wants to own the terminal when in the foreground
*/
#define JOB_TERMINAL 256
-/**
+/**
A struct represeting a job. A job is basically a pipeline of one
or more processes and a couple of flags.
*/
typedef struct job
{
- /**
+ /**
The original command which led to the creation of this
job. It is used for displaying messages about job status
on the terminal.
*/
- wchar_t *command;
-
- /**
+ wchar_t *command;
+
+ /**
A linked list of all the processes in this job.
*/
- process_t *first_process;
-
- /**
+ process_t *first_process;
+
+ /**
process group ID for the process group that this job is
- running in.
+ running in.
*/
- pid_t pgid;
-
- /**
+ pid_t pgid;
+
+ /**
The saved terminal modes of this job. This needs to be
saved so that we can restore the terminal to the same
state after temporarily taking control over the terminal
- when a job stops.
+ when a job stops.
*/
struct termios tmodes;
-
+
/**
The job id of the job. This is a small integer that is a
unique identifier of the job within this shell, and is
used e.g. in process expansion.
*/
int job_id;
-
+
/**
- List of all IO redirections for this job
+ List of all IO redirections for this job
*/
io_data_t *io;
-
- /**
- A pointer to the next job in the job queue
+
+ /**
+ A pointer to the next job in the job queue
*/
- struct job *next;
+ struct job *next;
/**
Bitset containing information about the job. A combination of the JOB_* constants.
*/
int flags;
-
-}
+
+}
job_t;
-/**
- Whether we are running a subshell command
+/**
+ Whether we are running a subshell command
*/
extern int is_subshell;
-/**
- Whether we are running a block of commands
+/**
+ Whether we are running a block of commands
*/
extern int is_block;
-/**
+/**
Whether we are reading from the keyboard right now
*/
extern int is_interactive;
-/**
+/**
Whether this shell is attached to the keyboard at all
*/
extern int is_interactive_session;
-/**
+/**
Whether we are a login shell
*/
extern int is_login;
-/**
+/**
Whether we are running an event handler
*/
extern int is_event;
-/**
- Linked list of all living jobs
+/**
+ Linked list of all living jobs
*/
-extern job_t *first_job;
+extern job_t *first_job;
/**
Whether a universal variable barrier roundtrip has already been
@@ -396,7 +396,7 @@ job_t *job_get(int id);
job_t *job_get_from_pid(int pid);
/**
- Tests if the job is stopped
+ Tests if the job is stopped
*/
int job_is_stopped( const job_t *j );
diff --git a/reader.c b/reader.c
index 426f06c91..db4c1c9cc 100644
--- a/reader.c
+++ b/reader.c
@@ -240,7 +240,7 @@ typedef struct reader_data
/** The output of the last evaluation of the prompt command */
string_buffer_t prompt_buff;
-
+
/**
Color is the syntax highlighting for buff. The format is that
color[i] is the classification (according to the enum in
@@ -284,7 +284,7 @@ typedef struct reader_data
int prev_end_loop;
/**
- The current contents of the top item in the kill ring.
+ The current contents of the top item in the kill ring.
*/
string_buffer_t kill_item;
@@ -423,12 +423,12 @@ int reader_exit_forced()
static void reader_repaint()
{
parser_test( data->buff, data->indent, 0, 0 );
-
+
s_write( &data->screen,
(wchar_t *)data->prompt_buff.buff,
data->buff,
- data->color,
- data->indent,
+ data->color,
+ data->indent,
data->buff_pos );
data->repaint_needed = 0;
}
@@ -460,7 +460,7 @@ static void reader_kill( wchar_t *begin, int length, int mode, int new )
sb_append( &data->kill_item, old );
}
-
+
kill_replace( old, (wchar_t *)data->kill_item.buff );
free( old );
}
@@ -469,19 +469,19 @@ static void reader_kill( wchar_t *begin, int length, int mode, int new )
{
data->buff_pos = maxi( begin-data->buff, data->buff_pos-length );
}
-
+
data->buff_len -= length;
memmove( begin, begin+length, sizeof( wchar_t )*(wcslen( begin+length )+1) );
-
+
reader_super_highlight_me_plenty( data->buff_pos, 0 );
reader_repaint();
-
+
}
void reader_handle_int( int sig )
{
block_t *c = current_block;
-
+
if( !is_interactive_read )
{
while( c )
@@ -491,9 +491,9 @@ void reader_handle_int( int sig )
c=c->outer;
}
}
-
+
interrupted = 1;
-
+
}
wchar_t *reader_current_filename()
@@ -560,7 +560,7 @@ static int completion_cmp( const void *a, const void *b )
*/
static void sort_completion_list( array_list_t *comp )
{
- qsort( comp->arr,
+ qsort( comp->arr,
al_get_count( comp ),
sizeof( void*),
&completion_cmp );
@@ -575,17 +575,17 @@ static void remove_duplicates( array_list_t *l )
int in, out;
const wchar_t *prev;
completion_t *first;
-
+
if( al_get_count( l ) == 0 )
return;
-
+
first = (completion_t *)al_get( l, 0 );
prev = first->completion;
-
+
for( in=1, out=1; in < al_get_count( l ); in++ )
- {
+ {
completion_t *curr = (completion_t *)al_get( l, in );
-
+
if( wcscmp( prev, curr->completion )!=0 )
{
al_set( l, out++, curr );
@@ -624,10 +624,16 @@ void reader_write_title()
don't. Since we can't see the underlying terminal below screen
there is no way to fix this.
*/
- if( !term || !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
+ if ( !term )
+ {
+ return;
+ }
+
+ if( !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
{
char *n = ttyname( STDIN_FILENO );
+
if( contains( term, L"linux" ) )
{
return;
@@ -635,13 +641,13 @@ void reader_write_title()
if( strstr( n, "tty" ) || strstr( n, "/vc/") )
return;
-
-
+
+
}
title = function_exists( L"fish_title" )?L"fish_title":DEFAULT_TITLE;
- if( wcslen( title ) ==0 )
+ if( wcslen( title ) == 0 )
return;
al_init( &l );
@@ -661,7 +667,7 @@ void reader_write_title()
}
}
proc_pop_interactive();
-
+
al_foreach( &l, &free );
al_destroy( &l );
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
@@ -676,11 +682,11 @@ static void exec_prompt()
array_list_t prompt_list;
al_init( &prompt_list );
-
+
if( data->prompt )
{
proc_push_interactive( 0 );
-
+
if( exec_subshell( data->prompt, &prompt_list ) == -1 )
{
/* If executing the prompt fails, make sure we at least don't print any junk */
@@ -690,23 +696,20 @@ static void exec_prompt()
}
proc_pop_interactive();
}
-
+
reader_write_title();
-
+
sb_clear( &data->prompt_buff );
-
- for( i=0; iprompt_buff, (wchar_t *)al_get( &prompt_list, i ) );
- if (i + 1 < al_get_count( &prompt_list))
- {
- sb_append( &data->prompt_buff, L"\n" );
- }
+ sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ), L"\n" );
}
-
+ sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ));
+
al_foreach( &prompt_list, &free );
al_destroy( &prompt_list );
-
+
}
void reader_init()
@@ -716,7 +719,7 @@ void reader_init()
memcpy( &saved_modes,
&shell_modes,
sizeof(saved_modes)); /* save a copy so we can reset the terminal later */
-
+
shell_modes.c_lflag &= ~ICANON; /* turn off canonical mode */
shell_modes.c_lflag &= ~ECHO; /* turn off echo mode */
shell_modes.c_cc[VMIN]=1;
@@ -740,7 +743,7 @@ void reader_exit( int do_exit, int forced )
end_loop=do_exit;
if( forced )
exit_forced = 1;
-
+
}
void reader_repaint_needed()
@@ -789,14 +792,14 @@ static int insert_str(wchar_t *str)
{
int len = wcslen( str );
int old_len = data->buff_len;
-
+
assert( data->buff_pos >= 0 );
assert( data->buff_pos <= data->buff_len );
assert( len >= 0 );
-
+
data->buff_len += len;
check_size();
-
+
/* Insert space for extra characters at the right position */
if( data->buff_pos < old_len )
{
@@ -807,13 +810,13 @@ static int insert_str(wchar_t *str)
memmove( &data->buff[data->buff_pos], str, sizeof(wchar_t)*len );
data->buff_pos += len;
data->buff[data->buff_len]='\0';
-
+
/*
- Syntax highlight
+ Syntax highlight
*/
reader_super_highlight_me_plenty( data->buff_pos-1,
0 );
-
+
reader_repaint();
return 1;
}
@@ -827,7 +830,7 @@ static int insert_char( int c )
{
wchar_t str[]=
{
- 0, 0
+ 0, 0
}
;
str[0] = c;
@@ -881,7 +884,7 @@ static wchar_t get_quote( wchar_t *cmd, int len )
i++;
if( !cmd[i] )
break;
- i++;
+ i++;
}
else
{
@@ -1004,29 +1007,29 @@ static void completion_insert( const wchar_t *val, int flags )
int add_space = !(flags & COMPLETE_NO_SPACE);
int do_replace = (flags & COMPLETE_NO_CASE);
int do_escape = !(flags & COMPLETE_DONT_ESCAPE);
-
+
// debug( 0, L"Insert completion %ls with flags %d", val, flags);
if( do_replace )
{
-
+
int tok_start, tok_len;
wchar_t *begin, *end;
string_buffer_t sb;
wchar_t *escaped;
-
+
parse_util_token_extent( data->buff, data->buff_pos, &begin, 0, 0, 0 );
end = data->buff+data->buff_pos;
tok_start = begin - data->buff;
tok_len = end-begin;
-
+
sb_init( &sb );
sb_append_substring( &sb, data->buff, begin - data->buff );
-
+
if( do_escape )
{
- escaped = escape( val, ESCAPE_ALL | ESCAPE_NO_QUOTED );
+ escaped = escape( val, ESCAPE_ALL | ESCAPE_NO_QUOTED );
sb_append( &sb, escaped );
free( escaped );
}
@@ -1034,28 +1037,28 @@ static void completion_insert( const wchar_t *val, int flags )
{
sb_append( &sb, val );
}
-
- if( add_space )
+
+ if( add_space )
{
sb_append( &sb, L" " );
}
-
+
sb_append( &sb, end );
-
+
reader_set_buffer( (wchar_t *)sb.buff, (begin-data->buff)+wcslen(val)+!!add_space );
sb_destroy( &sb );
-
+
reader_super_highlight_me_plenty( data->buff_pos, 0 );
reader_repaint();
-
+
}
else
{
-
+
if( do_escape )
{
-
+
get_param( data->buff,
data->buff_pos,
"e,
@@ -1071,7 +1074,7 @@ static void completion_insert( const wchar_t *val, int flags )
const wchar_t *pin;
wchar_t *pout;
-
+
replaced = pout =
malloc( sizeof(wchar_t)*(wcslen(val) + 1) );
@@ -1106,20 +1109,20 @@ static void completion_insert( const wchar_t *val, int flags )
{
replaced = wcsdup(val);
}
-
+
if( insert_str( replaced ) )
{
/*
- Print trailing space since this is the only completion
+ Print trailing space since this is the only completion
*/
- if( add_space )
+ if( add_space )
{
if( quote &&
- (data->buff[data->buff_pos] != quote ) )
+ (data->buff[data->buff_pos] != quote ) )
{
- /*
- This is a quoted parameter, first print a quote
+ /*
+ This is a quoted parameter, first print a quote
*/
insert_char( quote );
}
@@ -1128,9 +1131,9 @@ static void completion_insert( const wchar_t *val, int flags )
}
free(replaced);
-
+
}
-
+
}
/**
@@ -1138,7 +1141,7 @@ static void completion_insert( const wchar_t *val, int flags )
fish_pager outputs any text, it is inserted into the input
backbuffer.
- \param prefix the string to display before every completion.
+ \param prefix the string to display before every completion.
\param is_quoted should be set if the argument is quoted. This will change the display style.
\param comp the list of completions to display
*/
@@ -1162,7 +1165,7 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
{
prefix_esc = escape( prefix,1);
}
-
+
sb_init( &cmd );
sb_init( &msg );
sb_printf( &cmd,
@@ -1177,13 +1180,13 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
in->fd = 3;
escaped_separator = escape( COMPLETE_SEP_STR, 1);
-
+
for( i=0; iflags & COMPLETE_NO_CASE );
}
-
+
for( i=0; ibuff, data->buff_pos, &begin, 0, 0, 0 );
base_len = data->buff_pos - (begin-data->buff);
}
-
+
foo = escape( el->completion + base_len, ESCAPE_ALL | ESCAPE_NO_QUOTED );
}
else
@@ -1217,12 +1220,12 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
foo = escape( el->completion, ESCAPE_ALL | ESCAPE_NO_QUOTED );
}
}
-
+
if( el && el->description )
{
baz = escape( el->description, 1 );
}
-
+
if( !foo )
{
debug( 0, L"Run pager called with bad argument." );
@@ -1231,33 +1234,33 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
}
else if( baz )
{
- sb_printf( &msg, L"%ls%ls%ls\n",
+ sb_printf( &msg, L"%ls%ls%ls\n",
foo,
escaped_separator,
baz );
}
else
{
- sb_printf( &msg, L"%ls\n",
+ sb_printf( &msg, L"%ls\n",
foo );
}
- free( foo );
- free( baz );
+ free( foo );
+ free( baz );
}
- free( escaped_separator );
-
+ free( escaped_separator );
+
foo = wcs2str( (wchar_t *)msg.buff );
b_append( in->param2.out_buffer, foo, strlen(foo) );
free( foo );
-
+
term_donate();
-
+
io_data_t *out = io_buffer_create( 0 );
out->next = in;
out->fd = 4;
-
+
eval( (wchar_t *)cmd.buff, out, TOP);
term_steal();
@@ -1296,22 +1299,22 @@ static void reader_flash()
struct timespec pollint;
int i;
-
+
for( i=0; ibuff_pos; i++ )
{
data->color[i] = HIGHLIGHT_SEARCH_MATCH<<16;
}
-
+
reader_repaint();
-
+
pollint.tv_sec = 0;
pollint.tv_nsec = 100 * 1000000;
nanosleep( &pollint, NULL );
reader_super_highlight_me_plenty( data->buff_pos, 0 );
reader_repaint();
-
-
+
+
}
/**
@@ -1338,7 +1341,7 @@ int reader_can_replace( const wchar_t *in, int flags )
{
return 1;
}
-
+
CHECK( in, 1 );
@@ -1357,7 +1360,7 @@ int reader_can_replace( const wchar_t *in, int flags )
/**
Handle the list of completions. This means the following:
-
+
- If the list is empty, flash the terminal.
- If the list contains one element, write the whole element, and if
the element does not end on a '/', '@', ':', or a '=', also write a trailing
@@ -1366,7 +1369,7 @@ int reader_can_replace( const wchar_t *in, int flags )
the prefix.
- If the list contains multiple elements without.
a common prefix, call run_pager to display a list of completions. Depending on terminal size and the length of the list, run_pager may either show less than a screenfull and exit or use an interactive pager to allow the user to scroll through the completions.
-
+
\param comp the list of completion strings
*/
@@ -1382,13 +1385,13 @@ static int handle_completions( array_list_t *comp )
int flags=0;
wchar_t *begin, *end;
wchar_t *tok;
-
+
parse_util_token_extent( data->buff, data->buff_pos, &begin, 0, 0, 0 );
end = data->buff+data->buff_pos;
-
+
context = halloc( 0, 0 );
tok = halloc_wcsndup( context, begin, end-begin );
-
+
/*
Check trivial cases
*/
@@ -1409,9 +1412,9 @@ static int handle_completions( array_list_t *comp )
*/
case 1:
{
-
+
completion_t *c = (completion_t *)al_get( comp, 0 );
-
+
/*
If this is a replacement completion, check
that we know how to replace it, e.g. that
@@ -1421,15 +1424,15 @@ static int handle_completions( array_list_t *comp )
if( !(c->flags & COMPLETE_NO_CASE) || reader_can_replace( tok, c->flags ) )
{
completion_insert( c->completion,
- c->flags );
+ c->flags );
}
done = 1;
len = 1;
break;
}
}
-
-
+
+
if( !done )
{
/*
@@ -1445,9 +1448,9 @@ static int handle_completions( array_list_t *comp )
*/
if( c->flags & COMPLETE_NO_CASE )
continue;
-
+
count++;
-
+
if( base )
{
new_len = comp_len( base, c->completion );
@@ -1474,8 +1477,8 @@ static int handle_completions( array_list_t *comp )
done = 1;
}
}
-
-
+
+
if( !done && base == 0 )
{
@@ -1487,9 +1490,9 @@ static int handle_completions( array_list_t *comp )
{
int offset = wcslen( tok );
-
+
count = 0;
-
+
for( i=0; iflags & COMPLETE_NO_CASE) )
continue;
-
+
if( !reader_can_replace( tok, c->flags ) )
{
len=0;
@@ -1517,7 +1520,7 @@ static int handle_completions( array_list_t *comp )
base = wcsdup( c->completion );
len = wcslen( base );
flags = c->flags;
-
+
}
}
@@ -1525,15 +1528,15 @@ static int handle_completions( array_list_t *comp )
{
if( count > 1 )
flags = flags | COMPLETE_NO_SPACE;
-
+
base[len]=L'\0';
completion_insert( base, flags );
done = 1;
}
-
+
}
}
-
+
free( base );
if( !done )
@@ -1581,9 +1584,9 @@ static int handle_completions( array_list_t *comp )
wchar_t quote;
get_param( data->buff, data->buff_pos, "e, 0, 0, 0 );
is_quoted = (quote != L'\0');
-
+
write_loop(1, "\n", 1 );
-
+
run_pager( prefix, is_quoted, comp );
}
@@ -1593,11 +1596,11 @@ static int handle_completions( array_list_t *comp )
}
-
+
halloc_free( context );
return len;
-
+
}
@@ -1619,7 +1622,7 @@ static void reader_interactive_init()
not enable it for us.
*/
- /*
+ /*
Check if we are in control of the terminal, so that we don't do
semi-expensive things like reset signal handlers unless we
really have to, which we often don't.
@@ -1628,7 +1631,7 @@ static void reader_interactive_init()
{
int block_count = 0;
int i;
-
+
/*
Bummer, we are not in control of the terminal. Stop until
parent has given us control of it. Stopping in fish is a bit
@@ -1640,13 +1643,13 @@ static void reader_interactive_init()
signal deliveries. In practice, this code should only be run
suring startup, when we're not waiting for any signals.
*/
- while (signal_is_blocked())
+ while (signal_is_blocked())
{
signal_unblock();
block_count++;
}
signal_reset_handlers();
-
+
/*
Ok, signal handlers are taken out of the picture. Stop ourself in a loop
until we are in control of the terminal.
@@ -1655,16 +1658,16 @@ static void reader_interactive_init()
{
killpg( shell_pgid, SIGTTIN);
}
-
+
signal_set_handlers();
- for( i=0; ibuff, data->buff_pos, &begin, &end, 0, 0 );
-
+
sb_clear( &data->search_buff );
if( begin )
{
@@ -1870,11 +1873,11 @@ static void handle_token_history( int forward, int reset )
if( current_pos == -1 )
{
const wchar_t *item;
-
+
/*
Move to previous line
*/
- free( (void *)data->token_history_buff );
+ free( (void *)data->token_history_buff );
/*
Search for previous item that contains this substring
@@ -1989,12 +1992,12 @@ static void move_word( int dir, int erase, int new )
{
return;
}
-
+
if( dir && data->buff_pos == data->buff_len )
{
return;
}
-
+
/*
If we are beyond the last character and moving left, start by
moving one step, since otehrwise we'll start on the \0, which
@@ -2004,10 +2007,10 @@ static void move_word( int dir, int erase, int new )
{
if( !end_buff_pos )
return;
-
+
end_buff_pos--;
}
-
+
/*
When moving left, ignore the character under the cursor
*/
@@ -2015,7 +2018,7 @@ static void move_word( int dir, int erase, int new )
{
end_buff_pos+=2*step;
}
-
+
/*
Remove all whitespace characters before finding a word
*/
@@ -2039,26 +2042,26 @@ static void move_word( int dir, int erase, int new )
*/
if( end_buff_pos != data->buff_pos )
{
-
+
c = data->buff[end_buff_pos];
-
+
if( !iswspace( c ) )
{
break;
}
}
-
+
end_buff_pos+=step;
}
-
+
/*
Remove until we find a character that is not alphanumeric
*/
while( 1 )
{
wchar_t c;
-
+
if( !dir )
{
if( end_buff_pos <= 0 )
@@ -2069,9 +2072,9 @@ static void move_word( int dir, int erase, int new )
if( end_buff_pos >= data->buff_len )
break;
}
-
+
c = data->buff[end_buff_pos];
-
+
if( !iswalnum( c ) )
{
/*
@@ -2097,7 +2100,7 @@ static void move_word( int dir, int erase, int new )
Make sure we don't move beyond begining or end of buffer
*/
end_buff_pos = maxi( 0, mini( end_buff_pos, data->buff_len ) );
-
+
if( erase )
@@ -2105,9 +2108,9 @@ static void move_word( int dir, int erase, int new )
int remove_count = abs(data->buff_pos - end_buff_pos);
int first_char = mini( data->buff_pos, end_buff_pos );
// fwprintf( stderr, L"Remove from %d to %d\n", first_char, first_char+remove_count );
-
+
reader_kill( data->buff + first_char, remove_count, dir?KILL_APPEND:KILL_PREPEND, new );
-
+
}
else
{
@@ -2232,7 +2235,7 @@ void reader_run_command( const wchar_t *cmd )
int reader_shell_test( wchar_t *b )
{
int res = parser_test( b, 0, 0, 0 );
-
+
if( res & PARSER_TEST_ERROR )
{
string_buffer_t sb;
@@ -2240,9 +2243,9 @@ int reader_shell_test( wchar_t *b )
int tmp[1];
int tmp2[1];
-
+
s_write( &data->screen, L"", L"", tmp, tmp2, 0 );
-
+
parser_test( b, 0, &sb, L"fish" );
fwprintf( stderr, L"%ls", sb.buff );
sb_destroy( &sb );
@@ -2268,7 +2271,7 @@ void reader_push( wchar_t *name )
{
DIE_MEM();
}
-
+
n->name = wcsdup( name );
n->next = data;
sb_init( &n->kill_item );
@@ -2318,7 +2321,7 @@ void reader_pop()
free( n->indent );
sb_destroy( &n->search_buff );
sb_destroy( &n->kill_item );
-
+
s_destroy( &n->screen );
sb_destroy( &n->prompt_buff );
@@ -2419,9 +2422,9 @@ static void handle_end_loop()
int job_count=0;
int is_breakpoint=0;
block_t *b;
-
- for( b = current_block;
- b;
+
+ for( b = current_block;
+ b;
b = b->outer )
{
if( b->type == BREAKPOINT )
@@ -2430,7 +2433,7 @@ static void handle_end_loop()
break;
}
}
-
+
for( j=first_job; j; j=j->next )
{
if( !job_is_completed(j) )
@@ -2439,11 +2442,11 @@ static void handle_end_loop()
break;
}
}
-
+
if( !reader_exit_forced() && !data->prev_end_loop && job_count && !is_breakpoint )
{
writestr(_( L"There are stopped jobs. A second attempt to exit will enforce their termination.\n" ));
-
+
reader_exit( 0, 0 );
data->prev_end_loop=1;
}
@@ -2454,13 +2457,13 @@ static void handle_end_loop()
/*
We already know that stdin is a tty since we're
in interactive mode. If isatty returns false, it
- means stdin must have been closed.
+ means stdin must have been closed.
*/
for( j = first_job; j; j=j->next )
{
if( ! job_is_completed( j ) )
{
- job_signal( j, SIGHUP );
+ job_signal( j, SIGHUP );
}
}
}
@@ -2476,12 +2479,12 @@ static void handle_end_loop()
static int read_i()
{
event_fire_generic(L"fish_prompt");
-
+
reader_push(L"fish");
reader_set_complete_function( &complete );
reader_set_highlight_function( &highlight_shell );
reader_set_test_function( &reader_shell_test );
-
+
data->prev_end_loop=0;
while( (!data->end_loop) && (!sanity_check()) )
@@ -2499,9 +2502,9 @@ static int read_i()
during evaluation.
*/
-
+
tmp = reader_readline();
-
+
if( data->end_loop)
{
@@ -2510,7 +2513,7 @@ static int read_i()
else if( tmp )
{
tmp = wcsdup( tmp );
-
+
data->buff_pos=data->buff_len=0;
data->buff[data->buff_len]=L'\0';
reader_run_command( tmp );
@@ -2524,7 +2527,7 @@ static int read_i()
data->prev_end_loop=0;
}
}
-
+
}
reader_pop();
@@ -2562,12 +2565,12 @@ static int is_backslashed( const wchar_t *str, int pos )
{
int count = 0;
int i;
-
+
for( i=pos-1; i>=0; i-- )
{
if( str[i] != L'\\' )
break;
-
+
count++;
}
@@ -2591,19 +2594,19 @@ wchar_t *reader_readline()
sb_clear( &data->search_buff );
data->buff[data->buff_len]='\0';
data->search_mode = NO_SEARCH;
-
-
+
+
exec_prompt();
reader_super_highlight_me_plenty( data->buff_pos, 0 );
s_reset( &data->screen, 1 );
reader_repaint();
- /*
+ /*
get the current terminal modes. These will be restored when the
function returns.
*/
- tcgetattr(0,&old_modes);
+ tcgetattr(0,&old_modes);
/* set the new modes */
if( tcsetattr(0,TCSANOW,&shell_modes))
{
@@ -2613,7 +2616,7 @@ wchar_t *reader_readline()
while( !finished && !data->end_loop)
{
int regular_char = 0;
-
+
/*
Sometimes strange input sequences seem to generate a zero
byte. I believe these simply mean a character was pressed
@@ -2626,7 +2629,7 @@ wchar_t *reader_readline()
is_interactive_read = 1;
c=input_readch();
is_interactive_read = was_interactive_read;
-
+
if( ( (!wchar_private(c))) && (c>31) && (c != 127) )
{
if( can_read(0) )
@@ -2673,36 +2676,36 @@ wchar_t *reader_readline()
*/
if( last_char != R_YANK && last_char != R_YANK_POP )
yank=0;
-
+
switch( c )
{
/* go to beginning of line*/
case R_BEGINNING_OF_LINE:
{
- while( ( data->buff_pos>0 ) &&
+ while( ( data->buff_pos>0 ) &&
( data->buff[data->buff_pos-1] != L'\n' ) )
{
data->buff_pos--;
}
-
+
reader_repaint();
break;
}
case R_END_OF_LINE:
{
- while( data->buff[data->buff_pos] &&
+ while( data->buff[data->buff_pos] &&
data->buff[data->buff_pos] != L'\n' )
{
data->buff_pos++;
}
-
+
reader_repaint();
break;
}
-
+
case R_BEGINNING_OF_BUFFER:
{
data->buff_pos = 0;
@@ -2724,7 +2727,7 @@ wchar_t *reader_readline()
{
if( data->repaint_needed )
reader_repaint();
-
+
break;
}
@@ -2762,26 +2765,26 @@ wchar_t *reader_readline()
parse_util_cmdsubst_extent( data->buff, data->buff_pos, &begin, &end );
parse_util_token_extent( begin, data->buff_pos - (begin-data->buff), &token_begin, &token_end, 0, 0 );
-
+
cursor_steps = token_end - data->buff- data->buff_pos;
data->buff_pos += cursor_steps;
if( is_backslashed( data->buff, data->buff_pos ) )
{
remove_backward();
}
-
+
reader_repaint();
-
+
len = data->buff_pos - (begin-data->buff);
buffcpy = wcsndup( begin, len );
comp = al_halloc( 0 );
data->complete_func( buffcpy, comp );
-
+
sort_completion_list( comp );
remove_duplicates( comp );
-
+
free( buffcpy );
comp_empty = handle_completions( comp );
@@ -2799,20 +2802,20 @@ wchar_t *reader_readline()
wchar_t *begin = &data->buff[data->buff_pos];
wchar_t *end = begin;
int len;
-
+
while( *end && *end != L'\n' )
end++;
-
+
if( end==begin && *end )
end++;
-
+
len = end-begin;
-
+
if( len )
{
reader_kill( begin, len, KILL_APPEND, last_char!=R_KILL_LINE );
}
-
+
break;
}
@@ -2823,18 +2826,18 @@ wchar_t *reader_readline()
wchar_t *end = &data->buff[data->buff_pos];
wchar_t *begin = end;
int len;
-
+
while( begin > data->buff && *begin != L'\n' )
begin--;
-
+
if( *begin == L'\n' )
begin++;
-
+
len = maxi( end-begin, 1 );
begin = end - len;
-
- reader_kill( begin, len, KILL_PREPEND, last_char!=R_BACKWARD_KILL_LINE );
-
+
+ reader_kill( begin, len, KILL_PREPEND, last_char!=R_BACKWARD_KILL_LINE );
+
}
break;
@@ -2845,29 +2848,29 @@ wchar_t *reader_readline()
wchar_t *end = &data->buff[data->buff_pos];
wchar_t *begin = end;
int len;
-
+
while( begin > data->buff && *begin != L'\n' )
begin--;
-
+
if( *begin == L'\n' )
begin++;
-
+
len = maxi( end-begin, 0 );
begin = end - len;
while( *end && *end != L'\n' )
end++;
-
+
if( begin == end && *end )
end++;
-
+
len = end-begin;
-
+
if( len )
{
- reader_kill( begin, len, KILL_APPEND, last_char!=R_KILL_WHOLE_LINE );
+ reader_kill( begin, len, KILL_APPEND, last_char!=R_KILL_WHOLE_LINE );
}
-
+
break;
}
@@ -2901,7 +2904,7 @@ wchar_t *reader_readline()
if( data->search_mode )
{
data->search_mode= NO_SEARCH;
-
+
if( data->token_history_pos==-1 )
{
history_reset();
@@ -2915,7 +2918,7 @@ wchar_t *reader_readline()
sb_clear( &data->search_buff );
reader_super_highlight_me_plenty( data->buff_pos, 0 );
reader_repaint();
-
+
}
break;
@@ -2958,7 +2961,7 @@ wchar_t *reader_readline()
insert_char( '\n' );
break;
}
-
+
switch( data->test_func( data->buff ) )
{
@@ -2977,12 +2980,12 @@ wchar_t *reader_readline()
reader_repaint();
break;
}
-
+
/*
We are incomplete, continue editing
*/
case PARSER_TEST_INCOMPLETE:
- {
+ {
insert_char( '\n' );
break;
}
@@ -3000,7 +3003,7 @@ wchar_t *reader_readline()
}
}
-
+
break;
}
@@ -3011,7 +3014,7 @@ wchar_t *reader_readline()
case R_HISTORY_TOKEN_SEARCH_FORWARD:
{
int reset = 0;
-
+
if( data->search_mode == NO_SEARCH )
{
reset = 1;
@@ -3024,7 +3027,7 @@ wchar_t *reader_readline()
{
data->search_mode = TOKEN_SEARCH;
}
-
+
sb_append( &data->search_buff, data->buff );
}
@@ -3034,7 +3037,7 @@ wchar_t *reader_readline()
case LINE_SEARCH:
{
const wchar_t *it = 0;
-
+
if( ( c == R_HISTORY_SEARCH_BACKWARD ) ||
( c == R_HISTORY_TOKEN_SEARCH_BACKWARD ) )
{
@@ -3044,12 +3047,12 @@ wchar_t *reader_readline()
{
it = history_next_match((wchar_t *)data->search_buff.buff);
}
-
+
handle_history( it );
-
+
break;
}
-
+
case TOKEN_SEARCH:
{
if( ( c == R_HISTORY_SEARCH_BACKWARD ) ||
@@ -3061,10 +3064,10 @@ wchar_t *reader_readline()
{
handle_token_history( SEARCH_FORWARD, reset );
}
-
+
break;
}
-
+
}
break;
}
@@ -3080,13 +3083,13 @@ wchar_t *reader_readline()
}
break;
}
-
+
/* Move right*/
case R_FORWARD_CHAR:
{
if( data->buff_pos < data->buff_len )
{
- data->buff_pos++;
+ data->buff_pos++;
reader_repaint();
}
break;
@@ -3138,49 +3141,49 @@ wchar_t *reader_readline()
int line_old = parse_util_get_line_from_offset( data->buff,
data->buff_pos );
int line_new;
-
+
if( c == R_UP_LINE )
line_new = line_old-1;
else
line_new = line_old+1;
-
+
int line_count = parse_util_lineno( data->buff, data->buff_len )-1;
-
+
if( line_new >= 0 && line_new <= line_count)
{
int base_pos_new;
int base_pos_old;
-
+
int indent_old;
int indent_new;
int line_offset_old;
int total_offset_new;
- base_pos_new = parse_util_get_offset_from_line( data->buff,
+ base_pos_new = parse_util_get_offset_from_line( data->buff,
line_new );
- base_pos_old = parse_util_get_offset_from_line( data->buff,
+ base_pos_old = parse_util_get_offset_from_line( data->buff,
line_old );
-
-
+
+
indent_old = data->indent[base_pos_old];
indent_new = data->indent[base_pos_new];
-
+
line_offset_old = data->buff_pos - parse_util_get_offset_from_line( data->buff,
line_old );
total_offset_new = parse_util_get_offset( data->buff, line_new, line_offset_old - 4*(indent_new-indent_old));
data->buff_pos = total_offset_new;
reader_repaint();
}
-
+
break;
}
-
+
/* Other, if a normal character, we add it to the command */
default:
{
-
+
if( (!wchar_private(c)) && (( (c>31) || (c==L'\n'))&& (c != 127)) )
{
regular_char = 1;
@@ -3199,7 +3202,7 @@ wchar_t *reader_readline()
}
}
-
+
if( (c != R_HISTORY_SEARCH_BACKWARD) &&
(c != R_HISTORY_SEARCH_FORWARD) &&
(c != R_HISTORY_TOKEN_SEARCH_BACKWARD) &&
@@ -3211,7 +3214,7 @@ wchar_t *reader_readline()
history_reset();
data->token_history_pos=-1;
}
-
+
last_char = c;
}
@@ -3226,10 +3229,10 @@ wchar_t *reader_readline()
{
wperror(L"tcsetattr");
}
-
+
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
}
-
+
return finished ? data->buff : 0;
}
@@ -3239,8 +3242,8 @@ int reader_search_mode()
{
return -1;
}
-
- return !!data->search_mode;
+
+ return !!data->search_mode;
}
@@ -3278,18 +3281,18 @@ static int read_ni( int fd, io_data_t *io )
int c;
c = fread(buff, 1, 4096, in_stream);
-
+
if( ferror( in_stream ) && ( errno != EINTR ) )
{
debug( 1,
_( L"Error while reading from file descriptor" ) );
-
+
/*
Reset buffer on error. We won't evaluate incomplete files.
*/
acc.used=0;
break;
-
+
}
b_append( &acc, buff, c );
@@ -3311,7 +3314,7 @@ static int read_ni( int fd, io_data_t *io )
{
string_buffer_t sb;
sb_init( &sb );
-
+
if( !parser_test( str, 0, &sb, L"fish" ) )
{
eval( str, io, TOP );
@@ -3322,7 +3325,7 @@ static int read_ni( int fd, io_data_t *io )
res = 1;
}
sb_destroy( &sb );
-
+
free( str );
}
else
@@ -3365,7 +3368,7 @@ int reader_read( int fd, io_data_t *io )
int inter = ((fd == STDIN_FILENO) && isatty(STDIN_FILENO));
proc_push_interactive( inter );
-
+
res= is_interactive?read_i():read_ni( fd, io );
/*
@@ -3375,7 +3378,7 @@ int reader_read( int fd, io_data_t *io )
if( data )
data->end_loop = 0;
end_loop = 0;
-
+
proc_pop_interactive();
return res;
}
diff --git a/reader.h b/reader.h
index 15c6b9da3..37e73f2b2 100644
--- a/reader.h
+++ b/reader.h
@@ -1,4 +1,4 @@
-/** \file reader.h
+/** \file reader.h
Prototypes for functions for reading data from stdin and passing
to the parser. If stdin is a keyboard, it supplies a killring,
@@ -46,7 +46,7 @@ wchar_t *reader_current_filename();
/**
Push a new filename on the stack of read files
-
+
\param fn The fileanme to push
*/
void reader_push_current_filename( const wchar_t *fn );
@@ -108,7 +108,7 @@ int reader_interrupted();
wchar_t *reader_readline();
/**
- Push a new reader environment.
+ Push a new reader environment.
*/
void reader_push( wchar_t *name );
@@ -118,7 +118,7 @@ void reader_push( wchar_t *name );
void reader_pop();
/**
- Specify function to use for finding possible tab completions. The function must take these arguments:
+ Specify function to use for finding possible tab completions. The function must take these arguments:
- The command to be completed as a null terminated array of wchar_t
- An array_list_t in which completions will be inserted.
@@ -148,7 +148,7 @@ void reader_set_test_function( int (*f)( wchar_t * ) );
void reader_set_prompt( wchar_t *prompt );
/**
- Returns true if the shell is exiting, 0 otherwise.
+ Returns true if the shell is exiting, 0 otherwise.
*/
int exit_status();
diff --git a/sanity.c b/sanity.c
index 3e51b4f3a..c68a87d29 100644
--- a/sanity.c
+++ b/sanity.c
@@ -49,27 +49,27 @@ int sanity_check()
kill_sanity_check();
if( !insane )
proc_sanity_check();
-
+
return insane;
}
void validate_pointer( const void *ptr, const wchar_t *err, int null_ok )
{
-
- /*
- Test if the pointer data crosses a segment boundary.
+
+ /*
+ Test if the pointer data crosses a segment boundary.
*/
-
+
if( (0x00000003l & (long)ptr) != 0 )
{
debug( 0, _(L"The pointer '%ls' is invalid"), err );
- sanity_lose();
+ sanity_lose();
}
-
+
if((!null_ok) && (ptr==0))
{
debug( 0, _(L"The pointer '%ls' is null"), err );
- sanity_lose();
+ sanity_lose();
}
}
diff --git a/sanity.h b/sanity.h
index 0ca8cd2a6..f46af7793 100644
--- a/sanity.h
+++ b/sanity.h
@@ -19,7 +19,7 @@ int sanity_check();
/**
Try and determine if ptr is a valid pointer. If not, loose sanity.
-
+
\param ptr The pointer to validate
\param err A description of what the pointer refers to, for use in error messages
\param null_ok Wheter the pointer is allowed to point to 0
diff --git a/screen.c b/screen.c
index 7029572c4..0046e0cff 100644
--- a/screen.c
+++ b/screen.c
@@ -97,7 +97,7 @@ static int next_tab_stop( int in )
*/
if( init_tabs <= 0 )
init_tabs = 8;
-
+
return ( (in/init_tabs)+1 )*init_tabs;
}
@@ -121,7 +121,7 @@ static int calc_prompt_width( wchar_t *prompt )
int l;
int len=0;
int found = 0;
-
+
/*
Detect these terminfo color escapes with parameter
value 0..7, all of which don't move the cursor
@@ -192,14 +192,14 @@ static int calc_prompt_width( wchar_t *prompt )
*/
len = maxi( try_sequence( tparm(esc2[l]), &prompt[j] ),
try_sequence( esc2[l], &prompt[j] ));
-
+
if( len )
{
j += (len-1);
found = 1;
}
}
-
+
if( !found )
{
if( prompt[j+1] == L'k' )
@@ -227,15 +227,19 @@ static int calc_prompt_width( wchar_t *prompt )
{
break;
}
- }
- }
+ }
+ }
}
-
+
}
else if( prompt[j] == L'\t' )
{
res = next_tab_stop( res );
}
+ else if( prompt[j] == L'\n' )
+ {
+ res = 0;
+ }
else
{
/*
@@ -333,9 +337,9 @@ static void s_check_status( screen_t *s)
is our best bet that we are still on the same line, so we
move to the beginning of the line, reset the modelled screen
contents, and then set the modeled cursor y-pos to its
- earlier value.
+ earlier value.
*/
-
+
int prev_line = s->actual_cursor[1];
write_loop( 1, "\r", 1 );
s_reset( s, 0 );
@@ -344,7 +348,7 @@ static void s_check_status( screen_t *s)
}
/**
- Free all memory used by one line_t struct.
+ Free all memory used by one line_t struct.
*/
static void free_line( void *l )
{
@@ -366,7 +370,7 @@ static void s_reset_arr( array_list_t *l )
void s_init( screen_t *s )
{
CHECK( s, );
-
+
memset( s, 0, sizeof(screen_t));
sb_init( &s->actual_prompt );
}
@@ -380,7 +384,7 @@ void s_destroy( screen_t *s )
al_destroy( &s->actual );
s_reset_arr( &s->desired );
al_destroy( &s->desired );
- sb_destroy( &s->actual_prompt );
+ sb_destroy( &s->actual_prompt );
}
/**
@@ -397,16 +401,16 @@ static line_t *s_create_line()
/**
Appends a character to the end of the line that the output cursor is
on. This function automatically handles linebreaks and lines longer
- than the screen width.
+ than the screen width.
*/
-static void s_desired_append_char( screen_t *s,
+static void s_desired_append_char( screen_t *s,
wchar_t b,
- int c,
+ int c,
int indent,
int prompt_width )
{
int line_no = s->desired_cursor[1];
-
+
switch( b )
{
case L'\n':
@@ -422,16 +426,16 @@ static void s_desired_append_char( screen_t *s,
}
break;
}
-
+
case L'\r':
{
line_t *current;
current = (line_t *)al_get( &s->desired, line_no );
al_truncate( ¤t->text, 0 );
- al_truncate( ¤t->color, 0 );
+ al_truncate( ¤t->color, 0 );
s->desired_cursor[0]=0;
- break;
- }
+ break;
+ }
default:
{
@@ -440,9 +444,9 @@ static void s_desired_append_char( screen_t *s,
int cw = wcwidth(b);
int ew = wcwidth( ellipsis_char );
int i;
-
+
current = (line_t *)al_get( &s->desired, line_no );
-
+
if( !current )
{
current = s_create_line();
@@ -457,7 +461,7 @@ static void s_desired_append_char( screen_t *s,
{
al_set_long( ¤t->text, s->desired_cursor[0], ellipsis_char );
al_set_long( ¤t->color, s->desired_cursor[0], HIGHLIGHT_COMMENT );
-
+
current = s_create_line();
al_push( &s->desired, current );
s->desired_cursor[1]++;
@@ -465,17 +469,17 @@ static void s_desired_append_char( screen_t *s,
for( i=0; i < (prompt_width-ew); i++ )
{
s_desired_append_char( s, L' ', 0, indent, prompt_width );
- }
+ }
s_desired_append_char( s, ellipsis_char, HIGHLIGHT_COMMENT, indent, prompt_width );
}
-
+
al_set_long( ¤t->text, s->desired_cursor[0], b );
al_set_long( ¤t->color, s->desired_cursor[0], c );
s->desired_cursor[0]+= cw;
break;
}
}
-
+
}
/**
@@ -491,7 +495,7 @@ static int s_writeb( char c )
Write the bytes needed to move screen cursor to the specified
position to the specified buffer. The actual_cursor field of the
specified screen_t will be updated.
-
+
\param s the screen to operate on
\param b the buffer to send the output escape codes to
\param new_x the new x position
@@ -501,22 +505,22 @@ static void s_move( screen_t *s, buffer_t *b, int new_x, int new_y )
{
int i;
int x_steps, y_steps;
-
+
int (*writer_old)(char) = output_get_writer();
char *str;
/*
- debug( 0, L"move from %d %d to %d %d",
- s->screen_cursor[0], s->screen_cursor[1],
+ debug( 0, L"move from %d %d to %d %d",
+ s->screen_cursor[0], s->screen_cursor[1],
new_x, new_y );
*/
output_set_writer( &s_writeb );
s_writeb_buffer = b;
-
+
y_steps = new_y - s->actual_cursor[1];
if( y_steps > 0 && (strcmp( cursor_down, "\n")==0))
- {
+ {
/*
This is very strange - it seems some (all?) consoles use a
simple newline as the cursor down escape. This will of
@@ -526,7 +530,7 @@ static void s_move( screen_t *s, buffer_t *b, int new_x, int new_y )
*/
s->actual_cursor[0]=0;
}
-
+
if( y_steps < 0 )
{
str = cursor_up;
@@ -534,9 +538,9 @@ static void s_move( screen_t *s, buffer_t *b, int new_x, int new_y )
else
{
str = cursor_down;
-
+
}
-
+
for( i=0; iactual_cursor[0];
-
+
if( x_steps && new_x == 0 )
{
char c = '\r';
b_append( b, &c, 1 );
x_steps = 0;
}
-
+
if( x_steps < 0 ){
str = cursor_left;
}
@@ -559,7 +563,7 @@ static void s_move( screen_t *s, buffer_t *b, int new_x, int new_y )
{
str = cursor_right;
}
-
+
for( i=0; iactual_cursor[0] = new_x;
s->actual_cursor[1] = new_y;
-
+
output_set_writer( writer_old );
-
+
}
/**
@@ -578,17 +582,17 @@ static void s_move( screen_t *s, buffer_t *b, int new_x, int new_y )
*/
static void s_set_color( screen_t *s, buffer_t *b, int c )
{
-
+
int (*writer_old)(char) = output_get_writer();
output_set_writer( &s_writeb );
s_writeb_buffer = b;
-
+
set_color( highlight_get_color( c & 0xffff ),
highlight_get_color( (c>>16)&0xffff ) );
-
+
output_set_writer( writer_old );
-
+
}
/**
@@ -602,9 +606,9 @@ static void s_write_char( screen_t *s, buffer_t *b, wchar_t c )
output_set_writer( &s_writeb );
s_writeb_buffer = b;
s->actual_cursor[0]+=wcwidth( c );
-
+
writech( c );
-
+
output_set_writer( writer_old );
}
@@ -620,7 +624,7 @@ static void s_write_mbs( buffer_t *b, char *s )
s_writeb_buffer = b;
writembs( s );
-
+
output_set_writer( writer_old );
}
@@ -636,7 +640,7 @@ static void s_write_str( buffer_t *b, wchar_t *s )
s_writeb_buffer = b;
writestr( s );
-
+
output_set_writer( writer_old );
}
@@ -653,10 +657,10 @@ static void s_update( screen_t *scr, wchar_t *prompt )
buffer_t output;
scr->need_clear = 0;
-
+
b_init( &output );
-
+
if( scr->actual_width != screen_width )
{
need_clear = 1;
@@ -664,16 +668,16 @@ static void s_update( screen_t *scr, wchar_t *prompt )
scr->actual_width = screen_width;
s_reset( scr, 0 );
}
-
+
if( wcscmp( prompt, (wchar_t *)scr->actual_prompt.buff ) )
{
s_move( scr, &output, 0, 0 );
s_write_str( &output, prompt );
sb_clear( &scr->actual_prompt );
- sb_append( &scr->actual_prompt, prompt );
+ sb_append( &scr->actual_prompt, prompt );
scr->actual_cursor[0] = prompt_width;
}
-
+
for( i=0; i< al_get_count( &scr->desired ); i++ )
{
line_t *o_line = (line_t *)al_get( &scr->desired, i );
@@ -691,29 +695,29 @@ static void s_update( screen_t *scr, wchar_t *prompt )
al_truncate( &s_line->color, 0 );
}
}
-
+
if( !s_line )
{
s_line = s_create_line();
al_push( &scr->actual, s_line );
}
-
+
for( j=start_pos; jtext ); j++ )
{
wchar_t o = (wchar_t)(long)al_get( &o_line->text, j );
int o_c = (int)(long)al_get( &o_line->color, j );
-
+
if( !o )
continue;
-
+
if( al_get_count( &s_line->text ) == j )
{
s_move( scr, &output, current_width, i );
s_set_color( scr, &output, o_c );
s_write_char( scr, &output, o );
al_set_long( &s_line->text, j, o );
- al_set_long( &s_line->color, j, o_c );
+ al_set_long( &s_line->color, j, o_c );
}
else
{
@@ -728,7 +732,7 @@ static void s_update( screen_t *scr, wchar_t *prompt )
al_set_long( &s_line->color, current_width, o_c );
for( k=1; ktext, current_width+k, L'\0' );
-
+
}
}
current_width += wcwidth( o );
@@ -740,7 +744,7 @@ static void s_update( screen_t *scr, wchar_t *prompt )
s_write_mbs( &output, clr_eol);
al_truncate( &s_line->text, al_get_count( &o_line->text ) );
}
-
+
}
for( i=al_get_count( &scr->desired ); i< al_get_count( &scr->actual ); i++ )
{
@@ -749,18 +753,18 @@ static void s_update( screen_t *scr, wchar_t *prompt )
s_write_mbs( &output, clr_eol);
al_truncate( &s_line->text, 0 );
}
-
+
s_move( scr, &output, scr->desired_cursor[0], scr->desired_cursor[1] );
-
+
s_set_color( scr, &output, 0xffffffff);
if( output.used )
{
write_loop( 1, output.buff, output.used );
}
-
+
b_destroy( &output );
-
+
}
/**
@@ -775,8 +779,8 @@ static int is_dumb()
void s_write( screen_t *s,
wchar_t *prompt,
- wchar_t *b,
- int *c,
+ wchar_t *b,
+ int *c,
int *indent,
int cursor )
{
@@ -788,7 +792,7 @@ void s_write( screen_t *s,
int max_line_width = 0;
int current_line_width = 0;
-
+
CHECK( s, );
CHECK( prompt, );
CHECK( b, );
@@ -803,17 +807,17 @@ void s_write( screen_t *s,
{
char *prompt_narrow = wcs2str( prompt );
char *buffer_narrow = wcs2str( b );
-
+
write_loop( 1, "\r", 1 );
write_loop( 1, prompt_narrow, strlen( prompt_narrow ) );
write_loop( 1, buffer_narrow, strlen( buffer_narrow ) );
free( prompt_narrow );
free( buffer_narrow );
-
+
return;
}
-
+
prompt_width = calc_prompt_width( prompt );
screen_width = common_get_width();
@@ -831,7 +835,7 @@ void s_write( screen_t *s,
prompt = L"> ";
prompt_width = 2;
}
-
+
/*
Completely ignore impossibly small screens
*/
@@ -879,26 +883,26 @@ void s_write( screen_t *s,
s_desired_append_char( s, L' ', 0, 0, prompt_width );
}
}
-
-
+
+
for( i=0; b[i]; i++ )
{
int col = c[i];
-
+
if( i == cursor )
{
col = 0;
}
-
+
if( i == cursor )
{
cursor_arr[0] = s->desired_cursor[0];
cursor_arr[1] = s->desired_cursor[1];
}
-
+
s_desired_append_char( s, b[i], col, indent[i], prompt_width );
-
+
if( i== cursor && s->desired_cursor[1] != cursor_arr[1] && b[i] != L'\n' )
{
/*
@@ -910,13 +914,13 @@ void s_write( screen_t *s,
cursor_arr[0] = s->desired_cursor[0] - wcwidth(b[i]);
cursor_arr[1] = s->desired_cursor[1];
}
-
+
}
if( i == cursor )
{
memcpy(cursor_arr, s->desired_cursor, sizeof(int)*2);
}
-
+
memcpy( s->desired_cursor, cursor_arr, sizeof(int)*2 );
s_update( s, prompt );
s_save_status( s );
diff --git a/screen.h b/screen.h
index 0e2c798a3..243ff8d0a 100644
--- a/screen.h
+++ b/screen.h
@@ -43,7 +43,7 @@ typedef struct
The actual width of the screen at the time of the last screen
write.
*/
- int actual_width;
+ int actual_width;
/**
This flag is set to true when there is reason to suspect that
@@ -52,7 +52,7 @@ typedef struct
has to be sent to the terminal at the end of each line.
*/
int need_clear;
-
+
/**
These status buffers are used to check if any output has occurred
other than from fish's main loop, in which case we need to redraw.
@@ -71,7 +71,7 @@ typedef struct
The text contents of the line. Each element of the array
represents on column of output. Because some characters are two
columns wide, it is perfectly possible for some of the comumns
- to be empty.
+ to be empty.
*/
array_list_t text;
/**
@@ -98,20 +98,20 @@ void s_destroy( screen_t *s );
order to render the desired output using as few terminal commands
as possible.
*/
-void s_write( screen_t *s,
- wchar_t *prompt,
+void s_write( screen_t *s,
+ wchar_t *prompt,
wchar_t *commandline,
- int *colors,
+ int *colors,
int *indent,
int cursor_pos );
-/**
+/**
This function resets the screen buffers internal knowledge about
the contents of the screen. Use this function when some other
function than s_write has written to the screen.
\param s the screen to reset
- \param reset_cursor whether the line on which the curor has changed should be assumed to have changed. If \c reset_cursor is set to 0, the library will attempt to make sure that the screen area does not seem to move up or down on repaint.
+ \param reset_cursor whether the line on which the curor has changed should be assumed to have changed. If \c reset_cursor is set to 0, the library will attempt to make sure that the screen area does not seem to move up or down on repaint.
If reset_cursor is incorreclt set to 0, this may result in screen
contents being erased. If it is incorrectly set to one, it may
diff --git a/seq.in b/seq.in
index b9e82c09f..de8cd11c8 100755
--- a/seq.in
+++ b/seq.in
@@ -1,5 +1,5 @@
#!/usr/bin/env fish
-#
+#
# Fallback implementation of the seq command
#
# @configure_input@
@@ -46,7 +46,7 @@ for i in $from $step $to
end
if [ $step -ge 0 ]
- echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
+ echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
else
- echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc
+ echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc
end
diff --git a/set_color.c b/set_color.c
index 8def213e8..1f2af6565 100644
--- a/set_color.c
+++ b/set_color.c
@@ -81,7 +81,7 @@ char *col[]=
int col_idx[]=
{
- 0,
+ 0,
1,
2,
3,
@@ -112,16 +112,16 @@ int translate_color( char *str )
color = -1;
for( i=0; i/dev/null ^/dev/null; and set is_gnu --is-gnu
__fish_gnu_complete -c df -s h -l human-readable --description "Human readable sizes" $is_gnu
diff --git a/share/completions/find.fish b/share/completions/find.fish
index 473109d87..eba8392b3 100644
--- a/share/completions/find.fish
+++ b/share/completions/find.fish
@@ -9,7 +9,7 @@ complete -c find -s L -o follow --description "Follow symlinks"
complete -c find -s H --description "Do not follow symbolic links, except while processing the command line arguments"
-# General options
+# General options
complete -c find -o daystart --description "Measure from the beginning of today rather than from 24 hours ago"
complete -c find -s d -o depth --description "Process subdirectories before the directory itself"
@@ -36,8 +36,8 @@ complete -c find -o cmin --description "File status last changed specified numbe
complete -c find -o cnewer --description "File status last changed more recently than file was modified" -r
complete -c find -o ctime --description "File status last changed specified number of days ago" -r
-complete -c find -o empty --description "File is empty and is either a regular file or a directory"
-complete -c find -o false --description "Always false"
+complete -c find -o empty --description "File is empty and is either a regular file or a directory"
+complete -c find -o false --description "Always false"
complete -c find -o fstype --description "File is on filesystem of specified type" -a "(__fish_print_filesystems)" -r
complete -c find -o gid --description "Numeric group id of file" -r
complete -c find -o group --description "Group name of file" -a "(__fish_complete_groups)"
@@ -99,7 +99,7 @@ complete -c find -o prune --description "Do not recurse unless -depth is specifi
complete -c find -o quit --description "Exit at once"
complete -c find -o ls --description "List file in ls -dils format" -r
-# Grouping
+# Grouping
complete -c find -o not --description "Negate result of action"
complete -c find -o and -s a --description "Result is only true if both previous and next action are true"
diff --git a/share/completions/flac.fish b/share/completions/flac.fish
index 343ae8092..40cd2a471 100644
--- a/share/completions/flac.fish
+++ b/share/completions/flac.fish
@@ -74,7 +74,7 @@ complete -c flac -l no-replay-gain -d "Don't calculate ReplayGain & store in Vor
complete -c flac -l no-residual-gnuplot -d "Don't generate gnuplot files of residual distribution"
complete -c flac -l no-residual-text -d "Don't include residual signal in text output"
complete -c flac -l no-sector-align -d "Don't align multiple files on sector boundaries"
-complete -c flac -l no-seektable
+complete -c flac -l no-seektable
complete -c flac -l no-silent -d "Write runtime encode/decode statistics"
complete -c flac -l no-force -d "Don't force overwriting of output files"
complete -c flac -l no-verify -d "Don't verify a correct encoding"
diff --git a/share/completions/git.fish b/share/completions/git.fish
index f4da66249..6350513ae 100644
--- a/share/completions/git.fish
+++ b/share/completions/git.fish
@@ -90,9 +90,9 @@ complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to
### checkout
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
-complete -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
-complete -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
-complete -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
+complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
+complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
+complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
# TODO options
### apply
@@ -117,7 +117,7 @@ complete -f -c git -n '__fish_git_using_command branch' -s M -d 'Force renaming
complete -f -c git -n '__fish_git_using_command branch' -s a -d 'Lists both local and remote branches'
### cherry-pick
-complete -f -c git -n '__fish_git_needs_command' -a cherry-pick -d 'Apply the change introduced by an existing commit'
+complete -f -c git -n '__fish_git_needs_command' -a cherry-pick -d 'Apply the change introduced by an existing commit'
complete -f -c git -n '__fish_git_using_command cherry-pick' -a '(__fish_git_branches)' -d 'Branch'
# TODO options
@@ -222,5 +222,12 @@ complete -f -c git -n '__fish_git_needs_command' -a config -d 'Set and read git
complete -f -c git -n '__fish_git_needs_command' -a format-patch -d 'Generate patch series to send upstream'
complete -f -c git -n '__fish_git_using_command format-patch' -a '(__fish_git_branches)' -d 'Branch'
-### aliases (custom user-definer commands)
+## git submodule
+complete -f -c git -n '__fish_git_needs_command' -a submodule -d 'Initialize, update or inspect submodules'
+complete -f -c git -n '__fish_git_using_command submodule' -a 'add status init update summary foreach sync' -d 'Make a GPG-signed tag'
+
+## git whatchanged
+complete -f -c git -n '__fish_git_needs_command' -a whatchanged -d 'Show logs with difference each commit introduces'
+
+## Aliases (custom user-defined commands)
complete -c git -n '__fish_git_needs_command' -a '(git config --get-regexp alias | sed -e "s/^alias\.\(\S\+\).*/\1/")' -d 'Alias (user-defined command)'
diff --git a/share/completions/gpg.fish b/share/completions/gpg.fish
index ce43266ce..f4d937ac7 100644
--- a/share/completions/gpg.fish
+++ b/share/completions/gpg.fish
@@ -1,5 +1,5 @@
#
-# Completions for the gpg command.
+# Completions for the gpg command.
#
# This program accepts an rather large number of switches. It allows
# you to do things like changing what file descriptor errors should be
@@ -22,7 +22,7 @@
function __fish_complete_gpg_user_id -d "Complete using gpg user ids"
# gpg doesn't seem to like it when you use the whole key name as a
# completion, so we skip the part and use it a s a
- # description.
+ # description.
gpg --list-keys --with-colon|cut -d : -f 10|sed -ne 's/\(.*\) <\(.*\)>/\1'\t'\2/p'
end
@@ -49,7 +49,7 @@ complete -c gpg -s s -l sign --description "Make a signature"
complete -c gpg -l clearsign --description "Make a clear text signature"
complete -c gpg -s b -l detach-sign --description "Make a detached signature"
complete -c gpg -s e -l encrypt --description "Encrypt data"
-complete -c gpg -s c -l symmetric --description "Encrypt with a symmetric cipher using a passphrase"
+complete -c gpg -s c -l symmetric --description "Encrypt with a symmetric cipher using a passphrase"
complete -c gpg -l store --description "Store only (make a simple RFC1991 packet)"
complete -c gpg -l decrypt --description "Decrypt specified file or stdin"
complete -c gpg -l verify --description "Assume specified file or stdin is sigfile and verify it"
@@ -76,7 +76,7 @@ complete -c gpg -l delete-key -xa "(__fish_complete_gpg_user_id)" --description
complete -c gpg -l delete-secret-key -xa "(__fish_complete_gpg_user_id)" --description "Remove key from the secret and public keyring"
complete -c gpg -l delete-secret-and-public-key -xa "(__fish_complete_gpg_user_id)" --description "Same as --delete-key, but if a secret key exists, it will be removed first"
-complete -c gpg -l gen-revoke -xa "(__fish_complete_gpg_user_id)" --description "Generate a revocation certificate for the complete key"
+complete -c gpg -l gen-revoke -xa "(__fish_complete_gpg_user_id)" --description "Generate a revocation certificate for the complete key"
complete -c gpg -l desig-revoke -xa "(__fish_complete_gpg_user_id)" --description "Generate a designated revocation certificate for a key"
complete -c gpg -l export -xa "(__fish_append , (__fish_complete_gpg_user_id))" --description 'Export all or the given keys from all keyrings'
@@ -91,7 +91,7 @@ complete -c gpg -l recv-keys -xa "(__fish_complete_gpg_key_id)" --description "I
complete -c gpg -l refresh-keys -xa "(__fish_complete_gpg_key_id)" --description "Request updates from a keyserver for keys that already exist on the local keyring"
complete -c gpg -l search-keys -xa "(__fish_append , (__fish_complete_gpg_user_id) )" --description "Search the keyserver for the given names"
complete -c gpg -l update-trustdb --description "Do trust database maintenance"
-complete -c gpg -l check-trustdb --description "Do trust database maintenance without user interaction"
+complete -c gpg -l check-trustdb --description "Do trust database maintenance without user interaction"
complete -c gpg -l export-ownertrust --description "Send the ownertrust values to stdout"
complete -c gpg -l import-ownertrust --description "Update the trustdb with the ownertrust values stored in specified files or stdin"
@@ -137,7 +137,7 @@ complete -c gpg -l bzip2-decompress-lowmem --description "Use a different decomp
complete -c gpg -s t -l textmode --description "Treat input files as text and store them in the OpenPGP canonical text form with standard 'CRLF' line endings"
complete -c gpg -l no-textmode --description "Don't treat input files as text and store them in the OpenPGP canonical text form with standard 'CRLF' line endings"
-complete -c gpg -s n -l dry-run --description "Don't make any changes (this is not completely implemented)"
+complete -c gpg -s n -l dry-run --description "Don't make any changes (this is not completely implemented)"
complete -c gpg -s i -l interactive --description "Prompt before overwrite"
@@ -210,7 +210,7 @@ complete -c gpg -l sig-keyserver-url -x --description "Use specified URL as a pr
complete -c gpg -l set-filename -x --description "Use specified string as the filename which is stored inside messages"
complete -c gpg -l for-your-eyes-only --description "Set the 'for your eyes only' flag in the message"
-complete -c gpg -l no-for-your-eyes-only --description "Clear the 'for your eyes only' flag in the message"
+complete -c gpg -l no-for-your-eyes-only --description "Clear the 'for your eyes only' flag in the message"
complete -c gpg -l use-embedded-filename --description "Create file with name as given in data"
complete -c gpg -l no-use-embedded-filename --description "Don't create file with name as given in data"
diff --git a/share/completions/gprof.fish b/share/completions/gprof.fish
index cbccb6280..91ea9ce0a 100644
--- a/share/completions/gprof.fish
+++ b/share/completions/gprof.fish
@@ -19,7 +19,7 @@ complete -c gprof -s x -l all-lines --description "Annotate every line"
complete -xc gprof -l demangle --description "Set demangling style"
complete -c gprof -l no-demangle --description "Turn of demangling"
complete -xc gprof -s a -l no-static --description "Supress static functions"
-complete -xc gprof -s c -l static-call-graph
+complete -xc gprof -s c -l static-call-graph
complete -xc gprof -s D -l ignore-non-functions --description "Ignore symbols not known to be functions"
complete -xc gprof -s k -r --description "Delete arcs from callgraph"
complete -xc gprof -s l -l line --description "Line by line profiling"
diff --git a/share/completions/gzip.fish b/share/completions/gzip.fish
index 10c5b8ab3..507eb71d9 100644
--- a/share/completions/gzip.fish
+++ b/share/completions/gzip.fish
@@ -1,7 +1,7 @@
complete -c gzip -s c -l stdout --description "Compress to stdout"
complete -c gzip -s d -l decompress -x -a "
(
- __fish_complete_suffix .gz
+ __fish_complete_suffix .gz
__fish_complete_suffix .tgz
)
"
diff --git a/share/completions/kill.fish b/share/completions/kill.fish
index c85d983c0..724effa6d 100644
--- a/share/completions/kill.fish
+++ b/share/completions/kill.fish
@@ -4,7 +4,7 @@ set -l signals
if kill -L ^/dev/null >/dev/null
- # Debian and some related systems use 'kill -L' to write out a numbered list
+ # Debian and some related systems use 'kill -L' to write out a numbered list
# of signals. Use this to complete on both number _and_ on signal name.
complete -c kill -s L --description "List codes and names of available signals"
@@ -12,7 +12,7 @@ if kill -L ^/dev/null >/dev/null
set signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | sgrep -E '^[^ ]+')
else
-
+
# Posix systems print out the name of a signal using 'kill -l
# SIGNUM', so we use this instead.
@@ -30,7 +30,7 @@ for i in $signals
complete -c kill -o $number -d $name
complete -c kill -o $name -d $name
complete -c kill -o s -x -a \"$number\tSend\ $name\ signal\"
- complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
+ complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
end
diff --git a/share/completions/make.fish b/share/completions/make.fish
index 0c89d52a2..05845e10d 100644
--- a/share/completions/make.fish
+++ b/share/completions/make.fish
@@ -5,7 +5,7 @@
# filename completion. Unfortunatly, this turns out to be a bit
# complicated to do.
-set -l is_assignment "commandline -ct|sgrep '..*='"
+set -l is_assignment "commandline -ct|sgrep '..*='"
set -l complete_file_assignment '(commandline -ct)(complete --do-complete=this_command_does_not_exist\ (commandline -ct|sed -e \'s/.*=//\'))'
complete -c make --condition $is_assignment -a $complete_file_assignment
diff --git a/share/completions/modprobe.fish b/share/completions/modprobe.fish
index e6625ab32..f36af1c69 100644
--- a/share/completions/modprobe.fish
+++ b/share/completions/modprobe.fish
@@ -15,7 +15,7 @@ complete -c modprobe -s V -l version --description "Display version and exit"
complete -c modprobe -s f -l force --description "Ignore all version information"
complete -c modprobe -l force-vermagic --description "Ignore version magic information"
complete -c modprobe -l force-modversion --description "Ignore module interface version"
-complete -c modprobe -s l -l list --description "List all modules matching the given wildcard"
+complete -c modprobe -s l -l list --description "List all modules matching the given wildcard"
complete -c modprobe -s a -l all --description "Insert modules matching the given wildcard"
complete -c modprobe -s t -l type --description "Restrict wildcards to specified directory"
complete -c modprobe -s s -l syslog --description "Send error messages through syslog"
diff --git a/share/completions/mplayer.fish b/share/completions/mplayer.fish
index ff894bed1..62eaee204 100644
--- a/share/completions/mplayer.fish
+++ b/share/completions/mplayer.fish
@@ -7,19 +7,19 @@
#
set mplayer_lang "
- de\tGerman
- dk\tDanish
- en\tEnglish
+ de\tGerman
+ dk\tDanish
+ en\tEnglish
es\tSpanish
- fi\tFinnish
- fr\tFrench
+ fi\tFinnish
+ fr\tFrench
gr\tGreek
hu\tHungarian
it\tItalian
- jp\tJapanese
- no\tNorwegian
- hu\tHungarian
- pl\tPolish
+ jp\tJapanese
+ no\tNorwegian
+ hu\tHungarian
+ pl\tPolish
pt\tPortugese
se\Swedish
"
diff --git a/share/completions/pacman.fish b/share/completions/pacman.fish
index 89912468a..54662f69f 100644
--- a/share/completions/pacman.fish
+++ b/share/completions/pacman.fish
@@ -32,9 +32,9 @@ complete -c pacman -n '__fish_contains_opt -s Q' -s l -d 'List all files owned b
complete -c pacman -n '__fish_contains_opt -s Q' -s p -d 'Apply the query to a package file and not to an installed package'
# Remove options
-complete -c pacman -n '__fish_contains_opt -s R' -s c -d 'Remove also the packages that depends on the target packages'
-complete -c pacman -n '__fish_contains_opt -s R' -s k -d 'Remove the database entries only'
-complete -c pacman -n '__fish_contains_opt -s R' -s n -d 'Ignore file backup designations'
+complete -c pacman -n '__fish_contains_opt -s R' -s c -d 'Remove also the packages that depends on the target packages'
+complete -c pacman -n '__fish_contains_opt -s R' -s k -d 'Remove the database entries only'
+complete -c pacman -n '__fish_contains_opt -s R' -s n -d 'Ignore file backup designations'
complete -c pacman -n '__fish_contains_opt -s R' -s s -d 'Remove also the dependencies of the target packages'
# Sync options
@@ -54,6 +54,6 @@ complete -c pacman -n '__fish_contains_opt -s S' -l noprogressbar -d 'Do not sho
# Complete with local packages
complete -c pacman -n '__fish_contains_opt -s A -s F -s U' -a '(__fish_complete_suffix pkg.tar.gz)' -d 'Local package'
# Complete with installed packages
-complete -c pacman -n '__fish_contains_opt -s Q -s R' -a '(pacman -Q | cut --delim " " --fields 1)' -d 'Installed package'
+complete -c pacman -n '__fish_contains_opt -s Q -s R' -a '(pacman -Q | cut --delim " " --fields 1)' -d 'Installed package'
# Complete with packages in the repos
complete -c pacman -n '__fish_contains_opt -s S' -a '(pacman -Sl | cut --delim " " --fields 2 | sort)' -d 'Repo package'
diff --git a/share/completions/ping.fish b/share/completions/ping.fish
index 37ef21acb..1ddebc048 100644
--- a/share/completions/ping.fish
+++ b/share/completions/ping.fish
@@ -13,7 +13,7 @@ complete -c ping -s l --description "Send the specified number of packets withou
complete -c ping -s L --description "Suppress loopback of multicast packets"
complete -c ping -s n --description "Numeric output only"
complete -c ping -s p --description "Pad packet with empty bytes" -x
-complete -c ping -s Q --description "Set Quality of Service -related bits in ICMP datagrams" -x
+complete -c ping -s Q --description "Set Quality of Service -related bits in ICMP datagrams" -x
complete -c ping -s q --description "Quiet mode"
complete -c ping -s R --description "Record route"
complete -c ping -s r --description "Bypass the normal routing tables and send directly to a host on an attached interface"
diff --git a/share/completions/quilt.fish b/share/completions/quilt.fish
index acfc5d784..6bf353cca 100644
--- a/share/completions/quilt.fish
+++ b/share/completions/quilt.fish
@@ -16,7 +16,7 @@ complete -c quilt -a fork -r --no-file -d " Fork the topmost patch"
complete -c quilt -a graph -r --no-file -d "Generate a dot(1) directed graph showing the dependencies between applied patches"
complete -c quilt -a grep -r --no-file -d "Grep through the source files, recursively, skipping patches and quilt meta-information"
complete -c quilt -a header -r --no-file -d " Print or change the header of the topmost or specified patch"
-complete -c quilt -a import -r -d "Import external patches"
+complete -c quilt -a import -r -d "Import external patches"
complete -c quilt -a mail -r -d "Create mail messages from all patches in the series file, and either store or send them"
complete -c quilt -a new -r -d "Create a new patch with the specified file name, and insert it after the topmost patch"
complete -c quilt -a next -r -d "Print the name of the next patch after the specified or topmost patch in the series file"
diff --git a/share/completions/scons.fish b/share/completions/scons.fish
index 5cba11560..5648d3c54 100644
--- a/share/completions/scons.fish
+++ b/share/completions/scons.fish
@@ -12,8 +12,8 @@ complete -c scons -l cache-force -l cache-populate --description 'When using Cac
complete -c scons -l cache-show --description 'When using CacheDir() and retrieving a derived file from the cache, show the command that would have been executed to build the file, instead of the usual report, "Retrieved file from cache'
complete -c scons -l config --description 'This specifies how the Configure call should use or generate the results of configuration tests' -a '
- auto\t"Use normal dependency mechanism"
- force\t"Rerun all tests"
+ auto\t"Use normal dependency mechanism"
+ force\t"Rerun all tests"
cache\t"Take all results from cache"' -x
complete -c scons -s C --description 'Directory, --directory=directory Change to the specified directory before searching for the SCon struct, Sconstruct, or sconstruct file, or doing anything else'
diff --git a/share/completions/sed.fish b/share/completions/sed.fish
index 715d4dee8..dd953ac43 100644
--- a/share/completions/sed.fish
+++ b/share/completions/sed.fish
@@ -4,12 +4,12 @@
# Test if we are using GNU sed
-set -l is_gnu
+set -l is_gnu
sed --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
# Shared ls switches
-__fish_gnu_complete -c sed -s n -l quiet --description "Silent mode" $is_gnu
+__fish_gnu_complete -c sed -s n -l quiet --description "Silent mode" $is_gnu
__fish_gnu_complete -c sed -s e -l expression -x --description "Evaluate expression" $is_gnu
__fish_gnu_complete -c sed -s f -l file -r --description "Evalute file" $is_gnu
__fish_gnu_complete -c sed -s i -l in-place --description "Edit files in place" $is_gnu
diff --git a/share/completions/set.fish b/share/completions/set.fish
index 4ff267162..86647e969 100644
--- a/share/completions/set.fish
+++ b/share/completions/set.fish
@@ -22,11 +22,11 @@ function __fish_set_is_color -d 'Test if We are specifying a color value for the
return 0
case '-*'
-
+
case '*'
return 1
end
- end
+ end
return 1
end
@@ -40,11 +40,11 @@ function __fish_set_is_locale -d 'Test if We are specifying a locale value for t
return 0
case '-*'
-
+
case '*'
return 1
end
- end
+ end
return 1
end
diff --git a/share/completions/status.fish b/share/completions/status.fish
index cb4040321..dc98703af 100644
--- a/share/completions/status.fish
+++ b/share/completions/status.fish
@@ -7,5 +7,5 @@ complete -c status -l is-login --description "Test if this is a login shell"
complete -c status -l is-full-job-control --description "Test if all new jobs are put under job control"
complete -c status -l is-interactive-job-control --description "Test if only interactive new jobs are put under job control"
complete -c status -l is-no-job-control --description "Test if new jobs are never put under job control"
-complete -c status -s j -l job-control -xa "full interactive none" --description "Set which jobs are out under job control"
+complete -c status -s j -l job-control -xa "full interactive none" --description "Set which jobs are out under job control"
complete -c status -s t -l print-stack-trace --description "Print a list of all function calls leading up to running the current command"
diff --git a/share/completions/su.fish b/share/completions/su.fish
index c75a617e0..990a0ae50 100644
--- a/share/completions/su.fish
+++ b/share/completions/su.fish
@@ -2,7 +2,7 @@
complete -x -c su -a "(__fish_complete_users)"
complete -c su -s l -l login --description "Make login shell"
-complete -r -c su -s c -l command --description "Pass command to shell" -xa "(__fish_complete_command)"
+complete -r -c su -s c -l command --description "Pass command to shell" -xa "(__fish_complete_command)"
complete -c su -s f -l fast --description "Pass -f to the shell"
complete -c su -s m -l preserve_environment --description "Preserve environment"
complete -c su -s p --description "Preserve environment"
diff --git a/share/completions/unrar.fish b/share/completions/unrar.fish
index c457936b8..a6e0a9ba9 100644
--- a/share/completions/unrar.fish
+++ b/share/completions/unrar.fish
@@ -3,9 +3,9 @@
complete -c unrar -a "(__fish_complete_unrar)"
complete -x -c unrar -n '__fish_use_subcommand' -a e --description "Extract files to current directory"
-complete -x -c unrar -n '__fish_use_subcommand' -a l --description "List archive"
-complete -x -c unrar -n '__fish_use_subcommand' -a lt --description "List archive (technical)"
-complete -x -c unrar -n '__fish_use_subcommand' -a lb --description "List archive (bare)"
+complete -x -c unrar -n '__fish_use_subcommand' -a l --description "List archive"
+complete -x -c unrar -n '__fish_use_subcommand' -a lt --description "List archive (technical)"
+complete -x -c unrar -n '__fish_use_subcommand' -a lb --description "List archive (bare)"
complete -x -c unrar -n '__fish_use_subcommand' -a p --description "Print file to stdout"
complete -x -c unrar -n '__fish_use_subcommand' -a t --description "Test archive files"
complete -x -c unrar -n '__fish_use_subcommand' -a v --description "Verbosely list archive"
diff --git a/share/completions/xargs.fish b/share/completions/xargs.fish
index 9858ed550..13948b529 100644
--- a/share/completions/xargs.fish
+++ b/share/completions/xargs.fish
@@ -6,15 +6,15 @@ complete -c xargs -s 0 -l null --description "Input filenames are terminated by
complete -c xargs -s e -l eof --description "Set the end of file string to eof-str"
complete -c xargs -s E -r -f --description "Set the end of file string to eof-str"
complete -c xargs -l help --description "Display help and exit"
-complete -c xargs -s i -l replace --description "Replace replace-str in the initial arguments with names from standard input"
+complete -c xargs -s i -l replace --description "Replace replace-str in the initial arguments with names from standard input"
complete -c xargs -s I -r -f --description "Replace replace-str in the initial arguments with names from standard input"
complete -c xargs -s l -l max-lines --description "Use at most max-lines nonblank input lines per command line"
complete -c xargs -s L -r -f --description "Use at most max-lines nonblank input lines per command line"
complete -c xargs -s n -l max-args -r -f --description "Use at most max-args arguments per command line"
complete -c xargs -s p -l interactive --description "Prompt the user about whether to run each command line and read a line from the terminal"
-complete -c xargs -s r -l no-run-if-empty --description "If the standard input does not contain any nonblanks, do not run the command"
+complete -c xargs -s r -l no-run-if-empty --description "If the standard input does not contain any nonblanks, do not run the command"
complete -c xargs -s s -l max-chars -r -f --description "Use at most max-chars characters per command line"
complete -c xargs -s t -l verbose --description "Print the command line on the standard error output before executing it"
complete -c xargs -l version --description "Display version and exit"
complete -c xargs -s x -l exit --description "Exit if the size is exceeded"
-complete -c xargs -s P -l max-procs -r -f --description "Run up to max-procs processes at a time"
+complete -c xargs -s P -l max-procs -r -f --description "Run up to max-procs processes at a time"
diff --git a/share/completions/xprop.fish b/share/completions/xprop.fish
index 612f42eaf..da56ea609 100644
--- a/share/completions/xprop.fish
+++ b/share/completions/xprop.fish
@@ -9,7 +9,7 @@ complete -c xprop -o display --description "Specify X server"
complete -c xprop -o len -x --description "Maximum display length"
complete -c xprop -o notype --description "Do not show property type"
complete -c xprop -o fs -r --description "Set format file"
-complete -c xprop -o frame --description "Select a window by clicking on its frame"
+complete -c xprop -o frame --description "Select a window by clicking on its frame"
complete -c xprop -o remove --description "Remove property" -x -a "
(
xprop -root -notype|cut -d ' ' -f 1|cut -d \t -f 1
diff --git a/share/completions/yum.fish b/share/completions/yum.fish
index 78dcb5874..e5a9d20bb 100644
--- a/share/completions/yum.fish
+++ b/share/completions/yum.fish
@@ -7,7 +7,7 @@
# Test if completing using package names is appropriate
function __fish_yum_package_ok
for i in (commandline -poc)
- if contains $i update upgrade remove erase
+ if contains $i update upgrade remove erase
return 0
end
end
@@ -27,21 +27,21 @@ complete -c yum -n '__fish_use_subcommand' -xa generate-rss --description "Gener
complete -c yum -n '__fish_yum_package_ok' -a "(__fish_print_packages)"
-complete -c yum -s h -l help --description "Display help and exit"
-complete -c yum -s y --description "Assume yes to all questions"
-complete -c yum -s c --description "Configuration file" -r
-complete -c yum -s d --description "Set debug level" -x
-complete -c yum -s e --description "Set error level" -x
-complete -c yum -s t -l tolerant --description "Be tolerant of errors in commandline"
+complete -c yum -s h -l help --description "Display help and exit"
+complete -c yum -s y --description "Assume yes to all questions"
+complete -c yum -s c --description "Configuration file" -r
+complete -c yum -s d --description "Set debug level" -x
+complete -c yum -s e --description "Set error level" -x
+complete -c yum -s t -l tolerant --description "Be tolerant of errors in commandline"
complete -c yum -s R --description "Set maximum delay between commands" -x
-complete -c yum -s c --description "Run commands from cache"
-complete -c yum -l version --description "Display version and exit"
-complete -c yum -l installroot --description "Specify installroot" -r
-complete -c yum -l enablerepo --description "Enable repository" -r
+complete -c yum -s c --description "Run commands from cache"
+complete -c yum -l version --description "Display version and exit"
+complete -c yum -l installroot --description "Specify installroot" -r
+complete -c yum -l enablerepo --description "Enable repository" -r
complete -c yum -l disablerepo --description "Disable repository" -r
-complete -c yum -l obsoletes --description "Enables obsolets processing logic"
-complete -c yum -l rss-filename --description "Output rss-data to file" -r
-complete -c yum -l exclude --description "Exclude specified package from updates" -a "(__fish_print_packages)"
+complete -c yum -l obsoletes --description "Enables obsolets processing logic"
+complete -c yum -l rss-filename --description "Output rss-data to file" -r
+complete -c yum -l exclude --description "Exclude specified package from updates" -a "(__fish_print_packages)"
complete -c yum -n 'contains list (commandline -poc)' -a all --description 'List all packages'
complete -c yum -n 'contains list (commandline -poc)' -a available --description 'List packages available for installation'
diff --git a/share/config.fish.in b/share/config.fish.in
index 085d8a85e..dc1c0f074 100644
--- a/share/config.fish.in
+++ b/share/config.fish.in
@@ -34,20 +34,20 @@ end
# Set up function and completion paths. Make sure that the fish
# default functions/completions are included in the respective path.
-if not set -q fish_function_path
- set -U fish_function_path $configdir/fish/functions @sysconfdir@/fish/functions @datadir@/fish/functions
+if not set -q fish_function_path
+ set -U fish_function_path $configdir/fish/functions @sysconfdir@/fish/functions @datadir@/fish/functions
end
-if not contains @datadir@/fish/functions $fish_function_path
- set fish_function_path[-1] @datadir@/fish/functions
+if not contains @datadir@/fish/functions $fish_function_path
+ set fish_function_path[-1] @datadir@/fish/functions
end
-if not set -q fish_complete_path
- set -U fish_complete_path $configdir/fish/completions @sysconfdir@/fish/completions @datadir@/fish/completions
+if not set -q fish_complete_path
+ set -U fish_complete_path $configdir/fish/completions @sysconfdir@/fish/completions @datadir@/fish/completions
end
-if not contains @datadir@/fish/completions $fish_complete_path
- set fish_complete_path[-1] @datadir@/fish/completions
+if not contains @datadir@/fish/completions $fish_complete_path
+ set fish_complete_path[-1] @datadir@/fish/completions
end
set __fish_help_dir @docdir@
@@ -62,9 +62,9 @@ set __fish_help_dir @docdir@
if test -d /usr/xpg4/bin
if not contains /usr/xpg4/bin $PATH
- set PATH /usr/xpg4/bin $PATH
+ set PATH /usr/xpg4/bin $PATH
end
-end
+end
#
# Add a few common directories to path, if they exists. Note that pure
diff --git a/share/functions/__fish_append.fish b/share/functions/__fish_append.fish
index 41b92d439..43caa26c0 100644
--- a/share/functions/__fish_append.fish
+++ b/share/functions/__fish_append.fish
@@ -1,7 +1,7 @@
function __fish_append -d "Internal completion function for appending string to the commandline" --argument separator
set -e argv[1]
set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//")
- printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/")
+ printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/")
end
diff --git a/share/functions/__fish_bind_test1.fish b/share/functions/__fish_bind_test1.fish
index 37f5eeb0e..b4380c18f 100644
--- a/share/functions/__fish_bind_test1.fish
+++ b/share/functions/__fish_bind_test1.fish
@@ -3,13 +3,13 @@ function __fish_bind_test1
set -l args
set -l use_keys no
-for i in (commandline -poc)
+for i in (commandline -poc)
switch $i
case -k --k --ke --key
set use_keys yes
case "-*"
-
+
case "*"
set args $args $i
end
diff --git a/share/functions/__fish_bind_test2.fish b/share/functions/__fish_bind_test2.fish
index 8530451c0..4c7f684ac 100644
--- a/share/functions/__fish_bind_test2.fish
+++ b/share/functions/__fish_bind_test2.fish
@@ -4,7 +4,7 @@ set -l args
for i in (commandline -poc)
switch $i
case "-*"
-
+
case "*"
set args $args $i
end
diff --git a/share/functions/__fish_commandline_test.fish b/share/functions/__fish_commandline_test.fish
index af533eb2e..a32512cfb 100644
--- a/share/functions/__fish_commandline_test.fish
+++ b/share/functions/__fish_commandline_test.fish
@@ -2,7 +2,7 @@
function __fish_commandline_test
set -l is_function no
-for i in (commandline -poc)
+for i in (commandline -poc)
switch $i
case -f --f --fu --fun --func --funct --functi --functio --function
set is_function yes
@@ -10,7 +10,7 @@ for i in (commandline -poc)
case --
break
-
+
end
end
diff --git a/share/functions/__fish_complete_ant_targets.fish b/share/functions/__fish_complete_ant_targets.fish
index f8b286439..61dde00a6 100644
--- a/share/functions/__fish_complete_ant_targets.fish
+++ b/share/functions/__fish_complete_ant_targets.fish
@@ -8,7 +8,7 @@ function __fish_complete_ant_targets -d "Print list of targets from build.xml an
set files (sed -n "s/^.*]* file=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $buildfile)
# iterate through files and display their targets
- for file in $files;
+ for file in $files;
__fish_filter_ant_targets $file
end
end
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish
index c4a6695ac..dbc7f766b 100644
--- a/share/functions/__fish_complete_cd.fish
+++ b/share/functions/__fish_complete_cd.fish
@@ -17,21 +17,21 @@ function __fish_complete_cd -d "Completions for the cd command"
set mycdpath $CDPATH
end
-
+
if echo (commandline -ct)|sgrep '^/\|^\./\|^\.\./' >/dev/null
# This is an absolute search path
eval printf '\%s\\tDirectory\\n' (commandline -ct)\*/
else
# This is a relative search path
- # Iterate over every directory in CDPATH
+ # Iterate over every directory in CDPATH
# and check for possible completions
for i in $mycdpath
- # Move to the initial directory first,
+ # Move to the initial directory first,
# in case the CDPATH directory is relative
builtin cd $wd
- builtin cd $i
+ eval builtin cd $i
eval printf '"%s\tDirectory in "'$i'"\n"' (commandline -ct)\*/
end
diff --git a/share/functions/__fish_complete_file_url.fish b/share/functions/__fish_complete_file_url.fish
index a85bd55c3..28af18080 100644
--- a/share/functions/__fish_complete_file_url.fish
+++ b/share/functions/__fish_complete_file_url.fish
@@ -12,7 +12,7 @@ function __fish_complete_file_url
if test file:// = $prefix
set -l stripped (echo $comp|cut -c 8-)
- printf "%s\n" file://(complete -C"echo $stripped")
+ printf "%s\n" file://(complete -C"echo $stripped")
else
echo file://
end
diff --git a/share/functions/__fish_complete_ls.fish b/share/functions/__fish_complete_ls.fish
index ff3bf4e0a..652a02d37 100644
--- a/share/functions/__fish_complete_ls.fish
+++ b/share/functions/__fish_complete_ls.fish
@@ -5,14 +5,14 @@
# Test if we are using GNU ls
function __fish_complete_ls -d "Compleletions for ls and its aliases"
-
- set -l is_gnu
+
+ set -l is_gnu
command ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
-
+
set -l cmds -c $argv
-
+
# Shared ls switches
-
+
__fish_gnu_complete $cmds -s a -l all --description "Show hidden" $is_gnu
__fish_gnu_complete $cmds -s A -l almost-all --description "Show hidden except . and .." $is_gnu
__fish_gnu_complete $cmds -s F -l classify --description "Append filetype indicator" $is_gnu
@@ -28,7 +28,7 @@ function __fish_complete_ls -d "Compleletions for ls and its aliases"
__fish_gnu_complete $cmds -s q -l hide-control-chars --description "Replace non-graphic characters with '?'" $is_gnu
__fish_gnu_complete $cmds -s r -l reverse --description "Reverse sort order" $is_gnu
__fish_gnu_complete $cmds -s s -l size --description "Print size of files" $is_gnu
-
+
complete $cmds -s C --description "List by columns"
complete $cmds -s S --description "Sort by size"
complete $cmds -s c --description "Show and sort by ctime"
@@ -41,11 +41,11 @@ function __fish_complete_ls -d "Compleletions for ls and its aliases"
complete $cmds -s u --description "Show access time"
complete $cmds -s x --description "List entries by lines"
complete $cmds -s 1 --description "List one file per line"
-
+
if test -n "$is_gnu"
-
+
# GNU specific ls switches
-
+
complete $cmds -l hide --description "Do not list implied entries matching specified shell pattern" -r
complete $cmds -l lcontext --description "Display security context"
complete $cmds -l context -s Z --description "Display security context so it fits on most displays"
@@ -94,11 +94,11 @@ function __fish_complete_ls -d "Compleletions for ls and its aliases"
complete $cmds -s X --description "Sort by extension"
complete $cmds -l help --description "Display help and exit"
complete $cmds -l version --description "Display version and exit"
-
+
else
-
+
# If not a GNU system, assume we have standard BSD ls features instead
-
+
complete $cmds -s B --description "Octal escapes for non graphic characters"
complete $cmds -s G --description "Use colors"
complete $cmds -s I --description "Prevent -A from being automatically set for root"
@@ -108,7 +108,7 @@ function __fish_complete_ls -d "Compleletions for ls and its aliases"
complete $cmds -s Z --description "Display each file's MAC label"
complete $cmds -s o --description "Include the file flags in a long (-l) output"
complete $cmds -s w --description "Print raw entry names"
-
+
end
-
+
end
diff --git a/share/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish
index dad6ed0d8..7be041f0c 100644
--- a/share/functions/__fish_complete_man.fish
+++ b/share/functions/__fish_complete_man.fish
@@ -1,5 +1,5 @@
-function __fish_complete_man
+function __fish_complete_man
if test (commandline -ct)
# Try to guess what section to search in. If we don't know, we
@@ -11,13 +11,13 @@ function __fish_complete_man
while count $prev
switch $prev[1]
case '-**'
-
+
case '*'
set section $prev[1]
end
set -e prev[1]
end
-
+
set section $section"[^)]*"
# Do the actual search
diff --git a/share/functions/__fish_complete_subcommand.fish b/share/functions/__fish_complete_subcommand.fish
index 78803a88b..c002b8123 100644
--- a/share/functions/__fish_complete_subcommand.fish
+++ b/share/functions/__fish_complete_subcommand.fish
@@ -24,7 +24,7 @@ function __fish_complete_subcommand -d "Complete subcommand"
switch $i
case '-*'
case '*=*'
-
+
case '*'
set had_cmd 1
set res $i
diff --git a/share/functions/__fish_complete_subcommand_root.fish b/share/functions/__fish_complete_subcommand_root.fish
index 49504ce4e..b6b2152e5 100644
--- a/share/functions/__fish_complete_subcommand_root.fish
+++ b/share/functions/__fish_complete_subcommand_root.fish
@@ -1,7 +1,7 @@
function __fish_complete_subcommand_root -d "Run the __fish_complete_subcommand function using a PATH containing /sbin and /usr/sbin"
- set -l PATH_OLD $PATH
+ set -l PATH_OLD $PATH
set PATH /sbin /usr/sbin $PATH
__fish_complete_subcommand
set PATH $PATH_OLD
diff --git a/share/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish
index 035911a76..5abdb2ffd 100644
--- a/share/functions/__fish_complete_suffix.fish
+++ b/share/functions/__fish_complete_suffix.fish
@@ -9,9 +9,9 @@ function __fish_complete_suffix -d "Complete using files"
# Variable declarations
- set -l comp
- set -l suff
- set -l desc
+ set -l comp
+ set -l suff
+ set -l desc
set -l files
switch (count $argv)
diff --git a/share/functions/__fish_complete_tar.fish b/share/functions/__fish_complete_tar.fish
index f19d6727f..91a795015 100644
--- a/share/functions/__fish_complete_tar.fish
+++ b/share/functions/__fish_complete_tar.fish
@@ -11,21 +11,21 @@ function __fish_complete_tar -d "Peek inside of archives and list all files"
case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2'
if test -f $i
set -l file_list (tar -jt <$i)
- printf (_ "%s\tArchived file\n") $file_list
+ printf (_ "%s\tArchived file\n") $file_list
end
return
case '*.tar.gz' '*.tgz'
if test -f $i
set -l file_list (tar -it <$i)
- printf (_ "%s\tArchived file\n") $file_list
+ printf (_ "%s\tArchived file\n") $file_list
end
return
case '*.tar'
if test -f $i
set -l file_list (tar -t <$i)
- printf (_ "%s\tArchived file\n") $file_list
+ printf (_ "%s\tArchived file\n") $file_list
end
return
end
diff --git a/share/functions/__fish_complete_unrar.fish b/share/functions/__fish_complete_unrar.fish
index b9a0fda16..1c86794e5 100644
--- a/share/functions/__fish_complete_unrar.fish
+++ b/share/functions/__fish_complete_unrar.fish
@@ -11,7 +11,7 @@ function __fish_complete_unrar -d "Peek inside of archives and list all files"
case '*.rar'
if test -f $i
set -l file_list (unrar vb $i)
- printf (_ "%s\tArchived file\n") $file_list
+ printf (_ "%s\tArchived file\n") $file_list
end
return
end
diff --git a/share/functions/__fish_complete_vi.fish b/share/functions/__fish_complete_vi.fish
index 7b756f298..ba7dc10b5 100644
--- a/share/functions/__fish_complete_vi.fish
+++ b/share/functions/__fish_complete_vi.fish
@@ -4,13 +4,13 @@ function __fish_complete_vi -d "Compleletions for vi and its aliases"
set -l is_vim
command vi --version >/dev/null ^/dev/null; and set is_vim vim
-
+
set -l cmds -c $argv
# vim
if test -n "$is_vim"
-
+
# these don't work
#complete $cmds -a - --description 'The file to edit is read from stdin. Commands are read from stderr, which should be a tty'
@@ -105,7 +105,7 @@ function __fish_complete_vi -d "Compleletions for vi and its aliases"
complete $cmds -r -c t --description 'Begin editing by executing the specified editor command'
end
-
+
end
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index 11ad98544..e2ace3f0c 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -32,8 +32,8 @@ function __fish_config_interactive -d "Initializations that should be performed
end
if test -d $configdir
- if command mkdir $configdir/fish
-
+ if command mkdir $configdir/fish
+
# These files are sometimes overwritten to by fish, so
# we want backups of them in case something goes wrong
@@ -51,7 +51,7 @@ function __fish_config_interactive -d "Initializations that should be performed
#
# Move the fishd stuff from another shell to avoid concurrency problems
#
-
+
/bin/sh -c mv\ \~/.fishd.(hostname)\ $configdir/fish/fishd.(hostname)\;kill\ -9\ (echo %fishd)
# Update paths to point to new configuration locations
@@ -70,12 +70,12 @@ function __fish_config_interactive -d "Initializations that should be performed
# Make sure this is only done once
set -U __fish_init_1_22_0
-
+
end
#
# If we are starting up for the first time, set various defaults
- #
+ #
if not set -q __fish_init_1_23_0
if not set -q fish_greeting
@@ -91,7 +91,7 @@ function __fish_config_interactive -d "Initializations that should be performed
function set_default -d "Set a universal variable, unless it has already been set"
if not set -q $argv[1]
- set -U -- $argv
+ set -U -- $argv
end
end
@@ -139,11 +139,11 @@ function __fish_config_interactive -d "Initializations that should be performed
#
functions -e set_default
-
+
end
#
- # Print a greeting
+ # Print a greeting
#
if functions -q fish_greeting
@@ -153,7 +153,7 @@ function __fish_config_interactive -d "Initializations that should be performed
switch $fish_greeting
case ''
# If variable is empty, don't print anything, saves us a fork
-
+
case '*'
echo $fish_greeting
end
@@ -189,7 +189,7 @@ function __fish_config_interactive -d "Initializations that should be performed
end
#
- # Completions for SysV startup scripts. These aren't bound to any
+ # Completions for SysV startup scripts. These aren't bound to any
# specific command, so they can't be autoloaded.
#
@@ -203,11 +203,11 @@ function __fish_config_interactive -d "Initializations that should be performed
if not set -q fish_key_bindings
set -U fish_key_bindings fish_default_key_bindings
end
-
+
# Reload keybindings when binding variable change
function __fish_reload_key_bindings -d "Reload keybindings when binding variable change" --on-variable fish_key_bindings
eval $fish_key_bindings ^/dev/null
- end
+ end
# Load keybindings
__fish_reload_key_bindings
@@ -220,11 +220,11 @@ function __fish_config_interactive -d "Initializations that should be performed
# If the ubuntu command-not-found package can be found, add a handler for it
# First check in /usr/lib, this is where modern Ubuntus place this command
- if test -f /usr/lib/command-not-found
+ if test -f /usr/lib/command-not-found
function fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found $argv
end
- else
+ else
# Ubuntu Feisty places this command in the regular path instead
if type -p command-not-found >/dev/null
function fish_command_not_found_handler --on-event fish_command_not_found
diff --git a/share/functions/__fish_contains_opt.fish b/share/functions/__fish_contains_opt.fish
index f38adb40c..b786fe3be 100644
--- a/share/functions/__fish_contains_opt.fish
+++ b/share/functions/__fish_contains_opt.fish
@@ -1,13 +1,13 @@
function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline"
- set -l next_short
+ set -l next_short
set -l short_opt
- set -l long_opt
+ set -l long_opt
for i in $argv
- if test $next_short
- set next_short
+ if test $next_short
+ set next_short
set short_opt $short_opt $i
else
switch $i
@@ -32,7 +32,7 @@ function __fish_contains_opt -d "Checks if a specific option has been given in t
if commandline -cpo | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 0
end
-
+
if commandline -ct | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 0
end
diff --git a/share/functions/__fish_crux_packages.fish b/share/functions/__fish_crux_packages.fish
index 8cd88f4a2..fa96e4803 100644
--- a/share/functions/__fish_crux_packages.fish
+++ b/share/functions/__fish_crux_packages.fish
@@ -1,4 +1,4 @@
-# a function to obtain a list of installed packages with CRUX pkgutils
+# a function to obtain a list of installed packages with CRUX pkgutils
function __fish_crux_packages -d 'Obtain a list of installed packages'
pkginfo -i|cut -d' ' -f1
end
diff --git a/share/functions/__fish_gnu_complete.fish b/share/functions/__fish_gnu_complete.fish
index 47885845f..ae8009403 100644
--- a/share/functions/__fish_gnu_complete.fish
+++ b/share/functions/__fish_gnu_complete.fish
@@ -6,7 +6,7 @@ function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the lon
# Check if we are using a gnu system
for i in $argv
switch $i
-
+
case -g --is-gnu
set is_gnu 1
@@ -31,7 +31,7 @@ function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the lon
continue
end
-
+
switch $i
case -l --long
@@ -45,7 +45,7 @@ function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the lon
set argv $argv_out
end
-
+
complete $argv
end
diff --git a/share/functions/__fish_move_last.fish b/share/functions/__fish_move_last.fish
index b4a70f8c0..c1d060439 100644
--- a/share/functions/__fish_move_last.fish
+++ b/share/functions/__fish_move_last.fish
@@ -14,14 +14,14 @@ function __fish_move_last -d "Move the last element of a directory history from
set -g (echo $dest) $$dest (command pwd)
set ssrc $$src
-
+
# Change dir to the last entry in the source dir-hist
builtin cd $ssrc[$size_src]
- # Keep all but the last from the source dir-hist
+ # Keep all but the last from the source dir-hist
set -e (echo $src)\[$size_src]
# All ok, return success
return 0
-end
+end
diff --git a/share/functions/__fish_no_arguments.fish b/share/functions/__fish_no_arguments.fish
index e47a42726..b2ce27814 100644
--- a/share/functions/__fish_no_arguments.fish
+++ b/share/functions/__fish_no_arguments.fish
@@ -5,7 +5,7 @@ function __fish_no_arguments -d "Internal fish function"
for i in $cmd
switch $i
case '-*'
-
+
case '*'
return 1
end
diff --git a/share/functions/__fish_not_contain_opt.fish b/share/functions/__fish_not_contain_opt.fish
index 0a7e0f561..8320607f2 100644
--- a/share/functions/__fish_not_contain_opt.fish
+++ b/share/functions/__fish_not_contain_opt.fish
@@ -1,12 +1,12 @@
function __fish_not_contain_opt -d "Checks that a specific option is not in the current commandline"
- set -l next_short
+ set -l next_short
set -l short_opt
- set -l long_opt
+ set -l long_opt
for i in $argv
- if test $next_short
- set next_short
+ if test $next_short
+ set next_short
set short_opt $short_opt $i
else
switch $i
@@ -31,7 +31,7 @@ function __fish_not_contain_opt -d "Checks that a specific option is not in the
if commandline -cpo | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 1
end
-
+
if commandline -ct | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 1
end
diff --git a/share/functions/__fish_paginate.fish b/share/functions/__fish_paginate.fish
index 992993b6c..01708f9cd 100644
--- a/share/functions/__fish_paginate.fish
+++ b/share/functions/__fish_paginate.fish
@@ -6,7 +6,7 @@ function __fish_paginate -d "Paginate the current command using the users defaul
end
if commandline -j|grep -v "$cmd *\$" >/dev/null
-
+
commandline -aj "|$cmd;"
end
diff --git a/share/functions/__fish_print_filesystems.fish b/share/functions/__fish_print_filesystems.fish
index 0eeea3c81..d7222f833 100644
--- a/share/functions/__fish_print_filesystems.fish
+++ b/share/functions/__fish_print_filesystems.fish
@@ -1,8 +1,8 @@
function __fish_print_filesystems -d "Print a list of all known filesystem types"
- set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3
- set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs
+ set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3
+ set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs
set fs $fs reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs
- printf "%s\n" $fs
+ printf "%s\n" $fs
end
diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish
index f6022a575..b213c8811 100644
--- a/share/functions/__fish_print_help.fish
+++ b/share/functions/__fish_print_help.fish
@@ -20,7 +20,7 @@ function __fish_print_help --description "Print help message for the specified f
set -l cmd3 s/.\x08'\(.\)'/(set_color --bold)\\1(set_color normal)/g
# Combine all expressions in a single variable
- set -l sed_cmd -e $cmd1 -e $cmd2 -e $cmd3
+ set -l sed_cmd -e $cmd1 -e $cmd2 -e $cmd3
# Render help output, save output into the variable 'help'
set -l help (nroff -man $__fish_datadir/man/$item.1)
diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish
index fb24ffff2..8dae87b91 100644
--- a/share/functions/__fish_print_packages.fish
+++ b/share/functions/__fish_print_packages.fish
@@ -25,12 +25,12 @@ function __fish_print_packages
# Rpm is too slow for this job, so we set it up to do completions
# as a background job and cache the results.
- if type -f rpm >/dev/null
+ if type -f rpm >/dev/null
# If the cache is less than five minutes old, we do not recalculate it
set cache_file /tmp/.rpm-cache.$USER
- if test -f $cache_file
+ if test -f $cache_file
cat $cache_file
set age (math (date +%s) - (stat -c '%Y' $cache_file))
set max_age 250
@@ -43,8 +43,8 @@ function __fish_print_packages
rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/'\t$package'/' &
end
- # This completes the package name from the portage tree.
- # True for installing new packages. Function for printing
+ # This completes the package name from the portage tree.
+ # True for installing new packages. Function for printing
# installed on the system packages is in completions/emerge.fish
if type -f emerge >/dev/null
emerge -s \^(commandline -tc) |sgrep "^*" |cut -d\ -f3 |cut -d/ -f2
diff --git a/share/functions/__fish_prt_use_package.fish b/share/functions/__fish_prt_use_package.fish
index edb2e7f7e..b7c480342 100644
--- a/share/functions/__fish_prt_use_package.fish
+++ b/share/functions/__fish_prt_use_package.fish
@@ -1,7 +1,7 @@
# a function to verify if prt-get should have packages as potential completion
function __fish_prt_use_package -d 'Test if prt-get should have packages as potential completion'
for i in (commandline -opc)
- if contains -- $i update remove lock unlock current
+ if contains -- $i update remove lock unlock current
return 0
end
end
diff --git a/share/functions/cd.fish b/share/functions/cd.fish
index 64ac705d2..8faa469d7 100644
--- a/share/functions/cd.fish
+++ b/share/functions/cd.fish
@@ -21,7 +21,7 @@ function cd --description "Change directory"
end
return $status
end
-
+
builtin cd $argv[1]
set -l cd_status $status
diff --git a/share/functions/dirh.fish b/share/functions/dirh.fish
index 411a2816a..582017678 100644
--- a/share/functions/dirh.fish
+++ b/share/functions/dirh.fish
@@ -1,5 +1,5 @@
-function dirh --description "Print the current directory history (the back- and fwd- lists)"
+function dirh --description "Print the current directory history (the back- and fwd- lists)"
if count $argv >/dev/null
switch $argv[1]
@@ -25,7 +25,7 @@ function dirh --description "Print the current directory history (the back- and
set_color $fish_color_history_current
echo -n -e $current$separator
set_color normal
-
+
for i in (seq (echo (count $dirnext)) -1 1)
echo -n -e $dirnext[$i]$separator
end
diff --git a/share/functions/down-or-search.fish b/share/functions/down-or-search.fish
index c9e8b256a..3f775bfbf 100644
--- a/share/functions/down-or-search.fish
+++ b/share/functions/down-or-search.fish
@@ -6,7 +6,7 @@ function down-or-search -d "Depending on cursor position and current mode, eithe
end
# We are not already in search mode.
- # If we are on the bottom line, start search mode,
+ # If we are on the bottom line, start search mode,
# otherwise move down
set lineno (commandline -L)
set line_count (commandline|wc -l)
@@ -14,7 +14,7 @@ function down-or-search -d "Depending on cursor position and current mode, eithe
switch $lineno
case $line_count
commandline -f history-search-forward
-
+
case '*'
commandline -f down-line
end
diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish
index 60fefc3b8..f8e1edf49 100644
--- a/share/functions/fish_default_key_bindings.fish
+++ b/share/functions/fish_default_key_bindings.fish
@@ -3,7 +3,7 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
# Clear earlier bindings, if any
bind --erase --all
-
+
# This is the default binding, i.e. the one used if no other binding matches
bind "" self-insert
@@ -12,28 +12,28 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \ck kill-line
bind \cy yank
bind \t complete
-
+
bind \e\n "commandline -i \n"
-
+
bind \e\[A up-or-search
bind \e\[B down-or-search
bind -k down down-or-search
bind -k up up-or-search
-
+
bind \e\[C forward-char
bind \e\[D backward-char
bind -k right forward-char
bind -k left backward-char
-
+
bind -k dc delete-char
bind -k backspace backward-delete-char
bind \x7f backward-delete-char
-
+
bind \e\[H beginning-of-line
bind \e\[F end-of-line
bind -k home beginning-of-line
bind -k end end-of-line
-
+
bind \e\eOC nextd-or-forward-word
bind \e\eOD prevd-or-backward-word
bind \e\e\[C nextd-or-forward-word
@@ -43,8 +43,8 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \e\[3C nextd-or-forward-word
bind \e\[3D prevd-or-backward-word
bind \e\[1\;3C nextd-or-forward-word
- bind \e\[1\;3D prevd-or-backward-word
-
+ bind \e\[1\;3D prevd-or-backward-word
+
bind \e\eOA history-token-search-backward
bind \e\eOB history-token-search-forward
bind \e\e\[A history-token-search-backward
@@ -55,7 +55,7 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \e\[3B history-token-search-forward
bind \e\[1\;3A history-token-search-backward
bind \e\[1\;3B history-token-search-forward
-
+
bind \ca beginning-of-line
bind \ce end-of-line
bind \ey yank-pop
@@ -73,17 +73,17 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind -k npage end-of-history
bind \e\< beginning-of-buffer
bind \e\> end-of-buffer
-
+
bind \el __fish_list_current_token
bind \ew 'set tok (commandline -pt); if test $tok[1]; whatis $tok[1]; commandline -f repaint; end'
bind \cl 'clear; commandline -f repaint'
bind \cc 'commandline ""'
bind \cu backward-kill-line
bind \ed kill-word
- bind \cw backward-kill-word
+ bind \cw backward-kill-word
bind \ed 'if test -z (commandline); dirh; commandline -f repaint; else; commandline -f kill-word; end'
bind \cd delete-or-exit
-
+
# This will make sure the output of the current command is paged using the less pager when you press Meta-p
bind \ep '__fish_paginate'
diff --git a/share/functions/funced.fish b/share/functions/funced.fish
index dca73d702..5bd54acdd 100644
--- a/share/functions/funced.fish
+++ b/share/functions/funced.fish
@@ -14,22 +14,22 @@ function funced --description "Edit function definition"
case '*'
set -l init ''
set -l tmp
-
+
# Shadow IFS here to avoid array splitting in command substitution
- set -l IFS
+ set -l IFS
if functions -q $argv
set init (functions $argv | fish_indent --no-indent)
else
set init function $argv\nend
end
-
+
set -l prompt 'printf "%s%s%s> " (set_color green) '$argv' (set_color normal)'
# Unshadow IFS since the fish_title breaks otherwise
set -e IFS
if read -p $prompt -c "$init" -s cmd
# Shadow IFS _again_ to avoid array splitting in command substitution
- set -l IFS
+ set -l IFS
eval (echo -n $cmd | fish_indent)
end
return 0
diff --git a/share/functions/grep.fish b/share/functions/grep.fish
index 60e83b204..b0dc9586c 100644
--- a/share/functions/grep.fish
+++ b/share/functions/grep.fish
@@ -3,10 +3,10 @@
#
if command grep --color=auto --help 1>/dev/null 2>/dev/null
- if not set -q GREP_COLOR
+ if not set -q GREP_COLOR
set -gx GREP_COLOR '97;45'
end
- if not set -q GREP_OPTIONS
+ if not set -q GREP_OPTIONS
set -gx GREP_OPTIONS --color=auto
end
end
diff --git a/share/functions/help.fish b/share/functions/help.fish
index 0234757f7..bd5360026 100644
--- a/share/functions/help.fish
+++ b/share/functions/help.fish
@@ -14,9 +14,9 @@ function help --description "Show help for the fish shell"
set -l fish_browser_bg
set -l h syntax completion editor job-control todo bugs history killring help
- set h $h color prompt title variables builtin-overview changes expand
- set h $h expand-variable expand-home expand-brace expand-wildcard
- set -l help_topics $h expand-command-substitution expand-process
+ set h $h color prompt title variables builtin-overview changes expand
+ set h $h expand-variable expand-home expand-brace expand-wildcard
+ set -l help_topics $h expand-command-substitution expand-process
# 'help -h' should launch 'help help'
if count $argv >/dev/null
diff --git a/share/functions/isatty.fish b/share/functions/isatty.fish
index 1603972f1..d4f2c43e3 100644
--- a/share/functions/isatty.fish
+++ b/share/functions/isatty.fish
@@ -1,7 +1,7 @@
function isatty -d "Tests if a file descriptor is a tty"
set -l fd 0
- if count $argv >/dev/null
+ if count $argv >/dev/null
switch $argv[1]
case -h --h --he --hel --help
@@ -19,7 +19,7 @@ function isatty -d "Tests if a file descriptor is a tty"
case '*'
set fd $argv[1]
-
+
end
end
diff --git a/share/functions/math.fish b/share/functions/math.fish
index f25793816..bad349d93 100644
--- a/share/functions/math.fish
+++ b/share/functions/math.fish
@@ -16,6 +16,6 @@ function math --description "Perform math calculations in bc"
return 0
end
return 2
-
+
end
diff --git a/share/functions/nextd.fish b/share/functions/nextd.fish
index 9b65b7567..80d7c42aa 100644
--- a/share/functions/nextd.fish
+++ b/share/functions/nextd.fish
@@ -10,7 +10,7 @@ function nextd --description "Move forward in the directory history"
end
# Parse arguments
- set -l show_hist 0
+ set -l show_hist 0
set -l times 1
for i in (seq (count $argv))
switch $argv[$i]
@@ -56,4 +56,4 @@ function nextd --description "Move forward in the directory history"
# All done
return $code
-end
+end
diff --git a/share/functions/prevd.fish b/share/functions/prevd.fish
index d0f546a22..c0361e1ff 100644
--- a/share/functions/prevd.fish
+++ b/share/functions/prevd.fish
@@ -10,7 +10,7 @@ function prevd --description "Move back in the directory history"
end
# Parse arguments
- set -l show_hist 0
+ set -l show_hist 0
set -l times 1
for i in (seq (count $argv))
switch $argv[$i]
@@ -56,5 +56,5 @@ function prevd --description "Move back in the directory history"
# All done
return $code
-end
+end
diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish
index 46b4935a7..7f892c700 100644
--- a/share/functions/prompt_pwd.fish
+++ b/share/functions/prompt_pwd.fish
@@ -10,7 +10,7 @@ if test (uname) = Darwin
end
else
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
- switch "$PWD"
+ switch "$PWD"
case "$HOME"
echo '~'
diff --git a/share/functions/psub.fish b/share/functions/psub.fish
index b3e958d47..42e34c731 100644
--- a/share/functions/psub.fish
+++ b/share/functions/psub.fish
@@ -9,7 +9,7 @@ function psub --description "Read from stdin into a file and output the filename
set -l longopt -l help,file
if getopt -T >/dev/null
- set longopt
+ set longopt
end
if not getopt -n psub -Q $shortopt $longopt -- $argv >/dev/null
@@ -57,7 +57,7 @@ function psub --description "Read from stdin into a file and output the filename
# Write output to pipe. This needs to be done in the background so
# that the command substitution exits without needing to wait for
# all the commands to exit
- mkfifo $filename
+ mkfifo $filename
cat >$filename &
else
cat >$filename
@@ -75,6 +75,6 @@ function psub --description "Read from stdin into a file and output the filename
end
# Make sure we erase file when caller exits
- eval function $funcname --on-job-exit caller\; command rm $filename\; functions -e $funcname\; end
+ eval function $funcname --on-job-exit caller\; command rm $filename\; functions -e $funcname\; end
end
diff --git a/share/functions/pwd.fish b/share/functions/pwd.fish
index d51fe5c61..22745406f 100644
--- a/share/functions/pwd.fish
+++ b/share/functions/pwd.fish
@@ -3,7 +3,7 @@
# Also drop '/private' directories on OS X.
#
-switch (uname)
+switch (uname)
case Darwin
function pwd --description "Print working directory"
diff --git a/share/functions/sgrep.fish b/share/functions/sgrep.fish
index c3515787a..77acc9293 100644
--- a/share/functions/sgrep.fish
+++ b/share/functions/sgrep.fish
@@ -1,5 +1,5 @@
function sgrep -d "Call grep without honoring GREP_OPTIONS settings"
set -l GREP_OPTIONS
- grep $argv
-end
\ No newline at end of file
+ command grep $argv
+end
diff --git a/share/functions/trap.fish b/share/functions/trap.fish
index 4a08af9d1..d88bdd4e7 100644
--- a/share/functions/trap.fish
+++ b/share/functions/trap.fish
@@ -13,18 +13,18 @@ function __trap_switch
switch $argv[1]
case EXIT
echo --on-exit %self
-
+
case '*'
echo --on-signal $argv[1]
- end
+ end
end
function trap -d 'Perform an action when the shell recives a signal'
set -l mode
- set -l cmd
- set -l sig
+ set -l cmd
+ set -l sig
set -l shortopt
set -l longopt
@@ -47,13 +47,13 @@ function trap -d 'Perform an action when the shell recives a signal'
case -h --help
__fish_print_help trap
return 0
-
+
case -p --print
set mode print
-
+
case -l --list-signals
set mode list
-
+
case --
set -e opt[1]
break
@@ -87,7 +87,7 @@ function trap -d 'Perform an action when the shell recives a signal'
for i in $opt
set sig (__trap_translate_signal $i)
if test $sig
- functions -e __trap_handler_$sig
+ functions -e __trap_handler_$sig
end
end
@@ -108,7 +108,7 @@ function trap -d 'Perform an action when the shell recives a signal'
end
case print
- set -l names
+ set -l names
if count $opt >/dev/null
set names $opt
@@ -130,7 +130,7 @@ function trap -d 'Perform an action when the shell recives a signal'
case list
kill -l
-
+
end
end
diff --git a/share/functions/type.fish b/share/functions/type.fish
index f57c7fa8f..0c25b7ffe 100644
--- a/share/functions/type.fish
+++ b/share/functions/type.fish
@@ -28,14 +28,14 @@ function type --description "Print the type of a command"
switch $i
case -t --type
set mode type
-
+
case -p --path
set mode path
-
- case -P --force-path
+
+ case -P --force-path
set mode path
set selection files
-
+
case -a --all
set selection multi
@@ -54,7 +54,7 @@ function type --description "Print the type of a command"
# Check all possible types for the remaining arguments
for i in $argv
-
+
switch $i
case '-*'
continue
diff --git a/share/functions/umask.fish b/share/functions/umask.fish
index 4ddb5dd6e..44a0ca109 100644
--- a/share/functions/umask.fish
+++ b/share/functions/umask.fish
@@ -4,7 +4,7 @@ function __fish_umask_parse -d "Internal umask function"
if echo $argv | sgrep -E '^(0|)[0-7]{1,3}$' >/dev/null
set -l char_count (echo $argv| wc -c)
for i in (seq (math 5 - $char_count)); set argv 0$argv; end
- echo $argv
+ echo $argv
else
# Test if argument really is a valid symbolic mask
if not echo $argv | sgrep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null
@@ -26,7 +26,7 @@ function __fish_umask_parse -d "Internal umask function"
set -l char_count (echo $tmp|cut -c 1)
set res[$i] (math 7 - $char_count)
end
-
+
set -l el (echo $argv|tr , \n)
for i in $el
switch $i
@@ -54,15 +54,15 @@ function __fish_umask_parse -d "Internal umask function"
switch $i
case '=*'
set mode set
- set i (echo $i| cut -c 2-)
+ set i (echo $i| cut -c 2-)
case '+*'
set mode add
- set i (echo $i| cut -c 2-)
+ set i (echo $i| cut -c 2-)
case '-*'
set mode remove
- set i (echo $i| cut -c 2-)
+ set i (echo $i| cut -c 2-)
case '*'
if not count $implicit_all >/dev/null
@@ -120,7 +120,7 @@ function __fish_umask_print_symbolic
if contains $val 0 1 2 3
set res {$res}r
end
-
+
if contains $val 0 1 4 5
set res {$res}w
end
@@ -161,7 +161,7 @@ function umask --description "Set default file permission mask"
return 0
case -p --as-command
- set as_command 1
+ set as_command 1
case -S --symbolic
set symbolic 1
diff --git a/share/functions/up-or-search.fish b/share/functions/up-or-search.fish
index 18c37e836..fc51d7106 100644
--- a/share/functions/up-or-search.fish
+++ b/share/functions/up-or-search.fish
@@ -6,14 +6,14 @@ function up-or-search -d "Depending on cursor position and current mode, either
end
# We are not already in search mode.
- # If we are on the top line, start search mode,
+ # If we are on the top line, start search mode,
# otherwise move up
set lineno (commandline -L)
switch $lineno
case 1
commandline -f history-search-backward
-
+
case '*'
commandline -f up-line
end
diff --git a/signal.c b/signal.c
index 2c64f7476..2ac38aae6 100644
--- a/signal.c
+++ b/signal.c
@@ -47,7 +47,7 @@ struct lookup_entry
/**
Signal description
*/
- const wchar_t *desc;
+ const wchar_t *desc;
};
/**
@@ -60,11 +60,11 @@ static int block_count=0;
Lookup table used to convert between signal names and signal ids,
etc.
*/
-const static struct lookup_entry lookup[] =
+static const struct lookup_entry lookup[] =
{
#ifdef SIGHUP
{
- SIGHUP,
+ SIGHUP,
L"SIGHUP",
N_( L"Terminal hung up" )
}
@@ -96,7 +96,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGTRAP
{
- SIGTRAP,
+ SIGTRAP,
L"SIGTRAP",
N_( L"Trace or breakpoint trap" )
}
@@ -112,7 +112,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGBUS
{
- SIGBUS,
+ SIGBUS,
L"SIGBUS",
N_( L"Misaligned address error" )
}
@@ -120,7 +120,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGFPE
{
- SIGFPE,
+ SIGFPE,
L"SIGFPE",
N_( L"Floating point exception" )
}
@@ -128,7 +128,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGKILL
{
- SIGKILL,
+ SIGKILL,
L"SIGKILL",
N_( L"Forced quit" )
}
@@ -151,7 +151,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGSEGV
{
- SIGSEGV,
+ SIGSEGV,
L"SIGSEGV",
N_( L"Address boundary error" )
}
@@ -167,7 +167,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGALRM
{
- SIGALRM,
+ SIGALRM,
L"SIGALRM",
N_( L"Timer expired" )
}
@@ -215,7 +215,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGTTIN
{
- SIGTTIN,
+ SIGTTIN,
L"SIGTTIN",
N_( L"Stop from terminal input" )
}
@@ -231,7 +231,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGURG
{
- SIGURG,
+ SIGURG,
L"SIGURG",
N_( L"Urgent socket condition" )
}
@@ -247,7 +247,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGXFSZ
{
- SIGXFSZ,
+ SIGXFSZ,
L"SIGXFSZ",
N_( L"File size limit exceeded" )
}
@@ -295,7 +295,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGPWR
{
- SIGPWR,
+ SIGPWR,
L"SIGPWR",
N_( L"Power failure" )
}
@@ -303,7 +303,7 @@ const static struct lookup_entry lookup[] =
#endif
#ifdef SIGSYS
{
- SIGSYS,
+ SIGSYS,
L"SIGSYS",
N_( L"Bad system call" )
}
@@ -359,15 +359,15 @@ const static struct lookup_entry lookup[] =
/**
- Test if \c name is a string describing the signal named \c canonical.
+ Test if \c name is a string describing the signal named \c canonical.
*/
-static int match_signal_name( const wchar_t *canonical,
+static int match_signal_name( const wchar_t *canonical,
const wchar_t *name )
{
if( wcsncasecmp( name, L"sig", 3 )==0)
name +=3;
- return wcscasecmp( canonical+3,name ) == 0;
+ return wcscasecmp( canonical+3,name ) == 0;
}
@@ -375,7 +375,7 @@ int wcs2sig( const wchar_t *str )
{
int i, res;
wchar_t *end=0;
-
+
for( i=0; lookup[i].desc ; i++ )
{
if( match_signal_name( lookup[i].name, str) )
@@ -387,8 +387,8 @@ int wcs2sig( const wchar_t *str )
res = wcstol( str, &end, 10 );
if( !errno && res>=0 && !*end )
return res;
-
- return -1;
+
+ return -1;
}
@@ -435,7 +435,7 @@ static void default_handler(int signal, siginfo_t *info, void *context)
if( event_get( &e, 0 ) )
{
-
+
event_fire( &e );
}
}
@@ -445,8 +445,8 @@ static void default_handler(int signal, siginfo_t *info, void *context)
*/
static void handle_winch( int sig, siginfo_t *info, void *context )
{
- common_handle_winch( sig );
- default_handler( sig, 0, 0 );
+ common_handle_winch( sig );
+ default_handler( sig, 0, 0 );
}
/**
@@ -460,16 +460,16 @@ static void handle_hup( int sig, siginfo_t *info, void *context )
e.type=EVENT_SIGNAL;
e.param1.signal = SIGHUP;
e.function_name=0;
-
+
if( event_get( &e, 0 ) )
{
- default_handler( sig, 0, 0 );
+ default_handler( sig, 0, 0 );
}
else
{
reader_exit( 1, 1 );
}
-
+
}
/**
@@ -479,7 +479,7 @@ static void handle_hup( int sig, siginfo_t *info, void *context )
static void handle_int( int sig, siginfo_t *info, void *context )
{
reader_handle_int( sig );
- default_handler( sig, info, context);
+ default_handler( sig, info, context);
}
/**
@@ -488,22 +488,22 @@ static void handle_int( int sig, siginfo_t *info, void *context )
static void handle_chld( int sig, siginfo_t *info, void *context )
{
job_handle_signal( sig, info, context );
- default_handler( sig, info, context);
+ default_handler( sig, info, context);
}
void signal_reset_handlers()
{
int i;
-
+
struct sigaction act;
sigemptyset( & act.sa_mask );
act.sa_flags=0;
act.sa_handler=SIG_DFL;
-
+
for( i=0; lookup[i].desc ; i++ )
{
sigaction( lookup[i].signal, &act, 0);
- }
+ }
}
@@ -516,11 +516,11 @@ void signal_set_handlers()
if( is_interactive == -1 )
return;
-
+
sigemptyset( & act.sa_mask );
act.sa_flags=SA_SIGINFO;
act.sa_sigaction = &default_handler;
-
+
/*
First reset everything to a use default_handler, a function
whose sole action is to fire of an event
@@ -531,7 +531,7 @@ void signal_set_handlers()
sigaction( SIGTTIN, &act, 0);
sigaction( SIGTTOU, &act, 0);
sigaction( SIGCHLD, &act, 0);
-
+
/*
Ignore sigpipe, it is generated if fishd dies, but we can
recover.
@@ -544,9 +544,9 @@ void signal_set_handlers()
Interactive mode. Ignore interactive signals. We are a
shell, we know whats best for the user. ;-)
*/
-
+
act.sa_handler=SIG_IGN;
-
+
sigaction( SIGINT, &act, 0);
sigaction( SIGQUIT, &act, 0);
sigaction( SIGTSTP, &act, 0);
@@ -568,7 +568,7 @@ void signal_set_handlers()
wperror( L"sigaction" );
FATAL_EXIT();
}
-
+
#ifdef SIGWINCH
act.sa_flags = SA_SIGINFO;
act.sa_sigaction= &handle_winch;
@@ -609,13 +609,13 @@ void signal_set_handlers()
exit(1);
}
}
-
+
}
void signal_handle( int sig, int do_handle )
{
struct sigaction act;
-
+
/*
These should always be handled
*/
@@ -626,7 +626,7 @@ void signal_handle( int sig, int do_handle )
(sig == SIGTTOU) ||
(sig == SIGCHLD) )
return;
-
+
sigemptyset( &act.sa_mask );
if( do_handle )
{
@@ -638,27 +638,27 @@ void signal_handle( int sig, int do_handle )
act.sa_flags = 0;
act.sa_handler = SIG_DFL;
}
-
+
sigaction( sig, &act, 0);
}
void signal_block()
{
- sigset_t chldset;
-
+ sigset_t chldset;
+
if( !block_count )
{
sigfillset( &chldset );
- sigprocmask(SIG_BLOCK, &chldset, 0);
+ sigprocmask(SIG_BLOCK, &chldset, 0);
}
-
+
block_count++;
// debug( 0, L"signal block level increased to %d", block_count );
}
void signal_unblock()
{
- sigset_t chldset;
+ sigset_t chldset;
block_count--;
@@ -668,11 +668,11 @@ void signal_unblock()
bugreport();
FATAL_EXIT();
}
-
+
if( !block_count )
{
sigfillset( &chldset );
- sigprocmask(SIG_UNBLOCK, &chldset, 0);
+ sigprocmask(SIG_UNBLOCK, &chldset, 0);
}
// debug( 0, L"signal block level decreased to %d", block_count );
}
diff --git a/tests/gen_output.fish b/tests/gen_output.fish
index 91db67b06..49e15bfdc 100755
--- a/tests/gen_output.fish
+++ b/tests/gen_output.fish
@@ -3,7 +3,7 @@
#
# Generate output for a test script
#
-# It is important that you verify that the generated
+# It is important that you verify that the generated
# output is correct!
#
diff --git a/tests/test.fish b/tests/test.fish
index 082db4686..610c966e6 100755
--- a/tests/test.fish
+++ b/tests/test.fish
@@ -1,9 +1,46 @@
#!/usr/local/bin/fish
#
# Main loop of the test suite. I wrote this
-# instad of using autotest to provide additional
+# instad of using autotest to provide additional
# testing for fish. :-)
+
+if [ "$argv" != '-n' ]
+ # begin...end has bug in error redirecting...
+ begin
+ ../fish -n ./test.fish ^top.tmp.err
+ ../fish -n ./test.fish -n ^^top.tmp.err
+ ../fish ./test.fish -n ^^top.tmp.err
+ end | tee top.tmp.out
+ echo $status >top.tmp.status
+ set res ok
+ if diff top.tmp.out top.out >/dev/null
+ else
+ set res fail
+ echo Output differs for file test.fish
+ end
+
+ if diff top.tmp.err top.err >/dev/null
+ else
+ set res fail
+ echo Error output differs for file test.fish
+ end
+
+ if test (cat top.tmp.status) = (cat top.status)
+ else
+ set res fail
+ echo Exit status differs for file test.fish
+ end
+
+ if test $res = ok;
+ echo File test.fish tested ok
+ else
+ echo File test.fish failed tests
+ end;
+
+ exit
+end
+
echo Testing high level script functionality
for i in *.in
diff --git a/tests/test1.in b/tests/test1.in
index 5b87fb719..3b3ba25f3 100644
--- a/tests/test1.in
+++ b/tests/test1.in
@@ -3,7 +3,7 @@
#
for i in 1 2 #Comment on same line as command
-#Comment inside loop
+#Comment inside loop
for j in a b
#Double loop
echo $i$j
@@ -12,7 +12,7 @@ end
# Simple alias tests
-function foo
+function foo
echo >foo.txt $argv
end
@@ -26,16 +26,16 @@ else
echo Test 2 fail
end
-function foo
+function foo
printf 'Test %s' $1; echo ' pass'
end
-foo 3
+foo 3
for i in Test for continue break and switch builtins problems;
switch $i
case Test
- printf "%s " $i
+ printf "%s " $i
case "f??"
printf "%s " 3
case "c*"
diff --git a/tests/test2.in b/tests/test2.in
index a0c7ecbd9..2a5ce81ee 100644
--- a/tests/test2.in
+++ b/tests/test2.in
@@ -1,4 +1,4 @@
-#Tests complex parameter expantions
+#Tests complex parameter expantions
set a A
set aa AA
diff --git a/tests/test3.in b/tests/test3.in
index 4b26d7871..c6801999e 100644
--- a/tests/test3.in
+++ b/tests/test3.in
@@ -62,9 +62,9 @@ end
# Test that scope is preserved in double blocks
-for i in 1
+for i in 1
set t6 $i
- for j in a
+ for j in a
if test $t6$j = 1a
echo Test 6 pass
else
@@ -105,7 +105,7 @@ end
# Test if exported variables go out of scope
-if test (../fish -c "echo $t8")
+if test (../fish -c "echo $t8")
echo Test 9 fail
else
echo Test 9 pass
diff --git a/tests/test4.in b/tests/test4.in
index 0966694aa..4155c0e86 100644
--- a/tests/test4.in
+++ b/tests/test4.in
@@ -2,30 +2,30 @@
set -e smurf
-function setter
+function setter
set smurf green
end
-function unsetter
+function unsetter
set -e smurf
end
-function call1
+function call1
set smurf blue; setter; if test $smurf = blue; echo Test 1 pass; else; echo Test 1 fail; end
end
-function call2
+function call2
set smurf blue; unsetter; if test $smurf = blue; echo Test 2 pass; else; echo Test 2 fail; end
end
call1
call2
-function call3
+function call3
setter; if test $smurf = green; echo Test 3 pass; else; echo Test 3 fail; end
end
-function call4
+function call4
unsetter; if not set -q smurf; echo Test 4 pass; else; echo Test 4 fail; end
end
diff --git a/tests/top.err b/tests/top.err
new file mode 100644
index 000000000..73a623c41
--- /dev/null
+++ b/tests/top.err
@@ -0,0 +1,6 @@
+fish: Expected redirection specification, got token of type '$i'
+/usr/local/src/grissioms-fish-shell/tests/test.fish (line 51): ../fish <$i >tmp.out ^tmp.err
+ ^
+fish: Expected redirection specification, got token of type '$i'
+/usr/local/src/grissioms-fish-shell/tests/test.fish (line 51): ../fish <$i >tmp.out ^tmp.err
+ ^
diff --git a/tests/top.out b/tests/top.out
new file mode 100644
index 000000000..c3a60ba61
--- /dev/null
+++ b/tests/top.out
@@ -0,0 +1,6 @@
+Testing high level script functionality
+File test1.in tested ok
+File test2.in tested ok
+File test3.in tested ok
+File test4.in tested ok
+File test5.in tested ok
diff --git a/tests/top.status b/tests/top.status
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/tests/top.status
@@ -0,0 +1 @@
+0
diff --git a/tokenizer.c b/tokenizer.c
index edefc070c..07c4c6d91 100644
--- a/tokenizer.c
+++ b/tokenizer.c
@@ -143,7 +143,7 @@ void tok_init( tokenizer *tok, const wchar_t *b, int flags )
void tok_destroy( tokenizer *tok )
{
CHECK( tok, );
-
+
free( tok->last );
if( tok->free_orig )
free( tok->orig_buff );
@@ -153,14 +153,14 @@ int tok_last_type( tokenizer *tok )
{
CHECK( tok, TOK_ERROR );
CHECK( tok->buff, TOK_ERROR );
-
+
return tok->last_type;
}
wchar_t *tok_last( tokenizer *tok )
{
CHECK( tok, 0 );
-
+
return tok->last;
}
@@ -231,7 +231,7 @@ static void read_string( tokenizer *tok )
{
do_loop = 0;
}
-
+
}
else if( *tok->buff == L'\n' && mode == 0)
@@ -240,15 +240,15 @@ static void read_string( tokenizer *tok )
do_loop = 0;
break;
}
-
+
tok->buff++;
continue;
}
-
-
+
+
/*
The modes are as follows:
-
+
0: regular text
1: inside of subshell
2: inside of array brackets
@@ -266,18 +266,18 @@ static void read_string( tokenizer *tok )
mode = 1;
break;
}
-
+
case L'[':
{
if( tok->buff != start )
mode=2;
break;
}
-
+
case L'\'':
case L'"':
{
-
+
const wchar_t *end = quote_end( tok->buff );
tok->last_quote = *tok->buff;
if( end )
@@ -287,7 +287,7 @@ static void read_string( tokenizer *tok )
else
{
tok->buff += wcslen( tok->buff );
-
+
if( (!tok->accept_unfinished) )
{
tok_error( tok, TOK_UNTERMINATED_QUOTE, QUOTE_ERROR );
@@ -332,7 +332,7 @@ static void read_string( tokenizer *tok )
}
do_loop = 0;
}
-
+
break;
}
@@ -488,7 +488,7 @@ static void read_redirect( tokenizer *tok, int fd )
wchar_t tok_last_quote( tokenizer *tok )
{
CHECK( tok, 0 );
-
+
return tok->last_quote;
}
@@ -520,7 +520,7 @@ void tok_next( tokenizer *tok )
CHECK( tok, );
CHECK( tok->buff, );
-
+
if( tok_last_type( tok ) == TOK_ERROR )
{
tok->has_next=0;
@@ -552,7 +552,7 @@ void tok_next( tokenizer *tok )
break;
}
}
-
+
if( *tok->buff == L'#')
{
@@ -649,7 +649,7 @@ wchar_t *tok_first( const wchar_t *str )
wchar_t *res=0;
CHECK( str, 0 );
-
+
tok_init( &t, str, 0 );
switch( tok_last_type( &t ) )
@@ -670,7 +670,7 @@ wchar_t *tok_first( const wchar_t *str )
int tok_get_pos( tokenizer *tok )
{
CHECK( tok, 0 );
-
+
return tok->last_pos;
}
@@ -678,7 +678,7 @@ int tok_get_pos( tokenizer *tok )
void tok_set_pos( tokenizer *tok, int pos )
{
CHECK( tok, );
-
+
tok->buff = tok->orig_buff + pos;
tok->has_next = 1;
tok_next( tok );
diff --git a/tokenizer.h b/tokenizer.h
index 3954cc481..b2d5905f7 100644
--- a/tokenizer.h
+++ b/tokenizer.h
@@ -1,4 +1,4 @@
-/** \file tokenizer.h
+/** \file tokenizer.h
A specialized tokenizer for tokenizing the fish language. In the
future, the tokenizer should be extended to support marks,
@@ -60,7 +60,7 @@ enum tokenizer_error
/**
- The tokenizer struct.
+ The tokenizer struct.
*/
typedef struct
{
@@ -70,7 +70,7 @@ typedef struct
wchar_t *orig_buff;
/** A pointer to the last token*/
wchar_t *last;
-
+
/** Type of last token*/
int last_type;
/** Length of last token*/
@@ -102,7 +102,7 @@ tokenizer;
\param flags Flags to the tokenizer. Setting TOK_ACCEPT_UNFINISHED will cause the tokenizer
to accept incomplete tokens, such as a subshell without a closing
parenthesis, as a valid token. Setting TOK_SHOW_COMMENTS will return comments as tokens
-
+
*/
void tok_init( tokenizer *tok, const wchar_t *b, int flags );
diff --git a/user_doc.head.html b/user_doc.head.html
index 342bf99b2..6a7684953 100644
--- a/user_doc.head.html
+++ b/user_doc.head.html
@@ -32,9 +32,9 @@ H4
diff --git a/util.c b/util.c
index c7192ad8c..d232d2c43 100644
--- a/util.c
+++ b/util.c
@@ -64,7 +64,7 @@
} \
oom_handler_internal( p ); \
} \
-
+
void util_die_on_oom( void * p);
@@ -74,7 +74,7 @@ void (*oom_handler_internal)(void *) = &util_die_on_oom;
void (*util_set_oom_handler( void (*h)(void *) ))(void *)
{
void (*old)(void *) = oom_handler_internal;
-
+
if( h )
oom_handler_internal = h;
else
@@ -130,9 +130,9 @@ static int q_realloc( dyn_queue_t *q )
void **old_stop = q->stop;
int diff;
int new_size;
-
+
new_size = 2*(q->stop-q->start);
-
+
q->start=(void**)realloc( q->start, sizeof(void*)*new_size );
if( !q->start )
{
@@ -140,13 +140,13 @@ static int q_realloc( dyn_queue_t *q )
oom_handler( q );
return 0;
}
-
+
diff = q->start - old_start;
q->get_pos += diff;
q->stop = &q->start[new_size];
memcpy( old_stop + diff, q->start, sizeof(void*)*(q->get_pos-q->start));
q->put_pos = old_stop + diff + (q->get_pos-q->start);
-
+
return 1;
}
@@ -155,7 +155,7 @@ int q_put( dyn_queue_t *q, void *e )
*q->put_pos = e;
// fprintf( stderr, "Put element %d to queue %d\n", e, q );
-
+
if( ++q->put_pos == q->stop )
q->put_pos = q->start;
if( q->put_pos == q->get_pos )
@@ -175,7 +175,7 @@ void *q_peek( dyn_queue_t *q )
{
return *q->get_pos;
}
-
+
int q_empty( dyn_queue_t *q )
{
// fprintf( stderr, "Queue %d is %s\n", q, (q->put_pos == q->get_pos)?"empty":"non-empty" );
@@ -199,7 +199,7 @@ void hash_init2( hash_table_t *h,
reasonably good size with regard to avoiding patterns of collisions.
*/
sz--;
-
+
h->arr = malloc( sizeof(hash_struct_t)*sz );
if( !h->arr )
@@ -207,7 +207,7 @@ void hash_init2( hash_table_t *h,
oom_handler( h );
return;
}
-
+
h->size = sz;
for( i=0; i< sz; i++ )
h->arr[i].key = 0;
@@ -279,10 +279,10 @@ static int hash_realloc( hash_table_t *h,
if( ( sz < h->size ) && (h->size < HASH_MIN_SIZE))
return 1;
sz = maxi( sz, HASH_MIN_SIZE );
-
+
hash_struct_t *old_arr = h->arr;
int old_size = h->size;
-
+
int i;
h->cache = -1;
@@ -319,7 +319,7 @@ int hash_put( hash_table_t *h,
const void *data )
{
int pos;
-
+
if( (float)(h->count+1)/h->size > 0.75f )
{
if( !hash_realloc( h, (h->size+1) * 2 -1 ) )
@@ -345,8 +345,8 @@ void *hash_get( hash_table_t *h,
{
if( !h->count )
return 0;
-
- int pos = hash_search( h, (void *)key );
+
+ int pos = hash_search( h, (void *)key );
if( h->arr[pos].key == 0 )
{
return 0;
@@ -360,10 +360,10 @@ void *hash_get( hash_table_t *h,
void *hash_get_key( hash_table_t *h,
const void *key )
-{
+{
if( !h->count )
return 0;
-
+
int pos = hash_search( h, (void *)key );
if( h->arr[pos].key == 0 )
return 0;
@@ -449,7 +449,7 @@ int hash_contains( hash_table_t *h,
{
if( !h->count )
return 0;
-
+
int pos = hash_search( h, (void *)key );
return h->arr[pos].key != 0;
}
@@ -541,7 +541,7 @@ static unsigned int rotl30( unsigned int in )
/**
The number of words of input used in each lap by the sha-like
- string hashing algorithm.
+ string hashing algorithm.
*/
#define WORD_COUNT 16
@@ -550,11 +550,11 @@ int hash_wcs_func( void *data )
const wchar_t *in = (const wchar_t *)data;
unsigned int a,b,c,d,e;
int t;
- unsigned int k0=0x5a827999u;
+ unsigned int k0=0x5a827999u;
unsigned int k1 =0x6ed9eba1u;
-
- unsigned int w[2*WORD_COUNT];
-
+
+ unsigned int w[2*WORD_COUNT];
+
/*
Same constants used by sha1
*/
@@ -563,10 +563,10 @@ int hash_wcs_func( void *data )
c=0x98badcfeu;
d=0x10325476u;
e=0xc3d2e1f0u;
-
+
if( data == 0 )
return 0;
-
+
while( *in )
{
int i;
@@ -586,9 +586,9 @@ int hash_wcs_func( void *data )
}
else
w[i]=*in++;
-
+
}
-
+
/*
And fill up the rest by rotating the previous content
*/
@@ -642,11 +642,11 @@ int hash_str_cmp( void *a, void *b )
int hash_str_func( void *data )
{
int res = 0x67452301u;
- const char *str = data;
+ const char *str = data;
while( *str )
res = (18499*rotl5(res)) ^ *str++;
-
+
return res;
}
@@ -812,7 +812,7 @@ static int al_push_generic( array_list_t *l, anything_t o )
return 0;
}
l->arr = tmp;
- l->size = new_size;
+ l->size = new_size;
}
l->arr[l->pos++] = o;
return 1;
@@ -857,10 +857,10 @@ int al_insert( array_list_t *a, int pos, int count )
assert( pos >= 0 );
assert( count >= 0 );
assert( a );
-
+
if( !count )
return 0;
-
+
/*
Reallocate, if needed
*/
@@ -870,7 +870,7 @@ int al_insert( array_list_t *a, int pos, int count )
If we reallocate, add a few extra elements just in case we
want to do some more reallocating any time soon
*/
- size_t new_size = maxi( maxi( pos, a->pos ) + count +32, a->size*2);
+ size_t new_size = maxi( maxi( pos, a->pos ) + count +32, a->size*2);
void *tmp = realloc( a->arr, sizeof( anything_t )*new_size );
if( tmp )
{
@@ -881,19 +881,19 @@ int al_insert( array_list_t *a, int pos, int count )
oom_handler( a );
return 0;
}
-
+
}
-
+
if( a->pos > pos )
{
memmove( &a->arr[pos],
- &a->arr[pos+count],
+ &a->arr[pos+count],
sizeof(anything_t ) * (a->pos-pos) );
}
-
+
memset( &a->arr[pos], 0, sizeof(anything_t)*count );
a->pos += count;
-
+
return 1;
}
@@ -905,7 +905,7 @@ int al_insert( array_list_t *a, int pos, int count )
static int al_set_generic( array_list_t *l, int pos, anything_t v )
{
int old_pos;
-
+
if( pos < 0 )
return 0;
if( pos < l->pos )
@@ -914,16 +914,16 @@ static int al_set_generic( array_list_t *l, int pos, anything_t v )
return 1;
}
old_pos=l->pos;
-
+
l->pos = pos;
if( al_push_generic( l, v ) )
{
- memset( &l->arr[old_pos],
+ memset( &l->arr[old_pos],
0,
sizeof(anything_t) * (pos - old_pos) );
- return 1;
+ return 1;
}
- return 0;
+ return 0;
}
int al_set( array_list_t *l, int pos, const void *o )
@@ -954,7 +954,7 @@ static anything_t al_get_generic( array_list_t *l, int pos )
{
anything_t res;
res.ptr_val=0;
-
+
if( (pos >= 0) && (pos < l->pos) )
res = l->arr[pos];
@@ -997,8 +997,8 @@ static anything_t al_pop_generic( array_list_t *l )
memset( &e, 0, sizeof(anything_t ) );
return e;
}
-
-
+
+
e = l->arr[--l->pos];
if( (l->pos*3 < l->size) && (l->size < MIN_SIZE) )
{
@@ -1022,17 +1022,17 @@ static anything_t al_pop_generic( array_list_t *l )
void *al_pop( array_list_t *l )
{
- return al_pop_generic(l).ptr_val;
+ return al_pop_generic(l).ptr_val;
}
long al_pop_long( array_list_t *l )
{
- return al_pop_generic(l).long_val;
+ return al_pop_generic(l).long_val;
}
func_ptr_t al_pop_func( array_list_t *l )
{
- return al_pop_generic(l).func_val;
+ return al_pop_generic(l).func_val;
}
/**
@@ -1050,17 +1050,17 @@ static anything_t al_peek_generic( array_list_t *l )
void *al_peek( array_list_t *l )
{
- return al_peek_generic(l).ptr_val;
+ return al_peek_generic(l).ptr_val;
}
long al_peek_long( array_list_t *l )
{
- return al_peek_generic(l).long_val;
+ return al_peek_generic(l).long_val;
}
func_ptr_t al_peek_func( array_list_t *l )
{
- return al_peek_generic(l).func_val;
+ return al_peek_generic(l).func_val;
}
int al_empty( array_list_t *l )
@@ -1093,7 +1093,7 @@ void al_foreach2( array_list_t *l, void (*func)( void *, void *), void *aux)
CHECK( l, );
CHECK( func, );
-
+
for( i=0; ipos; i++ )
func( l->arr[i].ptr_val, aux );
}
@@ -1102,7 +1102,7 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
{
CHECK( a, 0 );
CHECK( b, 0 );
-
+
if( *a==0 )
{
if( *b==0)
@@ -1122,7 +1122,7 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
long bl;
int diff;
- errno = 0;
+ errno = 0;
al = wcstol( a, &aend, 10 );
bl = wcstol( b, &bend, 10 );
@@ -1133,7 +1133,7 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
*/
return wcscmp( a, b );
}
-
+
diff = al - bl;
if( diff )
return diff>0?2:-2;
@@ -1165,9 +1165,9 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
return secondary_diff>0?1:-1;
}
}
-
+
return res;
-
+
}
void sb_init( string_buffer_t * b)
@@ -1181,7 +1181,7 @@ void sb_init( string_buffer_t * b)
return;
}
- memset( b, 0, sizeof(string_buffer_t) );
+ memset( b, 0, sizeof(string_buffer_t) );
b_append( b, &c, sizeof( wchar_t));
b->used -= sizeof(wchar_t);
}
@@ -1195,7 +1195,7 @@ string_buffer_t *sb_new()
oom_handler( 0 );
return 0;
}
-
+
sb_init( res );
return res;
}
@@ -1230,7 +1230,7 @@ void sb_append_internal( string_buffer_t *b, ... )
wchar_t *arg;
CHECK( b, );
-
+
va_start( va, b );
while( (arg=va_arg(va, wchar_t *) )!= 0 )
{
@@ -1244,21 +1244,21 @@ int sb_printf( string_buffer_t *buffer, const wchar_t *format, ... )
{
va_list va;
int res;
-
+
CHECK( buffer, -1 );
CHECK( format, -1 );
-
+
va_start( va, format );
- res = sb_vprintf( buffer, format, va );
+ res = sb_vprintf( buffer, format, va );
va_end( va );
-
- return res;
+
+ return res;
}
int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig )
{
int res;
-
+
CHECK( buffer, -1 );
CHECK( format, -1 );
@@ -1271,20 +1271,20 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
oom_handler( buffer );
return -1;
}
- }
+ }
while( 1 )
{
va_list va;
va_copy( va, va_orig );
-
- res = vswprintf( (wchar_t *)((char *)buffer->buff+buffer->used),
- (buffer->length-buffer->used)/sizeof(wchar_t),
+
+ res = vswprintf( (wchar_t *)((char *)buffer->buff+buffer->used),
+ (buffer->length-buffer->used)/sizeof(wchar_t),
format,
va );
-
- va_end( va );
+
+ va_end( va );
if( res >= 0 )
{
buffer->used+= res*sizeof(wchar_t);
@@ -1295,7 +1295,7 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
As far as I know, there is no way to check if a
vswprintf-call failed because of a badly formated string
option or because the supplied destination string was to
- small. In GLIBC, errno seems to be set to EINVAL either way.
+ small. In GLIBC, errno seems to be set to EINVAL either way.
Because of this, sb_printf will on failiure try to
increase the buffer size until the free space is
@@ -1304,7 +1304,7 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
formated string option, and return an error. Make
sure to null terminate string before that, though.
*/
-
+
if( buffer->length - buffer->used > SB_MAX_SIZE )
{
wchar_t tmp=0;
@@ -1312,7 +1312,7 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
buffer->used -= sizeof(wchar_t);
break;
}
-
+
buffer->buff = realloc( buffer->buff, 2*buffer->length );
if( !buffer->buff )
@@ -1320,10 +1320,10 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
oom_handler( buffer );
return -1;
}
-
- buffer->length *= 2;
+
+ buffer->length *= 2;
}
- return res;
+ return res;
}
@@ -1332,7 +1332,7 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
void sb_destroy( string_buffer_t * b )
{
CHECK( b, );
-
+
free( b->buff );
}
@@ -1345,20 +1345,20 @@ void sb_clear( string_buffer_t * b )
void sb_truncate( string_buffer_t *b, int chars_left )
{
wchar_t *arr;
-
+
CHECK( b, );
b->used = (chars_left)*sizeof( wchar_t);
arr = (wchar_t *)b->buff;
arr[chars_left] = 0;
-
+
}
ssize_t sb_length( string_buffer_t *b )
{
CHECK( b, -1 );
return (b->used-1)/sizeof( wchar_t);
-
+
}
@@ -1384,7 +1384,7 @@ int b_append( buffer_t *b, const void *d, ssize_t len )
if( len<=0 )
return 0;
- CHECK( b, -1 );
+ CHECK( b, -1 );
if( !b )
{
@@ -1400,12 +1400,12 @@ int b_append( buffer_t *b, const void *d, ssize_t len )
{
size_t l = maxi( b->length*2,
b->used+len+MIN_SIZE );
-
+
void *d = realloc( b->buff, l );
if( !d )
{
oom_handler( b );
- return -1;
+ return -1;
}
b->buff=d;
b->length = l;
diff --git a/util.h b/util.h
index 84bbe0970..14753b1cb 100644
--- a/util.h
+++ b/util.h
@@ -25,7 +25,7 @@ typedef void (*func_ptr_t)();
used to make sure that the pointer type can fit whatever we want to
insert.
*/
-typedef union
+typedef union
{
/**
long value
@@ -91,7 +91,7 @@ typedef struct hash_table
/** The array containing the data */
hash_struct_t *arr;
/** A simple one item cache. This should always point to the index of the last item to be used */
- int cache;
+ int cache;
/** Number of elements */
int count;
/** Length of array */
@@ -128,12 +128,12 @@ priority_queue_t;
*/
typedef struct array_list
{
- /**
+ /**
Array containing the data
*/
anything_t *arr;
-
- /**
+
+ /**
Internal cursor position of the array_list_t. This is the
position to append elements at. This is also what the
array_list_t considers to be its true size, as reported by
@@ -142,7 +142,7 @@ typedef struct array_list
*/
size_t pos;
- /**
+ /**
Amount of memory allocated in arr, expressed in number of elements.
*/
size_t size;
@@ -181,8 +181,8 @@ typedef buffer_t string_buffer_t;
/**
Set the out-of-memory handler callback function. If a memory
- allocation fails, this function will be called.
-*/
+ allocation fails, this function will be called.
+*/
void (*util_set_oom_handler( void (*h)(void *) ))(void *);
/**
@@ -207,38 +207,38 @@ int mini( int a, int b );
/*
All the datastuctures below autoresize. The queue, stack and
priority queue are all impemented using an array and are guaranteed
- to never be less than 50% full.
+ to never be less than 50% full.
*/
-/**
+/**
Initialize the queue. A queue is a FIFO buffer, i.e. the first
element to be inserted into the buffer is the first element to be
- returned.
+ returned.
*/
void q_init( dyn_queue_t *q );
/**
- Destroy the queue
+ Destroy the queue
*/
void q_destroy( dyn_queue_t *q );
/**
- Insert element into queue
+ Insert element into queue
*/
int q_put( dyn_queue_t *q, void *e );
/**
- Remove and return next element from queue
+ Remove and return next element from queue
*/
void *q_get( dyn_queue_t *q);
/**
- Return next element from queue without removing it
+ Return next element from queue without removing it
*/
void *q_peek( dyn_queue_t *q);
/**
- Returns 1 if the queue is empty, 0 otherwise
+ Returns 1 if the queue is empty, 0 otherwise
*/
int q_empty( dyn_queue_t *q );
@@ -262,9 +262,9 @@ void hash_init2( hash_table_t *h,
*/
void hash_destroy( hash_table_t *h );
/**
- Set the key/value pair for the hashtable.
+ Set the key/value pair for the hashtable.
*/
-int hash_put( hash_table_t *h,
+int hash_put( hash_table_t *h,
const void *key,
const void *data );
/**
@@ -275,7 +275,7 @@ void *hash_get( hash_table_t *h,
/**
Returns the hash tables version of the specified key
*/
-void *hash_get_key( hash_table_t *h,
+void *hash_get_key( hash_table_t *h,
const void *key );
/**
@@ -290,15 +290,15 @@ int hash_get_count( hash_table_t *h);
\param old_key If not 0, a pointer to the old key will be stored at the specified address
\param old_data If not 0, a pointer to the data will be stored at the specified address
*/
-void hash_remove( hash_table_t *h,
- const void *key,
+void hash_remove( hash_table_t *h,
+ const void *key,
void **old_key,
void **old_data );
/**
Checks whether the specified key is in the hash table
*/
-int hash_contains( hash_table_t *h,
+int hash_contains( hash_table_t *h,
const void *key );
/**
@@ -316,20 +316,20 @@ void hash_get_data( hash_table_t *h,
/**
Call the function func for each key/data pair in the table
*/
-void hash_foreach( hash_table_t *h,
+void hash_foreach( hash_table_t *h,
void (*func)( void *, void * ) );
/**
Same as hash_foreach, but the function func takes an additional
- argument, which is provided by the caller in the variable aux
+ argument, which is provided by the caller in the variable aux
*/
-void hash_foreach2( hash_table_t *h, void (*func)( void *,
- void *,
- void *),
+void hash_foreach2( hash_table_t *h, void (*func)( void *,
+ void *,
+ void *),
void *aux );
/**
- Hash function suitable for character strings.
+ Hash function suitable for character strings.
*/
int hash_str_func( void *data );
/**
@@ -348,7 +348,7 @@ int hash_wcs_func( void *data );
/**
Hash comparison function suitable for wide character strings
*/
-int hash_wcs_cmp( void *a,
+int hash_wcs_cmp( void *a,
void *b );
/**
@@ -365,9 +365,9 @@ int hash_ptr_cmp( void *a,
-/**
+/**
Initialize the priority queue
-
+
\param q the queue to initialize
\param compare a comparison function that can compare two entries in the queue
*/
@@ -378,7 +378,7 @@ void pq_init( priority_queue_t *q,
\param q the queue
\param e the new element
-
+
*/
int pq_put( priority_queue_t *q,
void *e );
@@ -392,7 +392,7 @@ void *pq_get( priority_queue_t *q );
*/
void *pq_peek( priority_queue_t *q );
-/**
+/**
Returns 1 if the priority queue is empty, 0 otherwise.
*/
int pq_empty( priority_queue_t *q );
@@ -402,7 +402,7 @@ int pq_empty( priority_queue_t *q );
*/
int pq_get_count( priority_queue_t *q );
-/**
+/**
Destroy the priority queue and free memory used by it.
*/
void pq_destroy( priority_queue_t *q );
@@ -413,12 +413,12 @@ void pq_destroy( priority_queue_t *q );
*/
array_list_t *al_new();
-/**
- Initialize the list.
+/**
+ Initialize the list.
*/
void al_init( array_list_t *l );
-/**
+/**
Destroy the list and free memory used by it.
*/
void al_destroy( array_list_t *l );
@@ -468,15 +468,15 @@ int al_insert( array_list_t *a, int pos, int count );
Sets the element at the specified index
\param l The array_list_t
- \param pos The index
- \param o The element
+ \param pos The index
+ \param o The element
*/
int al_set( array_list_t *l, int pos, const void *o );
/**
Sets the element at the specified index
\param l The array_list_t
- \param pos The index
+ \param pos The index
\param v The element to set
*/
int al_set_long( array_list_t *l, int pos, long v );
@@ -484,7 +484,7 @@ int al_set_long( array_list_t *l, int pos, long v );
Sets the element at the specified index
\param l The array_list_t
- \param pos The index
+ \param pos The index
\param f The element to insert
*/
int al_set_func( array_list_t *l, int pos, func_ptr_t f );
@@ -493,24 +493,24 @@ int al_set_func( array_list_t *l, int pos, func_ptr_t f );
Returns the element at the specified index
\param l The array_list_t
- \param pos The index
- \return The element
+ \param pos The index
+ \return The element
*/
void *al_get( array_list_t *l, int pos );
/**
Returns the element at the specified index
\param l The array_list_t
- \param pos The index
- \return The element
+ \param pos The index
+ \return The element
*/
long al_get_long( array_list_t *l, int pos );
/**
Returns the element at the specified index
\param l The array_list_t
- \param pos The index
- \return The element
+ \param pos The index
+ \return The element
*/
func_ptr_t al_get_func( array_list_t *l, int pos );
@@ -555,12 +555,12 @@ func_ptr_t al_peek_func( array_list_t *l );
*/
int al_empty( array_list_t *l);
-/**
+/**
Call the function func for each entry in the list
*/
void al_foreach( array_list_t *l, void (*func)( void * ));
-/**
+/**
Same as al_foreach, but the function func takes an additional
argument, which is provided by the caller in the variable aux
*/
diff --git a/wgetopt.c b/wgetopt.c
index 08e42cbaa..351fc249e 100644
--- a/wgetopt.c
+++ b/wgetopt.c
@@ -1,5 +1,5 @@
/** \file wgetopt.c
- A version of the getopt library for use with wide character strings.
+ A version of the getopt library for use with wide character strings.
This is simply the gnu getopt library, but converted for use with
wchar_t instead of char. This is not usually useful since the argv
@@ -257,7 +257,7 @@ exchange (argv)
int middle = last_nonopt;
int top = woptind;
wchar_t *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,
@@ -712,7 +712,7 @@ wgetopt_long (argc, argv, options, long_options, opt_index)
int argc;
wchar_t *const *argv;
const wchar_t *options;
-const struct woption *long_options;
+const struct woption *long_options;
int *opt_index;
{
return _wgetopt_internal (argc, argv, options, long_options, opt_index, 0);
@@ -723,7 +723,7 @@ wgetopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
wchar_t *const *argv;
const wchar_t *options;
-const struct woption *long_options;
+const struct woption *long_options;
int *opt_index;
{
return _wgetopt_internal (argc, argv, options, long_options, opt_index, 1);
diff --git a/wgetopt.h b/wgetopt.h
index 126b42b56..f1f186ed0 100644
--- a/wgetopt.h
+++ b/wgetopt.h
@@ -1,5 +1,5 @@
/** \file wgetopt.h
- A version of the getopt library for use with wide character strings.
+ A version of the getopt library for use with wide character strings.
This is simply the gnu getopt library, but converted for use with
wchar_t instead of char. This is not usually useful since the argv
@@ -115,12 +115,12 @@ struct woption
#else
wchar_t *name;
#endif
- /**
+ /**
Must be one of no_argument, required_argument and
optional_argument.
has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int.
+ type mismatches in all the code that assumes it is an int.
*/
int has_arg;
@@ -153,7 +153,7 @@ struct woption
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts);
@@ -161,20 +161,20 @@ extern int wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts);
extern int wgetopt ();
#endif /* __GNU_LIBRARY__ */
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt_long (int argc, wchar_t *const *argv, const wchar_t *shortopts,
const struct woption *longopts, int *longind);
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt_long_only (int argc, wchar_t *const *argv,
const wchar_t *shortopts,
const struct woption *longopts, int *longind);
-/**
- Internal only. Users should not call this directly.
+/**
+ Internal only. Users should not call this directly.
*/
extern int _wgetopt_internal (int argc, wchar_t *const *argv,
const wchar_t *shortopts,
@@ -182,23 +182,23 @@ extern int _wgetopt_internal (int argc, wchar_t *const *argv,
int long_only);
#else /* not __STDC__ */
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt ();
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt_long ();
-/**
+/**
Get options from argument list. See the glibc manual for information on how to use this function.
*/
extern int wgetopt_long_only ();
-/**
- Internal only. Users should not call this directly.
+/**
+ Internal only. Users should not call this directly.
*/
extern int _wgetopt_internal ();
#endif /* __STDC__ */
diff --git a/wildcard.c b/wildcard.c
index f585dbb98..49f66d810 100644
--- a/wildcard.c
+++ b/wildcard.c
@@ -43,7 +43,7 @@ wildcards using **.
/**
The maximum length of a filename token. This is a fallback value,
- an attempt to find the true value using patchconf is always made.
+ an attempt to find the true value using patchconf is always made.
*/
#define MAX_FILE_LENGTH 1024
@@ -115,9 +115,9 @@ static void al_push_check( array_list_t *l, const wchar_t *new )
{
int i;
- for( i = 0; i < al_get_count(l); i++ )
+ for( i = 0; i < al_get_count(l); i++ )
{
- if( !wcscmp( al_get(l, i), new ) )
+ if( !wcscmp( al_get(l, i), new ) )
{
free( (void *)new );
return;
@@ -143,7 +143,7 @@ int wildcard_has( const wchar_t *str, int internal )
if( !str )
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- return 0;
+ return 0;
}
if( internal )
@@ -164,33 +164,33 @@ int wildcard_has( const wchar_t *str, int internal )
prev = *str;
}
}
-
+
return 0;
}
/**
Check whether the string str matches the wildcard string wc.
-
+
\param str String to be matched.
\param wc The wildcard.
- \param is_first Whether files beginning with dots should not be matched against wildcards.
+ \param is_first Whether files beginning with dots should not be matched against wildcards.
*/
-static int wildcard_match2( const wchar_t *str,
- const wchar_t *wc,
+static int wildcard_match2( const wchar_t *str,
+ const wchar_t *wc,
int is_first )
{
-
+
if( *str == 0 && *wc==0 )
return 1;
-
+
if( *wc == ANY_STRING || *wc == ANY_STRING_RECURSIVE)
- {
+ {
/* Ignore hidden file */
if( is_first && *str == L'.' )
{
return 0;
}
-
+
/* Try all submatches */
do
{
@@ -215,10 +215,10 @@ static int wildcard_match2( const wchar_t *str,
{
return 0;
}
-
+
return wildcard_match2( str+1, wc+1, 0 );
}
-
+
if( *wc == *str )
return wildcard_match2( str+1, wc+1, 0 );
@@ -230,9 +230,9 @@ static int wildcard_match2( const wchar_t *str,
possible completion of the string, the remainder of the string is
inserted into the array_list_t.
*/
-static int wildcard_complete_internal( const wchar_t *orig,
- const wchar_t *str,
- const wchar_t *wc,
+static int wildcard_complete_internal( const wchar_t *orig,
+ const wchar_t *str,
+ const wchar_t *wc,
int is_first,
const wchar_t *desc,
const wchar_t *(*desc_func)(const wchar_t *),
@@ -242,7 +242,7 @@ static int wildcard_complete_internal( const wchar_t *orig,
if( !wc || !str || !orig)
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- return 0;
+ return 0;
}
if( *wc == 0 &&
@@ -250,12 +250,12 @@ static int wildcard_complete_internal( const wchar_t *orig,
{
wchar_t *out_completion = 0;
const wchar_t *out_desc = desc;
-
+
if( !out )
{
return 1;
}
-
+
if( flags & COMPLETE_NO_CASE )
{
out_completion = wcsdup( orig );
@@ -271,11 +271,11 @@ static int wildcard_complete_internal( const wchar_t *orig,
This completion has an embedded description, du not use the generic description
*/
wchar_t *sep;
-
+
sep = wcschr(out_completion, PROG_COMPLETE_SEP );
*sep = 0;
out_desc = sep + 1;
-
+
}
else
{
@@ -290,31 +290,31 @@ static int wildcard_complete_internal( const wchar_t *orig,
if( func_desc )
out_desc = func_desc;
}
-
+
}
-
+
if( out_completion )
{
- completion_allocate( out,
+ completion_allocate( out,
out_completion,
out_desc,
flags );
}
-
+
free ( out_completion );
-
+
return 1;
}
-
-
+
+
if( *wc == ANY_STRING )
- {
+ {
int res=0;
-
+
/* Ignore hidden file */
if( is_first && str[0] == L'.' )
return 0;
-
+
/* Try all submatches */
do
{
@@ -324,12 +324,12 @@ static int wildcard_complete_internal( const wchar_t *orig,
}
while( *str++ != 0 );
return res;
-
+
}
else if( *wc == ANY_CHAR )
{
return wildcard_complete_internal( orig, str+1, wc+1, 0, desc, desc_func, out, flags );
- }
+ }
else if( *wc == *str )
{
return wildcard_complete_internal( orig, str+1, wc+1, 0, desc, desc_func, out, flags );
@@ -338,19 +338,19 @@ static int wildcard_complete_internal( const wchar_t *orig,
{
return wildcard_complete_internal( orig, str+1, wc+1, 0, desc, desc_func, out, flags | COMPLETE_NO_CASE );
}
- return 0;
+ return 0;
}
int wildcard_complete( const wchar_t *str,
const wchar_t *wc,
- const wchar_t *desc,
+ const wchar_t *desc,
const wchar_t *(*desc_func)(const wchar_t *),
array_list_t *out,
int flags )
{
int res;
-
- res = wildcard_complete_internal( str, str, wc, 1, desc, desc_func, out, flags );
+
+ res = wildcard_complete_internal( str, str, wc, 1, desc, desc_func, out, flags );
return res;
}
@@ -358,21 +358,21 @@ int wildcard_complete( const wchar_t *str,
int wildcard_match( const wchar_t *str, const wchar_t *wc )
{
- return wildcard_match2( str, wc, 1 );
+ return wildcard_match2( str, wc, 1 );
}
/**
- Creates a path from the specified directory and filename.
+ Creates a path from the specified directory and filename.
*/
static wchar_t *make_path( const wchar_t *base_dir, const wchar_t *name )
{
-
+
wchar_t *long_name;
int base_len = wcslen( base_dir );
if( !(long_name= malloc( sizeof(wchar_t)*(base_len+wcslen(name)+1) )))
{
DIE_MEM();
- }
+ }
wcscpy( long_name, base_dir );
wcscpy(&long_name[base_len], name );
return long_name;
@@ -393,12 +393,12 @@ static wchar_t *complete_get_desc_suffix_internal( const wchar_t *suff_orig )
if( !suff || !cmd )
DIE_MEM();
-
+
al_init( &l );
-
+
if( exec_subshell( cmd, &l ) != -1 )
{
-
+
if( al_get_count( &l )>0 )
{
wchar_t *ln = (wchar_t *)al_get(&l, 0 );
@@ -414,16 +414,16 @@ static wchar_t *complete_get_desc_suffix_internal( const wchar_t *suff_orig )
}
}
}
-
+
free(cmd);
al_foreach( &l, &free );
al_destroy( &l );
-
+
if( !desc )
{
desc = wcsdup(COMPLETE_FILE_DESC);
}
-
+
hash_put( suffix_hash, suff, desc );
return desc;
@@ -458,7 +458,7 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
wchar_t *desc;
len = wcslen(suff_orig );
-
+
if( len == 0 )
return COMPLETE_FILE_DESC;
@@ -494,7 +494,7 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
{
desc = complete_get_desc_suffix_internal( suff );
}
-
+
free( suff );
return desc;
@@ -511,20 +511,20 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
\param lbuf The struct buf output of calling lstat on the file
\param stat_res The result of calling stat on the file
\param buf The struct buf output of calling stat on the file
- \param err The errno value after a failed stat call on the file.
+ \param err The errno value after a failed stat call on the file.
*/
-static const wchar_t *file_get_desc( const wchar_t *filename,
+static const wchar_t *file_get_desc( const wchar_t *filename,
int lstat_res,
- struct stat lbuf,
- int stat_res,
- struct stat buf,
+ struct stat lbuf,
+ int stat_res,
+ struct stat buf,
int err )
{
wchar_t *suffix;
CHECK( filename, 0 );
-
+
if( !lstat_res )
{
if( S_ISLNK(lbuf.st_mode))
@@ -542,7 +542,7 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
( buf.st_mode & S_IXGRP ) ||
( buf.st_mode & S_IXOTH ) )
{
-
+
if( waccess( filename, X_OK ) == 0 )
{
/*
@@ -557,7 +557,7 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
}
}
}
-
+
return COMPLETE_SYMLINK_DESC;
}
@@ -569,7 +569,7 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
{
return COMPLETE_ROTTEN_SYMLINK_DESC;
}
-
+
case ELOOP:
{
return COMPLETE_LOOP_SYMLINK_DESC;
@@ -602,13 +602,13 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
{
return COMPLETE_DIRECTORY_DESC;
}
- else
+ else
{
if( ( buf.st_mode & S_IXUSR ) ||
( buf.st_mode & S_IXGRP ) ||
( buf.st_mode & S_IXOTH ) )
{
-
+
if( waccess( filename, X_OK ) == 0 )
{
/*
@@ -624,19 +624,19 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
}
}
}
-
+
suffix = wcsrchr( filename, L'.' );
if( suffix != 0 && !wcsrchr( suffix, L'/' ) )
{
return complete_get_desc_suffix( suffix );
}
-
+
return COMPLETE_FILE_DESC ;
}
/**
- Add the specified filename if it matches the specified wildcard.
+ Add the specified filename if it matches the specified wildcard.
If the filename matches, first get the description of the specified
filename. If this is a regular file, append the filesize to the
@@ -648,8 +648,8 @@ static const wchar_t *file_get_desc( const wchar_t *filename,
\param wc the wildcard to match against
\param is_cmd whether we are performing command completion
*/
-static void wildcard_completion_allocate( array_list_t *list,
- const wchar_t *fullname,
+static void wildcard_completion_allocate( array_list_t *list,
+ const wchar_t *fullname,
const wchar_t *completion,
const wchar_t *wc,
int is_cmd )
@@ -657,14 +657,14 @@ static void wildcard_completion_allocate( array_list_t *list,
const wchar_t *desc;
struct stat buf, lbuf;
static string_buffer_t *sb = 0;
-
+
int free_completion = 0;
-
+
int flags = 0;
int stat_res, lstat_res;
int stat_errno=0;
-
- long long sz;
+
+ long long sz;
if( !sb )
{
@@ -676,7 +676,7 @@ static void wildcard_completion_allocate( array_list_t *list,
}
CHECK( fullname, );
-
+
sb_clear( sb );
/*
@@ -694,7 +694,7 @@ static void wildcard_completion_allocate( array_list_t *list,
{
if( S_ISLNK(lbuf.st_mode))
{
-
+
if( ( stat_res = wstat( fullname, &buf ) ) )
{
sz=-1;
@@ -703,7 +703,7 @@ static void wildcard_completion_allocate( array_list_t *list,
{
sz = (long long)buf.st_size;
}
-
+
/*
In order to differentiate between e.g. rotten symlinks
and symlink loops, we also need to know the error status of wstat.
@@ -717,9 +717,9 @@ static void wildcard_completion_allocate( array_list_t *list,
sz = (long long)buf.st_size;
}
}
-
+
desc = file_get_desc( fullname, lstat_res, lbuf, stat_res, buf, stat_errno );
-
+
if( sz >= 0 && S_ISDIR(buf.st_mode) )
{
free_completion = 1;
@@ -728,7 +728,7 @@ static void wildcard_completion_allocate( array_list_t *list,
sb_append( sb, desc );
}
else
- {
+ {
sb_append( sb, desc, L", ", (void *)0 );
sb_format_size( sb, sz );
}
@@ -759,14 +759,14 @@ static int test_flags( wchar_t *filename,
return 0;
}
}
-
-
+
+
if( flags & EXECUTABLES_ONLY )
{
if ( waccess( filename, X_OK ) != 0)
return 0;
}
-
+
return 1;
}
@@ -776,24 +776,24 @@ static int test_flags( wchar_t *filename,
This function traverses the relevant directory tree looking for
matches, and recurses when needed to handle wildcrards spanning
- multiple components and recursive wildcards.
+ multiple components and recursive wildcards.
*/
-static int wildcard_expand_internal( const wchar_t *wc,
+static int wildcard_expand_internal( const wchar_t *wc,
const wchar_t *base_dir,
int flags,
array_list_t *out )
{
-
+
/* Points to the end of the current wildcard segment */
wchar_t *wc_end;
/* Variables for traversing a directory */
struct wdirent *next;
DIR *dir;
-
+
/* The result returned */
int res = 0;
-
+
/* Length of the directory to search in */
int base_len;
@@ -806,24 +806,24 @@ static int wildcard_expand_internal( const wchar_t *wc,
/* Description for completions */
string_buffer_t sb_desc;
-
+
// debug( 3, L"WILDCARD_EXPAND %ls in %ls", wc, base_dir );
if( reader_interrupted() )
{
return -1;
}
-
+
if( !wc || !base_dir || !out)
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
- return 0;
+ return 0;
}
if( flags & ACCEPT_INCOMPLETE )
- {
- /*
- Avoid excessive number of returned matches for wc ending with a *
+ {
+ /*
+ Avoid excessive number of returned matches for wc ending with a *
*/
int len = wcslen(wc);
if( len && (wc[len-1]==ANY_STRING) )
@@ -832,7 +832,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
foo[len-1]=0;
int res = wildcard_expand_internal( foo, base_dir, flags, out );
free( foo );
- return res;
+ return res;
}
}
@@ -841,7 +841,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
*/
dir_string = base_dir[0]==L'\0'?L".":base_dir;
-
+
if( !(dir = wopendir( dir_string )))
{
return 0;
@@ -852,7 +852,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
/*
Test for recursive match string in current segment
- */
+ */
wc_recursive = wcschr( wc, ANY_STRING_RECURSIVE );
is_recursive = ( wc_recursive && (!wc_end || wc_recursive < wc_end));
@@ -883,7 +883,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
{
wchar_t *name = next->d_name;
wchar_t *long_name = make_path( base_dir, name );
-
+
if( test_flags( long_name, flags ) )
{
wildcard_completion_allocate( out,
@@ -892,16 +892,16 @@ static int wildcard_expand_internal( const wchar_t *wc,
L"",
flags & EXECUTABLES_ONLY );
}
-
+
free( long_name );
- }
+ }
}
}
else
- {
+ {
res = 1;
al_push_check( out, wcsdup( base_dir ) );
- }
+ }
}
else
{
@@ -911,14 +911,14 @@ static int wildcard_expand_internal( const wchar_t *wc,
while( (next=wreaddir(dir))!=0 )
{
wchar_t *name = next->d_name;
-
+
if( flags & ACCEPT_INCOMPLETE )
{
-
+
wchar_t *long_name = make_path( base_dir, name );
/*
- Test for matches before stating file, so as to minimize the number of calls to the much slower stat function
+ Test for matches before stating file, so as to minimize the number of calls to the much slower stat function
*/
if( wildcard_complete( name,
wc,
@@ -934,12 +934,12 @@ static int wildcard_expand_internal( const wchar_t *wc,
name,
wc,
flags & EXECUTABLES_ONLY );
-
+
}
}
-
+
free( long_name );
-
+
}
else
{
@@ -947,7 +947,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
{
wchar_t *long_name = make_path( base_dir, name );
int skip = 0;
-
+
if( is_recursive )
{
/*
@@ -959,9 +959,9 @@ static int wildcard_expand_internal( const wchar_t *wc,
if( !wstat( long_name, &buf ) )
{
skip = S_ISDIR(buf.st_mode);
- }
+ }
}
-
+
if( skip )
{
free( long_name );
@@ -983,7 +983,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
Wilcard segment is not the last segment. Recursively call
wildcard_expand for all matching subdirectories.
*/
-
+
/*
wc_str is the part of the wildcarded string from the
beginning to the first slash
@@ -1010,17 +1010,17 @@ static int wildcard_expand_internal( const wchar_t *wc,
if( narrow_dir_string )
{
- /*
+ /*
Find out how long the filename can be in a worst case
scenario
*/
- ln = pathconf( narrow_dir_string, _PC_NAME_MAX );
+ ln = pathconf( narrow_dir_string, _PC_NAME_MAX );
/*
If not specified, use som large number as fallback
*/
if( ln < 0 )
- ln = MAX_FILE_LENGTH;
+ ln = MAX_FILE_LENGTH;
free( narrow_dir_string );
}
new_dir= malloc( sizeof(wchar_t)*(base_len+ln+2) );
@@ -1033,19 +1033,19 @@ static int wildcard_expand_internal( const wchar_t *wc,
}
wcscpy( new_dir, base_dir );
-
+
while( (next=wreaddir(dir))!=0 )
{
wchar_t *name = next->d_name;
-
+
/*
Test if the file/directory name matches the whole
wildcard element, i.e. regular matching.
*/
int whole_match = wildcard_match2( name, wc_str, 1 );
int partial_match = 0;
-
- /*
+
+ /*
If we are doing recursive matching, also check if this
directory matches the part up to the recusrive
wildcard, if so, then we can search all subdirectories
@@ -1057,24 +1057,24 @@ static int wildcard_expand_internal( const wchar_t *wc,
wchar_t *wc_sub = wcsndup( wc, end-wc+1);
partial_match = wildcard_match2( name, wc_sub, 1 );
free( wc_sub );
- }
+ }
if( whole_match || partial_match )
{
int new_len;
- struct stat buf;
+ struct stat buf;
char *dir_str;
int stat_res;
int new_res;
wcscpy(&new_dir[base_len], name );
dir_str = wcs2str( new_dir );
-
+
if( dir_str )
{
stat_res = stat( dir_str, &buf );
free( dir_str );
-
+
if( !stat_res )
{
if( S_ISDIR(buf.st_mode) )
@@ -1082,7 +1082,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
new_len = wcslen( new_dir );
new_dir[new_len] = L'/';
new_dir[new_len+1] = L'\0';
-
+
/*
Regular matching
*/
@@ -1100,51 +1100,51 @@ static int wildcard_expand_internal( const wchar_t *wc,
new_wc++;
}
}
-
+
new_res = wildcard_expand_internal( new_wc,
- new_dir,
- flags,
+ new_dir,
+ flags,
out );
if( new_res == -1 )
{
res = -1;
break;
- }
+ }
res |= new_res;
-
+
}
-
+
/*
Recursive matching
*/
if( partial_match )
{
-
- new_res = wildcard_expand_internal( wcschr( wc, ANY_STRING_RECURSIVE ),
+
+ new_res = wildcard_expand_internal( wcschr( wc, ANY_STRING_RECURSIVE ),
new_dir,
- flags | WILDCARD_RECURSIVE,
+ flags | WILDCARD_RECURSIVE,
out );
if( new_res == -1 )
{
res = -1;
break;
- }
+ }
res |= new_res;
-
+
}
- }
+ }
}
}
}
}
-
+
free( wc_str );
free( new_dir );
}
closedir( dir );
-
+
if( flags & ACCEPT_INCOMPLETE )
{
sb_destroy( &sb_desc );
@@ -1154,7 +1154,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
}
-int wildcard_expand( const wchar_t *wc,
+int wildcard_expand( const wchar_t *wc,
const wchar_t *base_dir,
int flags,
array_list_t *out )
@@ -1162,41 +1162,41 @@ int wildcard_expand( const wchar_t *wc,
int c = al_get_count( out );
int res = wildcard_expand_internal( wc, base_dir, flags, out );
int i;
-
+
if( flags & ACCEPT_INCOMPLETE )
{
wchar_t *wc_base=L"";
wchar_t *wc_base_ptr = wcsrchr( wc, L'/' );
string_buffer_t sb;
-
+
if( wc_base_ptr )
{
wc_base = wcsndup( wc, (wc_base_ptr-wc)+1 );
}
-
+
sb_init( &sb );
for( i=c; iflags & COMPLETE_NO_CASE )
{
sb_clear( &sb );
sb_printf( &sb, L"%ls%ls%ls", base_dir, wc_base, c->completion );
-
+
c->completion = halloc_wcsdup( out, (wchar_t *)sb.buff );
}
}
-
+
sb_destroy( &sb );
if( wc_base_ptr )
{
free( wc_base );
}
-
+
}
return res;
}
diff --git a/wildcard.h b/wildcard.h
index 917e15afd..26a8ce07f 100644
--- a/wildcard.h
+++ b/wildcard.h
@@ -1,4 +1,4 @@
-/** \file wildcard.h
+/** \file wildcard.h
My own globbing implementation. Needed to implement this instead
of using libs globbing to support tab-expansion of globbed
@@ -39,7 +39,7 @@ enum
;
/**
- Expand the wildcard by matching against the filesystem.
+ Expand the wildcard by matching against the filesystem.
New strings are allocated using malloc and should be freed by the caller.
@@ -61,11 +61,11 @@ enum
\param out The list in which to put the output
\return 1 if matches where found, 0 otherwise. Return -1 on abort (I.e. ^C was pressed).
-
+
*/
-int wildcard_expand( const wchar_t *wc,
- const wchar_t *base_dir,
- int flags,
+int wildcard_expand( const wchar_t *wc,
+ const wchar_t *base_dir,
+ int flags,
array_list_t *out );
/**
Test whether the given wildcard matches the string
@@ -74,7 +74,7 @@ int wildcard_expand( const wchar_t *wc,
\param wc The wildcard to test against
\return true if the wildcard matched
*/
-int wildcard_match( const wchar_t *str,
+int wildcard_match( const wchar_t *str,
const wchar_t *wc );
@@ -88,7 +88,7 @@ int wildcard_has( const wchar_t *str, int internal );
*/
int wildcard_complete( const wchar_t *str,
const wchar_t *wc,
- const wchar_t *desc,
+ const wchar_t *desc,
const wchar_t *(*desc_func)(const wchar_t *),
array_list_t *out,
int flags );
diff --git a/wutil.c b/wutil.c
index 9c7e09a0b..3c55cf261 100644
--- a/wutil.c
+++ b/wutil.c
@@ -134,9 +134,9 @@ void wutil_destroy()
static char *wutil_wcs2str( const wchar_t *in )
{
size_t new_sz;
-
+
wutil_calls++;
-
+
new_sz =MAX_UTF8_BYTES*wcslen(in)+1;
if( tmp_len < new_sz )
{
@@ -161,9 +161,9 @@ static char *wutil_wcs2str( const wchar_t *in )
static wchar_t *wutil_str2wcs( const char *in )
{
size_t new_sz;
-
+
wutil_calls++;
-
+
new_sz = sizeof(wchar_t)*(strlen(in)+1);
if( tmp2_len < new_sz )
{
@@ -175,7 +175,7 @@ static wchar_t *wutil_str2wcs( const char *in )
}
tmp2_len = new_sz;
}
-
+
return str2wcs_internal( in, tmp2 );
}
@@ -189,7 +189,7 @@ struct wdirent *wreaddir(DIR *dir )
my_wdirent.d_name = wutil_str2wcs( d->d_name );
return &my_wdirent;
-
+
}
@@ -198,24 +198,24 @@ wchar_t *wgetcwd( wchar_t *buff, size_t sz )
char *buffc = malloc( sz*MAX_UTF8_BYTES);
char *res;
wchar_t *ret = 0;
-
+
if( !buffc )
{
errno = ENOMEM;
return 0;
}
-
+
res = getcwd( buffc, sz*MAX_UTF8_BYTES );
if( res )
{
if( (size_t)-1 != mbstowcs( buff, buffc, sizeof( wchar_t ) * sz ) )
{
ret = buff;
- }
+ }
}
-
+
free( buffc );
-
+
return ret;
}
@@ -227,15 +227,15 @@ int wchdir( const wchar_t * dir )
FILE *wfopen(const wchar_t *path, const char *mode)
{
-
+
char *tmp =wutil_wcs2str(path);
FILE *res=0;
if( tmp )
{
res = fopen(tmp, mode);
-
+
}
- return res;
+ return res;
}
FILE *wfreopen(const wchar_t *path, const char *mode, FILE *stream)
@@ -246,7 +246,7 @@ FILE *wfreopen(const wchar_t *path, const char *mode, FILE *stream)
{
res = freopen(tmp, mode, stream);
}
- return res;
+ return res;
}
@@ -256,10 +256,10 @@ int wopen(const wchar_t *pathname, int flags, ...)
char *tmp =wutil_wcs2str(pathname);
int res=-1;
va_list argp;
-
+
if( tmp )
{
-
+
if( ! (flags & O_CREAT) )
{
res = open(tmp, flags);
@@ -271,7 +271,7 @@ int wopen(const wchar_t *pathname, int flags, ...)
va_end( argp );
}
}
-
+
return res;
}
@@ -283,7 +283,7 @@ int wcreat(const wchar_t *pathname, mode_t mode)
{
res= creat(tmp, mode);
}
-
+
return res;
}
@@ -291,11 +291,11 @@ DIR *wopendir(const wchar_t *name)
{
char *tmp =wutil_wcs2str(name);
DIR *res = 0;
- if( tmp )
+ if( tmp )
{
res = opendir(tmp);
}
-
+
return res;
}
@@ -308,8 +308,8 @@ int wstat(const wchar_t *file_name, struct stat *buf)
{
res = stat(tmp, buf);
}
-
- return res;
+
+ return res;
}
int lwstat(const wchar_t *file_name, struct stat *buf)
@@ -321,8 +321,8 @@ int lwstat(const wchar_t *file_name, struct stat *buf)
{
res = lstat(tmp, buf);
}
-
- return res;
+
+ return res;
}
@@ -333,8 +333,8 @@ int waccess(const wchar_t *file_name, int mode)
if( tmp )
{
res= access(tmp, mode);
- }
- return res;
+ }
+ return res;
}
void wperror(const wchar_t *s)
@@ -352,18 +352,18 @@ void wperror(const wchar_t *s)
wchar_t *wrealpath(const wchar_t *pathname, wchar_t *resolved_path)
{
char *tmp = wutil_wcs2str(pathname);
- char *narrow_res = realpath( tmp, 0 );
- wchar_t *res;
+ char *narrow_res = realpath( tmp, 0 );
+ wchar_t *res;
if( !narrow_res )
return 0;
-
+
if( resolved_path )
{
wchar_t *tmp2 = str2wcs( narrow_res );
wcslcpy( resolved_path, tmp2, PATH_MAX );
free( tmp2 );
- res = resolved_path;
+ res = resolved_path;
}
else
{
@@ -382,17 +382,17 @@ wchar_t *wrealpath(const wchar_t *pathname, wchar_t *resolved_path)
char *tmp = wutil_wcs2str(pathname);
char narrow_buff[PATH_MAX];
char *narrow_res = realpath( tmp, narrow_buff );
- wchar_t *res;
+ wchar_t *res;
if( !narrow_res )
return 0;
-
+
if( resolved_path )
{
wchar_t *tmp2 = str2wcs( narrow_res );
wcslcpy( resolved_path, tmp2, PATH_MAX );
free( tmp2 );
- res = resolved_path;
+ res = resolved_path;
}
else
{
@@ -409,14 +409,14 @@ wchar_t *wdirname( wchar_t *path )
static string_buffer_t *sb = 0;
if( sb )
sb_clear(sb);
- else
+ else
sb = sb_halloc( global_context );
-
+
char *tmp =wutil_wcs2str(path);
char *narrow_res = dirname( tmp );
if( !narrow_res )
return 0;
-
+
sb_printf( sb, L"%s", narrow_res );
wcscpy( path, (wchar_t *)sb->buff );
return path;
@@ -427,14 +427,14 @@ wchar_t *wbasename( const wchar_t *path )
static string_buffer_t *sb = 0;
if( sb )
sb_clear(sb);
- else
+ else
sb = sb_halloc( global_context );
-
+
char *tmp =wutil_wcs2str(path);
char *narrow_res = basename( tmp );
if( !narrow_res )
return 0;
-
+
sb_printf( sb, L"%s", narrow_res );
return (wchar_t *)sb->buff;
}
@@ -450,9 +450,9 @@ static void wgettext_destroy()
if( !wgettext_is_init )
return;
-
+
wgettext_is_init = 0;
-
+
for(i=0; ibuff;
-
+
}
int wmkdir( const wchar_t *name, int mode )
@@ -555,7 +555,7 @@ int wrename( const wchar_t *old, const wchar_t *new )
char *old_narrow =wutil_wcs2str(old);
char *new_narrow =wcs2str(new);
int res;
-
+
res = rename( old_narrow, new_narrow );
free( new_narrow );
diff --git a/wutil.h b/wutil.h
index fcabfa93d..16f16d809 100644
--- a/wutil.h
+++ b/wutil.h
@@ -1,7 +1,7 @@
/** \file wutil.h
Prototypes for wide character equivalents of various standard unix
- functions.
+ functions.
*/
#ifndef FISH_WUTIL_H
#define FISH_WUTIL_H
@@ -95,7 +95,7 @@ wchar_t *wgetcwd( wchar_t *buff, size_t sz );
*/
int wchdir( const wchar_t * dir );
-/**
+/**
Wide character version of realpath function. Just like the GNU
version of realpath, wrealpath will accept 0 as the value for the
second argument, in which case the result will be allocated using
diff --git a/xdgmime.c b/xdgmime.c
index e4934a975..1b66b05f0 100644
--- a/xdgmime.c
+++ b/xdgmime.c
@@ -2,13 +2,13 @@
/* xdgmime.c: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
*
* More info can be found at http://www.freedesktop.org/standards/
- *
+ *
* Copyright (C) 2003,2004 Red Hat, Inc.
* Copyright (C) 2003,2004 Jonathan Blandford
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
- *
+ *
* This 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
@@ -440,7 +440,7 @@ xdg_mime_get_mime_type_for_file (const char *file_name)
data = malloc (max_extent);
if (data == NULL)
return XDG_MIME_TYPE_UNKNOWN;
-
+
file = fopen (file_name, "r");
if (file == NULL)
{
@@ -500,7 +500,7 @@ xdg_mime_shutdown (void)
xdg_dir_time_list_free (dir_time_list);
dir_time_list = NULL;
}
-
+
if (global_hash)
{
_xdg_glob_hash_free (global_hash);
@@ -522,8 +522,8 @@ xdg_mime_shutdown (void)
{
_xdg_mime_parent_list_free ( parent_list);
}
-
-
+
+
for (list = callback_list; list; list = list->next)
(list->callback) (list->data);
@@ -534,7 +534,7 @@ int
xdg_mime_get_max_buffer_extents (void)
{
xdg_mime_init ();
-
+
return _xdg_mime_magic_get_buffer_extents (global_magic);
}
@@ -577,7 +577,7 @@ xdg_mime_media_type_equal (const char *mime_a,
xdg_mime_init ();
sep = strchr (mime_a, '/');
-
+
if (sep && strncmp (mime_a, mime_b, sep - mime_a + 1) == 0)
return 1;
@@ -616,7 +616,7 @@ xdg_mime_mime_type_subclass (const char *mime,
if (strcmp (umime, ubase) == 0)
return 1;
-#if 0
+#if 0
/* Handle supertypes */
if (xdg_mime_is_super_type (ubase) &&
xdg_mime_media_type_equal (umime, ubase))
@@ -624,13 +624,13 @@ xdg_mime_mime_type_subclass (const char *mime,
#endif
/* Handle special cases text/plain and application/octet-stream */
- if (strcmp (ubase, "text/plain") == 0 &&
+ if (strcmp (ubase, "text/plain") == 0 &&
strncmp (umime, "text/", 5) == 0)
return 1;
if (strcmp (ubase, "application/octet-stream") == 0)
return 1;
-
+
parents = _xdg_mime_parent_list_lookup (parent_list, umime);
for (; parents && *parents; parents++)
{
@@ -653,7 +653,7 @@ xdg_mime_get_mime_parents (const char *mime)
return _xdg_mime_parent_list_lookup (parent_list, umime);
}
-void
+void
xdg_mime_dump (void)
{
printf ("*** ALIASES ***\n\n");
diff --git a/xdgmime.h b/xdgmime.h
index fd3647b59..a02b67881 100644
--- a/xdgmime.h
+++ b/xdgmime.h
@@ -2,13 +2,13 @@
/* xdgmime.h: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
*
* More info can be found at http://www.freedesktop.org/standards/
- *
+ *
* Copyright (C) 2003 Red Hat, Inc.
* Copyright (C) 2003 Jonathan Blandford
*
* Licensed under the Academic Free License version 2.0
* Or under the following terms:
- *
+ *
* This 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
@@ -44,7 +44,7 @@ extern "C" {
typedef void (*XdgMimeCallback) (void *user_data);
typedef void (*XdgMimeDestroy) (void *user_data);
-
+
#ifdef XDG_PREFIX
#define xdg_mime_get_mime_type_for_data XDG_ENTRY(get_mime_type_for_data)
#define xdg_mime_get_mime_type_for_file XDG_ENTRY(get_mime_type_for_file)
diff --git a/xdgmimealias.c b/xdgmimealias.c
index 2dd70f1d6..35ce89078 100644
--- a/xdgmimealias.c
+++ b/xdgmimealias.c
@@ -47,7 +47,7 @@
typedef struct XdgAlias XdgAlias;
-struct XdgAlias
+struct XdgAlias
{
char *alias;
char *mime_type;
@@ -72,7 +72,7 @@ _xdg_mime_alias_list_new (void)
return list;
}
-void
+void
_xdg_mime_alias_list_free (XdgAliasList *list)
{
int i;
@@ -147,20 +147,20 @@ _xdg_mime_alias_read_from_file (XdgAliasList *list,
if (list->n_aliases == alloc)
{
alloc <<= 1;
- list->aliases = realloc (list->aliases,
+ list->aliases = realloc (list->aliases,
alloc * sizeof (XdgAlias));
}
list->aliases[list->n_aliases].alias = strdup (line);
list->aliases[list->n_aliases].mime_type = strdup (sep);
list->n_aliases++;
}
- list->aliases = realloc (list->aliases,
+ list->aliases = realloc (list->aliases,
list->n_aliases * sizeof (XdgAlias));
- fclose (file);
-
+ fclose (file);
+
if (list->n_aliases > 1)
- qsort (list->aliases, list->n_aliases,
+ qsort (list->aliases, list->n_aliases,
sizeof (XdgAlias), alias_entry_cmp);
}
@@ -174,7 +174,7 @@ _xdg_mime_alias_list_dump (XdgAliasList *list)
{
for (i = 0; i < list->n_aliases; i++)
{
- printf ("%s %s\n",
+ printf ("%s %s\n",
list->aliases[i].alias,
list->aliases[i].mime_type);
}
diff --git a/xdgmimeglob.c b/xdgmimeglob.c
index ff3e27745..ef4a46085 100644
--- a/xdgmimeglob.c
+++ b/xdgmimeglob.c
@@ -302,11 +302,11 @@ _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, FALSE));
if (mime_type != NULL)
return mime_type;
-
+
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, TRUE));
if (mime_type != NULL)
return mime_type;
-
+
ptr = strchr (ptr+1, '.');
}
diff --git a/xdgmimeglob.h b/xdgmimeglob.h
index 771c4527f..bd3e72cdd 100644
--- a/xdgmimeglob.h
+++ b/xdgmimeglob.h
@@ -39,7 +39,7 @@ typedef enum
XDG_GLOB_FULL /* x*.[ch] */
} XdgGlobType;
-
+
#ifdef XDG_PREFIX
#define _xdg_mime_glob_read_from_file XDG_ENTRY(glob_read_from_file)
#define _xdg_glob_hash_new XDG_ENTRY(hash_new)
diff --git a/xdgmimeparent.c b/xdgmimeparent.c
index 511bbacbc..30648e3ea 100644
--- a/xdgmimeparent.c
+++ b/xdgmimeparent.c
@@ -73,7 +73,7 @@ _xdg_mime_parent_list_new (void)
return list;
}
-void
+void
_xdg_mime_parent_list_free (XdgParentList *list)
{
int i;
@@ -159,13 +159,13 @@ _xdg_mime_parent_read_from_file (XdgParentList *list,
break;
}
}
-
+
if (!entry)
{
if (list->n_mimes == alloc)
{
alloc <<= 1;
- list->parents = realloc (list->parents,
+ list->parents = realloc (list->parents,
alloc * sizeof (XdgMimeParents));
}
list->parents[list->n_mimes].mime = strdup (line);
@@ -182,25 +182,25 @@ _xdg_mime_parent_read_from_file (XdgParentList *list,
else
{
entry->n_parents += 1;
- entry->parents = realloc (entry->parents,
+ entry->parents = realloc (entry->parents,
(entry->n_parents + 2) * sizeof (char *));
}
entry->parents[entry->n_parents - 1] = strdup (sep);
entry->parents[entry->n_parents] = NULL;
}
- list->parents = realloc (list->parents,
+ list->parents = realloc (list->parents,
list->n_mimes * sizeof (XdgMimeParents));
- fclose (file);
-
+ fclose (file);
+
if (list->n_mimes > 1)
- qsort (list->parents, list->n_mimes,
+ qsort (list->parents, list->n_mimes,
sizeof (XdgMimeParents), &parent_entry_cmp);
}
-void
+void
_xdg_mime_parent_list_dump (XdgParentList *list)
{
int i;
diff --git a/xsel-0.9.6.tar b/xsel-0.9.6.tar
deleted file mode 100644
index 47e5ceb2b..000000000
Binary files a/xsel-0.9.6.tar and /dev/null differ
diff --git a/xsel-1.2.0.tar.gz b/xsel-1.2.0.tar.gz
new file mode 100644
index 000000000..866f678ee
Binary files /dev/null and b/xsel-1.2.0.tar.gz differ