2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Timothy Manning <timothy@yaffs.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
17 void join_paths(char *path1,char *path2,char *new_path ){
19 //strcat(new_path,path1); /*since all functions have this then pull it out*/
20 if ( (path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]!='/') {
21 /*paths are compatiable. concatanate them. note -2 is because of \0*/
22 strcat(new_path,path1);
23 strcat(new_path,path2);
24 //char new_path[(sizeof(path1)/sizeof(char))+(sizeof(path2)/sizeof(char))];
25 //strcpy(new_path,strcat(path1,path2));
28 else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]=='/') {
29 /*paths are compatiable. concatanate them*/
30 strcat(new_path,path1);
31 strcat(new_path,path2);
34 else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]!='/') {
35 /*need to add a "/". */
36 strcat(new_path,path1);
38 strcat(new_path,path2);
42 else if ((path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]=='/') {
43 /*need to remove a "/". */
44 /*yaffs does not mind the extra slash. */
45 strcat(new_path,path1);
46 strcat(new_path,path2);