Message-ID: <38BC0F27.25F413BF@teleline.es> Date: Tue, 29 Feb 2000 19:25:43 +0100 From: Mariano Alvarez =?iso-8859-1?Q?Fern=E1ndez?= X-Mailer: Mozilla 4.5 [es] (Win95; I) X-Accept-Language: es MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: short file names when using LFN Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello: Searching the Ralph Brown I found the interrupt to get the short file name when using LFN. Here is the routine. Really I d'ont know very much about the DJGPP internals, so I made the routine modifying the "_gen_short_filename" one. It seem to work. It return the whole path, so you must provide a short_fname variable for 128 bytes. Now, I only need the put routine :-) I'm playing with a crazy idea: do the copy, compare the short filenames if they don't match rename the copied file adding .00n do another copy and try again when the short filenames match, delete the bad copies. What do you think? It work by hand. M.Alvarez -- lfngsfn.c ---------------- /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ #include #include #include #include #include #include #include char * _lfn_get_short_fname (const char *long_fname, char *short_fname) { __dpmi_regs r; unsigned long tbuf = __tb; short_fname[0] = '\0'; if (_USE_LFN) { dosmemput (long_fname, strlen (long_fname) + 1, tbuf); r.x.ax = 0x7160; r.x.ds = tbuf >> 4; r.x.si = 0; r.x.es = r.x.ds; r.x.di = 260; r.h.cl = 0x01; r.h.ch = 0x00; __dpmi_int (0x21, &r); if ((r.x.flags & 1) == 0 && r.x.ax != 0x7100) { dosmemget (tbuf + 260, 128, short_fname); } } return short_fname; } #ifdef TEST #include int main (int argc, char *argv[]) { char sh[128]; if (argc > 1) printf ("Long: %s\nShort: %s\n", argv[1], _lfn_get_short_fname(argv[1], sh)); return 0; } #endif