//pkg/trunk/helpers.c |
---|
40,6 → 40,13 |
} |
/* converts a string to all lowercase */ |
void strtolower(char *mystring) { |
int x; |
for (x = 0; mystring[x] != 0; x++) mystring[x] = tolower(mystring[x]); |
} |
/* Find the first occurrence of find in s, ignore case. */ |
char *fdnpkg_strcasestr(const char *s, const char *find) { |
char c, sc; |
//pkg/trunk/helpers.h |
---|
1,6 → 1,6 |
/* |
* This file is part of pkginst |
* Copyright (C) 2012-2022 Mateusz Viste |
* Copyright (C) 2012-2021 Mateusz Viste |
* |
* It contains a few helper function... |
*/ |
9,6 → 9,7 |
#define helpers_sentinel |
#include "loadconf.h" /* required for the customdirs struct */ |
void slash2backslash(char *str); |
void strtolower(char *mystring); |
char *fdnpkg_strcasestr(const char *s, const char *find); |
void mkpath(char *dirs); |
char *computelocalpath(char *longfilename, char *respath, const char *dosdir, const struct customdirs *dirlist); |
//pkg/trunk/main.c |
---|
114,7 → 114,7 |
} |
memcpy(pkgname, file + lastpathdelim + 1, t); |
pkgname[t] = 0; |
strlwr(pkgname); /* package name must be all lower-case for further file matching in the zip file */ |
strtolower(pkgname); /* package name must be all lower-case for further file matching in the zip file */ |
/* prepare the zip file and install it */ |
zipfileidx = pkginstall_preparepackage(pkgname, file, flags, &zipfilefd, dosdir, dirlist); |
if (zipfileidx != NULL) { |
//pkg/trunk/pkginst.c |
---|
10,7 → 10,7 |
#include <unistd.h> /* read() */ |
#include <sys/types.h> /* struct utimbuf */ |
#include "helpers.h" /* slash2backslash() */ |
#include "helpers.h" /* slash2backslash(), strtolower() */ |
#include "fileexst.h" |
#include "kprintf.h" |
#include "libunzip.h" /* zip_listfiles()... */ |
134,7 → 134,7 |
for (curzipnode = ziplinkedlist; curzipnode != NULL;) { |
/* change all slashes to backslashes, and switch into all-lowercase */ |
slash2backslash(curzipnode->filename); |
strlwr(curzipnode->filename); |
strtolower(curzipnode->filename); |
/* remove 'directory' ZIP entries to avoid false alerts about directory already existing */ |
if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) { |
curzipnode->filename[0] = 0; /* mark it "empty", will be removed in a short moment */ |