obsfucation is a kind of art,
an insane art, tough.
Anyway, i like perl obfuscation :-)
But what happens if you find some ugly unindented? ... use unix indent or other code-indenting tool? ... Yep, thats the solution for all those that do not like risks ... but for the rest, here you got a nano-script, for indenting some c code :-)
#!/usr/bin/perl (/(?:}\s*(?:else(?{$/--})| (?{$__="\t"x--$/.$_})))/xo, /(?:{\s*(?{$__="\t"x$/++.$_}))$/o, print($__?"$__":"\t"x$/.$_), undef $__) while (<>)
¿how to use it?, very simple:
usage: indent [--help] file example: indent file
I've use this file for testing:
#include <stdlib.h> #include <stdio.h> #include <unistd.h> 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"); }
Sure it's no perfect, sure it's useless ... but it's my baby monster ;-)
Dr. Frankesturein
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unindented indenter?
by ambrus (Abbot) on Jan 29, 2006 at 17:35 UTC |