From 724671a2adb689e1463990f08737d905f0537489 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Wed, 22 Aug 2012 22:49:19 +0200 Subject: [PATCH] examples/tt now runs on FreeBSD --- cde/.gitignore | 3 +++ cde/examples/tt/Makefile.FreeBSD | 45 ++++++++++++++++++++++++++++++++ cde/examples/tt/broadcast.c | 36 ++++++++++++++----------- 3 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 cde/examples/tt/Makefile.FreeBSD diff --git a/cde/.gitignore b/cde/.gitignore index 7b786417..1ebea60d 100644 --- a/cde/.gitignore +++ b/cde/.gitignore @@ -74,6 +74,9 @@ config/util/makestrs config/util/mergelib config/util/xmkmf +# exampls +examples/tt/broadcast + # Compiled binaries and misc generated program files programs/dsdm/dsdm programs/dtaction/dtaction diff --git a/cde/examples/tt/Makefile.FreeBSD b/cde/examples/tt/Makefile.FreeBSD new file mode 100644 index 00000000..9d153fa5 --- /dev/null +++ b/cde/examples/tt/Makefile.FreeBSD @@ -0,0 +1,45 @@ +# $XConsortium: Makefile.ibm /main/2 1996/05/13 12:02:39 drk $ +########################################################################## +# +# Makefile for ToolTalk examples (IBM) +# +# (c) Copyright 1993, 1994 Hewlett-Packard Company +# (c) Copyright 1993, 1994 International Business Machines Corp. +# (c) Copyright 1993, 1994 Sun Microsystems, Inc. +# (c) Copyright 1993, 1994 Novell, Inc. +# +########################################################################## + +CC = clang +RM = rm -f + +PROGRAM = broadcast +SOURCES = broadcast.c +OBJECTS = broadcast.o + +DEFINES = +CDEBUGFLAGS = -O -g +CFLAGS = $(DEFINES) $(CDEBUGFLAGS) + +DTINCLUDE = -I/usr/dt/include +X11INCLUDE = -I/usr/local/include + +INCLUDES = $(DTINCLUDE) $(X11INCLUDE) + +DTLIBS = -L/usr/dt/lib -ltt -L/usr/local/lib -lXm +X11LIBS = -L/usr/local/lib -lXt -lX11 +SYSLIBS = + +LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS) +LDFLAGS = + +.c.o: + $(CC) -c $(CFLAGS) $(INCLUDES) $< + +all:: $(PROGRAM) + +$(PROGRAM):: $(OBJECTS) + $(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES) + +clean:: + $(RM) $(PROGRAM) $(OBJECTS) diff --git a/cde/examples/tt/broadcast.c b/cde/examples/tt/broadcast.c index a2a3fcda..039a83ce 100644 --- a/cde/examples/tt/broadcast.c +++ b/cde/examples/tt/broadcast.c @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -50,7 +51,7 @@ void receive_tt_message(); void create_ui_components(); -void +int main(argc, argv) int argc; char **argv; @@ -64,7 +65,7 @@ main(argc, argv) */ toplevel = XtVaAppInitialize(&app, "ttsample1", NULL, 0, &argc, argv, NULL, NULL); - XtVaSetValues(toplevel, XmNtitle, "ToolTalk Sample 1", 0); + XtVaSetValues(toplevel, XmNtitle, "ToolTalk Sample 1", NULL); create_ui_components(); /* @@ -75,6 +76,11 @@ main(argc, argv) my_procid = tt_open(); ttfd = tt_fd(); + if (ttfd < 0) { + fprintf(stderr, "Cannot get tt_fd, err=%d\n", ttfd); + return -1; + } + /* * Arrange for Motif to call receive_tt_message when the ToolTalk @@ -112,7 +118,7 @@ main(argc, argv) */ tt_close(); - exit(0); + return 0; } @@ -132,9 +138,9 @@ broadcast_value(widget, client_data, call_data) * ttsample1_value(in int