2012-07-28 13:51:53 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2012-10-25 14:16:06 +00:00
|
|
|
#include <stdint.h>
|
2012-08-10 13:49:13 +00:00
|
|
|
#include <stdbool.h>
|
2012-08-11 18:02:00 +00:00
|
|
|
#include <string.h>
|
2012-07-28 13:51:53 +00:00
|
|
|
#include <zlib.h>
|
|
|
|
|
2012-08-09 19:09:29 +00:00
|
|
|
#include "huffman.h"
|
|
|
|
|
2012-07-28 13:51:53 +00:00
|
|
|
#define CHUNK 1024
|
|
|
|
|
|
|
|
struct node {
|
2012-08-10 13:49:13 +00:00
|
|
|
int count;
|
|
|
|
char **paths;
|
|
|
|
struct node **children;
|
2012-07-28 13:51:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2012-08-11 18:02:00 +00:00
|
|
|
load_dictionary(FILE *source, char ***dictionary, int *dictionary_size,
|
|
|
|
bool stats)
|
2012-08-09 19:09:29 +00:00
|
|
|
{
|
2012-07-28 13:51:53 +00:00
|
|
|
int ret;
|
|
|
|
z_stream strm;
|
|
|
|
unsigned char in[CHUNK];
|
|
|
|
int read = 0;
|
|
|
|
|
2012-08-09 19:09:29 +00:00
|
|
|
// XXX keep a ref to buf for free()
|
2012-07-28 13:51:53 +00:00
|
|
|
unsigned char *buf = malloc(sizeof(char) * CHUNK);
|
|
|
|
|
|
|
|
/* allocate inflate state */
|
|
|
|
strm.zalloc = Z_NULL;
|
|
|
|
strm.zfree = Z_NULL;
|
|
|
|
strm.opaque = Z_NULL;
|
|
|
|
strm.avail_in = 0;
|
|
|
|
strm.next_in = Z_NULL;
|
|
|
|
ret = inflateInit(&strm);
|
|
|
|
if (ret != Z_OK) {
|
|
|
|
printf("ERROR\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* decompress until deflate stream ends or end of file */
|
|
|
|
do {
|
|
|
|
strm.avail_in = fread(in, 1, CHUNK, source);
|
|
|
|
if (ferror(source)) {
|
|
|
|
(void)inflateEnd(&strm);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (strm.avail_in == 0) {
|
|
|
|
printf("read entire file\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
strm.next_in = in;
|
|
|
|
|
|
|
|
/* run inflate() on input until output buffer not full */
|
|
|
|
do {
|
|
|
|
strm.avail_out = CHUNK;
|
|
|
|
strm.next_out = buf;
|
|
|
|
ret = inflate(&strm, Z_NO_FLUSH);
|
|
|
|
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
|
|
|
switch (ret) {
|
|
|
|
case Z_NEED_DICT:
|
|
|
|
printf("NEED ERROR\n");
|
|
|
|
ret = Z_DATA_ERROR; /* and fall through */
|
|
|
|
case Z_DATA_ERROR:
|
|
|
|
printf("DATA ERROR\n");
|
|
|
|
case Z_MEM_ERROR:
|
|
|
|
(void)inflateEnd(&strm);
|
|
|
|
printf("MEMORY ERROR\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
read += CHUNK - strm.avail_out;
|
|
|
|
} while (strm.avail_out == 0);
|
|
|
|
|
|
|
|
// read += CHUNK;
|
|
|
|
/* done when inflate() says it's done */
|
|
|
|
} while (ret != Z_STREAM_END);
|
|
|
|
|
2012-08-09 19:09:29 +00:00
|
|
|
int offset_size = 64;
|
|
|
|
int *dictionary_offsets = malloc (sizeof (int) * offset_size);
|
|
|
|
*dictionary_size = 1;
|
2012-07-28 13:51:53 +00:00
|
|
|
|
|
|
|
int i;
|
2012-08-09 19:09:29 +00:00
|
|
|
int j = 0;
|
|
|
|
dictionary_offsets[j++] = 0;
|
|
|
|
for (i = 0; i < read; i++) {
|
2012-07-28 13:51:53 +00:00
|
|
|
if (buf[i] == '\0') {
|
2012-08-09 19:09:29 +00:00
|
|
|
if (i != read - 1) {
|
|
|
|
dictionary_offsets[j++] = i + 1;
|
|
|
|
(*dictionary_size)++;
|
|
|
|
if (j == offset_size) {
|
|
|
|
offset_size = offset_size * 2;
|
|
|
|
dictionary_offsets =
|
|
|
|
realloc (dictionary_offsets,
|
|
|
|
sizeof (int) *
|
|
|
|
offset_size);
|
|
|
|
}
|
|
|
|
}
|
2012-07-28 13:51:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
*dictionary = malloc (sizeof (char *) * (*dictionary_size + 1));
|
|
|
|
for (i = 0; i < *dictionary_size; i++) {
|
2012-08-09 19:09:29 +00:00
|
|
|
(*dictionary)[i] = (char *) buf + dictionary_offsets[i];
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
(*dictionary_size)++;
|
|
|
|
// Add in the end of node sentinal string
|
|
|
|
char *sentinal = malloc (sizeof (char));
|
|
|
|
sentinal[0] = 0x00;
|
|
|
|
(*dictionary)[i] = sentinal;
|
|
|
|
|
2012-07-28 13:51:53 +00:00
|
|
|
// rewind back to unused zlib bytes
|
|
|
|
if (fseek(source, (long) strm.avail_in * -1, SEEK_CUR)) {
|
|
|
|
printf("Error seeking back in stream\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
if (stats) {
|
|
|
|
printf ("dictionary stats:\n");
|
|
|
|
printf ("\tcompressed size: %zu\n", ftell(source));
|
|
|
|
printf ("\tuncompressed size: %d\n", read);
|
|
|
|
printf ("\tentries found: %d\n", *dictionary_size);
|
|
|
|
}
|
|
|
|
|
2012-07-28 13:51:53 +00:00
|
|
|
inflateEnd(&strm);
|
|
|
|
|
|
|
|
return ret == Z_STREAM_END ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-09-06 14:12:54 +00:00
|
|
|
load_content_sets(FILE *stream, struct node **list, int *node_count,
|
|
|
|
struct huffman_node *dictionary_tree, bool stats, bool raw)
|
|
|
|
{
|
2012-08-10 13:49:13 +00:00
|
|
|
unsigned char *buf = malloc (sizeof (char *) * CHUNK);
|
2012-07-28 13:51:53 +00:00
|
|
|
size_t read;
|
2012-08-10 13:49:13 +00:00
|
|
|
struct node **nodes;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
unsigned char count;
|
|
|
|
fread(&count, sizeof (unsigned char), 1, stream);
|
2012-08-11 18:02:00 +00:00
|
|
|
|
2012-10-25 14:16:06 +00:00
|
|
|
uint64_t big_count;
|
|
|
|
|
|
|
|
if (count & 0x80) {
|
|
|
|
unsigned short count_bytes = count & 0x7F;
|
|
|
|
unsigned char *size_buf = malloc (sizeof (char *) *
|
|
|
|
count_bytes);
|
|
|
|
fread (size_buf, sizeof (char), count_bytes, stream);
|
|
|
|
|
|
|
|
printf ("found count: %hd\n", count_bytes);
|
|
|
|
printf ("%hd\n", (unsigned short) size_buf[0]);
|
|
|
|
printf ("%hd\n", size_buf[1]);
|
|
|
|
|
|
|
|
big_count = 0;
|
|
|
|
int offset = sizeof (uint64_t ) - count_bytes;
|
|
|
|
|
|
|
|
memcpy (((void *) &big_count) + offset, size_buf, count_bytes);
|
|
|
|
big_count = be64toh (big_count);
|
|
|
|
} else {
|
|
|
|
big_count = count;
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
if (stats) {
|
2012-09-06 14:12:54 +00:00
|
|
|
printf ("node stats:\n");
|
2012-10-25 14:16:06 +00:00
|
|
|
printf ("\tnumber of nodes: %lu\n", big_count);
|
2012-09-06 14:12:54 +00:00
|
|
|
} else if (raw) {
|
2012-10-25 14:16:06 +00:00
|
|
|
printf ("Nodes (%lu entries):\n", big_count);
|
2012-08-11 18:02:00 +00:00
|
|
|
}
|
2012-07-28 13:51:53 +00:00
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
|
2012-10-25 14:16:06 +00:00
|
|
|
nodes = malloc (sizeof (struct node *) * big_count);
|
|
|
|
for (i = 0; i < big_count; i++) {
|
2012-08-10 13:49:13 +00:00
|
|
|
nodes[i] = malloc (sizeof (struct node));
|
|
|
|
}
|
|
|
|
|
|
|
|
read = fread (buf, sizeof (char), CHUNK, stream);
|
2012-09-06 15:08:06 +00:00
|
|
|
unsigned char *eob = buf + read;
|
2012-08-11 18:02:00 +00:00
|
|
|
if (stats) {
|
|
|
|
printf("\tbytes: %zu\n", read);
|
|
|
|
}
|
2012-07-28 13:51:53 +00:00
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
/*
|
|
|
|
* the parent node doesn't go in the huffman tree, as nothing else
|
|
|
|
* references it.
|
|
|
|
*/
|
|
|
|
struct huffman_node *tree =
|
|
|
|
huffman_build_tree ((void **) nodes + 1,
|
2012-10-25 14:16:06 +00:00
|
|
|
big_count - 1);
|
2012-08-10 13:49:13 +00:00
|
|
|
|
|
|
|
int bits_read = 0;
|
2012-10-25 14:16:06 +00:00
|
|
|
for (i = 0; i < big_count; i++) {
|
2012-08-10 13:49:13 +00:00
|
|
|
struct node *node = nodes[i];
|
|
|
|
node->count = 0;
|
|
|
|
|
|
|
|
// XXX hard coded
|
|
|
|
node->paths = malloc (sizeof (char *) * 64);
|
|
|
|
node->children = malloc (sizeof (struct node *) * 64);
|
|
|
|
|
2012-09-06 14:12:54 +00:00
|
|
|
if (raw) {
|
2012-09-06 14:51:37 +00:00
|
|
|
printf (" Node - ");
|
|
|
|
huffman_reverse_lookup (tree, node);
|
|
|
|
printf (":\n");
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
while (true) {
|
2012-09-06 14:12:54 +00:00
|
|
|
if (raw) {
|
2012-09-06 14:51:37 +00:00
|
|
|
printf(" ");
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
char *path = (char *) huffman_lookup (dictionary_tree,
|
2012-09-06 14:12:54 +00:00
|
|
|
buf, &bits_read,
|
|
|
|
raw);
|
2012-08-10 13:49:13 +00:00
|
|
|
buf = buf + bits_read / 8;
|
|
|
|
bits_read = bits_read % 8;
|
2012-09-06 15:08:06 +00:00
|
|
|
if (buf >= eob) {
|
|
|
|
printf ("\nread too much: dictionary lookup\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2012-08-10 13:49:13 +00:00
|
|
|
|
|
|
|
if (path[0] == '\0') {
|
2012-09-06 14:12:54 +00:00
|
|
|
if (raw) {
|
2012-09-06 14:51:37 +00:00
|
|
|
printf(" (<end>)\n");
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
2012-08-10 13:49:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-09-06 14:12:54 +00:00
|
|
|
if (raw) {
|
2012-09-06 14:51:37 +00:00
|
|
|
printf (" (%s) :: ", path);
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
struct node *child =
|
|
|
|
(struct node *) huffman_lookup (tree, buf,
|
2012-09-06 14:12:54 +00:00
|
|
|
&bits_read,
|
|
|
|
raw);
|
|
|
|
if (raw) {
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
buf = buf + bits_read / 8;
|
|
|
|
bits_read = bits_read % 8;
|
2012-09-06 15:08:06 +00:00
|
|
|
if (buf >= eob) {
|
|
|
|
printf ("\nread too much: path lookup\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2012-08-10 13:49:13 +00:00
|
|
|
|
|
|
|
node->paths[node->count] = path;
|
|
|
|
node->children[node->count] = child;
|
|
|
|
node->count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*list = nodes[0];
|
2012-07-28 13:51:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
struct stack {
|
|
|
|
struct stack *next;
|
|
|
|
struct stack *prev;
|
|
|
|
char *path;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_content_set (struct node *content_sets, struct stack *head,
|
|
|
|
struct stack *tail)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct stack stack;
|
|
|
|
stack.prev = tail;
|
|
|
|
tail->next = &stack;
|
|
|
|
|
|
|
|
for (i = 0; i < content_sets->count; i++) {
|
|
|
|
stack.path = content_sets->paths[i];
|
|
|
|
dump_content_set(content_sets->children[i], head, &stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (content_sets->count == 0) {
|
|
|
|
struct stack *cur = head;
|
|
|
|
|
|
|
|
for (cur = head->next; cur != &stack; cur = cur->next) {
|
|
|
|
printf("/%s", cur->path);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_content_sets (struct node *content_sets)
|
|
|
|
{
|
|
|
|
struct stack stack;
|
|
|
|
stack.next = NULL;
|
|
|
|
stack.path = NULL;
|
|
|
|
|
|
|
|
dump_content_set (content_sets, &stack, &stack);
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
static void
|
|
|
|
count_content_set (struct node *content_sets, struct stack *head,
|
|
|
|
struct stack *tail, int *count)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct stack stack;
|
|
|
|
tail->next = &stack;
|
|
|
|
|
|
|
|
for (i = 0; i < content_sets->count; i++) {
|
|
|
|
stack.path = content_sets->paths[i];
|
|
|
|
count_content_set(content_sets->children[i], head, &stack,
|
|
|
|
count);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (content_sets->count == 0) {
|
|
|
|
(*count)++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
count_content_sets (struct node *content_sets, int *count)
|
|
|
|
{
|
|
|
|
struct stack stack;
|
|
|
|
stack.next = NULL;
|
|
|
|
stack.path = NULL;
|
|
|
|
|
|
|
|
count_content_set (content_sets, &stack, &stack, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_content_set (struct node *content_sets, const char *path)
|
|
|
|
{
|
|
|
|
struct node *cur = content_sets;
|
|
|
|
struct stack head;
|
|
|
|
head.next = NULL;
|
|
|
|
head.path = NULL;
|
|
|
|
struct stack *stack;
|
|
|
|
stack = &head;
|
|
|
|
|
|
|
|
bool found;
|
|
|
|
while(cur != NULL) {
|
|
|
|
int i;
|
|
|
|
found = false;
|
|
|
|
if (cur->count == 0) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (i = 0; i < cur->count; i++) {
|
|
|
|
int len = strlen(cur->paths[i]);
|
|
|
|
if (cur->paths[i][0] == '$' ||
|
|
|
|
!strncmp(cur->paths[i], path, len)) {
|
|
|
|
char *slash = index(path, '/');
|
|
|
|
/*
|
|
|
|
* we've hit then end. if the content set isn't
|
|
|
|
* also at the end, it's not a match
|
|
|
|
*/
|
|
|
|
if (slash == NULL ||
|
|
|
|
strlen(slash + 1) == 0) {
|
|
|
|
if (cur->count != 0) {
|
|
|
|
found = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
path = slash + 1;
|
|
|
|
found = true;
|
|
|
|
|
|
|
|
struct stack *top =
|
|
|
|
malloc (sizeof (struct stack));
|
|
|
|
stack->next = top;
|
|
|
|
top->path = cur->paths[i];
|
|
|
|
stack = top;
|
|
|
|
cur = cur->children[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
printf ("no match found\n");
|
|
|
|
} else {
|
|
|
|
struct stack *cur;
|
|
|
|
for (cur = head.next; cur != NULL; cur = cur->next) {
|
|
|
|
printf("/%s", cur->path);
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-06 14:12:54 +00:00
|
|
|
static void
|
2012-09-06 14:51:37 +00:00
|
|
|
print_dictionary (char **dictionary, int dictionary_size,
|
|
|
|
struct huffman_node *dictionary_tree)
|
2012-09-06 14:12:54 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
printf ("Path Dictionary (%d entries):\n", dictionary_size);
|
2012-09-06 14:51:37 +00:00
|
|
|
for (i = 0; i < dictionary_size - 1; i++) {
|
|
|
|
printf (" %s - ", dictionary[i]);
|
|
|
|
huffman_reverse_lookup (dictionary_tree, dictionary[i]);
|
|
|
|
printf("\n");
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
2012-09-06 14:51:37 +00:00
|
|
|
printf (" <end of node indicator> - ");
|
|
|
|
huffman_reverse_lookup (dictionary_tree, dictionary[i]);
|
|
|
|
printf ("\n");
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
|
|
|
|
2012-07-28 13:51:53 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv) {
|
|
|
|
FILE *fp;
|
2012-08-09 19:09:29 +00:00
|
|
|
char **dictionary;
|
|
|
|
int dictionary_size;
|
2012-08-10 13:49:13 +00:00
|
|
|
struct node *content_sets;
|
2012-09-06 14:12:54 +00:00
|
|
|
int content_set_size;
|
2012-07-28 13:51:53 +00:00
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
bool stats = false;
|
2012-09-06 14:12:54 +00:00
|
|
|
bool raw = false;
|
2012-08-11 18:02:00 +00:00
|
|
|
bool dump = false;
|
|
|
|
bool check = false;
|
|
|
|
|
|
|
|
if (argc < 3) {
|
|
|
|
printf("usage: unpack [mode] [bin file]\n");
|
|
|
|
printf("mode is one of:\n");
|
|
|
|
printf("s - print stats for the binary content set blob\n");
|
2012-09-06 14:12:54 +00:00
|
|
|
printf("r - display the raw binary as text\n");
|
2012-08-11 18:02:00 +00:00
|
|
|
printf("d - dump the blob contents to stdout\n");
|
|
|
|
printf("c - check if a path is allowed by the blob\n");
|
|
|
|
printf("\n");
|
|
|
|
printf("c requires an extra argument after the bin file,\n"
|
|
|
|
"for the path to check. the path must start with "
|
|
|
|
"a '/'\n\n");
|
2012-07-28 13:51:53 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
switch (argv[1][0]) {
|
|
|
|
case 's':
|
|
|
|
stats = true;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
dump = true;
|
|
|
|
break;
|
2012-09-06 14:12:54 +00:00
|
|
|
case 'r':
|
|
|
|
raw = true;
|
|
|
|
break;
|
2012-08-11 18:02:00 +00:00
|
|
|
case 'c':
|
|
|
|
check = true;
|
|
|
|
if (argc != 4) {
|
|
|
|
printf("error: must specify a path "
|
|
|
|
"with check\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fp = fopen(argv[2], "r");
|
2012-07-28 13:51:53 +00:00
|
|
|
if (fp == NULL) {
|
|
|
|
printf("error: unable to open file: %s\n", argv[1]);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
if (load_dictionary(fp, &dictionary, &dictionary_size, stats)) {
|
2012-07-28 13:51:53 +00:00
|
|
|
printf("dictionary inflation failed. exiting\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:49:13 +00:00
|
|
|
struct huffman_node *dictionary_tree =
|
|
|
|
huffman_build_tree ((void **) dictionary, dictionary_size);
|
2012-08-09 19:09:29 +00:00
|
|
|
|
2012-09-06 14:12:54 +00:00
|
|
|
if (raw) {
|
2012-09-06 14:51:37 +00:00
|
|
|
print_dictionary (dictionary, dictionary_size, dictionary_tree);
|
2012-09-06 14:12:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (load_content_sets(fp, &content_sets, &content_set_size,
|
|
|
|
dictionary_tree, stats, raw)) {
|
2012-07-28 13:51:53 +00:00
|
|
|
printf("node list parsing failed. exiting\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-11 18:02:00 +00:00
|
|
|
if (stats) {
|
|
|
|
int count = 0;
|
|
|
|
count_content_sets(content_sets, &count);
|
|
|
|
printf("\tcontent paths: %d\n", count);
|
|
|
|
} else if (dump) {
|
|
|
|
dump_content_sets (content_sets);
|
|
|
|
} else if (check) {
|
|
|
|
const char *path = argv[3];
|
|
|
|
if (path[0] == '/') {
|
|
|
|
path++;
|
|
|
|
}
|
|
|
|
check_content_set (content_sets, path);
|
|
|
|
}
|
2012-08-10 13:49:13 +00:00
|
|
|
|
2012-07-28 13:51:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|