suckless_dictpopup/format_output.c

31 lines
460 B
C
Raw Normal View History

2023-05-28 11:15:50 +00:00
#include <stdio.h>
#include <string.h>
int main()
{
int prevseen = 0;
2023-05-28 11:15:50 +00:00
static char *buf = NULL;
static size_t size = 0;
2023-05-28 19:04:04 +00:00
long n = 1;
while(getline(&buf, &size, stdin) > 0)
2023-05-28 11:15:50 +00:00
{
if (n++ < 5)
2023-05-28 11:15:50 +00:00
continue;
if (strncmp(buf,"-->", 3) == 0)
{
if (!prevseen)
{
prevseen = 1;
putchar('\n');
}
else
{
prevseen = 0;
}
}
2023-05-28 19:04:04 +00:00
else if (buf[0] != 10)
fputs(buf, stdout);
2023-05-28 11:15:50 +00:00
}
return 0;
}