diff options
author | Anton Semjonov | 2020-02-21 22:50:51 +0100 |
---|---|---|
committer | Anton Semjonov | 2020-02-21 22:50:51 +0100 |
commit | 90e29f1d57559dde355e180be01407915ca474aa (patch) | |
tree | 581ab4588ce90bac963d4d9cfca65a1ca6abac97 | |
parent | 6f6e1edda2c78f0cda708c49de219728f69fd00c (diff) | |
download | aur-90e29f1d57559dde355e180be01407915ca474aa.tar.gz |
add patch for crlf line-ending trimming, see issue #3
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | 001_trim_crlf_line_ending.patch | 42 | ||||
-rw-r--r-- | PKGBUILD | 8 |
3 files changed, 51 insertions, 3 deletions
@@ -1,7 +1,7 @@ pkgbase = updiprog-git pkgdesc = utility for programming AVR devices with UPDI interface using standard TTL serial port pkgver = v0.2.r2.3741ea7 - pkgrel = 1 + pkgrel = 2 url = https://github.com/Polarisru/updiprog arch = x86_64 license = BSD @@ -11,8 +11,10 @@ pkgbase = updiprog-git conflicts = updiprog source = updiprog-git::git+https://github.com/Polarisru/updiprog.git source = Makefile + source = 001_trim_crlf_line_ending.patch sha256sums = SKIP sha256sums = 8145eee13c59c4723ff3b8175c41ea860117fd4fd93cfd18dd176cb74d55cd8a + sha256sums = 96162427278f7403402c5c9436400f39af6dc00f015c9420cac8a05f466aa273 pkgname = updiprog-git diff --git a/001_trim_crlf_line_ending.patch b/001_trim_crlf_line_ending.patch new file mode 100644 index 000000000000..115f09985f46 --- /dev/null +++ b/001_trim_crlf_line_ending.patch @@ -0,0 +1,42 @@ +diff --git a/ihex.c b/ihex.c +index 860a8ad..642d54f 100644 +--- a/ihex.c ++++ b/ihex.c +@@ -1,4 +1,5 @@ + #include <stdio.h>
++#include <ctype.h>
+ #include <string.h>
+ #include "ihex.h"
+
+@@ -131,6 +132,7 @@ uint8_t IHEX_ReadFile(FILE *fp, uint8_t *data, uint16_t maxlen, uint16_t *max_ad + uint8_t i;
+ uint8_t byte;
+ char str[128];
++ char *end;
+
+ addr = 0;
+ segment = 0;
+@@ -138,6 +140,10 @@ uint8_t IHEX_ReadFile(FILE *fp, uint8_t *data, uint16_t maxlen, uint16_t *max_ad + {
+ if (fgets(str, sizeof(str), fp) == NULL)
+ return IHEX_ERROR_FILE;
++ // trim whitespace on the right
++ end = str + strlen(str) - 1;
++ while (end > str && isspace((unsigned char) *end)) end--;
++ end[1] = '\0';
+ if (strlen(str) < IHEX_MIN_STRING)
+ return IHEX_ERROR_FMT;
+ len = IHEX_GetByte(&str[IHEX_OFFS_LEN]);
+diff --git a/ihex.h b/ihex.h +index d2f2f83..e96c6cf 100644 +--- a/ihex.h ++++ b/ihex.h +@@ -6,7 +6,7 @@ + #include <stdbool.h>
+
+ #define IHEX_LINE_LENGTH 16
+-#define IHEX_MIN_STRING 12
++#define IHEX_MIN_STRING 11
+
+ #define IHEX_OFFS_LEN 1
+ #define IHEX_OFFS_ADDR 3
@@ -5,7 +5,7 @@ _pkgname=(${pkgname%-git}) pkgdesc="utility for programming AVR devices with UPDI interface using standard TTL serial port" pkgver=v0.2.r2.3741ea7 -pkgrel=1 +pkgrel=2 arch=('x86_64') url="https://github.com/Polarisru/$_pkgname" @@ -19,10 +19,12 @@ conflicts=($_pkgname) source=( "$pkgname::git+$url.git" "Makefile" + "001_trim_crlf_line_ending.patch" ) sha256sums=( "SKIP" "8145eee13c59c4723ff3b8175c41ea860117fd4fd93cfd18dd176cb74d55cd8a" + "96162427278f7403402c5c9436400f39af6dc00f015c9420cac8a05f466aa273" ) pkgver() { @@ -31,7 +33,9 @@ pkgver() { } prepare() { - cp Makefile "$pkgname/" + cd "$pkgname/" + cp ../Makefile . + patch --forward --strip=1 --input=../001_trim_crlf_line_ending.patch } build() { |