| Deutsch English Français Italiano |
|
<lrqvnoF55oU2@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor <vallor@cultnix.org>
Newsgroups: comp.os.linux.advocacy
Subject: Fine, let's see you using pathconf(3) on Windows (was: Re: Then
there's PATH_MAX)
Date: 10 Dec 2024 13:58:17 GMT
Lines: 80
Message-ID: <lrqvnoF55oU2@mid.individual.net>
References: <lrnft4Fd071U5@mid.individual.net>
<180fd2f32d5884e5$6049$1734$802601b3@news.usenetexpress.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net pmqrcSYc+7KYptVx4tMEOA2X3blKNUb7B2Ae4sIUaJCCeY6qdO
Cancel-Lock: sha1:BQbZWcYY0MY0BoGchpPkUlEaXRk= sha256:y1fefgioPghB0BUsLpup5fQdWMXgDoHWhaZBT6N+/iU=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.161 (Hmm2; be402cc9; Linux-6.12.4)
Bytes: 2921
On Tue, 10 Dec 2024 13:12:03 +0000, Farley Flud <fsquared@fsquared.linux>
wrote in <180fd2f32d5884e5$6049$1734$802601b3@news.usenetexpress.com>:
> On Mon, 09 Dec 2024 06:09:40 +0000, vallor wrote:
>
>
>> #include <stdio.h> #include <limits.h>
>>
>> #ifdef __linux__ #include <linux/limits.h>
>> #endif
>>
>> int main (void)
>> {
>>
>> printf("%d\n",PATH_MAX);
>>
>> return 0;
>> }
>>
>>
> This is bullshit.
>
> PATH_MAX is filesystem dependent and since GNU/Linux, unlike that pile
> of garbage Microslop, supports many, many different filesystems the
> PATH_MAX macro is unreliable and may be undefined on some machines.
>
> The best and only way to determine file name/path parameters is to use
> "pathconf" of "fpathconf:"
>
> https://pubs.opengroup.org/onlinepubs/9799919799/
>
> From the link:
>
> "The pathconf() function was proposed immediately after the sysconf()
> function when it was realized that some configurable values may differ
> across file system, directory, or device boundaries."
Of course, "Flud" (after morphing -- AGAIN) couldn't be
bothered to provide a program that builds on both Linux and Windows
to demonstrate.
(I doubt Windows has pathconf(), but would love to be proved wrong. I
downloaded the tcc winapi headers, and I don't see it in there...)
- - cut here %<- - -
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char * argv[], char * envp[])
{
int result = 0;
char * path;
if(argv[1])
{
path = argv[1];
}
else
{
path = "/";
}
errno = 0;
result = pathconf(path,_PC_PATH_MAX);
if(result == -1)
{
perror("pathconf() returned -1:");
return 1;
}
printf("%d\n",result);
return 0;
}
- - cut here %<- - -
--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.12.4 Release: Mint 21.3 Mem: 258G
"Honey, PLEASE don't pick up the PH$@#*&$^(#@&$^%(*NO CARRIER"