📄 intro.3cur
字号:
gettmode(\|)#Establish current tty modesgetyx(win, y, x)#Get (y, x) coordinateshas_ic(\|)#True if terminal can do insert characterhas_il(\|)#True if terminal can do insert lineidlok(win, bf)#Use terminal's insert/delete line if bf != 0inch(\|)#Get character at current (y, x) coordinatesinitscr(\|)#Initialize screensinsch(c)#Insert a characterinsertln(\|)#Insert a lineintrflush(win, bf)#Interrupt flush output if bf is TRUEkeypad(win, bf)#Enable keypad inputkillchar(\|)#Return current user's kill characterleaveok(win, flag)#Leave cursor anywhere after refresh if#flag!=0 for \*w. Otherwise cursor must be left#at current positionlongname(\|)#Return verbose name of terminalmeta(win, flag)#Allow meta characters on input if flag != 0move(y, x)#Move to (y, x) on \*s.TE.PP.BNOTE:The following routines prefixed with .B mv require .PN yand .PN xcoordinates to move to, before performing the same functions as thestandard routines. As an example, .PN mvaddchperforms the same function as.PN addch, but .PN yand.PN xcoordinates must be supplied first. The routines prefixed with.B mvw also require a window or pad argument..PP.TS \-Htab (#);l l.mvaddch(y, x, ch)#mvaddstr(y, x, str)#mvcur(oldrow, oldcol, newrow,#low level cursor motionnewcol)#mvdelch(y, x)#mvgetch(y, x)#mvgetstr(y, x)#mvinch(y, x)#mvinsch(y, x, c)#mvprintw(y, x, fmt, args)mvscanw(y, x, fmt, args)mvwaddch(win, y, x, ch)mvwaddstr(win, y, x, str)mvwdelch(win, y, x)mvwgetch(win, y, x)mvwgetstr(win, y, x)mvwin(win, by, bx)mvwinch(win, y, x)mvwinsch(win, y, x, c)mvwprintw(win, y, x, fmt, args)mvwscanw(win, y, x, fmt, args)newpad(nlines, ncols)#Create a new pad with given dimensionsnewterm(type, fd)#T{Set up new terminal of given type to output on fdT}newwin(lines, cols,#Create a new windowbegin_y, begin_x)#nl(\|)#Set newline mappingnocbreak(\|)#Unset cbreak modenodelay(win, bf)#Enable nodelay input mode through \fHgetch\fPnoecho(\|)#Unset echo modenonl(\|)#Unset newline mappingnoraw(\|)#Unset raw modeoverlay(win1, win2)#Overlay win1 on win2overwrite(win1, win2)#Overwrite win1 on top of win2pnoutrefresh(pad, pminrow,#Like \fHprefresh\fP but with no outputpmincol, sminrow, smincol,#until \fHdoupdate\fP calledsmaxrow, smaxcol)#prefresh(pad, pminrow,#T{Refresh from pad starting with given upperT}pmincol, sminrow, smincol,#left corner of pad with output tosmaxrow, smaxcol)#given portion of screenprintw(fmt, arg1, arg2, ...)#\fHprintf\fP on \*sraw(\|)#Set raw moderefresh(\|)#Make current screen look like \*sresetterm(\|)#Set tty modes to ``out of curses'' stateresetty(\|)#Reset tty flags to stored valuesaveterm(\|)#T{Save current modes as ``in curses'' stateT}savetty(\|)#Store current tty flagsscanw(fmt, arg1, arg2, ...)#\fHscanf\fP through \*sscroll(win)#Scroll \*w one linescrollok(win, flag)#Allow terminal to scroll if flag != 0set_term(new)#Switch between different terminalssetscrreg(t, b)#T{Set user scrolling region to lines t through bT}setupterm(term, filenum, errret)#Low level terminal setupstandend(\|)#Clear standout mode attributestandout(\|)#Set standout mode attributesubwin(win, lines, cols,#Create a subwindowbegin_y, begin_x)#touchwin(win)#\*(lqchange\*(rq all of \*wtraceoff(\|)#Turn off debugging trace outputtraceon(\|)#Turn on debugging trace outputtypeahead(fd)#T{Use file descriptor fd to check typeaheadT}unctrl(ch)#Produce printable version of \fIch\fPwaddch(win, ch)#Add character to \*wwaddstr(win, str)#Add string to \*wwattroff(win, attrs)#Turn off attrs in \*wwattron(win, attrs)#Turn on attrs in \*wwattrset(win, attrs)#Set attrs in \*w to attrswclear(win)#Clear \*wwclrtobot(win)#Clear to bottom of \*wwclrtoeol(win)#Clear to end of line on \*wwdelch(win, c)#Delete char from \*wwdeleteln(win)#Delete line from \*wwerase(win)#Erase \*wwgetch(win)#Get a character through \*wwgetstr(win, str)#Get a string through \*wwinch(win)#Get character at current (y, x) in \*wwinsch(win, c)#Insert char into \*wwinsertln(win)#Insert line into \*wwmove(win, y, x)#Set current (y, x) coordinates on \*wwnoutrefresh(win)#Refresh but no screen outputwprintw(win, fmt,#\fHprintf\fP on \*warg1, arg2, ...)#wrefresh(win)#Make screen look like \*wwscanw(win, fmt,#\fHscanf\fP through \*warg1, arg2, ...)#wsetscrreg(win, t, b)#Set scrolling region of \*wwstandend(win)#Clear standout attribute in \*wwstandout(win)#Set standout attribute in \*w.TE.PP.B Caution.PP The plotting library.MS plot 3xand the .MS curses 3curlibrary both use the names .PN erase(\|)and .PN move(\|).The .PN cursesversions are macros.If you need both libraries, put the.MS plot 3xcode in a different source file to the.MS curses 3curcode, and/or .PN #undef .PN move(\|) and .PN erase(\|) in the.MS plot 3xcode..SH TERMINFO Level Routines.PPIf the environment variable \s-1TERMINFO\s+1 is defined, any programusing .PN curses will check for a local terminal definition beforechecking in the standard libraries.For example, if the standard place is .PN /usr/lib/terminfo, and \s-1TERM\s+1 isset to \fBvt100\fP, the compiled file will normally be found in.PN /usr/lib/terminfo/v/vt100 . The \fBv\fP is copied from the first letterof vt100 to avoid creating huge directories.However, if \s-1TERMINFO\s+1 is set to.PN /usr/mark/myterms, .PN curseswill first check.PN /usr/mark/myterms/v/vt100,and if that fails,will then check.PN /usr/lib/terminfo/v/vt100.This is useful for developing experimental definitions orwhen there is no write permission for.PN /usr/lib/terminfo ..PPThese routines should be called by programs that need to deal directlywith the .PN terminfodatabase, but as this isa low level interface, it is not recommended..PPInitially, the routine.PN setupterm should be called.This will define the set of terminal-dependent variables defined in.MS terminfo 5 .The include files .PN <cursesX.h> and .PN <term.h>should be included to get the definitionsfor these strings, numbers, and flags.Parameterized strings should be passed through.PN tparm to instantiate them.All terminfo strings (including the output of .PN tparm ) should be printed with.PN tputs or.PN putp .Before exiting,.PN resetterm should be called to restore the tty modes..PPPrograms which want shell escapes or .CT Zsuspending can call.PN resettermbefore the shell is called and.PN fixtermafter returning from the shell..DS.TStab(#);l l.fixterm(\|)#Restore tty modes for terminfo use#(called by setupterm)resetterm(\|)#Reset tty modes to state before program entrysetupterm(term, fd, rc)#Read in database. Terminal type is the#character string term, all output is to \s-1ULTRIX\s+1#System file descriptor fd. A status value is#returned in the integer pointed to by rc: 1#is normal. The simplest call would be#setupterm(0, 1, 0) which uses all defaultstparm(str, p1, p2, ..., p9)#Instantiate string str with parms p\di\u.sptputs(str, affcnt, putc)#Apply padding info to string str#affcnt is the number of lines affected,#or 1 if not applicable. Putc is a#putchar-like function to which the characters#are passed, one at a timeputp(str)#A function that calls tputs#(str, 1, putchar)vidputs(attrs, putc)#Output the string to put terminal in video#attribute mode attrs, which is any #combination of the attributes listed below#Chars are passed to putchar-like#function putc\fRvidattr(attrs)#Like vidputs but outputs through#putchar.TE.DE.SH Termcap Compatibility Routines.PPThe following routines were included as a conversion aid forprograms that use termcap.Their parameters are the same as for termcap.They are emulated using the .PN terminfodatabase..PPDO NOT use these routines in new programs..PP.TStab (#);l l.tgetent(bp, name)#Look up termcap entry for nametgetflag(id)#Get boolean entry for idtgetnum(id)#Get numeric entry for idtgetstr(id, area)#Get string entry for idtgoto(cap, col, row)#Apply parms to given captputs(cap, affcnt, fn)#Apply padding to cap calling fn as putchar.TE.PPAs an aid to compatibility, the object module.PN termcap.ohas been provided in .PN /usr/lib/termcap.o .This module should be linked into an applicationbefore resolving against the .PN curseslibrary.If your application contains references such as .PN UPthen recompile using.EX 0cc [\fIoptions\fP] \fIfiles\fP /usr/lib/termcap.o \-lcursesX [\fIlibs\fP].EE.SH ErrorsNo errors are defined for the .PN cursesfunctions..SH Return ValuesFor most .PN cursesroutines, the .PN OKvalue is returned if a routine is properly completed and the.PN ERRvalue is returned if some error occurs..SH See Alsotic(1), ioctl(2), getenv(3), printf(3s), putchar(3s), scanf(3s), plot(3x),termcap(5), terminfo(5) .br\fIGuide to X/Open curses Screen Handling\fP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -