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 - 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 - Syntax highlighting should mark cd to non-existing directories as an error
- wait shellscript - wait shellscript
- Signal handler to save the history file before exiting from a signal
- Support for the screen clipboard - 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 \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 active, which is the one that new events is written to. The inactive
one contains the events that are currently beeing performed. 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 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; event_t e;
/* /*
Because of concurrency issues, env_remove does not actually free Because of concurrency issues (env_remove could remove an event
any events - instead it simply moves all events that should be that is currently being executed), env_remove does not actually
removed from the event list to the killme list. 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 ) if( !events )
@ -617,7 +620,6 @@ void event_fire( event_t *event )
void event_init() void event_init()
{ {
sig_list[active_list].count=0;
} }
void event_destroy() void event_destroy()

19
exec.c
View file

@ -126,7 +126,7 @@ int exec_pipe( int fd[2])
if( open_fds == 0 ) if( open_fds == 0 )
{ {
open_fds = al_new(); open_fds = al_halloc( global_context );
} }
al_push( open_fds, (void *)(long)fd[0] ); 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 the redirection list io. This should make sure that there are no
stray opened file descriptors in the child. 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 ) 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. 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") #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. 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 "halloc_util.h"
#include "history.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 Parse init files
@ -165,14 +169,14 @@ int main( int argc, char **argv )
int opt = getopt_long( argc, int opt = getopt_long( argc,
argv, argv,
"hilnvc:p:d:", GETOPT_STRING,
long_options, long_options,
&opt_index ); &opt_index );
#else #else
int opt = getopt( argc, int opt = getopt( argc,
argv, argv,
"hilnvc:p:d:" ); GETOPT_STRING );
#endif #endif
if( opt == -1 ) if( opt == -1 )
break; break;
@ -259,7 +263,6 @@ int main( int argc, char **argv )
proc_init(); proc_init();
event_init(); event_init();
exec_init();
wutil_init(); wutil_init();
parser_init(); parser_init();
builtin_init(); builtin_init();
@ -348,7 +351,6 @@ int main( int argc, char **argv )
reader_destroy(); reader_destroy();
parser_destroy(); parser_destroy();
wutil_destroy(); wutil_destroy();
exec_destroy();
event_destroy(); event_destroy();
common_destroy(); common_destroy();