Browse Source

termios test program, since I'm having difficulty on powerpc

David Schleef 24 years ago
parent
commit
43989bfe8b
2 changed files with 63 additions and 0 deletions
  1. 39 0
      test/termios/Makefile
  2. 24 0
      test/termios/termios.c

+ 39 - 0
test/termios/Makefile

@@ -0,0 +1,39 @@
+TESTDIR=../
+include $(TESTDIR)/Rules.mak
+
+
+
+TARGETS=termios termios_glibc
+
+all: $(TARGETS)
+
+termios: termios.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(TESTCC)
+	-@ echo "-------"
+	-@ echo " "
+	-@ echo "Compiling vs uClibc: "
+	-@ echo " "
+	$(TESTCC) $(CFLAGS) -c $< -o $@.o
+	$(TESTCC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
+	$(STRIPTOOL) -x -R .note -R .comment $@
+	-ldd $@
+	ls $(LSFLAGS) $@
+	-./$@
+	-@ echo " "
+
+termios_glibc: termios.c Makefile
+	-@ echo "-------"
+	-@ echo " "
+	-@ echo "Compiling vs GNU libc: "
+	-@ echo " "
+	$(CC) $(CFLAGS) -c $< -o $@.o
+	$(CC) $(LDFLAGS) $@.o -o $@
+	$(STRIPTOOL) -x -R .note -R .comment $@
+	-ldd $@
+	ls $(LSFLAGS) $@
+	-./$@
+	-@ echo " "
+
+clean:
+	rm -f *.[oa] *~ core $(TARGETS)
+
+

+ 24 - 0
test/termios/termios.c

@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
+#include <asm/ioctls.h>
+
+int main(int argc,char *argv[])
+{
+	struct termios t;
+	int ret;
+
+	printf("TCGETS = 0x%08x\n",TCGETS);
+	printf("sizeof(struct termios) = %d\n",sizeof(struct termios));
+
+	ret = ioctl(fileno(stdout),TCGETS,&t);
+
+	if(ret<0){
+		perror("ioctl");
+	}else{
+		printf("ioctl returned %d\n",ret);
+	}
+
+	return 0;
+}