From 0b9f543ff1683ae58492651d96f6da1ea88b9b70 Mon Sep 17 00:00:00 2001 From: Jens True Date: Mon, 1 Apr 2019 10:10:35 +0200 Subject: [PATCH] Added error message for invalid color --- Dockerfile | 3 +++ Makefile | 2 +- main.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4e91c17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM gcc +COPY . . +RUN apt-get -y update && apt-get -y install libusb-1.0 && make diff --git a/Makefile b/Makefile index e474ab9..ea700fd 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ all: ledcontroller ledcontroller: main.c - gcc -o $@ $^ `pkg-config libusb-1.0 --cflags --libs` + gcc -o $@ $^ `pkg-config libusb-1.0 --cflags --libs` clean: rm ledcontroller diff --git a/main.c b/main.c index 8bb3554..643818b 100644 --- a/main.c +++ b/main.c @@ -43,7 +43,7 @@ #include #include #include - +#include #define VID 0x1294 #define PID 0x1320 @@ -108,6 +108,9 @@ int main(int argc,char** argv) else if ( strcmp(argv[1],"white") == 0 ) { code = 7; + } else { + printf("invalid color\n"); + return -1; } libusb_init(NULL);