Subversion Repositories SvarDOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 612 → Rev 613

/pkg/kitten/kitten.h
File deleted
/pkg/kitten/kitten.c
File deleted
/pkg/Makefile
5,7 → 5,7
 
CFLAGS = -0 -mc -os -wx -we -d0 -i=zlib
LDFLAGS = -lr -fe=pkg.exe
LIBS = zlib\zlib_c.lib
LIBS = zlib\zlib_c.lib svarlang.lib\svarlngc.lib
 
all: pkg.exe
 
13,25 → 13,32
mkdir appinfo
mkdir bin
mkdir nls
copy nls_utf8\pkg_en.txt nls\pkg.en
utf8tocp 850 nls_utf8\pkg_de.txt > nls\pkg.de
utf8tocp 850 nls_utf8\pkg_fr.txt > nls\pkg.fr
utf8tocp 850 nls_utf8\pkg_dk.txt > nls\pkg.dk
utf8tocp 852 nls_utf8\pkg_si.txt > nls\pkg.si
utf8tocp 857 nls_utf8\pkg_tr.txt > nls\pkg.tr
utf8tocp maz nls_utf8\pkg_pl.txt > nls\pkg.pl
copy pkg.lng nls
upx --8086 -9 pkg.exe -o bin\pkg.exe
copy pkg.lsm appinfo
zip -9moDkr pkg.zip appinfo bin nls
zip -9moDkrX pkg.zip appinfo bin nls
rmdir appinfo
rmdir bin
rmdir nls
 
pkg.exe: kitten.obj main.obj crc32.obj fileexst.obj helpers.obj inf.obj kprintf.obj libunzip.obj loadconf.obj lsm.obj pkginst.obj pkgrem.obj trim.obj showinst.obj unzip.obj
pkg.exe: main.obj crc32.obj fileexst.obj helpers.obj inf.obj kprintf.obj libunzip.obj loadconf.obj lsm.obj pkginst.obj pkgrem.obj trim.obj showinst.obj unzip.obj deflang.obj
wcl $(LDFLAGS) $(LIBS) *.obj
 
kitten.obj: kitten\kitten.c
wcc $(CFLAGS) kitten\kitten.c
deflang.obj: nls_utf8\pkg_en.txt
cd nls_utf8
copy pkg_en.txt en.txt
utf8tocp 850 pkg_de.txt > de.txt
utf8tocp 850 pkg_fr.txt > fr.txt
utf8tocp 850 pkg_dk.txt > dk.txt
utf8tocp 852 pkg_si.txt > si.txt
utf8tocp 857 pkg_tr.txt > tr.txt
utf8tocp maz pkg_pl.txt > pl.txt
..\svarlang.lib\tlumacz en de fr dk si tr pl
move out.lng ..\pkg.lng
move deflang.c ..
del ??.txt
cd ..
wcc $(CFLAGS) deflang.c
 
main.obj: main.c
wcc $(CFLAGS) main.c
/pkg/kprintf.c
2,23 → 2,19
* This file provides dummy functions that simulate kitten-enabled routines
* without actually having kitten.
*
* Copyright (C) 2015-2021 Mateusz Viste
* Copyright (C) 2015-2022 Mateusz Viste
*/
 
#include <stdio.h> /* vprintf() */
#include <stdarg.h> /* va_list, va_start()... */
 
#include "kitten/kitten.h"
#include "svarlang.lib\svarlang.h"
 
#include "kprintf.h"
 
void kitten_printf(short x, short y, char *fmt, ...) {
void kitten_printf(short x, short y, ...) {
va_list args;
va_start(args, fmt);
vprintf(kittengets(x, y, fmt), args);
va_start(args, y);
vprintf(svarlang_str(x, y), args);
va_end(args);
}
 
void kitten_puts(short x, short y, char *fmt) {
puts(kittengets(x, y, fmt));
}
/pkg/kprintf.h
6,7 → 6,6
#ifndef kprintf_sentinel
#define kprintf_sentinel
 
void kitten_printf(short x, short y, char *fmt, ...);
void kitten_puts(short x, short y, char *fmt);
void kitten_printf(short x, short y, ...);
 
#endif
/pkg/libunzip.c
88,7 → 88,7
/* create new entry and link it into the list */
newentry = calloc(sizeof(struct ziplist) + filenamelen, 1);
if (newentry == NULL) {
kitten_printf(2, 14, "Out of memory! (%s)", "libunzip");
kitten_printf(2, 14, "libunzip"); /* "Out of memory! (%s)" */
puts("");
zip_freelist(&reslist);
break;
149,7 → 149,7
/* no need to read the header we just have to skip it */
fseek(fd, 12, SEEK_CUR); /* the header is 3x4 bytes (CRC + compressed len + uncompressed len) */
} else { /* unknown sig */
kitten_printf(8, 1, "unknown zip sig: 0x%08lx", entrysig);
kitten_printf(8, 1, entrysig); /* "unknown zip sig: 0x%08lx" */
puts("");
zip_freelist(&reslist);
break;
/pkg/loadconf.c
29,7 → 29,7
for (; dirlist != NULL; dirlist = dirlist->next) {
for (curpos = dirlist->next; curpos != NULL; curpos = curpos->next) {
if (strcasecmp(curpos->name, dirlist->name) == 0) {
kitten_printf(7, 0, "ERROR: custom dir '%s' is listed twice!", curpos->name);
kitten_printf(7, 0, curpos->name); /* "ERROR: custom dir '%s' is listed twice!" */
puts("");
return(-1);
}
44,7 → 44,7
for (; dirlist != NULL; dirlist = dirlist->next) {
/* the location must be at least 3 characters long to be a valid absolute path (like 'c:\')*/
if (strlen(dirlist->location) < 3) {
kitten_printf(7, 15, "ERROR: custom dir '%s' is not a valid absolute path!", dirlist->name);
kitten_printf(7, 15, dirlist->name); /* "ERROR: custom dir '%s' is not a valid absolute path!" */
puts("");
return(-1);
}
52,7 → 52,7
if ((dirlist->location[1] != ':') ||
((dirlist->location[2] != '/') && (dirlist->location[2] != '\\')) ||
(((dirlist->location[0] < 'a') || (dirlist->location[0] > 'z')) && ((dirlist->location[0] < 'A') || (dirlist->location[0] > 'Z')))) {
kitten_printf(7, 15, "ERROR: custom dir '%s' is not a valid absolute path!", dirlist->name);
kitten_printf(7, 15, dirlist->name); /* "ERROR: custom dir '%s' is not a valid absolute path!" */
puts("");
return(-1);
}
63,7 → 63,7
(strcasecmp(dirlist->name, "help") == 0) ||
(strcasecmp(dirlist->name, "nls") == 0) ||
(strcasecmp(dirlist->name, "packages") == 0)) {
kitten_printf(7, 16, "ERROR: custom dir '%s' is a reserved name!", dirlist->name);
kitten_printf(7, 16, dirlist->name); /* "ERROR: custom dir '%s' is a reserved name!" */
puts("");
return(-1);
}
96,7 → 96,7
snprintf(token, sizeof(token), "%s\\cfg\\pkg.cfg", dosdir);
fd = fopen(token, "r");
if (fd == NULL) {
kitten_printf(7, 1, "ERROR: Could not open config file (%s)!", token);
kitten_printf(7, 1, token); /* "ERROR: Could not open config file (%s)!" */
puts("");
return(-1);
}
111,7 → 111,7
if ((token[0] == '#') || (token[0] == 0)) continue;
 
if ((value == NULL) || (value[0] == 0)) {
kitten_printf(7, 4, "Warning: token with empty value on line #%d", nline);
kitten_printf(7, 4, nline); /* "Warning: token with empty value on line #%d" */
puts("");
continue;
}
123,7 → 123,7
/* find nearer space */
for (i = 0; (value[i] != ' ') && (value[i] != 0); i++);
if (value[i] == 0) {
kitten_printf(7, 11, "Warning: Invalid 'DIR' directive found at line #%d", nline);
kitten_printf(7, 11, nline); /* "Warning: Invalid 'DIR' directive found at line #%d" */
puts("");
continue;
}
135,7 → 135,7
removeDoubleBackslashes(location);
if (location[strlen(location) - 1] != '\\') strcat(location, "\\"); /* make sure to end dirs with a backslash */
if (addnewdir(dirlist, value, location) != 0) {
kitten_printf(2, 14, "Out of memory! (%s)", "addnewdir");
kitten_printf(2, 14, "addnewdir"); /* "Out of memory! (%s)" */
puts("");
freeconf(dirlist);
fclose(fd);
142,7 → 142,7
return(-1);
}
} else { /* unknown token */
kitten_printf(7, 8, "Warning: Unknown token '%s' at line #%d", token, nline);
kitten_printf(7, 8, token, nline); /* "Warning: Unknown token '%s' at line #%d" */
puts("");
}
}
/pkg/main.c
3,7 → 3,7
*
* PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
*
* COPYRIGHT (C) 2016-2021 MATEUSZ VISTE, ALL RIGHTS RESERVED.
* COPYRIGHT (C) 2016-2022 MATEUSZ VISTE, ALL RIGHTS RESERVED.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
29,7 → 29,7
#include <stdlib.h> /* malloc() and friends */
#include <string.h> /* strcasecmp() */
 
#include "kitten/kitten.h"
#include "svarlang.lib/svarlang.h"
#include "kprintf.h"
#include "libunzip.h"
#include "pkginst.h"
53,17 → 53,17
static int showhelp(void) {
puts("PKG ver " PVER " Copyright (C) " PDATE " Mateusz Viste");
puts("");
kitten_puts(1, 0, "PKG is the package installer for SvarDOS.");
puts(svarlang_str(1, 0)); /* "PKG is the package installer for SvarDOS." */
puts("");
kitten_puts(1, 20, "Usage: pkg install package.zip");
kitten_puts(1, 21, " pkg update package.zip");
kitten_puts(1, 22, " pkg remove package");
kitten_puts(1, 23, " pkg listfiles package");
kitten_puts(1, 24, " pkg listlocal [filter]");
kitten_puts(1, 27, " pkg unzip file.zip");
puts(svarlang_str(1, 20)); /* "Usage: pkg install package.zip */
puts(svarlang_str(1, 21)); /* " pkg update package.zip" */
puts(svarlang_str(1, 22)); /* " pkg remove package" */
puts(svarlang_str(1, 23)); /* " pkg listfiles package" */
puts(svarlang_str(1, 24)); /* " pkg listlocal [filter]" */
puts(svarlang_str(1, 27)); /* " pkg unzip file.zip" */
puts("");
kitten_puts(1, 25, "PKG is published under the MIT license.");
kitten_puts(1, 26, "It is configured through %DOSDIR%\\CFG\\PKG.CFG");
puts(svarlang_str(1, 25)); /* "PKG is published under the MIT license." */
puts(svarlang_str(1, 26)); /* "It is configured through %DOSDIR%\CFG\PKG.CFG" */
return(1);
}
 
108,7 → 108,7
if (lastdot <= lastpathdelim) lastdot = t; /* a dot before last path delimiters is not an extension prefix */
t = lastdot - (lastpathdelim + 1);
if (t + 1 > sizeof(pkgname)) {
kitten_puts(3, 24, "ERROR: package name too long");
puts(svarlang_str(3, 24)); /* "ERROR: package name too long" */
return(1);
}
memcpy(pkgname, file + lastpathdelim + 1, t);
131,7 → 131,7
const char *dosdir;
struct customdirs *dirlist;
 
kittenopen("pkg"); /* NLS init */
svarlang_autoload("pkg"); /* NLS init */
 
action = parsearg(argc, argv);
if (action == ACTION_HELP) {
142,8 → 142,8
/* read the DOSDIR environment variable */
dosdir = getenv("DOSDIR");
if (dosdir == NULL) {
kitten_puts(2, 2, "%DOSDIR% not set! You should make it point to the FreeDOS main directory.");
kitten_puts(2, 3, "Example: SET DOSDIR=C:\\FDOS");
puts(svarlang_str(2, 2)); /* "%DOSDIR% not set! You should make it point to the FreeDOS main directory." */
puts(svarlang_str(2, 3)); /* "Example: SET DOSDIR=C:\FDOS" */
goto GAMEOVER;
}
 
173,7 → 173,6
}
 
GAMEOVER:
kittenclose(); /* NLS de-init */
if (res != 0) return(1);
return(0);
}
/pkg/nls_utf8/pkg_de.txt
3,7 → 3,6
# Time-stamp: "2017-03-09 22:50:34 joerg"
#
# Language..: German
# Codepage..: 850
# Translator: Jörg Jenderek
# Version...: 0.99.4
 
18,12 → 17,12
1.24: pkg listlocal [filter]
1.27: pkg unzip datei.zip
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
1.26:It is configured through %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% nicht gesetzt! Sie sollte auf das SvarDOS-Hauptverzeichnis verweisen.
2.3:Beispiel: SET DOSDIR=C:\\SVARDOS
2.3:Beispiel: SET DOSDIR=C:\SVARDOS
2.14:Kein Speicher mehr! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_dk.txt
2,7 → 2,6
# FDNPKG language file
#
# Language..: Danish
# Codepage..: 850 (858)
# Translator: Henrik Schick-Hansen
#
 
16,12 → 15,12
1.24: pkg listlocal [filter]
1.27: pkg unzip file.zip
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
1.26:It is configured through %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% ikke sat! DOSDIR skal pege på SvarDOS hoved biblioteket.
2.3:Eksempel: SET DOSDIR=C:\\SVARDOS
2.3:Eksempel: SET DOSDIR=C:\SVARDOS
2.14:Hukommelse opbrugt! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_en.txt
2,7 → 2,6
# PKG language file
#
# Language..: English
# Codepage..: 437
# Translator: Mateusz Viste
#
 
16,12 → 15,12
1.24: pkg listlocal [filter]
1.27: pkg unzip file.zip
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
1.26:It is configured through %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% not set! You should make it point to the SvarDOS main directory.
2.3:Example: SET DOSDIR=C:\\SVARDOS
2.3:Example: SET DOSDIR=C:\SVARDOS
2.14:Out of memory! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_fr.txt
2,7 → 2,6
# FDNPKG language file
#
# Language..: French
# Codepage..: 850
# Translator: anonymous
#
 
16,12 → 15,12
1.24: pkg listlocal [filter]
1.27: pkg unzip fichier.zip
1.25:PKG est publié sous license MIT.
1.26:Cet outil est configurable via %DOSDIR%\\CFG\\PKG.CFG
1.26:Cet outil est configurable via %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% non défini! Faites-le pointer vers le répertoire principal de SvarDOS.
2.3:Exemple : SET DOSDIR=C:\\SVARDOS
2.3:Exemple : SET DOSDIR=C:\SVARDOS
2.14:Mémoire insuffisante! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_pl.txt
2,7 → 2,6
# PKG language file
#
# Language..: Polish
# Codepage..: MAZOVIA
# Translator: Mateusz Viste
#
 
16,12 → 15,12
1.24: pkg listlocal [filtr]
1.27: pkg unzip plik.zip
1.25:PKG jest opublikowany na licencji MIT.
1.26:Konfiguracja znajduje się w pliku %DOSDIR%\\CFG\\PKG.CFG
1.26:Konfiguracja znajduje się w pliku %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% nie ustawione! Ustaw by wskazywało na katalog instalacji SvarDOS.
2.3:Przykład: SET DOSDIR=C:\\SVARDOS
2.3:Przykład: SET DOSDIR=C:\SVARDOS
2.14:Brak pamięci! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_si.txt
4,7 → 4,6
# Language..: Slovene
# Translator: Matej Horvat (http://matejhorvat.si/)
# Updated...: 2016-12-12
# Codepage..: 852
 
#### Help ####
 
16,12 → 15,12
1.24: pkg listlocal [filter]
1.27: pkg unzip file.zip
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
1.26:It is configured through %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.0:Spremenljivka TEMP ni nastavljena! Kaže naj na imenik, kamor se da pisati.
2.3:Primer: SET DOSDIR=C:\\SVARDOS
2.3:Primer: SET DOSDIR=C:\SVARDOS
2.14:Ni dovolj spomina! (%s)
 
#### Installing package ####
/pkg/nls_utf8/pkg_tr.txt
2,7 → 2,6
# FDNPKG language file
#
# Language..: Turkish
# Codepage..: 857
# Translator: anonymous
#
 
16,12 → 15,12
1.24: pkg listlocal [filter]
1.27: pkg unzip file.zip
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
1.26:It is configured through %DOSDIR%\CFG\PKG.CFG
 
### General stuff ####
 
2.2:%DOSDIR% ayarlanmamış! Onun SvarDOS ana dizinine işaret etmesi gerekir.
2.3:Örnek: SET DOSDIR=C:\\SVARDOS
2.3:Örnek: SET DOSDIR=C:\SVARDOS
2.14:Bellek yetersiz! (%s)
 
#### Installing package ####
/pkg/pkg.lsm
1,3 → 1,2
version: 20210212
description: SvarDOS package manager: installs, removes and updates packages
license: MIT
version: 20220203
description: SvarDOS package manager installs, removes and updates packages
/pkg/pkginst.c
1,6 → 1,6
/*
* This file is part of pkg (SvarDOS)
* Copyright (C) 2012-2021 Mateusz Viste
* Copyright (C) 2012-2022 Mateusz Viste
*/
 
#include <ctype.h> /* toupper() */
15,6 → 15,7
#include "kprintf.h"
#include "libunzip.h" /* zip_listfiles()... */
#include "showinst.h" /* pkg_loadflist() */
#include "svarlang.lib\svarlang.h"
 
#include "pkginst.h" /* include self for control */
 
75,7 → 76,7
/* checks that pkgname is NOT installed. return 0 on success, non-zero otherwise. */
static int validate_package_not_installed(const char *pkgname, const char *dosdir) {
if (is_package_installed(pkgname, dosdir) != 0) {
kitten_printf(3, 18, "Package %s is already installed! You might want to use the 'update' action.", pkgname);
kitten_printf(3, 18, pkgname); /* "Package %s is already installed! You might want to use the 'update' action." */
puts("");
return(-1);
}
115,12 → 116,12
 
*zipfd = fopen(zipfile, "rb");
if (*zipfd == NULL) {
kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
puts(svarlang_str(3, 8)); /* "ERROR: Invalid zip archive! Package not installed." */
goto RAII;
}
ziplinkedlist = zip_listfiles(*zipfd);
if (ziplinkedlist == NULL) {
kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
puts(svarlang_str(3, 8)); /* "ERROR: Invalid zip archive! Package not installed." */
goto RAII;
}
/* if updating, load the list of files belonging to the current package */
157,7 → 158,7
}
/* validate that the file has a valid filename (8+3, no shady chars...) */
if (validfilename(curzipnode->filename) != 0) {
kitten_puts(3, 23, "ERROR: Package contains an invalid filename:");
puts(svarlang_str(3, 23)); /* "ERROR: Package contains an invalid filename:" */
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
}
166,20 → 167,19
shortfile = computelocalpath(curzipnode->filename, fname, dosdir, dirlist);
strcat(fname, shortfile);
if ((findfileinlist(flist, fname) == NULL) && (fileexists(fname) != 0)) {
kitten_puts(3, 9, "ERROR: Package contains a file that already exists locally:");
puts(svarlang_str(3, 9)); /* "ERROR: Package contains a file that already exists locally:" */
printf(" %s\n", fname);
goto RAII_ERR;
}
/* abort if any entry is encrypted */
if ((curzipnode->flags & ZIP_FLAG_ENCRYPTED) != 0) {
kitten_printf(3, 20, "ERROR: Package contains an encrypted file:");
puts("");
puts(svarlang_str(3, 20)); /* "ERROR: Package contains an encrypted file:" */
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
}
/* abort if any file is compressed with an unsupported method */
if ((curzipnode->compmethod != ZIP_METH_STORE) && (curzipnode->compmethod != ZIP_METH_DEFLATE)) { /* unsupported compression method */
kitten_printf(8, 2, "ERROR: Package contains a file compressed with an unsupported method (%d):", curzipnode->compmethod);
kitten_printf(8, 2, curzipnode->compmethod); /* "ERROR: Package contains a file compressed with an unsupported method (%d):" */
puts("");
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
190,7 → 190,7
}
/* if appinfo file not found, this is not a real FreeDOS package */
if (appinfopresence != 1) {
kitten_printf(3, 12, "ERROR: Package do not contain the %s file! Not a valid FreeDOS package.", appinfofile);
kitten_printf(3, 12, appinfofile); /* "ERROR: Package do not contain the %s file! Not a valid SvarDOS package." */
puts("");
goto RAII_ERR;
}
232,7 → 232,7
sprintf(buff, "%s\\%s", dosdir, packageslst);
lstfd = fopen(buff, "wb"); /* opening it in binary mode, because I like to have control over line terminators (CR/LF) */
if (lstfd == NULL) {
kitten_printf(3, 10, "ERROR: Could not create %s!", buff);
kitten_printf(3, 10, buff); /* "ERROR: Could not create %s!" */
puts("");
return(-2);
}
250,7 → 250,7
/* Now unzip the file */
unzip_result = zip_unzip(zipfd, curzipnode, fulldestfilename);
if (unzip_result != 0) {
kitten_printf(8, 3, "ERROR: failed extracting '%s' to '%s'!", curzipnode->filename, fulldestfilename);
kitten_printf(8, 3, curzipnode->filename, fulldestfilename); /* "ERROR: failed extracting '%s' to '%s'!" */
printf(" [%d]\n", unzip_result);
filesextractedfailure += 1;
} else {
260,7 → 260,7
}
fclose(lstfd);
 
kitten_printf(3, 19, "Package %s installed: %ld files extracted, %ld errors.", pkgname, filesextractedsuccess, filesextractedfailure);
kitten_printf(3, 19, pkgname, filesextractedsuccess, filesextractedfailure); /* "Package %s installed: %ld files extracted, %ld errors." */
puts("");
return(filesextractedfailure);
}
/pkg/pkgrem.c
1,6 → 1,6
/*
* This file is part of the pkg (SvarDOS) project.
* Copyright (C) Mateusz Viste 2012-2021
* Copyright (C) Mateusz Viste 2012-2022
*/
 
#include <ctype.h> /* toupper() */
32,7 → 32,7
/* not in the list yet - add it */
res = malloc(sizeof(struct dirliststruct) + strlen(path));
if (res == NULL) { /* out of memory */
kitten_printf(4, 3, "Out of memory! Could not store directory %s!", path);
kitten_printf(4, 3, path); /* "Out of memory! Could not store directory %s!" */
puts("");
return(NULL);
}
74,7 → 74,7
sprintf(fpath, "%s\\packages\\%s.lst", dosdir, pkgname);
flist = fopen(fpath, "rb");
if (flist == NULL) {
kitten_printf(4, 0, "Package %s is not installed, so not removed.", pkgname);
kitten_printf(4, 0, pkgname); /* "Package %s is not installed, so not removed." */
puts("");
return(-1);
}
103,7 → 103,7
if (strcasecmp(buff, fpath) == 0) continue;
 
/* remove it */
kitten_printf(4, 4, "removing %s", buff);
kitten_printf(4, 4, buff); /* "removing %s" */
puts("");
unlink(buff);
}
136,7 → 136,7
 
/* remove the lst file */
unlink(fpath);
kitten_printf(4, 5, "Package %s has been removed.", pkgname);
kitten_printf(4, 5, pkgname); /* "Package %s has been removed." */
puts("");
return(0);
}
/pkg/showinst.c
1,6 → 1,6
/*
* This file is part of PKG (SvarDOS)
* Copyright (C) 2013-2021 Mateusz Viste
* Copyright (C) 2013-2022 Mateusz Viste
*/
 
#include <stdio.h>
14,6 → 14,7
#include "kprintf.h"
#include "libunzip.h" /* zip_freelist()... */
#include "lsm.h"
#include "svarlang.lib\svarlang.h"
 
#include "showinst.h" /* include self for control */
 
28,7 → 29,7
sprintf(buff, "%s\\packages", dosdir);
dp = opendir(buff);
if (dp == NULL) {
kitten_printf(9, 0, "ERROR: Could not access directory %s", buff);
kitten_printf(9, 0, buff); /* "ERROR: Could not access directory %s" */
puts("");
return(-1);
}
52,7 → 53,7
puts("");
matchfound = 1;
}
if (matchfound == 0) kitten_puts(5, 0, "No package matched the search.");
if (matchfound == 0) puts(svarlang_str(5, 0)); /* "No package matched the search." */
 
closedir(dp);
return(0);
78,7 → 79,7
sprintf(buff, "%s\\packages\\%s.lst", dosdir, pkgname);
fd = fopen(buff, "rb");
if (fd == NULL) {
kitten_printf(9, 1, "ERROR: Local package '%s' not found.", pkgname);
kitten_printf(9, 1, pkgname); /* "ERROR: Local package '%s' not found." */
puts("");
return(NULL);
}
90,7 → 91,7
/* add the new node to the result */
newnode = malloc(sizeof(struct flist_t) + strlen(buff));
if (newnode == NULL) {
kitten_printf(2, 14, "Out of memory! (%s)", "malloc failure");
kitten_printf(2, 14, "malloc failure"); /* "Out of memory! (%s)" */
continue;
}
newnode->next = res;
/pkg/svarlang.lib
0,0 → 1,0
link ../svarlang.lib
Property changes:
Added: svn:special
+*
\ No newline at end of property
/pkg/unzip.c
3,7 → 3,7
* returns 0 on success
*
* this file is part of pkg (SvarDOS)
* copyright (C) 2021 Mateusz Viste
* copyright (C) 2021-2022 Mateusz Viste
*/
 
#include <stdio.h>
12,6 → 12,7
#include "helpers.h"
#include "kprintf.h"
#include "libunzip.h"
#include "svarlang.lib\svarlang.h"
 
#include "unzip.h"
 
23,13 → 24,13
 
fd = fopen(zipfile, "rb");
if (fd == NULL) {
kitten_puts(10, 1, "ERROR: Failed to open the archive file");
puts(svarlang_str(10, 1)); /* "ERROR: Failed to open the archive file" */
return(1);
}
 
zlist = zip_listfiles(fd);
if (zlist == NULL) {
kitten_puts(10, 2, "ERROR: Invalid ZIP archive");
puts(svarlang_str(10, 2)); /* "ERROR: Invalid ZIP archive" */
fclose(fd);
return(-1);
}
47,7 → 48,7
if (znode->flags == ZIP_FLAG_ISADIR) goto OK;
/* file already exists? */
if (fileexists(znode->filename) != 0) {
kitten_puts(10, 3, "ERROR: File already exists");
puts(svarlang_str(10, 3)); /* "ERROR: File already exists" */
r = 1;
continue;
}
59,7 → 60,7
continue;
}
OK:
kitten_puts(10, 0, "OK");
puts(svarlang_str(10, 0)); /* "OK" */
}
 
zip_freelist(&zlist);
/pkg/version.h
4,7 → 4,7
#ifndef COMMON_H_SENTINEL
#define COMMON_H_SENTINEL
 
#define PVER "20210212"
#define PDATE "2012-2021"
#define PVER "20220203"
#define PDATE "2012-2022"
 
#endif