diff options
| author | Franklin Wei <git@fwei.tk> | 2015-11-12 21:47:23 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-11-12 21:47:23 -0500 |
| commit | a810c8760d090dcbc5ee0854b4c124a0eea3d7e7 (patch) | |
| tree | 281a7196ededfb311fddff608712ef70d97b80aa /target | |
| parent | 142f530e6502ecb33af7a3095f5d049b8eca3c91 (diff) | |
| download | ducky-a810c8760d090dcbc5ee0854b4c124a0eea3d7e7.zip ducky-a810c8760d090dcbc5ee0854b4c124a0eea3d7e7.tar.gz ducky-a810c8760d090dcbc5ee0854b4c124a0eea3d7e7.tar.bz2 ducky-a810c8760d090dcbc5ee0854b4c124a0eea3d7e7.tar.xz | |
add rockbox cross-compiler
Diffstat (limited to 'target')
| -rw-r--r-- | target/unix/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/target/unix/main.c b/target/unix/main.c index 32f6bc9..278b889 100644 --- a/target/unix/main.c +++ b/target/unix/main.c @@ -9,7 +9,7 @@ char *progname; void arg_error(void) { - printf("Usage: %s [-c] FILE\n", progname); + printf("Usage: %s [-cei] FILE\n", progname); exit(EXIT_FAILURE); } @@ -34,6 +34,14 @@ int main(int argc, char *argv[]) if(file) { int fd = open(file, O_RDONLY), out_fd; + unsigned char header[4]; + read(fd, &header, sizeof(header)); + if(*((uint32_t*)header) == DUCKY_MAGIC) + { + printf("Detected ducky bytecode signature.\n"); + action = EXECUTE; + } + lseek(fd, 0, SEEK_SET); switch(action) { case INTERP: |