You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
555 B

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "defs.h"
#include "rc.h"
#include "hw.h"
#include "path.h"
char *rcpath;
int rc_sourcefile(char *filename)
{
FILE *f;
char *name;
char line[256], *p;
name = path_search(filename, "r", rcpath);
f = fopen(name, "r");
if (!f) return -1;
for (;;)
{
if (feof(f)) break;
fgets(line, sizeof line, f);
if ((p = strpbrk(line, "#\r\n")))
*p = 0;
rc_command(line);
}
fclose(f);
return 0;
}
rcvar_t rcfile_exports[] =
{
RCV_STRING("rcpath", &rcpath),
RCV_END
};