author | Florian Pose <fp@igh-essen.com> |
Wed, 15 Oct 2008 16:08:29 +0000 | |
changeset 1271 | 19f9e9b6cf2c |
parent 1254 | c19d273a9e76 |
child 1363 | 11c0b2caa253 |
permissions | -rw-r--r-- |
1142 | 1 |
/***************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
4 |
* |
|
5 |
****************************************************************************/ |
|
6 |
||
7 |
#include <iostream> |
|
8 |
#include <iomanip> |
|
9 |
#include <fstream> |
|
10 |
using namespace std; |
|
11 |
||
12 |
#include "CommandSiiWrite.h" |
|
13 |
#include "sii_crc.h" |
|
14 |
||
15 |
/*****************************************************************************/ |
|
16 |
||
17 |
CommandSiiWrite::CommandSiiWrite(): |
|
18 |
Command("sii_write", "Write SII contents to a slave.") |
|
19 |
{ |
|
20 |
} |
|
21 |
||
22 |
/*****************************************************************************/ |
|
23 |
||
24 |
string CommandSiiWrite::helpString() const |
|
25 |
{ |
|
26 |
stringstream str; |
|
27 |
||
28 |
str << getName() << " [OPTIONS] <FILENAME>" << endl |
|
29 |
<< endl |
|
30 |
<< getBriefDescription() << endl |
|
31 |
<< endl |
|
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
32 |
<< "This command requires a single slave to be selected." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
33 |
<< endl |
1142 | 34 |
<< "The file contents are checked for validity and integrity." << endl |
35 |
<< "These checks can be overridden with the --force option." << endl |
|
36 |
<< endl |
|
37 |
<< "Arguments:" << endl |
|
38 |
<< " FILENAME must be a path to a file that contains a" << endl |
|
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
39 |
<< " positive number of words. If it is '-'," << endl |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
40 |
<< " data are read from stdin." << endl |
1142 | 41 |
<< endl |
42 |
<< "Command-specific options:" << endl |
|
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
43 |
<< " --alias -a <alias>" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
44 |
<< " --position -p <pos> Slave selection. See the help of" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
45 |
<< " the 'slaves' command." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
46 |
<< " --force -f Override validity checks." << endl |
1142 | 47 |
<< endl |
48 |
<< numericInfo(); |
|
49 |
||
50 |
return str.str(); |
|
51 |
} |
|
52 |
||
53 |
/****************************************************************************/ |
|
54 |
||
55 |
void CommandSiiWrite::execute(MasterDevice &m, const StringVector &args) |
|
56 |
{ |
|
57 |
stringstream err; |
|
58 |
ec_ioctl_slave_sii_t data; |
|
59 |
ifstream file; |
|
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
60 |
SlaveList slaves; |
1142 | 61 |
|
62 |
if (args.size() != 1) { |
|
63 |
err << "'" << getName() << "' takes exactly one argument!"; |
|
64 |
throwInvalidUsageException(err); |
|
65 |
} |
|
66 |
||
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
67 |
if (args[0] == "-") { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
68 |
loadSiiData(&data, cin); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
69 |
} else { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
70 |
file.open(args[0].c_str(), ifstream::in | ifstream::binary); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
71 |
if (file.fail()) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
72 |
err << "Failed to open '" << args[0] << "'!"; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
73 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
74 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
75 |
loadSiiData(&data, file); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
76 |
file.close(); |
1142 | 77 |
} |
78 |
||
1166 | 79 |
if (!getForce()) { |
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
80 |
try { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
81 |
checkSiiData(&data); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
82 |
} catch (CommandException &e) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
83 |
delete [] data.words; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
84 |
throw e; |
1142 | 85 |
} |
86 |
} |
|
87 |
||
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
88 |
try { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
89 |
m.open(MasterDevice::ReadWrite); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
90 |
} catch (MasterDeviceException &e) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
91 |
delete [] data.words; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
92 |
throw e; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
93 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
94 |
|
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
95 |
slaves = selectedSlaves(m); |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
96 |
if (slaves.size() != 1) { |
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
97 |
delete [] data.words; |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
98 |
throwSingleSlaveRequired(slaves.size()); |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
99 |
} |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
100 |
data.slave_position = slaves.front().position; |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1155
diff
changeset
|
101 |
|
1142 | 102 |
// send data to master |
103 |
data.offset = 0; |
|
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
104 |
try { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
105 |
m.writeSii(&data); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
106 |
} catch (MasterDeviceException &e) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
107 |
delete [] data.words; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
108 |
throw e; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
109 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
110 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
111 |
if (getVerbosity() == Verbose) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
112 |
cerr << "SII writing finished." << endl; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
113 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
114 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
115 |
delete [] data.words; |
1142 | 116 |
} |
117 |
||
118 |
/*****************************************************************************/ |
|
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
119 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
120 |
void CommandSiiWrite::loadSiiData( |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
121 |
ec_ioctl_slave_sii_t *data, |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
122 |
const istream &in |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
123 |
) |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
124 |
{ |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
125 |
stringstream err; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
126 |
ostringstream tmp; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
127 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
128 |
tmp << in.rdbuf(); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
129 |
string const &contents = tmp.str(); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
130 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
131 |
if (getVerbosity() == Verbose) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
132 |
cerr << "Read " << contents.size() << " bytes of SII data." << endl; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
133 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
134 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
135 |
if (!contents.size() || contents.size() % 2) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
136 |
err << "Invalid data size " << contents.size() << "! " |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
137 |
<< "Must be non-zero and even."; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
138 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
139 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
140 |
data->nwords = contents.size() / 2; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
141 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
142 |
// allocate buffer and read file into buffer |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
143 |
data->words = new uint16_t[data->nwords]; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
144 |
contents.copy((char *) data->words, contents.size()); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
145 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
146 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
147 |
/*****************************************************************************/ |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
148 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
149 |
void CommandSiiWrite::checkSiiData( |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
150 |
const ec_ioctl_slave_sii_t *data |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
151 |
) |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
152 |
{ |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
153 |
stringstream err; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
154 |
const uint16_t *categoryHeader; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
155 |
uint16_t categoryType, categorySize; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
156 |
uint8_t crc; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
157 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
158 |
if (data->nwords < 0x0041) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
159 |
err << "SII data too short (" << data->nwords << " words)! Mimimum is" |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
160 |
" 40 fixed words + 1 delimiter. Use --force to write anyway."; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
161 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
162 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
163 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
164 |
// calculate checksum over words 0 to 6 |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
165 |
crc = calcSiiCrc((const uint8_t *) data->words, 14); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
166 |
if (crc != ((const uint8_t *) data->words)[14]) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
167 |
err << "CRC incorrect. Must be 0x" |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
168 |
<< hex << setfill('0') << setw(2) << (unsigned int) crc |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
169 |
<< ". Use --force to write anyway."; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
170 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
171 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
172 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
173 |
// cycle through categories to detect corruption |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
174 |
categoryHeader = data->words + 0x0040U; |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1166
diff
changeset
|
175 |
categoryType = le16_to_cpup(categoryHeader); |
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
176 |
while (categoryType != 0xffff) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
177 |
if (categoryHeader + 1 > data->words + data->nwords) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
178 |
err << "SII data seem to be corrupted! " |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
179 |
<< "Use --force to write anyway."; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
180 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
181 |
} |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1166
diff
changeset
|
182 |
categorySize = le16_to_cpup(categoryHeader + 1); |
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
183 |
if (categoryHeader + 2 + categorySize + 1 |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
184 |
> data->words + data->nwords) { |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
185 |
err << "SII data seem to be corrupted! " |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
186 |
"Use --force to write anyway."; |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
187 |
throwCommandException(err); |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
188 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
189 |
categoryHeader += 2 + categorySize; |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1166
diff
changeset
|
190 |
categoryType = le16_to_cpup(categoryHeader); |
1161
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
191 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
192 |
} |
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
193 |
|
d1324ac71232
Accept '-' as filename to read from stdin.
Florian Pose <fp@igh-essen.com>
parents:
1157
diff
changeset
|
194 |
/*****************************************************************************/ |