From owner-freebsd-questions@FreeBSD.ORG Tue Jun 16 01:21:21 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B49A8106567B for ; Tue, 16 Jun 2009 01:21:21 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (aristotle.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id 73BF58FC0C for ; Tue, 16 Jun 2009 01:21:21 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id n5G1LHca017129 for ; Mon, 15 Jun 2009 18:21:17 -0700 (PDT) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Mon, 15 Jun 2009 18:21:17 -0700 (PDT) Date: Mon, 15 Jun 2009 18:21:16 -0700 From: Gary Kline To: FreeBSD Mailing List Message-ID: <20090616012114.GA38011@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 22++ years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: Subject: feedback, comments on this php-delimiter scrubbing program? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 01:21:21 -0000 guys, last night i was lost with a slightly shorter version of this. even looking at a printout did nothing. this morning i had another go and went in a corner and started at the code. finally i figured it out. this *seems* to work... The only thing this does is remove the "" delimiters. i'll go more into my rationale later on. i'm pretty sure i can tighten up on this; getting it to work was my main goal. can any of you break this? gary Encl: dephp.c, test -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix $Id: dephp.c,v 1.6 2009/06/16 01:05:47 kline Exp kline $ #include int main() { int ch; do { if ((ch = getchar()) != EOF) switch (ch) { case '>': putchar (ch); break; case '<': putchar (ch); switch ((ch = getchar()) ) { case '?': ch = getchar(); while (1) { if (ch == '?' && (ch = getchar()) == '>') { break; } else { ch = getchar(); } } break; case '>': putchar (ch); break; default: putchar(ch); break; } break; default: putchar (ch); } } while (ch != EOF); return 0; } // test foo bar blah, blah < > blah, blah: more HERE. <> < > < > < >