File: qtscripttest.cpp

package info (click to toggle)
warzone2100 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 660,348 kB
  • sloc: cpp: 675,711; ansic: 387,204; javascript: 75,107; python: 16,628; php: 4,294; sh: 3,941; makefile: 2,330; lisp: 1,492; cs: 489; xml: 404; perl: 224; ruby: 156; java: 89
file content (38 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (4)
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
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <QtCore/QCoreApplication>
#include "lint.h"

int main(int argc, char **argv)
{
	QCoreApplication app(argc, argv);
	char datapath[PATH_MAX], fullpath[PATH_MAX], filename[PATH_MAX];
	FILE *fp = fopen("jslist.txt", "r");
	if (!fp)
	{
		fprintf(stderr, "%s: Failed to open list file\n", argv[0]);
		return -1;
	}
	if (getenv("srcdir"))
	{
		strcpy(datapath, getenv("srcdir"));
	}
	strcat(datapath, "/../data/");
	while (!feof(fp))
	{
		if (fscanf(fp, "%254s\n", filename) != 1)
		{
			fprintf(stderr, "%s: Failed to fscanf jslist.txt.\n", argv[0]);
			return -1;
		}
		printf("Testing script: %s\n", filename);
		strcpy(fullpath, datapath);
		strcat(fullpath, filename);
		testGlobalScript(fullpath);
	}
	fclose(fp);

	return 0;
}