Rangitaki Sync Library
First of all: I'm really sorry for my bad code style, the bad design, all the ugliness , the missing comments (I will add them as soon as possible), for some things that may not work as expected, for every C developer who is used to read good code, for all the bugs that may happen. I'm sorry, but I'm not a good C developer. I just started coding in that language.
But, however, the funny part is: IT ACTUALLY WORKS! (or at least it should and did in my tests)
Anyway, this is a library written for synchronizing a Rangitaki blog with your device. (Actually you can download every directory recursive and upload single files...).
For testing purposes I wrote two test programs: One for uploading (single file), one for downloading (recursive, into /tmp).
These library is written on Linux and tested on Linux. It may works on other systems, but I don't know.
Even if I write all of my programs in the hope, that they will be useful for someone one day, I don't think that this will be used by anyone else than me. But look also in the 'Useful Stuff' section of this README.
make you have following programs:
Just run it with
./rsl-download-test. You don't need to give any arguments, since it will ask you everything.
This program will download you all files and subdirectory of the entered remote directory into
/tmp/rangitaki-sync. Normally the program should create this directory, if it isn't already there. If it fails to create it and it isn't already there, you will receive a nice and friendly error message...
Just run it with
./rsl-upload-test. You don't need to give any arguments, since it will ask you everything.
This program will upload a single file form the entered path to the entered path on your server.
libssh project (libssh.org)
For there great ssh library and the awesome documentation.
Zed A. Shaw (zedshaw.com)
For his great book "Learn C the hard way".
For his awesome debug macros (The
- Fork it
- Create a feature branch with a meaningful name (
git checkout -b my-new-feature)
- Add yourself to the CONTRIBUTORS file
- Commit your changes (
git commit -am 'Add some feature')
- Push to your branch (
git push origin my-new-feature)
- Create a new pull request
I wrote one function in this library which could be more useful for many people than the library: the char *getFilename(const char *input) function, which returns the filename of a path to a file.
char *path = "/var/www/html/index.html"; printf("%s\n", getFilename(path)); // Will print 'index.html'