source: MondoRescue/branches/3.0/mondo/test/test-truncname.c@ 3185

Last change on this file since 3185 was 3185, checked in by Bruno Cornec, 11 years ago

Simplify the interface of mr_getline and mr_asprintf. With 3.1 compatibility now will allow backports from this branch into 3.0

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/*
2 * $Id$
3 *
4 * Test program for mountlist management at restore time
5 * Cn be used on host system with valgrind easier than with mondorestore
6 */
7#include <stdio.h>
8#include "my-stuff.h"
9#include "mr_mem.h"
10#include "../common/mondostructures.h"
11#include "../common/libmondo.h"
12#include "../mondoarchive/mondoarchive.h"
13
14extern void twenty_seconds_til_yikes(void);
15
16/* Reference to global bkpinfo */
17struct s_bkpinfo *bkpinfo;
18
19extern bool g_text_mode;
20extern FILE *g_fprep;
21extern double g_kernel_version;
22extern int g_partition_table_locked_up;
23extern int g_noof_rows;
24
25/* Whether we should fail immediately at first error */
26bool g_fail_immediately = FALSE;
27
28bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
29bool g_I_have_just_nuked = FALSE;
30char *g_biggielist_txt;
31char *g_filelist_full;
32char *g_filelist_imagedevs;
33char *g_imagedevs_restthese;
34
35char *g_mondo_cfg_file;
36
37char *g_mountlist_fname;
38char *g_mondo_home;
39
40char *g_getfacl;
41char *g_getfattr;
42
43extern char *MONDO_LOGFILE;
44extern char *truncate_to_drive_name(const char *);
45/* We don't have a cleanup function yet */
46void (*mr_cleanup)(void) = NULL;
47void free_MR_global_filenames() {
48}
49
50int main() {
51
52char *part = NULL;
53char *disk = NULL;
54char *list[] = {
55 "/dev/sda99",
56 "/dev/hda12",
57 "/dev/cciss/c12d9p24",
58 "/dev/mapper/vg00lv02",
59 "/dev/mapper/dm-4",
60 "/dev/mapper/mpath4p19",
61 "/dev/mapper/part13",
62 "/dev/rd/c10d4p16",
63 "/dev/cciss/c1d12",
64 "/dev/mapper/mpath34",
65 NULL
66};
67int i;
68
69mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
70
71/* Globals */
72g_loglevel = 99;
73g_text_mode = FALSE;
74g_main_pid = getpid();
75
76log_it("Begin loop");
77for (i=0; list[i] != NULL; i++) {
78 log_it("%d: partition %s ...",i, list[i]);
79 mr_asprintf(part,"%s",list[i]);
80 disk = truncate_to_drive_name(part);
81 log_it("...belongs to disk %s",disk);
82 mr_free(part);
83}
84log_it("end of loop");
85mr_free(MONDO_LOGFILE);
86exit(0);
87}
Note: See TracBrowser for help on using the repository browser.