www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/03/13/03:30:04

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT nohavenot DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is there some way to convert long filenames to short filenames?
Date: Fri, 13 Mar 2009 04:25:24 -0400
Organization: Aioe.org NNTP Server
Lines: 59
Message-ID: <gpd54j$kr5$1@aioe.org>
References: <275d23ac-69e7-4da0-88a0-a807a182477e AT a39g2000yqc DOT googlegroups DOT com>
NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.aioe.org
X-Complaints-To: abuse AT aioe DOT org
NNTP-Posting-Date: Fri, 13 Mar 2009 08:22:43 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933
X-Notice: Filtered by postfilter v. 0.7.7
X-Newsreader: Microsoft Outlook Express 6.00.2800.1933
Cancel-Lock: sha1:fvlDJRBZFllFSrUHBw92n+LHNO8=
X-Priority: 3
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"dos-man 64" <ChairShot AT mail DOT com> wrote in message
news:275d23ac-69e7-4da0-88a0-a807a182477e AT a39g2000yqc DOT googlegroups DOT com...
> At any rate, this version of the program seems just as clueless about
> long filenames as my old borland executable.

DJGPP supports longfilenames (LFNs) but *only* if the environment you're
using supports the LFN API.  LFNs aren't available by default in DOS because
the LFN API was created for Windows, not DOS.  But, there are some ways to
get LFN support in DOS.  For nearly all real mode16-bit DOSes, you'll need
to install an LFN driver TSR.  The best one is Henrik Haftmann's DOSLFN.  I
use version 0.32o - the last by Haftmann.  Jason Hood also has some updated
versions of DOSLFN.  However, it seems that Jason didn't list his changes.
So, I'm not clear on what changes he made...  If you're running in a Windows
dosbox, you'll have LFN support since it accesses the Windows LFN API.  It's
also possible you may have a DOS with the LFN API such as the experimental
versions of OpenDOS/DR-DOS.  The last time I used FreeDOS it didn't have LFN
API.  It might have it today.  You'll have to check.  There are also
standalone DOS utilities with LFN support that don't require an LFN driver,
such as LFN tools by Ortwin "Odi" Glueck.  His lcopy and lren are very
useful.  His code is GPL'd for an obsolete version of MSVC.  (Hint for DJGPP
developers?)  There are also drivers for other versions of Windows such as
NT.

Jason Hood's updates of DOSLFN, also with a link to Haftmann's pages:
http://www.geocities.com/jadoxa/doslfn/index.html

So, the questions are:
1) What environment are you using: real mode 16-bit DOS without LFN, OpenDOS
with LFN, or a Windows dosbox with LFN?  I.e., does it support LFN's?
2) How are you attempting to use LFN's in your program?  Are you using
DJGPP's functions?  Or, are you calling the LFN API directly?

Many of the DJGPP file functions, e.g., open, rename, exec, stat, call a
DJGPP's _truename() which is a specialized wrapper around the LFN API call
that converts between LFNs and SFNs.  So, if the environment you're using
has LFN support, LFN's should be available as DJ stated.  Why DJ doesn't
ever clarify that the environment also *requires* LFN support to use DJGPP's
LFN support is beyond me.  This issue has come up numerous times...  50% of
an answer...

FYI, I don't usually use the LFN functionality of DJGPP.  What I typically
do is use SFNs only.  The reason is because I need LFN's to work with the
OpenWatcom C compiler too which doesn't have LFN support or it only had SFN
support when I started using it...  It might have LFNs in the current
version.  If I need to display an LFN, I convert from SFN to LFN calling the
LFN API directly.  If I'm passed an LFN, I convert from LFN to SFN calling
the LFN API directly and then use the SFN.  To obtain or convert between
SFNs and LFNs, you need only two of the LFN API's calls - except for
renaming an LFN.  I use __dpmi_int() to call the 0x71a0 and 0x7160 LFN
functions to determine: 1) if LFN's are available and 2) to obtain the LFN,
SFN, or fullpathname from an LFN or SFN.  This works with both MS-DOS v7.10
and Win98SE dosbox, DJGPP and OpenWatcom.  Once these two functions are
written, it's "cut-n-paste".


Rod Pemberton



- Raw text -


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