File: run_hscroll.c

package info (click to toggle)
ncmpc 0.25-0.1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,616 kB
  • sloc: ansic: 12,229; sh: 4,157; makefile: 282; ruby: 28
file content (42 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (3)
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
35
36
37
38
39
40
41
42
#include "hscroll.h"
#include "config.h"

#include <glib.h>
#include <stdlib.h>

#ifdef ENABLE_LOCALE
#include <locale.h>
#endif

int main(int argc, char **argv)
{
	struct hscroll hscroll;
	char *p;
	unsigned width, count;

	if (argc != 5) {
		g_printerr("Usage: %s TEXT SEPARATOR WIDTH COUNT\n", argv[0]);
		return 1;
	}

#ifdef ENABLE_LOCALE
	setlocale(LC_CTYPE,"");
#endif

	hscroll_reset(&hscroll);

	width = atoi(argv[3]);
	count = atoi(argv[4]);

	for (unsigned i = 0; i < count; ++i) {
		p = strscroll(&hscroll, argv[1], argv[2], width);
		g_print("%s\n", p);
		g_free(p);

		hscroll_step(&hscroll);
	}

	hscroll_reset(&hscroll);

	return 0;
}