libvirt/tests/conftest.c
Daniel Veillard 3bbac7cdb6 * TODO libvirt.spec.in: update
* configure.in include/libvirt/virterror.h src/Makefile.am
  src/conf.c src/conf.h src/virterror.c src/xen_internal.c:
  adding a subset of Xen config file parser, and serializer
* tests/Makefile.am tests/conftest.c tests/test_conf.sh
  tests/confdata/Makefile.am tests/confdata/fc4.conf
  tests/confdata/fc4.out: adding test program for config in and out
Daniel
2006-08-29 22:27:07 +00:00

31 lines
643 B
C

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "conf.h"
int main(int argc, char **argv) {
int ret;
virConfPtr conf;
int len = 10000;
char buffer[10000];
if (argc != 2) {
fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
exit(1);
}
conf = virConfReadFile(argv[1]);
if (conf == NULL) {
fprintf(stderr, "Failed to process %s\n", argv[1]);
exit(2);
}
ret = virConfWriteMem(&buffer[0], &len, conf);
if (ret < 0) {
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
exit(3);
}
printf("%s", buffer);
virConfFree(conf);
exit(0);
}