From df91c1ee66282ae547db2447e928fecb42ff5c80 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Mon, 21 Oct 2013 20:09:43 +0000 Subject: [PATCH] Apply patches from base/ (default option). PR: 183142 --- devel/rcs57/Makefile | 24 ++++- devel/rcs57/files/freebsd-src-ident.c | 11 +++ devel/rcs57/files/freebsd-src-maketime.c | 11 +++ devel/rcs57/files/freebsd-src-rcsbase.h | 38 ++++++++ devel/rcs57/files/freebsd-src-rcsdiff.c | 11 +++ devel/rcs57/files/freebsd-src-rcsedit.c | 49 ++++++++++ devel/rcs57/files/freebsd-src-rcsfnms.c | 74 +++++++++++++++ devel/rcs57/files/freebsd-src-rcskeep.c | 10 ++ devel/rcs57/files/freebsd-src-rcskeys.c | 114 +++++++++++++++++++++++ devel/rcs57/files/freebsd-src-rcsrev.c | 24 +++++ devel/rcs57/files/freebsd-src-rcsutil.c | 18 ++++ devel/rcs57/files/freebsd-src-rlog.c | 58 ++++++++++++ 12 files changed, 441 insertions(+), 1 deletion(-) create mode 100644 devel/rcs57/files/freebsd-src-ident.c create mode 100644 devel/rcs57/files/freebsd-src-maketime.c create mode 100644 devel/rcs57/files/freebsd-src-rcsbase.h create mode 100644 devel/rcs57/files/freebsd-src-rcsdiff.c create mode 100644 devel/rcs57/files/freebsd-src-rcsedit.c create mode 100644 devel/rcs57/files/freebsd-src-rcsfnms.c create mode 100644 devel/rcs57/files/freebsd-src-rcskeep.c create mode 100644 devel/rcs57/files/freebsd-src-rcskeys.c create mode 100644 devel/rcs57/files/freebsd-src-rcsrev.c create mode 100644 devel/rcs57/files/freebsd-src-rcsutil.c create mode 100644 devel/rcs57/files/freebsd-src-rlog.c diff --git a/devel/rcs57/Makefile b/devel/rcs57/Makefile index 2bd53385114a..88326115f529 100644 --- a/devel/rcs57/Makefile +++ b/devel/rcs57/Makefile @@ -10,6 +10,10 @@ PKGNAMESUFFIX= 57 MAINTAINER= cy@FreeBSD.org COMMENT= Version control system (as was in FreeBSD prior to removal) +OPTIONS_DEFINE= FREEBSD +OPTIONS_DEFAULT= FREEBSD +FREEBSD_DESC= Apply FreeBSD patches + CONFLICTS= rcs-5.[89]* LICENSE= GPLv2 @@ -21,4 +25,22 @@ MAN1= ci.1 co.1 ident.1 merge.1 rcs.1 rcsclean.1 rcsdiff.1 rcsintro.1 \ MAN5= rcsfile.5 NO_STAGE= yes -.include + +.include + +.if ${PORT_OPTIONS:MFREEBSD} +EXTRA_PATCHES+= ${FILESDIR}/freebsd-src-ident.c \ + ${FILESDIR}/freebsd-src-maketime.c \ + ${FILESDIR}/freebsd-src-rcsbase.h \ + ${FILESDIR}/freebsd-src-rcsedit.c \ + ${FILESDIR}/freebsd-src-rcsfnms.c \ + ${FILESDIR}/freebsd-src-rcskeep.c \ + ${FILESDIR}/freebsd-src-rcskeys.c \ + ${FILESDIR}/freebsd-src-rcsrev.c \ + ${FILESDIR}/freebsd-src-rcsutil.c \ + ${FILESDIR}/freebsd-src-rcsdiff.c \ + ${FILESDIR}/freebsd-src-rlog.c + +.endif + +.include diff --git a/devel/rcs57/files/freebsd-src-ident.c b/devel/rcs57/files/freebsd-src-ident.c new file mode 100644 index 000000000000..af6c02e2274e --- /dev/null +++ b/devel/rcs57/files/freebsd-src-ident.c @@ -0,0 +1,11 @@ +--- src/ident.c ++++ freebsd/gnu/usr.bin/rcs/ident/ident.c +@@ -234,7 +233,7 @@ match(fp) /* group substring between t + if (c == EOF && feof(fp) | ferror(fp)) + return c; + switch (ctab[c]) { +- case LETTER: case Letter: ++ case LETTER: case Letter: case DIGIT: + *tp++ = c; + if (tp < line+sizeof(line)-4) + break; diff --git a/devel/rcs57/files/freebsd-src-maketime.c b/devel/rcs57/files/freebsd-src-maketime.c new file mode 100644 index 000000000000..53d6ac969f86 --- /dev/null +++ b/devel/rcs57/files/freebsd-src-maketime.c @@ -0,0 +1,11 @@ +--- src/maketime.c ++++ freebsd/gnu/usr.bin/rcs/lib/maketime.c 1999-08-28 03:37:10.000000000 +0400 +@@ -335,7 +335,7 @@ main(argc, argv) int argc; char **argv; + time_t default_time = time((time_t *)0); + long default_zone = argv[1] ? atol(argv[1]) : 0; + char buf[1000]; +- while (gets(buf)) { ++ while (fgets(buf, 1000, stdin)) { + time_t t = str2time(buf, default_time, default_zone); + printf("%s", asctime(gmtime(&t))); + } diff --git a/devel/rcs57/files/freebsd-src-rcsbase.h b/devel/rcs57/files/freebsd-src-rcsbase.h new file mode 100644 index 000000000000..f7295876000e --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsbase.h @@ -0,0 +1,38 @@ +--- src/rcsbase.h ++++ freebsd/gnu/usr.bin/rcs/lib/rcsbase.h 1999-08-28 03:37:10.000000000 +0400 +@@ -427,10 +426,12 @@ struct assoc { + #define REVISION "Revision" + #define SOURCE "Source" + #define STATE "State" +-#define keylength 8 /* max length of any of the above keywords */ ++#define CVSHEADER "CVSHeader" ++#define keylength 9 /* max length of any of the above keywords */ + + enum markers { Nomatch, Author, Date, Header, Id, +- Locker, Log, Name, RCSfile, Revision, Source, State }; ++ Locker, Log, Name, RCSfile, Revision, Source, State, CVSHeader, ++ LocalId }; + /* This must be in the same order as rcskeys.c's Keyword[] array. */ + + #define DELNUMFORM "\n\n%s\n%s\n" +@@ -501,6 +502,7 @@ RILE *rcsreadopen P((struct buf*,struct + char *bufenlarge P((struct buf*,char const**)); + char const *basefilename P((char const*)); + char const *getfullRCSname P((void)); ++char const *getfullCVSname P((void)); + char const *maketemp P((int)); + char const *rcssuffix P((char const*)); + int pairnames P((int,char**,RILE*(*)P((struct buf*,struct stat*,int)),int,int)); +@@ -531,8 +533,11 @@ extern struct buf prevauthor, prevdate, + int getoldkeys P((RILE*)); + + /* rcskeys */ +-extern char const *const Keyword[]; ++extern char const *Keyword[]; ++extern enum markers LocalIdMode; + enum markers trymatch P((char const*)); ++void setRCSLocalId(char const *); ++void setIncExc(char const *); + + /* rcslex */ + extern FILE *foutptr; diff --git a/devel/rcs57/files/freebsd-src-rcsdiff.c b/devel/rcs57/files/freebsd-src-rcsdiff.c new file mode 100644 index 000000000000..65473f699a1c --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsdiff.c @@ -0,0 +1,11 @@ +--- src/rcsdiff.c ++++ freebsd/gnu/usr.bin/rcs/rcsdiff/rcsdiff.c 1999-08-28 03:37:10.000000000 +0400 +@@ -216,7 +215,7 @@ mainProg(rcsdiffId, "rcsdiff", "$Id: rcs + /* fall into */ + case 'C': case 'F': case 'I': case 'L': case 'W': + #if DIFF_L +- if (c == 'L' && ++file_labels == 2) ++ if (c == 'L' && file_labels++ == 2) + faterror("too many -L options"); + #endif + *dcp++ = c; diff --git a/devel/rcs57/files/freebsd-src-rcsedit.c b/devel/rcs57/files/freebsd-src-rcsedit.c new file mode 100644 index 000000000000..ba7ab2d6173a --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsedit.c @@ -0,0 +1,49 @@ +--- src/rcsedit.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcsedit.c +@@ -1050,12 +1049,17 @@ keyreplace(marker, delta, delimstuffed, + aputs(date2str(date,datebuf), out); + break; + case Id: ++ case LocalId: + case Header: +- escape_string(out, +- marker==Id || RCSvnum, + date2str(date, datebuf), +@@ -1503,6 +1507,9 @@ makedirtemp(isworkfile) + register size_t dl; + register struct buf *bn; + register char const *name = isworkfile ? workname : RCSname; ++# if has_mktemp ++ int fd; ++# endif + + dl = basefilename(name) - name; + bn = &dirtpname[newRCSdirtp_index + isworkfile]; +@@ -1521,10 +1528,12 @@ makedirtemp(isworkfile) + catchints(); + # if has_mktemp + VOID strcpy(tp, "XXXXXX"); +- if (!mktemp(np) || !*np) ++ fd = mkstemp(np); ++ if (fd < 0 || !*np) + faterror("can't make temporary pathname `%.*s_%cXXXXXX'", + (int)dl, name, '0'+isworkfile + ); ++ close(fd); + # else + /* + * Posix 1003.1-1990 has no reliable way diff --git a/devel/rcs57/files/freebsd-src-rcsfnms.c b/devel/rcs57/files/freebsd-src-rcsfnms.c new file mode 100644 index 000000000000..09fa8b2b6bc3 --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsfnms.c @@ -0,0 +1,74 @@ +--- src/rcsfnms.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcsfnms.c +@@ -285,6 +284,9 @@ maketemp(n) + { + char *p; + char const *t = tpnames[n]; ++# if has_mktemp ++ int fd; ++# endif + + if (t) + return t; +@@ -296,10 +298,12 @@ maketemp(n) + size_t tplen = dir_useful_len(tp); + p = testalloc(tplen + 10); + VOID sprintf(p, "%.*s%cT%cXXXXXX", (int)tplen, tp, SLASH, '0'+n); +- if (!mktemp(p) || !*p) ++ fd = mkstemp(p); ++ if (fd < 0 || !*p) + faterror("can't make temporary pathname `%.*s%cT%cXXXXXX'", + (int)tplen, tp, SLASH, '0'+n + ); ++ close(fd); + # else + static char tpnamebuf[TEMPNAMES][L_tmpnam]; + p = tpnamebuf[n]; +@@ -868,6 +872,47 @@ getfullRCSname() + } + } + ++/* Derived from code from the XFree86 project */ ++ char const * ++getfullCVSname() ++/* Function: returns a pointer to the path name of the RCS file with the ++ * CVSROOT part stripped off, and with 'Attic/' stripped off (if present). ++ */ ++{ ++ ++#define ATTICDIR "/Attic" ++ ++ char const *namebuf = getfullRCSname(); ++ char *cvsroot = cgetenv("CVSROOT"); ++ int cvsrootlen; ++ char *c = NULL; ++ int alen = strlen(ATTICDIR); ++ ++ if ((c = strrchr(namebuf, '/')) != NULL) { ++ if (namebuf - c >= alen) { ++ if (!strncmp(c - alen, ATTICDIR, alen)) { ++ while(*c != '\0') { ++ *(c - alen) = *c; ++ c++; ++ } ++ *(c - alen) = '\0'; ++ } ++ } ++ } ++ ++ if (!cvsroot) ++ return(namebuf); ++ else ++ { ++ cvsrootlen = strlen(cvsroot); ++ if (!strncmp(namebuf, cvsroot, cvsrootlen) && ++ namebuf[cvsrootlen] == '/') ++ return(namebuf + cvsrootlen + 1); ++ else ++ return(namebuf); ++ } ++} ++ + static size_t + dir_useful_len(d) + char const *d; diff --git a/devel/rcs57/files/freebsd-src-rcskeep.c b/devel/rcs57/files/freebsd-src-rcskeep.c new file mode 100644 index 000000000000..7de06d0aa635 --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcskeep.c @@ -0,0 +1,10 @@ +--- src/rcskeep.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcskeep.c 1999-08-28 03:37:10.000000000 +0400 +@@ -192,6 +191,7 @@ getoldkeys(fp) + break; + case Header: + case Id: ++ case LocalId: + if (!( + getval(fp, (struct buf*)0, false) && + keeprev(fp) && diff --git a/devel/rcs57/files/freebsd-src-rcskeys.c b/devel/rcs57/files/freebsd-src-rcskeys.c new file mode 100644 index 000000000000..5c193af39357 --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcskeys.c @@ -0,0 +1,114 @@ +--- src/rcskeys.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcskeys.c +@@ -67,14 +66,22 @@ + libId(keysId, "$Id: rcskeys.c,v 5.4 1995/06/16 06:19:24 eggert Exp $") + + +-char const *const Keyword[] = { ++char const *Keyword[] = { + /* This must be in the same order as rcsbase.h's enum markers type. */ + 0, + AUTHOR, DATE, HEADER, IDH, +- LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE ++ LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE, CVSHEADER, ++ NULL + }; + +- ++/* Expand all keywords by default */ ++static int ExpandKeyword[] = { ++ false, ++ true, true, true, true, ++ true, true, true, true, true, true, true, true, ++ true ++}; ++enum markers LocalIdMode = Id; + + enum markers + trymatch(string) +@@ -87,8 +94,12 @@ trymatch(string) + register int j; + register char const *p, *s; + for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) { ++ if (!ExpandKeyword[j]) ++ continue; + /* try next keyword */ + p = Keyword[j]; ++ if (p == NULL) ++ continue; + s = string; + while (*p++ == *s++) { + if (!*p) +@@ -104,3 +115,72 @@ trymatch(string) + return(Nomatch); + } + ++ void ++setIncExc(arg) ++ char const *arg; ++/* Sets up the ExpandKeyword table according to command-line flags */ ++{ ++ char *key; ++ char *copy, *next; ++ int include = 0, j; ++ ++ copy = strdup(arg); ++ next = copy; ++ switch (*next++) { ++ case 'e': ++ include = false; ++ break; ++ case 'i': ++ include = true; ++ break; ++ default: ++ free(copy); ++ return; ++ } ++ if (include) ++ for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) ++ ExpandKeyword[j] = false; ++ key = strtok(next, ","); ++ while (key) { ++ for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) { ++ if (Keyword[j] == NULL) ++ continue; ++ if (!strcmp(key, Keyword[j])) ++ ExpandKeyword[j] = include; ++ } ++ key = strtok(NULL, ","); ++ } ++ free(copy); ++ return; ++} ++ ++ void ++setRCSLocalId(string) ++ char const *string; ++/* function: sets local RCS id and RCSLOCALID envariable */ ++{ ++ static char local_id[keylength+1]; ++ char *copy, *next, *key; ++ int j; ++ ++ copy = strdup(string); ++ next = copy; ++ key = strtok(next, "="); ++ if (strlen(key) > keylength) ++ faterror("LocalId is too long"); ++ VOID strcpy(local_id, key); ++ Keyword[LocalId] = local_id; ++ ++ /* options? */ ++ while (key = strtok(NULL, ",")) { ++ if (!strcmp(key, Keyword[Id])) ++ LocalIdMode=Id; ++ else if (!strcmp(key, Keyword[Header])) ++ LocalIdMode=Header; ++ else if (!strcmp(key, Keyword[CVSHeader])) ++ LocalIdMode=CVSHeader; ++ else ++ error("Unknown LocalId mode"); ++ } ++ free(copy); ++} diff --git a/devel/rcs57/files/freebsd-src-rcsrev.c b/devel/rcs57/files/freebsd-src-rcsrev.c new file mode 100644 index 000000000000..d7b828a08b8a --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsrev.c @@ -0,0 +1,24 @@ +--- src/rcsrev.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcsrev.c 1999-08-28 03:37:10.000000000 +0400 +@@ -883,17 +882,17 @@ int argc; char * argv[]; + /* all output goes to stderr, to have diagnostics and */ + /* errors in sequence. */ + aputs("\nEnter revision number or or '.': ",stderr); +- if (!gets(symrevno)) break; ++ if (!fgets(symrevno, 100, stdin)) break; + if (*symrevno == '.') break; + aprintf(stderr,"%s;\n",symrevno); + expandsym(symrevno,&numricrevno); + aprintf(stderr,"expanded number: %s; ",numricrevno.string); + aprintf(stderr,"Date: "); +- gets(date); aprintf(stderr,"%s; ",date); ++ fgets(date, 20, stdin); aprintf(stderr,"%s; ",date); + aprintf(stderr,"Author: "); +- gets(author); aprintf(stderr,"%s; ",author); ++ fgets(author, 20, stdin); aprintf(stderr,"%s; ",author); + aprintf(stderr,"State: "); +- gets(state); aprintf(stderr, "%s;\n", state); ++ fgets(state, 20, stdin); aprintf(stderr, "%s;\n", state); + target = genrevs(numricrevno.string, *date?date:(char *)0, *author?author:(char *)0, + *state?state:(char*)0, &gendeltas); + if (target) { diff --git a/devel/rcs57/files/freebsd-src-rcsutil.c b/devel/rcs57/files/freebsd-src-rcsutil.c new file mode 100644 index 000000000000..4bce25e02882 --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rcsutil.c @@ -0,0 +1,18 @@ +--- src/rcsutil.c ++++ freebsd/gnu/usr.bin/rcs/lib/rcsutil.c 1999-08-28 03:37:10.000000000 +0400 +@@ -1231,8 +1230,15 @@ getRCSINIT(argc, argv, newargv) + char **argv, ***newargv; + { + register char *p, *q, **pp; ++ char const *ev; + size_t n; + ++ if ((ev = cgetenv("RCSLOCALID"))) ++ setRCSLocalId(ev); ++ ++ if ((ev = cgetenv("RCSINCEXC"))) ++ setIncExc(ev); ++ + if (!(q = cgetenv("RCSINIT"))) + *newargv = argv; + else { diff --git a/devel/rcs57/files/freebsd-src-rlog.c b/devel/rcs57/files/freebsd-src-rlog.c new file mode 100644 index 000000000000..f41a4d7ee33f --- /dev/null +++ b/devel/rcs57/files/freebsd-src-rlog.c @@ -0,0 +1,58 @@ +--- src/rlog.c ++++ freebsd/gnu/usr.bin/rcs/rlog/rlog.c 1999-08-28 03:37:10.000000000 +0400 +@@ -222,7 +221,7 @@ + mainProg(rlogId, "rlog", "$Id: rlog.c,v 5.18 1995/06/16 06:19:24 eggert Exp $") + { + static char const cmdusage[] = +- "\nrlog usage: rlog -{bhLNRt} -ddates -l[lockers] -r[revs] -sstates -Vn -w[logins] -xsuff -zzone file ..."; ++ "\nrlog usage: rlog -{bhLNRt} -v[string] -ddates -l[lockers] -r[revs] -sstates -Vn -w[logins] -xsuff -zzone file ..."; + + register FILE *out; + char *a, **newargv; +@@ -239,9 +238,12 @@ mainProg(rlogId, "rlog", "$Id: rlog.c,v + int pre5; + int shownames; + int revno; ++ int versionlist; ++ char *vstring; + + descflag = selectflag = shownames = true; +- onlylockflag = onlyRCSflag = false; ++ versionlist = onlylockflag = onlyRCSflag = false; ++ vstring=0; + out = stdout; + suffixes = X_DEFAULT; + +@@ -318,6 +320,11 @@ mainProg(rlogId, "rlog", "$Id: rlog.c,v + setRCSversion(*argv); + break; + ++ case 'v': ++ versionlist = true; ++ vstring = a; ++ break; ++ + default: + unknown: + error("unknown option: %s%s", *argv, cmdusage); +@@ -371,6 +378,12 @@ mainProg(rlogId, "rlog", "$Id: rlog.c,v + if (onlylockflag && !Locks) + continue; + ++ if ( versionlist ) { ++ gettree(); ++ aprintf(out, "%s%s %s\n", vstring, workname, tiprev()); ++ continue; ++ } ++ + if ( onlyRCSflag ) { + aprintf(out, "%s\n", RCSname); + continue; +@@ -462,6 +475,7 @@ mainProg(rlogId, "rlog", "$Id: rlog.c,v + putrunk(); + putree(Head); + } ++ aputs("----------------------------\n", out); + aputs("=============================================================================\n",out); + } + Ofclose(out);