06.12.2012 Aufrufe

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

B.29 Monitoring/wildmat_code.c 319<br />

register intreverse;<br />

for ( ; *p; text++, p++) {<br />

if (*text == '\0' && *p != '*')<br />

return ABORT;<br />

switch (*p) {<br />

case '\\':<br />

/* Literal match with following character. */<br />

p++;<br />

/* FALLTHROUGH */<br />

default:<br />

if (*text != *p)<br />

return FALSE;<br />

continue;<br />

case '?':<br />

/* Match anything. */<br />

continue;<br />

case '*':<br />

while (*++p == '*')<br />

/* Consecutive stars act just like one. */<br />

continue;<br />

if (*p == '\0')<br />

/* Trailing star matches everything. */<br />

return TRUE;<br />

while (*text)<br />

if ((matched = DoMatch(text++, p)) != FALSE)<br />

return matched;<br />

return ABORT;<br />

case '[':<br />

reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE;<br />

if (reverse)<br />

/* Inverted character class. */<br />

p++;<br />

matched = FALSE;<br />

if (p[1] == ']' || p[1] == '-')<br />

if (*++p == *text)<br />

matched = TRUE;<br />

for (last = *p; *++p && *p != ']'; last = *p)<br />

/* This next line requires a good C compiler. */<br />

if (*p == '-' && p[1] != ']'<br />

? *text = last : *text == *p)<br />

matched = TRUE;<br />

if (matched == reverse)<br />

return FALSE;<br />

continue;<br />

}<br />

}<br />

#ifdef MATCH_TAR_PATTERN<br />

if (*text == '/')<br />

return TRUE;<br />

#endif /* MATCH_TAR_ATTERN */<br />

return *text == '\0';<br />

}<br />

/*<br />

** User-level routine. Returns TRUE or FALSE.<br />

*/<br />

int<br />

wildmat(text, p)<br />

char*text;<br />

char*p;<br />

{<br />

#ifdef OPTIMIZE_JUST_STAR<br />

if (p[0] == '*' && p[1] == '\0')<br />

return TRUE;<br />

#endif /* OPTIMIZE_JUST_STAR */<br />

return DoMatch(text, p) == TRUE;<br />

}<br />

(c) 1996-2003 <strong>Hubert</strong> <strong>Feyrer</strong> Stand: 21. Oktober 2003

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!