delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/11/12:42:35

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting longfilename support..
Date: Mon, 10 Feb 1997 21:01:27 +0000
Organization: None
Distribution: world
Message-ID: <uW7oSBAny4$yEwNA@talula.demon.co.uk>
References: <ksk9ogc00x DOT fsf AT telelogic DOT se> <32ff64ab DOT 14004877 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 17
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot writes:
>>Is it possible, during runtime, to detect if long filenames is
>>supported (the LFN=y is set in the djgpp.env file)
>
> int lfn=(toupper(getenv("LFN")[0])=='Y');

Two problems with that. For one, it will crash if LFN isn't in the
environment (getenv will return NULL, and we all know what happens when
you dereference the NULL pointer :-) More seriously, it only tells you
the environment settings, not whether the OS is actually supporting
them. Instead, you should include <fcntl.h> and check the value of the
_USE_LFN() macro.

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019