1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
diff -ur dvipng-1.15.orig/misc.c dvipng-1.15/misc.c
--- dvipng-1.15.orig/misc.c 2015-03-02 20:33:56.000000000 +0100
+++ dvipng-1.15/misc.c 2015-03-03 13:35:10.000000000 +0100
@@ -47,24 +47,43 @@
int32_t number; /* Temporary storage for numeric parameter */
char *dviname=NULL; /* Name of dvi file */
char *outname=NULL; /* Name of output file */
+ char *base; /* basename of argv[0] */
- if (argv[0]) {
+#ifdef HAVE_LIBKPATHSEA
+ /* we certainly don't want to modify argv[0]. */
+ programname = xstrdup (argv[0] ? argv[0] : PACKAGE_NAME);
+# ifdef HAVE_KPSE_PROGRAM_BASENAME
+ base = kpse_program_basename (programname);
+# else
+ base = xstrdup (xbasename (programname));
+ {
+ char *dot = strrchr (base, '.');
+ if (dot && FILESTRCASEEQ (dot, ".exe"))
+ *dot = 0;
+ }
+# endif
+#else
+ /* we certainly don't want to modify argv[0]. */
+ programname = strdup (argv[0] ? argv[0] : PACKAGE_NAME);
+ base = strrchr (programname, '/');
+ if (base)
+ base++;
+ else
+ base = programname;
+#endif
#ifdef HAVE_GDIMAGEGIF
- programname=strrchr(argv[0],'/');
- if (programname!=NULL)
- programname++;
- else
- programname=argv[0];
- if (strncmp(programname,"dvigif",6)==0)
- option_flags |= GIF_OUTPUT;
+# ifdef HAVE_LIBKPATHSEA
+ if (FILESTRCASEEQ (base, "dvigif"))
+# else
+ if (strncmp(programname,"dvigif",6)==0)
+# endif
+ option_flags |= GIF_OUTPUT;
#endif
- programname=argv[0];
- Message(BE_NONQUIET,"This is %s",programname);
- if (strcmp(basename(programname),PACKAGE_NAME)!=0)
- Message(BE_NONQUIET," (%s)", PACKAGE_NAME);
- Message(BE_NONQUIET," %s Copyright 2002-2015 Jan-Ake Larsson\n",
- PACKAGE_VERSION);
- }
+ Message(BE_NONQUIET,"This is %s",programname);
+ if (strcmp(base,PACKAGE_NAME)!=0)
+ Message(BE_NONQUIET," (%s)", PACKAGE_NAME);
+ Message(BE_NONQUIET," %s Copyright 2002-2015 Jan-Ake Larsson\n",
+ PACKAGE_VERSION);
for (i=1; i<argc; i++) {
if (*argv[i]=='-') {
|