Francois PONSARD 2 лет назад
Родитель
Сommit
60d54a45cc
5 измененных файлов с 11 добавлено и 1 удалено
  1. 3 0
      Makefile
  2. 1 0
      fifo.c
  3. 3 1
      pert_interf.c
  4. 2 0
      pertd2.c
  5. 2 0
      sleep_us.c

+ 3 - 0
Makefile

@@ -19,3 +19,6 @@ sleep_us.o: sleep_us.c
 
 fifo.o: fifo.c
 	cc    -c -o fifo.o fifo.c
+
+clean: 
+	rm -f *.o pertd2

+ 1 - 0
fifo.c

@@ -5,6 +5,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #define BUF_SIZE 512
 char buffer[BUF_SIZE];

+ 3 - 1
pert_interf.c

@@ -78,7 +78,9 @@ const static unsigned char rowoffset[4] =
  */
 void wrtch(unsigned char c) {
 	if (write(pert_fd,&c,1) != 1)
-		fprintf(stderr,"Error writing to pert: %s\n",c);
+    // %s makes a warning
+		//fprintf(stderr,"Error writing to pert: %s\n",c);
+		fprintf(stderr,"Error writing to pert: %d\n",c);
 	tcdrain(pert_fd);
 	sleep_us(char_delay);
 	}

+ 2 - 0
pertd2.c

@@ -15,8 +15,10 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "fifo.h"
 #include "pert_interf.h"
+#include "sleep_us.h"
 
 # define BUF_SIZE 512
 

+ 2 - 0
sleep_us.c

@@ -2,6 +2,8 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stddef.h>
+#include <unistd.h>
+#include <time.h>
 
 /* From Advanced Programming in the Unix Environment
  * by W. Richard Stevens. */