Commit e9099386 by Bruce Korb Committed by Bruce Korb

improve the debug displays, ignore SIGPIPE, and fix char_macro_def regex

From-SVN: r33956
parent 558fe506
2000-05-16 Bruce Korb <bkorb@gnu.org>
* fixinc/fixincl.c: improve the debug displays, ignore SIGPIPE
* fixinc/server.c: likewise
* fixinc/fixfixes.c( char_macro_def_fix ): fix regex
2000-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix): * fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
......
...@@ -339,11 +339,11 @@ FIX_PROC_HEAD( char_macro_use_fix ) ...@@ -339,11 +339,11 @@ FIX_PROC_HEAD( char_macro_use_fix )
/* Scan the input file for all occurrences of text like this: /* Scan the input file for all occurrences of text like this:
#define xxxIOxx(x, y) ('x'<<16+y) #define xxxIOxx(x, y) (....'x'<<16....)
and change them to read like this: and change them to read like this:
#define xxxIOxx(x, y) (x<<16+y) #define xxxIOxx(x, y) (....x<<16....)
which is the required syntax per the C standard. (The uses of _IO which is the required syntax per the C standard. (The uses of _IO
also has to be tweaked - see above.) 'IO' is actually whatever also has to be tweaked - see above.) 'IO' is actually whatever
...@@ -357,15 +357,14 @@ FIX_PROC_HEAD( char_macro_def_fix ) ...@@ -357,15 +357,14 @@ FIX_PROC_HEAD( char_macro_def_fix )
*/ */
"^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\(" "^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\("
/* /*
* The next character must be alphabetic without a name-type * The next character must match a later one
* character following it
*/ */
"([a-zA-Z])[^a-zA-Z0-9_]" /* rm[1] */ "([a-zA-Z])" /* rm[1] */
/* /*
* now match over the argument list, intervening white space * now match over a comma, the argument list, intervening white space
* and opening parentheses, and on through a single quote character * an opening parenthesis, and on through a single quote character
*/ */
"[^)]*\\)[ \t]+\\([ \t(]*'" "[ \t]*,[^)]*\\)[ \t]+\\([^']*'"
/* /*
* Match the character that must match the remembered char above * Match the character that must match the remembered char above
*/ */
...@@ -375,8 +374,8 @@ FIX_PROC_HEAD( char_macro_def_fix ) ...@@ -375,8 +374,8 @@ FIX_PROC_HEAD( char_macro_def_fix )
* Indecipherable gobbeldygook: * Indecipherable gobbeldygook:
*/ */
"^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\(([a-zA-Z])[^a-zA-Z0-9_]\ "^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\(\
[^)]*\\)[ \t]+\\([ \t(]*'([a-zA-Z])'" ([a-zA-Z])[ \t]*,[^)]*\\)[ \t]+\\([^']*'([a-zA-Z])'"
#endif #endif
; ;
......
...@@ -618,14 +618,27 @@ else echo FALSE\n\ ...@@ -618,14 +618,27 @@ else echo FALSE\n\
fi"; fi";
char *pz_res; char *pz_res;
int res = SKIP_FIX; int res;
static char cmd_buf[4096]; static char cmd_buf[4096];
sprintf (cmd_buf, cmd_fmt, pz_test_file, p_test->pz_test_text); sprintf (cmd_buf, cmd_fmt, pz_test_file, p_test->pz_test_text);
pz_res = run_shell (cmd_buf); pz_res = run_shell (cmd_buf);
if (*pz_res == 'T')
switch (*pz_res) {
case 'T':
res = APPLY_FIX; res = APPLY_FIX;
break;
case 'F':
res = SKIP_FIX;
break;
default:
fprintf (stderr, "Script yielded bogus result of `%s':\n%s\n\n",
pz_res, cmd_buf );
}
free ((void *) pz_res); free ((void *) pz_res);
return res; return res;
} }
...@@ -938,7 +951,8 @@ fix_applies (p_fixd) ...@@ -938,7 +951,8 @@ fix_applies (p_fixd)
tFixDesc *p_fixd; tFixDesc *p_fixd;
{ {
#ifdef DEBUG #ifdef DEBUG
static const char z_failed[] = "not applying %s to %s - test %d failed\n"; static const char z_failed[] = "not applying %s %s to %s - "
"test %d failed\n";
#endif #endif
const char *pz_fname = pz_curr_file; const char *pz_fname = pz_curr_file;
const char *pz_scan = p_fixd->file_list; const char *pz_scan = p_fixd->file_list;
...@@ -994,8 +1008,8 @@ fix_applies (p_fixd) ...@@ -994,8 +1008,8 @@ fix_applies (p_fixd)
if (test_test (p_test, pz_curr_file) != APPLY_FIX) { if (test_test (p_test, pz_curr_file) != APPLY_FIX) {
#ifdef DEBUG #ifdef DEBUG
if (VLEVEL( VERB_EVERYTHING )) if (VLEVEL( VERB_EVERYTHING ))
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname, fprintf (stderr, z_failed, "TEST", p_fixd->fix_name,
p_fixd->test_ct - test_ct); pz_fname, p_fixd->test_ct - test_ct);
#endif #endif
return BOOL_FALSE; return BOOL_FALSE;
} }
...@@ -1005,8 +1019,8 @@ fix_applies (p_fixd) ...@@ -1005,8 +1019,8 @@ fix_applies (p_fixd)
if (egrep_test (pz_curr_data, p_test) != APPLY_FIX) { if (egrep_test (pz_curr_data, p_test) != APPLY_FIX) {
#ifdef DEBUG #ifdef DEBUG
if (VLEVEL( VERB_EVERYTHING )) if (VLEVEL( VERB_EVERYTHING ))
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname, fprintf (stderr, z_failed, "EGREP", p_fixd->fix_name,
p_fixd->test_ct - test_ct); pz_fname, p_fixd->test_ct - test_ct);
#endif #endif
return BOOL_FALSE; return BOOL_FALSE;
} }
...@@ -1016,8 +1030,8 @@ fix_applies (p_fixd) ...@@ -1016,8 +1030,8 @@ fix_applies (p_fixd)
if (egrep_test (pz_curr_data, p_test) == APPLY_FIX) { if (egrep_test (pz_curr_data, p_test) == APPLY_FIX) {
#ifdef DEBUG #ifdef DEBUG
if (VLEVEL( VERB_EVERYTHING )) if (VLEVEL( VERB_EVERYTHING ))
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname, fprintf (stderr, z_failed, "NEGREP", p_fixd->fix_name,
p_fixd->test_ct - test_ct); pz_fname, p_fixd->test_ct - test_ct);
#endif #endif
/* Negated sense */ /* Negated sense */
return BOOL_FALSE; return BOOL_FALSE;
...@@ -1029,8 +1043,8 @@ fix_applies (p_fixd) ...@@ -1029,8 +1043,8 @@ fix_applies (p_fixd)
!= APPLY_FIX) { != APPLY_FIX) {
#ifdef DEBUG #ifdef DEBUG
if (VLEVEL( VERB_EVERYTHING )) if (VLEVEL( VERB_EVERYTHING ))
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname, fprintf (stderr, z_failed, "FTEST", p_fixd->fix_name,
p_fixd->test_ct - test_ct); pz_fname, p_fixd->test_ct - test_ct);
#endif #endif
return BOOL_FALSE; return BOOL_FALSE;
} }
......
...@@ -209,6 +209,8 @@ sig_handler (signo) ...@@ -209,6 +209,8 @@ sig_handler (signo)
"fixincl ERROR: sig_handler: killed pid %ld due to %s\n", "fixincl ERROR: sig_handler: killed pid %ld due to %s\n",
(long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM"); (long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM");
#endif #endif
if (signo == SIGPIPE)
return;
close_server (); close_server ();
read_pipe_timeout = BOOL_TRUE; read_pipe_timeout = BOOL_TRUE;
} }
...@@ -226,6 +228,8 @@ server_setup () ...@@ -226,6 +228,8 @@ server_setup ()
if (atexit_done++ == 0) if (atexit_done++ == 0)
atexit (close_server); atexit (close_server);
else
fputs ("NOTE: server restarted\n", stderr);
signal (SIGPIPE, sig_handler); signal (SIGPIPE, sig_handler);
signal (SIGALRM, sig_handler); signal (SIGALRM, sig_handler);
...@@ -281,6 +285,7 @@ char * ...@@ -281,6 +285,7 @@ char *
run_shell (pz_cmd) run_shell (pz_cmd)
const char *pz_cmd; const char *pz_cmd;
{ {
tSCC zNoServer[] = "Server not running, cannot run:\n%s\n\n";
t_bool retry = BOOL_TRUE; t_bool retry = BOOL_TRUE;
do_retry: do_retry:
...@@ -299,7 +304,7 @@ run_shell (pz_cmd) ...@@ -299,7 +304,7 @@ run_shell (pz_cmd)
if (server_id <= 0) if (server_id <= 0)
{ {
char *pz = (char *) malloc (1); char *pz = (char *) malloc (1);
fprintf (stderr, zNoServer, pz_cmd);
if (pz != (char *) NULL) if (pz != (char *) NULL)
*pz = '\0'; *pz = '\0';
return pz; return pz;
...@@ -317,7 +322,7 @@ run_shell (pz_cmd) ...@@ -317,7 +322,7 @@ run_shell (pz_cmd)
if (server_id == NULLPROCESS) if (server_id == NULLPROCESS)
{ {
char *pz = (char *) malloc (1); char *pz = (char *) malloc (1);
fprintf (stderr, zNoServer, pz_cmd);
if (pz != (char *) NULL) if (pz != (char *) NULL)
*pz = '\0'; *pz = '\0';
return pz; return pz;
...@@ -344,6 +349,9 @@ run_shell (pz_cmd) ...@@ -344,6 +349,9 @@ run_shell (pz_cmd)
if (pz != (char *) NULL) if (pz != (char *) NULL)
*pz = '\0'; *pz = '\0';
} }
#ifdef DEBUG
fprintf( stderr, "run_shell command success: %s\n", pz );
#endif
return pz; return pz;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment