a3ffa97f40
This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
58 lines
931 B
C
58 lines
931 B
C
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#ifdef __BAREBOX__
|
|
#include <fs.h>
|
|
#include <malloc.h>
|
|
#include <common.h>
|
|
#endif
|
|
|
|
int make_directory(const char *dir)
|
|
{
|
|
char *s = strdup(dir);
|
|
char *path = s;
|
|
char c;
|
|
|
|
do {
|
|
c = 0;
|
|
|
|
/* Bypass leading non-'/'s and then subsequent '/'s. */
|
|
while (*s) {
|
|
if (*s == '/') {
|
|
do {
|
|
++s;
|
|
} while (*s == '/');
|
|
c = *s; /* Save the current char */
|
|
*s = 0; /* and replace it with nul. */
|
|
break;
|
|
}
|
|
++s;
|
|
}
|
|
|
|
if (mkdir(path, 0777) < 0) {
|
|
|
|
/* If we failed for any other reason than the directory
|
|
* already exists, output a diagnostic and return -1.*/
|
|
#ifdef __BAREBOX__
|
|
if (errno != -EEXIST)
|
|
#else
|
|
if (errno != EEXIST)
|
|
#endif
|
|
break;
|
|
}
|
|
if (!c)
|
|
goto out;
|
|
|
|
/* Remove any inserted nul from the path (recursive mode). */
|
|
*s = c;
|
|
|
|
} while (1);
|
|
|
|
out:
|
|
free(path);
|
|
return errno;
|
|
}
|
|
#ifdef __BAREBOX__
|
|
EXPORT_SYMBOL(make_directory);
|
|
#endif
|