#!/usr/bin/perl # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Given one or more C declarations, this program converts them to an extern # # declarations. This entails replacing any initial "static" or "global" with # # "extern", and stripping away any initializers. The current implementation # # works best with one-line declarations; some multi-line declarations won't # # be completely transformed. This program is intended to be run from an # # editor to rewrite a chunk of the program. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # for () { s/^static\s+//; s/^global\s+//; s/^/extern /; s/\s*=.*;/;/; print; }