Newsgroups: comp.sources.misc From: tcamp@hercules.acpub.duke.edu (Ted Campbell) Subject: v27i001: sfs - Space Flight Simulator, Part01/21 Message-ID: X-Md4-Signature: 17b4173cff3241dc4cce3b900a528ace Date: Tue, 24 Dec 1991 04:50:21 GMT Approved: kent@sparky.imd.sterling.com Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell) Posting-number: Volume 27, Issue 1 Archive-name: sfs/part01 Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11, [ This submission contains uuencoded files and requires uudecode ] [ to be in your PATH to successfully unpack. -Kent+ ] Bywater Software is pleased to announce the public availability of its Space Flight Simulator and User Interface in their first complete release, version 1.01. This software is copyright (c) 1991, Ted A. Campbell, and is released under the terms of an agreement specified in the file "sfs.ro" and in source code file headers. Description: The Space Flight Simulator offers a graphics-based, real-time, animated simulation of orbital flight. Users can develop simulations by specifying a complete range of orbital parameters, and can develop simulations for all of the planets of the solar system and for some other celestial bodies. A particularly full map is given of the earth, which can be viewed as it would appear from the orbiting spacecraft, as a ground-track map, or as a "distant perspective" in which the earth (or another orbital focus) and the orbital track can be seen together. User Interface: The User Interface (ui) was developed to underly Bywater's Space Flight Simulator (also available). It offers implementation of mouse, window, icon, menu, dialog boxes, and other widgets for the development of a user environment. Implementation: Current implementations of the User Interface (ui) for which source code is included are the following: (a) IBM PC and compatibles, utilizing the Microsoft QuickC compiler and requiring Hercules, EGA, or VGA graphics; (b) the AT&T Unix PC with a primary implementation for the TAM subsystem, and a rather poorer implementation for the MGR windowing system; (c) Unix-based computers utilizing the X Windows system, version 11 (tested on DecStation 2100 and 3100). Binaries: Binaries are available on duke.cs.duke.edu in the directory pub/bywater for the IBM PC and compatibles, requiring Hercules, EGA, or VGA graphics. Communications: Bywater Software P. O. Box 4023 Duke Station Durham, NC 27707 USA email: tcamp@hercules.acpub.duke.edu ----------------------------------------------------------------------- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 12/23/1991 20:30 UTC by kent@sparky.IMD.Sterling.COM # # existing files will NOT be overwritten unless -c is specified # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 2555 -rw-rw-r-- README # 1990 -rw-rw-r-- README.first # 2939 -rw-r--r-- README.sfs # 2119 -rw-r--r-- README.ui # 1391 -rw-r--r-- io/bw/bw.h # 1020 -rw-r--r-- io/bw/bw_cpy.h # 1641 -rw-r--r-- io/dr/dr.h # 3516 -rw-r--r-- io/dr/dr_ibmpc.c # 2379 -rw-r--r-- io/dr/dr_spec.c # 4111 -rw-r--r-- io/dr/dr_sysv.c # 2371 -rw-r--r-- io/dr/dr_test.c # 553 -rw-r--r-- io/dr/dr_test.mak # 4258 -rw-r--r-- io/dr/dr_unix.c # 4574 -rw-r--r-- io/gr/gr.h # 12686 -rw-r--r-- io/gr/gr_def.c # 34235 -rw-r--r-- io/gr/gr_ibmpc.c # 23877 -rw-r--r-- io/gr/gr_mgr.c # 17026 -rw-r--r-- io/gr/gr_spec.c # 27360 -rw-r--r-- io/gr/gr_tam.c # 13731 -rw-r--r-- io/gr/gr_test.c # 643 -rw-r--r-- io/gr/gr_test.mak # 30654 -rw-r--r-- io/gr/gr_x.c # 299 -rw-r--r-- io/gr/makefile.tam # 1891 -rw-r--r-- io/kb/kb.h # 12842 -rw-r--r-- io/kb/kb_7300.c # 6035 -rw-r--r-- io/kb/kb_cpm.c # 6597 -rw-r--r-- io/kb/kb_ibmpc.c # 3370 -rw-r--r-- io/kb/kb_spec.c # 5260 -rw-r--r-- io/kb/kb_sysv.c # 2861 -rw-r--r-- io/kb/kb_test.c # 3981 -rw-r--r-- io/kb/kb_x.c # 1832 -rw-r--r-- io/tw/tw.h # 6629 -rw-r--r-- io/tw/tw_ibmpc.c # 2119 -rw-r--r-- io/ui/README.ui # 177 -rw-r--r-- io/ui/backgrnd.pbm # 221 -rw-r--r-- io/ui/blank.pbm # 539 -rw-r--r-- io/ui/buildlib.bat # 1145 -rw-r--r-- io/ui/buildlib.sh # 2941 -rw-r--r-- io/ui/bywater.pbm # 144 -rw-r--r-- io/ui/cleanlib.bat # 68 -rw-r--r-- io/ui/cleanlib.sh # 132 -rw-r--r-- io/ui/close.pbm # 944 -rw-r--r-- io/ui/default.pbm # 221 -rw-r--r-- io/ui/down.pbm # 231 -rw-r--r-- io/ui/elevator.pbm # 941 -rw-r--r-- io/ui/exec.pbm # 1220 -rw-r--r-- io/ui/filesys.pbm # 1219 -rw-r--r-- io/ui/floppy.pbm # 943 -rw-r--r-- io/ui/folder.pbm # 857 -rw-r--r-- io/ui/garbage.pbm # 221 -rw-r--r-- io/ui/left.pbm # 536 -rw-r--r-- io/ui/makefile.mgr # 602 -rw-r--r-- io/ui/makefile.tam # 543 -rw-r--r-- io/ui/makefile.x # 260 -rw-r--r-- io/ui/move.pbm # 316 -rw-r--r-- io/ui/qrf.bat # 262 -rw-r--r-- io/ui/resize.pbm # 221 -rw-r--r-- io/ui/right.pbm # 1975 -rw-r--r-- io/ui/synapsis.pbm # 2941 -rw-r--r-- io/ui/test.pbm # 45150 -rw-r--r-- io/ui/ui.doc # 10420 -rw-r--r-- io/ui/ui.h # 9808 -rw-r--r-- io/ui/ui_boxes.c # 2853 -rw-r--r-- io/ui/ui_clock.c # 9126 -rw-r--r-- io/ui/ui_dial.c # 2866 -rw-r--r-- io/ui/ui_gets.c # 31158 -rw-r--r-- io/ui/ui_icon.c # 3779 -rw-r--r-- io/ui/ui_init.c # 37627 -rw-r--r-- io/ui/ui_list.c # 7475 -rw-r--r-- io/ui/ui_pbm.c # 11199 -rw-r--r-- io/ui/ui_rband.c # 11977 -rw-r--r-- io/ui/ui_test.c # 1354 -rw-r--r-- io/ui/ui_test.mak # 7529 -rw-r--r-- io/ui/ui_text.c # 2839 -rw-r--r-- io/ui/ui_tw.c # 1458 -rw-r--r-- io/ui/uitest_n.mak # 221 -rw-r--r-- io/ui/up.pbm # 4503 -rw-r--r-- sfs/as/as.h # 6547 -rw-r--r-- sfs/as/as_focus.c # 9998 -rw-r--r-- sfs/as/as_orbit.c # 14480 -rw-r--r-- sfs/as/as_spj.c # 8757 -rw-r--r-- sfs/as/as_test.c # 703 -rw-r--r-- sfs/as/as_test.mak # 2526 -rw-r--r-- sfs/as/as_vpt.c # 44 -rw-r--r-- sfs/bin/callisto.fd # 638 -rw-r--r-- sfs/bin/callisto.sfs # 7626 -rw-r--r-- sfs/bin/callisto.spd # 1231 -rw-r--r-- sfs/bin/complex.sfs # 611 -rw-r--r-- sfs/bin/default.sfs # 636 -rw-r--r-- sfs/bin/distant.sfs # 33 -rw-r--r-- sfs/bin/earth.fd # 31674 -rw-r--r-- sfs/bin/earth.spd # 52034 -rw-r--r-- sfs/bin/earthb.spd # 619 -rw-r--r-- sfs/bin/hubble.sfs # 625 -rw-r--r-- sfs/bin/inclined.sfs # 33 -rw-r--r-- sfs/bin/jupiter.fd # 18871 -rw-r--r-- sfs/bin/latlon.spd # 30 -rw-r--r-- sfs/bin/mars.fd # 613 -rw-r--r-- sfs/bin/mars.sfs # 13105 -rw-r--r-- sfs/bin/mars.spd # 37 -rw-r--r-- sfs/bin/mercury.fd # 458 -rw-r--r-- sfs/bin/meridian.spd # 37 -rw-r--r-- sfs/bin/moon.fd # 609 -rw-r--r-- sfs/bin/moon.sfs # 307 -rw-r--r-- sfs/bin/nasa.spd # 35 -rw-r--r-- sfs/bin/neptune.fd # 903 -rw-r--r-- sfs/bin/new.sfs # 72 -rw-r--r-- sfs/bin/null.spd # 1511 -rw-r--r-- sfs/bin/orb.spd # 34 -rw-r--r-- sfs/bin/pluto.fd # 612 -rw-r--r-- sfs/bin/quick.sfs # 34 -rw-r--r-- sfs/bin/saturn.fd # 611 -rw-r--r-- sfs/bin/shuttle.sfs # 2480 -rw-r--r-- sfs/bin/smallgr.spd # 35 -rw-r--r-- sfs/bin/sun.fd # 615 -rw-r--r-- sfs/bin/test.sfs # 32 -rw-r--r-- sfs/bin/uranus.fd # 36 -rw-r--r-- sfs/bin/venus.fd # 2225 -rw-r--r-- sfs/doc/README.pc # 2939 -rw-r--r-- sfs/doc/README.sfs # 103 -rw-r--r-- sfs/doc/ansi.tab # 247 -rw-r--r-- sfs/doc/deskjet.tab # 210 -rw-r--r-- sfs/doc/laserjet.tab # 52 -rw-r--r-- sfs/doc/null.tab # 126 -rw-r--r-- sfs/doc/nx10.tab # 73260 -rw-r--r-- sfs/doc/sfs.ro # 3741 -rw-r--r-- sfs/doc/tmac.m # 2002 -rw-r--r-- sfs/map/README.map # 1593 -rw-r--r-- sfs/map/makefile.tam # 1545 -rw-r--r-- sfs/map/makefile.x # 25899 -rw-r--r-- sfs/map/map.c # 3311 -rw-r--r-- sfs/map/map.h # 941 -rw-r--r-- sfs/map/map.mak # 9366 -rw-r--r-- sfs/map/map_dr.c # 75 -rw-r--r-- sfs/map/test.spd # 1320 -rw-r--r-- sfs/sfs/buildsfs.bat # 1455 -rw-r--r-- sfs/sfs/buildsfs.sh # 489 -rw-r--r-- sfs/sfs/cleansfs.bat # 279 -rw-r--r-- sfs/sfs/cleansfs.sh # 2007 -rw-r--r-- sfs/sfs/makefile.mgr # 2037 -rw-r--r-- sfs/sfs/makefile.tam # 2308 -rw-r--r-- sfs/sfs/makefile.x # 4685 -rw-r--r-- sfs/sfs/sfs.c # 12242 -rw-r--r-- sfs/sfs/sfs.h # 546 -rw-r--r-- sfs/sfs/sfs.mak # 6336 -rw-r--r-- sfs/sfs/sfs_di.c # 4733 -rw-r--r-- sfs/sfs/sfs_ft.c # 15884 -rw-r--r-- sfs/sfs/sfs_gt.c # 19001 -rw-r--r-- sfs/sfs/sfs_pe.c # 17557 -rw-r--r-- sfs/sfs/sfs_pr.c # 16784 -rw-r--r-- sfs/sfs/sfs_vi.c # 17785 -rw-r--r-- sfs/sfs/sfsm.c # 10462 -rw-r--r-- sfs/sfs/sfsm.h # 1158 -rw-r--r-- sfs/sfs/sfsm.mak # 1443 -rw-r--r-- sfs/sfs/sfsm_n.mak # 20737 -rw-r--r-- sfs/sfs/sfsm_om.c # 26740 -rw-r--r-- sfs/sfs/sfsx.c # 7157 -rw-r--r-- sfs/sfs/sfsx.h # 1444 -rw-r--r-- sfs/sfs/sfsx.mak # 12780 -rw-r--r-- sfs/sfs/sfsx_cp.c # 1726 -rw-r--r-- sfs/sfs/sfsx_n.mak # 6678 -rw-r--r-- sfs/sfs/sfsx_sp.c # 3875 -rw-r--r-- sfs/sfs/sfsx_var.c # 1400 -rw-r--r-- smallfont/read.me # 2336 -rw-r--r-- smallfont/smallfont # if test -r _shar_seq_.tmp; then echo 'Must unpack archives in sequence!' echo Please unpack part `cat _shar_seq_.tmp` next exit 1 fi # ============= README ============== if test -f 'README' -a X"$1" != X"-c"; then echo 'x - skipping README (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting README (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README' && X Bywater Software at duke.cs.duke.edu ------------------------------------ X All Bywater Software is released under specific copyright claims, for which see the documentation or source code for any of the particular applications. Be careful to use the binary mode of ftp to download these files. The directory /pub/bywater at duke.cs.duke.edu contains the following files: X sfs101.zoo zoo'd binaries and support files for Space Flight X Simulator, version 1.01. This implementation is for X the IBM PC and compatibles, and requires Hercules, X EGA, or VGA graphics. X map101.zoo zoo'd binaries and support files for the Map utility X for the Space Flight Simulator, version 1.01. Same X requirements as the previous file. X sfs101.tar.Z tar'd and compressed source code for Space Flight X Simulator, version 1.01. When uncompressed and un-tar'd, X this will produce a directory full of files: "sfs" X (the Space Flight Simulator itself). The README file X contains information on compiling the program. The X document is in the file sfs/doc/sfs.ro and is in "ro" X format (see below). Current implementations available X are for the IBM PC and compatibles using Hercules, EGA, X and VGA graphics, Unix systems utilizing the X Windows X system, and the AT&T Unix PC using the TAM interface. X The compilation of this program requires prior compilation X of the Bywater grahical user interface (see below). X ui101.tar.Z tar'd and compressed source code for the Bywater X graphical user interface (ui). Prior compilation X of this subsystem is necessary for compilation X of the Space Flight Simulator (see above). Current X implementations are for the IBM PC and compatibles X utilizing the Microsoft QuickC compiler with Hercules, X EGA, or VGA graphics, for the AT&T Unix PC, and for X the X Windows system, version 11 (tested only on X DecStation 3100 and 2100). X smallf.tar.Z tar'd and compressed files to construct a "smallfont" X for the AT&T Unix PC/3B1. See the "read.me" file X included. The smallfont is needed for Unix PC/3B1 X implementation of the ui and Space Flight Simulator X under TAM. X ro101.tar.Z tar'd and compressed source code (and PC binary) for X "ro", an nroff-like text formatter. When uncompressed X and un-tar'd, this will fill the current directory with X files. The manual is "ro.doc" which is in ro format. X Users are requested not to move or alter these files without my permission. Thanks. X Ted A. Campbell Bywater Software P. O. Box 4023 Duke Station Durham, NC 27706 X email: tcamp@hercules.acpub.duke.edu X SHAR_EOF chmod 0664 README || echo 'restore of README failed' Wc_c="`wc -c < 'README'`" test 2555 -eq "$Wc_c" || echo 'README: original size 2555, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= README.first ============== if test -f 'README.first' -a X"$1" != X"-c"; then echo 'x - skipping README.first (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting README.first (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README.first' && This directory contains the Space Flight Simulator submission to comp.sources.misc. It consists of sfs101.tar.Z, ui101.tar.Z and smallf.tar.Z available from Bywater Software at duke.cs.duke.edu. It does not contain the .zoo'ed files or ro101.tar.Z. Ro is available from comp.sources.unix archives in volume21. The README file from Duke was included for those who wish to get pieces not include in the c.s.misc release. X Here is a 'lc' of the directories and an explaination of their contents. X X Directories: X io sfs smallfont X X Files: X README README.sfs README.ui X X sfs Source code for Space Flight Simulator, version 1.01. X The README file contains information on compiling the X program. The document is in the file sfs/doc/sfs.ro and X is in "ro"/nroff format Current implementations available X are for the IBM PC and compatibles using Hercules, EGA, X and VGA graphics, Unix systems utilizing the X Windows X system, and the AT&T Unix PC using the TAM interface. X The compilation of this program requires prior compilation X of the Bywater grahical user interface (see below). X io (ui) Source code for the Bywater graphical user interface (ui). X Prior compilation of this subsystem is necessary for X compilation of the Space Flight Simulator (see above). X Current implementations are for the IBM PC and compatibles X utilizing the Microsoft QuickC compiler with Hercules, X EGA, or VGA graphics, for the AT&T Unix PC, and for X the X Windows system, version 11 (tested only on X DecStation 3100 and 2100). X smallfont Files to construct a "smallfont" for the AT&T Unix PC/3B1. X See the "read.me" file included. The smallfont is needed X for Unix PC/3B1 implementation of the ui and Space Flight X Simulator under TAM. X For more information, please contact the author of SFS. X Ted A. Campbell Bywater Software P. O. Box 4023 Duke Station Durham, NC 27706 X email: tcamp@hercules.acpub.duke.edu X X -Kent+ X SHAR_EOF chmod 0664 README.first || echo 'restore of README.first failed' Wc_c="`wc -c < 'README.first'`" test 1990 -eq "$Wc_c" || echo 'README.first: original size 1990, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= README.sfs ============== if test -f 'README.sfs' -a X"$1" != X"-c"; then echo 'x - skipping README.sfs (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting README.sfs (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README.sfs' && X X ------------------ X X Bywater Software X Release Notice X X Space Flight Simulator X version 1.01 X (Source Code) X X ------------------ X Bywater Software is pleased to announce the public availability of its Space Flight Simulator in its first complete release, version 1.01. This software is copyright (c) 1991, Ted A. Campbell, and is released under the terms of an agreement specified in the file "sfs.ro" and in all source code file headers. X Description: The Space Flight Simulator offers a graphics-based, X real-time, animated simulation of orbital flight. X Users can develop simulations by specifying a complete X range of orbital parameters, and can develop simulations X for all of the planets of the solar system and for some X other celestial bodies. A particularly full map is X given of the earth, which can be viewed as it would X appear from the orbiting spacecraft, as a ground-track X map, or as a "distant perspective" in which the earth X (or another orbital focus) and the orbital track can X be seen together. X Implementation: Current implementations of the Space Flight Simulator X for which source code is included are the following: X (a) IBM PC and compatibles, utilizing the Microsoft X QuickC compiler and requiring Hercules, EGA, or X VGA graphics; (b) the AT&T Unix PC with a primary X implementation for the TAM subsystem, and a rather X poorer implementation for the MGR windowing system; X (c) Unix-based computers utilizing the X Windows X system, version 11 (tested on DecStation 2100 and X 3100). X Further Code: Compilation of this code requires the Bywater X graphical User Interface (ui), which is not included X in this archive. X Documentation: Complete documentation for this program is in the X file "sfs.ro", which is in a format compatible X with the "ro" text formatter (also available). Chapter X four contains complete instructions for compiling X the program, shorter instructions (for existing X implementations) follow this notice. X Communications: Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27707 X USA X X email: tcamp@hercules.acpub.duke.edu X ------------------------------------------------------ Quick Build Instructions for Existing Implementations: X (a) Build the User Interface (ui) using the build scripts supplied with it. This will create an include directory for header files and a lib directory for object modules of the User Interface. X (b) Change to the directory where SFS sourcecode is located: X X Unix: cd sfs/sfs X MSDOS: cd sfs\sfs X (c) Execute the build script for SFS: X X Unix: sh buildsfs.sh X MSDOS: buildsfs X On Unix systems, the user will be prompted for a number corresponding to the particular system to be implemented. X ------------------------------------------------------ X SHAR_EOF chmod 0644 README.sfs || echo 'restore of README.sfs failed' Wc_c="`wc -c < 'README.sfs'`" test 2939 -eq "$Wc_c" || echo 'README.sfs: original size 2939, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= README.ui ============== if test -f 'README.ui' -a X"$1" != X"-c"; then echo 'x - skipping README.ui (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting README.ui (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README.ui' && X X ------------------ X X Bywater Software X Release Notice X X User Interface (ui) X version 1.01 X (Source Code) X X ------------------ X Bywater Software is pleased to announce the public availability of its graphical User Interface (ui) in its first complete release, version 1.01. This software is copyright (c) 1991, Ted A. Campbell, and is released under the terms of an agreement specified in the headers of all source code files. X Description: The User Interface (ui) was developed to underly X Bywater's Space Flight Simulator (also available). X It offers implementation of mouse, window, icon, X menu, dialog boxes, and other widgets for the X development of a user environment. X Implementation: Current implementations of the User Interface (ui) X for which source code is included are the following: X (a) IBM PC and compatibles, utilizing the Microsoft X QuickC compiler and requiring Hercules, EGA, or X VGA graphics; (b) the AT&T Unix PC with a primary X implementation for the TAM subsystem, and a rather X poorer implementation for the MGR windowing system; X (c) Unix-based computers utilizing the X Windows X system, version 11 (tested on DecStation 2100 and X 3100). X Documentation: A quick reference guide to the abilities of the X ui (and its underlying graphics, keyboard, directory, X and text window subsystems) is supplied as "io/ui/ui.doc". X Communications: Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27707 X USA X X email: tcamp@hercules.acpub.duke.edu X ------------------------------------------------------ Quick Build Instructions for Existing Implementations: X X (a) Change to the directory where ui sourcecode is located: X X Unix: cd io/ui X MSDOS: cd io\ui X (b) Execute the build script for ui: X X Unix: sh buildlib.sh X MSDOS: buildlib X On Unix systems, the user will be prompted for a number corresponding to the particular system to be implemented. X ------------------------------------------------------ X SHAR_EOF chmod 0644 README.ui || echo 'restore of README.ui failed' Wc_c="`wc -c < 'README.ui'`" test 2119 -eq "$Wc_c" || echo 'README.ui: original size 2119, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/bw/bw.h ============== if test ! -d 'io'; then echo 'x - creating directory io' mkdir 'io' fi if test ! -d 'io/bw'; then echo 'x - creating directory io/bw' mkdir 'io/bw' fi if test -f 'io/bw/bw.h' -a X"$1" != X"-c"; then echo 'x - skipping io/bw/bw.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/bw/bw.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/bw/bw.h' && /**************************************************************** X X bw.h general header for error- and message- X handling routines for all Bywater Software X X Copyright (c) 1990, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ****************************************************************/ X #define BW_EBUFSIZE 512 X #define BW_ERROR -1 X extern char bw_ebuf[ BW_EBUFSIZE ]; X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X SHAR_EOF chmod 0644 io/bw/bw.h || echo 'restore of io/bw/bw.h failed' Wc_c="`wc -c < 'io/bw/bw.h'`" test 1391 -eq "$Wc_c" || echo 'io/bw/bw.h: original size 1391, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/bw/bw_cpy.h ============== if test -f 'io/bw/bw_cpy.h' -a X"$1" != X"-c"; then echo 'x - skipping io/bw/bw_cpy.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/bw/bw_cpy.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/bw/bw_cpy.h' && X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X SHAR_EOF chmod 0644 io/bw/bw_cpy.h || echo 'restore of io/bw/bw_cpy.h failed' Wc_c="`wc -c < 'io/bw/bw_cpy.h'`" test 1020 -eq "$Wc_c" || echo 'io/bw/bw_cpy.h: original size 1020, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr.h ============== if test ! -d 'io/dr'; then echo 'x - creating directory io/dr' mkdir 'io/dr' fi if test -f 'io/dr/dr.h' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr.h' && /*************************************************************** X X dr.h Header file for DR (directory) X io standards X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ***************************************************************/ X #define MAX_PATHLENGTH 64 X /* File types for return */ X #define FILE_NORMAL 0 #define FILE_DIRECTORY 1 #define FILE_EXECUTABLE 2 X /* Structure for directory entries */ X struct dir_ent X { X char filename[ MAX_PATHLENGTH ]; X char pathname[ MAX_PATHLENGTH ]; X int type; X long size; X }; X /* externals */ X extern int dr_fs; extern char dr_all[ MAX_PATHLENGTH ]; X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X X X SHAR_EOF chmod 0644 io/dr/dr.h || echo 'restore of io/dr/dr.h failed' Wc_c="`wc -c < 'io/dr/dr.h'`" test 1641 -eq "$Wc_c" || echo 'io/dr/dr.h: original size 1641, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_ibmpc.c ============== if test -f 'io/dr/dr_ibmpc.c' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_ibmpc.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_ibmpc.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_ibmpc.c' && /************************************************************************* X X dr_ibmpc.c Directory (dr) subroutines X for Bywater Software. X X Implementation for the IBM PC (tm) X and compatible microcomputers X utilizing Microsoft QuickC (tm) X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X **************************************************************************/ X #include "stdio.h" #include "dos.h" #include "sys\types.h" #include "sys\stat.h" #include "dr.h" X int dr_fs = '\\'; char dr_all[ MAX_PATHLENGTH ] = "*.*"; X static struct find_t myfind; static char _path[ MAX_PATHLENGTH ]; X dr_first( findb, retb ) X char findb[]; X struct dir_ent *retb; X { X register int c; X X if ( _dos_findfirst( findb, _A_NORMAL | _A_SUBDIR, &myfind ) == 0 ) X { X strcpy( retb->filename, myfind.name ); X strcpy( _path, findb ); X X c = strlen( _path ); X while (( c >= 0 ) && ( _path[ c ] != dr_fs )) X { #ifdef OLD_DEBUG X fprintf( stderr, "_path: %s \n", _path ); #endif X _path[ c ] = 0; X --c; X } X X strcpy( retb->pathname, _path ); X X fill_buffer( retb ); X return 1; X } X else X { X return 0; X } X } X dr_next( retb ) X struct dir_ent *retb; X { X if ( _dos_findnext( &myfind ) == 0 ) X { X strcpy( retb->filename, myfind.name ); X strcpy( retb->pathname, _path ); X fill_buffer( retb ); X return 1; X } X else X { X return 0; X } X } X X fill_buffer( retb ) X struct dir_ent *retb; X { X static struct stat s_buf; X static char newpath[ MAX_PATHLENGTH ]; X X if ( strlen( _path ) > 0 ) X { X sprintf( newpath, "%s%s", _path, retb->filename ); X } X else X { X strcpy( newpath, retb->filename ); X } X X if ( stat( newpath, &s_buf ) < 0 ) X { #ifdef DEBUG X fprintf( stderr, "stat() to %s failed. \n", newpath ); #endif X } X X retb->size = s_buf.st_size; X X if ( ibm_isexec( retb ) == TRUE ) X { X retb->type = FILE_EXECUTABLE; X } X X else if ( ( s_buf.st_mode & S_IFDIR ) == S_IFDIR ) X { X retb->type = FILE_DIRECTORY; X } X X else X { X retb->type = FILE_NORMAL; X } X X return TRUE; X X } X ibm_isexec( retb ) X struct dir_ent *retb; X { X static char buffer[ MAX_PATHLENGTH ]; X register int c, d; X X if ( strlen( retb->filename ) < 5 ) X { X return FALSE; X } X X d = 0; X for ( c = strlen( retb->filename ) - 4; X c < strlen( retb->filename ); ++c ) X { X buffer[ d ] = retb->filename[ c ]; X ++d; X buffer[ d ] = 0; X } X X if ( strcmp( buffer, ".EXE" ) == 0 ) X { X return TRUE; X } X else if ( strcmp( buffer, ".COM" ) == 0 ) X { X return TRUE; X } X else if ( strcmp( buffer, ".BAT" ) == 0 ) X { X return TRUE; X } X else X { X return FALSE; X } X } SHAR_EOF chmod 0644 io/dr/dr_ibmpc.c || echo 'restore of io/dr/dr_ibmpc.c failed' Wc_c="`wc -c < 'io/dr/dr_ibmpc.c'`" test 3516 -eq "$Wc_c" || echo 'io/dr/dr_ibmpc.c: original size 3516, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_spec.c ============== if test -f 'io/dr/dr_spec.c' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_spec.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_spec.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_spec.c' && /************************************************************************* X X dr_spec.c Directory (dr) subroutines X for Bywater Software. X X Specification file. X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X **************************************************************************/ X #include "dr.h" X /************************************************************************* X X dr_first() X X This function returns the first instance of a file matching an X ambiguous file specifier (TRUE) or FALSE if no matches are found. X X The argument "findb" is a pointer to a character string which X is the ambiguous file specifier. X X The argument "retb" is a pointer to a character buffer where X the returned value (if TRUE) will be written. X **************************************************************************/ X dr_first( findb, retb ) X char findb[]; X struct dir_ent *retb; X { X } X /************************************************************************* X X dr_next() X X This function returns the next instance of a file matching the X ambiguous file specifier previously supplied to dr_first(TRUE), X or FALSE if no further matches are found. X X The argument "retb" is a pointer to a character buffer where X the returned value (if TRUE) will be written. X **************************************************************************/ X dr_next( retb ) X struct dir_ent *retb; X { X } X SHAR_EOF chmod 0644 io/dr/dr_spec.c || echo 'restore of io/dr/dr_spec.c failed' Wc_c="`wc -c < 'io/dr/dr_spec.c'`" test 2379 -eq "$Wc_c" || echo 'io/dr/dr_spec.c: original size 2379, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_sysv.c ============== if test -f 'io/dr/dr_sysv.c' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_sysv.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_sysv.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_sysv.c' && /************************************************************************* X X dr_sysv.c Directory (dr) subroutines X for Bywater Software. X X Implementation for AT&T Unix System V (tm) X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X **************************************************************************/ X #include "stdio.h" #ifdef __STDC__ #include "process.h" #endif #include "string.h" #include "time.h" #include "sys/types.h" #include "sys/stat.h" X #include "dr.h" X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X #ifndef CR #define CR 13 #define LF 10 #endif X int dr_fs = '/'; char dr_all[ MAX_PATHLENGTH ] = "*"; X extern char *tmpname(); X char tmpfname[80], command_string[80]; FILE *unix_fp; static char _path[ MAX_PATHLENGTH ]; X dr_first( findb, retb ) X char findb[]; X struct dir_ent *retb; X { X register int c; X char *name; X X strcpy( tmpfname, "/tmp/dr_unix.tmp" ); X sprintf( command_string, "ls -a %s | sort > %s", findb, tmpfname ); X system( command_string ); X X if ( ( unix_fp = fopen( tmpfname, "r" )) == NULL) X { X bw_error( "Cannot open temporary file for directory"); X return FALSE; X } X X if ( feof( unix_fp )) X { X fclose( unix_fp ); #ifdef OLD_DEBUG X fprintf( "Temporary file is empty. \n" ); #else X unlink( tmpfname ); #endif X return FALSE; X } X else X { X X strcpy( _path, findb ); X c = strlen( _path ); X X while (( c >= 0 ) && ( _path[ c ] != dr_fs )) X { #ifdef OLD_DEBUG X fprintf( stderr, "_path: %s c: %d\n", _path, X c ); #endif X _path[ c ] = 0; X --c; X } X X strcpy( retb->pathname, _path ); X X name = fgets( command_string, 80, unix_fp ); X if ( fill_buffer( retb, name ) == FALSE ) X { X return FALSE; X } X else X { X return TRUE; X } X } X } X dr_next( retb ) X struct dir_ent *retb; X { X char *name; X X if ( feof( unix_fp ) ) X { X fclose( unix_fp ); #ifndef DEBUG X unlink( tmpfname ); #endif X return FALSE; X } X else X { X strcpy( retb->pathname, _path ); X name = fgets( command_string, 80, unix_fp ); X if ( fill_buffer( retb, name )== FALSE ) X { X return FALSE; X } X else X { X return TRUE; X } X } X } X fill_buffer( retb, name ) X struct dir_ent *retb; X char *name; X { X static struct stat s_buf; X #ifdef OLD_DEBUG X fprintf( stderr, "fill_buffer() received filename: <%s> \n", name ); #endif X X strcpy( retb->filename, name ); X unix_truncate( retb->filename ); X X if ( strlen( retb->filename ) == 0 ) X { #ifdef OLD_DEBUG X fprintf( stderr, "Null filename returned. \n" ); #endif X return FALSE; X } X X stat( retb->filename, &s_buf ); X X retb->size = s_buf.st_size; X X if ( ( s_buf.st_mode & 0040000 ) == 0040000 ) X { X retb->type = FILE_DIRECTORY; X } X else if ( ( s_buf.st_mode & 0000400 ) == 0000007 ) X { X retb->type = FILE_EXECUTABLE; X } X else if ( ( s_buf.st_mode & 0000200 ) == 0000070 ) X { X retb->type = FILE_EXECUTABLE; X } X else if ( ( s_buf.st_mode & 0000100 ) == 0000100 ) X { X retb->type = FILE_EXECUTABLE; X } X else X { X retb->type = FILE_NORMAL; X } X X return TRUE; X X } X unix_truncate( buffer ) X char *buffer; X { X register char *p; X X p = buffer; X while( *p != 0 ) X { X if (( *p == CR ) || ( *p == LF )) X { X *p = 0; X } X ++p; X } X } X SHAR_EOF chmod 0644 io/dr/dr_sysv.c || echo 'restore of io/dr/dr_sysv.c failed' Wc_c="`wc -c < 'io/dr/dr_sysv.c'`" test 4111 -eq "$Wc_c" || echo 'io/dr/dr_sysv.c: original size 4111, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_test.c ============== if test -f 'io/dr/dr_test.c' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_test.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_test.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_test.c' && /************************************************************************* X X dr_test.c Directory (dr) subroutines X for Bywater Software. X X Test program X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X **************************************************************************/ X #include "stdio.h" #ifdef __STDC__ #include "malloc.h" #else extern char *malloc(); #endif #include "dr.h" X #define DIR_ENTRIES 128 X char findname[ MAX_PATHLENGTH ]; struct dir_ent *retstructs[ DIR_ENTRIES ]; X main() X { X register int c; X X for ( c = 0; c < DIR_ENTRIES; ++c ) X { X if ( ( retstructs[ c ] X = (struct dir_ent *) malloc( sizeof( struct dir_ent )) ) == NULL ) X { X fprintf( stderr, "Failed to allocate memory for directory structure.\n" ); X exit( 1 ); X } X } X X printf( "Enter an ambiguous file specifier: " ); X gets( findname ); /* printf( "\n" ); */ X X c = 0; X if ( dr_first( findname, retstructs[ c ] ) == 0 ) X { X printf( "No matches found.\n" ); X exit( 1 ); X } X X X printf( "Pathname: %s\tFilename: %s\tType: %d\tSize: %ld\n", X retstructs[ c ]->pathname, X retstructs[ c ]->filename, X retstructs[ c ]->type, X retstructs[ c ]->size ); X ++c; X X while( dr_next( retstructs[ c ] ) != 0 ) X { X printf( "Pathname: %s\tFilename: %s\tType: %d\tSize: %ld\n", X retstructs[ c ]->pathname, X retstructs[ c ]->filename, X retstructs[ c ]->type, X retstructs[ c ]->size ); X ++c; X } X } X X SHAR_EOF chmod 0644 io/dr/dr_test.c || echo 'restore of io/dr/dr_test.c failed' Wc_c="`wc -c < 'io/dr/dr_test.c'`" test 2371 -eq "$Wc_c" || echo 'io/dr/dr_test.c: original size 2371, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_test.mak ============== if test -f 'io/dr/dr_test.mak' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_test.mak (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_test.mak (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_test.mak' && PROJ =DR_TEST DEBUG =0 CC =qcl CFLAGS_G = /AS /W1 /Ze CFLAGS_D = /Zi /Zr /Gi$(PROJ).mdt /Od CFLAGS_R = /O /Ot /DNDEBUG CFLAGS =$(CFLAGS_G) $(CFLAGS_R) LFLAGS_G =/NOI LFLAGS_D =/INCR /CO LFLAGS_R = LFLAGS =$(LFLAGS_G) $(LFLAGS_R) RUNFLAGS = OBJS_EXT = LIBS_EXT = X all: $(PROJ).exe X dr_test.obj: dr_test.c X dr_ibmpc.obj: dr_ibmpc.c X $(PROJ).exe: dr_test.obj dr_ibmpc.obj $(OBJS_EXT) X echo >NUL @<<$(PROJ).crf dr_test.obj + dr_ibmpc.obj + $(OBJS_EXT) $(PROJ).exe X $(LIBS_EXT); << X link $(LFLAGS) @$(PROJ).crf X run: $(PROJ).exe X $(PROJ) $(RUNFLAGS) X SHAR_EOF chmod 0644 io/dr/dr_test.mak || echo 'restore of io/dr/dr_test.mak failed' Wc_c="`wc -c < 'io/dr/dr_test.mak'`" test 553 -eq "$Wc_c" || echo 'io/dr/dr_test.mak: original size 553, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/dr/dr_unix.c ============== if test -f 'io/dr/dr_unix.c' -a X"$1" != X"-c"; then echo 'x - skipping io/dr/dr_unix.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/dr/dr_unix.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/dr/dr_unix.c' && /************************************************************************* X X dr_unix.c Directory (dr) subroutines X for Bywater Software. X X Implementation for generic (?) Unix X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X **************************************************************************/ X #include "stdio.h" #include "string.h" #include "time.h" #include "sys/types.h" #include "sys/stat.h" X #include "dr.h" X #define INFILENAME "." #define OUTFILENAME "/tmp/dr_unix.tmp" X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X #ifndef CR #define CR 13 #define LF 10 #endif X int dr_fs = '/'; char dr_all[ MAX_PATHLENGTH ] = ""; X extern char *tmpname(); X char unix_flpath[ MAX_PATHLENGTH ]; char command_string[80]; FILE *unix_fp; static char _path[ MAX_PATHLENGTH ]; X dr_first( findb, retb ) X char *findb; X struct dir_ent *retb; X { X register int c; X char *name; X X sprintf( command_string, "ls -a -1 %s >%s", findb, OUTFILENAME ); X system( command_string ); X X if ( ( unix_fp = fopen( OUTFILENAME, "r" )) == NULL) X { #ifdef DEBUG X bw_error( "Cannot open temp file"); #endif X return FALSE; X } X X if ( feof( unix_fp )) X { X fclose( unix_fp ); #ifdef DEBUG X bw_error( "Temporary file is empty." ); #else X unlink( OUTFILENAME ); #endif X return FALSE; X } X else X { X X strcpy( _path, findb ); X c = strlen( _path ); X X while (( c >= 0 ) && ( _path[ c ] != dr_fs )) X { #ifdef OLD_DEBUG X fprintf( stderr, "_path: %s c: %d\n", _path, X c ); #endif X _path[ c ] = 0; X --c; X } X X strcpy( retb->pathname, _path ); X X name = fgets( command_string, 80, unix_fp ); X if ( unix_fillbuffer( retb, name ) == FALSE ) X { X return FALSE; X } X else X { X return TRUE; X } X } X } X dr_next( retb ) X struct dir_ent *retb; X { X char *name; X X if ( feof( unix_fp ) ) X { X fclose( unix_fp ); #ifndef DEBUG X unlink( OUTFILENAME ); #endif X return FALSE; X } X else X { X strcpy( retb->pathname, _path ); X name = fgets( command_string, 80, unix_fp ); X if ( unix_fillbuffer( retb, name ) == FALSE ) X { X return FALSE; X } X else X { X return TRUE; X } X } X } X unix_fillbuffer( retb, name ) X struct dir_ent *retb; X char *name; X { X static struct stat s_buf; X #ifdef OLD_DEBUG X fprintf( stderr, "unix_fillbuffer() received filename: <%s> \n", name ); #endif X X if ( name == NULL ) X { X return FALSE; X } X X strcpy( retb->filename, name ); X unix_truncate( retb->filename ); X X if ( strlen( retb->filename ) == 0 ) X { #ifdef DEBUG X bw_error( "Null filename returned." ); #endif X return FALSE; X } X X if ( stat( retb->filename, &s_buf ) != 0 ) X { #ifdef OLD_DEBUG X fprintf( stderr, "Can't stat file %s\n", retb->filename ); #endif X } X X retb->size = s_buf.st_size; X X if ( ( s_buf.st_mode & 0040000 ) == 0040000 ) X { X retb->type = FILE_DIRECTORY; X } X else if ( ( s_buf.st_mode & 0000400 ) == 0000007 ) X { X retb->type = FILE_EXECUTABLE; X } X else if ( ( s_buf.st_mode & 0000200 ) == 0000070 ) X { X retb->type = FILE_EXECUTABLE; X } X else if ( ( s_buf.st_mode & 0000100 ) == 0000100 ) X { X retb->type = FILE_EXECUTABLE; X } X else X { X retb->type = FILE_NORMAL; X } X X return TRUE; X X } X unix_truncate( buffer ) X char *buffer; X { X register char *p; X X p = buffer; X while( *p != 0 ) X { X if (( *p == CR ) || ( *p == LF )) X { X *p = 0; X } X ++p; X } X } X SHAR_EOF chmod 0644 io/dr/dr_unix.c || echo 'restore of io/dr/dr_unix.c failed' Wc_c="`wc -c < 'io/dr/dr_unix.c'`" test 4258 -eq "$Wc_c" || echo 'io/dr/dr_unix.c: original size 4258, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/gr/gr.h ============== if test ! -d 'io/gr'; then echo 'x - creating directory io/gr' mkdir 'io/gr' fi if test -f 'io/gr/gr.h' -a X"$1" != X"-c"; then echo 'x - skipping io/gr/gr.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/gr/gr.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/gr/gr.h' && /**************************************************************** X X gr.h Header for Graphics Interface X for Bywater Software X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ****************************************************************/ X extern int gr_screens; extern int gr_colors; extern int gr_pxsize; extern int gr_pysize; extern int gr_ismouse; extern int gr_clipping; extern int gr_blitting; extern int gr_saving; X /**************************************************************** X X boolean operators X ****************************************************************/ X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X /**************************************************************** X X boolean operators X ****************************************************************/ X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X /**************************************************************** X X colors X ****************************************************************/ X #define BLACK 0 #define WHITE 1 #define LIGHT_RED 2 #define LIGHT_GREEN 3 #define LIGHT_BLUE 4 #define LIGHT_YELLOW 5 #define LIGHT_CYAN 6 #define LIGHT_MAGENTA 7 #define DARK_RED 10 #define DARK_GREEN 11 #define DARK_BLUE 12 #define DARK_YELLOW 13 #define DARK_CYAN 14 #define DARK_MAGENTA 15 X /**************************************************************** X X fill (and line) styles X ****************************************************************/ X #define HOLLOW 0 /* Hollow fill -- draw perimeter */ #define SOLID 1 #define GRID 2 #define HATCH 3 X /**************************************************************** X X input modes X ****************************************************************/ X #define STATUS 0 #define WAIT 1 #define SAMPLE 2 #define HIDE 3 #define SHOW 4 #define POSITION 5 X /**************************************************************** X X figure drawing modes X ****************************************************************/ X #define PERIMETER 1 #define FILL 2 X /**************************************************************** X X screens X ****************************************************************/ X #define GR_PRIMARY 0 /* primary drawing screen */ #define GR_HIDDEN 1 /* secondary or hidden drawing screen */ X /**************************************************************** X X fonts X ****************************************************************/ X #define F_DEFAULT 0 #define F_ROMAN 1 #define F_GOTHIC 2 #define F_ITALIC 3 X /**************************************************************** X X gr_window structure X ****************************************************************/ X struct gr_window X { X int initialized; /* Boolean: successfully initialized? */ X int xmax; /* Maximum number of pixels, x axis */ X int ymax; /* Maximum number of pixels, y axis */ X int font; /* Current font style */ X int fxsize; /* Font size in pixels, x axis */ X int fysize; /* Font size in pixels, y axis */ X int clipping; /* Boolean: is cliiping in use? */ X int cl_x1; /* Left of clip window */ X int cl_y1; /* Bottom of clip window */ X int cl_x2; /* Right of clip window */ X int cl_y2; /* Top of clip window */ X }; X extern long gr_imsize(); extern unsigned int gr_strlen(); SHAR_EOF chmod 0644 io/gr/gr.h || echo 'restore of io/gr/gr.h failed' Wc_c="`wc -c < 'io/gr/gr.h'`" test 4574 -eq "$Wc_c" || echo 'io/gr/gr.h: original size 4574, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= io/gr/gr_def.c ============== if test -f 'io/gr/gr_def.c' -a X"$1" != X"-c"; then echo 'x - skipping io/gr/gr_def.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting io/gr/gr_def.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'io/gr/gr_def.c' && /**************************************************************** X X gr_def.c default line, rectangle, and circle X routines for Bywater X Graphics Interface standard X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ****************************************************************/ X X #include "stdio.h" #include "math.h" X #ifdef __STDC__ #include "malloc.h" #else extern char * malloc(); #define size_t int #endif X #include "bw.h" #include "gr.h" #include "kb.h" X #define CHECK_PARAMS FALSE #ifndef DEG_RAD #define RAD_DEG 5.729577951e1 /* Convert radians to degrees */ #define DEG_RAD 1.745329252e-2 /* Convert degrees to radians */ #endif #ifndef ACCURACY #define ACCURACY 10 #endif X #ifdef STANDALONE struct gr_window main_window; char tbuf[ 128 ]; char bw_ebuf[ BW_EBUFSIZE ]; int x_pos, y_pos, b_stat; X main() X { X register int c; X int x, y; X X gr_init( &main_window, NULL ); X kb_init(); X X x = main_window.xmax / 8; X y = ( main_window.ymax / 4 ) * 3; X c = 0; X while ( ( c < gr_colors ) && ( y > main_window.fysize ) ) X { X def_line( GR_PRIMARY, x, y, x + main_window.xmax / 20, y, X c, SOLID ); X x += main_window.xmax / 10; X def_line( GR_PRIMARY, x, y, x + main_window.xmax / 20, y, X c, HATCH ); X sprintf( tbuf, " <- lines, color %d at x = %d, y = %d", X c, x, y ); X gr_text( GR_PRIMARY, x + ( 3 * ( main_window.xmax / 20 )), X y - ( main_window.fysize / 2 ), tbuf, WHITE, BLACK ); X ++c; X x -= main_window.xmax / 10; X y -= ( main_window.fysize / 2 ) * 3; X } X kb_rx(); X X gr_cls( GR_PRIMARY ); X def_line( GR_PRIMARY, main_window.xmax / 2, main_window.ymax, X main_window.xmax, main_window.ymax / 2, WHITE, GRID ); X def_line( GR_PRIMARY, main_window.xmax, main_window.ymax / 2, X main_window.xmax / 2, 0, WHITE, GRID ); X def_line( GR_PRIMARY, main_window.xmax / 2, 0, X 0, main_window.ymax / 2, WHITE, GRID ); X def_line( GR_PRIMARY, 0, main_window.ymax / 2, X main_window.xmax / 2, main_window.ymax, WHITE, GRID ); X def_line( GR_PRIMARY, 0, main_window.ymax / 2, X main_window.xmax, main_window.ymax / 2, WHITE, SOLID ); X def_line( GR_PRIMARY, main_window.xmax / 2, 0, X main_window.xmax / 2, main_window.ymax, WHITE, SOLID ); X kb_rx(); X X gr_cls( GR_PRIMARY ); X x = main_window.xmax / 40; X y = main_window.ymax / 20; X def_rectangle( GR_PRIMARY, x * 4, y * 16, x * 6, y * 18, WHITE, HOLLOW ); X gr_text( GR_PRIMARY, x * 10, y * 17, "Hollow rectangle", WHITE, BLACK ); X def_rectangle( GR_PRIMARY, x * 4, y * 12, x * 6, y * 14, WHITE, SOLID ); X gr_text( GR_PRIMARY, x * 10, y * 13, "Solid rectangle", WHITE, BLACK ); X def_rectangle( GR_PRIMARY, x * 4, y * 8, x * 6, y * 10, WHITE, GRID ); X gr_text( GR_PRIMARY, x * 10, y * 9, "Grid rectangle", WHITE, BLACK ); X def_rectangle( GR_PRIMARY, x * 4, y * 4, x * 6, y * 6, WHITE, HATCH ); X gr_text( GR_PRIMARY, x * 10, y * 5, "Hatch rectangle", WHITE, BLACK ); X kb_rx(); X X gr_cls( GR_PRIMARY ); X x = main_window.xmax / 40; X y = main_window.ymax / 20; X def_circle( GR_PRIMARY, x * 5, y * 17, (y/2)*3, WHITE, HOLLOW ); X gr_text( GR_PRIMARY, x * 10, y * 17, "Hollow circle", WHITE, BLACK ); X def_circle( GR_PRIMARY, x * 5, y * 13, (y/2)*3, WHITE, SOLID ); X gr_text( GR_PRIMARY, x * 10, y * 13, "Solid circle", WHITE, BLACK ); X def_circle( GR_PRIMARY, x * 5, y * 9, (y/2)*3, WHITE, GRID ); X gr_text( GR_PRIMARY, x * 10, y * 9, "Grid circle", WHITE, BLACK ); SHAR_EOF true || echo 'restore of io/gr/gr_def.c failed' fi echo 'End of part 1' echo 'File io/gr/gr_def.c is continued in part 2' echo 2 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.