2 Copyright © 2010-2011, The AROS Development Team. All rights reserved.
5 Desc: Filesystem control routines
15 #include "bootstrap.h"
16 #include "filesystem.h"
18 char *namepart(char *name
)
23 while((name
[-1] != ':') && (name
[-1] != '\\') && (name
[-1] != '/'))
29 static char *GetAbsName(const char *filename
)
31 int l1
= strlen(bootstrapdir
);
32 char *absname
= malloc(l1
+ strlen(filename
) + 1);
36 memcpy(absname
, bootstrapdir
, l1
);
37 strcpy(&absname
[l1
], filename
);
43 FILE *file_open(const char *filename
, const char *mode
)
48 if (*filename
== '\\')
50 /* The path is given as absolute, just use it */
51 return fopen(filename
, mode
);
54 absname
= GetAbsName(filename
);
58 res
= fopen(absname
, mode
);
64 int SetLog(const char *filename
)
68 if (*filename
!= '\\')
70 char *absname
= GetAbsName(filename
);
73 return GetLastError();
75 res
= freopen(absname
, "a", stderr
);
80 /* The path is given as absolute, just use it */
81 res
= freopen(filename
, "a", stderr
);
83 return res
? 0 : GetLastError();