home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
amiga
/
programm
/
utility
/
diff115.zoo
/
diff
/
fixupname.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-29
|
687b
|
33 lines
/* Fix unix pathname for AmigaDOS [":/" --> ":", "/blah" --> ":bla"] */
char *fixupname(name)
char *name;
{
register char *s, *d;
char * buffer;
char *xmalloc();
buffer = xmalloc(256);
s = name;
d = buffer;
if (*s == '/') { /* Fix leading slash (root dir) */
*d++ = ':';
s++;
}
else if (*s == '.') { /* fix leading "./" (Current dir) */
if (*(s+1L) == '/') { s++; s++; }; /* Leave it out */
};
/* And now try to handle volume names correctly */
while ((*s != '\0') && (*s != ':')) *d++ = *s++;
if (*s != '\0') {
*d++ = *s++; /* copy ":" */
if (*s == '/') s++;
while (*s != '\0') *d++ = *s++;
};
*d = '\0';
return(buffer);
}