]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cleanup easylogo
authorMike Frysinger <vapier@gentoo.org>
Tue, 18 Dec 2007 08:23:25 +0000 (03:23 -0500)
committerWolfgang Denk <wd@denx.de>
Wed, 9 Jan 2008 14:09:05 +0000 (15:09 +0100)
- 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 <vapier@gentoo.org>
tools/easylogo/Makefile
tools/easylogo/easylogo.c

index 292344ad0335e3f9288571eed337cbcd68b9c0f2..566b12506bfa4cfa19960146c518364809b5e3aa 100644 (file)
@@ -1,2 +1,8 @@
-all:   easylogo.c
-       gcc easylogo.c -o easylogo
+CFLAGS += -Wall
+
+all: easylogo
+
+clean:
+       rm -f easylogo *.o
+
+.PHONY: all clean
index 9f1d1fff0821cfb2f158c7cd40f69a426bc08d08..59f9ae7d99a544c68df52306eb8086b1944f8881 100644 (file)
@@ -8,6 +8,8 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #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);
            }
        }