seqedit – edit next expected send/receive
Usage: seqedit [-DRSdhiqv] <perist file prefix> -D,–rawdump dump all the raw data records referenced in the index
-R,–receive set next expected receive sequence number
-S,–send set next send sequence number
-d,–dump dump all the records in both the index and the data file
-h,–help help, this screen
-i,–index only dump the index not the data records
-q,–quiet set the sequence numbers silently
-v,–version print version, exit
e.g.
seqedit client.DLD_TEX.TEX_DLD
seqedit -R 23417 -S 2341 client.DLD_TEX.TEX_DLD
seqedit -d client.DLD_TEX.TEX_DLD
seqedit -D client.DLD_TEX.TEX_DLD
seqedit -id client.DLD_TEX.TEX_DLD
Definition in file seqedit.cpp.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 84 of file seqedit.cpp.
References FIX8::Prec::_offset, FIX8::IPrec::_prec, FIX8::IPrec::_seq, FIX8::Prec::_size, FIX8_MAX_MSG_LENGTH, FIX8_PACKAGE, FIX8_VERSION, GETARGLIST(), next_receive(), next_send(), O_BINARY, print_usage(), and quiet().
86 bool dump(
false), rawdump(
false), indexonly(
false),
quiet(
false);
90 #ifdef FIX8_HAVE_GETOPT_LONG
91 const option long_options[]
93 {
"help", 0, 0,
'h' },
94 {
"dump", 0, 0,
'd' },
95 {
"version", 0, 0,
'v' },
96 {
"rawdump", 0, 0,
'D' },
97 {
"index", 0, 0,
'i' },
98 {
"quiet", 0, 0,
'q' },
99 {
"send", 1, 0,
'S' },
100 {
"receive", 1, 0,
'R' },
104 while ((val = getopt_long (argc, argv,
GETARGLIST.c_str(), long_options, 0)) != -1)
106 while ((val = getopt (argc, argv,
GETARGLIST.c_str())) != -1)
113 cout <<
"Released under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3. See <http://fsf.org/> for details." << endl;
116 case 'D': rawdump =
true;
117 case 'd': dump =
true;
break;
118 case 'i': indexonly =
true;
break;
119 case 'q':
quiet =
true;
break;
120 case 'S':
next_send = stoul(optarg);
break;
122 case ':':
case '?':
return 1;
129 cerr <<
"no input persistence file prefix specified" << endl;
133 const string dbFname(argv[optind]);
134 const string dbIname(dbFname +
".idx");
138 fdset() : fod(), iod() {}
139 ~fdset() { close(iod); close(fod); }
143 if ((fds.fod = open(dbFname.c_str(), O_RDONLY |
O_BINARY)) < 0)
145 cerr <<
"Error opening existing database: " << dbFname <<
" (" << strerror(errno) <<
')' << endl;
148 if ((fds.iod = open(dbIname.c_str(), O_RDWR |
O_BINARY)) < 0)
150 cerr <<
"Error opening existing database index: " << dbIname <<
" (" << strerror(errno) <<
')' << endl;
155 ssize_t blrd(read(fds.iod, static_cast<void *>(&iprec),
sizeof(
IPrec)));
158 cerr <<
"Error reading existing database index: " << dbIname <<
" (" << strerror(errno) <<
')' << endl;
162 if (!rawdump && !
quiet)
165 cout <<
"Next send receive" << endl;
166 cout <<
"==============================" << endl;
167 cout <<
"Current " << left << setw(10) << iprec.
_prec.
_offset << right << setw(10) << iprec.
_prec.
_size << endl;
178 if (lseek(fds.iod, 0, SEEK_SET) < 0)
181 cerr <<
"Error could not seek to 0 for seqnum persitence: " << dbIname << endl;
184 if (write (fds.iod, static_cast<void *>(&iprec),
sizeof(iprec)) !=
sizeof(iprec))
187 cerr <<
"Error writing seqnum persitence: " << dbIname << endl;
192 cout <<
"New " << left << setw(10) << iprec.
_prec.
_offset << right << setw(10) << iprec.
_prec.
_size << endl;
198 blrd = read(fds.iod, static_cast<void *>(&iprec),
sizeof(
IPrec));
201 cerr <<
"Error reading existing database index: " << dbIname <<
" (" << strerror(errno) <<
')' << endl;
208 cout << iprec << endl;
217 cerr <<
"Error could not seek to correct index location " << iprec.
_prec.
_offset <<
" for get: " << dbFname << endl;
224 cerr <<
"Error could not read message record for seqnum " << iprec.
_seq <<
" from: " << dbFname
225 <<
": trying to read " << iprec.
_prec.
_size <<
", but available " << bytes_read
233 cout << buff << endl;
const string GETARGLIST("hvdDR:S:iq")
#define FIX8_MAX_MSG_LENGTH