aboutsummaryrefslogtreecommitdiff
path: root/textproc/bsdsort
diff options
context:
space:
mode:
authorGabor Kovesdan <gabor@FreeBSD.org>2012-05-09 10:44:16 +0000
committerGabor Kovesdan <gabor@FreeBSD.org>2012-05-09 10:44:16 +0000
commitc6c075521a11703816e55e217f6601b0ff73ea22 (patch)
tree7380947866e4027b12cb88922ed719cd7a9b9882 /textproc/bsdsort
parent83688fcd9f5ba1aac87ece1653a4e57670d3724f (diff)
downloadports-c6c075521a11703816e55e217f6601b0ff73ea22.tar.gz
ports-c6c075521a11703816e55e217f6601b0ff73ea22.zip
- Add patch to fix obsolete keys
- Bump PORTREVISION
Notes
Notes: svn path=/head/; revision=296287
Diffstat (limited to 'textproc/bsdsort')
-rw-r--r--textproc/bsdsort/Makefile1
-rw-r--r--textproc/bsdsort/files/patch-obsolete-keys.diff96
2 files changed, 97 insertions, 0 deletions
diff --git a/textproc/bsdsort/Makefile b/textproc/bsdsort/Makefile
index 765e0cea8c4b..d879a1583ecf 100644
--- a/textproc/bsdsort/Makefile
+++ b/textproc/bsdsort/Makefile
@@ -7,6 +7,7 @@
PORTNAME= sort
PORTVERSION= 20120508
+PORTREVISION= 1
CATEGORIES= textproc
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= gabor
diff --git a/textproc/bsdsort/files/patch-obsolete-keys.diff b/textproc/bsdsort/files/patch-obsolete-keys.diff
new file mode 100644
index 000000000000..318627d4fb61
--- /dev/null
+++ b/textproc/bsdsort/files/patch-obsolete-keys.diff
@@ -0,0 +1,96 @@
+--- 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))