static void chkcmd(const char *mac) { int i; /* * Check to see if it matches top of stack. */ if (stktop >= 0 && eq(mac, br[stk[stktop].opno].clbr)) stktop--; /* OK. Pop & forget */ else { /* No. Maybe it's an opener */ for (i = 0; br[i].opbr[0] != '\0'; i++) { if (eq(mac, br[i].opbr)) { /* Found. Push it. */ stktop++; stk[stktop].opno = i; stk[stktop].pl = 0; stk[stktop].parm = 0; stk[stktop].lno = lineno; break; } /* * Maybe it's an unmatched closer. * NOTE: this depends on the fact * that none of the closers can be * openers too. */ if (eq(mac, br[i].clbr)) { nomatch(mac); break; } } } }
/* This allows removing Bus Masters while program is running * The master is usually only read-locked for normal operation * write lock is done in a separate thread when no requests are being processed */ void Del_InFlight( GOOD_OR_BAD (*nomatch)(struct port_in * trial,struct port_in * existing), struct port_in * old_pin ) { struct connection_in * old_in ; if ( old_pin == NULL ) { return ; } old_in = old_pin->first ; LEVEL_DEBUG("Request master be removed: %s", DEVICENAME(old_in)); if ( nomatch != NULL ) { struct port_in * pin ; CONNIN_WLOCK ; for ( pin = Inbound_Control.head_port ; pin != NULL ; pin = pin->next ) { if ( BAD( nomatch( old_pin, pin )) ) { LEVEL_DEBUG("Removing BUS index=%d %s",pin->first->index,SAFESTRING(DEVICENAME(pin->first))); RemovePort(pin) ; } } CONNIN_WUNLOCK ; } }
void function (char * fullpath, char const * vector []) { FILE * fp; char buffer [CSOURCE]; char * sp; char * cp; signed c; if ((fp = efopen (fullpath, "rb"))) { char pathname [FILENAME_MAX]; for (sp = cp = strcpy (pathname, fullpath); * cp; ++ cp) { if (* cp == '/') { sp = cp; } } * sp = (char)(0); c = getc (fp); while (c != EOF) { sp = buffer; if (isspace (c)) { do { putc (c, stdout); c = getc (fp); } while (isspace (c)); continue; } if (isalpha (c)) { do { putc (c, stdout); c = getc (fp); } while (isalnum (c)); continue; } if (isdigit (c)) { do { putc (c, stdout); c = getc (fp); } while (isdigit (c)); continue; } if (c == '#') { * sp++ = (char)(c); c = getc (fp); while (isblank (c)) { * sp++ = (char)(c); c = getc (fp); } cp = sp; while (isalpha (c)) { * sp++ = (char) (c); c = getc (fp); } * sp = (char)(0); if (strcmp ("include", cp)) { while (nobreak (c)) { * sp++ = (char) (c); c = getc (fp); } * sp++ = (char)(c); for (cp = buffer; cp < sp; putc (* cp++, stdout)); c = getc (fp); continue; } while (isblank (c)) { * sp++ = (char) (c); c = getc (fp); } if (c == '\"') { size_t index; char filename [FILENAME_MAX]; cp = filename; c = getc (fp); while ((c != '\"') && (c != EOF)) { * cp++ = * sp++ = (char) (c); c = getc (fp); } * cp = (char) (0); makepath (fullpath, pathname, filename); for (index = 0; vector [index] != (char *)(0); index++) { if (!strcmp (fullpath, vector [index])) { break; } } if (vector [index] == (char *)(0)) { vector [index++] = strdup (fullpath); vector [index] = (char *)(0); function (fullpath, vector); } while (nobreak (c)) { * sp++ = (char) (c); c = getc (fp); } * sp++ = (char) (c); } else { while (nobreak (c)) { * sp++ = (char) (c); c = getc (fp); } * sp++ = (char) (c); for (cp = buffer; cp < sp; putc (* cp++, stdout)); } c = getc (fp); continue; } if (isquote (c)) { signed o = getc (fp); putc (c, stdout); while ((o != c) && (c != EOF)) { if (o == '\\') { putc (o, stdout); o = getc (fp); } putc (o, stdout); o = getc (fp); } putc (c, stdout); c = getc (fp); continue; } if (c == '/') { putc (c, stdout); c = getc (fp); if (c == '/') { while (nobreak (c)) { putc (c, stdout); c = getc (fp); } putc ('\n', stdout); c = getc (fp); continue; } if (c == '*') { while (nomatch (c, '/')) { while (nomatch (c, '*')) { putc (c, stdout); c = getc (fp); } putc (c, stdout); c = getc (fp); } putc ('/', stdout); c = getc (fp); continue; } putc (c, stdout); c = getc (fp); continue; } putc (c, stdout); c = getc (fp); } fclose (fp); } return; }
unsigned function (char const * oldname, char const * newname) { unsigned count = 0; signed c = getc (stdin); while (c != EOF) { if (isspace (c)) { do { putc (c, stdout); c = getc (stdin); } while (isspace (c)); continue; } if (isalpha (c) || (c == '_')) { char string [255]; char * sp = string; do { * sp++ = (char) (c); c = getc (stdin); } while (isalnum (c) || (c == '_')); * sp = (char) (0); if (! strcmp (string, oldname)) { count++; fputs (newname, stdout); continue; } fputs (string, stdout); continue; } if (isdigit (c)) { do { putc (c, stdout); c = getc (stdin); } while (isdigit (c) || (c == '.')); if ((c == 'x') || (c == 'X')) { do { putc (c, stdout); c = getc (stdin); } while (isxdigit (c)); } if ((c == 'e') || (c == 'E')) { putc (c, stdout); c = getc (stdin); if ((c == '+') || (c == '-')) { putc (c, stdout); c = getc (stdin); } while (isdigit (c)) { putc (c, stdout); c = getc (stdin); } } continue; } if (isquote (c)) { signed o; putc (c, stdout); o = getc (stdin); while (nomatch (o, c)) { if ((char) (o) == '\\') { putc (o, stdout); o = getc (stdin); } putc (o, stdout); o = getc (stdin); } putc (c, stdout); c = getc (stdin); continue; } if (c == '/') { putc (c, stdout); c = getc (stdin); if (c == '/') { while (nobreak (c)) { putc (c, stdout); c = getc (stdin); } putc ('\n', stdout); c = getc (stdin); continue; } if (c == '*') { while (nomatch (c, '/')) { while (nomatch (c, '*')) { putc (c, stdout); c = getc (stdin); } putc (c, stdout); c = getc (stdin); } putc ('/', stdout); c = getc (stdin); continue; } continue; } putc (c, stdout); c = getc (stdin); } return (count); }