/svnlschk/Makefile |
---|
0,0 → 1,11 |
# |
# svnlschk makefile |
# |
CC = gcc |
CFLAGS = -std=gnu89 -Wall -Wextra -pedantic -Werror -Wstrict-prototypes -O3 -s |
all: svnlschk |
svnlschk: svnlschk.c |
$(CC) svnlschk.c -o svnlschk $(CFLAGS) |
/svnlschk/svnlschk.c |
---|
0,0 → 1,160 |
/* |
* svnlschk - Svarog's NLS checker |
* Copyright (C) 2016 Mateusz Viste |
* |
* analyzes a Svarog386 package and outputs a single integer number: |
* -1 error (returns a non-zero errorlevel, too) |
* 0 no NLS data |
* x any positive number = number of strings for given language |
* |
* usage: svnlschk pkg.zip lang filetype |
* |
* note: this program relies on the availability of info-zip's UNZIP. |
*/ |
#include <stdio.h> |
#include <stdlib.h> /* system() */ |
#include <string.h> |
#include <libgen.h> /* basename() */ |
/* trims the extension part of a filename */ |
static void trimext(char *s) { |
char *lastdot = NULL; |
/* find last dot, if any */ |
for (;*s != 0; s++) if (*s == '.') lastdot = s; |
/* trim last dot, if any */ |
if (lastdot != NULL) *lastdot = 0; |
} |
/* trim trailing and white spaces */ |
static void trim(char *str) { |
int x, y, firstchar = -1, lastchar = -1; |
/* trim out the UTF-8 BOM, if present */ |
if (((unsigned char)str[0] == 0xEF) && ((unsigned char)str[1] == 0xBB) && ((unsigned char)str[2] == 0xBF)) { |
memmove(str, str + 3, strlen(str + 3) + 1); |
} |
/* */ |
for (x = 0; str[x] != 0; x++) { |
switch (str[x]) { |
case ' ': |
case '\t': |
case '\n': |
case '\r': |
break; |
default: |
if (firstchar < 0) firstchar = x; |
lastchar = x; |
break; |
} |
} |
str[lastchar + 1] = 0; /* right trim */ |
if (firstchar > 0) { /* left trim (shift to the left ) */ |
y = 0; |
for (x = firstchar; str[x] != 0; x++) str[y++] = str[x]; |
str[y] = 0; |
} |
} |
/* count the number of strings in a CATS-style nls file */ |
static long countnlsstrings(char *file, int filetype) { |
/* filetype 0 = NLS file ; 1 = COMMAND-style LNG file */ |
long res = 0; |
int stringongoing = 0; |
char line[1024]; |
while (*file != 0) { |
int i = 0; |
for (;; file++) { |
if (*file == '\r') continue; |
if (*file == '\n') { |
line[i] = 0; |
file++; |
break; |
} |
if (*file == 0) { |
line[i] = 0; |
break; |
} |
line[i] = *file; |
if (i < 1023) i++; |
} |
trim(line); |
/* skip empty lines and comments */ |
if ((line[0] == 0) || (line[0] == '#')) continue; |
/* */ |
if (filetype == 0) { |
res++; |
} else { |
if ((line[0] == ':') && (stringongoing == 0)) stringongoing = 1; |
if ((line[0] == '.') && (stringongoing != 0)) { |
res++; |
stringongoing = 0; |
} |
} |
} |
return(res); |
} |
int main(int argc, char **argv) { |
char buff[512]; |
char *lang; |
char *pkgfile; |
char pkgshortname[64]; |
char *file; |
long filelen; |
long result; |
int filetype; |
int popenres; |
#define FILEALLOC 1024*1024 |
FILE *fd; |
/* read arg list */ |
if ((argc != 4) || (argv[1][0] == '-') || (atoi(argv[3]) > 1) || (atoi(argv[3]) < 0)) { |
printf("-1\n"); |
fprintf(stderr, "svnlschk - Svarog's NLS checker\n" |
"usage: svnlschk pkg.zip lang filetype\n" |
"\n" |
"where filetype is:\n" |
" 0 = standard CATS-like NLS file\n" |
" 1 = FreeCOM-style LNG file\n"); |
return(1); |
} |
pkgfile = argv[1]; |
lang = argv[2]; |
filetype = atoi(argv[3]); |
strcpy(buff, pkgfile); |
snprintf(pkgshortname, sizeof(pkgshortname), basename(buff)); |
trimext(pkgshortname); |
/* is this a valid zip archive? */ |
snprintf(buff, sizeof(buff), "unzip -qq -t %s", pkgfile); |
if (system(buff) != 0) { |
printf("-1\n"); |
fprintf(stderr, "ERROR: %s is not a valid ZIP archive!\n", pkgfile); |
return(1); |
} |
/* extract wanted file through popen() and read it into memory */ |
snprintf(buff, sizeof(buff), "unzip -pC %s nls/%s.%s", pkgfile, pkgshortname, lang); |
/* */ |
fd = popen(buff, "r"); |
if (fd == NULL) { |
printf("-1\n"); |
fprintf(stderr, "ERROR: popen() failed\n"); |
return(1); |
} |
file = malloc(FILEALLOC); |
if (file == NULL) { |
printf("-1\n"); |
fprintf(stderr, "ERROR: out of memory\n"); |
return(1); |
} |
filelen = fread(file, 1, FILEALLOC - 1, fd); |
file[filelen] = 0; /* make sure to NULL-terminate */ |
result = countnlsstrings(file, filetype); |
free(file); |
popenres = WEXITSTATUS(pclose(fd)); |
if (popenres != 0) { |
printf("0\n"); |
return(0); |
} |
printf("%ld\n", result); |
return(0); |
} |
/website/index-test.php |
---|
1,5 → 1,66 |
<p class="title">Svarog386 - a FreeDOS distribution for 386+ computers</p> |
<p class="copyr">brought to you by <a href="http://mateusz.viste.fr/" class="mateusz">Mateusz Viste</a></p> |
<div style="overflow: auto;"> |
<img src="svarog386.png" alt="logo" style="height: 10em; float: right; margin: 0 0 0.5em 0.5em;"> |
<p>Svarog386 is a free, multilingual DOS distribution based on FreeDOS. It's released in the form of a single bootable CD image (ISO) that contains the FreeDOS kernel, a command interpreter and a variety of third-party packages.<br> |
Svarog386 is a "rolling release", meaning that it doesn't follow the concept of "versions". Svarog386 can be kept up-to-date either via online <a href="?p=tech&art=onlinerepos">update repositories</a> or by using the latest ISO image as your local package repository.</p> |
<p>Svarog386 is <b>not</b> designed for strict 8086 compatibility. Many parts of it might require a 386-class CPU. If you look for a simple 8086 FreeDOS distribution, take a look at <a href="http://svarog86.sourceforge.net">Svarog86</a>.</p> |
<p>Need to get in touch? Wish to contribute some packages, translate Svarog386 to your language, or otherwise contribute? Feel free to drop a line or two to the usenet group <b><a href="?p=tech&art=support">alt.os.free-dos</a></b>. |
</div> |
<?php |
// find the latest 'full' ISO available |
$files = glob("svarog386-full-*.iso", GLOB_NOSORT); |
$files = array_combine($files, array_map("filemtime", $files)); |
arsort($files); |
$latest_iso_full = key($files); |
// compute file size and date of the 'full' ISO |
$fsize_full = filesize($latest_iso_full) >> 20; |
$ftime_full = date("d M Y", $files[$latest_iso_full]); |
echo "<p>this is a test page</p>\n"; |
// find the latest 'nosrc' ISO available |
$files = glob("svarog386-nosrc-*.iso", GLOB_NOSORT); |
$files = array_combine($files, array_map("filemtime", $files)); |
arsort($files); |
$latest_iso_nosrc = key($files); |
// compute file size and date of the 'nosrc' ISO |
$fsize_nosrc = filesize($latest_iso_nosrc) >> 20; |
$ftime_nosrc = date("d M Y", $files[$latest_iso_nosrc]); |
// find the latest 'micro' ISO available |
$files = glob("svarog386-micro-*.iso", GLOB_NOSORT); |
$files = array_combine($files, array_map("filemtime", $files)); |
arsort($files); |
$latest_iso_micro = key($files); |
// compute file size and date of the 'micro' ISO |
$fsize_micro = filesize($latest_iso_micro) >> 20; |
$ftime_micro = date("d M Y", $files[$latest_iso_micro]); |
//echo " <p style=\"margin: 1.2em auto 0 auto; font-size: 1.2em; text-align: center; font-weight: bold;\">Download the latest Svarog386 ISO</p>\n"; |
echo " <div style=\"width: 45%; float: left; margin: 1.2em 5% 0 0;\">\n"; |
echo " <p style=\"text-align: center; font-weight: bold;\"><a href=\"/{$latest_iso_nosrc}\">Download Svarog386</a></p>\n"; |
echo " <p style=\"margin: 0 auto 1.4em auto; font-size: 1em; text-align: center; color: #333;\">({$fsize_nosrc}M, last update: {$ftime_nosrc}, <a href=\"/{$latest_iso_nosrc}.md5\" style=\"color: inherit;\">MD5</a>)</p>\n"; |
echo " </div>\n"; |
echo " <div style=\"width: 45%; float: right; margin: 1.2em 0 0 5%;\">\n"; |
echo " <p style=\"text-align: center; font-weight: bold;\"><a href=\"/{$latest_iso_full}\">Download Svarog386 (+sources)</a></p>\n"; |
echo " <p style=\"margin: 0 auto 1.4em auto; font-size: 1em; text-align: center; color: #333;\">({$fsize_full}M, last update: {$ftime_full}, <a href=\"/{$latest_iso_full}.md5\" style=\"color: inherit;\">MD5</a>)</p>\n"; |
echo " </div>\n"; |
echo " <div style=\"width: 100%; margin: 1.2em 0 0 0;\">\n"; |
echo " <p style=\"text-align: center; font-weight: bold;\"><a href=\"/{$latest_iso_micro}\">Download Svarog386 micro (core OS only)</a></p>\n"; |
echo " <p style=\"margin: 0 auto 1.4em auto; font-size: 1em; text-align: center; color: #333;\">({$fsize_micro}M, last update: {$ftime_micro}, <a href=\"/{$latest_iso_micro}.md5\" style=\"color: inherit;\">MD5</a>)</p>\n"; |
echo " </div>\n"; |
?> |
<p>You might want to know what it is exactly that you are about to download, before fetching the multi-megabytes ISO file. Feel free to browse the <a href="listing.txt">listing</a> of all the packages that come with Svarog386.</p> |
<p>If your computer is unable to boot from a CD, you can use Svarog386's <a href="boot.img">boot floppy image</a> to install Svarog386 (you still need to put Svarog386's CD in your drive).</p> |
<p>Wondering how Svarog386 is built? You might be interested in taking a look at the <a href="https://sourceforge.net/p/svarog386/code">project's SVN</a>, where all the build-related files are stored.</p> |