1 |
|
/* |
2 |
< |
* Copyright (C) 1984-2012 Mark Nudelman |
2 |
> |
* Copyright (C) 1984-2017 Mark Nudelman |
3 |
|
* |
4 |
|
* You may distribute under the terms of either the GNU General Public |
5 |
|
* License or the Less License, as specified in the README file. |
24 |
|
extern IFILE curr_ifile; |
25 |
|
|
26 |
|
struct ifile { |
27 |
< |
struct ifile *h_next; /* Links for command line list */ |
27 |
> |
struct ifile *h_next; /* Links for command line list */ |
28 |
|
struct ifile *h_prev; |
29 |
< |
char *h_filename; /* Name of the file */ |
30 |
< |
void *h_filestate; /* File state (used in ch.c) */ |
31 |
< |
int h_index; /* Index within command line list */ |
32 |
< |
int h_hold; /* Hold count */ |
33 |
< |
char h_opened; /* Has this ifile been opened? */ |
34 |
< |
struct scrpos h_scrpos; /* Saved position within the file */ |
29 |
> |
char *h_filename; /* Name of the file */ |
30 |
> |
void *h_filestate; /* File state (used in ch.c) */ |
31 |
> |
int h_index; /* Index within command line list */ |
32 |
> |
int h_hold; /* Hold count */ |
33 |
> |
char h_opened; /* Has this ifile been opened? */ |
34 |
> |
struct scrpos h_scrpos; /* Saved position within the file */ |
35 |
> |
void *h_altpipe; /* Alt pipe */ |
36 |
> |
char *h_altfilename; /* Alt filename */ |
37 |
|
}; |
38 |
|
|
39 |
|
/* |
52 |
|
|
53 |
|
static void |
54 |
|
incr_index(p, incr) |
55 |
< |
register struct ifile *p; |
55 |
> |
struct ifile *p; |
56 |
|
int incr; |
57 |
|
{ |
58 |
|
for (; p != &anchor; p = p->h_next) |
109 |
|
char *filename; |
110 |
|
struct ifile *prev; |
111 |
|
{ |
112 |
< |
register struct ifile *p; |
112 |
> |
struct ifile *p; |
113 |
|
|
114 |
|
/* |
115 |
|
* Allocate and initialize structure. |
131 |
|
del_ifile(h) |
132 |
|
IFILE h; |
133 |
|
{ |
134 |
< |
register struct ifile *p; |
134 |
> |
struct ifile *p; |
135 |
|
|
136 |
|
if (h == NULL_IFILE) |
137 |
|
return; |
155 |
|
next_ifile(h) |
156 |
|
IFILE h; |
157 |
|
{ |
158 |
< |
register struct ifile *p; |
158 |
> |
struct ifile *p; |
159 |
|
|
160 |
|
p = (h == NULL_IFILE) ? &anchor : int_ifile(h); |
161 |
|
if (p->h_next == &anchor) |
170 |
|
prev_ifile(h) |
171 |
|
IFILE h; |
172 |
|
{ |
173 |
< |
register struct ifile *p; |
173 |
> |
struct ifile *p; |
174 |
|
|
175 |
|
p = (h == NULL_IFILE) ? &anchor : int_ifile(h); |
176 |
|
if (p->h_prev == &anchor) |
210 |
|
find_ifile(filename) |
211 |
|
char *filename; |
212 |
|
{ |
213 |
< |
register struct ifile *p; |
213 |
> |
struct ifile *p; |
214 |
|
|
215 |
|
for (p = anchor.h_next; p != &anchor; p = p->h_next) |
216 |
|
if (strcmp(filename, p->h_filename) == 0) |
228 |
|
char *filename; |
229 |
|
IFILE prev; |
230 |
|
{ |
231 |
< |
register struct ifile *p; |
231 |
> |
struct ifile *p; |
232 |
|
|
233 |
|
if ((p = find_ifile(filename)) == NULL) |
234 |
|
p = new_ifile(filename, int_ifile(prev)); |
330 |
|
int_ifile(ifile)->h_filestate = filestate; |
331 |
|
} |
332 |
|
|
333 |
+ |
public void |
334 |
+ |
set_altpipe(ifile, p) |
335 |
+ |
IFILE ifile; |
336 |
+ |
void *p; |
337 |
+ |
{ |
338 |
+ |
int_ifile(ifile)->h_altpipe = p; |
339 |
+ |
} |
340 |
+ |
|
341 |
+ |
public void * |
342 |
+ |
get_altpipe(ifile) |
343 |
+ |
IFILE ifile; |
344 |
+ |
{ |
345 |
+ |
return (int_ifile(ifile)->h_altpipe); |
346 |
+ |
} |
347 |
+ |
|
348 |
+ |
public void |
349 |
+ |
set_altfilename(ifile, altfilename) |
350 |
+ |
IFILE ifile; |
351 |
+ |
char *altfilename; |
352 |
+ |
{ |
353 |
+ |
struct ifile *p = int_ifile(ifile); |
354 |
+ |
if (p->h_altfilename != NULL) |
355 |
+ |
free(p->h_altfilename); |
356 |
+ |
p->h_altfilename = altfilename; |
357 |
+ |
} |
358 |
+ |
|
359 |
+ |
public char * |
360 |
+ |
get_altfilename(ifile) |
361 |
+ |
IFILE ifile; |
362 |
+ |
{ |
363 |
+ |
return (int_ifile(ifile)->h_altfilename); |
364 |
+ |
} |
365 |
+ |
|
366 |
|
#if 0 |
367 |
|
public void |
368 |
|
if_dump() |
369 |
|
{ |
370 |
< |
register struct ifile *p; |
370 |
> |
struct ifile *p; |
371 |
|
|
372 |
|
for (p = anchor.h_next; p != &anchor; p = p->h_next) |
373 |
|
{ |