Line 5... |
Line 5... |
5 |
buildidx computes an index tsv file for the SvarDOS repository.
|
5 |
buildidx computes an index tsv file for the SvarDOS repository.
|
6 |
it must be executed pointing to a directory that stores packages (zip)
|
6 |
it must be executed pointing to a directory that stores packages (zip)
|
7 |
files. buildidx will generate the index file and save it into the package
|
7 |
files. buildidx will generate the index file and save it into the package
|
8 |
repository.
|
8 |
repository.
|
9 |
|
9 |
|
- |
|
10 |
11 feb 2021: lsm headers are no longer checked, so it is compatible with the simpler lsm format used by SvarDOS
|
10 |
13 jan 2021: removed the identification line, changed CRC32 to bsum, not creating the listing.txt file and stopped compressing index
|
11 |
13 jan 2021: removed the identification line, changed CRC32 to bsum, not creating the listing.txt file and stopped compressing index
|
11 |
23 apr 2017: uncompressed index is no longer created, added CRC32 of zib (bin only) files, if present
|
12 |
23 apr 2017: uncompressed index is no longer created, added CRC32 of zib (bin only) files, if present
|
12 |
28 aug 2016: listing.txt is always written inside the repo dir (instead of inside current dir)
|
13 |
28 aug 2016: listing.txt is always written inside the repo dir (instead of inside current dir)
|
13 |
27 aug 2016: accepting full paths to repos (starting with /...)
|
14 |
27 aug 2016: accepting full paths to repos (starting with /...)
|
14 |
07 dec 2013: rewritten buildidx in ANSI C89
|
15 |
07 dec 2013: rewritten buildidx in ANSI C89
|
Line 29... |
Line 30... |
29 |
#include <time.h> /* time(), ctime() */
|
30 |
#include <time.h> /* time(), ctime() */
|
30 |
#include <unistd.h> /* read() */
|
31 |
#include <unistd.h> /* read() */
|
31 |
#include <dirent.h>
|
32 |
#include <dirent.h>
|
32 |
#include <sys/types.h>
|
33 |
#include <sys/types.h>
|
33 |
|
34 |
|
34 |
#define pVer "2021-01-13"
|
35 |
#define pVer "2021-02-11"
|
35 |
|
36 |
|
36 |
|
37 |
|
37 |
/* computes the BSD sum of a file and returns it. returns 0 on error. */
|
38 |
/* computes the BSD sum of a file and returns it. returns 0 on error. */
|
38 |
static uint16_t file2bsum(const char *filename) {
|
39 |
static uint16_t file2bsum(const char *filename) {
|
39 |
uint16_t result = 0;
|
40 |
uint16_t result = 0;
|
Line 109... |
Line 110... |
109 |
description[0] = 0;
|
110 |
description[0] = 0;
|
110 |
title[0] = 0;
|
111 |
title[0] = 0;
|
111 |
/* open the file */
|
112 |
/* open the file */
|
112 |
fd = fopen(filename, "rb");
|
113 |
fd = fopen(filename, "rb");
|
113 |
if (fd == NULL) return(-1);
|
114 |
if (fd == NULL) return(-1);
|
114 |
/* check the file's header */
|
- |
|
115 |
if (readline_fromfile(fd, linebuff, 64) < 0) return(-1);
|
- |
|
116 |
if (strcasecmp(linebuff, "begin3") != 0) return(-1);
|
- |
|
117 |
/* read the LSM file line by line */
|
115 |
/* read the LSM file line by line */
|
118 |
while (readline_fromfile(fd, linebuff, 127) >= 0) {
|
116 |
while (readline_fromfile(fd, linebuff, 127) >= 0) {
|
119 |
for (x = 0;; x++) {
|
117 |
for (x = 0;; x++) {
|
120 |
if (linebuff[x] == 0) {
|
118 |
if (linebuff[x] == 0) {
|
121 |
x = -1;
|
119 |
x = -1;
|