NAME

  Libconf - Set of abstraction layers to the linux/unix configuration


DESCRIPTION

PERL

High level

This high level layer provides a hierarchical structure representing the configuration file informations. It's very simple to use, and it uses a "semantic" approach to structure the informations. You should use this layer.

  use Libconf::Glueconf::Networking::Resolv;
  my $resolv = new Libconf::Glueconf::Networking::Resolv({filename => '/etc/resolv.conf' });
  push(@{$resolv->{nameserver}}, '192.168.76.7');
  $resolv->{search}->[1] = 'foo';
  $resolv->write_conf('/etc/resolv_modified');

See the Libconf::Glueconf manpage

Low level

This is the core layer and templates of Libconf, don't use it unless you know what you do, or if there is no high level templates for your needs. But you better contact us so that we add a tempalte. See the Libconf::Templates manpage.

C

  #include <stdio.h>
  #include "conf2xml.h"
  #include <string.h>
  int main (int argc, char **argv, char **env)
  {
      char *xml_string;
      conf2xml_init();
      xml_string = conf2xml("/etc/rc.conf", "Generic/Shell", "shell_style:true_bash,shell_command:/bin/bash");
      FILE* output = fopen("/tmp/rc.xml", "w");
      fwrite(xml_string, strlen(xml_string), 1, output);
      // ... alter xml_string ...
      xml2conf(xml_string, "./etc/rc.conf", NULL, NULL);
      conf2xml_free();
      return (0);
  }

PYTHON

  from conf2xml import *;
  xml_string=conf2xml("/etc/passwd", "System/Passwd")
  f=open("/tmp/passwd.xml", "w")
  f.write(xml_string)
  f.close
  xml2conf(xml_string, "/tmp/passwd", "System/Passwd")

RUBY

  require conf2xml
  xml=Conf2Xml.conf2xml("/etc/passwd", "System/Passwd");
  Conf2Xml.xml2conf(xml, "/tmp/passwd", "System/Passwd");

TEMPLATES

The template list can be found in the Libconf::Glueconf manpage, or you can have a list by issuing on the command line :

  libconf --command 'list_templates'