1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Further fix 'command -p' (re: c9ccee86)

This fixes 'command -p' for systems where getconf(1) lives
somewhere other than in /bin or /usr/bin, i.e. NixOS.

src/lib/libast/comp/conf.tab:
- To determine the default path value for AST 'getconf PATH' and
  'command -p', compile a small C program to get the correct local
  default path value (_CS_PATH) from the operating system so it
  gets hardcoded in the ksh binary. This eliminates the need to to
  invoke 'getconf PATH' to get this value, which fixes a catch-22
  problem on systems where getconf(1) exists somewhere other than
  /bin or /usr/bin.
This commit is contained in:
Martijn Dekker 2020-08-03 08:31:23 +01:00
parent cba895ed5f
commit 5a7bd2c196

View file

@ -368,7 +368,23 @@ PAGESIZE POSIX SC 1 MU PAGESIZE PAGE_SIZE 4096 cc{
}
PAGE_SIZE POSIX SC 1 MU _AST_PAGESIZE
PASS_MAX SVID SC 1 CDLMU 8
PATH POSIX CS 1 CMU "/bin:/usr/bin"
PATH POSIX CS 1 MU cc{
#include <stdio.h>
#include <unistd.h>
int main()
{
size_t length = confstr(_CS_PATH, 0, 0);
if(!length)
printf("\\"/bin:/usr/bin\\"");
else
{
char path[length];
confstr(_CS_PATH, path, length);
printf("\\"%s\\"", path);
}
return 0;
}
}
PATH_MAX POSIX PC 1 CDLMUX MAXPATHLEN 1024
PBS POSIX SC 2 FUW
PBS_ACCOUNTING POSIX SC 2 FUW