From 477f1f10494abd222b599f48f618ea40bd9bf3c3 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Mon, 29 Oct 2007 22:30:59 +0000 Subject: [PATCH] Submitted by : patch #6141: accept binary format immediate values Detect a 0b prefix, and call strtoul() differently in that case. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@754 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 7 +++++++ avrdude/fileio.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 88500cdf..0de226f3 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,10 @@ +2007-10-29 Joerg Wunsch + + Submitted by : + patch #6141: accept binary format immediate values + * fileio.c: Detect a 0b prefix, and call strtoul() differently + in that case. + 2007-10-29 Joerg Wunsch bug #21076: -vvvv serial receive prints are empty in Win32 build diff --git a/avrdude/fileio.c b/avrdude/fileio.c index 97752418..4bad9734 100644 --- a/avrdude/fileio.c +++ b/avrdude/fileio.c @@ -743,6 +743,10 @@ static int fileio_imm(struct fioparms * fio, p = strtok(filename, " ,"); while (p != NULL && loc < size) { b = strtoul(p, &e, 0); + /* check for binary formated (0b10101001) strings */ + b = (strncmp (p, "0b", 2))? + strtoul (p, &e, 0): + strtoul (p + 2, &e, 2); if (*e != 0) { fprintf(stderr, "%s: invalid byte value (%s) specified for immediate mode\n",