mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-24 22:21:15 -03:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1bf115fa2 | ||
|
|
0f25ef365d | ||
|
|
55ea4b6fc0 | ||
|
|
5ef8cccf21 | ||
|
|
5613d96001 | ||
|
|
5d9ba8c1a2 | ||
|
|
0de232bf54 | ||
|
|
db5b887824 |
@@ -198,7 +198,6 @@ all: $(PROGRAMS) user_doc
|
||||
.PHONY: all
|
||||
|
||||
configure: configure.ac
|
||||
autoconf
|
||||
./config.status --recheck
|
||||
|
||||
Makefile: Makefile.in configure
|
||||
|
||||
@@ -2503,7 +2503,7 @@ static int builtin_jobs( wchar_t **argv )
|
||||
*/
|
||||
for( j=first_job; j; j=j->next )
|
||||
{
|
||||
if( j->constructed )
|
||||
if( j->constructed && !job_is_completed(j) )
|
||||
{
|
||||
builtin_jobs_print( j, mode, !found );
|
||||
return 0;
|
||||
@@ -2536,7 +2536,7 @@ static int builtin_jobs( wchar_t **argv )
|
||||
|
||||
j = job_get_from_pid( pid );
|
||||
|
||||
if( j )
|
||||
if( j && !job_is_completed( j ) )
|
||||
{
|
||||
builtin_jobs_print( j, mode, !found );
|
||||
}
|
||||
@@ -2557,7 +2557,7 @@ static int builtin_jobs( wchar_t **argv )
|
||||
/*
|
||||
Ignore unconstructed jobs, i.e. ourself.
|
||||
*/
|
||||
if( j->constructed /*&& j->skip_notification*/ )
|
||||
if( j->constructed && !job_is_completed(j) )
|
||||
{
|
||||
builtin_jobs_print( j, mode, !found );
|
||||
found = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(fish,1.21.3,fish-users@lists.sf.net)
|
||||
AC_INIT(fish,1.21.4,fish-users@lists.sf.net)
|
||||
|
||||
# If needed, run autoconf to regenerate the configure file
|
||||
AC_MSG_CHECKING([if autoconf needs to be run])
|
||||
|
||||
@@ -33,8 +33,9 @@ the manual page for the echo command by writing:
|
||||
|
||||
<code>man echo</code>
|
||||
|
||||
\c man is a command for displaying a manual page on a given
|
||||
topic. There are manual pages for almost every command on most
|
||||
\c man is a command for displaying a manual page on a given topic. The
|
||||
man command takes the name of the manual page to display as an
|
||||
argument. There are manual pages for almost every command on most
|
||||
computers. There are also manual pages for many other things, such as
|
||||
system libraries and important files.
|
||||
|
||||
@@ -60,6 +61,17 @@ Commands and parameters are separated by the space character
|
||||
the return key) or a semicolon (;). More than one command can be
|
||||
written on the same line by separating them with semicolons.
|
||||
|
||||
A switch is a very common special type of argument. Switches almost
|
||||
always start with one or more hyphens (-) and alter the way a command
|
||||
operates. For example, the \c ls command usually lists all the files
|
||||
and directories in the current working directory, but by using the \c
|
||||
-l switch, the behaviour of ls is changed to not only display the
|
||||
filename, but also the size, permissions, owner and modification time
|
||||
of each file. Switches differ between commands and are documented in
|
||||
the manual page for each command. Some switches are very common
|
||||
though, for example '--help' will usually display a help text, '-i'
|
||||
will often turn on interactive prompting before taking action, while
|
||||
'-f' will turn it off.
|
||||
|
||||
\subsection quotes Quotes
|
||||
|
||||
@@ -200,7 +212,15 @@ When you start a job in \c fish, \c fish itself will pause, and give
|
||||
control of the terminal to the program just started. Sometimes, you
|
||||
want to continue using the commandline, and have the job run in the
|
||||
background. To create a background job, append a \& (ampersand) to
|
||||
your command. This will tell fish to run the job in the background.
|
||||
your command. This will tell fish to run the job in the
|
||||
background. Background jobs are very useful when running programs that
|
||||
have a graphical user interface.
|
||||
|
||||
Example:
|
||||
|
||||
<code>emacs \&</code>
|
||||
|
||||
will start the emacs text editor in the background.
|
||||
|
||||
\subsection syntax-job-control Job control
|
||||
|
||||
@@ -211,16 +231,17 @@ programs and do anything you want. If you then want to go back to the
|
||||
suspended command by using the <a href="builtins.html#fg">fg</a>
|
||||
command.
|
||||
|
||||
If you instead want to put a suspended job into the foreground, use
|
||||
the <a href="builtins.html#fg">fg</a> command.
|
||||
If you instead want to put a suspended job into the background, use
|
||||
the <a href="builtins.html#bg">bg</a> command.
|
||||
|
||||
To get a listing of all currently started jobs, use the <a
|
||||
href="builtins.html#jobs">jobs</a> command.
|
||||
|
||||
\subsection syntax-function Shellscript functions
|
||||
|
||||
Functions are used to group together commands and arguments
|
||||
using a single name. For example, the following is a function
|
||||
Functions are used to group together commands and arguments using a
|
||||
single name. It can also be used to start a specific command with
|
||||
additional arguments. For example, the following is a function
|
||||
definition that calls the command 'ls -l' to print a detailed listing
|
||||
of the contents of the current directory:
|
||||
|
||||
@@ -237,14 +258,14 @@ $argv</code> should be called when ll is invoked. $argv is an array
|
||||
variable, which always contains all arguments sent to the function. In
|
||||
the example above, these are simply passed on to the ls command. For
|
||||
more information on functions, see the documentation for the <a
|
||||
href='builtin.html#function'>function builtin</a>.
|
||||
href='builtin.html#function'>function</a> builtin.
|
||||
|
||||
Functions can be defined on the commandline or in a configuration
|
||||
file, but they can also be automatically loaded. Fish automatically
|
||||
searches through any directories in the array variable
|
||||
\$fish_function_path, and any functions defined are automatically
|
||||
loaded when needed. A function definition file must have a filename
|
||||
consisting of the name of the function and the suffix '.fish'.
|
||||
consisting of the name of the function plus the suffix '.fish'.
|
||||
|
||||
The default value for \$fish_function_path is ~/.fish.d/functions,
|
||||
/etc/fish.d/functions /usr/share/fish/functions. The exact path to the
|
||||
@@ -259,12 +280,13 @@ functions and the last one is for default fish functions.
|
||||
This is a short explanation of some of the commonly used words in fish.
|
||||
|
||||
- argument, a parameter given to a command
|
||||
- builtin, a command that is implemented in the shell
|
||||
- command, a program
|
||||
- function, a block of one or more fish commands that can be called as a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||
- builtin, a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
|
||||
- command, a program that the shell can run.
|
||||
- function, a block of commands and arguments that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||
- job, a running pipeline or command
|
||||
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
|
||||
- redirection, a operation that changes one of the input/output streams associated with a job
|
||||
- switch, a special flag sent as an argument to a command that will alter the behavious of the command. A switch almost always begins with one or two hyphens.
|
||||
|
||||
\section help Help
|
||||
|
||||
@@ -1206,7 +1228,7 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
|
||||
\subsection bugs Known bugs
|
||||
|
||||
- Completion for gcc -\#\#\# option doesn't work.
|
||||
- Yanking weird characters from clipboard prints Unicode escapes
|
||||
- Yanking weird characters from the clipboard prints Unicode escapes
|
||||
- Suspending and then resuming pipelines containing a builtin is broken. How should this be handled?
|
||||
|
||||
If you think you have found a bug not described here, please send a
|
||||
@@ -1384,8 +1406,8 @@ Examples:
|
||||
/** \page license Licenses
|
||||
|
||||
Fish Copyright (C) 2005 Axel Liljencrantz. Fish is released under the
|
||||
GNU General Public License. The license agreement is included
|
||||
below.
|
||||
GNU General Public License, version 2. The license agreement is
|
||||
included below.
|
||||
|
||||
Fish contains code under the BSD license, namely versions of the
|
||||
two functions strlcat and strlcpy, modified for use with wide
|
||||
@@ -1394,11 +1416,16 @@ license agreement is included below.
|
||||
|
||||
The XSel command, written and copyrighted by Conrad Parker, is
|
||||
distributed together with, and used by fish. It is released under the MIT
|
||||
license. The license agreement is included below.
|
||||
license. The license agreement is included below.
|
||||
|
||||
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
|
||||
by the mimedb command, which is a part of fish. It is released under
|
||||
the LGPL license. The license agreement is included below.
|
||||
the LGPL. The license agreement is included below.
|
||||
|
||||
Fish contains code from the glibc library, namely the wcstok
|
||||
function. This code is licensed under the LGPL. The license agreement
|
||||
is included below.
|
||||
|
||||
|
||||
<HR>
|
||||
|
||||
|
||||
4
exec.c
4
exec.c
@@ -1209,14 +1209,12 @@ void exec( job_t *j )
|
||||
{
|
||||
proc_last_bg_pid = j->pgid;
|
||||
}
|
||||
|
||||
|
||||
if( !exec_error )
|
||||
{
|
||||
job_continue (j, 0);
|
||||
}
|
||||
|
||||
debug( 3, L"End of exec()" );
|
||||
|
||||
}
|
||||
|
||||
int exec_subshell( const wchar_t *cmd,
|
||||
|
||||
@@ -38,17 +38,17 @@
|
||||
#include <ncurses/term.h>
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#ifdef TPUTS_KLUDGE
|
||||
|
||||
int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t))
|
||||
int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t))
|
||||
{
|
||||
while( *str )
|
||||
{
|
||||
putc( *str++ );
|
||||
fish_putc( *str++ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef char tputs_arg_t;
|
||||
Linux on PPC seems to have a tputs implementation that sometimes
|
||||
behaves strangely. This fallback seems to fix things.
|
||||
*/
|
||||
int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t));
|
||||
int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t));
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
1
parser.c
1
parser.c
@@ -2497,7 +2497,6 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
int parser_test( wchar_t * buff,
|
||||
int babble )
|
||||
{
|
||||
|
||||
30
proc.c
30
proc.c
@@ -265,28 +265,12 @@ int job_is_completed( const job_t *j )
|
||||
{
|
||||
if (!p->completed)
|
||||
{
|
||||
// fwprintf( stderr, L"Process %ls not finished\n", p->argv[0] );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Return true if all processes in the job have completed.
|
||||
|
||||
\param j the job to test
|
||||
*/
|
||||
static int job_last_is_completed( const job_t *j )
|
||||
{
|
||||
process_t *p;
|
||||
|
||||
for (p = j->first_process; p->next; p = p->next)
|
||||
;
|
||||
return p->completed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Store the status of the process pid that was returned by waitpid.
|
||||
Return 0 if all went well, nonzero otherwise.
|
||||
@@ -503,6 +487,11 @@ int job_reap( int interactive )
|
||||
static int locked = 0;
|
||||
|
||||
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;
|
||||
|
||||
@@ -511,6 +500,11 @@ int job_reap( int interactive )
|
||||
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
|
||||
status messages
|
||||
*/
|
||||
if( (!j->skip_notification) && (!interactive) && (!j->fg))
|
||||
{
|
||||
continue;
|
||||
@@ -915,7 +909,7 @@ void job_continue (job_t *j, int cont)
|
||||
do
|
||||
{
|
||||
got_signal = 0;
|
||||
quit = job_is_stopped( j ) || job_last_is_completed( j );
|
||||
quit = job_is_stopped( j ) || job_is_completed( j );
|
||||
}
|
||||
while( got_signal && !quit );
|
||||
if( !quit )
|
||||
@@ -1039,7 +1033,7 @@ void proc_sanity_check()
|
||||
/*
|
||||
More than one foreground job?
|
||||
*/
|
||||
if( j->fg && !(job_is_stopped(j) || job_last_is_completed(j) ) )
|
||||
if( j->fg && !(job_is_stopped(j) || job_is_completed(j) ) )
|
||||
{
|
||||
if( fg_job != 0 )
|
||||
{
|
||||
|
||||
47
reader.c
47
reader.c
@@ -2265,7 +2265,19 @@ static int read_i()
|
||||
|
||||
if( data->end_loop)
|
||||
{
|
||||
if( !prev_end_loop && first_job != 0 )
|
||||
job_t *j;
|
||||
int has_job=0;
|
||||
|
||||
for( j=first_job; j; j=j->next )
|
||||
{
|
||||
if( !job_is_completed(j) )
|
||||
{
|
||||
has_job = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !prev_end_loop && has_job )
|
||||
{
|
||||
writestr(_( L"There are stopped jobs\n" ));
|
||||
write_prompt();
|
||||
@@ -2461,8 +2473,6 @@ wchar_t *reader_readline()
|
||||
len = data->buff_pos - (data->buff - begin);
|
||||
buffcpy = wcsndup( begin, len );
|
||||
|
||||
//fwprintf( stderr, L"String is %ls\n", buffcpy );
|
||||
|
||||
reader_save_status();
|
||||
data->complete_func( buffcpy, &comp );
|
||||
reader_check_status();
|
||||
@@ -2492,7 +2502,6 @@ wchar_t *reader_readline()
|
||||
|
||||
|
||||
repaint();
|
||||
// wcscpy(data->search_buff,data->buff);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2512,7 +2521,6 @@ wchar_t *reader_readline()
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
// wcscpy(data->search_buff,data->buff);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2524,7 +2532,6 @@ wchar_t *reader_readline()
|
||||
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
|
||||
|
||||
repaint();
|
||||
// wcscpy(data->search_buff,data->buff);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2533,7 +2540,6 @@ wchar_t *reader_readline()
|
||||
{ yank_str = kill_yank();
|
||||
insert_str( yank_str );
|
||||
yank = wcslen( yank_str );
|
||||
// wcscpy(data->search_buff,data->buff);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2696,6 +2702,7 @@ wchar_t *reader_readline()
|
||||
|
||||
/* Move left*/
|
||||
case R_BACKWARD_CHAR:
|
||||
{
|
||||
if( data->buff_pos > 0 )
|
||||
{
|
||||
data->buff_pos--;
|
||||
@@ -2710,8 +2717,9 @@ wchar_t *reader_readline()
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Move right*/
|
||||
}
|
||||
|
||||
/* Move right*/
|
||||
case R_FORWARD_CHAR:
|
||||
{
|
||||
if( data->buff_pos < data->buff_len )
|
||||
@@ -2796,7 +2804,12 @@ wchar_t *reader_readline()
|
||||
insert_char( c );
|
||||
else
|
||||
{
|
||||
// Carriage returns happen. We ignore them
|
||||
/*
|
||||
Carriage returns happen - they are usually a
|
||||
sign of an incorrectly set terminal, but there
|
||||
really isn't very much we can do at this point,
|
||||
so we ignore them.
|
||||
*/
|
||||
if( c != 13 )
|
||||
debug( 0, _( L"Unknown keybinding %d" ), c );
|
||||
}
|
||||
@@ -2873,7 +2886,7 @@ static int read_ni( int fd )
|
||||
_( L"Error while reading commands" ) );
|
||||
|
||||
/*
|
||||
Reset buffer. We won't evaluate incomplete files.
|
||||
Reset buffer on error. We won't evaluate incomplete files.
|
||||
*/
|
||||
acc.used=0;
|
||||
break;
|
||||
@@ -2894,13 +2907,10 @@ static int read_ni( int fd )
|
||||
res = 1;
|
||||
}
|
||||
|
||||
// fwprintf( stderr, L"Woot is %d chars\n", wcslen( acc.buff ) );
|
||||
|
||||
if( str )
|
||||
{
|
||||
if( !parser_test( str, 1 ) )
|
||||
{
|
||||
//fwprintf( stderr, L"We parse it\n" );
|
||||
eval( str, 0, TOP );
|
||||
}
|
||||
else
|
||||
@@ -2943,10 +2953,11 @@ static int read_ni( int fd )
|
||||
int reader_read( int fd )
|
||||
{
|
||||
int res;
|
||||
|
||||
/*
|
||||
If reader_read is called recursively through the '.' builtin,
|
||||
we need to preserve is_interactive, so we save the
|
||||
original state. We also update the signal handlers.
|
||||
If reader_read is called recursively through the '.' builtin, we
|
||||
need to preserve is_interactive. This, and signal handler setup
|
||||
is handled by proc_push_interactive/proc_pop_interactive.
|
||||
*/
|
||||
|
||||
proc_push_interactive( ((fd == 0) && isatty(STDIN_FILENO)));
|
||||
@@ -2955,7 +2966,7 @@ int reader_read( int fd )
|
||||
|
||||
/*
|
||||
If the exit command was called in a script, only exit the
|
||||
script, not the program
|
||||
script, not the program.
|
||||
*/
|
||||
if( data )
|
||||
data->end_loop = 0;
|
||||
|
||||
Reference in New Issue
Block a user