Subversion Repositories SvarDOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 711 → Rev 712

/pkgnet/trunk/Makefile
3,7 → 3,7
#
 
CFLAGS = -j -ml -0 -bt=dos -wx -we -d0 -ox -dNOLFN -i=watt32\inc
LIB = watt32\lib\wattcpwl.lib
LIB = watt32\lib\wattcpwl.lib svarlang.lib\svarlngl.lib
 
all: pkgnet.exe
 
10,15 → 10,28
release: pkgnet.exe .symbolic
mkdir bin
mkdir appinfo
mkdir nls
copy pkgnet.exe bin
copy pkgnet.lsm appinfo
zip -9krDX -m pkgnet.svp bin appinfo
copy pkgnet.lng nls
if exist pkgnet.svp del pkgnet.svp
zip -9krDX -m pkgnet.svp bin appinfo nls
rmdir bin
rmdir appinfo
zip -9krDX pkgnet.zip Makefile *.c *.h pkgnet.lsm watt32
rmdir nls
if exist pkgnet.zip del pkgnet.zip
zip -9krDX pkgnet.zip Makefile *.c *.h pkgnet.lsm watt32 svarlang.lib
 
pkgnet.exe: pkgnet.obj net.obj unchunk.obj lsm.obj helpers.obj trim.obj
wcl -lr -k4096 $(LIB) pkgnet.obj net.obj unchunk.obj lsm.obj helpers.obj trim.obj -fe=pkgnet.exe
cd nls
utf8tocp 437 en_utf8.txt > en.txt
utf8tocp maz pl_utf8.txt > pl.txt
..\svarlang.lib\tlumacz en pl
del ??.txt
move /y deflang.c ..\deflang.c
move /y out.lng ..\pkgnet.lng
cd ..
*wcl -lr -k4096 $(LIB) pkgnet.obj deflang.c net.obj unchunk.obj lsm.obj helpers.obj trim.obj -fe=pkgnet.exe
 
pkgnet.obj: pkgnet.c
*wcc $(CFLAGS) pkgnet.c
/pkgnet/trunk/nls/en_utf8.txt
0,0 → 1,48
#
# PKGNET TRANSLATION FILE
#
# LANG : EN
# AUTHOR: MATEUSZ VISTE
#
 
###############################################################################
# HELP SCREEN #
###############################################################################
 
1.0:pkgnet is the SvarDOS package downloader.
1.1:usage: pkgnet search <term>
1.2: pkgnet pull <package>
1.3: pkgnet pull <package>-<version>
1.4: pkgnet pullsrc <package>
1.4: pkgnet pullsrc <package>-<version>
1.6: pkgnet checkup
1.7:actions:
1.8:search - asks remote repository for the list of matching packages
1.9:pull - downloads package into current directory
1.10:checkup - lists updates available for your system
 
 
###############################################################################
# OPERATIONS #
###############################################################################
 
2.0:Downloaded %ld KiB into %s (BSUM: %04X)
 
 
###############################################################################
# ERROR MESSAGES #
###############################################################################
 
9.0:ERROR: variable %DOSDIR% is not set
9.1:ERROR: could not access the %DOSDIR%\\packages directory
9.2:ERROR: failed to connect to %s
9.3:ERROR: failed to send a HTTP query to the remote server
9.4:ERROR: failed to send POST data to remote server
9.5:ERROR: TCP communication error #%d
9.6:ERROR: failed to create file %s
9.7:ERROR: failed to write data to file %s after %ld bytes
9.8:ERROR: timeout while waiting for data
9.9:ERROR: out of memory
9.10:ERROR: file %s already exists
9.11:ERROR: network subsystem initialization failed
9.12:ERROR: DNS resolution failed
/pkgnet/trunk/nls/pl_utf8.txt
0,0 → 1,48
#
# PKGNET TRANSLATION FILE
#
# LANG : PL
# AUTHOR: MATEUSZ VISTE
#
 
###############################################################################
# HELP SCREEN #
###############################################################################
 
1.0:pkgnet, program do pobierania pakietów SvarDOS.
1.1:użycie: pkgnet search <wyrażenie>
1.2: pkgnet pull <pakiet>
1.3: pkgnet pull <pakiet>-<wersja>
1.4: pkgnet pullsrc <pakiet>
1.4: pkgnet pullsrc <pakiet>-<wersja>
1.6: pkgnet checkup
1.7:akcje:
1.8:search - pyta zdalne repozytorium o listę pakietów pasujących do wyrażenia
1.9:pull - pobiera dany pakiet do bieżącego katalogu
1.10:checkup - wyświetla dostępne aktualizacje dla twojego systemu
 
 
###############################################################################
# OPERATIONS #
###############################################################################
 
2.0:Pobrano %ld KiB do %s (BSUM: %04X)
 
 
###############################################################################
# ERROR MESSAGES #
###############################################################################
 
9.0:BŁĄD: zmienna %DOSDIR% nie jest ustawiona
9.1:BŁĄD: dostęp do katalogu %DOSDIR%\\packages nie powiódł się
9.2:BŁĄD: połączenie do %s nie powiodło się
9.3:BŁĄD: nie zdołano wysłać zapytania HTTP do zdalnego serwera
9.4:BŁĄD: nie zdołano wysłać danych POST do zdalnego serwera
9.5:BŁĄD: błąd komunikacji TCP #%d
9.6:BŁĄD: nie zdołano utworzyć pliku %s
9.7:BŁĄD: nie zdołano zapisać danych do pliku %s po %ld bajtach
9.8:BŁĄD: osiągnięto limit czasu oczekiwania na dane
9.9:BŁĄD: brak pamięci
9.10:BŁĄD: plik %s już istnieje
9.11:BŁĄD: inicjalizacja podsystemu sieciowego nie powiodła się
9.12:BŁĄD: rozwiązywanie nazwy DNS nie powiodło się
/pkgnet/trunk/pkgnet.c
23,7 → 23,7
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* http://svardos.osdn.io
* http://svardos.org
*/
 
#include <direct.h> /* opendir() and friends */
35,15 → 35,21
#include "net.h"
#include "unchunk.h"
 
#include "svarlang.lib\svarlang.h"
 
#include "../../pkg/trunk/lsm.h"
 
 
#define PVER "20220214"
#define PVER "20220215"
#define PDATE "2021-2022"
 
#define HOSTADDR "svardos.org"
 
 
/* convenience define that outputs nls strings to screen (followed by CR/LF) */
#define putsnls(x,y) puts(svarlang_strid((x << 8) | y))
 
 
/* returns length of all http headers, or 0 if uncomplete yet */
static unsigned short detecthttpheadersend(const unsigned char *buff) {
char lastbyteislf = 0;
69,21 → 75,21
static void help(void) {
puts("pkgnet ver " PVER " -- Copyright (C) " PDATE " Mateusz Viste");
puts("");
puts("pkgnet is the SvarDOS package downloader.");
putsnls(1, 0); /* "pkgnet is the SvarDOS package downloader" */
puts("");
puts("usage: pkgnet search <term>");
puts(" pkgnet pull <package>");
puts(" pkgnet pull <package>-<version>");
puts(" pkgnet checkup");
putsnls(1, 1); /* "usage: pkgnet search <term>" */
putsnls(1, 2); /* " pkgnet pull <package>" */
putsnls(1, 3); /* " pkgnet pull <package>-<version>" */
putsnls(1, 6); /* " pkgnet checkup" */
puts("");
puts("actions:");
puts(" search - asks remote repository for the list of matching packages");
puts(" pull - downloads package into current directory");
puts(" checkup - lists updates available for your system");
putsnls(1, 7); /* "actions:" */
puts("");
putsnls(1, 8); /* "search - asks remote repository for the list of matching packages" */
putsnls(1, 9); /* "pull - downloads package into current directory" */
putsnls(1, 10); /* "checkup - lists updates available for your system" */
puts("");
printf("Watt32 kernel: %s", net_engine());
puts("");
puts("");
}
 
 
186,7 → 192,7
if (dosdir == NULL) {
dosdir = getenv("DOSDIR");
if ((dosdir == NULL) || (dosdir[0] == 0)) {
puts("ERROR: %DOSDIR% not set");
putsnls(9, 0); /* "ERROR: %DOSDIR% not set" */
return(0);
}
}
196,7 → 202,7
sprintf(buff, "%s\\packages", dosdir);
dp = opendir(buff);
if (dp == NULL) {
puts("ERROR: Could not access %DOSDIR%\\packages directory");
putsnls(9, 1); /* "ERROR: Could not access %DOSDIR%\\packages directory" */
return(0);
}
}
246,7 → 252,8
 
sock = net_connect(ipaddr, 80);
if (sock == NULL) {
puts("ERROR: failed to connect to " HOSTADDR);
printf(svarlang_strid(0x0902), HOSTADDR); /* "ERROR: failed to connect to " HOSTADDR */
puts("");
goto SHITQUIT;
}
 
255,7 → 262,8
int connstate = net_isconnected(sock);
if (connstate > 0) break;
if (connstate < 0) {
puts("ERROR: connection error");
printf(svarlang_strid(0x0902), HOSTADDR); /* "ERROR: failed to connect to " HOSTADDR */
puts("");
goto SHITQUIT;
}
_asm int 28h; /* DOS idle */
269,7 → 277,7
}
 
if (net_send(sock, buffer, strlen((char *)buffer)) != (int)strlen((char *)buffer)) {
puts("ERROR: failed to send HTTP query to remote server");
putsnls(9, 3); /* "ERROR: failed to send a HTTP query to remote server" */
goto SHITQUIT;
}
 
286,7 → 294,7
hlen = sprintf(hbuf, "%X\r\n", blen);
}
if (net_send(sock, hbuf, hlen) != hlen) {
puts("ERROR: failed to send POST data to remote server");
putsnls(9, 4); /* "ERROR: failed to send POST data to remote server" */
goto SHITQUIT;
}
/* add trailing CR/LF to buffer as required by chunked mode */
293,7 → 301,7
buffer[blen++] = '\r';
buffer[blen++] = '\n';
if (net_send(sock, buffer, blen) != blen) {
puts("ERROR: failed to send POST data to remote server");
putsnls(9, 4); /* "ERROR: failed to send POST data to remote server" */
goto SHITQUIT;
}
} while (blen != 2);
304,7 → 312,7
 
/* transmission error? */
if (byteread < 0) {
printf("ERROR: communication error (%d)", byteread);
printf(svarlang_strid(0x0905), byteread); /* "ERROR: TCP communication error #%d" */
puts("");
goto SHITQUIT;
}
313,7 → 321,7
if ((httpcode >= 200) && (httpcode <= 299) && (*outfname != 0)) {
fd = fopen(outfname, "wb");
if (fd == NULL) {
printf("ERROR: failed to create file %s", outfname);
printf(svarlang_strid(0x0906), outfname); /* "ERROR: failed to create file %s" */
puts("");
goto SHITQUIT;
}
333,7 → 341,7
if (fd != NULL) {
int i;
if (fwrite(buffer, 1, byteread, fd) != byteread) {
printf("ERROR: failed to write data to file %s after %ld bytes", outfname, flen);
printf(svarlang_strid(0x0907), outfname, flen); /* "ERROR: failed to write data to file %s after %ld bytes" */
puts("");
break;
}
363,7 → 371,7
 
} else { /* check for timeout (byteread == 0) */
if (time(NULL) - lastactivity > 20) { /* TIMEOUT! */
puts("ERROR: Timeout while waiting for data");
putsnls(9, 8); /* "ERROR: Timeout while waiting for data" */
goto SHITQUIT;
}
/* waiting for packets - release a CPU cycle in the meantime */
404,10 → 412,12
char outfname[16];
} *mem;
 
svarlang_autoload("PKGNET");
 
/* allocate memory */
mem = malloc(sizeof(*mem));
if (mem == NULL) {
puts("ERROR: out of memory");
putsnls(9, 9); /* "ERROR: out of memory" */
return(1);
}
 
416,7 → 426,7
 
/* if outfname requested, make sure that file does not exist yet */
if ((mem->outfname[0] != 0) && (fexists(mem->outfname))) {
printf("ERROR: file %s already exists", mem->outfname);
printf(svarlang_strid(0x090A), mem->outfname); /* "ERROR: file %s already exists" */
puts("");
return(1);
}
423,7 → 433,7
 
/* init network stack */
if (net_init() != 0) {
puts("ERROR: Network subsystem initialization failed");
putsnls(9, 11); /* "ERROR: Network subsystem initialization failed" */
return(1);
}
 
430,7 → 440,7
puts(""); /* required because watt-32 likes to print out garbage sometimes ("configuring through DHCP...") */
 
if (net_dnsresolve(mem->ipaddr, HOSTADDR) != 0) {
puts("ERROR: DNS resolution failed");
putsnls(9, 12); /* "ERROR: DNS resolution failed" */
return(1);
}
 
439,7 → 449,7
 
if (mem->outfname[0] != 0) {
/* print bsum, size, filename */
printf("Downloaded %ld KiB into %s (BSUM: %04X)", flen >> 10, mem->outfname, bsum);
printf(svarlang_strid(0x0200), flen >> 10, mem->outfname, bsum); /* Downloaded %ld KiB into %s (BSUM: %04X) */
puts("");
}
 
/pkgnet/trunk/pkgnet.lsm
1,3 → 1,3
version: 20220214
description: pulls packages and updates from the internet SvarDOS repository
version: 20220215
description: pulls packages and updates from the online SvarDOS repository
license: MIT
/pkgnet/trunk/svarlang.lib
0,0 → 1,0
link ../../svarlang.lib
Property changes:
Added: svn:special
+*
\ No newline at end of property