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_cd.c,v 8.3 1993/12/02 10:47:00 bostic Exp $ (Berkeley) $Date: 1993/12/02 10:47:00 $";
12 #include <sys/param.h>
23 * ex_cd -- :cd[!] [directory]
32 char *dir
, buf
[MAXPATHLEN
];
36 if ((dir
= getenv("HOME")) == NULL
) {
38 "Environment variable HOME not set.");
43 dir
= cmdp
->argv
[0]->bp
;
50 msgq(sp
, M_SYSERR
, dir
);
53 if (getcwd(buf
, sizeof(buf
)) != NULL
)
54 msgq(sp
, M_INFO
, "New directory: %s", buf
);