diff options
author | charnier <charnier@FreeBSD.org> | 1997-09-17 06:24:58 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-09-17 06:24:58 +0000 |
commit | 34a6b27326dc91b02abd2d076f78ebe1517503ae (patch) | |
tree | 9781d3dc281584ebde8e98c9633036821521c397 /usr.sbin/ctm/ctm | |
parent | 7f53c003f5540404b2c94a3af48e22a076aba47b (diff) | |
download | FreeBSD-src-34a6b27326dc91b02abd2d076f78ebe1517503ae.zip FreeBSD-src-34a6b27326dc91b02abd2d076f78ebe1517503ae.tar.gz |
Use err(3). Use An/Aq for author name.
Diffstat (limited to 'usr.sbin/ctm/ctm')
-rw-r--r-- | usr.sbin/ctm/ctm/ctm.1 | 34 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm.5 | 20 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm.c | 36 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm.h | 13 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm_ed.c | 12 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm_pass2.c | 6 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm_pass3.c | 12 | ||||
-rw-r--r-- | usr.sbin/ctm/ctm/ctm_passb.c | 6 |
8 files changed, 72 insertions, 67 deletions
diff --git a/usr.sbin/ctm/ctm/ctm.1 b/usr.sbin/ctm/ctm/ctm.1 index 9025c82..e175f52 100644 --- a/usr.sbin/ctm/ctm/ctm.1 +++ b/usr.sbin/ctm/ctm/ctm.1 @@ -10,7 +10,7 @@ .\" .\" CTM and ctm(1) by <phk@login.dknet.dk> .\" -.\" $Id$ +.\" $Id: ctm.1,v 1.12 1997/02/22 16:05:19 peter Exp $ .\" .Dd Mar 25, 1995 .Os @@ -28,7 +28,7 @@ .Op Fl T Ar tmpdir .Op Fl V Ar level .Op Fl x Ar exclude-regex -.Ar file... +.Ar .Sh DESCRIPTION .Nm Ctm was originally @@ -46,7 +46,7 @@ entirely different things. .Ss Usage To apply a CTM delta, you pass it to the -.Nm ctm +.Nm command. You can pass a CTM delta on stdin, or you can give the filename as an argument. If you do the latter, you make life a lot easier for your self, since the program can accept gzip'ed files and @@ -55,22 +55,22 @@ specify multiple deltas at one time, they will be proccessed one at a time. Deltas that are already applied will be ignored. The -.Nm ctm +.Nm command runs in a number of passes. It will process the entire input file in each pass, before commencing with the next pass. Before working on a file .Ar name -.Nm ctm +.Nm first checks for the existence of the file .Ar name.ctm . If this file exists, -.Nm ctm +.Nm works on it instead. Pass 1 will verify that the input file is OK. The syntax, the data and the global MD5 checksum will be checked. If any of these fail, -.Nm ctm +.Nm will simply reject the input file. Pass 2 will validate that the directory tree is in the state expected by @@ -82,7 +82,7 @@ If a had been specified using the .Fl B option, all files that would be modified by this -.Nm ctm +.Nm invocation are backed up to this file using the archiver command specified by the .Fl t @@ -92,7 +92,7 @@ option. The default archiver command is Pass 3 will actually apply the delta. The list of files that would be modified by -.Nm ctm +.Nm is subject to filtering regular expressions specified using the .Fl e @@ -280,18 +280,22 @@ options. .Sh HISTORY -Initial trials were run during the work on FreeBSD 1.1.5, and many bugs and +Initial trials were run during the work on +.Fx 1.1.5 , +and many bugs and methods were hashed out. The -.Nm ctm -command appeared in FreeBSD 2.1. +.Nm +command appeared in +.Fx 2.1 . .Sh AUTHORS The CTM system has been designed and implemented by -Poul-Henning Kamp +.An Poul-Henning Kamp .Aq phk@FreeBSD.org . -Joerg Wunsch wrote this man-page. -.Aq joerg@FreeBSD.org . +.An Joerg Wunsch +.Aq joerg@FreeBSD.org +wrote this man-page. diff --git a/usr.sbin/ctm/ctm/ctm.5 b/usr.sbin/ctm/ctm/ctm.5 index e492c7f..6f2cf96 100644 --- a/usr.sbin/ctm/ctm/ctm.5 +++ b/usr.sbin/ctm/ctm/ctm.5 @@ -10,7 +10,7 @@ .\" .\" CTM and ctm(1) by <phk@login.dknet.dk> .\" -.\" $Id$ +.\" $Id: ctm.5,v 1.5 1997/02/22 16:05:20 peter Exp $ .\" .Dd March 25, 1995 .Os @@ -21,7 +21,7 @@ .Sh DESCRIPTION The -.Nm ctm +.Nm transfers data in a specific file format, called a CTM delta. CTM deltas consist of control lines and data chunks. Each control @@ -61,7 +61,7 @@ meaning this is a UTC timestamp .Pc . The .Ar prefix -This field is currently not implemented. +field is currently not implemented. .It _END Ar md5 @@ -196,15 +196,19 @@ CTM_END 74ddd298d76215ae45a077a4b6a74e9c .Sh HISTORY -Initial trials ran during the FreeBSD 1.1.5, and many bugs and +Initial trials ran during the +.Fx 1.1.5 , +and many bugs and methods were hashed out. -The CTM system has been made publically available in FreeBSD 2.1. +The CTM system has been made publically available in +.Fx 2.1 . .Sh AUTHORS The CTM system has been designed and implemented by -Poul-Henning Kamp +.An Poul-Henning Kamp .Aq phk@FreeBSD.org . -Joerg Wunsch wrote this man-page. -.Aq joerg@FreeBSD.org . +.An Joerg Wunsch +.Aq joerg@FreeBSD.org +wrote this man-page. diff --git a/usr.sbin/ctm/ctm/ctm.c b/usr.sbin/ctm/ctm/ctm.c index c8f2645..a05b2d5 100644 --- a/usr.sbin/ctm/ctm/ctm.c +++ b/usr.sbin/ctm/ctm/ctm.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm.c,v 1.16 1997/02/22 16:05:21 peter Exp $ * * This is the client program of 'CTM'. It will apply a CTM-patch to a * collection of files. @@ -50,8 +50,6 @@ main(int argc, char **argv) { int stat=0, err=0; int c; - extern int optopt,optind; - extern char * optarg; unsigned applied = 0; FILE *statfile; struct CTM_Filter *nfilter = NULL; /* new filter */ @@ -90,10 +88,8 @@ main(int argc, char **argv) case 'e': /* filter expressions */ case 'x': if (NULL == (nfilter = Malloc(sizeof(struct CTM_Filter)))) { - fprintf(stderr, - "Out of memory for expressions: \"%s\"\n", - optarg); - stat++; + warnx("out of memory for expressions: \"%s\"", optarg); + stat++; break; } @@ -106,7 +102,7 @@ main(int argc, char **argv) regerror(err, &nfilter->CompiledRegex, errmsg, sizeof(errmsg)); - fprintf(stderr, "Regular expression: \"%s\"\n", errmsg); + warnx("regular expression: \"%s\"", errmsg); stat++; break; } @@ -125,21 +121,21 @@ main(int argc, char **argv) } break; case ':': - fprintf(stderr,"Option '%c' requires an argument.\n",optopt); + warnx("option '%c' requires an argument",optopt); stat++; break; case '?': - fprintf(stderr,"Option '%c' not supported.\n",optopt); + warnx("option '%c' not supported",optopt); stat++; break; default: - fprintf(stderr,"Option '%c' not yet implemented.\n",optopt); + warnx("option '%c' not yet implemented",optopt); break; } } if(stat) { - fprintf(stderr,"%d errors during option processing\n",stat); + warnx("%d errors during option processing",stat); return Exit_Pilot; } stat = Exit_Done; @@ -166,7 +162,7 @@ main(int argc, char **argv) else if((statfile = fopen(Buffer, "r")) == NULL) { if (Verbose > 0) - fprintf(stderr, "Warning: %s not found.\n", Buffer); + warnx("warning: %s not found", Buffer); } else { fscanf(statfile, "%*s %u", &applied); fclose(statfile); @@ -184,7 +180,7 @@ main(int argc, char **argv) stat = Exit_OK; if(Verbose > 0) - fprintf(stderr,"Exit(%d)\n",stat); + warnx("exit(%d)",stat); if (FilterList) for (nfilter = FilterList; nfilter; ) { @@ -210,13 +206,13 @@ Proc(char *filename, unsigned applied) strcpy(p,"gunzip < "); strcat(p,filename); f = popen(p,"r"); - if(!f) { perror(p); return Exit_Garbage; } + if(!f) { warn("%s", p); return Exit_Garbage; } } else { p = 0; f = fopen(filename,"r"); } if(!f) { - perror(filename); + warn("%s", filename); return Exit_Garbage; } @@ -233,7 +229,7 @@ Proc(char *filename, unsigned applied) int i; if(!f2) { - perror(fn); + warn("%s", fn); fclose(f); return Exit_Broke; } @@ -265,7 +261,7 @@ Proc(char *filename, unsigned applied) } else { pclose(f); f = popen(p,"r"); - if(!f) { perror(p); return Exit_Broke; } + if(!f) { warn("%s", p); return Exit_Broke; } } i=Pass2(f); @@ -275,7 +271,7 @@ Proc(char *filename, unsigned applied) } else { pclose(f); f = popen(p,"r"); - if(!f) { perror(p); return Exit_Broke; } + if(!f) { warn("%s", p); return Exit_Broke; } } if(i) { @@ -300,7 +296,7 @@ Proc(char *filename, unsigned applied) } else { pclose(f); f = popen(p,"r"); - if(!f) { perror(p); return Exit_Broke; } + if(!f) { warn("%s", p); return Exit_Broke; } } } diff --git a/usr.sbin/ctm/ctm/ctm.h b/usr.sbin/ctm/ctm/ctm.h index 52f8840..c53eb44 100644 --- a/usr.sbin/ctm/ctm/ctm.h +++ b/usr.sbin/ctm/ctm/ctm.h @@ -6,23 +6,24 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm.h,v 1.12 1997/02/22 16:05:21 peter Exp $ * */ +#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> -#include <regex.h> #define VERSION "2.0" #define MAXSIZE (1024*1024*10) diff --git a/usr.sbin/ctm/ctm/ctm_ed.c b/usr.sbin/ctm/ctm/ctm_ed.c index 67c2fae..31c5729 100644 --- a/usr.sbin/ctm/ctm/ctm_ed.c +++ b/usr.sbin/ctm/ctm/ctm_ed.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm_ed.c,v 1.8 1997/02/22 16:05:23 peter Exp $ * */ @@ -21,13 +21,13 @@ ctm_edit(u_char *script, int length, char *filein, char *fileout) fi = fopen(filein,"r"); if(!fi) { - perror(filein); + warn("%s", filein); return 8; } fo = fopen(fileout,"w"); if(!fo) { - perror(fileout); + warn("%s", fileout); fclose(fi); return 4; } @@ -96,17 +96,17 @@ ctm_edit(u_char *script, int length, char *filein, char *fileout) bye: if(fi) { if(fclose(fi) != 0) { - perror(filein); + warn("%s", filein); ret = 1; } } if(fo) { if(fflush(fo) != 0) { - perror(fileout); + warn("%s", fileout); ret = 1; } if(fclose(fo) != 0) { - perror(fileout); + warn("%s", fileout); ret = 1; } } diff --git a/usr.sbin/ctm/ctm/ctm_pass2.c b/usr.sbin/ctm/ctm/ctm_pass2.c index 6750d23..7c38ff0 100644 --- a/usr.sbin/ctm/ctm/ctm_pass2.c +++ b/usr.sbin/ctm/ctm/ctm_pass2.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm_pass2.c,v 1.15 1997/02/22 16:05:26 peter Exp $ * */ @@ -209,13 +209,13 @@ Pass2(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",p); if (pclose(ed)) { - perror(p); + warn("%s", p); WRONG } if(strcmp(md5,MD5File(p,md5_1))) { diff --git a/usr.sbin/ctm/ctm/ctm_pass3.c b/usr.sbin/ctm/ctm/ctm_pass3.c index 29a4def..9ca19d8 100644 --- a/usr.sbin/ctm/ctm/ctm_pass3.c +++ b/usr.sbin/ctm/ctm/ctm_pass3.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm_pass3.c,v 1.17 1997/02/22 16:05:27 peter Exp $ * */ @@ -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; @@ -178,11 +178,11 @@ Pass3(FILE *fd) 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); @@ -201,13 +201,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))) { diff --git a/usr.sbin/ctm/ctm/ctm_passb.c b/usr.sbin/ctm/ctm/ctm_passb.c index 0fce077..0cf657f 100644 --- a/usr.sbin/ctm/ctm/ctm_passb.c +++ b/usr.sbin/ctm/ctm/ctm_passb.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Joseph Koshy * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: ctm_passb.c,v 1.3 1997/02/22 16:05:28 peter Exp $ * */ @@ -38,7 +38,7 @@ PassB(FILE *fd) MD5Init (&ctx); sprintf(buf, TarCmd, BackupFile); b=popen(buf, "w"); - if(!b) { perror(buf); return Exit_Garbage; } + if(!b) { warn("%s", buf); return Exit_Garbage; } GETFIELD(p,' '); if(strcmp("CTM_BEGIN",p)) WRONG GETFIELD(p,' '); if(strcmp(Version,p)) WRONG @@ -117,7 +117,7 @@ PassB(FILE *fd) /* send name to the archiver for a backup */ cnt = strlen(name); if (cnt != fwrite(name,1,cnt,b) || EOF == fputc('\n',b)) { - perror(name); + warn("%s", name); pclose(b); WRONG; } |