40 while((c = getc(fd)) != EOF) {
43 if( strlen >= memlen ) {
45 if( !(strptr =
trealloc(strptr, memlen + 1))) {
57 strptr[strlen] =
'\0';
59 strptr =
trealloc(strptr, strlen + 1);
80 if (strchr(name, DIR_TERM) || strchr(name,
'/')
84 return (fopen(buf, mode));
91 (void) sprintf(buf,
"%s/%s", v->va_string, name);
94 (void) sprintf(buf,
"%d/%s", v->va_num, name);
97 (void) sprintf(buf,
"%lg/%s", v->va_real, name);
101 if (fp = fopen(buf, mode))
120 char *buffer, *
s, *
t;
136 for (s = buffer; *s && (*s !=
'\n'); s++)
139 fprintf(
cp_err,
"Warning: premature EOF\n");
145 while (*s ==
' ' || *s ==
'\t')
154 if (
prefix(
".include", buffer)) {
155 for (s = buffer; *s && !isspace(*s); s++)
161 "Error: .include filename missing\n");
164 for (t = s; *t && !isspace(*t); t++)
174 (void) fclose(newfp);
183 end = cc =
alloc(
struct line);
194 (
void) strncpy(buffer + 1,
"end of:", 7);
202 end = cc =
alloc(
struct line);
216 switch (*working->li_line) {
220 working = working->li_next;
224 working->li_error =
copy(
225 "Illegal continuation card: ignored.");
226 working = working->li_next;
229 buffer =
tmalloc(strlen(prev->li_line) +
230 strlen(working->li_line) + 2);
231 (void) sprintf(buffer,
"%s %s", prev->li_line,
232 working->li_line + 1);
234 prev->li_line = buffer;
235 prev->li_next = working->li_next;
236 working->li_next =
NULL;
237 if (prev->li_actual) {
245 newcard =
alloc(
struct line);
246 newcard->li_linenum = prev->li_linenum;
247 newcard->li_line = s;
248 newcard->li_next = working;
249 prev->li_actual = newcard;
251 working = prev->li_next;
255 working = working->li_next;
272 *
string =
strip(*
string);
273 if (!isspace(*
string) && !isprint(*
string))
275 if (isupper(*
string))
276 *
string = tolower(*
string);
322 deck = deck->li_next;
void cp_pathfix(char *buf)
static char buf[MAXPROMPT]
bool cp_getvar(char *n, int t, char *r)
void inp_readall(FILE *fp, struct line **data, char *title)
char * readline(FILE *fd)
void inp_deckfree(struct line *deck)
FILE * inp_pathopen(char *name, char *mode)
struct line * inp_deckcopy(struct line *deck)
struct variable * va_next
void inp_casefix(char *string)