annotate src/mingw-units-1-fixes.patch @ 3348:c3ad8e6faffa

units: use exe installed path to work out units definition file location * src/mingw-units-1-fixes.patch: New file.
author John Donoghue <john.donoghue@ieee.org>
date Sat, 07 Dec 2013 21:19:33 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3348
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
1 diff -ur units-2.02.orig/Makefile.in units-2.02/Makefile.in
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
2 --- units-2.02.orig/Makefile.in 2013-12-07 06:56:41.000000000 -0500
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
3 +++ units-2.02/Makefile.in 2013-12-07 19:50:21.000000000 -0500
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
4 @@ -35,7 +35,7 @@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
5 TEXI2DVI = texi2dvi
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
6 TEXI2PDF = texi2pdf
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
7 LDFLAGS = @LDFLAGS@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
8 -LIBS= @LIBS@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
9 +LIBS= @LIBS@ -lkernel32
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
10 VPATH = @srcdir@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
11
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
12 datarootdir = @datarootdir@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
13 diff -ur units-2.02.orig/units.c units-2.02/units.c
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
14 --- units-2.02.orig/units.c 2013-12-07 06:56:41.000000000 -0500
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
15 +++ units-2.02/units.c 2013-12-07 20:51:00.000000000 -0500
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
16 @@ -56,13 +56,28 @@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
17 #include "getopt.h"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
18 #include "units.h"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
19
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
20 -#ifndef UNITSFILE
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
21 -# define UNITSFILE "definitions.units"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
22 -#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
23 +#ifdef _WIN32
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
24 + #define WIN32_LEAN_AND_MEAN
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
25 + #include <windows.h>
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
26
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
27 -#ifndef LOCALEMAP
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
28 -# define LOCALEMAP "locale.map"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
29 -#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
30 +# ifdef UNITSFILE
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
31 +# undef UNITSFILE
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
32 +# endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
33 +# define UNITSFILE "/share/units/definitions.units"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
34 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
35 +# ifdef LOCALEMAP
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
36 +# undef LOCALEMAP
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
37 +# endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
38 +# define LOCALEMAP "/share/units/locale.map"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
39 +#else
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
40 +# ifndef UNITSFILE
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
41 +# define UNITSFILE "definitions.units"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
42 +# endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
43 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
44 +# ifndef LOCALEMAP
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
45 +# define LOCALEMAP "locale.map"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
46 +# endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
47 +#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
48
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
49 #ifndef EOFCHAR
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
50 # define EOFCHAR "D"
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
51 @@ -1187,6 +1202,31 @@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
52 }
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
53 #endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
54
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
55 +#ifdef _WIN32
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
56 +char * root_path()
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
57 +{
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
58 + static char buff[2048];
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
59 + if(GetModuleFileName(NULL, buff, 2048) > 0)\
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
60 + {
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
61 + /* name should be something like \somepath\bin\units.exe */
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
62 + char * ptr;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
63 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
64 + ptr = strrchr(buff, '\\');
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
65 + if(ptr) *ptr = 0;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
66 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
67 + ptr = strrchr(buff, '\\');
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
68 + if(ptr)
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
69 + {
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
70 + *ptr = 0;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
71 + }
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
72 + }
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
73 + else
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
74 + strcpy(buff, "c:");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
75 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
76 + return buff;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
77 +}
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
78 +#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
79 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
80
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
81 /*
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
82 Read in units data.
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
83 @@ -3296,6 +3336,18 @@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
84 return file;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
85 file = UNITSFILE;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
86 testfile = fopen(file, "rt");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
87 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
88 +#ifdef _WIN32
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
89 + if (!testfile) {
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
90 + char * root = root_path();
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
91 + file = mymalloc(strlen(root)+strlen(UNITSFILE)+2,"(findunitsfile)");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
92 + strcpy(file, root);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
93 + strcat(file, "\\");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
94 + strcat(file, UNITSFILE);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
95 + testfile = fopen(file, "rt");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
96 + }
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
97 +#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
98 +
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
99 if (!testfile) {
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
100 char *direc, *env;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
101 char separator[2];
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
102 @@ -4214,6 +4266,17 @@
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
103 char *value;
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
104 char name[80];
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
105 map = fopen(LOCALEMAP,"rt");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
106 +#ifdef _WIN32
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
107 + if (!map) {
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
108 + char * root = root_path();
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
109 + char * file = mymalloc(strlen(root)+strlen(UNITSFILE)+2,"(localmap)");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
110 + strcpy(file, root);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
111 + strcat(file, "\\");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
112 + strcat(file, LOCALEMAP);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
113 + map = fopen(file, "rt");
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
114 + free(file);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
115 + }
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
116 +#endif
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
117 if (!map)
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
118 fprintf(stderr,"%s: Unable to read locale map '%s'\n",progname,LOCALEMAP);
c3ad8e6faffa units: use exe installed path to work out units definition file location
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
119 else {