From: Mike Frysinger Date: Tue, 18 Dec 2007 08:23:25 +0000 (-0500) Subject: cleanup easylogo X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=38d299c2db81bd889c601b5dfc12c4e83ef83333;p=u-boot.git cleanup easylogo - make the Makefile not suck - include proper headers for prototypes - fix obvious broken handling of strchr() when handling '.' in filenames Signed-Off-By: Mike Frysinger --- diff --git a/tools/easylogo/Makefile b/tools/easylogo/Makefile index 292344ad03..566b12506b 100644 --- a/tools/easylogo/Makefile +++ b/tools/easylogo/Makefile @@ -1,2 +1,8 @@ -all: easylogo.c - gcc easylogo.c -o easylogo +CFLAGS += -Wall + +all: easylogo + +clean: + rm -f easylogo *.o + +.PHONY: all clean diff --git a/tools/easylogo/easylogo.c b/tools/easylogo/easylogo.c index 9f1d1fff08..59f9ae7d99 100644 --- a/tools/easylogo/easylogo.c +++ b/tools/easylogo/easylogo.c @@ -8,6 +8,8 @@ */ #include +#include +#include #pragma pack(1) @@ -41,7 +43,7 @@ typedef struct { } yuyv_t ; typedef struct { - unsigned char *data, + void *data, *palette ; int width, height, @@ -352,9 +354,10 @@ int main (int argc, char *argv[]) strcpy (varname, argv[2]); else { - int pos = strchr(inputfile, '.'); + char *dot = strchr(inputfile, '.'); + int pos = dot - inputfile; - if (pos >= 0) + if (dot) { strncpy (varname, inputfile, pos); varname[pos] = 0 ; @@ -365,13 +368,15 @@ int main (int argc, char *argv[]) strcpy (outputfile, argv[3]); else { - int pos = strchr (varname, '.'); + char *dot = strchr (varname, '.'); + int pos = dot - varname; - if (pos > 0) + if (dot) { char app[DEF_FILELEN] ; strncpy(app, varname, pos); + app[pos] = 0; sprintf(outputfile, "%s.h", app); } }