2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
9 static char sccsid
[] = "$Id: ex_file.c,v 8.7 1993/12/02 10:47:41 bostic Exp $ (Berkeley) $Date: 1993/12/02 10:47:41 $";
12 #include <sys/types.h>
22 * ex_file -- :f[ile] [name]
23 * Status line and change the file's name.
40 /* Make sure can allocate enough space. */
41 if ((p
= strdup(cmdp
->argv
[0]->bp
)) == NULL
) {
42 msgq(sp
, M_SYSERR
, NULL
);
46 /* If already have a file name, it becomes the alternate. */
47 if ((t
= FILENAME(frp
)) != NULL
)
50 /* Free any previously changed name. */
51 if (frp
->cname
!= NULL
)
55 /* The read-only bit follows the file name; clear it. */
56 F_CLR(frp
, FR_RDONLY
);
58 /* Have to force a write if the file exists, next time. */
59 F_CLR(frp
, FR_CHANGEWRITE
);
64 status(sp
, ep
, sp
->lno
, 1);