Minor edits

darcs-hash:20060514163936-ac50b-2a208818ccb26dabb60fba18078c3824da40adf5.gz
This commit is contained in:
axel 2006-05-15 02:39:36 +10:00
parent 32e54fd719
commit c9deea2237
3 changed files with 65 additions and 13 deletions

View file

@ -61,11 +61,6 @@ parts of fish.
#include "wildcard.h" #include "wildcard.h"
#include "parser.h" #include "parser.h"
/**
The maximum number of minor errors to report. Further errors will be omitted.
*/
#define ERROR_MAX_COUNT 1
/** /**
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 a lockfile

View file

@ -285,7 +285,6 @@ static void get_names_internal_all( const void *key,
void *aux ) void *aux )
{ {
wchar_t *name = (wchar_t *)key; wchar_t *name = (wchar_t *)key;
function_data_t *f = (function_data_t *)val;
if( !al_contains_str( (array_list_t *)aux, name ) ) if( !al_contains_str( (array_list_t *)aux, name ) )
{ {

View file

@ -55,143 +55,189 @@ static int block_count=0;
*/ */
static struct lookup_entry lookup[] = static struct lookup_entry lookup[] =
{ {
#ifdef SIGHUP
{ {
SIGHUP, SIGHUP,
L"SIGHUP", L"SIGHUP",
N_( L"Terminal hung up" ) N_( L"Terminal hung up" )
} }
, ,
#endif
#ifdef SIGINT
{ {
SIGINT, SIGINT,
L"SIGINT", L"SIGINT",
N_( L"Quit request from job control (^C)" ) N_( L"Quit request from job control (^C)" )
} }
, ,
#endif
#ifdef SIGQUIT
{ {
SIGQUIT, SIGQUIT,
L"SIGQUIT", L"SIGQUIT",
N_( L"Quit request from job control with core dump (^\\)" ) N_( L"Quit request from job control with core dump (^\\)" )
} }
, ,
#endif
#ifdef SIGILL
{ {
SIGILL, SIGILL,
L"SIGILL", L"SIGILL",
N_( L"Illegal instruction" ) N_( L"Illegal instruction" )
} }
, ,
#endif
#ifdef SIGTRAP
{ {
SIGTRAP, SIGTRAP,
L"SIGTRAP", L"SIGTRAP",
N_( L"Trace or breakpoint trap" ) N_( L"Trace or breakpoint trap" )
} }
, ,
#endif
#ifdef SIGABRT
{ {
SIGABRT, SIGABRT,
L"SIGABRT", L"SIGABRT",
N_( L"Abort" ) N_( L"Abort" )
} }
, ,
#endif
#ifdef SIGBUS
{ {
SIGBUS, SIGBUS,
L"SIGBUS", L"SIGBUS",
N_( L"Misaligned address error" ) N_( L"Misaligned address error" )
} }
, ,
#endif
#ifdef SIGFPE
{ {
SIGFPE, SIGFPE,
L"SIGFPE", L"SIGFPE",
N_( L"Floating point exception" ) N_( L"Floating point exception" )
} }
, ,
#endif
#ifdef SIGKILL
{ {
SIGKILL, SIGKILL,
L"SIGKILL", L"SIGKILL",
N_( L"Forced quit" ) N_( L"Forced quit" )
} }
, ,
#endif
#ifdef SIGUSR1
{ {
SIGUSR1, SIGUSR1,
L"SIGUSR1", L"SIGUSR1",
N_( L"User defined signal 1" ) N_( L"User defined signal 1" )
} }
, ,
#endif
#ifdef SIGUSR2
{ {
SIGUSR2, L"SIGUSR2", SIGUSR2, L"SIGUSR2",
N_( L"User defined signal 2" ) N_( L"User defined signal 2" )
} }
, ,
#endif
#ifdef SIGSEGV
{ {
SIGSEGV, SIGSEGV,
L"SIGSEGV", L"SIGSEGV",
N_( L"Address boundary error" ) N_( L"Address boundary error" )
} }
, ,
#endif
#ifdef SIGPIPE
{ {
SIGPIPE, SIGPIPE,
L"SIGPIPE", L"SIGPIPE",
N_( L"Broken pipe" ) N_( L"Broken pipe" )
} }
, ,
#endif
#ifdef SIGALRM
{ {
SIGALRM, SIGALRM,
L"SIGALRM", L"SIGALRM",
N_( L"Timer expired" ) N_( L"Timer expired" )
} }
, ,
#endif
#ifdef SIGTERM
{ {
SIGTERM, SIGTERM,
L"SIGTERM", L"SIGTERM",
N_( L"Polite quit request" ) N_( L"Polite quit request" )
} }
, ,
#endif
#ifdef SIGCHLD
{ {
SIGCHLD, SIGCHLD,
L"SIGCHLD", L"SIGCHLD",
N_( L"Child process status changed" ) N_( L"Child process status changed" )
} }
, ,
#endif
#ifdef SIGCONT
{ {
SIGCONT, SIGCONT,
L"SIGCONT", L"SIGCONT",
N_( L"Continue previously stopped process" ) N_( L"Continue previously stopped process" )
} }
, ,
#endif
#ifdef SIGSTOP
{ {
SIGSTOP, SIGSTOP,
L"SIGSTOP", L"SIGSTOP",
N_( L"Forced stop" ) N_( L"Forced stop" )
} }
, ,
#endif
#ifdef SIGTSTP
{ {
SIGTSTP, SIGTSTP,
L"SIGTSTP", L"SIGTSTP",
N_( L"Stop request from job control (^Z)" ) N_( L"Stop request from job control (^Z)" )
} }
, ,
#endif
#ifdef SIGTTIN
{ {
SIGTTIN, SIGTTIN,
L"SIGTTIN", L"SIGTTIN",
N_( L"Stop from terminal input" ) N_( L"Stop from terminal input" )
} }
, ,
#endif
#ifdef SIGTTOU
{ {
SIGTTOU, SIGTTOU,
L"SIGTTOU", L"SIGTTOU",
N_( L"Stop from terminal output" ) N_( L"Stop from terminal output" )
} }
, ,
#endif
#ifdef SIGURG
{ {
SIGURG, SIGURG,
L"SIGURG", L"SIGURG",
N_( L"Urgent socket condition" ) N_( L"Urgent socket condition" )
} }
, ,
#endif
#ifdef SIGXCPY
{ {
SIGXCPU, SIGXCPU,
L"SIGXCPU", L"SIGXCPU",
N_( L"CPU time limit exceeded" ) N_( L"CPU time limit exceeded" )
} }
, ,
#endif
#ifdef SIGXFSZ #ifdef SIGXFSZ
{ {
SIGXFSZ, SIGXFSZ,
@ -200,12 +246,14 @@ static struct lookup_entry lookup[] =
} }
, ,
#endif #endif
#ifdef SIGVTALRM
{ {
SIGVTALRM, SIGVTALRM,
L"SIGVTALRM", L"SIGVTALRM",
N_( L"Virtual timer expired" ) N_( L"Virtual timer expired" )
} }
, ,
#endif
#ifdef SIGPROF #ifdef SIGPROF
{ {
SIGPROF, SIGPROF,
@ -230,12 +278,14 @@ static struct lookup_entry lookup[] =
} }
, ,
#endif #endif
#ifdef SIGWIO
{ {
SIGIO, SIGIO,
L"SIGIO", L"SIGIO",
N_( L"I/O on asynchronous file descriptor is possible" ) N_( L"I/O on asynchronous file descriptor is possible" )
} }
, ,
#endif
#ifdef SIGPWR #ifdef SIGPWR
{ {
SIGPWR, SIGPWR,
@ -338,6 +388,7 @@ int wcs2sig( const wchar_t *str )
const wchar_t *sig2wcs( int sig ) const wchar_t *sig2wcs( int sig )
{ {
int i; int i;
for( i=0; lookup[i].desc ; i++ ) for( i=0; lookup[i].desc ; i++ )
{ {
if( lookup[i].signal == sig ) if( lookup[i].signal == sig )
@ -345,12 +396,14 @@ const wchar_t *sig2wcs( int sig )
return lookup[i].name; return lookup[i].name;
} }
} }
return L"Unknown";
return _(L"Unknown");
} }
const wchar_t *signal_get_desc( int sig ) const wchar_t *signal_get_desc( int sig )
{ {
int i; int i;
for( i=0; lookup[i].desc ; i++ ) for( i=0; lookup[i].desc ; i++ )
{ {
if( lookup[i].signal == sig ) if( lookup[i].signal == sig )
@ -358,7 +411,8 @@ const wchar_t *signal_get_desc( int sig )
return _(lookup[i].desc); return _(lookup[i].desc);
} }
} }
return L"Unknown";
return _(L"Unknown");
} }
/** /**
@ -535,13 +589,13 @@ void signal_set_handlers()
exit(1); exit(1);
} }
} }
} }
void signal_handle( int sig, int do_handle ) void signal_handle( int sig, int do_handle )
{ {
struct sigaction act; struct sigaction act;
/* /*
These should always be handled These should always be handled
*/ */
@ -553,15 +607,15 @@ void signal_handle( int sig, int do_handle )
(sig == SIGCHLD) ) (sig == SIGCHLD) )
return; return;
sigemptyset( & act.sa_mask ); sigemptyset( &act.sa_mask );
if( do_handle ) if( do_handle )
{ {
act.sa_flags=SA_SIGINFO; act.sa_flags = SA_SIGINFO;
act.sa_sigaction = &default_handler; act.sa_sigaction = &default_handler;
} }
else else
{ {
act.sa_flags=0; act.sa_flags = 0;
act.sa_handler = SIG_DFL; act.sa_handler = SIG_DFL;
} }
@ -577,16 +631,20 @@ void signal_block()
sigfillset( &chldset ); sigfillset( &chldset );
sigprocmask(SIG_BLOCK, &chldset, 0); sigprocmask(SIG_BLOCK, &chldset, 0);
} }
block_count++; block_count++;
} }
void signal_unblock() void signal_unblock()
{ {
sigset_t chldset; sigset_t chldset;
block_count--; block_count--;
if( !block_count ) if( !block_count )
{ {
sigfillset( &chldset ); sigfillset( &chldset );
sigprocmask(SIG_UNBLOCK, &chldset, 0); sigprocmask(SIG_UNBLOCK, &chldset, 0);
} }
} }