1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

- Update to 20120716

Note for -CURRENT users: BSD sort is already the default in recent -CURRENT
but with threading disabled. You can easily try threaded BSD sort by
installing this port.
This commit is contained in:
Gabor Kovesdan 2012-07-16 11:11:15 +00:00
parent 721490520d
commit da56a41ee6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=300939
3 changed files with 14 additions and 110 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= sort
PORTVERSION= 20120508
PORTREVISION= 1
PORTVERSION= 20120716
CATEGORIES= textproc
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= gabor
@ -25,28 +24,29 @@ MAN1= sort.1
MAKE_ENV+= BINDIR="${PREFIX}/bin" \
MANDIR="${MANPREFIX}/man/man" \
CATDIR="${MANPREFIX}/man/man" \
NLSDIR="${PREFIX}/share/nls"
NLSDIR="${PREFIX}/share/nls" \
MK_GNU_SORT="no"
CFLAGS+= -std=c99
OPTIONS= THREADS "Compile with threads support" on \
NLS "Compile with NLS support" on \
OVERWRITE_BASE "Replaces base GNU sort" off
OPTIONS_DEFINE= THREADS NLS OVERWRITE_BASE
OVERWRITE_BASE_DESC= "Replaces base GNU sort"
OPTIONS_DEFAULT= THREADS NLS
.include <bsd.port.pre.mk>
.if defined(WITHOUT_NLS)
.if ${PORT_OPTIONS:MNLS}
PLIST_SUB+= NLS=""
.else
MAKE_ENV+= WITHOUT_NLS=yes
PLIST_SUB+= NLS="@comment "
.else
PLIST_SUB+= NLS=""
.endif
.if defined(WITHOUT_THREADS)
MAKE_ENV+= WITHOUT_THREADS=yes
.if ${PORT_OPTIONS:MTHREADS}
MAKE_ENV+= WITH_THREADS=yes
.endif
.if defined(WITH_OVERWRITE_BASE)
.if ${PORT_OPTIONS:MOVERWRITE_BASE}
PREFIX= /usr
PLIST_SUB+= OVERWRITE_BASE="" NO_OVERWRITE_BASE="@comment "
.else

View File

@ -1,2 +1,2 @@
SHA256 (sort-20120508.tar.gz) = df0f9a7a776cccbc224b85fdf484de4babc7793b67a74df19ab3a9b156340522
SIZE (sort-20120508.tar.gz) = 51759
SHA256 (sort-20120716.tar.gz) = a30c577b78730f6acf2fe6aed154dbe906fc6834998c8f67c9b7e30fb10755a4
SIZE (sort-20120716.tar.gz) = 40754

View File

@ -1,96 +0,0 @@
--- sort.c.orig Tue May 08 17:38:20 2012 +0200
+++ sort.c Wed May 09 12:37:18 2012 +0200
@@ -779,17 +779,17 @@
* Parse POS in +POS -POS option.
*/
static int
-parse_pos_obs(const char *s, int *nf, int *nc)
+parse_pos_obs(const char *s, int *nf, int *nc, char* sopts)
{
regex_t re;
- regmatch_t pmatch[3];
+ regmatch_t pmatch[4];
char *c, *f;
- const char *sregexp = "^([0-9]+)(\\.[0-9]+)?$";
+ const char *sregexp = "^([0-9]+)(\\.[0-9]+)?([A-Za-z]+)?$";
int ret;
size_t len, nmatch;
ret = -1;
- nmatch = 3;
+ nmatch = 4;
c = f = NULL;
*nc = *nf = 0;
@@ -829,6 +829,14 @@
errx(2, getstr(11));
}
+ if (pmatch[3].rm_eo > pmatch[3].rm_so) {
+
+ len = pmatch[3].rm_eo - pmatch[3].rm_so;
+
+ strncpy(sopts, s + pmatch[3].rm_so, len);
+ sopts[len] = '\0';
+ }
+
ret = 0;
end:
@@ -856,10 +864,12 @@
if (strlen(arg1) > 1 && arg1[0] == '+') {
int c1, f1;
+ char sopts1[128];
+ sopts1[0] = 0;
c1 = f1 = 0;
- if (parse_pos_obs(arg1 + 1, &f1, &c1) < 0)
+ if (parse_pos_obs(arg1 + 1, &f1, &c1, sopts1) < 0)
continue;
else {
f1 += 1;
@@ -870,15 +880,17 @@
if (strlen(arg2) > 1 &&
arg2[0] == '-') {
int c2, f2;
+ char sopts2[128];
+ sopts2[0] = 0;
c2 = f2 = 0;
if (parse_pos_obs(arg2 + 1,
- &f2, &c2) >= 0) {
+ &f2, &c2, sopts2) >= 0) {
if (c2 > 0)
f2 += 1;
- sprintf(sopt, "-k%d.%d,%d.%d",
- f1, c1, f2, c2);
+ sprintf(sopt, "-k%d.%d%s,%d.%d%s",
+ f1, c1, sopts1, f2, c2, sopts2);
argv[i] = sort_strdup(sopt);
for (int j = i + 1; j + 1 < *argc; j++)
argv[j] = argv[j + 1];
@@ -976,6 +988,21 @@
set_tmpdir();
set_sort_opts();
+#if 0
+ {
+ static int counter = 0;
+ char fn[128];
+ sprintf(fn, "/var/tmp/debug.sort.%d", counter++);
+ FILE* f = fopen(fn, "w");
+ fprintf(f, ">>sort>>");
+ for (int i = 0; i < argc; i++) {
+ fprintf(f, "<%s>", argv[i]);
+ }
+ fprintf(f, "<<sort<<\n");
+ fclose(f);
+ }
+#endif
+
fix_obsolete_keys(&argc, argv);
while (((c = getopt_long(argc, argv, OPTIONS, long_options, NULL))