Next | Trivial Utilities | 81 |
I wrote this around March of 1988:
/* Take a man page and strip out the _^H's. */ #include <stdio.h> #define CTLH 8 /* Code for a control-H */
main() { char c; int ulflag = 0; /* set this if I just read an underline character */
while ((c= getchar()) != EOF) { if (ulflag == 1) { ulflag = 0; if (c != CTLH) printf("_%c",c); } else { if (c == '_') ulflag = 1; else printf("%c",c); } } }
Here's how I would write it in March of 2005:
#!/usr/bin/perl -lp s/_\cH//g;
Next | Menu | Copyright © 2012 M. J. Dominus |