diff --git a/Makefile.in b/Makefile.in index 0b0dad5c7..6d231f201 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,6 +47,9 @@ fishfile = @fishfile@ fishinputfile = @fishinputfile@ docdir = @docdir@ +#Init files to install +INIT_DIR_INSTALL = init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish + HAVE_GETTEXT=@HAVE_GETTEXT@ # All objects used by fish, that are compiled from an ordinary .c file @@ -134,7 +137,7 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \ $(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \ $(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \ user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \ - config.guess fish_tests.c main.c fish_pager.c fishd.c + config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in # Files in ./init/ INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \ @@ -148,7 +151,7 @@ TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \ COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish) # Programs to build -PROGRAMS:=fish set_color @XSEL@ mimedb count fish_pager fishd +PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd # Manuals to install MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \ @@ -311,7 +314,7 @@ install: all install-translations $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir) $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions $(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile) - for i in init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish ; do \ + for i in $(INIT_DIR_INSTALL); do \ $(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \ done; for i in $(COMPLETIONS_DIR_FILES); do \ diff --git a/configure.ac b/configure.ac index a358da1fe..3197630e5 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,9 @@ if ! test $has_doxygen = "true"; then exit 1 fi +# Check for seq program. If missing, install fallback shellscript implementation +AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq]) + # Optionally drop xsel AC_ARG_WITH( xsel, AC_HELP_STRING([--without-xsel], @@ -183,7 +186,7 @@ AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURS # does not properly support terminfo. AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)]) -AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish]) +AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq]) AC_OUTPUT echo "Now run 'make' and 'make install' to built and install fish." diff --git a/env.c b/env.c index 1a19ffb5e..d6334e68c 100644 --- a/env.c +++ b/env.c @@ -432,7 +432,7 @@ static void setup_path() sb_destroy( &b ); - al_foreach( &l, &free ); + al_foreach( &l, (void (*)(const void *))&free ); path = env_get( L"PATH" ); al_truncate( &l, 0 ); expand_variable_array( path, &l ); @@ -740,7 +740,8 @@ void env_set( const wchar_t *key, else { /* - New variable with unspecified scope. The default scope is the innermost scope that is shadowing + New variable with unspecified scope. The default + scope is the innermost scope that is shadowing */ node = top; while( node->next && !node->new_scope ) diff --git a/seq.in b/seq.in new file mode 100755 index 000000000..5906acb0d --- /dev/null +++ b/seq.in @@ -0,0 +1,37 @@ +#!@prefix@/bin/fish + +function seq -d "Print a sequnce of numbers" + + set -l from 1 + set -l step 1 + set -l to 1 + + switch (count $argv) + case 1 + set to $argv[1] + + case 2 + set from $argv[1] + set to $argv[2] + + case 3 + set from $argv[1] + set step $argv[2] + set to $argv[3] + + case '*' + printf (_ "%s: Expected 1, 2 or 3 arguments, got %d\n") seq (count $argv) + return 1 + + end + + for i in $from $step $to + if not echo $i | grep '^-\?[0-9]*\(\|.[0-9]\+\)$' >/dev/null + printf (_ "%s: '%s' is not a number\n") seq $i + return 1 + end + end + + echo "for( i=$from; i<$to ; i+=$step ) i;" | bc + +end diff --git a/util.c b/util.c index 2f7dc4844..1cc2a44f9 100644 --- a/util.c +++ b/util.c @@ -168,10 +168,6 @@ int q_empty( dyn_queue_t *q ) return q->put_pos == q->get_pos; } -/* Stack functions */ - - - /* Hash table functions */