author | clem <clem> | 2004-09-24 12:39:50 (UTC) |
---|---|---|
committer | clem <clem> | 2004-09-24 12:39:50 (UTC) |
commit | 478b2ead47a09956cadfacb8f469fb2fdee5531c (patch) (unidiff) | |
tree | 2e028e3de22a822d6ae779640e14999030ac3107 | |
parent | 4761d0610715569c7af83dc68ffc90fea4d35690 (diff) | |
download | opie-478b2ead47a09956cadfacb8f469fb2fdee5531c.zip opie-478b2ead47a09956cadfacb8f469fb2fdee5531c.tar.gz opie-478b2ead47a09956cadfacb8f469fb2fdee5531c.tar.bz2 |
Denote the end of the xargs parameters, to avoid "xargs: invalid option -- v"
kind of errors with old xargs.
-rwxr-xr-x | core/launcher/opie-taskbar.prerm | 2 | ||||
-rwxr-xr-x | libopie2/tools/regen.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/opie-taskbar.prerm b/core/launcher/opie-taskbar.prerm index 664160b..ae02235 100755 --- a/core/launcher/opie-taskbar.prerm +++ b/core/launcher/opie-taskbar.prerm | |||
@@ -1,5 +1,5 @@ | |||
1 | #/bin/sh | 1 | #/bin/sh |
2 | 2 | ||
3 | find /etc -name [SK][0-9][0-9]opie | xargs rm -f | 3 | find /etc -name [SK][0-9][0-9]opie | xargs -- rm -f |
4 | 4 | ||
5 | exit 0 | 5 | exit 0 |
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py index 89385e1..2f53a14 100755 --- a/libopie2/tools/regen.py +++ b/libopie2/tools/regen.py | |||
@@ -1,272 +1,272 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | """Regenerate C++ mapping classes""" | 3 | """Regenerate C++ mapping classes""" |
4 | 4 | ||
5 | #---------------------------------------------------------------------------# | 5 | #---------------------------------------------------------------------------# |
6 | # # | 6 | # # |
7 | #---------------------------------------------------------------------------# | 7 | #---------------------------------------------------------------------------# |
8 | 8 | ||
9 | def regenDebugMapper( basename ): | 9 | def regenDebugMapper( basename ): |
10 | """ | 10 | """ |
11 | Debug Mapper - maps ioctl numbers to names, e.g. 0x4x5a -> SIOCGIWNAME | 11 | Debug Mapper - maps ioctl numbers to names, e.g. 0x4x5a -> SIOCGIWNAME |
12 | """ | 12 | """ |
13 | 13 | ||
14 | result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines() | 14 | result = os.popen( 'find /usr/include -name "*.h" |xargs -- grep -h SIOC|grep 0x' ).readlines() |
15 | 15 | ||
16 | try: | 16 | try: |
17 | tablehfile = file( basename+".h", "w" ) | 17 | tablehfile = file( basename+".h", "w" ) |
18 | except: | 18 | except: |
19 | tablehfile = sys.stdout | 19 | tablehfile = sys.stdout |
20 | 20 | ||
21 | try: | 21 | try: |
22 | tablecfile = file( basename+".cpp", "w" ) | 22 | tablecfile = file( basename+".cpp", "w" ) |
23 | except: | 23 | except: |
24 | tablecfile = sys.stdout | 24 | tablecfile = sys.stdout |
25 | 25 | ||
26 | print >>tablehfile,""" | 26 | print >>tablehfile,""" |
27 | /* | 27 | /* |
28 | * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 28 | * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef DEBUGMAPPER_H | 31 | #ifndef DEBUGMAPPER_H |
32 | #define DEBUGMAPPER_H | 32 | #define DEBUGMAPPER_H |
33 | 33 | ||
34 | #include <qstring.h> | 34 | #include <qstring.h> |
35 | #include <qintdict.h> | 35 | #include <qintdict.h> |
36 | 36 | ||
37 | typedef QIntDict<QString> IntStringMap; | 37 | typedef QIntDict<QString> IntStringMap; |
38 | 38 | ||
39 | class DebugMapper | 39 | class DebugMapper |
40 | { | 40 | { |
41 | public: | 41 | public: |
42 | DebugMapper(); | 42 | DebugMapper(); |
43 | ~DebugMapper(); | 43 | ~DebugMapper(); |
44 | 44 | ||
45 | const QString& map( int value ) const; | 45 | const QString& map( int value ) const; |
46 | private: | 46 | private: |
47 | IntStringMap _map; | 47 | IntStringMap _map; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #endif | 50 | #endif |
51 | """ % sys.argv[0] | 51 | """ % sys.argv[0] |
52 | 52 | ||
53 | print >>tablecfile,""" | 53 | print >>tablecfile,""" |
54 | /* | 54 | /* |
55 | * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 55 | * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
56 | */ | 56 | */ |
57 | 57 | ||
58 | #include <opie2/odebug.h> | 58 | #include <opie2/odebug.h> |
59 | 59 | ||
60 | #include "%s" | 60 | #include "%s" |
61 | 61 | ||
62 | DebugMapper::DebugMapper() | 62 | DebugMapper::DebugMapper() |
63 | { | 63 | { |
64 | odebug << "DebugMapper::DebugMapper()" << oendl; | 64 | odebug << "DebugMapper::DebugMapper()" << oendl; |
65 | 65 | ||
66 | """ % ( sys.argv[0], tablehfile.name ) | 66 | """ % ( sys.argv[0], tablehfile.name ) |
67 | 67 | ||
68 | for line in result: | 68 | for line in result: |
69 | l = line.split() | 69 | l = line.split() |
70 | if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ): | 70 | if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ): |
71 | print >>sys.stderr, "can't parse line: %s" % l | 71 | print >>sys.stderr, "can't parse line: %s" % l |
72 | continue | 72 | continue |
73 | print >>tablecfile, " _map.insert( %s, new QString(\"%s\") );" % ( l[2], l[1] ) | 73 | print >>tablecfile, " _map.insert( %s, new QString(\"%s\") );" % ( l[2], l[1] ) |
74 | 74 | ||
75 | 75 | ||
76 | print >>tablecfile,""" | 76 | print >>tablecfile,""" |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | DebugMapper::~DebugMapper() | 80 | DebugMapper::~DebugMapper() |
81 | { | 81 | { |
82 | odebug << "DebugMapper::~DebugMapper()" << oendl; | 82 | odebug << "DebugMapper::~DebugMapper()" << oendl; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | const QString& DebugMapper::map( int value ) const | 86 | const QString& DebugMapper::map( int value ) const |
87 | { | 87 | { |
88 | QString* result = _map[ value ]; | 88 | QString* result = _map[ value ]; |
89 | 89 | ||
90 | if ( !result ) | 90 | if ( !result ) |
91 | { | 91 | { |
92 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; | 92 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; |
93 | return QString::null; | 93 | return QString::null; |
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | return *result; | 97 | return *result; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | """ | 101 | """ |
102 | 102 | ||
103 | #---------------------------------------------------------------------------# | 103 | #---------------------------------------------------------------------------# |
104 | # # | 104 | # # |
105 | #---------------------------------------------------------------------------# | 105 | #---------------------------------------------------------------------------# |
106 | 106 | ||
107 | def regenManufacturerDB( basename ): | 107 | def regenManufacturerDB( basename ): |
108 | 108 | ||
109 | try: | 109 | try: |
110 | h = file( basename+".h", "w" ) | 110 | h = file( basename+".h", "w" ) |
111 | except: | 111 | except: |
112 | h = sys.stdout | 112 | h = sys.stdout |
113 | 113 | ||
114 | try: | 114 | try: |
115 | cpp = file( basename+".cpp", "w" ) | 115 | cpp = file( basename+".cpp", "w" ) |
116 | except: | 116 | except: |
117 | cpp = sys.stdout | 117 | cpp = sys.stdout |
118 | 118 | ||
119 | print >>h,""" | 119 | print >>h,""" |
120 | #ifndef OMANUFACTURERDB_H | 120 | #ifndef OMANUFACTURERDB_H |
121 | #define OMANUFACTURERDB_H | 121 | #define OMANUFACTURERDB_H |
122 | 122 | ||
123 | #include <qmap.h> | 123 | #include <qmap.h> |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * @brief A Ethernet card vendor database. | 126 | * @brief A Ethernet card vendor database. |
127 | * | 127 | * |
128 | * This class encapsulates the lookup of Ethernet vendor given a | 128 | * This class encapsulates the lookup of Ethernet vendor given a |
129 | * certain Mac Address. Only the first three bytes define the vendor. | 129 | * certain Mac Address. Only the first three bytes define the vendor. |
130 | */ | 130 | */ |
131 | class OManufacturerDB | 131 | class OManufacturerDB |
132 | { | 132 | { |
133 | public: | 133 | public: |
134 | /** | 134 | /** |
135 | * @returns the one-and-only @ref OManufacturerDB instance. | 135 | * @returns the one-and-only @ref OManufacturerDB instance. |
136 | */ | 136 | */ |
137 | static OManufacturerDB* instance(); | 137 | static OManufacturerDB* instance(); |
138 | /** | 138 | /** |
139 | * @returns the short manufacturer string given a @a macaddr. | 139 | * @returns the short manufacturer string given a @a macaddr. |
140 | */ | 140 | */ |
141 | const QString& lookup( const QString& macaddr ) const; | 141 | const QString& lookup( const QString& macaddr ) const; |
142 | /** | 142 | /** |
143 | * @returns the enhanced manufacturer string given a @a macaddr. | 143 | * @returns the enhanced manufacturer string given a @a macaddr. |
144 | */ | 144 | */ |
145 | const QString& lookupExt( const QString& macaddr ) const; | 145 | const QString& lookupExt( const QString& macaddr ) const; |
146 | 146 | ||
147 | protected: | 147 | protected: |
148 | OManufacturerDB(); | 148 | OManufacturerDB(); |
149 | virtual ~OManufacturerDB(); | 149 | virtual ~OManufacturerDB(); |
150 | 150 | ||
151 | private: | 151 | private: |
152 | QMap<QString, QString> manufacturers; | 152 | QMap<QString, QString> manufacturers; |
153 | QMap<QString, QString> manufacturersExt; | 153 | QMap<QString, QString> manufacturersExt; |
154 | static OManufacturerDB* _instance; | 154 | static OManufacturerDB* _instance; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
158 | """ | 158 | """ |
159 | 159 | ||
160 | print >>cpp,""" | 160 | print >>cpp,""" |
161 | #include "%s.h" | 161 | #include "%s.h" |
162 | 162 | ||
163 | /* OPIE CORE */ | 163 | /* OPIE CORE */ |
164 | #include <opie2/odebug.h> | 164 | #include <opie2/odebug.h> |
165 | 165 | ||
166 | /* QT */ | 166 | /* QT */ |
167 | #include <qapplication.h> | 167 | #include <qapplication.h> |
168 | #include <qstring.h> | 168 | #include <qstring.h> |
169 | 169 | ||
170 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 170 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
171 | 171 | ||
172 | OManufacturerDB* OManufacturerDB::_instance = 0; | 172 | OManufacturerDB* OManufacturerDB::_instance = 0; |
173 | 173 | ||
174 | OManufacturerDB* OManufacturerDB::instance() | 174 | OManufacturerDB* OManufacturerDB::instance() |
175 | { | 175 | { |
176 | if ( !OManufacturerDB::_instance ) | 176 | if ( !OManufacturerDB::_instance ) |
177 | { | 177 | { |
178 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 178 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
179 | _instance = new OManufacturerDB(); | 179 | _instance = new OManufacturerDB(); |
180 | } | 180 | } |
181 | return _instance; | 181 | return _instance; |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | OManufacturerDB::OManufacturerDB() | 185 | OManufacturerDB::OManufacturerDB() |
186 | { | 186 | { |
187 | """ % basename | 187 | """ % basename |
188 | 188 | ||
189 | count = 0 | 189 | count = 0 |
190 | for line in sys.stdin: | 190 | for line in sys.stdin: |
191 | if line[0] == "#": # skip comments | 191 | if line[0] == "#": # skip comments |
192 | continue | 192 | continue |
193 | #print line.strip() | 193 | #print line.strip() |
194 | entries = line.strip().split() | 194 | entries = line.strip().split() |
195 | #print "number of entries =", len( entries ) | 195 | #print "number of entries =", len( entries ) |
196 | #print entries | 196 | #print entries |
197 | if len( entries ) < 2: | 197 | if len( entries ) < 2: |
198 | continue | 198 | continue |
199 | elif len( entries ) == 2: | 199 | elif len( entries ) == 2: |
200 | count += 1 | 200 | count += 1 |
201 | print "2-line detected." | 201 | print "2-line detected." |
202 | print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] ) | 202 | print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] ) |
203 | print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], entries[1] ) | 203 | print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], entries[1] ) |
204 | elif len( entries ) > 2: | 204 | elif len( entries ) > 2: |
205 | count += 1 | 205 | count += 1 |
206 | print "3-line detected." | 206 | print "3-line detected." |
207 | print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] ) | 207 | print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] ) |
208 | print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], "_".join( entries[3:] ) ) | 208 | print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], "_".join( entries[3:] ) ) |
209 | else: | 209 | else: |
210 | assert( false ) | 210 | assert( false ) |
211 | if not (count % 1000): | 211 | if not (count % 1000): |
212 | print >>cpp,""" | 212 | print >>cpp,""" |
213 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 213 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
214 | if (qApp) qApp->processEvents(); | 214 | if (qApp) qApp->processEvents(); |
215 | #endif | 215 | #endif |
216 | """ | 216 | """ |
217 | print "successfully parsed", count, "manufacturer lines" | 217 | print "successfully parsed", count, "manufacturer lines" |
218 | print >>cpp,""" | 218 | print >>cpp,""" |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
222 | OManufacturerDB::~OManufacturerDB() | 222 | OManufacturerDB::~OManufacturerDB() |
223 | { | 223 | { |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 227 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
228 | { | 228 | { |
229 | return manufacturers[macaddr.upper().left(8)]; | 229 | return manufacturers[macaddr.upper().left(8)]; |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 233 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
234 | { | 234 | { |
235 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 235 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
236 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 236 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
237 | } | 237 | } |
238 | """ | 238 | """ |
239 | 239 | ||
240 | #---------------------------------------------------------------------------# | 240 | #---------------------------------------------------------------------------# |
241 | # # | 241 | # # |
242 | #---------------------------------------------------------------------------# | 242 | #---------------------------------------------------------------------------# |
243 | 243 | ||
244 | #---------------------------------------------------------------------------# | 244 | #---------------------------------------------------------------------------# |
245 | # # | 245 | # # |
246 | #---------------------------------------------------------------------------# | 246 | #---------------------------------------------------------------------------# |
247 | 247 | ||
248 | #---------------------------------------------------------------------------# | 248 | #---------------------------------------------------------------------------# |
249 | # # | 249 | # # |
250 | #---------------------------------------------------------------------------# | 250 | #---------------------------------------------------------------------------# |
251 | 251 | ||
252 | import sys | 252 | import sys |
253 | import os | 253 | import os |
254 | import copy | 254 | import copy |
255 | 255 | ||
256 | if __name__ == "__main__": | 256 | if __name__ == "__main__": |
257 | if len( sys.argv ) != 3: | 257 | if len( sys.argv ) != 3: |
258 | print """ | 258 | print """ |
259 | Usage: %s <table> <basename> | 259 | Usage: %s <table> <basename> |
260 | 260 | ||
261 | Available tables: %s | 261 | Available tables: %s |
262 | """ % ( sys.argv[0], [ str(k)[5:] for k in copy.copy( locals() ) if k.startswith( "regen" ) ] ) | 262 | """ % ( sys.argv[0], [ str(k)[5:] for k in copy.copy( locals() ) if k.startswith( "regen" ) ] ) |
263 | sys.exit( -1 ) | 263 | sys.exit( -1 ) |
264 | 264 | ||
265 | try: | 265 | try: |
266 | func = locals()["regen%s" % sys.argv[1]] | 266 | func = locals()["regen%s" % sys.argv[1]] |
267 | except KeyError: | 267 | except KeyError: |
268 | print "Table '%s' unknown." % sys.argv[1] | 268 | print "Table '%s' unknown." % sys.argv[1] |
269 | sys.exit( -1 ) | 269 | sys.exit( -1 ) |
270 | else: | 270 | else: |
271 | func( sys.argv[2] ) | 271 | func( sys.argv[2] ) |
272 | sys.exit( 0 ) \ No newline at end of file | 272 | sys.exit( 0 ) |