Prepare the Makefile for integration into the FreeBSD ports tree.

Fix a few "may be used uninitialized" bugs found by -Wall.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@33 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
bsd 2001-01-15 02:28:46 +00:00
parent adcede7780
commit a5875162a7
2 changed files with 28 additions and 12 deletions

View File

@ -1,23 +1,34 @@
#------------------------------------------------------------------------
# #
# $Id$ # $Id$
# #
# Makefile
#
TARGET = avrprog TARGET = avrprog
DEST = ${HOME}/bin/0.${ARCH} PREFIX ?= /usr/local
BINDIR = ${PREFIX}/bin
all : ${TARGET} INSTALL = /usr/bin/install -c -o root -g wheel
CFLAGS = -Wall --pedantic -g CFLAGS += -Wall --pedantic
${TARGET} : avrprog.c INSTALL_PROGRAM = ${INSTALL} -m 555 -s
${CC} ${CFLAGS} -o ${TARGET} avrprog.c INSTALL_DATA = ${INSTALL} -m 444
INSTALL_MANUAL = ${INSTALL_DATA}
all : $(TARGET)
$(TARGET) : avrprog.c
$(CC) $(CFLAGS) -o $(TARGET) $<
clean : clean :
rm -f *.o ${TARGET} *~ rm -f *~ *.core $(TARGET)
install : ${DEST}/${TARGET} install : ${BINDIR}/$(TARGET)
${DEST}/${TARGET} : ${TARGET} ${BINDIR}/$(TARGET) : $(TARGET)
cp -p ${TARGET} $@ ${INSTALL_PROGRAM} $(TARGET) ${BINDIR}

View File

@ -468,6 +468,8 @@ int avr_read ( int fd, struct avrpart * p, AVRMEM memtype )
unsigned char * buf; unsigned char * buf;
int bufsize; int bufsize;
start = 0;
switch (memtype) { switch (memtype) {
case AVR_FLASH : case AVR_FLASH :
memt = AVR_FLASH_LO; memt = AVR_FLASH_LO;
@ -1009,6 +1011,10 @@ int fileio_rbin ( struct fioparms * fio,
case FIO_WRITE: case FIO_WRITE:
rc = fwrite(buf, 1, size, f); rc = fwrite(buf, 1, size, f);
break; break;
default:
fprintf(stderr, "%s: fileio: invalid operation=%d\n",
progname, fio->op);
return -1;
} }
if (rc < size) { if (rc < size) {
@ -1697,6 +1703,7 @@ int go_interactive ( int fd, struct avrpart * p )
int argc; int argc;
char ** argv; char ** argv;
rc = 0;
fprintf(stdout, "avrprog> "); fprintf(stdout, "avrprog> ");
while (fgets(cmdbuf, MAX_LINE_LEN, stdin) != NULL) { while (fgets(cmdbuf, MAX_LINE_LEN, stdin) != NULL) {
len = strlen(cmdbuf); len = strlen(cmdbuf);
@ -1722,7 +1729,6 @@ int go_interactive ( int fd, struct avrpart * p )
fprintf(stdout, "%s ", argv[i]); fprintf(stdout, "%s ", argv[i]);
fprintf(stdout, "\n"); fprintf(stdout, "\n");
#if 1
/* run the command */ /* run the command */
rc = do_cmd(fd, p, argc, argv); rc = do_cmd(fd, p, argc, argv);
free(argv); free(argv);
@ -1730,7 +1736,6 @@ int go_interactive ( int fd, struct avrpart * p )
rc = 0; rc = 0;
break; break;
} }
#endif
fprintf(stdout, "avrprog> "); fprintf(stdout, "avrprog> ");
} }