From: Othmar Gsenger Date: Wed, 14 Dec 2011 21:04:09 +0000 (+0000) Subject: added uncompressor X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=ff160af1cca5874b008f13495ad723510bac7fbb;p=svn42.git added uncompressor --- diff --git a/rf433rcv/pc/Makefile b/rf433rcv/pc/Makefile index 8ff6534..6badbc0 100644 --- a/rf433rcv/pc/Makefile +++ b/rf433rcv/pc/Makefile @@ -36,11 +36,14 @@ endif OBJS = $(PROG).o hid.o -all: $(TARGET) compress +all: $(TARGET) compress uncompress compress: compress.c $(CC) -o compress compress.c +uncompress: uncompress.c + $(CC) -o uncompress uncompress.c + $(PROG): $(OBJS) $(CC) -o $(PROG) $(OBJS) $(LIBS) $(STRIP) $(PROG) diff --git a/rf433rcv/pc/uncompress.c b/rf433rcv/pc/uncompress.c new file mode 100644 index 0000000..14d20b8 --- /dev/null +++ b/rf433rcv/pc/uncompress.c @@ -0,0 +1,32 @@ +#include +#include +#include + +#define MAX_RAM 502 + +void main() +{ + unsigned char input[MAX_RAM]; + uint16_t i=0; + uint16_t len=0; + uint16_t len_net=0; + + len=read(0,input,MAX_RAM+1); + if (len<1) + { + perror("read(): "); + } else if (len==MAX_RAM+1) { + printf("File to big"); + } + + len_net= *((uint16_t *) input); + len = ntohs(len_net); + //very unsave!!! + for(i=2*8; i