summaryrefslogtreecommitdiff
path: root/Build/source/texk/detex
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-06-28 06:17:11 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-06-28 06:17:11 +0000
commitd255e898b99b63f264f3a3848a0cfe80473b4c84 (patch)
tree3566826ff4a05d51e97c8fe9378d72b74062c909 /Build/source/texk/detex
parent0277c6bc6f2dd4647bc8a7e14640bdf262a45a34 (diff)
Replace BSD string functions (removed in POSIX.1-2008) by SYSV/ANSI equivalents
git-svn-id: svn://tug.org/texlive/trunk@30997 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/detex')
-rw-r--r--Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog5
-rw-r--r--Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings52
-rw-r--r--Build/source/texk/detex/detex-2.8/detex.c12
-rw-r--r--Build/source/texk/detex/detex-2.8/detex.l12
4 files changed, 69 insertions, 12 deletions
diff --git a/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog b/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog
index b979ffb58a3..8ec8c93eaef 100644
--- a/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog
+++ b/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ patch-10-ANSI (new): Replace index() => strchr() and
+ rindex() => strrchr().
+
2012-08-24 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-08-kpathsea (new): Use kpse_program_name.
diff --git a/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings b/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings
new file mode 100644
index 00000000000..8f03d7b26af
--- /dev/null
+++ b/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings
@@ -0,0 +1,52 @@
+diff -ur detex-2.8.orig/detex.l detex-2.8/detex.l
+--- detex-2.8.orig/detex.l 2012-08-24 10:51:12.000000000 +0200
++++ detex-2.8/detex.l 2013-06-27 18:49:05.000000000 +0200
+@@ -70,10 +70,10 @@
+
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+-#define index strchr
+-#define rindex strrchr
+ #else
+ #include <strings.h>
++#define strchr index
++#define strrchr rindex
+ #endif
+ #ifndef MAXPATHLEN
+ #include <sys/param.h>
+@@ -445,7 +445,7 @@
+ kpse_set_program_name (rgsbArgs[0], NULL);
+ sbProgName = kpse_program_name;
+ #else
+- if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL)
++ if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL)
+ sbProgName++;
+ else
+ sbProgName = rgsbArgs[0];
+@@ -701,7 +701,7 @@
+ if (csbIncList == 0) /* no list */
+ return(1);
+ (void)strcpy(sbBase, sbFile);
+- if ((pch = rindex(sbBase, '.')) != NULL)
++ if ((pch = strrchr(sbBase, '.')) != NULL)
+ *pch = '\0';
+ i = 0;
+ while ((i < csbIncList) && rgsbIncList[i])
+@@ -770,7 +770,7 @@
+
+ while (sbList && *sbList && csbList < csbMax) {
+ rgsbList[csbList++] = sbList;
+- if ((sbList = index(sbList, chSep)))
++ if ((sbList = strchr(sbList, chSep)))
+ *sbList++ = '\0';
+ }
+ return(sbList && *sbList ? my_ERROR : csbList);
+@@ -815,7 +815,7 @@
+ #endif
+
+ /* If sbFile ends in .tex then it must be there */
+- if ((pch = rindex(sbFullPath, '.')) != NULL
++ if ((pch = strrchr(sbFullPath, '.')) != NULL
+ && (strcmp(pch, ".tex") == 0))
+ {
+ if ((fp = fopen(sbFullPath, "r")) != NULL)
diff --git a/Build/source/texk/detex/detex-2.8/detex.c b/Build/source/texk/detex/detex-2.8/detex.c
index c6114c5b71d..58188654f02 100644
--- a/Build/source/texk/detex/detex-2.8/detex.c
+++ b/Build/source/texk/detex/detex-2.8/detex.c
@@ -1531,10 +1531,10 @@ static char rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.22 2007/0
#ifdef HAVE_STRING_H
#include <string.h>
-#define index strchr
-#define rindex strrchr
#else
#include <strings.h>
+#define strchr index
+#define strrchr rindex
#endif
#ifndef MAXPATHLEN
#include <sys/param.h>
@@ -3759,7 +3759,7 @@ main(int cArgs, char *rgsbArgs[])
kpse_set_program_name (rgsbArgs[0], NULL);
sbProgName = kpse_program_name;
#else
- if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL)
+ if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL)
sbProgName++;
else
sbProgName = rgsbArgs[0];
@@ -4015,7 +4015,7 @@ InList(char *sbFile)
if (csbIncList == 0) /* no list */
return(1);
(void)strcpy(sbBase, sbFile);
- if ((pch = rindex(sbBase, '.')) != NULL)
+ if ((pch = strrchr(sbBase, '.')) != NULL)
*pch = '\0';
i = 0;
while ((i < csbIncList) && rgsbIncList[i])
@@ -4084,7 +4084,7 @@ SeparateList(char *sbList, char *rgsbList[], char chSep, int csbMax)
while (sbList && *sbList && csbList < csbMax) {
rgsbList[csbList++] = sbList;
- if ((sbList = index(sbList, chSep)))
+ if ((sbList = strchr(sbList, chSep)))
*sbList++ = '\0';
}
return(sbList && *sbList ? my_ERROR : csbList);
@@ -4129,7 +4129,7 @@ TexOpen(char *sbFile)
#endif
/* If sbFile ends in .tex then it must be there */
- if ((pch = rindex(sbFullPath, '.')) != NULL
+ if ((pch = strrchr(sbFullPath, '.')) != NULL
&& (strcmp(pch, ".tex") == 0))
{
if ((fp = fopen(sbFullPath, "r")) != NULL)
diff --git a/Build/source/texk/detex/detex-2.8/detex.l b/Build/source/texk/detex/detex-2.8/detex.l
index aab1d7096ef..23c22e35f69 100644
--- a/Build/source/texk/detex/detex-2.8/detex.l
+++ b/Build/source/texk/detex/detex-2.8/detex.l
@@ -70,10 +70,10 @@ static char rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.22 2007/0
#ifdef HAVE_STRING_H
#include <string.h>
-#define index strchr
-#define rindex strrchr
#else
#include <strings.h>
+#define strchr index
+#define strrchr rindex
#endif
#ifndef MAXPATHLEN
#include <sys/param.h>
@@ -445,7 +445,7 @@ main(int cArgs, char *rgsbArgs[])
kpse_set_program_name (rgsbArgs[0], NULL);
sbProgName = kpse_program_name;
#else
- if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL)
+ if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL)
sbProgName++;
else
sbProgName = rgsbArgs[0];
@@ -701,7 +701,7 @@ InList(char *sbFile)
if (csbIncList == 0) /* no list */
return(1);
(void)strcpy(sbBase, sbFile);
- if ((pch = rindex(sbBase, '.')) != NULL)
+ if ((pch = strrchr(sbBase, '.')) != NULL)
*pch = '\0';
i = 0;
while ((i < csbIncList) && rgsbIncList[i])
@@ -770,7 +770,7 @@ SeparateList(char *sbList, char *rgsbList[], char chSep, int csbMax)
while (sbList && *sbList && csbList < csbMax) {
rgsbList[csbList++] = sbList;
- if ((sbList = index(sbList, chSep)))
+ if ((sbList = strchr(sbList, chSep)))
*sbList++ = '\0';
}
return(sbList && *sbList ? my_ERROR : csbList);
@@ -815,7 +815,7 @@ TexOpen(char *sbFile)
#endif
/* If sbFile ends in .tex then it must be there */
- if ((pch = rindex(sbFullPath, '.')) != NULL
+ if ((pch = strrchr(sbFullPath, '.')) != NULL
&& (strcmp(pch, ".tex") == 0))
{
if ((fp = fopen(sbFullPath, "r")) != NULL)