2 * Built-in config files
4 * (C) 2006 Joseph H. Allen
6 * This file is part of JOE (Joe's Own Editor)
11 __RCSID("$MirOS: contrib/code/jupp/builtin.c,v 1.8 2017/12/08 02:00:38 tg Exp $");
20 #define zcmp(a,b) strcmp((char *)(a), (char *)(b))
23 jfopen(const unsigned char *name, const char *mode)
29 xname = strdup((const char *)name + 1);
32 if (x >= 'A' && x <= 'Z')
33 cp[-1] = x - 'A' + 'a';
36 for (x = 0; builtins[x]; x += 2) {
37 if (!zcmp(builtins[x], xname)) {
38 JFILE *j = malloc(sizeof(JFILE));
40 j->p = builtins[x + 1];
48 FILE *f = fopen((const char *)name, (const char *)mode);
50 JFILE *j = malloc(sizeof(JFILE));
69 unsigned char *jfgets(unsigned char *buf,int len,JFILE *f)
72 return (unsigned char *)fgets((char *)buf, len, f->f);
76 for (x = 0; f->p[x] && f->p[x] != '\n'; ++x)
78 if (f->p[x] == '\n') {