xref: /csrg-svn/contrib/ed/f.c (revision 57684)
1*57684Sbostic /*-
2*57684Sbostic  * Copyright (c) 1992 The Regents of the University of California.
3*57684Sbostic  * All rights reserved.
4*57684Sbostic  *
5*57684Sbostic  * This code is derived from software contributed to Berkeley by
6*57684Sbostic  * Rodney Ruddock of the University of Guelph.
7*57684Sbostic  *
8*57684Sbostic  * %sccs.include.redist.c%
9*57684Sbostic  */
10*57684Sbostic 
11*57684Sbostic #ifndef lint
12*57684Sbostic static char sccsid[] = "@(#)f.c	5.1 (Berkeley) 01/23/93";
13*57684Sbostic #endif /* not lint */
14*57684Sbostic 
15*57684Sbostic #include "ed.h"
16*57684Sbostic 
17*57684Sbostic /*
18*57684Sbostic  * Prints out or sets the remembered filename.
19*57684Sbostic  */
20*57684Sbostic 
21*57684Sbostic void
22*57684Sbostic f(inputt, errnum)
23*57684Sbostic 
24*57684Sbostic FILE *inputt;
25*57684Sbostic int *errnum;
26*57684Sbostic 
27*57684Sbostic {
28*57684Sbostic   char *l_temp;
29*57684Sbostic 
30*57684Sbostic   l_temp = filename(inputt, errnum);
31*57684Sbostic   if (sigint_flag)
32*57684Sbostic      SIGINT_ACTION;
33*57684Sbostic   if (*errnum == 1)
34*57684Sbostic     {
35*57684Sbostic       free(filename_current);
36*57684Sbostic       filename_current = l_temp;
37*57684Sbostic     }
38*57684Sbostic   else if (*errnum == -2)
39*57684Sbostic     while (((ss = getc(inputt)) != '\n') || (ss == EOF))
40*57684Sbostic          ;
41*57684Sbostic   else if (*errnum < 0)
42*57684Sbostic       return;
43*57684Sbostic   if (sigint_flag)
44*57684Sbostic      SIGINT_ACTION;
45*57684Sbostic   fwrite(filename_current, sizeof(char), strlen(filename_current), stdout);
46*57684Sbostic   putchar('\n');
47*57684Sbostic   *errnum = 1;
48*57684Sbostic } /* end-f */
49