ReactOS 0.4.15-dev-8145-ga541a46
makepath.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS CRT library
3 * LICENSE: See COPYING in the top level directory
4 * FILE: lib/sdk/crt/stdlib/makepath.c
5 * PURPOSE: Creates a path
6 * PROGRAMMERS: Wine team
7 * Copyright 1996,1998 Marcus Meissner
8 * Copyright 1996 Jukka Iivonen
9 * Copyright 1997,2000 Uwe Bonnes
10 * Copyright 2000 Jon Griffiths
11 *
12 */
13
14#include <precomp.h>
15#include <stdlib.h>
16#include <string.h>
17
18/*
19 * @implemented
20 */
21void _makepath(char* path, const char* drive, const char* dir, const char* fname, const char* ext)
22{
23 char *p = path;
24
25 if ( !path )
26 return;
27
28 if (drive && drive[0])
29 {
30 *p++ = drive[0];
31 *p++ = ':';
32 }
33 if (dir && dir[0])
34 {
35 size_t len = strlen(dir);
36 memmove(p, dir, len);
37 p += len;
38 if (p[-1] != '/' && p[-1] != '\\')
39 *p++ = '\\';
40 }
41 if (fname && fname[0])
42 {
43 size_t len = strlen(fname);
44 memmove(p, fname, len);
45 p += len;
46 }
47 if (ext && ext[0])
48 {
49 if (ext[0] != '.')
50 *p++ = '.';
51 strcpy(p, ext);
52 }
53 else
54 *p = '\0';
55}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int dir
Definition: maze.c:112
static const WCHAR *const ext[]
Definition: module.c:53
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
void _makepath(char *path, const char *drive, const char *dir, const char *fname, const char *ext)
Definition: makepath.c:21
#define memmove(s1, s2, n)
Definition: mkisofs.h:881