39 lines
804 B
C
39 lines
804 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/* cc ulzenc.c -o ulzenc && ./ulzenc example.txt */
|
|
|
|
static int
|
|
error(const char *name, const char *msg)
|
|
{
|
|
fprintf(stderr, "%s: %s\n", name, msg);
|
|
return 0;
|
|
}
|
|
|
|
char *mem, *ptr;
|
|
|
|
int
|
|
encode_ulz(FILE *src)
|
|
{
|
|
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
int res;
|
|
FILE *src, *dst;
|
|
if(argv[1][0] == '-' && argv[1][1] == 'v')
|
|
return !fprintf(stdout, "Ulzenc - ULZ Encoder, 15 Nov 2023.\n");
|
|
if(argc != 3)
|
|
return error("usage", "ulzenc [-v] a.bin b.ulz ");
|
|
if(!(src = fopen(argv[1], "rb")))
|
|
return !error("Invalid input file", argv[1]);
|
|
res = encode_ulz(src);
|
|
if(!(dst = fopen(argv[2], "wb")))
|
|
return !error("Invalid output file", argv[1]);
|
|
fwrite(mem, res, 1, dst);
|
|
printf("Compressed %s -> %s(%d bytes).\n", argv[1], argv[2], res);
|
|
return 0;
|
|
} |