--- "Arkady V.Belousov" <[EMAIL PROTECTED]> escribió:
> Hi!
>
> 24-á×Ç-2006 12:48 [EMAIL PROTECTED] (Blair Campbell) wrote to
> [email protected]:
>
> BC> Maybe in other DOSes, the TRUENAME command in COMMAND.COM itself
> BC> removes the trailing '\'.
> >> DR> C:\>TRUENAME FDOS\
> >> DR> C:\FDOS\
> >> Don't know how you test under DR/PC DOS, but what FreeCOM
> shows under
> >> MS-DOS:
>
> Well, MS-command.com also doesn't strips trailing slash:
>
> C:\>truename c:
> C:\
> C:\>truename temp
> C:\TEMP
> C:\>truename temp\
> C:\TEMP\
>
>
I used the following program:
/*
** truname.c -- wrapper for the undocumented DOS function TRUENAME
**
** TRUENAME: interrupt 0x21 function 0x60
**
** Call with: ah = 60h
** es:di -> destination buffer
** ds:si -> source buffer
**
** Returns: carry bit set if there were problems
**
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dos.h>
char *Truename(char *dst, char *src)
{
union REGS rg;
struct SREGS rs;
if (!src || !*src || !dst)
return NULL;
while(src[0]==' ')src++;
/* Trim blanks */
while((src[strlen(src)-1]==' ')&&(strlen(src)>0))src[strlen(src-1)]=0;
rg.h.ah = 0x60;
rg.x.si = FP_OFF(src);
rg.x.di = FP_OFF(dst);
rs.ds = FP_SEG(src);
rs.es = FP_SEG(dst);
intdosx(&rg, &rg, &rs);
return (rg.x.cflag) ? NULL : dst;
}
int main(int argc, char *argv[])
{
char buf[128]=" ", *s;
int i;
if (3 > _osmajor)
{
puts("Only works with DOS 3+");
return -1;
}
if(argc > 1)
{
for(i = 1; i < argc; i++)
{
s = Truename((char *)buf,(char *)argv[i]);
printf("%s=%s\n",argv[i], s ? buf : "(null)");
}
}
else printf("Usage: TRUNAME [filename [filename...]]\n");
return 0;
}
... and, yes, if you use FreeCOM the trailing backslash appears even
under PC DOS.
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel