home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-08-28 | 52.8 KB | 1,380 lines |
- Article 186 of comp.sources.misc:
- Relay-Version: version B 2.10.3 alpha 5/22/85; site osu-eddie.UUCP
- Path: osu-eddie!cbosgd!clyde!ima!necntc!ncoast!allbery
- From: bl@infovax.UUCP (Bj|rn Larsson)
- Newsgroups: comp.sources.misc
- Subject: PCcurses shar 2
- Message-ID: <4270@ncoast.UUCP>
- Date: 26 Aug 87 22:52:40 GMT
- Date-Received: 27 Aug 87 12:24:34 GMT
- Sender: allbery@ncoast.UUCP
- Lines: 1363
- Approved: allbery@ncoast.UUCP
- X-Archive: comp.sources.misc/8708/pc-curses/2
-
- # This is a shar archive.
- # Remove everything above this line.
- # Run the file through sh, not csh.
- # (type `sh pccurses.sh.2')
- echo extracting - curses.cmd
- sed 's/^X//' > curses.cmd << 'FRIDAY_NIGHT'
- Xtmp
- Xy
- Xattrib.obj &
- X+beep.obj &
- X+boxes.obj &
- X+charadd.obj &
- X+chardel.obj &
- X+charget.obj &
- X+charins.obj &
- X+charpick.obj &
- X+clrtobot.obj &
- X+clrtoeol.obj &
- X+cursesio.obj &
- X+endwin.obj &
- X+initscr.obj &
- X+linedel.obj &
- X+lineins.obj &
- X+longname.obj &
- X+move.obj &
- X+mvcursor &
- X+newwin.obj &
- X+options.obj &
- X+overlay.obj &
- X+prntscan.obj &
- X+refresh.obj &
- X+scrreg.obj &
- X+setterm.obj &
- X+stradd.obj &
- X+strget.obj &
- X+tabsize.obj &
- X+termmisc.obj &
- X+unctrl.obj &
- X+update.obj &
- X+winclear.obj &
- X+windel.obj &
- X+winerase.obj &
- X+winmove.obj &
- X+winscrol.obj &
- X+wintouch.obj
- Xnul
- FRIDAY_NIGHT
- echo extracting - curses.h
- sed 's/^X//' > curses.h << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* CURSES.H */
- X/* Header file for definitions and declarations for the */
- X/* PCcurses package. This should be #include'd in all user */
- X/* programs. */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X/* general definitions */
- X
- X#define TRUE 1 /* booleans */
- X#define FALSE 0
- X#define ERR 1 /* general error flag */
- X#define OK 0 /* general OK flag */
- X
- X/* functions defined as macros */
- X
- X#define getch() wgetch(stdscr) /* using macroes allows you to use */
- X#define ungetch(c) wungetch(c) /* #undef getch/ungetch in your */
- X /* programs to use MSC getch() and */
- X /* ungetch() routines */
- X
- X#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx)
- X
- X#ifndef max
- X#define max(a,b) (((a) > (b)) ? (a) : (b))
- X#endif
- X#ifndef min
- X#define min(a,b) (((a) < (b)) ? (a) : (b))
- X#endif
- X
- X/* video attribute definitions */
- X
- X#define A_ALTCHARSET 0
- X#define A_BLINK 0x100
- X#define A_BLANK 0x200
- X#define A_BOLD 0x400
- X#define A_DIM 0
- X#define A_PROTECT 0
- X#define A_REVERSE 0x800
- X#define A_STANDOUT 0x1000
- X#define A_UNDERLINE 0x2000
- X
- X/* function and keypad key definitions */
- X
- X#define KEY_BREAK 0x101 /* Not on PC */
- X#define KEY_DOWN 0x102 /* The four arrow keys */
- X#define KEY_UP 0x103
- X#define KEY_LEFT 0x104
- X#define KEY_RIGHT 0x105
- X#define KEY_HOME 0x106 /* Home key (upward+left arrow) */
- X#define KEY_BACKSPACE 0x107 /* Not on PC */
- X#define KEY_F0 0x108 /* Function keys. Space for */
- X#define KEY_F(n) (KEY_F0+(n)) /* 64 keys is reserved. */
- X#define KEY_DL 0x148 /* Not on PC */
- X#define KEY_IL 0x149 /* Insert line */
- X#define KEY_DC 0x14a /* Delete character */
- X#define KEY_IC 0x14b /* Insert char or enter insert mode */
- X#define KEY_EIC 0x14c /* Exit insert char mode */
- X#define KEY_CLEAR 0x14d /* Clear screen */
- X#define KEY_EOS 0x14e /* Clear to end of screen */
- X#define KEY_EOL 0x14f /* Clear to end of line */
- X#define KEY_SF 0x150 /* Scroll 1 line forward */
- X#define KEY_SR 0x151 /* Scroll 1 line backwards (reverse) */
- X#define KEY_NPAGE 0x152 /* Next page */
- X#define KEY_PPAGE 0x153 /* Previous page */
- X#define KEY_STAB 0x154 /* Set tab */
- X#define KEY_CTAB 0x155 /* Clear tab */
- X#define KEY_CATAB 0x156 /* Clear all tabs */
- X#define KEY_ENTER 0x157 /* Enter or send (unreliable) */
- X#define KEY_SRESET 0x158 /* soft (partial) reset (unreliable) */
- X#define KEY_RESET 0x159 /* reset or hard reset (unreliable) */
- X#define KEY_PRINT 0x15a /* print or copy */
- X#define KEY_LL 0x15b /* home down or bottom (lower left) */
- X#define KEY_ABORT 0x15c /* Abort/Terminate key (any) */
- X#define KEY_SHELP 0x15d /* Short help */
- X#define KEY_LHELP 0x15e /* Long help */
- X
- X/* type declarations */
- X
- Xtypedef char bool; /* boolean type */
- X
- Xtypedef struct
- X {
- X int _cury; /* current pseudo-cursor */
- X int _curx;
- X int _maxy; /* max coordinates */
- X int _maxx;
- X int _begy; /* origin on screen */
- X int _begx;
- X int _flags; /* window properties */
- X int _attrs; /* attributes of written characters */
- X int _tabsize; /* tab character size */
- X bool _clear; /* causes clear at next refresh */
- X bool _leave; /* leaves cursor as it happens */
- X bool _scroll; /* allows window scrolling */
- X bool _nodelay; /* input character wait flag */
- X bool _keypad; /* flags keypad key mode active */
- X int **_line; /* pointer to line pointer array */
- X int *_minchng; /* First changed character in line */
- X int *_maxchng; /* Last changed character in line */
- X int _regtop; /* Top/bottom of scrolling region */
- X int _regbottom;
- X } WINDOW;
- X
- X/* External variables */
- X
- Xextern int LINES; /* terminal height */
- Xextern int COLS; /* terminal width */
- Xextern WINDOW *curscr; /* the current screen image */
- Xextern WINDOW *stdscr; /* the default screen window */
- X
- X/* PCcurses function declarations */
- X
- Xextern int addch(); /* put char in stdscr */
- Xextern int addstr(); /* put string in stdscr */
- Xextern void attrset(); /* set stdscr char attributes */
- Xextern void attroff(); /* clear attribute(a) stdscr */
- Xextern void attron(); /* add attribute(s) stdscr */
- Xextern int baudrate(); /* compatibility dummy */
- Xextern void beep(); /* sound bell */
- Xextern void box(); /* draw a box around a window */
- Xextern void cbreak(); /* set terminal cbreak mode */
- Xextern void clear(); /* clear stdscr */
- Xextern void clearok(); /* marks a window for screen clear */
- Xextern int clrtobot(); /* clear end of stdscr */
- Xextern int clrtoeol(); /* clear end of line in stdscr */
- Xextern void crmode(); /* set terminal cbreak mode */
- Xextern void cursoff(); /* turns off hardware cursor */
- Xextern void curson(); /* turns on hardware cursor */
- Xextern int delch(); /* delete a char in stdscr */
- Xextern int deleteln(); /* delete a line in stdscr */
- Xextern void delwin(); /* delete a window or a subwindow */
- Xextern void doupdate(); /* update physical screen */
- Xextern void echo(); /* set terminal echo mode */
- Xextern int endwin(); /* cleanup and finitialization */
- Xextern void erase(); /* erase stdscr */
- Xextern int erasechar(); /* return char kill character */
- Xextern int fixterm(); /* compatibility dummy */
- Xextern void flash(); /* flash terminal screen */
- Xextern void flushinp(); /* kill pending keyboard input */
- Xextern int getstr(); /* get string to stdscr and buffer */
- Xextern int gettmode(); /* compatibility dummy */
- Xextern void idlok(); /* use ins/del line (dummy) */
- Xextern int initscr(); /* curses initialization */
- Xextern int inch(); /* get char at stdscr cursor */
- Xextern int insch(); /* insert character in stdscr */
- Xextern int insertln(); /* insert new line in stdscr */
- Xextern void keypad(); /* marks a window for keypad usage */
- Xextern int killchar(); /* return line kill character */
- Xextern char *longname(); /* terminal description */
- Xextern void leaveok(); /* marks window for cursor 'leave' */
- Xextern void meta(); /* marks window for meta (dummy) */
- Xextern int move(); /* move cursor in stdscr */
- Xextern int mvaddch(); /* move & put char in stdscr */
- Xextern int mvaddstr(); /* move & put string in stdscr */
- Xextern int mvclrtobot(); /* move & clear end of stdscr */
- Xextern int mvclrtoeol(); /* move & clear lineend in stdscr */
- Xextern int mvcur(); /* move terminal cursor */
- Xextern int mvdelch(); /* move & delete a char in stdscr */
- Xextern int mvdeleteln(); /* move & delete a line in stdscr */
- Xextern int mvgetch(); /* move & get char to stdscr */
- Xextern int mvgetstr(); /* move & get string to stdscr */
- Xextern int mvinch(); /* move & get char at stdscr cursor */
- Xextern int mvinsch(); /* move & insert char in stdscr */
- Xextern int mvinsertln(); /* move & insert new line in stdscr */
- Xextern int mvprintw(); /* move & print string in stdscr */
- Xextern int mvscanw(); /* move & get values via stdscr */
- Xextern int mvwaddch(); /* move & put char in a window */
- Xextern int mvwaddstr(); /* move & put string in a window */
- Xextern int mvwclrtobot(); /* move & clear end of a window */
- Xextern int mvwclrtoeol(); /* move & clear lineend in a window */
- Xextern int mvwdelch(); /* move & delete a char in a window */
- Xextern int mvwdeleteln(); /* move & delete a line in a window */
- Xextern int mvwgetch(); /* move & get char to a window */
- Xextern int mvwgetstr(); /* move & get string to a window */
- Xextern int mvwinch(); /* move & get char at window cursor */
- Xextern int mvwinsch(); /* move & insert char in a window */
- Xextern int mvwinsertln(); /* move & insert new line in window */
- Xextern int mvwin(); /* move window */
- Xextern int mvwprintw(); /* move & print string in a window */
- Xextern int mvwscanw(); /* move & get values via a window */
- Xextern WINDOW *newwin(); /* create a window */
- Xextern void nl(); /* set terminal cr-crlf map mode */
- Xextern void nocbreak(); /* unset terminal cbreak mode */
- Xextern void nocrmode(); /* unset terminal cbreak mode */
- Xextern void nodelay(); /* marks window for no input wait */
- Xextern void noecho(); /* unset terminal echo mode */
- Xextern void nonl(); /* unset terminal cr-crlf map mode */
- Xextern void noraw(); /* unset raw terminal mode */
- Xextern void overlay(); /* overlay one window on another */
- Xextern void overwrite(); /* overwrite one window on another */
- Xextern int printw(); /* print string in stdscr */
- Xextern void raw(); /* set raw terminal mode */
- Xextern void refrbrk(); /* set screen refresh break mode */
- Xextern void refresh(); /* refresh stdscr */
- Xextern int resetterm(); /* compatibility dummy */
- Xextern int resetty(); /* restore terminal I/O modes */
- Xextern int saveoldterm(); /* compatibility dummy */
- Xextern int saveterm(); /* compatibility dummy */
- Xextern int savetty(); /* save terminal I/O modes */
- Xextern int scanw(); /* get values via stdscr */
- Xextern void scroll(); /* scroll region in a window */
- Xextern void scrollok(); /* marks a window to allow scroll */
- Xextern int setsrcreg(); /* define stdscr's scroll region */
- Xextern int setterm(); /* compatibility dummy */
- Xextern int setupterm(); /* set up terminal (no-op) */
- Xextern void standend(); /* start normal chars in stdscr */
- Xextern void standout(); /* start standout chars in stdscr */
- Xextern WINDOW *subwin(); /* create a sub-window */
- Xextern int tabsize(); /* set/get tabsize of stdscr */
- Xextern void touchwin(); /* mark a window as modified */
- Xextern char *unctrl(); /* char-to-string converter */
- Xextern int waddch(); /* put char in a window */
- Xextern int waddstr(); /* put string in a window */
- Xextern void wattroff(); /* clear attribute(a) in window */
- Xextern void wattron(); /* add attribute(s) in window */
- Xextern void wattrset(); /* set window char attributes */
- Xextern int wbox(); /* draw a box inside a window */
- Xextern void wclear(); /* clear a window */
- Xextern int wclrtobot(); /* clear end of a window */
- Xextern int wclrtoeol(); /* clear end of line in a window */
- Xextern int wdelch(); /* delete a char in a window */
- Xextern int wdeleteln(); /* delete a line in a window */
- Xextern void werase(); /* erase a window */
- Xextern int wgetch(); /* get char to a window */
- Xextern int wgetstr(); /* get string to window and buffer */
- Xextern int winch(); /* get char at window cursor */
- Xextern int winsch(); /* insert character in a window */
- Xextern int winsertln(); /* insert new line in a window */
- Xextern int wmove(); /* move cursor in a window */
- Xextern void wnoutrefresh(); /* create screen image, w/o display */
- Xextern int wprintw(); /* print string in a window */
- Xextern void wrefresh(); /* refresh screen */
- Xextern int wscanw(); /* get values via a window */
- Xextern int wsetsrcreg(); /* define a window's scroll region */
- Xextern void wstandend(); /* start normal chars in window */
- Xextern void wstandout(); /* start standout chars in window */
- Xextern int wtabsize(); /* set/get tabsize of a window */
- Xextern int wungetch(); /* character push-back */
- FRIDAY_NIGHT
- echo extracting - curses.man
- sed 's/^X//' > curses.man << 'FRIDAY_NIGHT'
- XCURSES(3) MS-DOS Programmer's Manual CURSES(3)
- X
- XNAME
- X curses - screen/window management library
- X
- XDESCRIPTION
- X Curses is a library of screen and window management routines. It is modeled
- X after the UNIX curses and ncurses libraries. Normally, programs written for
- X curses should be easily ported to UNIX, and vice versa.
- X
- X To use the routines, the function initscr() must first be called. This cre-
- X ates two 'windows' for the user: stdscr and curscr. Stdscr is the default
- X window for the user to make changes on, and curscr reflects the current
- X contents of the physical display screen. The user writes or edits the std-
- X scr window to his liking, then calls the refresh() function to make curscr
- X and the physical screen look like stdscr. When the user program terminates,
- X it should call the endwin() function to restore things to normal.
- X
- X There are all sorts of window manipulation routines available to the pro-
- X grammer: auxiliary windows may be created, edited, moved and deleted. The
- X terminal may be set in many different modes, output text may be attributed
- X with blink, blank, bold and reverse attributes. There are window-specific
- X printf- and scanf-like routines, routines for scrolling, bow-drawing, win-
- X dow overlaying, clearing routines etc. Curses also handles terminal func-
- X tion keys, which is enables by calling the keypad() function.
- X
- X For more and detailed information, see the library source codes. All curses
- X functions are preceded by a complete description.
- X
- XCOMPILING
- X All programs that use curses facilities should include the file <curses.h>,
- X and during linking, the library ?curses.lib should be specified to the lin-
- X ker ('?' is 's', 'c' 'm' or 'l' for small, compact, medium or large memory
- X model respectively).
- X
- XFUNCTIONS
- X Below is a list over the available functions, together with a brief de-
- X scription of what they do. In general, functions whose names start with
- X 'w' differ from the one without 'w' (like wmove vs. move) signify that
- X a specific window is used. Without a 'w', sdtscr is implied. The functions
- X that start with 'mv' before the 'genereic' function name signify that a
- X cursor motion should be made before the actual work. 'mv' and 'w' combine
- X as expected.
- X
- X Most routines that return an int will return the manifest constant ERR if
- X there is a failure during execution. Routines that return a char actually
- X return an int, so that ERR does not conflict with the character code 0xff.
- X All IBM PC characters from 0 to 0xff are allowed for usage with curses.
- X
- X Some routines, like {mv}{w} printw() and {mv}{w}scanw() return a meaningful
- X positive value if the operation is successful.
- X
- X The curses package uses some predefined types, variables and manifest con-
- X stants that are also available to the programmer. There are also a few
- X globally accessible variables that should not be touched by the applica-
- X tion program. Those untouchable variables have names starting with an
- X underscore (_) to avoid conflicts. The user-accessible types, variables
- X and constants are (there are a number of other constants defining charac-
- X ter attribute names and function key names - consult <curses.h> for de-
- X tails):
- X
- X (manifest constants)
- X
- X TRUE boolean true
- X FALSE boolean false
- X ERR unsuccessfull operation
- X OK successfull operation
- X
- X (types)
- X
- X WINDOW a window structure type
- X bool boolean flag type
- X
- X (variables)
- X
- X WINDOW curscr physical display image
- X WINDOW stdscr default user drawing board
- X int LINES terminal height
- X int COLS terminal width
- X
- X The following is an alphabetical list of the curses functions, together
- X with their types, parameters and a short comment for each (win is a win-
- X dow, ch, vc, hc are characters, buf is a character buffer, attrs is an
- X attribute bit map, bf is a boolean flag. Note that `characters' in this
- X context usually can have 16 bits):
- X
- X
- X int addch(ch) put char in stdscr
- X int addstr(str) put string in stdscr
- X void attroff(attrs) clear attribute(s) in stdscr
- X void attron(attrs) add attribute(s) in stdscr
- X void attrset(attrs) set stdscr char attributes
- X int baudrate() dummy for compatibility
- X void beep() ring the bell
- X void box(win,vc,hc) box in a window, with given characters
- X void cbreak() set terminal cbreak mode
- X void clear() clear stdscr
- X void clearok(win,bf) marks window for screen clear
- X int clrtobot() clear end of stdscr
- X int clrtoeol() clear end of line in stdscr
- X void crmode() set terminal cbreak mode
- X void cursoff() turns off hardware cursor
- X void curson() turns on hardware cursor
- X int delch() delete a char in stdscr
- X int deleteln() delete a line in stdscr
- X void delwin(win) delete a window or a subwindow
- X void doupdate() update physical screen
- X void echo() set terminal echo mode
- X int endwin() cleanup and curses finitialization
- X void erase() erase stdscr
- X int erasechar() return char delete character
- X int fixterm() dummy for compatibility
- X void flash() flash terminal screen
- X void flushinp() kill pending keyboard input
- X int getch() (#def macro) get character via stdscr
- X int getstr(buf) get string via stdscr to a buffer
- X void getyx(win,y,x) get a window's cursor position
- X int gettmode() dummy for compatibility
- X void idlok(win,bf) dummy for compatibility
- X int initscr() curses initialization (ret 1 if OK)
- X int inch() get char at stdscr cursor
- X int insch(ch) insert character in stdscr
- X int insertln() insert an empty line in stdscr
- X void keypad(win,bf) marks a window for keypad usage
- X int killchar() return line delete character
- X char *longname() returns terminal description string
- X void leaveok(win,bf) marks window for cursor 'update leave'
- X void meta(win,bf) marks window for meta (dummy function)
- X int move(y,x) move cursor in stdscr
- X int mvaddch(y,x,ch) move & put char in stdscr
- X int mvaddstr(y,x,str) move & put string in stdscr
- X int mvclrtobot(y,x) move & clear end of stdscr
- X int mvclrtoeol(y,x) move & clear lineend in stdscr
- X int mvcur(oldy,oldx,y,x) move terminal cursor to <y,x>
- X int mvdelch(y,x) move & delete a char in stdscr
- X int mvdeleteln(y,x) move & delete a line in stdscr
- X int mvgetch(y,x) move & get char to stdscr
- X int mvgetstr(y,x,buf) move & get string via stdscr to buffer
- X int mvinch(y,x,) move & get char at stdscr cursor
- X int mvinsch(y,x,ch) move & insert char in stdscr
- X int mvinsertln(y,x) move & insert new line in stdscr
- X int mvprintw(y,x,fmt,args) move & print string in stdscr
- X int mvscanw(y,x,fmt,args) move & get values via stdscr
- X int mvwaddch(win,y,x,ch) move & put char in a window
- X int mvwaddstr(win,y,x,str) move & put string in a window
- X int mvwclrtobot(win,y,x) move & clear end of a window
- X int mvwclrtoeol(win,y,x) move & clear lineend in a window
- X int mvwdelch(win,y,x) move & delete a char in a window
- X int mvwdeleteln(win,y,x) move & delete a line in a window
- X int mvwgetch(win,y,x) move & get char to a window
- X int mvwgetstr(win,y,x,str) move & get string to a window
- X int mvwinch(win,y,x) move & get char at window cursor
- X int mvwinsch(win,y,x,ch) move & insert char in a window
- X int mvwinsertln(win,y,x) move & insert new line in window
- X int mvwin(win,y,x) move window on physical screen
- X int mvwprintw(win,x,y,fmt,args) move & print string in a window
- X int mvwscanw(win,y,x,fmt,args) move & get values via a window
- X WINDOW *newwin(lines,cols,begy,begx) create a new window
- X void nl() set terminal cr-crlf mapping mode
- X void nocbreak() unset terminal cbreak mod
- X void nocrmode() unset terminal cbreak mode
- X void nodelay(win,bf) marks window for no input wait
- X void noecho() unset terminal echo mode
- X void nonl() unset terminal cr-crlf mapping mode
- X void noraw() unset raw terminal mode
- X void overlay(win1,win2) overlay one window on another
- X void overwrite(win1,win2) overwrite one window on another
- X int printw(fmt,args) print string in stdscr
- X void raw() set raw terminal mode
- X void refrbrk(bf) set screen update break mode
- X void refresh() refresh stdscr
- X int resetterm() dummy for compatibility
- X int resetty() restore terminal I/O modes
- X int saveoldterm() dummy for compatibility
- X int saveterm() dummy for compatibility
- X int savetty() save terminal I/O modes
- X int scanw(fmt,args) get values via stdscr
- X void scroll(win) scroll scrolling region of a window
- X void scrollok(win,bf) marks a window to allow scroll
- X int setsrcreg(miny,maxy) define stdscr's scroll region
- X int setterm() dummy for compatibility
- X int setupterm(term,fd,errret) set up terminal (no-op on PC)
- X void standend() start normal chars in stdscr
- X void standout() start standout chars in stdscr
- X WINDOW *subwin(win,lines,cols,begy,begx) create a sub-window in window win
- X int tabsize(ts) set/get tabsize of stdscr
- X void touchwin(win) mark a window as totally modified
- X char *unctrl(ch) char-to-string converter
- X int ungetch(ch) (#def macro) push back a character to input */
- X int waddch(win,ch) put char in a window
- X int waddstr(win,str) put string in a window
- X void wattroff(win,attrs) clear attribute(s) in window
- X void wattron(win,attrs) add attribute(s) in window
- X void wattrset(win,attrs) set window char attributes
- X int wbox(win,miny,minx,maxy,maxx,vc,hc) draw a box inside a window
- X void wclear(win) clear a window
- X int wclrtobot(win) clear end of a window
- X int wclrtoeol(win) clear end of line in a window
- X int wdelch(win) delete a char in a window
- X int wdeleteln(win) delete a line in a window
- X void werase(win) erase a window
- X int wgetch(win) get char via a window
- X int wgetstr(win,buf) get string via window to a buffer
- X int winch(win) get char at window cursor
- X int winsch(win,ch) insert character in a window
- X int winsertln(win) insert new line in a window
- X int wmove(win,y,x) move cursor in a window
- X void wnoutrefresh(win) create internal screen image
- X int wprintw(win,fmt,args) print string in a window
- X void wrefresh(win) refresh window
- X int wscanw(win,fmt,args) get values via a window
- X int wsetsrcreg(win,miny,maxy) define a window's scrolling region
- X void wstandend(win) start normal chars in window
- X void wstandout(win) start standout chars in window
- X int wtabsize(win,ts) set/get tabsize of a window
- X int wungetch(ch) push back a character to input */
- X
- XSEE ALSO
- X Screen Updating And Cursor Movement Optimization: A Library Package -
- X Kenneth C.R.C. Arnold
- X The Ncurses Reference Manual - Pavel Curtis, Cornell University
- X
- XBUGS
- X The terminal raw I/O mode is implemented by reading characters directly
- X from the BIOS. This means that the programmer must not use the normal
- X I/O routines to the screen or from the keyboard, since they will trap the
- X MS-DOS ^C, ^S, ^Q and ^P characters and thus nullify the raw input.
- X
- X Also, if the terminal is in normal or cbreak mode and the programmer has
- X trapped CTRL-BREAK by using signal(SIGINT,ownhandler), MS-DOS will still
- X echo the characters '^C' on the screen when the character is intercepted.
- X There seems to be no way to avoid this under MS-DOS (use raw mode in-
- X stead).
- X
- X The function keys are hardware dependent. There is a table in charget.c
- X that maps keyboard scan codes from the keyboard to function key names.
- X The one supplied works for IBM PC/XT/AT, and for most clones.
- FRIDAY_NIGHT
- echo extracting - cursesio.asm
- sed 's/^X//' > cursesio.asm << 'FRIDAY_NIGHT'
- X TITLE PCcurses BIOS Control Functions for MicroSoft 'C' v.4.0
- X NAME CURSESIO
- X PAGE 46,132
- X ;****************************************************************
- X ;* CURSESIO.ASM *
- X ;* *
- X ;* This file contains 'C' functions for the MicroSoft 'C' com- *
- X ;* piler v.4.0. It exercises a number of BIOS video calls, and *
- X ;* is intended for inclusion in a curses library package. *
- X ;* *
- X ;* The two files FARNEAR.INC and SMALHUGE.INC each contain one *
- X ;* EQUate. These define the module's memory model. *
- X ;* *
- X ;****************************************************************
- X ;* This version of curses is based on ncurses, a curses version *
- X ;* originally written by Pavel Curtis at Cornell University. *
- X ;* I have made substantial changes to make it run on IBM PC's, *
- X ;* and therefore consider myself free to make it public domain. *
- X ;* Bjorn Larsson (...mcvax!enea!infovax!bl) *
- X ;****************************************************************
- X ;* Author: Bjorn Larsson *
- X ;* Revised: *
- X ;* 1.0: Release: 870515 *
- X ;****************************************************************
- X ;
- X INCLUDE FARNEAR.INC ;DEFINE FAR OR NEAR CALL SEQUENCE
- X INCLUDE SMALHUGE.INC ;DEFINE FAR OR NEAR DATA ACCESS
- X ;
- XSYSTEM EQU 21H ;SYSTEM CALL
- XBRKCHK EQU 33H ;BREAK SET/CHECK FUNCTION CODE
- X ;
- X_TEXT SEGMENT BYTE PUBLIC 'CODE'
- X ASSUME CS: _TEXT
- X ;
- X ;****************************************************************
- X ;* Function entry and exit macros, and parameter fetch macro. *
- X ;* Used by all functions. *
- X ;****************************************************************
- X ;
- Xc_entry MACRO f_name
- X ;
- X if far_call
- X&f_name proc far
- X else
- X&f_name proc near
- X endif
- X push bp
- X mov bp,sp
- X push di
- X push si
- X ;
- X ENDM
- X ;
- Xc_exit MACRO f_name
- X ;
- X pop si
- X pop di
- X pop bp
- X ret
- X&f_name endp
- X ;
- X ENDM
- X ;
- Xg_parm MACRO reg,p_num
- X if far_call
- X mov ®,[bp+&p_num*2+4]
- X else
- X mov ®,[bp+&p_num*2+2]
- X endif
- X ;
- X ENDM
- X ;
- X PAGE
- X ;****************************************************************
- X ;* _cursesocattr *
- X ;* *
- X ;* void _cursescattr(chr,attr) *
- X ;* *
- X ;* Writes char 'chr' with attributes 'attr' to the current cur- *
- X ;* sor location. *
- X ;****************************************************************
- X PUBLIC __cursescattr
- X ;
- X c_entry __cursescattr
- X MOV AH,9
- X MOV BH,0 ;USE PAGE 0
- X g_parm AL,2 ;GET CHR PARAMETER
- X g_parm BL,3 ;GET ATTR PARAMETER
- X MOV CX,1 ;PUT 1 CHARACTER
- X INT 10H
- X c_exit __cursescattr
- X ;
- X ;****************************************************************
- X ;* _cursescursor *
- X ;* *
- X ;* void _cursescursor(row,column) *
- X ;* *
- X ;* Sets the cursor position in video page 0. 'row' and 'column' *
- X ;* are the cursor address. If 'row' is set to 25, no cursor at *
- X ;* all is displayed. *
- X ;****************************************************************
- X PUBLIC __cursescursor
- X ;
- X c_entry __cursescursor
- X MOV AH,2
- X MOV BH,0 ;USE PAGE 0
- X g_parm DH,2 ;GET ROW PARAMETER
- X g_parm DL,3 ;GET COLUMN PARAMETER
- X INT 10H
- X c_exit __cursescursor
- X ;
- X ;****************************************************************
- X ;* _cursesgcols *
- X ;* *
- X ;* int _cursesgcols() *
- X ;* *
- X ;* Return the current number of columns on the screen. *
- X ;****************************************************************
- X PUBLIC __cursesgcols
- X ;
- X c_entry __cursesgcols
- X MOV AH,15
- X INT 10H
- X MOV AL,AH
- X XOR AH,AH
- X c_exit __cursesgcols
- X ;
- X ;****************************************************************
- X ;* _cursesputc *
- X ;* *
- X ;* void _cursesputc(chr,colour) *
- X ;* *
- X ;* Output character 'chr' to screen in tty fashion. If a colour *
- X ;* mode is active, the character is written with colour *
- X ;* 'colour'. *
- X ;****************************************************************
- X PUBLIC __cursesputc
- X ;
- X c_entry __cursesputc
- X MOV AH,14
- X g_parm AL,1 ;GET CHR PARAMETER
- X g_parm BL,2 ;GET COLOUR PARAMETER
- X INT 10H
- X c_exit __cursesputc
- X ;
- X ;****************************************************************
- X ;* _cursesscroll *
- X ;* *
- X ;* void _cursesscroll(urow,lcol,lrow,rcol,lines,attr) *
- X ;* *
- X ;* Scroll a window in the current page up or down. Urow, lcol, *
- X ;* lrow,rcol are the window coordinats. lines is the number of *
- X ;* lines to scroll. If 0, clears the window, if < 0 scrolls *
- X ;* down, > 0 scrolls up. Blanks areas that are left, and sets *
- X ;* character attributes to attr. If in a colour graphics mode, *
- X ;* fills them with the colour 'attr' instead. *
- X ;****************************************************************
- X PUBLIC __cursesscroll
- X ;
- X c_entry __cursesscroll
- X g_parm AL,5 ;GET LINES PARAMETER
- X MOV AH,6
- X TEST AL,80H
- X JZ SHORT CS_1
- X ;
- X MOV AH,7
- X NEG AL
- X ;
- XCS_1: g_parm CH,1 ;GET UROW PARAMETER
- X g_parm CL,2 ;GET LCOL PARAMETER
- X g_parm DH,3 ;GET LROW PARAMETER
- X g_parm DL,4 ;GET RCOL PARAMETER
- X g_parm BH,6 ;GET ATTR PARAMETER
- X INT 10H
- X c_exit __cursesscroll
- X ;
- X ;****************************************************************
- X ;* _cursesgcmode *
- X ;* *
- X ;* int _cursesgcmode() *
- X ;* *
- X ;* Return the current cursor type. Bits 8-15 of the return *
- X ;* value is the start scan row, and bits 0-7 is the end scan *
- X ;* row. *
- X ;****************************************************************
- X PUBLIC __cursesgcmode
- X ;
- X c_entry __cursesgcmode
- X MOV AH,3
- X INT 10H
- X MOV AX,CX
- X c_exit __cursesgcmode
- X ;
- X ;****************************************************************
- X ;* _cursescmode *
- X ;* *
- X ;* void _cursescmode(startrow,endrow) *
- X ;* *
- X ;* Sets the cursor type to begin in scan line startrow and end *
- X ;* in scan line endrow. Both values should be 0-31. *
- X ;****************************************************************
- X PUBLIC __cursescmode
- X ;
- X c_entry __cursescmode
- X MOV AH,1
- X g_parm CH,1 ;GET STARTROW PARAMETER
- X g_parm CL,2 ;GET ENDROW PARAMETER
- X INT 10H
- X c_exit __cursescmode
- X ;
- X ;****************************************************************
- X ;* _curseskey *
- X ;* *
- X ;* int _curseskey() *
- X ;* *
- X ;* Returns the next key code struck at the keyboard. If the low *
- X ;* 8 bits are non-0, the uper bits contain the extended cha- *
- X ;* racter code. If bit 0-7 are non-zero, the upper bits = 0. *
- X ;****************************************************************
- X PUBLIC __curseskey
- X ;
- X c_entry __curseskey
- X MOV AH,0
- X INT 16H
- X CMP AL,0
- X JZ SHORT EXTKEY
- X AND AX,0FFH
- XEXTKEY:
- X c_exit __curseskey
- X ;
- X ;****************************************************************
- X ;* _curseskeytst *
- X ;* *
- X ;* int _curseskeytst() *
- X ;* *
- X ;* Returns 1 if a character is available, 0 otherwise. *
- X ;****************************************************************
- X PUBLIC __curseskeytst
- X ;
- X c_entry __curseskeytst
- X MOV AH,1
- X INT 16H
- X JZ SHORT TST1
- X MOV AX,0
- X JMP SHORT EXTTST
- XTST1: MOV AX,1
- XEXTTST:
- X c_exit __curseskeytst
- X ;
- X ;****************************************************************
- X ;* _cursesgcb *
- X ;* *
- X ;* int _cursesgcb() *
- X ;* *
- X ;* Returns 1 if MSDOS BREAK CHECK is on, otherwise 0. *
- X ;****************************************************************
- X PUBLIC __cursesgcb
- X ;
- X c_entry __cursesgcb
- X MOV AX,BRKCHK*256+0
- X INT SYSTEM
- X XOR AH,AH
- X MOV AL,DL
- X c_exit __cursesgcb
- X ;
- X ;****************************************************************
- X ;* _cursesscb *
- X ;* *
- X ;* void _cursesscb(setting) *
- X ;* *
- X ;* Sets MSDOS BREAK CHECK according to 'setting'. *
- X ;****************************************************************
- X PUBLIC __cursesscb
- X ;
- X c_entry __cursesscb
- X MOV AX,BRKCHK*256+1
- X g_parm DL,1
- X AND DL,DL
- X JZ SHORT SCB1
- X MOV DL,1
- XSCB1: INT SYSTEM
- X c_exit __cursesscb
- X ;
- X_TEXT ENDS
- X if1
- X %OUT Pass 1 Completed
- X else
- X %OUT Assembly Completed
- X endif
- X END
- FRIDAY_NIGHT
- echo extracting - curspriv.h
- sed 's/^X//' > curspriv.h << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* CURSPRIV.H */
- X/* Header file for definitions and declarations for the */
- X/* PCcurses package. These definitions should not be gene- */
- X/* rally accessible to programmers. */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X/* window properties */
- X
- X#define _SUBWIN 1 /* window is a subwindow */
- X#define _ENDLINE 2 /* last winline is last screen line */
- X#define _FULLWIN 4 /* window fills screen */
- X#define _SCROLLWIN 8 /* window lwr rgt is screen lwr rgt */
- X
- X/* Miscellaneous */
- X
- X#define _INBUFSIZ 200 /* size of terminal input buffer */
- X#define _NO_CHANGE -1 /* flags line edge unchanged */
- X
- X#define _BREAKCHAR 0x03 /* ^C character */
- X#define _DCCHAR 0x08 /* Delete Char char (BS) */
- X#define _DLCHAR 0x1b /* Delete Line char (ESC) */
- X#define _GOCHAR 0x11 /* ^Q character */
- X#define _PRINTCHAR 0x10 /* ^P character */
- X#define _STOPCHAR 0x13 /* ^S character */
- X#define NUNGETCH 10 /* max # chars to ungetch() */
- X
- X/* character mask definitions */
- X
- X#define CHR_MSK ((int) 0x00ff) /* ASCIIZ character mask */
- X#define ATR_MSK ((int) 0xff00) /* attribute mask */
- X#define ATR_NRM ((int) 0x0000) /* no special attributes */
- X
- X/* type declarations */
- X
- Xtypedef struct
- X {
- X WINDOW *tmpwin; /* window used for updates */
- X int cursrow; /* position of physical cursor */
- X int curscol;
- X bool autocr; /* if lf -> crlf */
- X bool cbreak; /* if terminal unbuffered */
- X bool echo; /* if terminal echo */
- X bool raw; /* if terminal raw mode */
- X bool refrbrk; /* if premature refresh brk allowed */
- X bool orgcbr; /* original MSDOS ^-BREAK setting */
- X } cursv;
- X
- X/* External variables */
- X
- Xextern cursv _cursvar; /* curses variables */
- X
- X/* 'C' standard library function declarations */
- X
- Xextern char *calloc();
- Xextern char *malloc();
- Xextern void free();
- Xextern int sprintf();
- Xextern int sscanf();
- X
- X/* curses internal functions, not to be used by programmers */
- X
- Xextern void _cursescattr();
- Xextern void _cursescmode();
- Xextern void _cursescursor();
- Xextern int _cursesgcb();
- Xextern int _cursesgcmode();
- Xextern int _cursesgcols();
- Xextern int _curseskey();
- Xextern int _curseskeytst();
- Xextern bool _cursespendch();
- Xextern void _cursesputc();
- Xextern void _cursesscb();
- FRIDAY_NIGHT
- echo extracting - endwin.c
- sed 's/^X//' > endwin.c << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* Endwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/****************************************************************/
- X/* Endwin() does neccessary clean-up after using the PCcurses */
- X/* package. It should be called before exiting the user's pro- */
- X/* gram. */
- X/****************************************************************/
- X
- Xint endwin()
- X {
- X delwin(stdscr);
- X delwin(curscr);
- X delwin(_cursvar.tmpwin);
- X curson(); /* turn on cursor if off */
- X _cursescursor(0,LINES-1, 0); /* put at lower left */
- X _cursesscb(_cursvar.orgcbr); /* restore original ^BREAK setting */
- X return(OK);
- X } /* endwin */
- FRIDAY_NIGHT
- echo extracting - farcall.inc
- sed 's/^X//' > farcall.inc << 'FRIDAY_NIGHT'
- X far_call EQU 1
- FRIDAY_NIGHT
- echo extracting - hugedata.inc
- sed 's/^X//' > hugedata.inc << 'FRIDAY_NIGHT'
- X huge_data EQU 1
- FRIDAY_NIGHT
- echo extracting - initscr.c
- sed 's/^X//' > initscr.c << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* Initscr() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- XWINDOW *curscr; /* the current screen image */
- XWINDOW *stdscr; /* the default screen window */
- Xcursv _cursvar; /* curses variables */
- Xint LINES; /* terminal height */
- Xint COLS; /* terminal width */
- X
- X/****************************************************************/
- X/* Initscr() does neccessary initializations for the PCcurses */
- X/* package. It MUST be called before any other curses routines. */
- X/****************************************************************/
- X
- Xint initscr()
- X {
- X _cursvar.cursrow = -1; /* Initial cursor unknown */
- X _cursvar.curscol = -1;
- X _cursvar.autocr = TRUE; /* lf -> crlf by default */
- X _cursvar.raw = FALSE; /* tty I/O modes */
- X _cursvar.cbreak = FALSE;
- X _cursvar.echo = TRUE;
- X _cursvar.refrbrk = FALSE; /* no premature end of refresh */
- X _cursvar.orgcbr = _cursesgcb(); /* original ^BREAK setting */
- X
- X LINES = 25; /* @@@@ this must be fixed */
- X COLS = _cursesgcols();
- X
- X if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X curscr->_clear = FALSE;
- X return(OK);
- X } /* initscr */
- FRIDAY_NIGHT
- echo extracting - linedel.c
- sed 's/^X//' > linedel.c << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* Wdeleteln() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/****************************************************************/
- X/* Wdeleteln() deletes the line at the window cursor, and the */
- X/* lines below it are shifted up, inserting a blank line at */
- X/* the bottom of the window. */
- X/****************************************************************/
- X
- Xint wdeleteln(win)
- X WINDOW *win;
- X {
- X int *end;
- X int *temp;
- X short y;
- X static int blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X
- X temp = win->_line[win->_cury];
- X for (y = win->_cury; y < win->_regbottom; y++)
- X {
- X win->_line[y] = win->_line[y+1];
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = win->_maxx;
- X }
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = win->_maxx;
- X win->_line[win->_regbottom] = temp;
- X for (end = &(temp[win->_maxx]); temp <= end;)
- X *temp++ = blank;
- X return(OK);
- X } /* wdeleteln */
- X
- X/****************************************************************/
- X/* Deleteln() deletes the line at the stdscr cursor, and the */
- X/* lines below it are shifted up, inserting a blank line at */
- X/* the bottom of stdscr. */
- X/****************************************************************/
- X
- Xint deleteln()
- X {
- X return(wdeleteln(stdscr));
- X } /* deleteln */
- X
- X/****************************************************************/
- X/* Mvdeleteln() moves the cursor to a new position in stdscr, */
- X/* then deletes the line at the window cursor, and the lines */
- X/* below it are shifted up, inserting a blank line at the bot- */
- X/* tom of stdscr. */
- X/****************************************************************/
- X
- Xint mvdeleteln(y,x)
- X int y;
- X int x;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return(ERR);
- X return(wdeleteln(stdscr));
- X } /* mvdeleteln */
- X
- X/****************************************************************/
- X/* Mvwdeleteln() moves the cursor to a new position in a win- */
- X/* dow, then deletes the line at the window cursor, and the */
- X/* lines below it are shifted up, inserting a blank line at */
- X/* the bottom of the window. */
- X/****************************************************************/
- X
- Xint mvwdeleteln(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if (wmove(win,y,x) == ERR)
- X return(ERR);
- X return(wdeleteln(win));
- X } /* mvwdeleteln */
- FRIDAY_NIGHT
- echo extracting - lineins.c
- sed 's/^X//' > lineins.c << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* Winsertln() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/****************************************************************/
- X/* Winsertln() inserts a blank line instead of the cursor line */
- X/* in window 'win' and pushes other lines down. */
- X/****************************************************************/
- X
- Xint winsertln(win)
- X WINDOW *win;
- X {
- X int *temp;
- X int *end;
- X short y;
- X static int blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X temp = win->_line[win->_regbottom];
- X for (y = win->_regbottom; y > win->_cury; y--)
- X {
- X win->_line[y] = win->_line[y-1];
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = win->_maxx;
- X } /* for */
- X win->_line[win->_cury] = temp;
- X for (end = &temp[win->_maxx]; temp <= end; temp++)
- X *temp = blank;
- X win->_minchng[win->_cury] = 0;
- X win->_maxchng[win->_cury] = win->_maxx;
- X return(OK);
- X } /* winsertln */
- X
- X/****************************************************************/
- X/* Insertln() inserts a blank line instead of the cursor line */
- X/* in stdscr and pushes other lines down. */
- X/****************************************************************/
- X
- Xint insertln()
- X {
- X return(winsertln(stdscr));
- X } /* insertln */
- X
- X/****************************************************************/
- X/* Mvinsertln() moves the stdscr cursor to a new positions, in- */
- X/* serts a blank line instead of the cursor line and pushes */
- X/* other lines down. */
- X/****************************************************************/
- X
- Xint mvinsert(y,x)
- X int y;
- X int x;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return(ERR);
- X return(winsertln(stdscr));
- X } /* mvinsert */
- X
- X/****************************************************************/
- X/* Mvinsertln() moves the cursor in window 'win' to a new posi- */
- X/* tions, inserts a blank line instead of the cursor line and */
- X/* pushes other lines down. */
- X/****************************************************************/
- X
- Xint mvwinsert(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if (wmove(win,y,x) == ERR)
- X return(ERR);
- X return(winsertln(win));
- X } /* mvwinsert */
- FRIDAY_NIGHT
- echo extracting - longname.c
- sed 's/^X//' > longname.c << 'FRIDAY_NIGHT'
- X/****************************************************************/
- X/* Longname() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/****************************************************************/
- X/* Longname() returns a pointer to a string describing the */
- X/* user terminal. */
- X/****************************************************************/
- X
- Xchar *longname()
- X {
- X return("IBM PC BIOS");
- X }/* longname */
- FRIDAY_NIGHT
- echo extracting - make.man
- sed 's/^X//' > make.man << 'FRIDAY_NIGHT'
- XMAKE(1) MS-DOS Programmer's Manual MAKE(1)
- X
- XNAME
- X make - maintain program groups
- X
- XSYNOPSIS
- X make [-f <makefile>] [-ainpqrst] [<target>...]
- X
- XDESCRIPTION
- X Make executes commands in makefile to update one or more target names. Name
- X is typically a program. If no -f option is present, `makefile' is tried. If
- X makefile is `-', the standard input is taken. More than one -f option may
- X appear
- X
- X Make updates a target if it depends on prerequisite files that have been
- X modified since the target was last modified, or if the target does not
- X exist.
- X
- X Makefile contains a sequence of entries that specify dependencies. The
- X first line of an entry is a blank-separated list of targets, then a colon,
- X then a list of prerequisite files. Text following a semicolon, and all
- X following lines that begin with a tab, are shell commands to be executed to
- X update the target. If a name appears on the left of more than one `colon'
- X line, then it depends on all of the names on the right of the colon on
- X those lines, but only one command sequence may be specified for it. If a
- X name appears on a line with a double colon :: then the command sequence
- X following that line is performed only if the name is out of date with
- X respect to the names to the right of the double colon, and is not affected
- X by other double colon lines on which that name may appear.
- X
- X Sharp and newline surround comments.
- X
- X The following makefile says that `pgm' depends on two files `a.obj' and
- X `b.obj', and that they in turn depend on `.c' files and a common file
- X `incl'.
- X
- X pgm: a.obj b.obj
- X cc a.obj b.obj -lm -o pgm
- X a.obj: incl a.c
- X cc -c a.c
- X b.obj: incl b.c
- X cc -c b.c
- X
- X Makefile entries of the form
- X
- X string1 = string2
- X
- X are macro definitions. Subsequent appearances of $(string1) or ${string1}
- X are replaced by string2. If string1 is a single character, the parentheses
- X or braces are optional.
- X
- X Make infers prerequisites for files for which makefile gives no construc-
- X tion commands. For example, a `.c' file may be inferred as prerequisite for
- X a `.obj' file and be compiled to produce the `.obj' file. Thus the prece-
- X ding example can be done more briefly:
- X
- X pgm: a.obj b.obj
- X cc a.obj b.obj -lm -o pgm
- X a.obj b.obj: incl
- X
- X Prerequisites are inferred according to selected suffixes listed as the
- X `prerequisites' for the special name `.SUFFIXES'; multiple lists accumu-
- X late; an empty list clears what came before. Order is significant; the
- X first possible name for which both a file and a rule as described in the
- X next paragraph exist is inferred. The default list is
- X
- X .SUFFIXES: .obj .asm .c
- X
- X The rule to create a file with suffix s2 that depends on a similarly named
- X file with suffix s1 is specified as an entry for the `target' s1s2. In
- X such an entry, the special macros
- X
- X $* stands for the target name with suffix deleted,
- X $@ for the full target name,
- X $< for the complete list of prerequisites,
- X $? for the list of prerequisites that are out of date.
- X
- X For example, a rule for making optimized `.obj' files from `.c' files is
- X
- X .c.obj: ; cc -c -O -o $@ $*.c
- X
- X Certain macros are used by the default inference rules to communicate op-
- X tional arguments to any resulting compilations. In particular, `CFLAGS' is
- X used for cc(1) options, and AFLAGS for masm options. In addition, the macro
- X `MFLAGS' is filled in with the initial command line options supplied to
- X make. This simplifies maintaining a hierarchy of makefiles as one may then
- X invoke make on makefiles in subdirectories and pass along useful options.
- X
- X Command lines are executed one at a time. First execution of the command
- X is attempted directly from make. If this fails, a secondary COMMAND.COM
- X processor is invoked to do the job. For commands executed by a secondary
- X COMMAND.COM processor, exit status may not be correct, which is a flaw in
- X MSDOS.
- X
- X A command line is printed when it is executed unless the special target
- X `.SILENT' is in makefile, or the first character of the command is `@'.
- X
- X Commands returning nonzero exit status cause make to terminate unless the
- X special target `.IGNORE' is in makefile or the command begins with the cha-
- X racter sequence <tab><hyphen>, or if the `-i' option was given.
- X
- X Interrupt and quit cause the target to be deleted unless the target is a
- X directory or depends on the special name `.PRECIOUS'.
- X
- XOPTION
- X -a Disregard date/time stamps, and perform all commands that would be
- X necessary to update the requested final target(s).
- X -f Use the next command line token for the makefile name. If this is '-'
- X then use standard input.
- X -i Equivalent to the special entry `.IGNORE:'. A single command may be
- X forced to behave this way by preceding it by '<tab>-'.
- X -n Trace and print, but do not execute the commands needed to update the
- X targets.
- X -p Print all macros and targets. Good for debugging your makefiles.
- X -q Causes make to return the up-to-date-ness of the target as exit
- X status.
- X -r Equivalent to an initial special entry `.SUFFIXES:' with no list. This
- X means that the built-in inference rules are not used.
- X -s Equivalent to the special entry `.SILENT:'. A single command may be
- X forced to behave this way by preceding it by '@'.
- X -t Touch, i.e. update the modified date of targets, without executing any
- X commands.
- X
- XFILES
- X makefile, command.com
- X
- XSEE ALSO
- X touch
- X
- XRESTRICTIONS
- X Some commands return nonzero status inappropriately. Use -i to overcome
- X the difficulty.
- X
- X If a command is executed by an invocation a secondary COMMAND.COM, and
- X ties to set environment variables, these settings will only affect the
- X environment of that secondary command processor. As soon asit terminates,
- X the settings are lost. Also, COMMAND.COM always return successful status,
- X even if it tries to execute a non-existen command. In general, the inten-
- X tion is that COMMAND.COM is only to be invoked to run simple commands as
- X COPY, TYPE, DEL and the like.
- FRIDAY_NIGHT
- echo pccurses.sh.2 completed!
-
-
-