summaryrefslogtreecommitdiff
path: root/usr.bin/mg/fileio.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-03-27 17:42:38 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-03-27 17:42:38 +0000
commitf669fd006e528f67d3ef363fa19ed9b5024470bc (patch)
tree67037a4394021e5b9e9ff7e3c430e886c33c213c /usr.bin/mg/fileio.c
parent87bbeef386d9841d66a33f3656cceb83128598e6 (diff)
Fixes the the following problems (from zyrnix)
1) Mg crashes with column width of 1, rows > 2 2) Mg panics on resizing due to incomplete write 3) Mg doesn't compile with STARTUPFILE defined deraadt@ OK
Diffstat (limited to 'usr.bin/mg/fileio.c')
-rw-r--r--usr.bin/mg/fileio.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 109c33e3458..df1c027c17a 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.26 2002/03/16 19:30:29 vincent Exp $ */
+/* $OpenBSD: fileio.c,v 1.27 2002/03/27 17:42:37 millert Exp $ */
/*
* POSIX fileio.c
@@ -297,8 +297,8 @@ adjustname(const char *fn)
!= -1;) {
if (linkbuf[0] != '/') {
--cp;
- while (cp > fnb && *--cp != '/') {
- }
+ while (cp > fnb && *--cp != '/')
+ ;
++cp;
(void) strncpy(cp, linkbuf, i);
cp += i;
@@ -333,8 +333,8 @@ adjustname(const char *fn)
default:
break;
}
- while (*fn && (*cp++ = *fn++) != '/') {
- }
+ while (*fn && (*cp++ = *fn++) != '/')
+ ;
}
if (cp[-1] == '/')
--cp;
@@ -350,8 +350,7 @@ adjustname(const char *fn)
* to the startup file name.
*/
char *
-startupfile(suffix)
- char *suffix;
+startupfile(char *suffix)
{
static char file[NFILEN];
char *home;
@@ -373,7 +372,7 @@ startupfile(suffix)
return file;
nohome:
#ifdef STARTUPFILE
- if (suffix == NULL)
+ if (suffix == NULL) {
if (snprintf(file, sizeof(file), "%s", STARTUPFILE)
>= sizeof(file))
return NULL;
@@ -395,9 +394,7 @@ nohome:
#include "kbd.h"
int
-copy(frname, toname)
- char *frname;
- char *toname;
+copy(char *frname, char *toname)
{
pid_t pid;
int status;
@@ -418,8 +415,7 @@ copy(frname, toname)
* dirname needs to have enough place to store an additional '/'.
*/
BUFFER *
-dired_(dirname)
- char *dirname;
+dired_(char *dirname)
{
BUFFER *bp;
FILE *dirpipe;