ctm.c (7395) | ctm.c (8857) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * | 1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * |
9 * $Id: ctm.c,v 1.9 1995/03/19 13:42:54 joerg Exp $ | 9 * $Id: ctm.c,v 1.10 1995/03/26 20:09:50 phk Exp $ |
10 * | 10 * |
11 * This is the client program of 'CTM'. It will apply a CTM-patch to a | 11 * This is the client program of 'CTM'. It will apply a CTM-patch to a |
12 * collection of files. 13 * 14 * Options we'd like to see: 15 * 16 * -a Attempt best effort. | 12 * collection of files. 13 * 14 * Options we'd like to see: 15 * 16 * -a Attempt best effort. |
17 * -b <dir> Base-dir | 17 * -b |
18 * -B <file> Backup to tar-file. 19 * -d <int> Debug TBD. 20 * -m <mail-addr> Email me instead. 21 * -r <name> Reconstruct file. 22 * -R <file> Read list of files to reconstruct. 23 * 24 * Options we have: 25 * -c Check it out, don't do anything. --- 9 unchanged lines hidden (view full) --- 35#define EXTERN /* */ 36#include "ctm.h" 37 38#define CTM_STATUS ".ctm_status" 39 40extern int Proc(char *, unsigned applied); 41 42int | 18 * -B <file> Backup to tar-file. 19 * -d <int> Debug TBD. 20 * -m <mail-addr> Email me instead. 21 * -r <name> Reconstruct file. 22 * -R <file> Read list of files to reconstruct. 23 * 24 * Options we have: 25 * -c Check it out, don't do anything. --- 9 unchanged lines hidden (view full) --- 35#define EXTERN /* */ 36#include "ctm.h" 37 38#define CTM_STATUS ".ctm_status" 39 40extern int Proc(char *, unsigned applied); 41 42int |
43main(int argc, char **argv) | 43main(int argc, char **argv) |
44{ 45 int stat=0; 46 int c; 47 extern int optopt,optind; 48 extern char * optarg; 49 FILE *statfile; 50 unsigned applied = 0; | 44{ 45 int stat=0; 46 int c; 47 extern int optopt,optind; 48 extern char * optarg; 49 FILE *statfile; 50 unsigned applied = 0; |
51 | 51 |
52 Verbose = 1; 53 Paranoid = 1; 54 setbuf(stderr,0); 55 setbuf(stdout,0); | 52 Verbose = 1; 53 Paranoid = 1; 54 setbuf(stderr,0); 55 setbuf(stdout,0); |
56 | 56 |
57 while((c=getopt(argc,argv,"ab:B:cd:Fm:pPqr:R:T:Vv")) != -1) { 58 switch (c) { 59 case 'c': CheckIt++; break; /* Only check it */ 60 case 'p': Paranoid--; break; /* Less Paranoid */ 61 case 'P': Paranoid++; break; /* More Paranoid */ 62 case 'q': Verbose--; break; /* Quiet */ 63 case 'v': Verbose++; break; /* Verbose */ 64 case 'T': TmpDir = optarg; break; --- 21 unchanged lines hidden (view full) --- 86 argv += optind; 87 88 if((statfile = fopen(CTM_STATUS, "r")) == NULL) 89 fprintf(stderr, "Warning: " CTM_STATUS " not found.\n"); 90 else { 91 fscanf(statfile, "%*s %u", &applied); 92 fclose(statfile); 93 } | 57 while((c=getopt(argc,argv,"ab:B:cd:Fm:pPqr:R:T:Vv")) != -1) { 58 switch (c) { 59 case 'c': CheckIt++; break; /* Only check it */ 60 case 'p': Paranoid--; break; /* Less Paranoid */ 61 case 'P': Paranoid++; break; /* More Paranoid */ 62 case 'q': Verbose--; break; /* Quiet */ 63 case 'v': Verbose++; break; /* Verbose */ 64 case 'T': TmpDir = optarg; break; --- 21 unchanged lines hidden (view full) --- 86 argv += optind; 87 88 if((statfile = fopen(CTM_STATUS, "r")) == NULL) 89 fprintf(stderr, "Warning: " CTM_STATUS " not found.\n"); 90 else { 91 fscanf(statfile, "%*s %u", &applied); 92 fclose(statfile); 93 } |
94 | 94 |
95 if(!argc) 96 stat |= Proc("-", applied); 97 98 while(argc-- && stat == Exit_Done) { 99 stat |= Proc(*argv++, applied); 100 stat &= ~Exit_Version; 101 } 102 --- 111 unchanged lines hidden --- | 95 if(!argc) 96 stat |= Proc("-", applied); 97 98 while(argc-- && stat == Exit_Done) { 99 stat |= Proc(*argv++, applied); 100 stat &= ~Exit_Version; 101 } 102 --- 111 unchanged lines hidden --- |