autogen.sh: use $AUTOMAKE_FLAGS
[ncmpc.git] / test / run_hscroll.c
blob6bc44078a1b0ecedfb817f5cc0cda2e14d15fd3f
1 #include "hscroll.h"
2 #include "config.h"
4 #include <glib.h>
5 #include <stdlib.h>
7 #ifdef ENABLE_LOCALE
8 #include <locale.h>
9 #endif
11 int main(int argc, char **argv)
13 struct hscroll hscroll;
14 char *p;
15 unsigned width, count;
17 if (argc != 5) {
18 g_printerr("Usage: %s TEXT SEPARATOR WIDTH COUNT\n", argv[0]);
19 return 1;
22 #ifdef ENABLE_LOCALE
23 setlocale(LC_CTYPE,"");
24 #endif
26 hscroll_reset(&hscroll);
28 width = atoi(argv[3]);
29 count = atoi(argv[4]);
31 for (unsigned i = 0; i < count; ++i) {
32 p = strscroll(&hscroll, argv[1], argv[2], width);
33 g_print("%s\n", p);
34 g_free(p);
36 hscroll_step(&hscroll);
39 hscroll_reset(&hscroll);
41 return 0;