int msr_iso_read(int fd, msr_tracks_t * tracks) { int r; int i; r = msr_cmd (fd, MSR_CMD_READ); if (r == -1) err(1, "Command write failed"); /* Wait for start delimiter. */ if (getstart (fd) == -1) err(1, "get start delimiter failed"); /* Read track data */ for (i = 0; i < MSR_MAX_TRACKS; i++) gettrack_iso (fd, i + 1, tracks->msr_tracks[i].msr_tk_data, &tracks->msr_tracks[i].msr_tk_len); /* Wait for end delimiter. */ if (getend (fd) == -1) { warnx("read failed"); return (-1); } return (0); }
void getpos(const char* p, int& line, int& column) { line = 0; column = 0; auto ps = getstart(); while(*ps) { line++; auto pe = skipline(ps); if(p >= ps && p < pe) { column = p - ps + 1; return; } ps = pe; } }
int msr_raw_read(int fd, msr_tracks_t * tracks) { int r; int i; r = msr_cmd (fd, MSR_CMD_RAW_READ); if (r == -1) err(1, "Command write failed"); if (getstart (fd) == -1) err(1, "get start delimiter failed"); for (i = 0; i < MSR_MAX_TRACKS; i++) gettrack_raw (fd, i + 1, tracks->msr_tracks[i].msr_tk_data, &tracks->msr_tracks[i].msr_tk_len); if (getend (fd) == -1) err(1, "read failed"); return (0); }
bsparse(const char* url, const bsfile* parent = 0) : bsfile(url, parent), p(getstart()) { clearvalue(); buffer[0] = 0; }