Next Welcome to my ~/bin 73

Interlude: the good old days

     /* 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);
         }
       }
     }
        #!/usr/bin/perl -lp
        s/_\cH//g;


Next Menu Copyright © 2005 M. J. Dominus