1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/old-tests/config/config_t.c

38 lines
649 B
C
Raw Normal View History

/*
* Test program that reads, then writes a config file.
*/
#include <stdio.h>
#include "config.h"
int main(int argc, char **argv)
{
struct config_file *cf;
if (argc != 2) {
fprintf(stderr, "Usage: %s <config_file>\n", argv[0]);
exit(1);
}
cf = create_config_file();
if (cf == NULL) {
fprintf(stderr, "Couldn't create config_file object.\n");
exit(1);
}
if (!read_config(cf, argv[1])) {
fprintf(stderr, "Couldn't read config file '%s'\n", argv[0]);
exit(1);
}
if (!write_config(cf, "out")) {
fprintf(stderr, "Couldn't write config file 'out'\n");
exit(1);
}
destroy_config_file(cf);
dump_memory();
return 0;
}