libmktorrent is a clone of esmil's mktorrent
mktorrent is a nice C application to make a .torrent file for your data. I need mktorrent in context of a application, so i clone mktorrent and add a target for building a static library.
I added a few hacks to get it nice and silent while working as library in your program.
As the Original: type 'make' to build the program.
Do 'make install' to install the program to /usr/local/bin.
Do 'make aslib' to compile mktorrent as static library called libmktorrent.a
The library and the header file will be located inside the /dist folder.
#include
#include
#include "./libmktorrent.h"
int main(int argc, char *argv[]) {
metafile_t *m = getDefaultMetaStruc();
unlink("testfile.torrent");
puts("------------------------------------------------------");
int st;
st = mktorrent("/tmp/testfile", "http://localhost/anounce", m);
printf("Result is: %d\n", st);
puts("------------------------------------------------------");
return EXIT_SUCCESS;
}
run:
cc main.c -o test ./libmktorrent.a
./test
The output should be like this:
------------------------------------------------------ Result is: 0 ------------------------------------------------------
There is a testfile.torrent in your directory now.
Sadly, esmil put the mktorrent under the GNU GPL, Version 2 (see COPYING). As for all of my projects I want to give you this piece of code for any purpose you get, but i can't because it's gpl'ed. :-( So please respect the decision of esmil and DO NOT SPEND ME A BEER!