2008-12-13 21:06:47 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS CRT library
|
|
|
|
* LICENSE: See COPYING in the top level directory
|
|
|
|
* FILE: lib/sdk/crt/stdlib/makepath.c
|
|
|
|
* PURPOSE: Creates a path
|
|
|
|
* PROGRAMMERS: Wine team
|
|
|
|
* Copyright 1996,1998 Marcus Meissner
|
|
|
|
* Copyright 1996 Jukka Iivonen
|
|
|
|
* Copyright 1997,2000 Uwe Bonnes
|
|
|
|
* Copyright 2000 Jon Griffiths
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-03-14 20:24:57 +00:00
|
|
|
/* $Id$
|
|
|
|
*/
|
|
|
|
#include <precomp.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
void _makepath(char* path, const char* drive, const char* dir, const char* fname, const char* ext)
|
|
|
|
{
|
2008-12-13 21:06:47 +00:00
|
|
|
char *p = path;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2008-12-13 21:06:47 +00:00
|
|
|
if ( !path )
|
|
|
|
return;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2008-12-13 21:06:47 +00:00
|
|
|
if (drive && drive[0])
|
|
|
|
{
|
|
|
|
*p++ = drive[0];
|
|
|
|
*p++ = ':';
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|
2008-12-13 21:06:47 +00:00
|
|
|
if (dir && dir[0])
|
|
|
|
{
|
|
|
|
unsigned int len = strlen(dir);
|
|
|
|
memmove(p, dir, len);
|
|
|
|
p += len;
|
|
|
|
if (p[-1] != '/' && p[-1] != '\\')
|
|
|
|
*p++ = '\\';
|
|
|
|
}
|
|
|
|
if (fname && fname[0])
|
|
|
|
{
|
|
|
|
unsigned int len = strlen(fname);
|
|
|
|
memmove(p, fname, len);
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
if (ext && ext[0])
|
|
|
|
{
|
|
|
|
if (ext[0] != '.')
|
|
|
|
*p++ = '.';
|
|
|
|
strcpy(p, ext);
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|
2008-12-13 21:06:47 +00:00
|
|
|
else
|
|
|
|
*p = '\0';
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|