Remove apathmax() and implicitly agetcwd()
pathconf() is just an insane interface to use. All sane operating- systems set sane values for PATH_MAX. Due to the by-runtime-nature of pathconf(), it actually weakens the programs depending on its values. Given over 3 years it has still not been possible to implement a sane and easy to use apathmax()-utility-function, and after discussing this on IRC, we'll dump this garbage. We are careful enough not to overflow PATH_MAX and even if, any user is able to set another limit in config.mk if he so desires.
This commit is contained in:
6
pwd.c
6
pwd.c
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
@@ -29,7 +30,7 @@ usage(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *cwd;
|
||||
char cwd[PATH_MAX];
|
||||
char mode = 'L';
|
||||
|
||||
ARGBEGIN {
|
||||
@@ -41,7 +42,8 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
} ARGEND;
|
||||
|
||||
cwd = agetcwd();
|
||||
if (!getcwd(cwd, sizeof(cwd)))
|
||||
eprintf("getcwd:");
|
||||
puts((mode == 'L') ? getpwd(cwd) : cwd);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user