ldc: Small fixes (includes, less warnings etc.)
authorPhilipp Hachtmann <hachti@hachti.de>
Tue, 17 May 2016 11:50:02 +0000 (13:50 +0200)
committerPhilipp Hachtmann <hachti@hachti.de>
Tue, 17 May 2016 11:50:02 +0000 (13:50 +0200)
Signed-off-by: Philipp Hachtmann <hachti@hachti.de>
pc-tools/ldc/Makefile
pc-tools/ldc/hw_types.h
pc-tools/ldc/ldc.c
pc-tools/ldc/ldc.h [new file with mode: 0644]
pc-tools/ldc/process.c
pc-tools/ldc/process.h
pc-tools/ldc/split.c
pc-tools/ldc/tape.c
pc-tools/ldc/tape.h

index df7c0f3850bbc0d667529917cb3a9b960248bf6f..9902505aa568c0e37a9b06556dbe5a034cde41ca 100644 (file)
@@ -1,9 +1,11 @@
 default: ldc
 
+CFLAGS=-Wall
+
 %.o: %.c *.h
        @echo -n Baue: $@
        @echo
-       @gcc -c -Wunknown-pragmas -o$@  $<
+       @gcc ${CFLAGS} -c -Wunknown-pragmas -o$@  $<
 
 
 ldc: ldc.o process.o hw_helpers.o tape.o split.o
index cb79661618c3d202892b27d657286a67d2db93e2..e5671157754e8de9e4108c40d518d1abae0c823c 100644 (file)
@@ -32,9 +32,9 @@ struct hw16_tape {
 };
 
 struct hw16_bytes {
-    unsigned char low __attribute__ ((packed));
-    unsigned char high __attribute__ ((packed));
-};
+    unsigned char low;
+    unsigned char high;
+}  __attribute__((packed)) w;
 
 struct hw16_otype {
     unsigned int space1:6 __attribute__ ((packed));
@@ -149,12 +149,12 @@ typedef union{
     
 
 typedef union {
-    struct hw16_bits bits __attribute__ ((packed));
-    struct hw16_bytes bytes __attribute__ ((packed));
-    struct hw16_tape tape __attribute__ ((packed));
-    struct hw16_otype blocktype __attribute__ ((packed));
-    unsigned short value __attribute__ ((packed));
-} hw16;
+       struct hw16_bits bits;
+       struct hw16_bytes bytes;
+       struct hw16_tape tape;
+       struct hw16_otype blocktype;
+       unsigned short value;
+}  __attribute__ ((packed)) hw16;
 
 enum {BT_DATA,BT_STOP};
 
index 6a20558ff0c362312462bacbfb6894513722ec32..26a469edea560b05f59596d72e2f9ee3fc92a46d 100644 (file)
@@ -6,6 +6,10 @@
 #include <sys/select.h>
 #include "hw_types.h"
 #include "hw_helpers.h"
+#include "tape.h"
+#include "process.h"
+#include "split.h"
+
 #define XON 0x11
 #define XOFF 0x13
 #define CHAR_START 0x81
diff --git a/pc-tools/ldc/ldc.h b/pc-tools/ldc/ldc.h
new file mode 100644 (file)
index 0000000..8a5b157
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef LDC_H
+#define LDC_H
+
+void errf (char *format, ...);
+
+#endif
index 9dd71be48aab208836e620c6e7e3872d2eedee92..a21ac7ed3fbb254e185cdedcb8790f329edab78e 100644 (file)
@@ -3,7 +3,7 @@
 #include "hw_helpers.h"
 
 #include "process.h"
-
+#include "ldc.h"
 
 //#define DEBUG_DATA
 /**********************************************************************/
@@ -41,7 +41,7 @@ void block_dispose(datablock * victim){
 
 char ** extract_labels0(datablock * blockp){
     char ** result=(char **) malloc (sizeof(char **));
-    result[0]==NULL;
+    result[0] = NULL;
     if (get_blocktype(blockp)!=0) return NULL;
             
     datablock block;
@@ -65,7 +65,6 @@ char ** extract_labels0(datablock * blockp){
        strncpy (aktres,akt+dd,strlen(akt+dd));
        result=(char **)realloc(result, (c+1)* sizeof(char**));
        result[c]=aktres;
-//     printf("akt: %s\n",result[c]);
     }
     result=(char **)realloc(result, (c+1)* sizeof(char**));
     result[c]=NULL;
@@ -75,7 +74,6 @@ char ** extract_labels0(datablock * blockp){
 }
 
 void dispose_labels(char ** labels){
-    char * akt;
     if (labels==NULL) return;
     int c=0;
     do {
index 825003f85abc18875cdee2bd63d46a9790517aa5..87dedccc0f2f7bd86671dfa1b87517ee94078402 100644 (file)
@@ -4,7 +4,7 @@
 void process_block (datablock * block);
 
 int get_blocktype (datablock * block);
-int get_subblocktype (datablock * block);
+int get_blocksubtype(datablock * block);
 void block_copy(datablock * dest, datablock* src);
 datablock * block_clone(datablock * original);
 void block_dispose(datablock * victim);
index ad305a5dae8034fcbe570aeb6075b5dbc5fe92b1..e28f862c2d70d4511db22bfb9e1b666658b44dbe 100644 (file)
@@ -2,6 +2,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "hw_types.h"
 #include "hw_helpers.h"
index 6225ca1ccd70708b1677481d7f02c2e40753810e..472b73c3474c43df12dd13e8e8985b05da6a719d 100644 (file)
@@ -4,6 +4,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <unistd.h>
 
 #include "tape.h"
 
index 15c8f79ff6612db387a1e0f3a6f6df2a4138cfd6..7b1bdc7e3b2c885ad8b5475a19834e2b2abb83b4 100644 (file)
@@ -1,4 +1,4 @@
 void tapeinit(int fg);
-void tapeclose();
-void tapestart();
-void tapestop();
+void tapeclose(void);
+void tapestart(void);
+void tapestop(void);