1.\" ----------------------------------------------------------------------------
2.\" "THE BEER-WARE LICENSE" (Revision 42):
3.\" <joerg@FreeBSD.org> wrote this file.  As long as you retain this notice you
4.\" can do whatever you want with this stuff. If we meet some day, and you think
5.\" this stuff is worth it, you can buy me a beer in return.       Joerg Wunsch
6.\" ----------------------------------------------------------------------------
7.\"
8.\" This manual page is partially obtained from Poul-Hennings CTM README
9.\" file.
10.\"
11.\" CTM and ctm(1) by <phk@FreeBSD.org>
12.\"
13.\" $FreeBSD: stable/10/usr.sbin/ctm/ctm/ctm.5 206622 2010-04-14 19:08:06Z uqs $
14.\"
15.Dd March 25, 1995
16.Dt CTM 5
17.Os
18.Sh NAME
19.Nm ctm
20.Nd source code mirror system
21.Sh DESCRIPTION
22The
23.Nm
24transfers data in a specific file format, called a CTM delta.
25.Pp
26CTM deltas consist of control lines and data chunks.
27Each control
28line starts with the letters
29.Dq CTM ,
30followed by a CTM statement and control data, and ends with a '\en'
31character.
32.Pp
33Data chunks always belong to the preceding control line, and the
34last field on that control line is the number of bytes in the data
35chunk.
36A trailing newline '\en' character follows each data chunk, this
37newline is not part of the chunk and is not included in the count.
38.Pp
39The CTM statements are as follows.
40.Bl -tag -width indent
41.It _BEGIN Ar version name number timestamp prefix
42This is the overall begin of a CTM delta file.
43The
44.Ar version
45field must match the program version
46(currently 2.0).
47.Ar Name
48is the name and
49.Ar number
50the sequence number of the CTM service, it is matched against the file
51.Pa .ctm_status
52to see if the delta has already been applied.
53.Ar Timestamp
54contains the year, month, day, hour, minute, and second of the
55time of delta creation for reference
56(followed by the letter
57.Sq Z
58meaning this is a UTC timestamp).
59The
60.Ar prefix
61field is currently not implemented.
62.It _END Ar md5
63This statement ends the CTM delta, the global
64.Ar md5
65checksum is matched against the MD5 checksum of the entire delta, up to
66and including the space (0x20) character following ``_END''.
67.It \&FM Ar name uid gid mode md5 count
68Make the file
69.Ar name ,
70the original file had the uid
71.Ar uid
72(numerical, decimal),
73the gid
74.Ar gid
75(numerical, decimal),
76mode
77.Ar mode
78(numerical, octal),
79and the MD5 checksum
80.Ar md5 .
81.Pp
82The following
83.Ar count
84bytes data are the contents of the new file.
85.It \&FS Ar name uid gid mode md5before md5after count
86Substitute the contents of file
87.Ar name ,
88the original file had the new uid
89.Ar uid
90(numerical, decimal),
91the new gid
92.Ar gid
93(numerical, decimal),
94new mode
95.Ar mode
96(numerical, octal),
97the old MD5 checksum
98.Ar md5before ,
99and the new MD5 checksum
100.Ar md5after .
101.Pp
102The following
103.Ar count
104bytes data are the contents of the new file.
105.Pp
106File substitution is used if the commands to edit a file would exceed
107the total file length, so substituting it is more efficient.
108.It \&FN Ar name uid gid mode md5before md5after count
109Edit the file
110.Ar name .
111The arguments are as above, but the data sections contains an
112.Xr diff 1
113-n script which should be applied to the file in question.
114.It \&FR Ar name md5
115Remove the file
116.Ar name ,
117which must match the MD5 checksum
118.Ar md5 .
119.It \&AS Ar name uid gid mode
120The original file
121.Ar name
122changed its owner to
123.Ar uid ,
124its group to
125.Ar gid ,
126and/or its mode to
127.Ar mode .
128.It \&DM Ar name uid gid mode
129The directory
130.Ar name
131is to be created, it had originally the owner
132.Ar uid ,
133group
134.Ar gid ,
135and mode
136.Ar mode .
137.It \&DR Ar name
138The directory
139.Ar name
140is to be removed.
141.El
142.Sh EXAMPLES
143In the following example, long lines have been folded to make them
144printable
145(marked by backslashes).
146.Bd -literal
147CTM_BEGIN 2.0 cvs-cur 485 19950324214652Z .
148CTMFR src/sys/gnu/i386/isa/scd.c,v 5225f13aa3c7e458f9dd0d4bb637b18d
149CTMFR src/sys/gnu/i386/isa/scdreg.h,v e5af42b8a06f2c8030b93a7d71afb223
150CTMDM src/sys/gnu/i386/isa/Attic 0 552 775
151CTMFS .ctm_status 545 552 664 d9ccd2a84a9dbb8db56ba85663adebf0 \\
152e2a10c6f66428981782a0a18a789ee2e 12
153cvs-cur 485
154
155CTMFN CVSROOT/commitlogs/gnu 545 552 664 \\
1565d7bc3549140d860bd9641b5782c002d 7fb04ed84b48160c9b8eea84b4c0b6e3 394
157a6936 21
158ache        95/03/24 09:59:50
159
160  Modified:    gnu/lib/libdialog kernel.c prgbox.c
161  Log:
162[...]
163CTM_END 74ddd298d76215ae45a077a4b6a74e9c
164.Ed
165.Sh SEE ALSO
166.Xr ctm 1 ,
167.Xr ctm_rmail 1 ,
168.Xr ed 1
169.Sh HISTORY
170Initial trials ran during the
171.Fx 1.1.5 ,
172and many bugs and
173methods were hashed out.
174The CTM system has been made publicly available in
175.Fx 2.1 .
176.Sh AUTHORS
177The CTM system has been designed and implemented by
178.An Poul-Henning Kamp
179.Aq phk@FreeBSD.org .
180.Pp
181.An Joerg Wunsch
182.Aq joerg@FreeBSD.org
183wrote this man-page.
184