#!/usr/bin/perl
(/(?:}\s*(?:else(?{$/--})|
(?{$__="\t"x--$/.$_})))/xo,
/(?:{\s*(?{$__="\t"x$/++.$_}))$/o,
print($__?"$__":"\t"x$/.$_),
undef $__) while (<>)
####
usage: indent [--help] file
example:
indent file
####
#include
#include
#include
int main() {
int pid,aux,status;
pid = fork();
if ( pid < 0 ) {
perror("fork");
exit(9);
} else if ( pid == 0 ) {
//Child
printf("do nothing ...\n");
exit( 0 );
} else {
printf("father\n");
do {
aux = waitpid(&pid,&status);
} while(pid == aux);
}
printf("end :-)\n");
}