Minor cleanup

darcs-hash:20060518130039-ac50b-c17e794113c38909d90be840fce36c7727c628b4.gz
This commit is contained in:
axel 2006-05-18 23:00:39 +10:00
parent 4a06821d99
commit 763a6b8351
6 changed files with 21 additions and 40 deletions

View file

@ -1200,8 +1200,9 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- The jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
- Syntax highlighting should mark cd to non-existing directories as an error
- wait shellscript
- Signal handler to save the history file before exiting from a signal
- Support for the screen clipboard
- The -a string sent to complete should be validated
- Fish should detect improper variable expansion when validating, e.g. strings such as 'foo$' and 'a${}' should be detected as invalid
\subsection todo-possible Possible features

12
event.c
View file

@ -57,7 +57,7 @@ typedef struct
active, which is the one that new events is written to. The inactive
one contains the events that are currently beeing performed.
*/
static signal_list_t sig_list[2];
static signal_list_t sig_list[]={{0,0},{0,0}};
/**
The index of sig_list that is the list of signals currently written to
@ -273,9 +273,12 @@ void event_remove( event_t *criterion )
event_t e;
/*
Because of concurrency issues, env_remove does not actually free
any events - instead it simply moves all events that should be
removed from the event list to the killme list.
Because of concurrency issues (env_remove could remove an event
that is currently being executed), env_remove does not actually
free any events - instead it simply moves all events that should
be removed from the event list to the killme list, and the ones
that shouldn't be killed to new_list, and then drops the empty
events-list.
*/
if( !events )
@ -617,7 +620,6 @@ void event_fire( event_t *event )
void event_init()
{
sig_list[active_list].count=0;
}
void event_destroy()

19
exec.c
View file

@ -126,7 +126,7 @@ int exec_pipe( int fd[2])
if( open_fds == 0 )
{
open_fds = al_new();
open_fds = al_halloc( global_context );
}
al_push( open_fds, (void *)(long)fd[0] );
@ -164,7 +164,8 @@ static int use_fd_in_pipe( int fd, io_data_t *io )
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.
\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 )
{
@ -185,20 +186,6 @@ static void close_unused_internal_pipes( io_data_t *io )
}
}
void exec_init()
{
}
void exec_destroy()
{
if( open_fds )
{
al_destroy( open_fds );
free( open_fds );
}
}
/**
Make sure the fd used by this redirection is not used by i.e. a pipe.
*/

11
exec.h
View file

@ -18,17 +18,6 @@
*/
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
/**
Initialize the exec library
*/
void exec_init();
/**
Destroy dynamically allocated data and other resources used by the
exec library
*/
void exec_destroy();
/**
Execute the processes specified by j.

10
main.c
View file

@ -63,6 +63,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "halloc_util.h"
#include "history.h"
/**
The string describing the single-character options accepted by the main fish binary
*/
#define GETOPT_STRING "hilnvc:p:d:"
/**
Parse init files
@ -165,14 +169,14 @@ int main( int argc, char **argv )
int opt = getopt_long( argc,
argv,
"hilnvc:p:d:",
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"hilnvc:p:d:" );
GETOPT_STRING );
#endif
if( opt == -1 )
break;
@ -259,7 +263,6 @@ int main( int argc, char **argv )
proc_init();
event_init();
exec_init();
wutil_init();
parser_init();
builtin_init();
@ -348,7 +351,6 @@ int main( int argc, char **argv )
reader_destroy();
parser_destroy();
wutil_destroy();
exec_destroy();
event_destroy();
common_destroy();

View file

@ -2102,15 +2102,15 @@ 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 );