BSD 4_3_Reno release
[unix-history] / usr / src / lib / libU77 / getcwd_.c
CommitLineData
dd052957 1/*
161423a6
RE
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
95f51977 6 * @(#)getcwd_.c 5.1 6/7/85
161423a6
RE
7 */
8
9/*
dd052957
DW
10 * Get pathname of current working directory.
11 *
12 * calling sequence:
13 * character*128 path
14 * ierr = getcwd(path)
15 * where:
16 * path will receive the pathname of the current working directory.
17 * ierr will be 0 if successful, a system error code otherwise.
18 */
19
05ec41e3
DW
20#include <sys/param.h>
21#ifndef MAXPATHLEN
22#define MAXPATHLEN 128
23#endif
24
dd052957 25extern int errno;
28a346e8 26char *getwd();
dd052957
DW
27
28long
29getcwd_(path, len)
30char *path;
431aa77e 31long len;
dd052957 32{
28a346e8 33 char *p;
05ec41e3 34 char pathname[MAXPATHLEN];
dd052957 35
28a346e8
DW
36 p = getwd(pathname);
37 b_char(pathname, path, len);
dd052957 38 if (p)
dd052957 39 return(0L);
28a346e8
DW
40 else
41 return((long)errno);
dd052957 42}