using config files in C

Requirement is to move the data out of C programs and let the program use a config file for the data. say we have a file called data.ini.

$ cat data.ini
x = 50;
y = 100;

$ cat prog.c
#include <libconfig.h>
int main(){
  long int x = 0;
  config_t* config;

  // read config file
  config_read_file(config, "data.ini");

  // get the value
  if( config_lookup_int(config, "position.x", &x) == CONFIG_FALSE ){
    printf("failed to lookup - position.x\n");
    return 1;

  printf("x = %d\n", (int)x);
  return 0;

Compile the program using the option “-lconfig”

$ gcc -lconfig prog.c

You may need libconfig-dev,
$ sudo apt-get install libconfig-dev

libconfig manual
Configuration file (wikipedia)


subversion client – nautilussvn

I have been looking for a good subversion client on Linux and started using nautilussvn. That’s pretty cool, since it works from the file browser and pysvn based.

Installation is easy process. I used deb package from the nautilussvn home page on my Debian (unstable).

Still using meld for comparison and that’s also look cool. Have to try using Gvidiff.

Using nautilussvn, could see the modified files, files that are not added to repository, files that are added etc. with good emblems on them. Moreover, we can do svn actions like add, commit, revert etc also by simply right clicking the file.

It is still in development. Check out the screenshots and tutorials on hacking nautilus on that same website.