Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1680 → Rev 1681

/pkg/trunk/main.c
3,7 → 3,7
*
* PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
*
* COPYRIGHT (C) 2016-2023 MATEUSZ VISTE, ALL RIGHTS RESERVED.
* COPYRIGHT (C) 2016-2024 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"),
30,6 → 30,7
#include <string.h> /* strcasecmp() */
 
#include "svarlang.lib/svarlang.h"
#include "crc32.h"
#include "helpers.h"
#include "kprintf.h"
#include "libunzip.h"
47,6 → 48,7
ACTION_LISTFILES,
ACTION_LISTLOCAL,
ACTION_UNZIP,
ACTION_CRC32,
ACTION_HELP
};
 
62,6 → 64,7
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(svarlang_str(1, 28)); /* " pkg crc32 file" */
puts("");
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" */
83,6 → 86,8
return(ACTION_LISTLOCAL);
} else if ((argc == 3) && (strcasecmp(argv[1], "unzip") == 0)) {
return(ACTION_UNZIP);
} else if ((argc == 3) && (strcasecmp(argv[1], "crc32") == 0)) {
return(ACTION_CRC32);
} else {
return(ACTION_HELP);
}
130,6 → 135,37
}
 
 
/* pkg crc32 file */
static int crcfile(const char *fname) {
FILE *fd;
unsigned long crc;
unsigned char buff[512];
unsigned int len;
 
fd = fopen(fname, "rb");
if (fd == NULL) {
puts(svarlang_str(10, 1)); /* failed to open file */
return(1);
}
 
crc = crc32_init();
 
for (;;) {
len = fread(buff, 1, sizeof(buff), fd);
if (len == 0) break;
crc32_feed(&crc, buff, len);
}
fclose(fd);
 
crc32_finish(&crc);
 
printf("%08lX", crc);
puts("");
 
return(0);
}
 
 
int main(int argc, char **argv) {
int res = 1;
enum ACTIONTYPES action;
148,6 → 184,10
res = unzip(argv[2]);
goto GAMEOVER;
break;
case ACTION_CRC32:
res = crcfile(argv[2]);
goto GAMEOVER;
break;
}
 
/* read the DOSDIR environment variable */
/pkg/trunk/nls_utf8/pkg_br.txt
71,7 → 71,7
#### unzip ####
 
10.0:OK
10.1:ERRO: Falha ao abrir o arquivo compactado
10.1:ERRO: Falha ao abrir o arquivo
10.2:ERRO: Arquivo ZIP inválido
10.3:ERRO: Arquivo já existe
10.4:ERRO: Falha na descompactação (%d)
/pkg/trunk/nls_utf8/pkg_de.txt
71,7 → 71,7
#### unzip ####
 
10.0:OK
10.1:FEHLER: Öffnen der Archivdatei fehlgeschlagen
10.1:FEHLER: Öffnen die Datei fehlgeschlagen
10.2:FEHLER: Ungültiges ZIP-Archiv
10.3:FEHLER: Datei existiert bereits
10.4:FEHLER: unzip-Fehler (%d)
/pkg/trunk/nls_utf8/pkg_en.txt
3,7 → 3,7
#
# Language....: English
# Author......: Mateusz Viste
# Last updated: 16 Feb 2022
# Last updated: 31 Jan 2024
#
 
#### Help ####
15,6 → 15,7
1.23: pkg listfiles package
1.24: pkg listlocal [filter]
1.27: pkg unzip file.zip
1.28: pkg crc32 file
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
 
71,7 → 72,7
#### unzip ####
 
10.0:OK
10.1:ERROR: Failed to open the archive file
10.1:ERROR: Failed to open the file
10.2:ERROR: Invalid ZIP archive
10.3:ERROR: File already exists
10.4:ERROR: unzip failure (%d)
/pkg/trunk/nls_utf8/pkg_fr.txt
70,7 → 70,7
#### unzip ####
 
10.0:OK
10.1:ERREUR: Échec d'ouverture du fichier d'archive
10.1:ERREUR: Échec d'ouverture du fichier
10.2:ERREUR: Archive ZIP invalide
10.3:ERREUR: Fichier déjà existant
10.4:ERREUR: Échec de unzip (%d)
/pkg/trunk/nls_utf8/pkg_pl.txt
14,6 → 14,7
1.23: pkg listfiles pakiet
1.24: pkg listlocal [filtr]
1.27: pkg unzip plik.zip
1.28: pkg crc32 plik
1.25:PKG jest opublikowany na licencji MIT.
1.26:Konfiguracja znajduje się w pliku %DOSDIR%\\CFG\\PKG.CFG
 
70,7 → 71,7
#### unzip ####
 
10.0:OK
10.1:BŁĄD: Otwarcie pliku archiwum nie powiodło się
10.1:BŁĄD: Otwarcie pliku nie powiodło się
10.2:BŁĄD: Nieprawidłowe archiwum ZIP
10.3:BŁĄD: Plik już istnieje
10.4:BŁĄD: błąd unzip (%d)