File: errors.c

package info (click to toggle)
rdiff-backup-fs 1.0.0-8
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 952 kB
  • sloc: sh: 3,800; ansic: 2,944; makefile: 23
file content (54 lines) | stat: -rw-r--r-- 1,363 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "headers.h"
#include "externs.h"
#include "errors.h"

void fail(int error){

    printf("Error: ");
    switch (error){
		case (ERR_PARAMETRES):
	    	printf("Wrong parametres; try " PROGRAM_NAME " <mount point path> <repository path> or see man " PROGRAM_NAME ";\n");
	    	break;
		case (ERR_NO_MOUNT_OPT):
		    printf("Mount point was not declared;\n");
		    break;
		case (ERR_NO_REPO_OPT):
	    	printf("No repository was given\n");
	    	break;
		case (ERR_UNKNOWN_OPTION):
		    printf("No such option; see man " PROGRAM_NAME "\n");
		    break;
		case (ERR_NO_MOUNT):
	    	printf("No such mount directory\n");
		    break;
		case (ERR_NO_REPO):
	    	printf("No such repository\n");
	    	break;
		case (ERR_NO_TMP):
		    printf("No such directory for temporary files directory;\n");
	    	break;
		case (ERR_RDIFF):
		    printf("Rdiff failed to recover file;\n");
	    	break;
	    case (ERR_FULL_ONLY):
	    	printf("Disk-only filesystem cannot be used, probably because of chosen layout;\n");
	    	break;
        case (ERR_REPO_READ):
            printf("Failed to read repository;\n");
            break;
		default:
		    printf("Unknown error\n");
	    	break;
    }
    clean_up();
    exit(-1);
    
};

void clean_up(){

    if (data_dir != NULL)
    	if (execlp("rm", "rm", "-r", "-f", data_dir, NULL) == -1)
    	    fail(-1);

}