- remove CVS keywords from patches

noticed by kurt@
ok kili@
This commit is contained in:
ajacoutot 2007-10-31 23:14:46 +00:00
parent aa0dd0584f
commit a2cb4112c5
15 changed files with 538 additions and 215 deletions

View File

@ -1,15 +1,6 @@
$OpenBSD: patch-ctm_README,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/README.orig Thu Sep 22 04:49:07 1994
+++ ctm/README Fri Oct 26 22:39:59 2007
@@ -5,7 +5,7 @@
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
# ----------------------------------------------------------------------------
#
-# $Id: patch-ctm_README,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+# $Id: patch-ctm_README,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
#
What will I not find in this file ?
$OpenBSD: patch-ctm_README,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/README.orig Wed Oct 31 23:06:34 2007
+++ ctm/README Wed Oct 31 23:06:34 2007
@@ -21,7 +21,7 @@ CTM is now meant to be the definitive way to make and
two versions of a directory tree.
There are two parts to this, making the delta and applying it. These are two

View File

@ -1,12 +1,20 @@
$OpenBSD: patch-ctm_ctm_Makefile,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/Makefile.orig Fri Oct 26 22:39:58 2007
+++ ctm/ctm/Makefile Fri Oct 26 22:40:00 2007
@@ -15,7 +15,7 @@ MANDIR=${PREFIX}/man/cat
PROG= ctm
NOTYET= ctm_ed.c
--- ctm/ctm/Makefile.orig Tue May 28 09:47:37 1996
+++ ctm/ctm/Makefile Wed Oct 31 23:38:04 2007
@@ -11,4 +11,4 @@
-BINDIR=/usr/local/bin
-MANDIR=/usr/local/man/cat
+BINDIR=${PREFIX}/bin
+MANDIR=${PREFIX}/man/cat
@@ -17,8 +17,4 @@
SRCS= ctm.c ctm_input.c ctm_pass1.c ctm_pass2.c ctm_pass3.c \
- ctm_syntax.c ctm_ed.c
-LDADD+= -L/usr/local/lib -lmd
-DPADD+= ${LIBMD}
-MAN1= ctm.1
-MAN5= ctm.5
-CFLAGS+= -I/usr/local/include -Wall
+ ctm_syntax.c ctm_ed.c ctm_passb.c
MAN= ctm.1 ctm.5
+MAN= ctm.1 ctm.5
.if exists(${.CURDIR}/../../Makefile.inc)

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_1,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm.1.orig Wed May 1 01:01:43 1996
+++ ctm/ctm/ctm.1 Fri Oct 26 22:39:59 2007
$OpenBSD: patch-ctm_ctm_ctm_1,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm.1.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm.1 Wed Oct 31 23:06:34 2007
@@ -1,5 +1,5 @@
.\"----------------------------------------------------------------------------
-.\""THE BEER-WARE LICENSE" (Revision 42):
@ -8,15 +8,6 @@ $OpenBSD: patch-ctm_ctm_ctm_1,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
.\"<joerg@freebsd.org> wrote this file. As long as you retain this notice you
.\"can do whatever you want with this stuff. If we meet some day, and you think
.\"this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
@@ -10,7 +10,7 @@
.\"
.\" CTM and ctm(1) by <phk@login.dknet.dk>
.\"
-.\" $Id: patch-ctm_ctm_ctm_1,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+.\" $Id: patch-ctm_ctm_ctm_1,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
.\"
.Dd Mar 25, 1995
.Os
@@ -20,19 +20,23 @@
.Nd source code mirror program
.Sh SYNOPSIS

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_5,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm.5.orig Sun Mar 26 22:09:48 1995
+++ ctm/ctm/ctm.5 Fri Oct 26 22:39:59 2007
$OpenBSD: patch-ctm_ctm_ctm_5,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm.5.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm.5 Wed Oct 31 23:06:34 2007
@@ -1,5 +1,5 @@
.\"----------------------------------------------------------------------------
-.\""THE BEER-WARE LICENSE" (Revision 42):
@ -8,15 +8,6 @@ $OpenBSD: patch-ctm_ctm_ctm_5,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
.\"<joerg@freebsd.org> wrote this file. As long as you retain this notice you
.\"can do whatever you want with this stuff. If we meet some day, and you think
.\"this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
@@ -10,7 +10,7 @@
.\"
.\" CTM and ctm(1) by <phk@login.dknet.dk>
.\"
-.\" $Id: patch-ctm_ctm_ctm_5,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+.\" $Id: patch-ctm_ctm_ctm_5,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
.\"
.Dd March 25, 1995
.Os
@@ -18,66 +18,63 @@
.Sh NAME
.Nm ctm

View File

@ -1,15 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm.c.orig Wed May 1 01:01:43 1996
+++ ctm/ctm/ctm.c Fri Oct 26 22:39:59 2007
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: patch-ctm_ctm_ctm_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ * $Id: patch-ctm_ctm_ctm_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
*
* This is the client program of 'CTM'. It will apply a CTM-patch to a
* collection of files.
$OpenBSD: patch-ctm_ctm_ctm_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm.c Wed Oct 31 23:06:34 2007
@@ -14,7 +14,6 @@
* Options we'd like to see:
*

View File

@ -1,15 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_ed_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_ed.c.orig Tue May 30 05:47:22 1995
+++ ctm/ctm/ctm_ed.c Fri Oct 26 22:39:59 2007
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: patch-ctm_ctm_ctm_ed_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ * $Id: patch-ctm_ctm_ctm_ed_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
*
*/
$OpenBSD: patch-ctm_ctm_ctm_ed_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_ed.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm_ed.c Wed Oct 31 23:06:34 2007
@@ -21,13 +21,13 @@ ctm_edit(u_char *script, int length, char *filein, cha
fi = fopen(filein,"r");

View File

@ -1,7 +1,27 @@
$OpenBSD: patch-ctm_ctm_ctm_h,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm.h.orig Fri Oct 26 22:39:59 2007
+++ ctm/ctm/ctm.h Fri Oct 26 22:40:01 2007
@@ -26,7 +26,7 @@
$OpenBSD: patch-ctm_ctm_ctm_h,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm.h.orig Wed May 1 01:01:43 1996
+++ ctm/ctm/ctm.h Wed Oct 31 23:35:36 2007
@@ -10,24 +10,27 @@
*
*/
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <md5.h>
-#include <ctype.h>
#include <string.h>
-#include <errno.h>
#include <time.h>
+#include <unistd.h>
+#include <md5.h>
+#include <regex.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/time.h>
#define VERSION "2.0"
@ -10,3 +30,69 @@ $OpenBSD: patch-ctm_ctm_ctm_h,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
#define SUBSUFF ".ctm"
#define TMPSUFF ".ctmtmp"
+#define TARCMD "tar -rf %s -T -"
/* The fields... */
#define CTM_F_MASK 0xff
@@ -51,12 +54,21 @@
#define CTM_Q_MD5_Force 0x0800
struct CTM_Syntax {
- char *Key;
- int *List;
+ char *Key; /* CTM key for operation */
+ int *List; /* List of operations */
};
extern struct CTM_Syntax Syntax[];
+struct CTM_Filter {
+ struct CTM_Filter *Next; /* next filter in the list */
+ int Action; /* enable or disable */
+ regex_t CompiledRegex; /* compiled regex */
+};
+
+#define CTM_FILTER_DISABLE 0
+#define CTM_FILTER_ENABLE 1
+
#define Malloc malloc
#define Free free
#define Delete(foo) if (!foo) ; else {Free(foo); foo = 0; }
@@ -74,6 +86,8 @@ EXTERN u_char *FileName;
EXTERN u_char *TmpDir;
EXTERN u_char *CatPtr;
EXTERN u_char *Buffer;
+EXTERN u_char *BackupFile;
+EXTERN u_char *TarCmd;
/*
* Paranoid -- Just in case they should be after us...
@@ -106,8 +120,12 @@ EXTERN int Verbose;
EXTERN int Exit;
EXTERN int Force;
EXTERN int CheckIt;
+EXTERN int KeepIt;
+EXTERN int ListIt;
EXTERN int SetTime;
EXTERN struct timeval Times[2];
+EXTERN struct CTM_Filter *FilterList;
+EXTERN struct CTM_Filter *LastFilter;
#define Exit_OK 0
#define Exit_Garbage 1
@@ -118,6 +136,7 @@ EXTERN struct timeval Times[2];
#define Exit_Mess 32
#define Exit_Done 64
#define Exit_Version 128
+#define Exit_NoMatch 256
void Fatal_(int ln, char *fn, char *kind);
#define Fatal(foo) Fatal_(__LINE__,__FILE__,foo)
@@ -139,6 +158,7 @@ u_char * Fdata(FILE *fd, int u_chars, MD5_CTX *ctx);
int Pass1(FILE *fd, unsigned applied);
int Pass2(FILE *fd);
+int PassB(FILE *fd);
int Pass3(FILE *fd);
int ctm_edit(u_char *script, int length, char *filein, char *fileout);

View File

@ -1,15 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_pass1_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_pass1.c.orig Mon Feb 5 17:06:50 1996
+++ ctm/ctm/ctm_pass1.c Fri Oct 26 22:39:59 2007
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: patch-ctm_ctm_ctm_pass1_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ * $Id: patch-ctm_ctm_ctm_pass1_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
*
*/
$OpenBSD: patch-ctm_ctm_ctm_pass1_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_pass1.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm_pass1.c Wed Oct 31 23:06:34 2007
@@ -23,9 +23,9 @@ Pass1(FILE *fd, unsigned applied)
u_char *p,*q;
MD5_CTX ctx;

View File

@ -1,7 +1,54 @@
$OpenBSD: patch-ctm_ctm_ctm_pass2_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_pass2.c.orig Fri Oct 26 22:39:59 2007
+++ ctm/ctm/ctm_pass2.c Fri Oct 26 22:40:00 2007
@@ -114,6 +114,11 @@ Pass2(FILE *fd)
$OpenBSD: patch-ctm_ctm_ctm_pass2_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_pass2.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm_pass2.c Wed Oct 31 23:06:34 2007
@@ -27,7 +27,10 @@ Pass2(FILE *fd)
struct CTM_Syntax *sp;
struct stat st;
int ret = 0;
+ int match = 0;
char md5_1[33];
+ struct CTM_Filter *filter;
+ FILE *ed = NULL;
if(Verbose>3)
printf("Pass2 -- Checking if CTM-patch will apply\n");
@@ -49,6 +52,12 @@ Pass2(FILE *fd)
Delete(md5);
cnt = -1;
+ /* if a filter list was specified, check file name against
+ the filters specified
+ if no filter was given operate on all files. */
+ match = (FilterList ?
+ !(FilterList->Action) : CTM_FILTER_ENABLE);
+
GETFIELD(p,' ');
if (p[0] != 'C' || p[1] != 'T' || p[2] != 'M') WRONG
@@ -70,6 +79,22 @@ Pass2(FILE *fd)
switch (j & CTM_F_MASK) {
case CTM_F_Name:
GETNAMECOPY(name,sep,j,0);
+ /* If `keep' was specified, we won't remove any files,
+ so don't check if the file exists */
+ if (KeepIt &&
+ (!strcmp(sp->Key,"FR") || !strcmp(sp->Key,"DR"))) {
+ match = CTM_FILTER_DISABLE;
+ break;
+ }
+
+ for (filter = FilterList; filter; filter = filter->Next) if (0 == regexec(&filter->CompiledRegex, name,
+ 0, 0, 0)) {
+ match = filter->Action;
+ }
+
+ if (CTM_FILTER_DISABLE == match)
+ break; /* should ignore this file */
+
/* XXX Check DR DM rec's for parent-dir */
if(j & CTM_Q_Name_New) {
/* XXX Check DR FR rec's for item */
@@ -89,6 +114,11 @@ Pass2(FILE *fd)
ret |= Exit_NotOK;
break;
}
@ -13,3 +60,52 @@ $OpenBSD: patch-ctm_ctm_ctm_pass2_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
if (SetTime && getuid() && (getuid() != st.st_uid)) {
fprintf(stderr,
" %s: %s not mine, cannot set time.\n",
@@ -124,7 +154,7 @@ Pass2(FILE *fd)
if(j & CTM_Q_MD5_Before) {
char *tmp;
GETFIELD(p,sep);
- if((st.st_mode & S_IFMT) == S_IFREG &&
+ if(match && (st.st_mode & S_IFMT) == S_IFREG &&
(tmp = MD5File(name,md5_1)) != NULL &&
strcmp(tmp,p)) {
fprintf(stderr," %s: %s md5 mismatch.\n",
@@ -154,6 +184,8 @@ Pass2(FILE *fd)
case CTM_F_Bytes:
if(cnt < 0) WRONG
GETDATA(trash,cnt);
+ if (!match)
+ break;
if(!strcmp(sp->Key,"FN")) {
p = tempnam(TmpDir,"CTMclient");
j = ctm_edit(trash,cnt,name,p);
@@ -171,6 +203,30 @@ Pass2(FILE *fd)
unlink(p);
Free(p);
return ret;
+ }
+ unlink(p);
+ Free(p);
+ } else if (!strcmp(sp->Key,"FE")) {
+ p = tempnam(TmpDir,"CTMclient");
+ ed = popen("ed","w");
+ if (!ed) {
+ WRONG
+ }
+ fprintf(ed,"e %s\n", name);
+ if (cnt != fwrite(trash,1,cnt,ed)) {
+ warn("%s", name);
+ pclose(ed);
+ WRONG
+ }
+ fprintf(ed,"w %s\n",p);
+ if (pclose(ed)) {
+ warn("%s", p);
+ WRONG
+ }
+ if(strcmp(md5,MD5File(p,md5_1))) {
+ fprintf(stderr,"%s %s MD5 didn't come out right\n",
+ sp->Key, name);
+ WRONG
}
unlink(p);
Free(p);

View File

@ -1,10 +1,66 @@
$OpenBSD: patch-ctm_ctm_ctm_pass3_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_pass3.c.orig Fri Oct 26 22:39:59 2007
+++ ctm/ctm/ctm_pass3.c Fri Oct 26 22:40:00 2007
@@ -176,6 +176,26 @@ Pass3(FILE *fd)
$OpenBSD: patch-ctm_ctm_ctm_pass3_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_pass3.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm_pass3.c Wed Oct 31 23:06:34 2007
@@ -22,7 +22,7 @@ settime(const char *name, const struct timeval *times)
{
if (SetTime)
if (utimes(name,times)) {
- fprintf(stderr, " utimes(): %s: %s\n", name, strerror(errno));
+ warn("utimes(): %s", name);
return -1;
}
return 0;
@@ -39,8 +39,9 @@ Pass3(FILE *fd)
FILE *ed=0;
struct stat st;
char md5_1[33];
+ int match=0;
struct timeval times[2];
-
+ struct CTM_Filter *filter = NULL;
if(Verbose>3)
printf("Pass3 -- Applying the CTM-patch\n");
MD5Init (&ctx);
@@ -139,10 +140,11 @@ Pass3(FILE *fd)
case CTM_F_Gid: GETFIELDCOPY(gid,sep); break;
case CTM_F_Mode: GETFIELDCOPY(mode,sep); break;
case CTM_F_MD5:
- if(j & CTM_Q_MD5_Before)
+ if(j & CTM_Q_MD5_Before) {
GETFIELDCOPY(md5before,sep);
- else
+ } else {
GETFIELDCOPY(md5,sep);
+ }
break;
case CTM_F_Count: GETBYTECNT(cnt,sep); break;
case CTM_F_Bytes: GETDATA(trash,cnt); break;
@@ -153,15 +155,55 @@ Pass3(FILE *fd)
j = strlen(name)-1;
if(name[j] == '/') name[j] = '\0';
if (Verbose > 0)
fprintf(stderr,"> %s %s\n",sp->Key,name);
- fprintf(stderr,"> %s %s\n",sp->Key,name);
+ /*
+ * If a filter list is specified, run thru the filter list and
+ * match `name' against filters. If the name matches, set the
+ * required action to that specified in the filter.
+ * The default action if no filterlist is given is to match
+ * everything.
+ */
+
+ match = (FilterList ? !(FilterList->Action) : CTM_FILTER_ENABLE);
+ for (filter = FilterList; filter; filter = filter->Next) {
+ if (0 == regexec(&filter->CompiledRegex, name,
+ 0, 0, 0)) {
+ match = filter->Action;
+ }
+ }
+
+ if (CTM_FILTER_DISABLE == match) /* skip file if disabled */
+ continue;
+
+ if (Verbose > 0)
+ fprintf(stderr,"> %s %s\n",sp->Key,name);
+ if ((strcmp(sp->Key, "FS") == 0 ||
+ strcmp(sp->Key, "FN") == 0 ||
+ strcmp(sp->Key, "FE") == 0) && -1 == access(name, W_OK)) {
@ -28,3 +84,75 @@ $OpenBSD: patch-ctm_ctm_ctm_pass3_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
if(!strcmp(sp->Key,"FM") || !strcmp(sp->Key, "FS")) {
i = open(name,O_WRONLY|O_CREAT|O_TRUNC,0666);
if(i < 0) {
- perror(name);
+ warn("%s", name);
WRONG
}
if(cnt != write(i,trash,cnt)) {
- perror(name);
+ warn("%s", name);
WRONG
}
close(i);
@@ -180,13 +222,13 @@ Pass3(FILE *fd)
}
fprintf(ed,"e %s\n",name);
if(cnt != fwrite(trash,1,cnt,ed)) {
- perror(name);
+ warn("%s", name);
pclose(ed);
WRONG
}
fprintf(ed,"w %s\n",name);
if(pclose(ed)) {
- perror("ed");
+ warn("ed");
WRONG
}
if(strcmp(md5,MD5File(name,md5_1))) {
@@ -206,12 +248,13 @@ Pass3(FILE *fd)
sp->Key,name,i);
WRONG
}
- rename(buf,name);
- if(strcmp(md5,MD5File(name,md5_1))) {
+ if(strcmp(md5,MD5File(buf,md5_1))) {
fprintf(stderr," %s %s Edit failed MD5 check.\n",
sp->Key,name);
WRONG
}
+ if (rename(buf,name) == -1)
+ WRONG
if (settime(name,times)) WRONG
continue;
}
@@ -228,7 +271,11 @@ Pass3(FILE *fd)
continue;
}
if(!strcmp(sp->Key,"FR")) {
- if (0 != unlink(name)) {
+ if (KeepIt) {
+ if (Verbose > 1)
+ printf("<%s> not removed\n", name);
+ }
+ else if (0 != unlink(name)) {
fprintf(stderr,"<%s> unlink failed\n",name);
if (!Force)
WRONG
@@ -240,8 +287,14 @@ Pass3(FILE *fd)
* We cannot use rmdir() because we do not get the directories
* in '-depth' order (cvs-cur.0018.gz for examples)
*/
- sprintf(buf,"rm -rf %s",name);
- system(buf);
+ if (KeepIt) {
+ if (Verbose > 1) {
+ printf("<%s> not removed\n", name);
+ }
+ } else {
+ sprintf(buf,"rm -rf %s",name);
+ system(buf);
+ }
continue;
}
WRONG

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-ctm_ctm_ctm_passb_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_passb.c.orig Fri Oct 26 22:39:59 2007
+++ ctm/ctm/ctm_passb.c Fri Oct 26 22:40:00 2007
@@ -0,0 +1,142 @@
$OpenBSD: patch-ctm_ctm_ctm_passb_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_passb.c.orig Wed Oct 31 23:09:23 2007
+++ ctm/ctm/ctm_passb.c Wed Oct 31 23:10:13 2007
@@ -0,0 +1,141 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
@ -10,7 +10,6 @@ $OpenBSD: patch-ctm_ctm_ctm_passb_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ * this stuff is worth it, you can buy me a beer in return. Joseph Koshy
+ * ----------------------------------------------------------------------------
+ *
+ * $Id: patch-ctm_ctm_ctm_passb_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ *
+ */
+

View File

@ -1,15 +1,6 @@
$OpenBSD: patch-ctm_ctm_ctm_syntax_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm/ctm_syntax.c.orig Mon Feb 5 17:06:55 1996
+++ ctm/ctm/ctm_syntax.c Fri Oct 26 22:40:00 2007
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: patch-ctm_ctm_ctm_syntax_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
+ * $Id: patch-ctm_ctm_ctm_syntax_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
*
*/
$OpenBSD: patch-ctm_ctm_ctm_syntax_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm/ctm_syntax.c.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm/ctm_syntax.c Wed Oct 31 23:06:34 2007
@@ -56,12 +56,12 @@ static int ctmDR[] = /* Directory Remove */
{ Name|Dir, 0 };

View File

@ -1,10 +1,16 @@
$OpenBSD: patch-ctm_ctm_rmail_Makefile,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm_rmail/Makefile.orig Fri Oct 26 22:39:59 2007
+++ ctm/ctm_rmail/Makefile Fri Oct 26 22:40:01 2007
@@ -4,6 +4,5 @@ MANDIR=${PREFIX}/man/cat
$OpenBSD: patch-ctm_ctm_rmail_Makefile,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm_rmail/Makefile.orig Wed Oct 31 23:06:34 2007
+++ ctm/ctm_rmail/Makefile Wed Oct 31 23:06:34 2007
@@ -1,9 +1,8 @@
-BINDIR=/usr/local/bin
-MANDIR=/usr/local/man/cat
+BINDIR=${PREFIX}/bin
+MANDIR=${PREFIX}/man/cat
PROG= ctm_rmail
SRCS= ctm_rmail.c error.c
CFLAGS+= -Wall
-CFLAGS+= -I/usr/local/include -Wall
-MLINKS+= ctm_rmail.1 ctm_smail.1
+CFLAGS+= -Wall
.include <bsd.prog.mk>

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
--- ctm/ctm_rmail/ctm_rmail.1.orig Fri Oct 26 22:40:00 2007
+++ ctm/ctm_rmail/ctm_rmail.1 Fri Oct 26 22:40:01 2007
@@ -6,27 +6,12 @@
$OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm_rmail/ctm_rmail.1.orig Wed May 1 01:01:45 1996
+++ ctm/ctm_rmail/ctm_rmail.1 Wed Oct 31 23:12:21 2007
@@ -6,20 +6,12 @@
.\" Author: Stephen McKay
.\"
.Dd January 24, 1995
@ -9,37 +9,30 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
+.Dt CTM_RMAIL 1
.Os
.Sh NAME
-.Nm ctm_smail ,
-.Nm ctm_dequeue ,
.Nm ctm_rmail
-.Nm ctm_smail, ctm_rmail
-.Nd send and receive
-.Xr ctm 1
-.Nm ctm
-deltas via mail
+.Nm ctm_rmail
+.Nd send and receive ctm deltas via mail
.Sh SYNOPSIS
-.Nm ctm_smail
-.Op Fl l Ar log
-.Op Fl m Ar maxmsgsize
-.Op Fl c Ar maxctmsize
-.Op Fl q Ar queue-dir
-.Ar ctm-delta
-.Ar mail-alias
-.Nm ctm_dequeue
-.Op Fl l Ar log
-.Op Fl n Ar numchunks
-.Ar queue-dir
.Nm ctm_rmail
.Op Fl Dfuv
.Op Fl l Ar log
@@ -35,106 +20,15 @@ deltas via mail
@@ -28,61 +20,15 @@ deltas via mail
.Op Fl b Ar basedir
.Op Ar
.Sh DESCRIPTION
-In conjunction with the
-In conjuction with the
-.Xr ctm 1
-command,
-.Nm ctm_smail ,
-.Nm ctm_dequeue
-.Nm ctm_smail
-and
+The
.Nm ctm_rmail
@ -48,8 +41,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
-is given a compressed
-.Xr ctm
-delta, and a mailing list to send it to. It splits the delta into manageable
-pieces, encodes them as mail messages and sends them to the mailing list
-(optionally queued to spread the mail load).
-pieces, encodes them as mail messages and sends them to the mailing list.
-Each recipient uses
-.Nm ctm_rmail
+program is used
@ -84,13 +76,6 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
-This is to prevent massive changes overwhelming users' mail boxes. Note that
-this is the size before encoding. Encoding causes a 4/3 size increase before
-mail headers are added. If not specified, there is no limit.
-.It Fl q Ar queue-dir
-Instead of mailing the delta pieces now, store them in the given directory
-to be mailed later using
-.Nm ctm_dequeue .
-This feature allows the mailing of large deltas to be spread out over
-hours or even days to limit the impact on recipients with limited network
-bandwidth or small mail spool areas.
-.El
-.Pp
-.Ar ctm-delta
@ -100,47 +85,57 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
-The mail messages are sent using
-.Xr sendmail 8 .
-.Pp
-Command line arguments for
-.Nm ctm_dequeue :
-.Bl -tag -width indent
-.It Fl l Ar log
-Instead of appearing on
-.Em stderr ,
-error diagnostics and informational messages (other than command line errors)
-are time stamped and written to the file
-.Em log .
-.It Fl n Ar numchunks
-Limit the number of mail messages that
-.Nm ctm_dequeue
-will send per run. By default,
-.Nm ctm_dequeue
-will send one mail message per run.
-.El
-.Pp
-.Ar queuedir
-is the directory containing the mail messages stored by
-.Nm ctm_smail .
-Up to
-.Ar numchunks
-mail messages will be sent in each run. The recipient mailing list is already
-encoded in the queued files.
-.Pp
-It is safe to run
-.Nm ctm_dequeue
-while
-.Nm ctm_smail
-is adding entries to the queue, or even to run
-.Nm ctm_smail
-multiple times concurrently, but a separate queue directory should be used
-for each tree being distributed. This is because entries are served in
-alphabetical order, and one tree will be unfairly serviced before any others,
-based on the delta names, not delta creation times.
-.Pp
-Command line arguments for
.Nm ctm_rmail :
.Bl -tag -width indent
.It Fl l Ar log
@@ -272,19 +166,8 @@ You can retrieve this delta via ftpmail, or your good
@@ -112,19 +58,18 @@ without the
.Fl p
flag.
Deltas will not be applied if they do not match the
-.Li .ctm_status
+.Pa .ctm_status
file in
.Ar basedir
(or if
-.Li .ctm_status
+.Pa .ctm_status
does not exist).
.It Fl D
Delete deltas after successful application by
.Xr ctm .
-It is probably a good idea to avoid this flag (and keep all the deltas)
-as one of the possible future enhancements to
+It is probably a good idea to avoid this flag (and keep all the deltas) as
.Xr ctm
-is the ability to recover small groups of files from a full set of deltas.
+has the ability to recover small groups of files from a full set of deltas.
.It Fl f
Fork and execute in the background while applying deltas with
.Xr ctm .
@@ -161,7 +106,11 @@ Pass the
flag to the
.Xr ctm
command when applying the complete deltas, causing a more informative
-output. Note that you need to make your own arrangements to capture it.
+output. All
+.Xr ctm
+output appears in the
+.Nm ctm_rmail
+log file.
.El
.Pp
The file arguments (or
@@ -196,7 +145,7 @@ CTM_MAIL END 61065
The subject of the message always begins with
.Dq ctm-mail
followed by the name of the delta, which piece this is, and how many total
-pieces there are. The data is bracketed by
+pieces there are. The data are bracketed by
.Dq CTM_MAIL BEGIN
and
.Dq CTM_MAIL END
@@ -217,23 +166,12 @@ You can retrieve this delta via ftpmail, or your good
.Pp
You are then on your own!
.Sh EXAMPLES
@ -152,7 +147,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
-.Em src-guys ,
-limiting the mail size to roughly 60000 bytes, you could use:
-.Bd -literal -offset indent
-.Ic ctm_smail -m 60000 /wherever/it/is/src-cur.0032.gz src-guys
-ctm_smail -m 60000 /wherever/it/is/src-cur.0032.gz src-guys
-.Ed
-.Pp
To decode every
@ -161,21 +156,96 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
message in your mailbox, assemble them into complete deltas, then apply
any deltas built or lying around, you could use:
.Bd -literal -offset indent
@@ -359,7 +242,7 @@ manipulation in
which allows
.Nm ctm_rmail
to execute
-.Xr ctm
-ctm_rmail -p ~/pieces -d ~/deltas -b /usr/ctm-src-cur $MAIL
+.Ic ctm_rmail -p ~/pieces -d ~/deltas -b /usr/ctm-src-cur $MAIL
.Ed
.Pp
(Note that no messages are deleted by
@@ -252,9 +190,9 @@ and
directories and
.Pa /ctm/log
file are writable by user
-.Em daemon
+.Dq daemon
or group
-.Em wheel ) :
+.Dq wheel ) :
.Bd -literal -offset indent
receiver-dude: "|ctm_rmail -p /ctm/tmp -d /ctm/deltas -l /ctm/log"
owner-receiver-dude: real_dude@wherever.you.like
@@ -265,11 +203,50 @@ or wherever else you like.
.Pp
To apply all the deltas collected, and delete those applied, you could use:
.Bd -literal -offset indent
-ctm_rmail -D -d /ctm/deltas -b /ctm/src-cur -l /ctm/apply.log
+.Ic ctm_rmail -D -d /ctm/deltas -b /ctm/src-cur -l /ctm/apply.log
.Ed
+.Pp
+For maximum flexibility, consider this excerpt from a
+.Xr procmail
+script:
+.Bd -literal -offset indent
+PATH=$HOME/bin:$PATH
+
+:0 w
+* ^Subject: ctm-mail cvs-cur
+| ctm_incoming
+.Ed
+.Pp
+together with the
+shell script
+.Pa ~/bin/ctm_incoming :
+.Bd -literal -offset indent
+#! /bin/sh
+PATH="$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
+export PATH
+
+cd $HOME/ctm && ctm_rmail -f -p pieces -d deltas -l log -b /ctm
+.Ed
+.Pp
+which will deposit all
+.Xr ctm
+deltas in
+.Pa ~/ctm/deltas ,
+apply them to the tree in
+.Pa /ctm ,
+and drop any failures into your regular mail box.
+Note the
+.Ev PATH
+manipulation in
+.Pa ctm_incoming
+which allows
+.Nm ctm_rmail
+to execute
+.Xr ctm 1
on the (non-OpenBSD) machine that this example was taken from.
+on the (non-OpenBSD) machine that this example was taken from.
.Sh SECURITY
If you automatically take your mail and pass it to a file tree patcher, you
@@ -409,11 +292,8 @@ source tree.
-might think you are handing the keys to your system to the hackers! Happily,
+might think you are handing the keys to your system to the crackers! Happily,
the window for mischief is quite small.
.Nm ctm_rmail
is careful to write only to the directories given to it (by not believing any
@@ -302,20 +279,21 @@ must be in your
.Ev PATH .
.Sh FILES
.Bl -tag -width indent
+.It Pa QUEUEDIR/*
+Pieces of deltas encoded as mail messages waiting to be sent to the
+mailing list.
.It Pa PIECEDIR/*
-Pieces of deltas waiting for the rest.
+Pieces of deltas waiting for the rest to arrive.
.It Pa DELTADIR/*
Completed deltas.
.It Pa BASEDIR/.ctm_status
-File containing name and number of the next delta to be applied to this
+File containing the name and number of the next delta to be applied to this
source tree.
.\" This next request is for sections 1, 6, 7 & 8 only
.\" (command return values (to shell) and fprintf/stderr type diagnostics)
.Sh DIAGNOSTICS
-.Nm ctm_smail ,
-.Nm ctm_dequeue
-.Nm ctm_smail
-and
.Nm ctm_rmail
-return exit status 0 for success, and 1 for various failures.
@ -183,7 +253,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
.Nm ctm_rmail
is expected to be called from a mail transfer program, and thus signals
failure only when the input mail message should be bounced (preferably into
@@ -424,24 +304,6 @@ is not considered an error important enough to bounce
@@ -326,13 +304,6 @@ is not considered an error important enough to bounce
.Nm ctm_rmail
returns an exit status of 0.
.Pp
@ -193,27 +263,25 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_1,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
-.Bd -literal -offset indent
-ctm_smail: src-cur.0250.gz 1/2 sent to src-guys
-.Ed
-.Pp
-or, if queueing,
-.Bd -literal -offset indent
-ctm_smail: src-cur.0250.gz 1/2 queued for src-guys
-.Ed
-.Pp
-.Nm ctm_dequeue
-will report messages like:
-.Bd -literal -offset indent
-ctm_dequeue: src-cur.0250.gz 1/2 sent
-.Ed
-.Pp
.Nm ctm_rmail
will report messages like:
.Bd -literal -offset indent
@@ -470,6 +332,8 @@ turn up here too. Error messages should be self expla
@@ -359,10 +330,15 @@ turn up here too. Error messages should be self expla
.\" The next request is for sections 2 and 3 error and signal handling only.
.\" .Sh ERRORS
.Sh SEE ALSO
.Xr ctm 1 ,
.Xr ctm 5
-.Xr ctm 1
-(coming soon)
+.Xr ctm 1 ,
+.Xr ctm 5
+.Pp
+.Pa "http://www.openbsd.org/ctm.html"
.\" .Sh STANDARDS
.\" .Sh HISTORY
.Sh AUTHOR
Stephen McKay <syssgm@devetir.qld.gov.au>
.\" .Sh BUGS
+.\" Gosh! No bugs here!
+.\" This message brought to you by the Coalition for More Humour in Man Pages.
+.\"

View File

@ -1,12 +1,7 @@
$OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $
$OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.2 2007/10/31 23:14:46 ajacoutot Exp $
--- ctm/ctm_rmail/ctm_rmail.c.orig Wed May 1 01:01:45 1996
+++ ctm/ctm_rmail/ctm_rmail.c Fri Oct 26 22:40:00 2007
@@ -1,3 +1,4 @@
+/* $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.1 2007/10/26 20:44:35 ajacoutot Exp $ */
/*
* Accept one (or more) ASCII encoded chunks that together make a compressed
* CTM delta. Decode them and reconstruct the deltas. Any completed
@@ -12,7 +13,7 @@
+++ ctm/ctm_rmail/ctm_rmail.c Wed Oct 31 23:14:02 2007
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
@ -15,7 +10,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
@@ -292,6 +293,7 @@ read_piece(char *input_file)
@@ -292,6 +292,7 @@ read_piece(char *input_file)
if (!decoding)
{
char *s;
@ -23,7 +18,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
if (sscanf(line, "CTM_MAIL BEGIN %s %d %d %c",
delta, &pce, &npieces, junk) != 3)
@@ -302,19 +304,19 @@ read_piece(char *input_file)
@@ -302,19 +303,19 @@ read_piece(char *input_file)
got_one++;
strcpy(tname, piece_dir);
@ -52,7 +47,7 @@ $OpenBSD: patch-ctm_ctm_rmail_ctm_rmail_c,v 1.1 2007/10/26 20:44:35 ajacoutot Ex
cksum = 0xffff;
decoding++;
@@ -494,17 +496,19 @@ combine(char *delta, int npieces, char *dname, char *p
@@ -494,17 +495,19 @@ combine(char *delta, int npieces, char *dname, char *p
FILE *dfp, *pfp;
int i, n, e;
char buf[BUFSIZ];