示例#1
0
文件: unicl.c 项目: dokterp/aldor
static FILE *
getCfgFile(int argc, char **argv)
{
	FileName cfgFileName;
	FILE *file;
	char *name;
	
	name = getOption(argc, argv, "-Wconfig=", NULL);
	
	/* Should strip off any ".conf" */

	if (!name) {
		cfgFileName = cfgFindFile(CONFFILE, "");
		if (!cfgFileName) cfgFileName = cfgFindFile(OLDCONFFILE, "");
	}
	else
		cfgFileName = fnameParse(name);
	
	if (!cfgFileName) {
		fprintf(stderr, "Can't find config file\n");
		return NULL;
	}
	if ((file = fileTryOpen(cfgFileName, osIoRdMode)) == NULL)
		fprintf(stderr, "Can't open: %s\n", fnameUnparse(cfgFileName));

	return file;
}
示例#2
0
文件: axlcomp.c 项目: nilqed/aldor
String
compRootFromCmdLine(String cwd, String file)
{
	FileName fname = fnameParseStaticWithin(file, cwd);
	String binDir = fnameDir(fname);
	FileName rootDir = fnameNew(binDir, "..", "");

	String root = fnameUnparse(rootDir);

	return root;
}
示例#3
0
文件: archive.c 项目: hemmecke/aldor
Bool
arHasBasicLib(Archive ar)
{
	static String	s = NULL;

	if (s == NULL) {
		FileName	fn = fnameNew("", "basic", FTYPE_INTERMED);
		s = fnameUnparse(fn);
		fnameFree(fn);
	}

	return arFindEntry(ar, s) != NULL;
}
示例#4
0
文件: unicl.c 项目: dokterp/aldor
static StringList
uclExpandLibs(StringList path0, StringList libs, String ext)
{
	StringList res = listNil(String);
	
	while (libs != listNil(String)) {
		String basename = car(libs);
		StringList path = path0;
                basename = strConcat("lib", basename);
		while (path != listNil(String)) {
			FileName name = fnameNew(car(path), basename, ext);
			if (fileIsOpenable(name, osIoRdMode)) {
				res = listCons(String)(fnameUnparse(name), res);
				break;
			}
			path = cdr(path);
		}
		if (path == listNil(String))
			printf("Warning: %s not found\n", basename);
                strFree(basename);
		libs = cdr(libs);
	}
	return listNReverse(String)(res);
}