Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wrap_lines.c « ietf « doc - github.com/mumble-voip/celt-0.7.0.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c78fde58d7f4ef770bd4c7d720fccd252ba80418 (plain)
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
28
29
30
31
32
33
34
#include <string.h>
#include <stdio.h>

int main()
{
	int comment = 0;
	int col = 0;
	char c0, c1;
	c0 = getchar();
	while (!feof(stdin))
	{
		c1 = getchar();
		if (c1==9)
			c1 = 32;
		if (col < 71 || c0 == 10) {
			putchar(c0);
		} else {
			if (c1 == 10 || c1 == 13)
			{
				putchar(c0);
			} else {
				putchar ('\\');
				/*printf ("%d %d %d", col, c0, c1);*/
				putchar (10);
				putchar (c0);
				col=0;
			}
		}
		col++;
		if (c0 == 10)
			col=0;
		c0 = c1;
	}
}