summaryrefslogtreecommitdiff
path: root/usr.bin/mg/dir.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-13 06:12:19 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-13 06:12:19 +0000
commit731317961dd78a8a6a84be2b662b9691fcf40d5a (patch)
tree642f051b45a10e806a55322912dad11e53435ab7 /usr.bin/mg/dir.c
parentf54a169ac01105217cbf6e3dfa39f465f0bde571 (diff)
The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...
Diffstat (limited to 'usr.bin/mg/dir.c')
-rw-r--r--usr.bin/mg/dir.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/usr.bin/mg/dir.c b/usr.bin/mg/dir.c
index d96e6552473..b667c862b6e 100644
--- a/usr.bin/mg/dir.c
+++ b/usr.bin/mg/dir.c
@@ -8,14 +8,16 @@
#include "def.h"
#ifndef NO_DIR
-char *wdir;
-static char cwd[NFILEN];
+char *wdir;
+static char cwd[NFILEN];
/*
* Initialize anything the directory management routines need
*/
+VOID
dirinit()
{
+
if (!(wdir = getcwd(cwd, sizeof(cwd))))
panic("Can't get current directory!");
}
@@ -23,34 +25,38 @@ dirinit()
/*
* Change current working directory
*/
-/*ARGSUSED*/
+/* ARGSUSED */
+int
changedir(f, n)
+ int f, n;
{
- register int s;
- char bufc[NPAT];
+ int s;
+ char bufc[NPAT];
- if ((s=ereply("Change default directory: ", bufc, NPAT)) != TRUE)
- return(s);
+ if ((s = ereply("Change default directory: ", bufc, NPAT)) != TRUE)
+ return (s);
if (bufc[0] == '\0')
(VOID) strcpy(bufc, wdir);
if (chdir(bufc) == -1) {
ewprintf("Can't change dir to %s", bufc);
- return(FALSE);
+ return (FALSE);
} else {
if (!(wdir = getcwd(cwd, sizeof(cwd))))
panic("Can't get current directory!");
ewprintf("Current directory is now %s", wdir);
- return(TRUE);
+ return (TRUE);
}
}
/*
* Show current directory
*/
-/*ARGSUSED*/
+/* ARGSUSED */
+int
showcwdir(f, n)
{
+
ewprintf("Current directory: %s", wdir);
- return(TRUE);
+ return (TRUE);
}
#endif