Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 292 → Rev 293

/pkg/main.c
85,7 → 85,7
 
static int pkginst(const char *file, int flags, const char *dosdir, const struct customdirs *dirlist) {
char pkgname[9];
int t, lastpathdelim = -1, lastdot = -1;
int t, lastpathdelim = -1, lastdot = -1, res = 1;
struct ziplist *zipfileidx;
FILE *zipfilefd;
/* copy the filename into pkgname (without path elements and without extension) */
111,13 → 111,12
/* prepare the zip file and install it */
zipfileidx = pkginstall_preparepackage(pkgname, file, flags, &zipfilefd, dosdir, dirlist);
if (zipfileidx != NULL) {
t = pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd);
fclose(zipfilefd);
return(t);
res = pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd);
zip_freelist(&zipfileidx);
}
 
fclose(zipfilefd);
return(1);
return(res);
}
 
 
/pkg/pkginst.c
214,9 → 214,9
/* install a package that has been prepared already. returns 0 on success,
* or a negative value on error, or a positive value on warning */
int pkginstall_installpackage(const char *pkgname, const char *dosdir, const struct customdirs *dirlist, struct ziplist *ziplinkedlist, FILE *zipfd) {
char *buff;
char *fulldestfilename;
char packageslst[64];
char buff[256];
char fulldestfilename[256];
char packageslst[32];
char *shortfile;
long filesextractedsuccess = 0, filesextractedfailure = 0;
struct ziplist *curzipnode;
224,17 → 224,6
 
sprintf(packageslst, "packages\\%s.lst", pkgname); /* Prepare the packages/xxxx.lst filename string for later use */
 
buff = malloc(512);
fulldestfilename = malloc(1024);
if ((buff == NULL) || (fulldestfilename == NULL)) {
kitten_printf(2, 14, "Out of memory! (%s)", "fulldestfilename");
puts("");
zip_freelist(&ziplinkedlist);
free(buff);
free(fulldestfilename);
return(-1);
}
 
/* create the %DOSDIR%/packages directory, just in case it doesn't exist yet */
sprintf(buff, "%s\\packages\\", dosdir);
mkpath(buff);
245,9 → 234,6
if (lstfd == NULL) {
kitten_printf(3, 10, "ERROR: Could not create %s!", buff);
puts("");
zip_freelist(&ziplinkedlist);
free(buff);
free(fulldestfilename);
return(-2);
}
 
255,9 → 241,8
for (curzipnode = ziplinkedlist; curzipnode != NULL; curzipnode = curzipnode->nextfile) {
int unzip_result;
if ((curzipnode->flags & ZIP_FLAG_ISADIR) != 0) continue; /* skip directories */
if (strcasecmp(curzipnode->filename, packageslst) == 0) continue; /* skip silently the package.lst file, if found */
shortfile = computelocalpath(curzipnode->filename, buff, dosdir, dirlist); /* substitute paths to custom dirs */
/* log the filename to packages\pkg.lst (with original, unmapped drive) */
/* log the filename to packages\pkg.lst */
fprintf(lstfd, "%s%s\r\n", buff, shortfile);
/* create the path, just in case it doesn't exist yet */
mkpath(buff);
275,11 → 260,6
}
fclose(lstfd);
 
/* free the ziplist and close file descriptor */
zip_freelist(&ziplinkedlist);
free(buff);
free(fulldestfilename);
 
kitten_printf(3, 19, "Package %s installed: %ld files extracted, %ld errors.", pkgname, filesextractedsuccess, filesextractedfailure);
puts("");
return(filesextractedfailure);
/pkg/version.h
4,7 → 4,7
#ifndef COMMON_H_SENTINEL
#define COMMON_H_SENTINEL
 
#define PVER "20210204"
#define PVER "20210211"
#define PDATE "2012-2021"
 
#endif