2011-05-25 23:01:20 -04:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
char *
|
|
|
|
agetcwd(void)
|
|
|
|
{
|
|
|
|
char *buf;
|
2011-06-21 00:05:37 -04:00
|
|
|
long size;
|
2011-05-25 23:01:20 -04:00
|
|
|
|
2011-06-21 00:05:37 -04:00
|
|
|
if((size = pathconf(".", _PC_PATH_MAX)) == -1)
|
2011-05-25 23:01:20 -04:00
|
|
|
size = BUFSIZ;
|
|
|
|
if(!(buf = malloc(size)))
|
|
|
|
eprintf("malloc:");
|
|
|
|
if(!getcwd(buf, size))
|
|
|
|
eprintf("getcwd:");
|
|
|
|
return buf;
|
|
|
|
}
|