summaryrefslogtreecommitdiff
path: root/payloads/libpayload/curses/PDCurses/os2
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/curses/PDCurses/os2')
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/README43
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/bccos2.mak90
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/gccos2.mak148
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/iccos2.lrf50
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/iccos2.mak256
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcclip.c185
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcdisp.c95
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcgetsc.c91
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdckbd.c519
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcos2.h51
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcscrn.c422
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcsetsc.c110
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/pdcutil.c36
-rw-r--r--payloads/libpayload/curses/PDCurses/os2/wccos2.mak43
14 files changed, 2139 insertions, 0 deletions
diff --git a/payloads/libpayload/curses/PDCurses/os2/README b/payloads/libpayload/curses/PDCurses/os2/README
new file mode 100644
index 0000000000..7fde884e08
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/README
@@ -0,0 +1,43 @@
+PDCurses for OS/2
+=================
+
+This directory contains PDCurses source code files specific to OS/2.
+
+
+Building
+--------
+
+. Choose the appropriate makefile for your compiler:
+
+ bccos2.mak - Borland C++ 2.0
+ gccos2.mak - EMX 0.9b+
+ iccos2.mak - C Set/2
+ wccos2.mak - Watcom 10.6+ (32-bit)
+
+. Optionally, you can build in a different directory than the platform
+ directory by setting PDCURSES_SRCDIR to point to the directory where
+ you unpacked PDCurses, and changing to your target directory:
+
+ set PDCURSES_SRCDIR=c:\pdcurses
+
+. Build it:
+
+ make -f makefilename
+
+ (For Watcom, use "wmake" instead of "make"; for MSVC or C Set/2,
+ "nmake".) You'll get the libraries (pdcurses.lib or .a, depending on
+ your compiler; and panel.lib or .a), the demos (*.exe), and a lot of
+ object files. Note that the panel library is just a copy of the main
+ library, provided for convenience; both panel and curses functions are
+ in the main library.
+
+ You can also use the optional parameter "DLL=Y" with EMX, to build the
+ library as a DLL:
+
+ make -f gccos2.mak DLL=Y
+
+
+Distribution Status
+-------------------
+
+The files in this directory are released to the Public Domain.
diff --git a/payloads/libpayload/curses/PDCurses/os2/bccos2.mak b/payloads/libpayload/curses/PDCurses/os2/bccos2.mak
new file mode 100644
index 0000000000..1c7d77a3fe
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/bccos2.mak
@@ -0,0 +1,90 @@
+# Borland MAKE Makefile for PDCurses library - OS/2 BC++ 1.0+
+#
+# Usage: make -f [path\]bccos2.mak [DEBUG=] [target]
+#
+# where target can be any of:
+# [all|demos|pdcurses.lib|testcurs.exe...]
+
+O = obj
+
+!ifndef PDCURSES_SRCDIR
+PDCURSES_SRCDIR = ..
+!endif
+
+!include $(PDCURSES_SRCDIR)\version.mif
+!include $(PDCURSES_SRCDIR)\libobjs.mif
+
+osdir = $(PDCURSES_SRCDIR)\os2
+
+CC = bcc
+
+!ifdef DEBUG
+CFLAGS = -N -v -y -DPDCDEBUG
+!else
+CFLAGS = -O
+!endif
+
+CPPFLAGS = -I$(PDCURSES_SRCDIR)
+
+BUILD = $(CC) -c $(CFLAGS) $(CPPFLAGS)
+
+LINK = tlink
+
+LIBEXE = tlib /C /E
+
+LIBCURSES = pdcurses.lib
+
+all: $(LIBCURSES) $(DEMOS)
+
+clean:
+ -del *.obj
+ -del *.lib
+ -del *.exe
+
+demos: $(DEMOS)
+
+$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
+ -del $@
+ $(LIBEXE) $@ \
++addch.obj +addchstr.obj +addstr.obj +attr.obj +beep.obj +bkgd.obj \
++border.obj +clear.obj +color.obj +delch.obj +deleteln.obj +deprec.obj \
++getch.obj +getstr.obj +getyx.obj +inch.obj +inchstr.obj +initscr.obj \
++inopts.obj +insch.obj +insstr.obj +instr.obj +kernel.obj +keyname.obj \
++mouse.obj +move.obj +outopts.obj +overlay.obj +pad.obj +panel.obj \
++printw.obj +refresh.obj +scanw.obj +scr_dump.obj +scroll.obj +slk.obj \
++termattr.obj +terminfo.obj +touch.obj +util.obj +window.obj +debug.obj \
++pdcclip.obj +pdcdisp.obj +pdcgetsc.obj +pdckbd.obj +pdcscrn.obj \
++pdcsetsc.obj +pdcutil.obj ,lib.map
+ -copy $(LIBCURSES) panel.lib
+
+.autodepend
+
+{$(srcdir)\}.c.obj:
+ $(BUILD) $<
+
+{$(osdir)\}.c.obj:
+ $(BUILD) $<
+
+{$(demodir)\}.c.obj:
+ $(BUILD) $<
+
+.c.obj:
+ $(BUILD) $<
+
+.obj.exe:
+ $(CC) -e$@ $** $(LIBCURSES)
+
+tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
+ $(CC) -e$@ $**
+
+tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
+ $(BUILD) -I$(demodir) $(demodir)\tui.c
+
+tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
+ $(BUILD) -I$(demodir) $(demodir)\tuidemo.c
+
+PLATFORM1 = Borland C++ OS/2 1.0
+PLATFORM2 = Borland C/C++ OS/2 1.0
+ARCNAME = pdc$(VER)bcos2
+
+!include $(PDCURSES_SRCDIR)\makedist.mif
diff --git a/payloads/libpayload/curses/PDCurses/os2/gccos2.mak b/payloads/libpayload/curses/PDCurses/os2/gccos2.mak
new file mode 100644
index 0000000000..07d4dca411
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/gccos2.mak
@@ -0,0 +1,148 @@
+# GNU MAKE Makefile for PDCurses library - OS/2 emx 0.9c+
+#
+# Usage: make -f [path\]gccos2.mak [DEBUG=Y] [EMXVIDEO=Y] [DLL=Y] [target]
+#
+# where target can be any of:
+# [all|demos|pdcurses.a|testcurs.exe...]
+#
+# The EMXVIDEO option compiles with the emx video library, which
+# enables a PDCurses program to run under OS/2 and DOS.
+
+O = o
+
+ifndef PDCURSES_SRCDIR
+ PDCURSES_SRCDIR = ..
+endif
+
+include $(PDCURSES_SRCDIR)/version.mif
+include $(PDCURSES_SRCDIR)/libobjs.mif
+
+osdir = $(PDCURSES_SRCDIR)/os2
+
+PDCURSES_OS2_H = $(osdir)/pdcos2.h
+
+CC = gcc
+
+CFLAGS = -I$(PDCURSES_SRCDIR) -c -Wall
+
+ifeq ($(EMXVIDEO),Y)
+ CFLAGS += -DEMXVIDEO
+ CCLIBS = -lvideo
+ BINDFLAGS = -acm
+else
+ CCLIBS =
+ BINDFLAGS =
+endif
+
+ifeq ($(DEBUG),Y)
+ CFLAGS += -g -DPDCDEBUG
+ LDFLAGS = -g
+else
+ CFLAGS += -O2
+ LDFLAGS =
+endif
+
+BASEDEF = $(PDCURSES_SRCDIR)\exp-base.def
+
+DEFDEPS = $(BASEDEF)
+
+DEFFILE = pdcurses.def
+
+DLLTARGET = pdcurses.dll
+DLLFLAGS = -Zdll -Zcrtdll -Zomf
+
+LINK = gcc
+EMXBIND = emxbind
+EMXOMF = emxomf
+
+LIBEXE = ar
+LIBFLAGS = rcv
+
+ifeq ($(DLL),Y)
+ CFLAGS += -Zdll -Zcrtdll -Zomf
+ LDFLAGS += -Zlinker /PM:VIO -Zomf -Zcrtdll
+ LIBCURSES = pdcurses.lib
+ LIBDEPS = $(LIBOBJS) $(PDCOBJS) $(DEFFILE)
+ PDCLIBS = $(DLLTARGET)
+ EXEPOST =
+ TUIPOST =
+ CLEAN = *.dll *.lib $(DEFFILE)
+else
+ LIBCURSES = pdcurses.a
+ LIBDEPS = $(LIBOBJS) $(PDCOBJS)
+ PDCLIBS = $(LIBCURSES)
+ EXEPOST = $(EMXBIND) $* $(BINDFLAGS)
+ TUIPOST = $(EMXBIND) tuidemo $(BINDFLAGS)
+ CLEAN = *.a testcurs newdemo xmas tuidemo firework ptest rain worm
+endif
+
+.PHONY: all libs clean demos dist
+
+all: libs demos
+
+libs: $(PDCLIBS)
+
+clean:
+ -del *.o
+ -del *.exe
+ -del $(CLEAN)
+
+demos: $(DEMOS)
+
+DEMOOBJS = testcurs.o newdemo.o xmas.o tui.o tuidemo.o firework.o \
+ptest.o rain.o worm.o
+
+$(DEFFILE) : $(DEFDEPS)
+ echo LIBRARY PDCURSES > $@
+ echo DESCRIPTION 'PDCurses 3.4 Dynamic Linking library' >> $@
+ echo PROTMODE >>$@
+ echo DATA MULTIPLE READWRITE LOADONCALL >> $@
+ echo CODE LOADONCALL >> $@
+ echo EXPORTS >> $@
+ type $(BASEDEF) >> $@
+
+$(LIBCURSES) : $(LIBDEPS)
+ $(LIBEXE) $(LIBFLAGS) $@ $?
+ -copy $(LIBCURSES) panel.a
+
+$(DLLTARGET) : $(LIBDEPS)
+ $(LINK) $(DLLFLAGS) -o $(DLLTARGET) $? $(DEFFILE)
+# lxlite $(DLLTARGET)
+ emximp -o $(LIBCURSES) $(DEFFILE)
+
+$(LIBOBJS) $(PDCOBJS) $(DEMOOBJS) : $(PDCURSES_HEADERS)
+$(PDCOBJS) : $(PDCURSES_OS2_H)
+$(DEMOS) : $(LIBCURSES)
+panel.o ptest.o: $(PANEL_HEADER)
+terminfo.o: $(TERM_HEADER)
+
+$(LIBOBJS) : %.o: $(srcdir)/%.c
+ $(CC) -c $(CFLAGS) -o$@ $<
+
+$(PDCOBJS) : %.o: $(osdir)/%.c
+ $(CC) -c $(CFLAGS) -o$@ $<
+
+firework.exe newdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
+ptest.exe: %.exe: %.o
+ $(LINK) $(LDFLAGS) -o $* $< $(LIBCURSES) $(CCLIBS)
+ $(EXEPOST)
+
+tuidemo.exe: tuidemo.o tui.o
+ $(LINK) $(LDFLAGS) -o tuidemo tuidemo.o tui.o $(LIBCURSES) $(CCLIBS)
+ $(TUIPOST)
+
+firework.o newdemo.o ptest.o rain.o testcurs.o worm.o xmas.o: %.o: \
+$(demodir)/%.c
+ $(CC) $(CFLAGS) -o$@ $<
+
+tui.o: $(demodir)\tui.c $(demodir)\tui.h
+ $(CC) $(CFLAGS) -I$(demodir) -o $@ $<
+
+tuidemo.o: $(demodir)\tuidemo.c
+ $(CC) $(CFLAGS) -I$(demodir) -o $@ $<
+
+PLATFORM1 = EMX OS/2
+PLATFORM2 = EMX 0.9d for OS/2
+ARCNAME = pdc$(VER)_emx_os2
+
+include $(PDCURSES_SRCDIR)/makedist.mif
diff --git a/payloads/libpayload/curses/PDCurses/os2/iccos2.lrf b/payloads/libpayload/curses/PDCurses/os2/iccos2.lrf
new file mode 100644
index 0000000000..b1fdf37e99
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/iccos2.lrf
@@ -0,0 +1,50 @@
+-+addch.obj &
+-+addchstr.obj &
+-+addstr.obj &
+-+attr.obj &
+-+beep.obj &
+-+bkgd.obj &
+-+border.obj &
+-+clear.obj &
+-+color.obj &
+-+delch.obj &
+-+deleteln.obj &
+-+deprec.obj &
+-+getch.obj &
+-+getstr.obj &
+-+getyx.obj &
+-+inch.obj &
+-+inchstr.obj &
+-+initscr.obj &
+-+inopts.obj &
+-+insch.obj &
+-+insstr.obj &
+-+instr.obj &
+-+kernel.obj &
+-+keyname.obj &
+-+mouse.obj &
+-+move.obj &
+-+outopts.obj &
+-+overlay.obj &
+-+pad.obj &
+-+panel.obj &
+-+printw.obj &
+-+refresh.obj &
+-+scanw.obj &
+-+scr_dump.obj &
+-+scroll.obj &
+-+slk.obj &
+-+termattr.obj &
+-+terminfo.obj &
+-+touch.obj &
+-+util.obj &
+-+window.obj &
+-+debug.obj &
+-+pdcclip.obj &
+-+pdcdisp.obj &
+-+pdcgetsc.obj &
+-+pdckbd.obj &
+-+pdcscrn.obj &
+-+pdcsetsc.obj &
+-+pdcutil.obj &
+,lib.map;
diff --git a/payloads/libpayload/curses/PDCurses/os2/iccos2.mak b/payloads/libpayload/curses/PDCurses/os2/iccos2.mak
new file mode 100644
index 0000000000..06a2c1fe8d
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/iccos2.mak
@@ -0,0 +1,256 @@
+# NMAKE Makefile for PDCurses library - OS/2 C Set/2
+#
+# Usage: nmake -f [path\]iccos2.mak [DEBUG=] [target]
+#
+# where target can be any of:
+# [all|demos|pdcurses.lib|testcurs.exe...]
+
+O = obj
+
+!ifndef PDCURSES_SRCDIR
+PDCURSES_SRCDIR = ..
+!endif
+
+!include $(PDCURSES_SRCDIR)\version.mif
+!include $(PDCURSES_SRCDIR)\libobjs.mif
+
+osdir = $(PDCURSES_SRCDIR)\os2
+
+PDCURSES_OS2_H = $(osdir)\pdcos2.h
+
+CC = icc
+
+!ifdef DEBUG
+CFLAGS = /Sm /Ti+ /O- /Q+ /dPDCDEBUG
+LDFLAGS = /NOLOGO /NOE /SE:160 /DEBUG /PMTYPE:VIO
+!else
+CFLAGS = /Sm /Ti- /O+ /Q+
+LDFLAGS = /NOLOGO /NOE /EXEPACK /PACKCODE /PACKDATA /PMTYPE:VIO
+!endif
+
+CPPFLAGS = -I$(PDCURSES_SRCDIR)
+
+BUILD = $(CC) -c $(CFLAGS) $(CPPFLAGS)
+
+LINK = link386
+
+LIBEXE = lib
+
+LIBCURSES = pdcurses.lib
+
+all: $(LIBCURSES) $(DEMOS)
+
+clean:
+ -del *.obj
+ -del *.lib
+ -del *.exe
+
+demos: $(DEMOS)
+
+$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
+ $(LIBEXE) $@ @$(osdir)\iccos2.lrf
+ -copy $(LIBCURSES) panel.lib
+
+addch.obj: $(srcdir)\addch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\addch.c
+
+addchstr.obj: $(srcdir)\addchstr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\addchstr.c
+
+addstr.obj: $(srcdir)\addstr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\addstr.c
+
+attr.obj: $(srcdir)\attr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\attr.c
+
+beep.obj: $(srcdir)\beep.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\beep.c
+
+bkgd.obj: $(srcdir)\bkgd.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\bkgd.c
+
+border.obj: $(srcdir)\border.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\border.c
+
+clear.obj: $(srcdir)\clear.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\clear.c
+
+color.obj: $(srcdir)\color.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\color.c
+
+delch.obj: $(srcdir)\delch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\delch.c
+
+deleteln.obj: $(srcdir)\deleteln.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\deleteln.c
+
+deprec.obj: $(srcdir)\deprec.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\deprec.c
+
+getch.obj: $(srcdir)\getch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\getch.c
+
+getstr.obj: $(srcdir)\getstr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\getstr.c
+
+getyx.obj: $(srcdir)\getyx.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\getyx.c
+
+inch.obj: $(srcdir)\inch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\inch.c
+
+inchstr.obj: $(srcdir)\inchstr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\inchstr.c
+
+initscr.obj: $(srcdir)\initscr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\initscr.c
+
+inopts.obj: $(srcdir)\inopts.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\inopts.c
+
+insch.obj: $(srcdir)\insch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\insch.c
+
+insstr.obj: $(srcdir)\insstr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\insstr.c
+
+instr.obj: $(srcdir)\instr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\instr.c
+
+kernel.obj: $(srcdir)\kernel.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\kernel.c
+
+keyname.obj: $(srcdir)\keyname.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\keyname.c
+
+mouse.obj: $(srcdir)\mouse.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\mouse.c
+
+move.obj: $(srcdir)\move.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\move.c
+
+outopts.obj: $(srcdir)\outopts.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\outopts.c
+
+overlay.obj: $(srcdir)\overlay.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\overlay.c
+
+pad.obj: $(srcdir)\pad.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\pad.c
+
+panel.obj: $(srcdir)\panel.c $(PDCURSES_HEADERS) $(PANEL_HEADER)
+ $(BUILD) $(srcdir)\panel.c
+
+printw.obj: $(srcdir)\printw.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\printw.c
+
+refresh.obj: $(srcdir)\refresh.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\refresh.c
+
+scanw.obj: $(srcdir)\scanw.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\scanw.c
+
+scr_dump.obj: $(srcdir)\scr_dump.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\scr_dump.c
+
+scroll.obj: $(srcdir)\scroll.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\scroll.c
+
+slk.obj: $(srcdir)\slk.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\slk.c
+
+termattr.obj: $(srcdir)\termattr.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\termattr.c
+
+terminfo.obj: $(srcdir)\terminfo.c $(PDCURSES_HEADERS) $(TERM_HEADER)
+ $(BUILD) $(srcdir)\terminfo.c
+
+touch.obj: $(srcdir)\touch.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\touch.c
+
+util.obj: $(srcdir)\util.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\util.c
+
+window.obj: $(srcdir)\window.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\window.c
+
+debug.obj: $(srcdir)\debug.c $(PDCURSES_HEADERS)
+ $(BUILD) $(srcdir)\debug.c
+
+pdcclip.obj: $(osdir)\pdcclip.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcclip.c
+
+pdcdisp.obj: $(osdir)\pdcdisp.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcdisp.c
+
+pdcgetsc.obj: $(osdir)\pdcgetsc.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcgetsc.c
+
+pdckbd.obj: $(osdir)\pdckbd.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdckbd.c
+
+pdcscrn.obj: $(osdir)\pdcscrn.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcscrn.c
+
+pdcsetsc.obj: $(osdir)\pdcsetsc.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcsetsc.c
+
+pdcutil.obj: $(osdir)\pdcutil.c $(PDCURSES_HEADERS) $(PDCURSES_OS2_H)
+ $(BUILD) $(osdir)\pdcutil.c
+
+firework.exe: firework.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+newdemo.exe: newdemo.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+ptest.exe: ptest.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+rain.exe: rain.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+testcurs.exe: testcurs.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj+tui.obj,$*,,$(LIBCURSES);
+
+worm.exe: worm.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+xmas.exe: xmas.obj $(LIBCURSES)
+ $(LINK) $(LDFLAGS) $*.obj,$*,,$(LIBCURSES);
+
+firework.obj: $(demodir)\firework.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\firework.c
+
+newdemo.obj: $(demodir)\newdemo.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\newdemo.c
+
+ptest.obj: $(demodir)\ptest.c $(PANEL_HEADER) $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\ptest.c
+
+rain.obj: $(demodir)\rain.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\rain.c
+
+testcurs.obj: $(demodir)\testcurs.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\testcurs.c
+
+tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\tui.c
+
+tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\tuidemo.c
+
+worm.obj: $(demodir)\worm.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\worm.c
+
+xmas.obj: $(demodir)\xmas.c $(PDCURSES_CURSES_H)
+ $(BUILD) $(demodir)\xmas.c
+
+PLATFORM1 = C Set/2 OS/2
+PLATFORM2 = C Set/2 for OS/2
+ARCNAME = pdc$(VER)_icc_os2
+
+!include $(PDCURSES_SRCDIR)\makedist.mif
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcclip.c b/payloads/libpayload/curses/PDCurses/os2/pdcclip.c
new file mode 100644
index 0000000000..1922bb83f0
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcclip.c
@@ -0,0 +1,185 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcclip.c,v 1.33 2008/07/14 04:24:51 wmcbrine Exp $")
+
+/*man-start**************************************************************
+
+ Name: clipboard
+
+ Synopsis:
+ int PDC_getclipboard(char **contents, long *length);
+ int PDC_setclipboard(const char *contents, long length);
+ int PDC_freeclipboard(char *contents);
+ int PDC_clearclipboard(void);
+
+ Description:
+ PDC_getclipboard() gets the textual contents of the system's
+ clipboard. This function returns the contents of the clipboard
+ in the contents argument. It is the responsibilitiy of the
+ caller to free the memory returned, via PDC_freeclipboard().
+ The length of the clipboard contents is returned in the length
+ argument.
+
+ PDC_setclipboard copies the supplied text into the system's
+ clipboard, emptying the clipboard prior to the copy.
+
+ PDC_clearclipboard() clears the internal clipboard.
+
+ Return Values:
+ indicator of success/failure of call.
+ PDC_CLIP_SUCCESS the call was successful
+ PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
+ the clipboard contents
+ PDC_CLIP_EMPTY the clipboard contains no text
+ PDC_CLIP_ACCESS_ERROR no clipboard support
+
+ Portability X/Open BSD SYS V
+ PDC_getclipboard - - -
+ PDC_setclipboard - - -
+ PDC_freeclipboard - - -
+ PDC_clearclipboard - - -
+
+**man-end****************************************************************/
+
+int PDC_getclipboard(char **contents, long *length)
+{
+#ifndef EMXVIDEO
+ HMQ hmq;
+ HAB hab;
+ PTIB ptib;
+ PPIB ppib;
+ ULONG ulRet;
+ long len;
+ int rc;
+#endif
+ PDC_LOG(("PDC_getclipboard() - called\n"));
+
+#ifndef EMXVIDEO
+ DosGetInfoBlocks(&ptib, &ppib);
+ ppib->pib_ultype = 3;
+ hab = WinInitialize(0);
+ hmq = WinCreateMsgQueue(hab, 0);
+
+ if (!WinOpenClipbrd(hab))
+ {
+ WinDestroyMsgQueue(hmq);
+ WinTerminate(hab);
+ return PDC_CLIP_ACCESS_ERROR;
+ }
+
+ rc = PDC_CLIP_EMPTY;
+
+ ulRet = WinQueryClipbrdData(hab, CF_TEXT);
+
+ if (ulRet)
+ {
+ len = strlen((char *)ulRet);
+ *contents = malloc(len + 1);
+
+ if (!*contents)
+ rc = PDC_CLIP_MEMORY_ERROR;
+ else
+ {
+ strcpy((char *)*contents, (char *)ulRet);
+ *length = len;
+ rc = PDC_CLIP_SUCCESS;
+ }
+ }
+
+ WinCloseClipbrd(hab);
+ WinDestroyMsgQueue(hmq);
+ WinTerminate(hab);
+
+ return rc;
+#else
+ return PDC_CLIP_ACCESS_ERROR;
+#endif
+}
+
+int PDC_setclipboard(const char *contents, long length)
+{
+#ifndef EMXVIDEO
+ HAB hab;
+ PTIB ptib;
+ PPIB ppib;
+ ULONG ulRC;
+ PSZ szTextOut = NULL;
+ int rc;
+#endif
+ PDC_LOG(("PDC_setclipboard() - called\n"));
+
+#ifndef EMXVIDEO
+ DosGetInfoBlocks(&ptib, &ppib);
+ ppib->pib_ultype = 3;
+ hab = WinInitialize(0);
+
+ if (!WinOpenClipbrd(hab))
+ {
+ WinTerminate(hab);
+ return PDC_CLIP_ACCESS_ERROR;
+ }
+
+ rc = PDC_CLIP_MEMORY_ERROR;
+
+ ulRC = DosAllocSharedMem((PVOID)&szTextOut, NULL, length + 1,
+ PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE);
+
+ if (ulRC == 0)
+ {
+ strcpy(szTextOut, contents);
+ WinEmptyClipbrd(hab);
+
+ if (WinSetClipbrdData(hab, (ULONG)szTextOut, CF_TEXT, CFI_POINTER))
+ rc = PDC_CLIP_SUCCESS;
+ else
+ {
+ DosFreeMem(szTextOut);
+ rc = PDC_CLIP_ACCESS_ERROR;
+ }
+ }
+
+ WinCloseClipbrd(hab);
+ WinTerminate(hab);
+
+ return rc;
+#else
+ return PDC_CLIP_ACCESS_ERROR;
+#endif
+}
+
+int PDC_freeclipboard(char *contents)
+{
+ PDC_LOG(("PDC_freeclipboard() - called\n"));
+
+ if (contents)
+ free(contents);
+
+ return PDC_CLIP_SUCCESS;
+}
+
+int PDC_clearclipboard(void)
+{
+#ifndef EMXVIDEO
+ HAB hab;
+ PTIB ptib;
+ PPIB ppib;
+#endif
+ PDC_LOG(("PDC_clearclipboard() - called\n"));
+
+#ifndef EMXVIDEO
+ DosGetInfoBlocks(&ptib, &ppib);
+ ppib->pib_ultype = 3;
+ hab = WinInitialize(0);
+
+ WinEmptyClipbrd(hab);
+
+ WinCloseClipbrd(hab);
+ WinTerminate(hab);
+
+ return PDC_CLIP_SUCCESS;
+#else
+ return PDC_CLIP_ACCESS_ERROR;
+#endif
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcdisp.c b/payloads/libpayload/curses/PDCurses/os2/pdcdisp.c
new file mode 100644
index 0000000000..4f886daf20
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcdisp.c
@@ -0,0 +1,95 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcdisp.c,v 1.49 2008/07/14 04:24:51 wmcbrine Exp $")
+
+/* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
+ match code page 437 and compatible pages (CP850, CP852, etc.) */
+
+#ifdef CHTYPE_LONG
+
+# define A(x) ((chtype)x | A_ALTCHARSET)
+
+chtype acs_map[128] =
+{
+ A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9),
+ A(10), A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18),
+ A(19), A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27),
+ A(28), A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&',
+ '\'', '(', ')', '*',
+
+ A(0x1a), A(0x1b), A(0x18), A(0x19),
+
+ '/',
+
+ 0xdb,
+
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
+ '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+
+ A(0x04), 0xb1,
+
+ 'b', 'c', 'd', 'e',
+
+ 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d,
+ 0x2d, 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3,
+ 0xf2, 0xe3, 0xd8, 0x9c, 0xf9,
+
+ A(127)
+};
+
+# undef A
+
+#endif
+
+/* position hardware cursor at (y, x) */
+
+void PDC_gotoyx(int row, int col)
+{
+ PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
+
+#ifdef EMXVIDEO
+ v_gotoxy(col, row);
+#else
+ VioSetCurPos(row, col, 0);
+#endif
+}
+
+/* update the given physical line to look like the corresponding line in
+ curscr */
+
+void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
+{
+ /* this should be enough for the maximum width of a screen. */
+
+ struct {unsigned char text, attr;} temp_line[256];
+ int j;
+
+ PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
+
+ /* replace the attribute part of the chtype with the
+ actual color value for each chtype in the line */
+
+ for (j = 0; j < len; j++)
+ {
+ chtype ch = srcp[j];
+
+ temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
+
+#ifdef CHTYPE_LONG
+ if (ch & A_ALTCHARSET && !(ch & 0xff80))
+ ch = acs_map[ch & 0x7f];
+#endif
+ temp_line[j].text = ch & 0xff;
+ }
+
+#ifdef EMXVIDEO
+ v_putline((char *)temp_line, x, lineno, len);
+#else
+ VioWrtCellStr((PCH)temp_line, (USHORT)(len * sizeof(unsigned short)),
+ (USHORT)lineno, (USHORT)x, 0);
+#endif
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcgetsc.c b/payloads/libpayload/curses/PDCurses/os2/pdcgetsc.c
new file mode 100644
index 0000000000..d712dadfa8
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcgetsc.c
@@ -0,0 +1,91 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcgetsc.c,v 1.39 2008/07/14 04:24:51 wmcbrine Exp $")
+
+/* return width of screen/viewport */
+
+int PDC_get_columns(void)
+{
+#ifdef EMXVIDEO
+ int rows = 0;
+#else
+ VIOMODEINFO modeInfo = {0};
+#endif
+ int cols = 0;
+ const char *env_cols;
+
+ PDC_LOG(("PDC_get_columns() - called\n"));
+
+#ifdef EMXVIDEO
+ v_dimen(&cols, &rows);
+#else
+ modeInfo.cb = sizeof(modeInfo);
+ VioGetMode(&modeInfo, 0);
+ cols = modeInfo.col;
+#endif
+ env_cols = getenv("COLS");
+
+ if (env_cols)
+ cols = min(atoi(env_cols), cols);
+
+ PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
+
+ return cols;
+}
+
+/* get the cursor size/shape */
+
+int PDC_get_cursor_mode(void)
+{
+#ifdef EMXVIDEO
+ int curstart = 0, curend = 0;
+#else
+ VIOCURSORINFO cursorInfo;
+#endif
+ PDC_LOG(("PDC_get_cursor_mode() - called\n"));
+
+#ifdef EMXVIDEO
+ v_getctype(&curstart, &curend);
+ return (curstart << 8) | curend;
+#else
+ VioGetCurType (&cursorInfo, 0);
+
+ return (cursorInfo.yStart << 8) | cursorInfo.cEnd;
+#endif
+}
+
+/* return number of screen rows */
+
+int PDC_get_rows(void)
+{
+#ifdef EMXVIDEO
+ int cols = 0;
+#else
+ VIOMODEINFO modeInfo = {0};
+#endif
+ int rows = 0;
+ const char *env_rows;
+
+ PDC_LOG(("PDC_get_rows() - called\n"));
+
+ /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
+ /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
+
+#ifdef EMXVIDEO
+ v_dimen(&cols, &rows);
+#else
+ modeInfo.cb = sizeof(modeInfo);
+ VioGetMode(&modeInfo, 0);
+ rows = modeInfo.row;
+#endif
+ env_rows = getenv("LINES");
+
+ if (env_rows)
+ rows = min(atoi(env_rows), rows);
+
+ PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
+
+ return rows;
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdckbd.c b/payloads/libpayload/curses/PDCurses/os2/pdckbd.c
new file mode 100644
index 0000000000..df79882ac7
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdckbd.c
@@ -0,0 +1,519 @@
+/* Public Domain Curses */
+
+#if defined(__EMX__) || defined(__WATCOMC__) || defined(__IBMC__) || \
+defined(__TURBOC__)
+# define HAVE_SIGNAL
+# include <signal.h>
+#endif
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdckbd.c,v 1.89 2008/07/14 04:24:51 wmcbrine Exp $")
+
+/*man-start**************************************************************
+
+ Name: pdckbd
+
+ Synopsis:
+ unsigned long PDC_get_input_fd(void);
+
+ Description:
+ PDC_get_input_fd() returns the file descriptor that PDCurses
+ reads its input from. It can be used for select().
+
+ Portability X/Open BSD SYS V
+ PDC_get_input_fd - - -
+
+**man-end****************************************************************/
+
+#ifdef EMXVIDEO
+# include <termios.h>
+static int tahead = -1;
+#else
+static KBDINFO kbdinfo; /* default keyboard mode */
+static HMOU mouse_handle = 0;
+static MOUSE_STATUS old_mouse_status;
+static USHORT old_shift = 0;
+static bool key_pressed = FALSE;
+static int mouse_events = 0;
+#endif
+
+/************************************************************************
+ * Table for key code translation of function keys in keypad mode *
+ * These values are for strict IBM keyboard compatibles only *
+ ************************************************************************/
+
+static short key_table[] =
+{
+ -1, ALT_ESC, -1, 0,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, ALT_BKSP, KEY_BTAB,
+ ALT_Q, ALT_W, ALT_E, ALT_R,
+ ALT_T, ALT_Y, ALT_U, ALT_I,
+ ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET,
+ ALT_ENTER, -1, ALT_A, ALT_S,
+ ALT_D, ALT_F, ALT_G, ALT_H,
+ ALT_J, ALT_K, ALT_L, ALT_SEMICOLON,
+ ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH,
+ ALT_Z, ALT_X, ALT_C, ALT_V,
+ ALT_B, ALT_N, ALT_M, ALT_COMMA,
+ ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR,
+ -1, -1, -1, KEY_F(1),
+ KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5),
+ KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9),
+ KEY_F(10), -1, -1, KEY_HOME,
+ KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT,
+ KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END,
+ KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC,
+ KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16),
+ KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20),
+ KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26),
+ KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30),
+ KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34),
+ KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40),
+ KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44),
+ KEY_F(45), KEY_F(46), -1, CTL_LEFT,
+ CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME,
+ ALT_1, ALT_2, ALT_3, ALT_4,
+ ALT_5, ALT_6, ALT_7, ALT_8,
+ ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL,
+ CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23),
+ KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47),
+ KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER,
+ CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL,
+ CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME,
+ ALT_UP, ALT_PGUP, -1, ALT_LEFT,
+ -1, ALT_RIGHT, -1, ALT_END,
+ ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL,
+ ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1
+};
+
+unsigned long pdc_key_modifiers = 0L;
+
+unsigned long PDC_get_input_fd(void)
+{
+ PDC_LOG(("PDC_get_input_fd() - called\n"));
+
+ return (unsigned long)fileno(stdin);
+}
+
+#ifndef EMXVIDEO
+
+void PDC_get_keyboard_info(void)
+{
+ kbdinfo.cb = sizeof(kbdinfo);
+ KbdGetStatus(&kbdinfo, 0);
+}
+
+void PDC_set_keyboard_default(void)
+{
+ KbdSetStatus(&kbdinfo, 0);
+}
+
+#endif /* ifndef EMXVIDEO */
+
+void PDC_set_keyboard_binary(bool on)
+{
+ PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
+
+#ifndef EMXVIDEO
+ if (on)
+ {
+ kbdinfo.fsMask &= ~(KEYBOARD_ASCII_MODE);
+ kbdinfo.fsMask |= KEYBOARD_BINARY_MODE;
+ }
+ else
+ {
+ kbdinfo.fsMask &= ~(KEYBOARD_BINARY_MODE);
+ kbdinfo.fsMask |= KEYBOARD_ASCII_MODE;
+ }
+
+ KbdSetStatus(&kbdinfo, 0);
+#endif
+
+#ifdef HAVE_SIGNAL
+ signal(SIGBREAK, on ? SIG_IGN : SIG_DFL);
+#endif
+}
+
+/* check if a key or mouse event is waiting */
+
+bool PDC_check_key(void)
+{
+#if !defined(_MSC_VER) && !defined(EMXVIDEO)
+ KBDKEYINFO keyInfo = {0};
+#endif
+
+#ifdef EMXVIDEO
+ if (tahead == -1) /* Nothing typed yet */
+ {
+ tahead = _read_kbd(0, 0, 0);
+
+ /* Read additional */
+
+ if (tahead == 0)
+ tahead = _read_kbd(0, 1, 0) << 8;
+ }
+
+ return (tahead != -1);
+#else
+# ifndef _MSC_VER
+
+ KbdGetStatus(&kbdinfo, 0);
+
+ if (mouse_handle)
+ {
+ MOUQUEINFO queue;
+
+ MouGetNumQueEl(&queue, mouse_handle);
+ mouse_events = queue.cEvents;
+
+ if (mouse_events)
+ return TRUE;
+ }
+
+ if (old_shift && !kbdinfo.fsState) /* modifier released */
+ {
+ if (!key_pressed && SP->return_key_modifiers)
+ return TRUE;
+ }
+ else if (!old_shift && kbdinfo.fsState) /* modifier pressed */
+ key_pressed = FALSE;
+
+ old_shift = kbdinfo.fsState;
+
+ KbdPeek(&keyInfo, 0); /* peek at keyboard */
+ return (keyInfo.fbStatus != 0);
+# else
+ return kbhit();
+# endif
+#endif
+}
+
+#ifndef EMXVIDEO
+
+static int _process_mouse_events(void)
+{
+ MOUEVENTINFO event;
+ static const USHORT button_mask[] = {6, 96, 24},
+ move_mask[] = {2, 32, 8},
+ press_mask[] = {4, 64, 16};
+ USHORT count = 1;
+ short shift_flags = 0;
+ int i;
+
+ MouReadEventQue(&event, &count, mouse_handle);
+ mouse_events--;
+
+ for (i = 0; i < 3; i++)
+ {
+ pdc_mouse_status.button[i] =
+ ((event.fs & move_mask[i]) ? BUTTON_MOVED : 0) |
+ ((event.fs & press_mask[i]) ? BUTTON_PRESSED : 0);
+
+ /* PRESS events are sometimes mistakenly reported as MOVE
+ events. A MOVE should always follow a PRESS, so treat a MOVE
+ immediately after a RELEASE as a PRESS. */
+
+ if ((pdc_mouse_status.button[i] == BUTTON_MOVED) &&
+ (old_mouse_status.button[i] == BUTTON_RELEASED))
+ {
+ pdc_mouse_status.button[i] = BUTTON_PRESSED;
+ }
+
+ if (pdc_mouse_status.button[i] == BUTTON_PRESSED && SP->mouse_wait)
+ {
+ /* Check for a click -- a PRESS followed immediately by a
+ release */
+
+ if (!mouse_events)
+ {
+ MOUQUEINFO queue;
+
+ napms(SP->mouse_wait);
+
+ MouGetNumQueEl(&queue, mouse_handle);
+ mouse_events = queue.cEvents;
+ }
+
+ if (mouse_events)
+ {
+ MouReadEventQue(&event, &count, mouse_handle);
+
+ if (!(event.fs & button_mask[i]))
+ pdc_mouse_status.button[i] = BUTTON_CLICKED;
+ }
+ }
+ }
+
+ pdc_mouse_status.x = event.col;
+ pdc_mouse_status.y = event.row;
+
+ pdc_mouse_status.changes = 0;
+
+ for (i = 0; i < 3; i++)
+ {
+ if (old_mouse_status.button[i] != pdc_mouse_status.button[i])
+ pdc_mouse_status.changes |= (1 << i);
+
+ if (pdc_mouse_status.button[i] == BUTTON_MOVED)
+ {
+ /* Discard non-moved "moves" */
+
+ if (pdc_mouse_status.x == old_mouse_status.x &&
+ pdc_mouse_status.y == old_mouse_status.y)
+ return -1;
+
+ /* Motion events always flag the button as changed */
+
+ pdc_mouse_status.changes |= (1 << i);
+ pdc_mouse_status.changes |= PDC_MOUSE_MOVED;
+ break;
+ }
+ }
+
+ old_mouse_status = pdc_mouse_status;
+
+ /* Treat click events as release events for comparison purposes */
+
+ for (i = 0; i < 3; i++)
+ {
+ if (old_mouse_status.button[i] == BUTTON_CLICKED)
+ old_mouse_status.button[i] = BUTTON_RELEASED;
+ }
+
+ /* Check for SHIFT/CONTROL/ALT */
+
+ if (kbdinfo.fsState & KBDSTF_ALT)
+ shift_flags |= BUTTON_ALT;
+
+ if (kbdinfo.fsState & KBDSTF_CONTROL)
+ shift_flags |= BUTTON_CONTROL;
+
+ if (kbdinfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
+ shift_flags |= BUTTON_SHIFT;
+
+ if (shift_flags)
+ {
+ for (i = 0; i < 3; i++)
+ {
+ if (pdc_mouse_status.changes & (1 << i))
+ pdc_mouse_status.button[i] |= shift_flags;
+ }
+ }
+
+ old_shift = kbdinfo.fsState;
+ key_pressed = TRUE;
+
+ SP->key_code = TRUE;
+ return KEY_MOUSE;
+}
+
+#endif
+
+/* return the next available key or mouse event */
+
+int PDC_get_key(void)
+{
+ int key, scan;
+#ifndef EMXVIDEO
+ KBDKEYINFO keyInfo = {0};
+#endif
+
+#ifdef EMXVIDEO
+ if (tahead == -1)
+ {
+ tahead = _read_kbd(0, 1, 0);
+
+ /* Read additional */
+
+ if (tahead == 0)
+ tahead = _read_kbd(0, 1, 0) << 8;
+ }
+
+ key = tahead & 0xff;
+ scan = tahead >> 8;
+ pdc_key_modifiers = 0L;
+
+ tahead = -1;
+#else
+ pdc_key_modifiers = 0L;
+
+ if (mouse_handle && mouse_events)
+ return _process_mouse_events();
+
+ if (old_shift && !kbdinfo.fsState)
+ {
+ key = -1;
+
+ if (old_shift & KBDSTF_LEFTALT)
+ {
+ key = KEY_ALT_L;
+ }
+ else if (old_shift & KBDSTF_RIGHTALT)
+ {
+ key = KEY_ALT_R;
+ }
+ else if (old_shift & KBDSTF_LEFTCONTROL)
+ {
+ key = KEY_CONTROL_L;
+ }
+ else if (old_shift & KBDSTF_RIGHTCONTROL)
+ {
+ key = KEY_CONTROL_R;
+ }
+ else if (old_shift & KBDSTF_LEFTSHIFT)
+ {
+ key = KEY_SHIFT_L;
+ }
+ else if (old_shift & KBDSTF_RIGHTSHIFT)
+ {
+ key = KEY_SHIFT_R;
+ }
+
+ key_pressed = FALSE;
+ old_shift = kbdinfo.fsState;
+
+ SP->key_code = TRUE;
+ return key;
+ }
+
+ KbdCharIn(&keyInfo, IO_WAIT, 0); /* get a character */
+
+ key = keyInfo.chChar;
+ scan = keyInfo.chScan;
+
+ if (SP->save_key_modifiers)
+ {
+ if (keyInfo.fsState & KBDSTF_ALT)
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
+
+ if (keyInfo.fsState & KBDSTF_CONTROL)
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
+
+ if (keyInfo.fsState & KBDSTF_NUMLOCK_ON)
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
+
+ if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
+ pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
+ }
+#endif
+ if (scan == 0x1c && key == 0x0a) /* ^Enter */
+ key = CTL_ENTER;
+ else if (scan == 0xe0 && key == 0x0d) /* PadEnter */
+ key = PADENTER;
+ else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */
+ key = CTL_PADENTER;
+ else if (scan == 0x37 && key == 0x2a) /* Star */
+ key = PADSTAR;
+ else if (scan == 0x4a && key == 0x2d) /* Minus */
+ key = PADMINUS;
+ else if (scan == 0x4e && key == 0x2b) /* Plus */
+ key = PADPLUS;
+ else if (scan == 0xe0 && key == 0x2f) /* Slash */
+ key = PADSLASH;
+ else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86))
+ key = (scan > 0xa7) ? -1 : key_table[scan];
+
+ if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
+ {
+ switch (key)
+ {
+ case KEY_HOME: /* Shift Home */
+ key = KEY_SHOME;
+ break;
+ case KEY_UP: /* Shift Up */
+ key = KEY_SUP;
+ break;
+ case KEY_PPAGE: /* Shift PgUp */
+ key = KEY_SPREVIOUS;
+ break;
+ case KEY_LEFT: /* Shift Left */
+ key = KEY_SLEFT;
+ break;
+ case KEY_RIGHT: /* Shift Right */
+ key = KEY_SRIGHT;
+ break;
+ case KEY_END: /* Shift End */
+ key = KEY_SEND;
+ break;
+ case KEY_DOWN: /* Shift Down */
+ key = KEY_SDOWN;
+ break;
+ case KEY_NPAGE: /* Shift PgDn */
+ key = KEY_SNEXT;
+ break;
+ case KEY_IC: /* Shift Ins */
+ key = KEY_SIC;
+ break;
+ case KEY_DC: /* Shift Del */
+ key = KEY_SDC;
+ }
+ }
+
+ key_pressed = TRUE;
+ SP->key_code = ((unsigned)key >= 256);
+
+ return key;
+}
+
+/* discard any pending keyboard or mouse input -- this is the core
+ routine for flushinp() */
+
+void PDC_flushinp(void)
+{
+ PDC_LOG(("PDC_flushinp() - called\n"));
+
+#ifdef EMXVIDEO
+ tcflush(0, TCIFLUSH);
+#else
+ if (mouse_handle)
+ MouFlushQue(mouse_handle);
+
+ KbdFlushBuffer(0);
+#endif
+}
+
+int PDC_mouse_set(void)
+{
+#ifndef EMXVIDEO
+
+ unsigned long mbe = SP->_trap_mbe;
+
+ if (mbe && !mouse_handle)
+ {
+ memset(&old_mouse_status, 0, sizeof(MOUSE_STATUS));
+ MouOpen(NULL, &mouse_handle);
+ if (mouse_handle)
+ MouDrawPtr(mouse_handle);
+ }
+ else if (!mbe && mouse_handle)
+ {
+ MouClose(mouse_handle);
+ mouse_handle = 0;
+ }
+
+ if (mbe && mouse_handle)
+ {
+ USHORT mask = ((mbe & (BUTTON1_PRESSED | BUTTON1_CLICKED |
+ BUTTON1_MOVED)) ? 6 : 0) |
+
+ ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED |
+ BUTTON3_MOVED)) ? 24 : 0) |
+
+ ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED |
+ BUTTON2_MOVED)) ? 96 : 0);
+
+ MouSetEventMask(&mask, mouse_handle);
+ }
+#endif
+ return OK;
+}
+
+int PDC_modifiers_set(void)
+{
+ key_pressed = FALSE;
+
+ return OK;
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcos2.h b/payloads/libpayload/curses/PDCurses/os2/pdcos2.h
new file mode 100644
index 0000000000..1c11d480ed
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcos2.h
@@ -0,0 +1,51 @@
+/* Public Domain Curses */
+
+/* $Id: pdcos2.h,v 1.9 2008/08/14 06:38:35 wmcbrine Exp $ */
+
+#ifdef _MSC_VER
+# define USE_OS2_H 1 /* Use the os2.h for the compiler */
+# define APIRET USHORT
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef EMXVIDEO
+# include <sys/video.h>
+#else
+# define INCL_DOS
+# define INCL_DOSMISC
+# define INCL_WIN
+# define INCL_VIO
+# define INCL_KBD
+# define INCL_MOU
+# include <os2.h>
+#endif
+
+#include <curspriv.h>
+
+#ifdef __WATCOMC__
+# define PDCTHUNK(x) ((ptr_16)(x))
+# ifdef __386__
+# define SEG16 _Seg16
+# else
+# define SEG16
+# endif
+
+typedef void * SEG16 ptr_16;
+
+#else
+# ifdef __EMX__
+# ifdef __INNOTEK_LIBC__
+# define PDCTHUNK(x) ((PCH)_libc_32to16(x))
+# else
+# define PDCTHUNK(x) ((PCH)_emx_32to16(x))
+# endif
+# endif
+#endif
+
+extern unsigned char *pdc_atrtab;
+extern int pdc_font;
+
+extern void PDC_get_keyboard_info(void);
+extern void PDC_set_keyboard_default(void);
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcscrn.c b/payloads/libpayload/curses/PDCurses/os2/pdcscrn.c
new file mode 100644
index 0000000000..daecb50a44
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcscrn.c
@@ -0,0 +1,422 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcscrn.c,v 1.76 2008/07/14 04:24:51 wmcbrine Exp $")
+
+#ifdef CHTYPE_LONG
+# define PDC_OFFSET 32
+#else
+# define PDC_OFFSET 8
+#endif
+
+/* COLOR_PAIR to attribute encoding table. */
+
+unsigned char *pdc_atrtab = (unsigned char *)NULL;
+
+int pdc_font; /* default font size */
+
+static short curstoreal[16], realtocurs[16] =
+{
+ COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED,
+ COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8,
+ COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8,
+ COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8
+};
+
+#ifdef EMXVIDEO
+static unsigned char *saved_screen = NULL;
+static int saved_lines = 0;
+static int saved_cols = 0;
+#else
+# ifdef PDCTHUNK
+# ifdef __EMX__
+# define THUNKEDVIO VIOCOLORREG
+# else
+
+typedef struct {
+ USHORT cb;
+ USHORT type;
+ USHORT firstcolorreg;
+ USHORT numcolorregs;
+ ptr_16 colorregaddr;
+} THUNKEDVIO;
+
+# endif
+# endif
+
+static PCH saved_screen = NULL;
+static USHORT saved_lines = 0;
+static USHORT saved_cols = 0;
+static VIOMODEINFO scrnmode; /* default screen mode */
+static VIOMODEINFO saved_scrnmode[3];
+static int saved_font[3];
+static bool can_change = FALSE;
+
+static int _get_font(void)
+{
+ VIOMODEINFO modeInfo = {0};
+
+ modeInfo.cb = sizeof(modeInfo);
+
+ VioGetMode(&modeInfo, 0);
+ return (modeInfo.vres / modeInfo.row);
+}
+
+static void _set_font(int size)
+{
+ VIOMODEINFO modeInfo = {0};
+
+ if (pdc_font != size)
+ {
+ modeInfo.cb = sizeof(modeInfo);
+
+ /* set most parameters of modeInfo */
+
+ VioGetMode(&modeInfo, 0);
+ modeInfo.cb = 8; /* ignore horiz an vert resolution */
+ modeInfo.row = modeInfo.vres / size;
+ VioSetMode(&modeInfo, 0);
+ }
+
+ curs_set(SP->visibility);
+
+ pdc_font = _get_font();
+}
+
+#endif
+
+/* close the physical screen -- may restore the screen to its state
+ before PDC_scr_open(); miscellaneous cleanup */
+
+void PDC_scr_close(void)
+{
+ PDC_LOG(("PDC_scr_close() - called\n"));
+
+ if (saved_screen && getenv("PDC_RESTORE_SCREEN"))
+ {
+#ifdef EMXVIDEO
+ v_putline(saved_screen, 0, 0, saved_lines * saved_cols);
+#else
+ VioWrtCellStr(saved_screen, saved_lines * saved_cols * 2,
+ 0, 0, (HVIO)NULL);
+#endif
+ free(saved_screen);
+ saved_screen = NULL;
+ }
+
+ reset_shell_mode();
+
+ if (SP->visibility != 1)
+ curs_set(1);
+
+ /* Position cursor to the bottom left of the screen. */
+
+ PDC_gotoyx(PDC_get_rows() - 2, 0);
+}
+
+void PDC_scr_free(void)
+{
+ if (SP)
+ free(SP);
+ if (pdc_atrtab)
+ free(pdc_atrtab);
+
+ pdc_atrtab = (unsigned char *)NULL;
+}
+
+/* open the physical screen -- allocate SP, miscellaneous intialization,
+ and may save the existing screen for later restoration */
+
+int PDC_scr_open(int argc, char **argv)
+{
+#ifdef EMXVIDEO
+ int adapter;
+#else
+ USHORT totchars;
+#endif
+ int i;
+ short r, g, b;
+
+ PDC_LOG(("PDC_scr_open() - called\n"));
+
+ SP = calloc(1, sizeof(SCREEN));
+ pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1);
+
+ if (!SP || !pdc_atrtab)
+ return ERR;
+
+ for (i = 0; i < 16; i++)
+ curstoreal[realtocurs[i]] = i;
+
+#ifdef EMXVIDEO
+ v_init();
+#endif
+ SP->orig_attr = FALSE;
+
+#ifdef EMXVIDEO
+ adapter = v_hardware();
+ SP->mono = (adapter == V_MONOCHROME);
+
+ pdc_font = SP->mono ? 14 : (adapter == V_COLOR_8) ? 8 : 12;
+#else
+ VioGetMode(&scrnmode, 0);
+ PDC_get_keyboard_info();
+
+ pdc_font = _get_font();
+#endif
+ SP->lines = PDC_get_rows();
+ SP->cols = PDC_get_columns();
+
+ SP->mouse_wait = PDC_CLICK_PERIOD;
+ SP->audible = TRUE;
+
+ /* This code for preserving the current screen */
+
+ if (getenv("PDC_RESTORE_SCREEN"))
+ {
+ saved_lines = SP->lines;
+ saved_cols = SP->cols;
+
+ saved_screen = malloc(2 * saved_lines * saved_cols);
+
+ if (!saved_screen)
+ {
+ SP->_preserve = FALSE;
+ return OK;
+ }
+#ifdef EMXVIDEO
+ v_getline(saved_screen, 0, 0, saved_lines * saved_cols);
+#else
+ totchars = saved_lines * saved_cols * 2;
+ VioReadCellStr((PCH)saved_screen, &totchars, 0, 0, (HVIO)NULL);
+#endif
+ }
+
+ SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL);
+
+ can_change = (PDC_color_content(0, &r, &g, &b) == OK);
+
+ return OK;
+}
+
+/* the core of resize_term() */
+
+int PDC_resize_screen(int nlines, int ncols)
+{
+#ifndef EMXVIDEO
+ VIOMODEINFO modeInfo = {0};
+ USHORT result;
+#endif
+
+ PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
+ nlines, ncols));
+
+#ifdef EMXVIDEO
+ return ERR;
+#else
+ modeInfo.cb = sizeof(modeInfo);
+
+ /* set most parameters of modeInfo */
+
+ VioGetMode(&modeInfo, 0);
+ modeInfo.fbType = 1;
+ modeInfo.row = nlines;
+ modeInfo.col = ncols;
+ result = VioSetMode(&modeInfo, 0);
+
+ LINES = PDC_get_rows();
+ COLS = PDC_get_columns();
+
+ return (result == 0) ? OK : ERR;
+#endif
+}
+
+void PDC_reset_prog_mode(void)
+{
+ PDC_LOG(("PDC_reset_prog_mode() - called.\n"));
+
+#ifndef EMXVIDEO
+ PDC_set_keyboard_binary(TRUE);
+#endif
+}
+
+void PDC_reset_shell_mode(void)
+{
+ PDC_LOG(("PDC_reset_shell_mode() - called.\n"));
+
+#ifndef EMXVIDEO
+ PDC_set_keyboard_default();
+#endif
+}
+
+#ifndef EMXVIDEO
+
+static bool _screen_mode_equals(VIOMODEINFO *oldmode)
+{
+ VIOMODEINFO current = {0};
+
+ VioGetMode(&current, 0);
+
+ return ((current.cb == oldmode->cb) &&
+ (current.fbType == oldmode->fbType) &&
+ (current.color == oldmode->color) &&
+ (current.col == oldmode->col) &&
+ (current.row == oldmode->row) &&
+ (current.hres == oldmode->vres) &&
+ (current.vres == oldmode->vres));
+}
+
+#endif
+
+void PDC_restore_screen_mode(int i)
+{
+#ifndef EMXVIDEO
+ if (i >= 0 && i <= 2)
+ {
+ pdc_font = _get_font();
+ _set_font(saved_font[i]);
+
+ if (!_screen_mode_equals(&saved_scrnmode[i]))
+ if (VioSetMode(&saved_scrnmode[i], 0) != 0)
+ {
+ pdc_font = _get_font();
+ scrnmode = saved_scrnmode[i];
+ LINES = PDC_get_rows();
+ COLS = PDC_get_columns();
+ }
+ }
+#endif
+}
+
+void PDC_save_screen_mode(int i)
+{
+#ifndef EMXVIDEO
+ if (i >= 0 && i <= 2)
+ {
+ saved_font[i] = pdc_font;
+ saved_scrnmode[i] = scrnmode;
+ }
+#endif
+}
+
+void PDC_init_pair(short pair, short fg, short bg)
+{
+ unsigned char att, temp_bg;
+ chtype i;
+
+ fg = curstoreal[fg];
+ bg = curstoreal[bg];
+
+ for (i = 0; i < PDC_OFFSET; i++)
+ {
+ att = fg | (bg << 4);
+
+ if (i & (A_REVERSE >> PDC_ATTR_SHIFT))
+ att = bg | (fg << 4);
+ if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT))
+ att = 1;
+ if (i & (A_INVIS >> PDC_ATTR_SHIFT))
+ {
+ temp_bg = att >> 4;
+ att = temp_bg << 4 | temp_bg;
+ }
+ if (i & (A_BOLD >> PDC_ATTR_SHIFT))
+ att |= 8;
+ if (i & (A_BLINK >> PDC_ATTR_SHIFT))
+ att |= 128;
+
+ pdc_atrtab[pair * PDC_OFFSET + i] = att;
+ }
+}
+
+int PDC_pair_content(short pair, short *fg, short *bg)
+{
+ *fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F];
+ *bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4];
+
+ return OK;
+}
+
+bool PDC_can_change_color(void)
+{
+ return can_change;
+}
+
+int PDC_color_content(short color, short *red, short *green, short *blue)
+{
+#ifdef PDCTHUNK
+ THUNKEDVIO vcr;
+ USHORT palbuf[4];
+ unsigned char pal[3];
+ int rc;
+
+ /* Read single DAC register */
+
+ palbuf[0] = 8;
+ palbuf[1] = 0;
+ palbuf[2] = curstoreal[color];
+
+ rc = VioGetState(&palbuf, 0);
+ if (rc)
+ return ERR;
+
+ vcr.cb = sizeof(vcr);
+ vcr.type = 3;
+ vcr.firstcolorreg = palbuf[3];
+ vcr.numcolorregs = 1;
+ vcr.colorregaddr = PDCTHUNK(pal);
+
+ rc = VioGetState(&vcr, 0);
+ if (rc)
+ return ERR;
+
+ /* Scale and store */
+
+ *red = DIVROUND((unsigned)(pal[0]) * 1000, 63);
+ *green = DIVROUND((unsigned)(pal[1]) * 1000, 63);
+ *blue = DIVROUND((unsigned)(pal[2]) * 1000, 63);
+
+ return OK;
+#else
+ return ERR;
+#endif
+}
+
+int PDC_init_color(short color, short red, short green, short blue)
+{
+#ifdef PDCTHUNK
+ THUNKEDVIO vcr;
+ USHORT palbuf[4];
+ unsigned char pal[3];
+ int rc;
+
+ /* Scale */
+
+ pal[0] = DIVROUND((unsigned)red * 63, 1000);
+ pal[1] = DIVROUND((unsigned)green * 63, 1000);
+ pal[2] = DIVROUND((unsigned)blue * 63, 1000);
+
+ /* Set single DAC register */
+
+ palbuf[0] = 8;
+ palbuf[1] = 0;
+ palbuf[2] = curstoreal[color];
+
+ rc = VioGetState(&palbuf, 0);
+ if (rc)
+ return ERR;
+
+ vcr.cb = sizeof(vcr);
+ vcr.type = 3;
+ vcr.firstcolorreg = palbuf[3];
+ vcr.numcolorregs = 1;
+ vcr.colorregaddr = PDCTHUNK(pal);
+
+ rc = VioSetState(&vcr, 0);
+
+ return rc ? ERR : OK;
+#else
+ return ERR;
+#endif
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcsetsc.c b/payloads/libpayload/curses/PDCurses/os2/pdcsetsc.c
new file mode 100644
index 0000000000..bc28b03aca
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcsetsc.c
@@ -0,0 +1,110 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcsetsc.c,v 1.44 2008/07/14 04:24:51 wmcbrine Exp $")
+
+/*man-start**************************************************************
+
+ Name: pdcsetsc
+
+ Synopsis:
+ int PDC_set_blink(bool blinkon);
+ void PDC_set_title(const char *title);
+
+ Description:
+ PDC_set_blink() toggles whether the A_BLINK attribute sets an
+ actual blink mode (TRUE), or sets the background color to high
+ intensity (FALSE). The default is platform-dependent (FALSE in
+ most cases). It returns OK if it could set the state to match
+ the given parameter, ERR otherwise. Current platforms also
+ adjust the value of COLORS according to this function -- 16 for
+ FALSE, and 8 for TRUE.
+
+ PDC_set_title() sets the title of the window in which the curses
+ program is running. This function may not do anything on some
+ platforms. (Currently it only works in Win32 and X11.)
+
+ Portability X/Open BSD SYS V
+ PDC_set_blink - - -
+ PDC_set_title - - -
+
+**man-end****************************************************************/
+
+int PDC_curs_set(int visibility)
+{
+#ifndef EMXVIDEO
+ VIOCURSORINFO pvioCursorInfo;
+#endif
+ int ret_vis, hidden = 0, start = 0, end = 0;
+
+ PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
+
+ ret_vis = SP->visibility;
+ SP->visibility = visibility;
+
+ switch(visibility)
+ {
+ case 0: /* invisible */
+#ifdef EMXVIDEO
+ start = end = 0;
+#else
+ start = pdc_font / 4;
+ end = pdc_font;
+ hidden = -1;
+#endif
+ break;
+
+ case 2: /* highly visible */
+ start = 2; /* almost full-height block */
+ end = pdc_font - 1;
+ break;
+
+ default: /* normal visibility */
+ start = (SP->orig_cursor >> 8) & 0xff;
+ end = SP->orig_cursor & 0xff;
+ }
+
+#ifdef EMXVIDEO
+ if (!visibility)
+ v_hidecursor();
+ else
+ v_ctype(start, end);
+#else
+ pvioCursorInfo.yStart = (USHORT)start;
+ pvioCursorInfo.cEnd = (USHORT)end;
+ pvioCursorInfo.cx = (USHORT)1;
+ pvioCursorInfo.attr = hidden;
+ VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0);
+#endif
+ return ret_vis;
+}
+
+void PDC_set_title(const char *title)
+{
+ PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
+}
+
+int PDC_set_blink(bool blinkon)
+{
+#ifndef EMXVIDEO
+ USHORT statebuf[3], result;
+
+ statebuf[0] = 6; /* length */
+ statebuf[1] = 2; /* blink/intensity */
+ statebuf[2] = !blinkon;
+
+ result = VioSetState(&statebuf, 0);
+ VioGetState(&statebuf, 0); /* needed? */
+
+ if (pdc_color_started)
+ COLORS = statebuf[2] ? 16 : 8;
+
+ return (result == 0) ? OK : ERR;
+#else
+ if (pdc_color_started)
+ COLORS = 16;
+
+ return blinkon ? ERR : OK;
+#endif
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/pdcutil.c b/payloads/libpayload/curses/PDCurses/os2/pdcutil.c
new file mode 100644
index 0000000000..290be3595f
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/pdcutil.c
@@ -0,0 +1,36 @@
+/* Public Domain Curses */
+
+#include "pdcos2.h"
+
+RCSID("$Id: pdcutil.c,v 1.14 2008/07/14 04:24:51 wmcbrine Exp $")
+
+#if defined(OS2) && !defined(__EMX__)
+APIRET APIENTRY DosSleep(ULONG ulTime);
+#endif
+
+void PDC_beep(void)
+{
+ PDC_LOG(("PDC_beep() - called\n"));
+
+#ifdef EMXVIDEO
+ putchar('\007');
+#else
+ DosBeep(1380, 100);
+#endif
+}
+
+void PDC_napms(int ms)
+{
+ PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
+
+#ifdef __EMX__
+ _sleep2(ms);
+#else
+ DosSleep(ms);
+#endif
+}
+
+const char *PDC_sysname(void)
+{
+ return "OS/2";
+}
diff --git a/payloads/libpayload/curses/PDCurses/os2/wccos2.mak b/payloads/libpayload/curses/PDCurses/os2/wccos2.mak
new file mode 100644
index 0000000000..d5900d3055
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/os2/wccos2.mak
@@ -0,0 +1,43 @@
+# Watcom WMAKE Makefile for PDCurses library - OS/2 Open Watcom 1.1+
+#
+# Usage: wmake -f [path\]wccos2.mak [DEBUG=Y] [target]
+#
+# where target can be any of:
+# [all|demos|pdcurses.lib|testcurs.exe...]
+
+!ifdef %PDCURSES_SRCDIR
+PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
+!else
+PDCURSES_SRCDIR = ..
+!endif
+
+!include $(PDCURSES_SRCDIR)\version.mif
+
+osdir = $(PDCURSES_SRCDIR)\os2
+
+CC = wcc386
+TARGET = os2v2
+
+CFLAGS = /bt=$(TARGET) /wx /s /zq /i=$(PDCURSES_SRCDIR)
+
+!ifeq DEBUG Y
+CFLAGS += /d2 /DPDCDEBUG
+LDFLAGS = D A op q sys $(TARGET)
+!else
+CFLAGS += /oneatx
+LDFLAGS = op q sys $(TARGET)
+!endif
+
+LIBEXE = wlib /q /n /b /c /t
+
+!include $(PDCURSES_SRCDIR)\watcom.mif
+
+$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
+ $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS)
+ -copy $(LIBCURSES) panel.lib
+
+PLATFORM1 = Watcom C++ OS/2
+PLATFORM2 = Open Watcom 1.6 for OS/2
+ARCNAME = pdc$(VER)_wcc_os2
+
+!include $(PDCURSES_SRCDIR)\makedist.mif