File: unman.c

package info (click to toggle)
splitvt 1.6.5-0potato1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 332 kB
  • ctags: 399
  • sloc: ansic: 4,684; sh: 78; makefile: 55; perl: 15
file content (27 lines) | stat: -rw-r--r-- 440 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/* A program to remove the doubled letters in nroff -man output */

/* This program was written before I learned the trick:

	nroff -man file.man | col -b
*/

#include	<stdio.h>

main()
{
	char buffer[BUFSIZ], newbuf[BUFSIZ];
	int i, j;

	while ( gets(buffer) != NULL ) {
		for ( i=0, j=0; buffer[i]; ++i ) {
			if ( buffer[i] == ('H'-'@') )
				--j;
			else
				newbuf[j++]=buffer[i];
		}
		newbuf[j]='\0';
		puts(newbuf);
	}
	exit(0);
}