From b0b2ca0abea9e516306e19de5fdeec373ed5600b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 30 Aug 2003 00:06:12 +0000 Subject: [PATCH] All correct, except for the odd-chunk-out. --- filterator | 12 +++++++----- shredtree.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/filterator b/filterator index 81c4f6b..ddb2f7f 100755 --- a/filterator +++ b/filterator @@ -8,9 +8,11 @@ import os, sys, re, getopt shredline = re.compile("-> ([^:]*):([0-9]+)-([0-9]+)") # Tokens to be removed when checking whether a shred is significant -C_junk = [r'\bbreak\b', r'\bcontinue\b', r'\bdefault\b', - r'\belse\b', r'\bif\b', r'\bgoto\b', r'\breturn\b', - r'\bint\b', r'\blong\b', r'\bshort\b', r'\bstatic\b', r'\bvoid\b', +C_junk = [r'\bbreak\b', r'\bcase\b',r'\bcontinue\b', r'\bdefault\b', + r'\bdo\b', r'\belse\b', r'\bif\b', r'\bgoto\b', r'\breturn\b', + r'\bswitch\b', r'\bwhile\b', + r'enum', r'\bint\b', r'\blong\b', r'\bshort\b', r'\bstatic\b', + r'\bstruct\b', r'typedef', r'\bunion\b', r'\bvoid\b', r'#define',r'#endif',r'#else',r'#if\b',r'#ifdef\b',r'#ifndef\b', r'/\*+', r'\*+/', r'\*+', r'\b0\b', r'\b1\b', @@ -35,8 +37,8 @@ def nontrivial(text): # there is still an identifier with a name longer than one char left, # we're looking at something that might be interesting. text = ' ' + text - for ch in ('{','}', '(',')', - ';', ':', ',', + for ch in ('{','}', '(',')','<','>', + ';', ':', ',','%','^','&','|','*','?', '+', '-', '/', '=', '!', '\n','\t'): text = text.replace(ch, ' ') while True: diff --git a/shredtree.c b/shredtree.c index 00290b1..2315b11 100644 --- a/shredtree.c +++ b/shredtree.c @@ -68,6 +68,7 @@ static void emit_chunk(shred *display, int linecount) for (i = 0; i < shredsize; i++) if (display[i].line) { + putchar('"'); for (cp = display[i].line; *cp; cp++) if (*cp == '\n') fputs("\\n", stdout); @@ -75,6 +76,7 @@ static void emit_chunk(shred *display, int linecount) fputs("\\t", stdout); else putchar(*cp); + putchar('"'); putchar('\n'); } } @@ -229,8 +231,6 @@ main(int argc, char *argv[]) /* make file list */ ftw(argv[optind], treewalker, 16); - printf("Filecount: %d\n", filecount); - /* now that we know the length, copy into an array */ list = place = (char **)calloc(sizeof(char *), filecount); for (; head->next; head = head->next) -- 2.43.0