Skip to content

Commit 5ac885d

Browse files
committed
actually skip N bytes when the -skip/-offset option is used
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45942 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent cfe757e commit 5ac885d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

vice/src/tools/petcat/petcat.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,8 @@ int main(int argc, char **argv)
11621162

11631163
/* reading offset */
11641164
if (!strcmp(argv[0], "-skip") || !strcmp(argv[0], "-offset")) {
1165-
if (argc > 1 && sscanf(argv[1], "%lx", &offset) == 1) {
1165+
if (argc > 1) {
1166+
offset = strtoul(argv[1], NULL, 0);
11661167
--argc; ++argv;
11671168
continue;
11681169
}
@@ -1329,6 +1330,12 @@ int main(int argc, char **argv)
13291330
fprintf(dest, "\n\n;%s ", (fil ? argv[0] : "<stdin>"));
13301331
}
13311332

1333+
/* skip "offset" bytes */
1334+
while (offset > 0) {
1335+
getc(source);
1336+
offset--;
1337+
}
1338+
13321339
/*
13331340
* Use TEXT mode if the offset doesn't equal BASIC load addresses
13341341
* and the first bytes to be read do not contain load address.

0 commit comments

Comments
 (0)