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: v_status.c,v 8.10 1993/11/20 10:05:56 bostic Exp $ (Berkeley) $Date: 1993/11/20 10:05:56 $";
12 #include <sys/param.h>
22 * Show the file status.
25 v_status(sp
, ep
, vp
, fm
, tm
, rp
)
33 * ^G in historic vi reset the cursor column to the first
34 * non-blank character in the line. This doesn't seem of
35 * any usefulness whatsoever, so I don't bother.
37 return (status(sp
, ep
, fm
->lno
, 1));
41 status(sp
, ep
, lno
, showlast
)
48 char *mo
, *nc
, *nf
, *ro
, *pid
;
52 (void)snprintf(pbuf
, sizeof(pbuf
), " (pid %u)", getpid());
58 * See nvi/exf.c:file_init() for a description of how and
59 * when the read-only bit is set. Possible displays are:
64 * [un]modified, readonly
65 * name changed, [un]modified
66 * name changed, [un]modified, readonly
69 * The historic display for "name changed" was "[Not edited]".
71 if (F_ISSET(sp
->frp
, FR_NEWFILE
)) {
72 F_CLR(sp
->frp
, FR_NEWFILE
);
77 if (sp
->frp
->cname
!= NULL
) {
79 mo
= F_ISSET(ep
, F_MODIFIED
) ?
80 ", modified" : ", unmodified";
83 mo
= F_ISSET(ep
, F_MODIFIED
) ?
84 "modified" : "unmodified";
87 ro
= F_ISSET(sp
->frp
, FR_RDONLY
) ? ", readonly" : "";
89 if (file_lline(sp
, ep
, &last
))
93 "%s: %s%s%s%s: line %lu of %lu [%ld%%]%s",
94 FILENAME(sp
->frp
), nf
, nc
, mo
, ro
, lno
,
95 last
, (lno
* 100) / last
, pid
);
97 msgq(sp
, M_INFO
, "%s: %s%s%s%s: empty file%s",
98 FILENAME(sp
->frp
), nf
, nc
, mo
, ro
, pid
);
100 msgq(sp
, M_INFO
, "%s: %s%s%s%s: line %lu%s",
101 FILENAME(sp
->frp
), nf
, nc
, mo
, ro
, lno
, pid
);