Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
45
cde/examples/dtterm/Makefile.hp
Normal file
45
cde/examples/dtterm/Makefile.hp
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.hp /main/2 1996/05/13 11:51:00 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtterm examples (HP)
|
||||
#
|
||||
# (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 = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = term
|
||||
SOURCES = term.c
|
||||
OBJECTS = term.o
|
||||
|
||||
DEFINES = -D_HPUX_SOURCE
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Aa -z $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/include/X11R5
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtTerm -lXm
|
||||
X11LIBS = -L/usr/lib/X11R5 -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)
|
||||
45
cde/examples/dtterm/Makefile.ibm
Normal file
45
cde/examples/dtterm/Makefile.ibm
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.ibm /main/3 1996/05/13 11:51:14 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtterm 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 = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = term
|
||||
SOURCES = term.c
|
||||
OBJECTS = term.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -lDtTerm -lXm
|
||||
X11LIBS = -L/usr/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)
|
||||
45
cde/examples/dtterm/Makefile.novell
Normal file
45
cde/examples/dtterm/Makefile.novell
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.novell /main/2 1996/05/13 11:51:28 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtterm examples (Novell)
|
||||
#
|
||||
# (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 = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = term
|
||||
SOURCES = term.c
|
||||
OBJECTS = term.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/X/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtTerm -lXm
|
||||
X11LIBS = -L/usr/X/lib -lXt -lX11
|
||||
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket -lXIM
|
||||
|
||||
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)
|
||||
45
cde/examples/dtterm/Makefile.sun
Normal file
45
cde/examples/dtterm/Makefile.sun
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.sun /main/2 1996/05/13 11:51:45 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtterm examples (SUN)
|
||||
#
|
||||
# (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 = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = term
|
||||
SOURCES = term.c
|
||||
OBJECTS = term.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/openwin/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtTerm -lDtHelp -lXm
|
||||
X11LIBS = -L/usr/openwin/lib -lXt -lX11
|
||||
SYSLIBS = -ldl -lw -lgen
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS = -R/usr/dt/lib:/usr/openwin/lib
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
$(RM) $(PROGRAM) $(OBJECTS)
|
||||
46
cde/examples/dtterm/Makefile.uxp
Normal file
46
cde/examples/dtterm/Makefile.uxp
Normal file
@@ -0,0 +1,46 @@
|
||||
# $XConsortium: Makefile.uxp /main/2 1996/05/13 11:52:00 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtterm examples (UXP)
|
||||
#
|
||||
# (Fujitsu.patch applied)
|
||||
#
|
||||
# (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 = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = term
|
||||
SOURCES = term.c
|
||||
OBJECTS = term.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtTerm -lDtHelp -lDtSvc -ltt -lXm
|
||||
X11LIBS = -L/usr/X/lib -lXt -lX11
|
||||
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket -lm
|
||||
|
||||
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)
|
||||
8
cde/examples/dtterm/README
Normal file
8
cde/examples/dtterm/README
Normal file
@@ -0,0 +1,8 @@
|
||||
/* $XConsortium: README /main/2 1996/07/15 14:02:03 drk $ */
|
||||
|
||||
This directory contains demonstrations of the DtTerm library.
|
||||
|
||||
term - Example application using a DtTerm widget. The application
|
||||
runs a shell in the terminal window and provides push
|
||||
button shortcuts for several commands.
|
||||
|
||||
140
cde/examples/dtterm/term.c
Normal file
140
cde/examples/dtterm/term.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/* $XConsortium: term.c /main/3 1995/10/27 10:40:51 rswiston $ */
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* term.c
|
||||
*
|
||||
* Example code for DtTerm widget
|
||||
*
|
||||
* Create a terminal widget running a shell and provide
|
||||
* push button shortcuts for shell commands. Regular shell
|
||||
* commands can be entered also.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <Xm/MessageB.h>
|
||||
#include <Xm/Frame.h>
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <Dt/Term.h>
|
||||
|
||||
static Widget toplevel;
|
||||
|
||||
static void CreateTerm(Widget, char *);
|
||||
static void SendCommandCb(Widget, XtPointer, XtPointer);
|
||||
static void AddCommandButton(Widget, char *, char *);
|
||||
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
XtAppContext appContext;
|
||||
Arg args[20];
|
||||
int n;
|
||||
XmString labelString;
|
||||
|
||||
Widget mainWindow, termContainer, termTitle;
|
||||
|
||||
/* Initialize DtTerm widget library */
|
||||
|
||||
DtTermInitialize();
|
||||
|
||||
toplevel = XtAppInitialize(&appContext, "Term", NULL, 0, &argc, argv,
|
||||
NULL, NULL, 0);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNdialogType, XmDIALOG_TEMPLATE); n++;
|
||||
mainWindow = XmCreateMessageBox(toplevel, "mainWindow", args, n);
|
||||
XtManageChild(mainWindow);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNmarginWidth, 10); n++;
|
||||
XtSetArg(args[n], XmNmarginHeight, 10); n++;
|
||||
termContainer = XmCreateFrame(mainWindow, "termContainer", args, n);
|
||||
XtManageChild(termContainer);
|
||||
|
||||
labelString = XmStringCreateLocalized("DtTerm with date and time shortcuts");
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
|
||||
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
||||
termTitle = XmCreateLabel(termContainer, "termTitle", args, n);
|
||||
XtManageChild(termTitle);
|
||||
XmStringFree(labelString);
|
||||
|
||||
/* Create the terminal widget */
|
||||
|
||||
CreateTerm(termContainer, "/bin/sh");
|
||||
|
||||
/* Add shortcut buttons to the message box */
|
||||
|
||||
AddCommandButton(mainWindow, "Today", "date\n");
|
||||
AddCommandButton(mainWindow, "Month", "cal\n");
|
||||
AddCommandButton(mainWindow, "1994", "clear;cal 1994\n");
|
||||
AddCommandButton(mainWindow, "1995", "clear;cal 1995\n");
|
||||
AddCommandButton(mainWindow, "1996", "clear;cal 1996\n");
|
||||
AddCommandButton(mainWindow, "1997", "clear;cal 1997\n");
|
||||
AddCommandButton(mainWindow, "1998", "clear;cal 1998\n");
|
||||
AddCommandButton(mainWindow, "1999", "clear;cal 1999\n");
|
||||
AddCommandButton(mainWindow, "2000", "clear;cal 2000\n");
|
||||
|
||||
XtRealizeWidget(toplevel);
|
||||
XtAppMainLoop(appContext);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a DtTerm
|
||||
*/
|
||||
|
||||
static void CreateTerm(Widget parent, char *cmd)
|
||||
{
|
||||
Widget term;
|
||||
Arg args[20];
|
||||
int n;
|
||||
|
||||
/*
|
||||
* Create a DtTerm widget.
|
||||
* Pass the command to execute.
|
||||
* Configure the window to fit a calendar year.
|
||||
*/
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], DtNsubprocessCmd, cmd); n++;
|
||||
XtSetArg(args[n], DtNrows, 46); n++;
|
||||
XtSetArg(args[n], DtNcolumns, 80); n++;
|
||||
term = DtCreateTerm(parent, "term", args, n);
|
||||
XtManageChild(term);
|
||||
}
|
||||
|
||||
static void AddCommandButton(Widget parent, char *label, char *cmd)
|
||||
{
|
||||
XmString labelString;
|
||||
Arg args[1];
|
||||
Widget button;
|
||||
|
||||
/* Create a pushbutton which will send a command to the terminal */
|
||||
|
||||
labelString = XmStringCreateLocalized(label);
|
||||
XtSetArg(args[0], XmNlabelString, labelString);
|
||||
button = XmCreatePushButton(parent, label, args, 1);
|
||||
XtManageChild(button);
|
||||
XmStringFree(labelString);
|
||||
XtAddCallback(button, XmNactivateCallback, SendCommandCb, (XtPointer)cmd);
|
||||
}
|
||||
|
||||
static void SendCommandCb(Widget w, XtPointer cd, XtPointer cb)
|
||||
{
|
||||
Widget term = XtNameToWidget(toplevel, "*term");
|
||||
unsigned char *cmd = (unsigned char*)cd;
|
||||
|
||||
/* send the pushbutton command to the terminal widget */
|
||||
|
||||
DtTermSubprocSend(term, cmd, strlen((char*)cmd));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user