sbase/util/agetcwd.c
Connor Lane Smith d7f9bda740 cc -Wextra
2011-06-21 05:05:37 +01:00

21 lines
362 B
C

/* 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;
long size;
if((size = pathconf(".", _PC_PATH_MAX)) == -1)
size = BUFSIZ;
if(!(buf = malloc(size)))
eprintf("malloc:");
if(!getcwd(buf, size))
eprintf("getcwd:");
return buf;
}