File: gfnstrings.c

package info (click to toggle)
gretl 2016d-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 48,620 kB
  • ctags: 22,779
  • sloc: ansic: 345,830; sh: 4,648; makefile: 2,712; xml: 570; perl: 364
file content (39 lines) | stat: -rw-r--r-- 672 bytes parent folder | download
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int process_strings (const char *pkg)
{
    char fname[128], line[1024];
    FILE *fp;

    sprintf(fname, "./%s/%s-i18n.c", pkg, pkg);
    fp = fopen(fname, "r");

    if (fp == NULL) {
	fprintf(stderr, "Couldn't open %s\n", fname);
	return 1;
    }

    while (fgets(line, sizeof line, fp)) {
        fputs(line, stdout);
    }
    fputc('\n', stdout);

    fclose(fp);

    return 0;
}

int main (int argc, char **argv)
{
    int i, err = 0;

    fputs("/* translatable strings for gretl addons */\n\n", stdout);

    for (i=1; i<argc && !err; i++) {
	err = process_strings(argv[i]);
    }

    return err;
}