ctm_pass1.c (7395) | ctm_pass1.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_pass1.c,v 1.8 1995/03/04 20:36:46 phk Exp $ | 9 * $Id: ctm_pass1.c,v 1.9 1995/03/26 20:09:52 phk Exp $ |
10 * 11 */ 12 13#include "ctm.h" 14#define BADREAD 1 15 16/*---------------------------------------------------------------------------*/ 17/* Pass1 -- Validate the incoming CTM-file. --- 4 unchanged lines hidden (view full) --- 22{ 23 u_char *p,*q; 24 MD5_CTX ctx; 25 int i,j,sep,cnt; 26 u_char *md5=0,*trash=0; 27 struct CTM_Syntax *sp; 28 int slashwarn=0; 29 unsigned current; | 10 * 11 */ 12 13#include "ctm.h" 14#define BADREAD 1 15 16/*---------------------------------------------------------------------------*/ 17/* Pass1 -- Validate the incoming CTM-file. --- 4 unchanged lines hidden (view full) --- 22{ 23 u_char *p,*q; 24 MD5_CTX ctx; 25 int i,j,sep,cnt; 26 u_char *md5=0,*trash=0; 27 struct CTM_Syntax *sp; 28 int slashwarn=0; 29 unsigned current; |
30 31 if(Verbose>3) | 30 31 if(Verbose>3) |
32 printf("Pass1 -- Checking integrity of incoming CTM-patch\n"); 33 MD5Init (&ctx); 34 35 GETFIELD(p,' '); /* CTM_BEGIN */ 36 if(strcmp(p,"CTM_BEGIN")) { 37 Fatal("Probably not a CTM-patch at all."); | 32 printf("Pass1 -- Checking integrity of incoming CTM-patch\n"); 33 MD5Init (&ctx); 34 35 GETFIELD(p,' '); /* CTM_BEGIN */ 36 if(strcmp(p,"CTM_BEGIN")) { 37 Fatal("Probably not a CTM-patch at all."); |
38 if(Verbose>3) | 38 if(Verbose>3) |
39 fprintf(stderr,"Expected \"CTM_BEGIN\" got \"%s\".\n",p); 40 return 1; 41 } 42 43 GETFIELDCOPY(Version,' '); /* <Version> */ 44 if(strcmp(Version,VERSION)) { 45 Fatal("CTM-patch is wrong version."); | 39 fprintf(stderr,"Expected \"CTM_BEGIN\" got \"%s\".\n",p); 40 return 1; 41 } 42 43 GETFIELDCOPY(Version,' '); /* <Version> */ 44 if(strcmp(Version,VERSION)) { 45 Fatal("CTM-patch is wrong version."); |
46 if(Verbose>3) | 46 if(Verbose>3) |
47 fprintf(stderr,"Expected \"%s\" got \"%s\".\n",VERSION,p); 48 return 1; 49 } 50 51 GETFIELDCOPY(Name,' '); /* <Name> */ 52 GETFIELDCOPY(Nbr,' '); /* <Nbr> */ 53 GETFIELDCOPY(TimeStamp,' '); /* <TimeStamp> */ 54 GETFIELDCOPY(Prefix,'\n'); /* <Prefix> */ 55 56 sscanf(Nbr, "%u", ¤t); 57 if(current && current <= applied) { 58 if(Verbose) 59 fprintf(stderr,"Delta number %u is already applied; ignoring.\n", 60 current); 61 return Exit_Version; 62 } | 47 fprintf(stderr,"Expected \"%s\" got \"%s\".\n",VERSION,p); 48 return 1; 49 } 50 51 GETFIELDCOPY(Name,' '); /* <Name> */ 52 GETFIELDCOPY(Nbr,' '); /* <Nbr> */ 53 GETFIELDCOPY(TimeStamp,' '); /* <TimeStamp> */ 54 GETFIELDCOPY(Prefix,'\n'); /* <Prefix> */ 55 56 sscanf(Nbr, "%u", ¤t); 57 if(current && current <= applied) { 58 if(Verbose) 59 fprintf(stderr,"Delta number %u is already applied; ignoring.\n", 60 current); 61 return Exit_Version; 62 } |
63 | 63 |
64 for(;;) { 65 if(md5) {Free(md5), md5 = 0;} 66 if(trash) {Free(trash), trash = 0;} 67 cnt = -1; 68 69 GETFIELD(p,' '); /* CTM_something */ 70 71 if (p[0] != 'C' || p[1] != 'T' || p[2] != 'M') { --- 134 unchanged lines hidden --- | 64 for(;;) { 65 if(md5) {Free(md5), md5 = 0;} 66 if(trash) {Free(trash), trash = 0;} 67 cnt = -1; 68 69 GETFIELD(p,' '); /* CTM_something */ 70 71 if (p[0] != 'C' || p[1] != 'T' || p[2] != 'M') { --- 134 unchanged lines hidden --- |