SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
20
devel/tradcpp/Makefile
Normal file
20
devel/tradcpp/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
COMMENT = traditional (K&R-style) C preprocessor
|
||||
|
||||
V = 0.5.3
|
||||
DISTNAME = tradcpp-${V}
|
||||
|
||||
CATEGORIES = devel
|
||||
|
||||
HOMEPAGE = https://www.netbsd.org/~dholland/tradcpp/
|
||||
MASTER_SITES = https://ftp.NetBSD.org/pub/NetBSD/misc/dholland/
|
||||
|
||||
# BSD
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
||||
# uses pledge()
|
||||
WANTLIB = c
|
||||
|
||||
MAKE_FLAGS = BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man
|
||||
NO_TEST = Yes
|
||||
|
||||
.include <bsd.port.mk>
|
2
devel/tradcpp/distinfo
Normal file
2
devel/tradcpp/distinfo
Normal file
|
@ -0,0 +1,2 @@
|
|||
SHA256 (tradcpp-0.5.3.tar.gz) = 4XufQs90s2DVaRvFn7U/N+QVgcRbdfzWS7ll5eL+TF4=
|
||||
SIZE (tradcpp-0.5.3.tar.gz) = 38683
|
25
devel/tradcpp/patches/patch-files_c
Normal file
25
devel/tradcpp/patches/patch-files_c
Normal file
|
@ -0,0 +1,25 @@
|
|||
Index: files.c
|
||||
--- files.c.orig
|
||||
+++ files.c
|
||||
@@ -334,11 +334,7 @@ mkfilename(struct place *place, const char *dir, const
|
||||
|
||||
rlen = dlen + (needslash ? 1 : 0) + flen;
|
||||
ret = domalloc(rlen + 1);
|
||||
- strcpy(ret, dir);
|
||||
- if (needslash) {
|
||||
- strcat(ret, "/");
|
||||
- }
|
||||
- strcat(ret, file);
|
||||
+ snprintf(ret, rlen+1, "%s%s%s", dir, needslash ? "/" : "", file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -351,7 +347,7 @@ file_tryopen(const char *file)
|
||||
/* XXX check for non-regular files */
|
||||
|
||||
fd = open(file, O_RDONLY);
|
||||
- if (fd < 0) {
|
||||
+ if (fd == -1) {
|
||||
if (errno != ENOENT && errno != ENOTDIR) {
|
||||
complain(NULL, "%s: %s", file, strerror(errno));
|
||||
}
|
30
devel/tradcpp/patches/patch-macro_c
Normal file
30
devel/tradcpp/patches/patch-macro_c
Normal file
|
@ -0,0 +1,30 @@
|
|||
Index: macro.c
|
||||
--- macro.c.orig
|
||||
+++ macro.c
|
||||
@@ -850,20 +850,20 @@ expand_substitute(struct place *p, struct expstate *es
|
||||
ei = expansionitemarray_get(&es->curmacro->expansion, i);
|
||||
switch (ei->itemtype) {
|
||||
case EI_STRING:
|
||||
- strcat(ret, ei->ei_string);
|
||||
+ strlcat(ret, ei->ei_string, len + 1);
|
||||
break;
|
||||
case EI_PARAM:
|
||||
arg = stringarray_get(&es->args, ei->ei_param);
|
||||
- strcat(ret, arg);
|
||||
+ strlcat(ret, arg, len + 1);
|
||||
break;
|
||||
case EI_FILE:
|
||||
- strcat(ret, "\"");
|
||||
- strcat(ret, place_getname(p));
|
||||
- strcat(ret, "\"");
|
||||
+ strlcat(ret, "\"", len + 1);
|
||||
+ strlcat(ret, place_getname(p), len + 1);
|
||||
+ strlcat(ret, "\"", len + 1);
|
||||
break;
|
||||
case EI_LINE:
|
||||
snprintf(numbuf, sizeof(numbuf), "%u", p->line);
|
||||
- strcat(ret, numbuf);
|
||||
+ strlcat(ret, numbuf, len + 1);
|
||||
break;
|
||||
}
|
||||
}
|
23
devel/tradcpp/patches/patch-main_c
Normal file
23
devel/tradcpp/patches/patch-main_c
Normal file
|
@ -0,0 +1,23 @@
|
|||
Index: main.c
|
||||
--- main.c.orig
|
||||
+++ main.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -1053,6 +1054,11 @@ main(int argc, char *argv[])
|
||||
progname = strrchr(argv[0], '/');
|
||||
progname = progname == NULL ? argv[0] : progname + 1;
|
||||
complain_init(progname);
|
||||
+
|
||||
+ if (pledge("stdio rpath wpath cpath", NULL) == -1) {
|
||||
+ fprintf(stderr, "%s: pledge: %s", progname, strerror(errno));
|
||||
+ exit(1);
|
||||
+ }
|
||||
|
||||
init();
|
||||
|
41
devel/tradcpp/patches/patch-utils_c
Normal file
41
devel/tradcpp/patches/patch-utils_c
Normal file
|
@ -0,0 +1,41 @@
|
|||
Index: utils.c
|
||||
--- utils.c.orig
|
||||
+++ utils.c
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "utils.h"
|
||||
@@ -170,7 +171,7 @@ dostrdup(const char *s)
|
||||
|
||||
len = strlen(s);
|
||||
ret = domalloc(len+1);
|
||||
- strcpy(ret, s);
|
||||
+ strlcpy(ret, s, len+1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -182,8 +183,7 @@ dostrdup2(const char *s, const char *t)
|
||||
|
||||
len = strlen(s) + strlen(t);
|
||||
ret = domalloc(len+1);
|
||||
- strcpy(ret, s);
|
||||
- strcat(ret, t);
|
||||
+ snprintf(ret, len+1, "%s%s", s, t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -195,9 +195,7 @@ dostrdup3(const char *s, const char *t, const char *u)
|
||||
|
||||
len = strlen(s) + strlen(t) + strlen(u);
|
||||
ret = domalloc(len+1);
|
||||
- strcpy(ret, s);
|
||||
- strcat(ret, t);
|
||||
- strcat(ret, u);
|
||||
+ snprintf(ret, len+1, "%s%s%s", s, t, u);
|
||||
return ret;
|
||||
}
|
||||
|
10
devel/tradcpp/pkg/DESCR
Normal file
10
devel/tradcpp/pkg/DESCR
Normal file
|
@ -0,0 +1,10 @@
|
|||
tradcpp is a K&R-style ("traditional") C preprocessor. It was written to
|
||||
support historical uses of the C preprocessor for preprocessing things that
|
||||
aren't C, as the preprocessors that ship with C compilers are increasingly
|
||||
unsuitable for this task and/or don't provide a traditional mode at all.
|
||||
|
||||
In particular, tradcpp preserves whitespace as much as possible, so it can be
|
||||
used in contexts where whitespace is significant and/or rearranging whitespace
|
||||
causes things to break, such as makefiles. Preprocessing makefiles with cpp is
|
||||
a fairly common property of sufficiently old legacy build systems, including
|
||||
old versions of Emacs and anything that uses imake.
|
2
devel/tradcpp/pkg/PLIST
Normal file
2
devel/tradcpp/pkg/PLIST
Normal file
|
@ -0,0 +1,2 @@
|
|||
@bin bin/tradcpp
|
||||
@man man/man1/tradcpp.1
|
Loading…
Add table
Add a link
Reference in a new issue