Added pwd.

Attachment: pwd.1
Description: Binary data

/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "util.h"

int
main(void)
{
	char *buf, *p;
	long pathsize;

	pathsize = pathconf(".", _PC_PATH_MAX);
	if (pathsize < 0)
		pathsize = BUFSIZ;
	buf = malloc(pathsize);
	if (!buf)
		eprintf("malloc:");
	p = getcwd(buf, pathsize);
	if (!p)
		eprintf("getcwd:");
	printf("%s\n", p);
	return EXIT_SUCCESS;
}

Reply via email to