1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-22 00:35:15 +00:00

Apply patches from base/ (default option).

PR:		183142
This commit is contained in:
Cy Schubert 2013-10-21 20:09:43 +00:00
parent f2d456fe96
commit df91c1ee66
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=331184
12 changed files with 441 additions and 1 deletions

View File

@ -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 <bsd.port.mk>
.include <bsd.port.pre.mk>
.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 <bsd.port.post.mk>

View File

@ -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;

View File

@ -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)));
}

View File

@ -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;

View File

@ -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;

View File

@ -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 || RCSv<VERSION(4)
- ? basefilename(RCSname)
- : getfullRCSname()
- );
+ case CVSHeader:
+ if (marker == Id || RCSv < VERSION(4) ||
+ (marker == LocalId && LocalIdMode == Id))
+ escape_string(out, basefilename(RCSname));
+ else if (marker == CVSHeader ||
+ (marker == LocalId && LocalIdMode == CVSHeader))
+ escape_string(out, getfullCVSname());
+ else
+ escape_string(out, getfullRCSname());
aprintf(out, " %s %s %s %s",
delta->num,
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

View File

@ -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;

View File

@ -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) &&

View File

@ -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);
+}

View File

@ -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 <return> 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) {

View File

@ -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 {

View File

@ -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);