File: bup

package info (click to toggle)
icmake 7.18.00-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,840 kB
  • sloc: ansic: 7,784; makefile: 3,811; sh: 319; cpp: 83
file content (79 lines) | stat: -rwxr-xr-x 2,061 bytes parent folder | download | duplicates (8)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/local/bin/icmake -qi

#define ETCDIR		"/usr/local/etc"

#define VER		"1.00"

list
    volumes;				// backup volumes

void init ()				// definition of backup volumes
{					// always: dirs, descrip, etc
    volumes += 
    	(list) "dummy_1" +		// bup 0: dummy
    				(list) "dummy_2" +
    	(list) "/" +			// bup 1: whole disk
    				(list) "whole UNIX disk" +
    	(list) "/home/karel/dos" +	// bup 2: DOS disk
    				(list) "DOS partition" +
    	(list) "/usr/local/bin /conf" +	//bup 3: local stuff
    				(list) "local UNIX stuff" +
	(list) "/home/karel" +		// bup 4: user Karel
				(list) "user Karel, except for DOS"
	;
}

void usage ()
{
    int
    	i;
    	
    printf ("\n"
    	    "ICCE Backup Runner  V", VER, "\n"
    	    "Copyright (c) ICCE 1993. All rights reserved.\n"
    	    "\n"
    	    "Bup by Karel Kubat.\n"
    	    "\n"
    	    "Usage: bup volume-number\n"
    	    "Where:\n"
    	    "       volume-number: number of volume to show/run\n"
    	    "\n"
    	    "Volumes may be:\n");
    for (i = 2; i < sizeof (volumes); i += 2)
    	printf (i / 2, ":    ", element (i + 1, volumes), " (", 
    		element (i, volumes), ")\n");
    printf ("\n"
    	    "The actual backup is perfomed by the Icmake program `backup'.\n"
    	    "If the file ", ETCDIR, "/bup.<volume-number>.exclude exists,\n"
    	    "then the files listed in this file are excluded from the backup.\n"
    	    "\n");
    	    
    exit (1);
}    

void main (int argc, list argv)		// start of program
{
    string
    	excludefile,
    	volstring;
    int
    	volnum,
    	showsize;

    init ();
    	
    volstring = element (1, argv);
    volnum = (int) volstring * 2;
    if (volnum < 2 || volnum >= sizeof (volumes))
    	usage ();
    	
    excludefile = ETCDIR + "/" + "bup." + volstring + ".exclude";
    
    if (exists (excludefile))    
    	exec ("backup", "-v", "store", element (volnum, volumes),
    	      "--exclude-from", excludefile);
    else
    	exec ("backup", "-v", "store", element (volnum, volumes));
    	
    exit (0);
}