From 88c27c9df81fc88978991a27a454a4035c457ed0 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 28 Apr 2016 22:55:06 +0200 Subject: Improve interop --- censor.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/censor.c b/censor.c index c2d5d2f..ab6c5ba 100644 --- a/censor.c +++ b/censor.c @@ -36,6 +36,7 @@ int main(int argc, char **argv){ setlocale(LC_ALL, ""); + int escape_state = 0; for(char **filename=inputs; filename 0){ - if(strchr("acegmnopqrsuvwxyz", c)) - printf("▄"); - else if(strchr(".,:; \t\r\n", c)) + if(!escape_state){ + if(c == '\e'){ + printf("%lc", c); + escape_state = 1; + }else if(strchr("acegmnopqrsuvwxyz", c)) + printf("▄"); + else if(strchr(".,:; \t\r\n", c)) + printf("%lc", c); + else + printf("█"); + }else{ printf("%lc", c); - else - printf("█"); + if(!strchr("[0123456789;", c)) + escape_state = 0; + } } fclose(f); -- cgit