#!/bin/sh

# Sample usage strip-ifdef foo.c -Dmips -DATT
# will select only code in those ifdefs which are selected by mips and ATT.
# includes, and defines will be left intact, as will comments

cat $1 | sed -e "s:^#include:XX#include:g" -e "s:^#define:XX#define:g"  > /tmp/tmpx.c
shift 1

gcc -E -C /tmp/tmpx.c $@ | sed -e "/^#/d" -e "s:XX#:#:g" -e "/^$/d" | cb
