900 Series HP 3000 Computer Systems MPE/iX Developer's Kit Reference Manual Volume 2 ABCDE HP Part No. 36430-90002 Printed in U.S.A. 1994 Second Edition E0494 FINAL TRIM SIZE : 7.0 in x 8.
UNIX is a registered trademark of UNIX System Laboratories Inc. in the U.S.A. and other countries. The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability or tness for a particular purpose.
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. Rights for non-DoD U.S. Government Departments and agencies are as set forth in FAR 52.227-19 (c) (1,2). Hewlett-Packard Company 3000 Hanover Street Palo Alto, CA 94304 U.S.A. Restricted Rights Legend FINAL TRIM SIZE : 7.0 in x 8.
Printing History The following table lists the printings of this document, together with the respective release dates for each edition. The software version indicates the version of the software product at the time that this document was issued. Many product releases do not require changes to the document; therefore, do not expect a one-to-one correspondence between product releases and document editions. Edition Date Software Version First Edition Second Edition October 1992 April 1994 A.00.00 C.50.
Preface MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest in a series of operating systems for the HP 3000 line of computers. In HP documentation and in talking with HP 3000 users, you will encounter references to MPE XL, the direct predecessor of MPE/iX. MPE/iX is a superset of MPE XL. All programs written for MPE XL will run without change under MPE/iX.
vi FINAL TRIM SIZE : 7.0 in x 8.
Conventions nonitalics Within syntax descriptions, nonitalicized words represent literals. Enter them exactly as shown. This includes angle brackets appearing within syntactic descriptions. For example, #include Nonitalicized words and punctuation characters appear in computer font.
Contents 1. Introduction 2. SVID IPC Library Function Descriptions What Is the SVID IPC Library? . . . . . . . . . . . . . What Is the TERMINFO Database? . . . . . . . . . . . What Is the CURSES Library? . . . . . . . . . . . . . . How to Use This Manual . . . . . . . . . . . . . . . . . Developing Applications Using the MPE/iX Shell and Utilities Understanding MPE/iX . . . . . . . . . . . . . . . . . Overview of SVID IPC . . . . . . . . . . . Message queues . . . . . . . . . . . . . . Shared memory . .
shmctl . . . . . . . . . . shmdt . . . . . . . . . . shmget . . . . . . . . . SVID IPC Header Descriptions sys/ipc.h . . . . . . . . . sys/msg.h . . . . . . . . sys/sem.h . . . . . . . . sys/shm.h . . . . . . . . 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-41 2-44 2-46 2-50 2-51 2-53 2-55 2-57 Introduction . . . . . . . . . . . . . . . TERMINFO Source File . . . . . . . . . .
home . . . . . . . . . . . . ri, ind . . . . . . . . . . . . mir . . . . . . . . . . . . . smcup, rmcup . . . . . . . . xt . . . . . . . . . . . . . . Edit Capabilities . . . . . . . . . Detailed Descriptions . . . . . . ich1 . . . . . . . . . . . . . in . . . . . . . . . . . . . . ip . . . . . . . . . . . . . . Attribute Capabilities . . . . . . . Handling Color . . . . . . . . . ncv Variable . . . . . . . . . Turning O Attributes . . . . . Setting Arbitrary Modes . . . . . Tabs and Margins . . . . . . . .
addch waddch mvaddch mvwaddch . . . . . . . . . addchstr waddchstr addchnstr waddchnstr mvaddchstr mvwaddchstr mvaddchnstr mvwaddchnstr . . . . . addstr waddstr addnstr waddnstr mvaddstr mvwaddstr mvaddnstr mvwaddnstr . . . . . . . . . . . . . attro wattro attron wattron attrset wattrset standend wstandend standout wstandout . . . . . . . . . baudrate . . . . . . . . . . . . . . . . . . . . . beep ash . . . . . . . . . . . . . . . . . . . . bkgdset wbkgdset bkgd wbkgd . . . . . . . . . . .
has color can change color color content pair content . . has ic has il . . . . . . . . . . . . . . . . . . . . . idlok . . . . . . . . . . . . . . . . . . . . . . . . immedok . . . . . . . . . . . . . . . . . . . . . . . inch winch mvinch mvwinch . . . . . . . . . . . . . . inchstr winchstr inchnstr winchnstr mvinchstr mvwinchstr mvinchnstr mvwinchnstr . . . . . . . . . . . . . . init color init pair . . . . . . . . . . . . . . . . . . initscr . . . . . . . . . . . . . . . . . . . . . . . .
raw noraw . . . . . . . . . . . . . . . . . . . . redrawwin wredrawln . . . . . . . . . . . . . . . refresh wrefresh doupdate wnoutrefresh . . . . . . . reset prog mode reset shell mode . . . . . . . . . resetty savetty . . . . . . . . . . . . . . . . . . scanw wscanw mvscanw mvwscanw vwscanw . . . . . scr dump scr restore . . . . . . . . . . . . . . . srcl wscrl scrol . . . . . . . . . . . . . . . . . . scrollok . . . . . . . . . . . . . . . . . . . . . set curterm . . . . . . . . . . . . . . . . . . .
Tables 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 3-7. 3-8. 3-9. 3-10. 3-11. 3-12. 3-13. 3-14. 3-15. 3-16. 3-17. 3-18. 3-19. 3-20. 3-21. 3-22. 4-1. 4-2. 4-3. 4-4. 4-5. 4-6. 4-7. 4-8. Su xes for Mode and User Preferences . . Syntax of Padding Speci cations . . . . . Explanation of Parameter Description . . . hp2392a Terminal Cursor Movement . . . ANSI Terminal Cursor Movement . . . . . Characters with Special Values . . . . . . Boolean Capabilities . . . . . . . . . . Numeric Capabilities . . . . . . . . . .
1 Introduction This chapter provides a summary overview of supplemental libraries and facilities that are available through the MPE/iX Developer's Kit (product # 36430A). The POSIX/iX library, also available through the MPE/iX Developer's Kit, is fully described in the MPE/iX Developer's Kit Reference Manual Volume 1 (36430-90001). The following topics are discussed in this chapter: What is the SVID IPC library? What is the TERMINFO database? What is Curses? How to use this manual.
What Is the TERMINFO Database? The TERMINFO database describes terminal and printer capabilities. A wide range of capabilities can be de ned that include, for example, the number of lines and columns for the device, whether or not the terminal wraps at the right margin, or what character sequence causes a carriage return. The database is used by screen-oriented programs such as VI or CURSES programs.
How to Use This Manual This manual is intended to be used with the following four manuals: MPE/iX Developer's Kit Reference Manual Volume 1 (36430-90001) HP C/iX Library Reference Manual (30026-90001) MPE/iX Shell and Utilities Reference Manual, Volumes 1 and 2 (36431-60001) The POSIX.1 Standard - A Programmer's Guide (36430-90003) The four manuals listed above contain descriptions of C library functions available through the POSIX/iX library provided with the MPE/iX Developer's Kit.
:RUN SH.HPBIN.SYS;INFO="-L" :SH.HPBIN.SYS -L Note The L must be entered in uppercase. For more information about the MPE/iX Shell and Utilities, refer to the following manuals: MPE/iX Shell and Utilities Reference Manual, Volumes 1 and 2 (36431-60001) MPE/iX Shell and Utilities User's Guide (36431-90002) Compiling and linking an application that requires libraries available through the MPE/iX Developer's Kit must be accomplished through the c89 command available in the MPE/iX Shell.
2 SVID IPC Library Function Descriptions This chapter describes a set of C/iX library functions that provides interprocess communication services to applications requiring information exchange and resource synchronization between multiple processes. These C/iX library functions emulate the behavior of a set of interprocess communication and synchronization functions de ned by the AT&T System V Interface De nition (SVID2).
The SVID IPC library provides three facilities and an access control feature: Message queues Shared memory Semaphores Access control For each of the three SVID IPC facilities there are C/iX library functions available for allocation, deallocation, and control of the facilities. Use an xxx get() function to either create a resource of the desired type (for example, a shared memory area) or obtain an identi er for an existing resource.
Shared memory The shared memory facility allows processes to communicate via a common memory area mapped to the address space of each process sharing the memory. When a process modi es the contents of a shared memory area, the data is immediately available to other processes. The most common usage of this facility is to allocate application global data needed by all processes sharing the memory area.
Access control Access control is provided through a key value, known to the application using SVID IPC functions, that is associated with each resource being shared by multiple processes. This key is used by di erent processes who have agreed to manage access to the resource using the shared key. All SVID IPC facilities require the user to supply a key to be used by the msgget(), semget(), and shmget() functions to obtain identi ers.
Managing SVID IPC Services Interactive utilities are provided through the MPE/iX Command Interpretor to manage the interprocess communication services provided by SVID IPC functions. These utilities are implemented as MPE/iX command les and located in HPBIN.SYS. Each utility provides a built-in help facility that contains detailed information on use.
Conformance and Implementation Considerations The MPE/iX SVID IPC library was implemented to emulate the behavior of the equivalent SVID-conformant IPC functionality available on the Series 800 HP 9000 computer system. Please read the \Implementation Considerations" section of each function description prior to using the function in order to understand any implementation-de ned behavior or behavior that does not conform to the de nition of the function in the AT&T System V Interface De nition .
ftok ftok Returns a key used in calls to msgget(), semget(), and shmget() function calls. Syntax #include #include key_t ftok (char *pathname, char id); Parameters pathname id Passes a pointer to a string containing the pathname of a le accessible to the calling process. Passes a character used to further qualify the returned key. Return Values 6=-1 -1 Key value returned. Error. The speci ed pathname does not exist or is not accessible to the calling process.
ftok Implementation Considerations None. Errors If an error occurs, errno is set to the following value. EINVAL The pathname parameter points to an invalid address, or pathname speci es a nonexistent le, or the caller does not have the correct access to the pathname. Make sure that pathname points to a valid and existing pathname to which the caller has access. CAUSE ACTION See Also msgget(), semget(), shmget() 2-8 SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
msgctl msgctl Provides message control operations. Syntax #include #include #include int msgctl (int msqid, int cmd, struct msqid_ds *bu er); Parameters msqid cmd bu er Passes a message queue identi er returned by a call to msgget(). Passes a command de ning the control operation to perform. Valid commands are de ned in the \Description" section below. Passes a pointer to a bu er of type struct msqid_ds (de ned in the header).
msgctl IPC_SET the value of either the msg_perm.uid (owner) or msg_perm.cuid (creator) elds in the data structure associated with msqid ). Copy data from the following elds of the msqid_ds structure pointed to by bu er to the corresponding elds in the data structure associated with msqid : msg_perm.uid (owner user ID) msg_perm.gid (owner group ID) Low order 9 bits of msg_perm.
msgctl Errors If an error occurs, errno is set to one of the following values. EACCES CAUSE ACTION EFAULT CAUSE EINVAL ACTION CAUSE ACTION EPERM CAUSE cmd speci es IPC_STAT and the calling process does not have read permission. Ensure that the calling process has read permission for the msqid . The system detected a NULL or bad address in attempting to use the bu er argument. Check to see if the pointer is correctly initialized.
msgget Returns a message queue identi er. Syntax #include #include #include int msgget (key_t key, int msg g); Parameters key msg g 2-12 Either a user-de ned key value to rendezvous with the message queue, or IPC_PRIVATE. If IPC_PRIVATE is speci ed, a new message queue is created, but other processes cannot rendezvous by key .
msgget Return Values >0 -1 Success. A message queue identi er is returned. An error occurred, and errno is set to indicate the error condition. Description The msgget() function returns a message queue identi er associated with the value passed in key . A new message queue identi er is allocated and a message queue and data structure are associated with it if: The value passed in key is equal to IPC_PRIVATE.
msgget The maximum number of bytes on a message queue The total number of message queues allowed system wide Refer to the section \Managing SVID IPC Services" for more information. Errors If an error occurs, errno is set to one of the following values. A message queue identi er exists for key and the calling process does not have permission (speci ed by the low-order 9 bits of msg g ).
msgrcv msgrcv Reads a message from a message queue. Syntax #include #include #include int msgrcv (int msqid, void *msgp, int msgsz, long msgtyp, int msg g); Parameters msqid msgp Passes message queue identi er returned by a call to msgget(). Passes a pointer to a bu er whose structure is similar to the msgbuf example template located in
msgrcv >0 msg g Read the rst message on the queue whose type equals msgtyp . <0 Read a message from the queue whose type is the lowest type of all messages in that queue that is less than or equal to the absolute value of msgtyp . Passes a value de ning what action to take if either a message speci ed by msgtyp is not found on the message queue or the message is too large to t in the bu er. Flags are: IPC_NOWAIT The calling process is not suspended. Control returns immediately with errno set to ENOMSG.
msgrcv If the calling process is suspended waiting for a message, the following conditions will cause msgrcv() to return an error and set errno to indicate the error condition. The message queue speci ed by msqid is removed from the system The calling process receives a signal that is to be caught.
msgrcv msgsz is less than the size of the message and msg g does not CAUSE E2BIG specify MSG_NOERROR. Increase the msgsz parameter and associated bu er space, or specify the MSG_NOERROR option to allow truncation of the received message. The calling process does not have permission. Ensure that the calling process has read access for the message queue. The system detected a NULL or bad address in attempting to use the msgp argument. Check to see if the pointer is correctly initialized.
msgsnd msgsnd Sends a message to a message queue. Syntax #include #include #include int msgsnd (int msqid, void *msgp, int msgsz, int msg g); Parameters msqid msgp Passes a message queue identi er returned by a call to msgget(). Passes a pointer to a bu er whose structure is similar to the msgbuf example template located in
msgsnd data on this queue would exceed the system-de ned limit, or the system-wide message bu er pool is temporarily depleted due to the amount of data queued to all message queues. Flags are: The calling process is not suspended. Control returns immediately with errno set to EAGAIN. IPC_NOWAIT If msg g does not specify IPC_NOWAIT and one of the previous conditions would occur, the calling process suspends execution.
msgsnd Implementation Considerations If a process suspended during execution of msgsnd() receives a signal, control returns to the user with errno set to EINTR. Disabled signals are ignored. Errors If an error occurs, errno is set to one of the following values. EACCES CAUSE ACTION EAGAIN CAUSE ACTION EFAULT CAUSE EIDRM ACTION CAUSE EINTR ACTION CAUSE ACTION The calling process does not have permission. Ensure that the calling process has write permission for the message queue.
msgsnd msqid is not a valid message queue identi er, or msgsz is less CAUSE EINVAL than 0 or greater than the system-de ned limit, or mtype is less than 0. Check the parameters to make sure the msqid is valid and has not been removed from the system, and that the msgsz and mtype are within valid ranges. An operating system error occurred that does not map directly to any of the above errors. Examine the MPE/iX process error stack for the type of system error.
semctl semctl Provides semaphore control operations. Syntax #include #include #include int semctl (int semid, int semnum, int cmd, semun semarg); Parameters semid semnum cmd semarg Passes a semaphore identi er returned by a call to semget(). Passes a value indicating a particular semaphore in the semaphore set certain commands speci ed in cmd will apply to, if applicable. Passes a command de ning the control operation to perform.
semctl Return Values >=0 Success. The value returned depends on the command passed in cmd . Refer to the list below of possible return values and their meanings. An error occurred, and errno is set to indicate the error condition. -1 Upon successful completion, the semctl() function returns one of the following values depending on the command passed in cmd : Command Return Value GETVAL The semaphore value of the semaphore speci ed by semid and semnum .
semctl IPC_SET IPC_STAT GETVAL SETVAL GETPID GETNCNT GETZCNT Copy data from the following elds of the semid_ds structure (de ned in the header) pointed to by semarg.buf to the corresponding elds in the data structure associated with semid : sem_perm.uid (owner user ID) sem_perm.gid (owner group ID) Low order 9 bits of sem_perm.mode The calling process must have either MPE/iX SM capability or an e ective user ID equal to the value of either the sem_perm.uid or sem_perm.
semctl GETALL SETALL Copy the semaphore values of all semaphores associated with semid to the array pointed to by semarg.array . The calling process must have read permission. Set the semaphore values of all semaphores to the values speci ed in the array pointed to by arg.array (must be >=0). This command clears in all processes the semaphore adjust value corresponding to the speci ed semaphore. The calling process must have write permission. Implementation Considerations None.
semctl EACCES CAUSE ACTION EFAULT CAUSE ACTION EINVAL CAUSE ACTION EPERM CAUSE ACTION ERANGE CAUSE ACTION ESYSERR CAUSE ACTION The calling process does not have permission. Ensure that the process has the required permissions to perform the speci ed cmd . The system detected a NULL or bad address in attempting to use either the semarg.buf or semarg.array arguments. Check the semarg parameter and make sure it is properly de ned.
semget Returns a semaphore identi er. Syntax #include #include #include int semget (key_t key, int nsems, int sem g); Parameters key nsems sem g 2-28 Either a user-de ned key value to rendezvous with the semaphore set, or IPC_PRIVATE. If IPC_PRIVATE is speci ed, a new semaphore set is created, but other processes cannot rendezvous by key . Refer to the description of ftok() for details about obtaining user-de ned key values The number of semaphores in the set.
semget Return Values >=0 -1 Success. A semaphore identi er is returned. An error occurred, and errno is set to indicate the error condition. Description The semget() function returns a semaphore identi er associated with the value passed in key . A semaphore identi er and the associated data structure and semaphore set containing nsems semaphores are created for key if one of the following conditions is true: The value passed in key is equal to IPC_PRIVATE.
semget The maximum number of semaphore sets allowed system wide The maximum number of semaphore operations allowed per semop() call Refer to the section \Managing SVID IPC Services" for more information. Errors If an error occurs, errno is set to one of the following values. EACCES A semaphore identi er exists for key and the calling process does not have permission (speci ed by the low-order 9 bits of sem g ).
semget ESYSERR CAUSE ACTION An operating system error occurred that does not map directly to any of the above errors. Examine the MPE/iX process error stack for the type of system error. See Also semctl(), semop(), SVID2 (Section 12) SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
semop Performs operations on a set of semaphores. Syntax #include #include #include int semop (int semid, struct sembuf *sops, int nsops); Parameters semid sops nsops Passes a semaphore identi er returned by a semget() call. Passes a pointer to an array of semaphore operation structures where each element is of type struct sembuf (de ned in the header). Semaphore operation structures de ne operations to perform on the semaphore set.
semop operation is further de ned by the sem_flg eld. No semaphore operations are performed until blocking conditions on all of the semaphores speci ed in the array are removed.
semop If the value of sem_op is equal to 0 and the calling process has read permission, one of the following operations occurs depending upon the current semaphore value and the value of sem_flag: Operations when Semaphore Value sem_flag Value sem_op=0 Operation 0 Any value semop() executes the next semaphore operation in the array <>0 IPC_NOWAIT semop() returns -1, sets errno to EAGAIN , and returns control to the calling process.
semop If the value of sem_op is greater than 0 and the calling process has write permission, one of the following operations occurs depending upon the current semaphore value and the value of sem_flag. Operations when Semaphore Value sem_op>0 Operation sem_flag Value Any value SEM_UNDO not A new semaphore value is calculated as the result of adding the value of sem_op to the current semaphore value of the speci ed semaphore. The call to semop() returns successfully to the calling process.
semop An MPE/iX system manager can use the MPE/iX SVIPC utility to interactively con gure: the maximum semaphore value the maximum semaphore adjust value the maximum nsops value The maximum sem_op value Refer to the section \Managing SVID IPC Services" for more information. Errors If an error occurs, errno is set to one of the following values. E2BIG CAUSE ACTION EACCES CAUSE ACTION EAGAIN CAUSE EFAULT ACTION CAUSE nsops speci es a value greater than the system-de ned limit.
semop EIDRM EINTR EINVAL CAUSE ACTION CAUSE ACTION CAUSE ACTION ENOSPC CAUSE ACTION ERANGE CAUSE ESYSERR ACTION CAUSE ACTION The semaphore set speci ed by semid was removed while semop() was suspended on a semaphore operation. None. semget() was interrupted by a signal. None. Application dependent. semid is not a valid semaphore identi er, or the calling process requested a SEM_UNDO for a number of semaphores that would exceed the system-de ned limit.
shmat Attaches the calling process to a shared memory area. Syntax #include #include #include char *shmat (int shmid, char *shmaddr, int shm g); Parameters shmid shmaddr shm g Passes a shared memory identi er returned by a shmget() call. Passes either 0 or a valid memory address. Set shmaddr to zero to attach a shared memory area to the address space of the calling process.
shmat current attach address of the area. The area is attached for both reading and writing. Implementation Considerations The MPE/iX implementation of SVID IPC shared memory emulates the equivalent functionality on a Series 800 HP9000 computer system. A process cannot attach to the same shmid multiple times. The address must be the same in all processes. Specifying a di erent address results in an error. When attaching to a shared memory area for the rst time, shmaddr must be set to zero.
shmat Errors If an error occurs, errno is set to one of the following values. CAUSE EACCES The calling process does not have permission, or SHM_RND was speci ed. Ensure that the calling process has permission to access the area as requested, or do not specify the SHM_RND and SHMLBA ags. shmid is not a valid shared memory identi er, or shmaddr is not zero and not equal to the current attach location for the shared memory area, or the calling process is already attached to the shared memory area.
shmctl shmctl Performs control operations on a shared memory area. Syntax #include #include #include int shmctl (int shmid, int cmd, struct shmid_ds *bu er); Parameters shmid cmd bu er Passes a shared memory identi er returned by a call to shmget(). Passes a command de ning the control operation to perform. Valid control codes are de ned in the \Description" section below. Passes a pointer to a bu er of type struct shmid_ds (de ned in the header).
shmctl area is marked removed. The area is purged only when the last attached process detaches from it. IPC_SET IPC_STAT The calling process must have either MPE/iX SM capability or be the owner or creator of the shared memory area (have an e ective user ID equal to the value of either the shm_perm.uid (owner) or shm_perm.cuid (creator) elds in the data structure associated with shmid ).
shmctl EACCES CAUSE ACTION EFAULT CAUSE EINVAL ACTION CAUSE ACTION ENOMEM CAUSE EPERM ACTION CAUSE ACTION ESYSERR CAUSE ACTION cmd is set to IPC_STAT and the calling process does not have read permission. Ensure that the calling process has read permission to the shared memory area. The system detected a NULL or bad address in attempting to use the bu er argument. Check to see if the pointer is properly initialized.
shmdt Detaches a process from a shared memory area. Syntax #include #include #include int shmdt (char *shmaddr); Parameters shmaddr Passes the address of the shared memory area (returned from a call to shmat()). Return Values 0 -1 Success. An error occurred, and errno is set to indicate the error condition. Description The shmdt() function detaches a shared memory area from the calling process's data area.
shmdt Errors If an error occurs, errno is set to one of the following values. EINVAL CAUSE ACTION ESYSERR CAUSE ACTION shmaddr is not the data area start address of a shared memory area. Check to see that shmaddr is equal to the value returned by a previous shmat() call. An operating system error occurred that does not map directly to any of the above errors. Examine the MPE/iX process error stack for the type of system error.
shmget Returns a shared memory identi er. Syntax #include #include #include int shmget (key_t key, int size, int shm g); Parameters key size shm g 2-46 Passes either a user-de ned key value to rendezvous with the shared memory area, or IPC_PRIVATE. If IPC_PRIVATE is speci ed, a new shared memory area is created, but other processes cannot rendezvous by key .
shmget SHM_NO_PID SHM_PRIV_ACCESS mask found in le entries). They de ne access permissions for the owner, the group, and other users on the system. Allocate a shared memory area without PID protection. (Refer to \Implementation Considerations" for more information about using this ag.) Allocate a shared memory area accessible only to a calling process that has MPE/iX user privileged mode (PM). (Refer to \Implementation Considerations" for more information about using this ag.
shmget shm_segsz msg_qnum shm_lpid shm_nattch shm_atime shm_dtime shm_ctime Value passed in size Zero Zero Zero Zero Zero Current time Implementation Considerations The maximum shared memory area size is 256 megabytes. On MPE/iX, two ags, SHM_NO_PID and SHM_PRIV_ACCESS are available to the shmget() function that are not de ned by SVID. (Refer to the description of shm g above.) The SHM_NO_PID and SHM_PRIV_ACCESS ags are available only on 900 Series HP 3000 computer systems.
shmget EACCES CAUSE ACTION EEXIST CAUSE ACTION EINVAL CAUSE ACTION ENOENT CAUSE ACTION ENOMEM CAUSE ACTION ENOSPC CAUSE ACTION ESYSERR CAUSE ACTION A shared memory identi er exists for key but the calling process does not have permission (as speci ed by the low-order 9 bits of shm g ). Ensure that the calling process has appropriate permissions to obtain access to the existing shared memory identi er. A shared memory identi er exists for key and shm g speci es both IPC_CREATE and IPC_EXCL .
SVID IPC Header Descriptions Headers required by SVID IPC provide MACRO, type, and structure de nitions, as well as function prototypes. SVID IPC headers are located under the to be provided directory. In addition, the header, described in the MPE/iX Developer's Kit Reference Manual (36430-90001), de nes additional features required by SVID IPC. The following headers are required by SVID IPC:
sys/ipc.h sys/ipc.
sys/ipc.h Structures Common IPC access structure: struct ipc_perm { uid_t gid_t uid_t gid_t long long key_t uid; gid; cuid; cgid; mode; seq; key; /* /* /* /* /* /* /* owner's user id */ owner's group id */ creator's user id */ creator's group id */ access modes */ slot usage sequence number*/ key */ }; 2-52 SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sys/msg.h sys/msg.
sys/msg.h time_t time_t msg_rtime; msg_ctime; /* last msgrcv time /* last change time */ */ }; Message bu er template structure: struct msgbuf { long char mtype; mtext[1]; /*This is a sample template only */ /* message type /* message text */ */ }; 2-54 SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sys/sem.h sys/sem.
sys/sem.h }; Semaphore semop array element template structure: struct sembuf { int int long sem_num; sem_op; sem_flg; /* semaphore # /* semaphore operation /* operation flags }; 2-56 SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sys/shm.h sys/shm.
sys/shm.h pid_t int int time_t time_t time_t shm_cpid; shm_nattch; shm_cnattch; shm_atime; shm_dtime; shm_ctime; /* /* /* /* /* /* void }; *shm_ptr; /* pointer to the shm area. 2-58 pid of last change attached users in memory attached users ?? last shmat time last shmdt time last change time SVID IPC Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
3 TERMINFO Database Introduction The TERMINFO database describes terminal and printer capabilities. A wide range of capabilities can be de ned that include, for example, the number of lines and columns for the device, whether or not the terminal wraps at the right margin, or what character sequence causes a carriage return. The database is used by screen-oriented programs such as VI or CURSES programs.
TERMINFO Source File One or more devices are described in a TERMINFO source le. This section describes the contents of the source le. Syntax of Device Descriptions Each device entry in the TERMINFO source le has the following format: alias1 | alias2 | ... | aliasn | fullname, capability1, capability2, . . . capabilityn, The rst line in the device description is called the header; it must start in column one of the le.
Table 3-1. Suffixes for Mode and User Preferences Su x Meaning -am Auto margins (usually the default) -na No arrow keys (leave in local mode) -nam No auto margins -w Wide mode (more than 80 columns) -rv Reverse video -n Number of lines on the screen -n p Number of pages of memory After the header come the descriptions of the capabilities, separated by commas (white space after the comma is ignored). Each line after the header is indented one or more spaces or tabs.
The terminal in the previous example beeps the terminal when sent a ^G sequence, performs a carriage return when sent a return character, moves the cursor down a line when sent a newline character, and scrolls forward from the bottom line of the screen when sent a newline character. (Control characters are entered in the device description as a caret (^), followed by a letter, as opposed to entered as the actual control character.
Parameterized Strings Strings that require run-time parameters are described using printf-like escapes (%x). Calculations are done on a stack using Reverse Polish Notation. Parameters are pushed onto the stack, manipulated in some way, and a result is output. The left-most operators are pushed rst; for example, to subtract 10 from the rst parameter, you would use: %p1%{10}%-.
Stack Operators The stack operators are de ned as follows: Outputs the % character. %char Pop and print character on top of stack. %[ [:]flags] Pop the topmost value and output as [field_width[.precision] ] [doxXs] speci ed by the printf-like format. Flags are [- + #] and space. %% Note When using the- ag with %[doxXs], a colon (:), must be put between the % and- to distinguish the ag from the binary %operator, for example, %:-16.16s.
For ANSI terminals, increment rst parameter by one, if one parameter present, or increment rst two parameters by one, if more than one parameter present. Execute thenpart if expr is TRUE; otherwise execute elsepart (elsepart is optional). Else-if's are possible: %i %? expr %t thenpart %e elsepart %; %? c1 %t b1 %e c2 %t b2 %e c3 %t b3, %e c4 %t b4 %e b5 %; where ci are conditions and bi are bodies.
Table 3-5. ANSI Terminal Cursor Movement Expression Meaning \E[ Send ^[[ %i Increment the rst and second parameter by one %p1 Push the rst parameter onto the stack %d Print top of stack as a decimal number ; Send character ; %p2 Push the second parameter onto the stack %d Print top of stack as decimal number H Send character H Creating Device Descriptions The easiest way to create a new entry for a device is to nd one that is similar, modify it, and compile it using the tic utility.
am@, use=vt100, A crude test for getting the right amount of padding for insert-line (if not documented) is to comment out xon, edit a large le at 9600 baud with VI, delete 16 or so lines from the middle of the screen, and press the 4u5 key several times quickly. If the display becomes corrupted, insert-line requires more padding. Special Characters Table 3-6 summarizes all the special characters sequences discussed to this point. TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Table 3-6. Characters with Special Values Character 3-10 Meaning , Separates capabilities # Precedes integer value in numeric capabilities = Separates string capability name from string sequence @ Cancels capability # At the beginning of line, comments out the line .
Table 3-6.
Boolean Capabilities Table 3-7 lists the Boolean capabilities. Table 3-7.
Table 3-7.
Table 3-8.
Table 3-8.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-9.
Table 3-10.
Table 3-10.
Detailed Descriptions More detailed descriptions are provided below for the following capabilities: cmdch da, db gn if, iprog, is1, is2, is3 lm xenl os, hc ascs Some terminals, such as the Tektronix 4025, have a control character that can be set. The cmdch string describes a \dummy" control character to be used in all capabilities. Some UNIX systems support the convention of using the value of the environment variable CC in place of the dummy control character. cmdch.
The lm capability is used if the terminal has more lines of memory than can be displayed on the screen simultaneously; a value of zero means that the number of lines is not xed but that number is still more than can t on the screen. lm. xenl. In addition to terminals that ignore a linefeed, xenl should be speci ed for terminals that do not immediately wrap when a character is read to the right-most column of the screen but wait until another character has been received (the VT100, for example). os, hc.
Table 3-11. Glyph to Character Mapping (continued) Glyph Name Character checker board (stipple) a degree symbol f plus/minus g board of squares h lower right corner j upper right corner k upper left corner l lower left corner m plus n scan line 1 o horizontal line q scan line 9 s TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Table 3-11. Glyph to Character Mapping (continued) Glyph Name Character left tee (|-) t right tee (-|) u bottom tee () v top tee (T) w vertical line x bullet ~ The characters are described in pairs, with the de ning character for the glyph followed by the corresponding character on the device.
Table 3-12.
Table 3-12.
selectable automatic margins, am should be speci ed in the TERMINFO le, and initialization strings should turn on this option. cufl. The local cursor movements should not change the text that they pass over; for example, you would not use cufl=\s because the space would erase the character that it passed over. csr. The cursor position is unde ned after using csr.
into the device for cursor addressing to work properly. Terminals, such as the Tektronix 4025, that have programmable command characters need to set the command character to the one used in TERMINFO. The smcup and rmcup strings start and end programs that use cursor movement.
Table 3-13.
Table 3-13. Editing Capabilities (continued) Capability Variable Description ip= insert_padding Insert pad after character inserted rmdc= exit_delete_mode End delete mode rmir= exit_insert_mode End insert mode rmp= char_padding Like ip, but when in replace mode smdc= enter_delete_mode Delete mode (enter) smir= enter_insert_mode Insert mode (enter) Detailed Descriptions More detailed descriptions are provided below for the following capabilities: ich1 in ip ich1.
Attribute Capabilities Table 3-14 lists the capabilities used to control attributes on the terminal. For example, attribute capabilities include those to manipulate bold, underline, and color. Table 3-14.
Table 3-14.
Some color terminals replace video attributes with colors. Since these attributes should not be combined with colors, they need to be identi ed. Information about these attributes are packed into the ncv variable. The nine least signi cant bits of the ncv variable correspond to the video attributes as shown in Table 3-15. ncv Variable. Table 3-15.
Programs using standout mode should exit standout mode (rmso) before sending a newline or moving the cursor unless the msgr capability is present. (The msgr capability speci es that it's safe to move in standout mode.) Setting Arbitrary Modes The sgr string describes the sequence to set arbitrary combinations of modes. The sgr string takes nine parameters in the following order: 1. standout 2. underline 3. reverse 4. blink 5. dim 6. bold 7. blank 8. protect 9.
Table 3-16. sgr Parameters tparm Attribute none p1 standout p2 underline p3 reverse p4 blink p5 dim p6 bold p7 invis p8 protect p9 altcharset TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Tabs and Margins Table 3-17 lists the capabilities used to control margins and tabs on the terminal. Table 3-17.
The it string is normally used by tputs init to determine whether to set the mode for hardware expansion and whether to set the tabs. TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Terminal Key Capabilities Table 3-18 lists the capabilities used to describe keys on the terminal. 3-50 TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Table 3-18.
Refer back to Table 3-9 for a complete list of all the key capabilities. Note Key capabilities describe keypads that transmit sequences of characters when keys are pressed. Keypads that work only in local mode cannot be described. The keypad is assumed to always transmit; if the transmit of keys can be turned on or o , this should be speci ed with smkx and rmkx, respectively. If the rst 11 function keys have labels other than the default f0 through f10, they can be described using lf0 through lf10.
Table 3-19.
The fsl string must leave the cursor in the same position as it was before tsl. If necessary, this can be done by including sc and rc in thefsl and tsl strings. The wind string de nes a window that all commands a ect as part of memory. It takes four arguments: starting lines in memory, ending lines in memory, starting columns in memory, and ending columns in memory.
Boolean Capabilities Table 3-20 lists the Boolean capabilities. Table 3-20.
Table 3-20.
Numeric Capabilities Table 3-21 lists the numeric capabilities. Table 3-21.
Table 3-21. Numeric Capabilities (continued) Variable TInfo TCap Description lines_of_memory lm lm Lines of memory if > 0; 0 means un xed magic_cookie_glitch xmc sg Number of blank chars left by smso or rmso max_colors colors Co Maximum number of colors on the screen max_micro_address maddr Yd Maximum value in micro . . . address max_micro_jump mjump Ye Maximum value in parm . . .
String Capabilities Table 3-22 lists the string capabilities. TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
Table 3-22.
[0] The rst six items in the le make up the header. The header consists of six short integers, stored using VAX/PDP style byte swapping (least-signi cant byte rst). The integers are as follows: 1. magic number (octal 0432) 2. the size, in bytes, of the names section 3. the number of bytes in the Boolean section 4.
The setupterm() routine may expect a di erent set of capabilities than appears in the le. Unexpected or missing entries may result when the database has been updated since the CURSES library was last compiled, or when the program is recompiled more recently than the database. Note The rst of the following two examples shows a terminfo le for a dumb terminal; the second example shows an octal dump of the TERM le.
Implementation Considerations Identical to UNIX System V Portability UNIX System V TERMINFO Database FINAL TRIM SIZE : 7.0 in x 8.
4 CURSES The CURSES screen management package consists of routines and macros for creating and modifying input and output to a terminal screen. CURSES contains routines for creating windows, highlighting text, writing to the screen, reading from user input, and moving the cursor. The CURSES package is designed to optimize screen update activities. For example, when updating the screen, CURSES minimizes the number of characters sent to the terminal to move and update the screen.
Environment Variables The following three environment variables are useful, and can be set in the MPE/iX shell: TERMINFO COLUMNS LINES Refer to the MPE/iX Shell and Utilities User's Guide (36431-90002) for more information on the MPE/iX shell. TERMINFO Environment Variable If you have an alternate Terminfo database containing terminal types that are not available in the system default database /usr/lib/terminfo, you can specify the TERMINFO environment variable to point to this alternate database.
The number of columns may be set to a number smaller than the screen size; however, if set larger than the screen or window width, the results are unde ned. Currently, the largest screen width possible is 132 columns. The value set using the COLUMNS environment variable takes precedence over the value normally used for the terminal. LINES Environment Variable The LINES environment variable is used to set the window height.
The routines shown in the following table are stubs for the older TERMCAP interface and should be replaced by their newer TERMINFO counterparts.
Global Variables The global variables de ned for CURSES are shown in Table 4-1. Table 4-1.
Implementation Considerations The curscr, sdscr, COLS, and LINES constants are identical to XPG/3. The COLORS, COLOR_PAIRS, boolcodes[], boolfnames[], boolnames[], numcodes[], numfnames[], numnames[], strcodes[], strfnames[], and strnames[] constants are UNIX System V implementations. Portability The COLORS, COLOR_PAIRS, boolcodes[ ], boolfnames[ ], boolnames[ ], numcodes[ ], numfnames[ ], numnames[ ], strcodes[ ], strfnames[ ], and strnames[ ] constants conform to UNIX System V.
addch addch waddch mvaddch mvwaddch The addch set of routines is used to add a character (with attributes) to a window. Syntax int int int int addch(chtype ch); waddch(WINDOW *win, chtype ch); mvaddch(int y, int x, chtype ch); mvwaddch(WINDOW *win, int y, int x, chtype ch); Parameters ch win x y The character/attribute pair to be written to the window. A pointer to the window in which the character is to be written. The x (column) coordinate of the character's position in the window.
addch Description A window is made up of foreground and background attributes. All characters except space are part of the foreground. The character and its attributes make up a character/attribute pair de ned as a chtype. The character is any 16-bit value; the attribute consists of highlighting attributes that a ect the appearance of the character on the screen (for example, bold, underline).
addch the last character position on a line, a newline is generated automatically. If the character is written to the last character position of a scrolling region and scrollok() is enabled, the scrolling region is scrolled up one line (see wsetscrreg()). Individual characters can be highlighted by performing a bitwise OR operation between the character and one or more of the constants shown in Table 4-2. Table 4-2.
addch Table 4-3.
addch Note The addch(), mvaddch(), and mvwaddch() routines are macros. Implementation Considerations Identical to XPG/3. See Also winsch(), nl(), nonl(), scrollok(), wattron(), wattroff(), wattrset(), wbkgdset(), wprintw(), wscrl(), wsetscrreg() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
addchstr addchstr waddchstr addchnstr waddchnstr mvaddchstr mvwaddchstr mvaddchnstr mvwaddchnstr The addchstr set of routines is used to copy a character string (with attributes) to a window. Syntax #include
addchstr x y The x (column) coordinate of the starting position of chstr in the window. The y (row) coordinate of the starting position of chstr in the window. Return Values OK ERR Successful completion. An error occurred. Description The addchstr() routine copies the chtype character string to the stdscr window at the current cursor position. The waddchstr() routine performs the identical action, but writes to the window speci ed by win .
addchstr Implementation Considerations UNIX System V implementation See Also waddch(), waddnstr(), wattrset() Portability UNIX System V 4-14 CURSES FINAL TRIM SIZE : 7.0 in x 8.
addstr addstr waddstr addnstr waddnstr mvaddstr mvwaddstr mvaddnstr mvwaddnstr The addstr set of routines is used to add a character string (with attributes) to a window. Syntax #include
addstr y The y (row) coordinate of the starting position of str in the window. Return Values Successful completion. An error occurred. An attempt was made to write outside the window boundary. OK ERR Description The addstr() routine writes a null-terminated character string to the stdscr window at the current cursor position and advances the cursor. The waddstr() routine performs an identical action, but writes the character to the window speci ed by win .
addstr Implementation Considerations The addstr(), waddstr(), mvaddstr(), and mvwaddstr() are identical to XPG/3. The addnstr(), waddnstr(), mvaddnstr(), and mvwaddnstr() routines are UNIX System V implementations. See Also waddch(), waddchnstr() Portability The addstr(), waddstr(), mvaddstr(), and mvwaddstr() routines conform to HP-UX, UNIX System V, and XPG/3. The addnstr(), waddnstr(), mvaddnstr(), and mvwaddnstr() routines conform to UNIX System V. CURSES FINAL TRIM SIZE : 7.0 in x 8.
attroff attroff wattroff attron wattron attrset wattrset standend wstandend standout wstandout The attroff set of routines is used to change the foreground window attributes. Syntax #include
attroff Parameters attrs win The foreground window attributes to be added or removed. A pointer to the window in which attribute changes are to be made. Return Values OK ERR Successful completion. An error occurred. Description The attroff() and attron() routines remove and add, respectively, the speci ed foreground window attributes of stdscr. These routines only a ect the attributes speci ed; attributes that existed before the call retain their values.
attroff Table 4-4.
attroff printw("This word is"); attrset(A_UNDERLINE); printw("underlined."); attrset(A_NORMAL); printw("This is back to normal text.\n"); refresh(); Note All of these routines are macros. Implementation Considerations Identical to XPG/3 except for color support See Also init_color(), init_pair() , start_color() , wbkgd(), wbkgdset() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
baudrate baudrate The baudrate routine returns the terminal baud rate. Syntax #include int baudrate(); Return Values The terminal's baud rate is returned in bits per second. Description The baudrate() routine returns the terminal's data communication line and output speed in bits per second (for example, 9600). Implementation Considerations Identical to XPG/3 Portability HP-UX, UNIX System V, XPG/3 4-22 CURSES FINAL TRIM SIZE : 7.0 in x 8.
beep beep flash The beep and flash routines activate the audio-visual alarm. Syntax #include int beep(); int flash(); Return Values OK ERR Successful completion. An error occurred. The terminal does not support either capability. Description The beep() and flash() routines produce an audio and visual alarm on the terminal, respectively. If the terminal has the capability, beep() sounds a bell or beep, and flash() ashes the screen.
bkgdset bkgdset wbkgdset bkgd wbkgd The bkgdset set of routines is used to set the background character (and attributes) of a window. Syntax #include void bkgdset(chtype ch); void wbkgdset(WINDOW *win, chtype ch); int bkgd(chtype ch); int wbkgd(WINDOW *win, chtype ch); Parameters ch win A pointer to the background character to be set. A pointer to the window in which the background character is to be set. Return Values Successful completion. An error occurred.
bkgdset Each time a character, other than a space, is written to a window with waddch(), wprintw(), or waddstr(), a bitwise OR operation is performed between the chtype (foreground character with its attributes), the current foreground attributes of the window, and the current background attributes of the window. The current foreground attributes are set with wattrset(), wattron(), and wattroff(); the current background attributes are set with wbgdset().
bkgdset The bkgd(), wbkgd(), and bkgdset() routines are macros. Note Implementation Considerations UNIX System V implementation See Also addch(), attroff(), attron(), waddchstr() , wattrset(), winsch() Portability UNIX System V 4-26 CURSES FINAL TRIM SIZE : 7.0 in x 8.
border border box wborder The border set of routines is used to add a border to a window. Syntax #include int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int box(WINDOW *win, chtype verch, chtype horch); Parameters bl br bs horch ls rs tl The character and attributes used for the bottom-left corner of the border.
border tr The character and attributes used for the top- right corner of the border. The character and attributes used for the top of the border. The character and attributes used for the left and right columns of the box. The pointer to the window in which the border or box is to be drawn. ts verch win Return Values Successful completion. An error occurred. OK ERR Description The border(), wborder(), and box() routines draw a border around the speci ed window.
border Table 4-5. Constant Values for Borders Parameter Constant Used Value verch ACS_VLINE j horch ACS_HLINE - ls ACS_VLINE rs ACS_VLINE j j ts ACS_HLINE - bs ACS_HLINE - bl ACS_BLCORNER + br ACS_BRCORNER + tl ACS_ULCORNER + tr ACS_URCORNER + The call box (win, verch, horch) is a short form for wborder(win, verch, verch, horch, horch, 0, 0, 0, 0) When the window is boxed, the bottom and top rows and right and left columns are unavailable for text.
border Implementation Considerations The box() routine is identical to XPG/3. The border() and wborder() routines are UNIX System V implementations. See Also waddch(), wattrset() Portability The box() routine conforms to HP-UX, UNIX System V, and XPG/3. The border() and wborder() routines conform to UNIX System V. 4-30 CURSES FINAL TRIM SIZE : 7.0 in x 8.
cbreak cbreak nocbreak The cbreak and nocbreak routines enable and disable the character-mode operation. Syntax #include int cbreak(); int nocbreak(); Return Values OK ERR Successful completion. An error occurred. Description The cbreak() and nocbreak() routines enable and disable character-mode operation, respectively. When enabled, characters typed by the user are immediately processed by the program.
cbreak See Also wgetch(), halfdelay(), nodelay(), raw(), wtimeout() Portability HP-UX, UNIX System V, XPG/3 4-32 CURSES FINAL TRIM SIZE : 7.0 in x 8.
clear clear wclear The clear and wclear routines are used to clear the window. Syntax #include int clear(); int wclear(WINDOW *win); Parameters win A pointer to the window that is to be cleared. Return Values OK ERR Successful completion. An error occurred. Description The clear() routine clears stdscr, destroying its previous contents. The wclear() routine performs the same action, but clears the window speci ed by win instead of stdscr.
clear Implementation Considerations Identical to XPG/3 See Also clearok(), wbkgdset(), wclrtobot() , wclrtoeol() , werase() Portability HP-UX, UNIX System V, XPG/3 4-34 CURSES FINAL TRIM SIZE : 7.0 in x 8.
clearok clearok The clearok routine is used to clear and redraw the window with the next refresh. Syntax #include int clearok(WINDOW *win, bool bf); Parameters win bf A pointer to the window that is to be cleared and refreshed. A Boolean expression. Return Values OK ERR Successful completion. An error occurred. Description If bf is TRUE, clearok() clears and redraws the entire screen on the next call to wrefresh().
clrtobot clrtobot wclrtobot The clrtobot and wclrtobot routines are used to clear to the end of the window. Syntax #include int clrtobot(); int wclrtobot(WINDOW *win); Parameters win A pointer to the window that is to be cleared. Return Values Successful completion. An error occurred. OK ERR Description The clrtobot() routine clears all characters in the stdscr window from the cursor to the end of the window.
clrtobot Implementation Considerations Identical to XPG/3 See Also clearok(), wbkgdset(), wclear(), wcrltoeol(), werase() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
clrtoeol clrtoeol wclrtoeol The clrtoeol and wclrtoeol routines are used to clear to end of line. Syntax #include int clrtoeol(); int wclrtoeol(WINDOW *win); Parameters win A pointer to the window in which to clear to the end of the line. Return Values Successful completion. An error occurred. OK ERR Description The clrtoeol() routine clears the current line from the cursor to the right margin in the stdscr window.
clrtoeol Implementation Considerations Identical to XPG/3 See Also clearok(), wbkgdset(), wclear(), wclrtobot(), werase() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
color pair The color_pair routine is not implemented at this time. Note 4-40 CURSES FINAL TRIM SIZE : 7.0 in x 8.
copywin copywin The copywin routine is used to overlay or overwrite any portion of window. Syntax #include int copywin(WINDOW *srcwin, WINDOW *dstwin, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, int overlay); Parameters srcwin dstwin smincol sminrow dmincol dminrow dmaxcol dmaxrow overlay A pointer to the source window to be copied. A pointer to the destination window to be overlayed or overwritten.
copywin Return Values Successful completion. An error occurred. OK ERR Description The copywin() routine overlays or overwrites windows similiar to the overlay() and overwrite() functions; however, copywin() allows a ner degree of control on what portion of the window to overlay or overwrite. The parameters smincol and sminrow specify the upper-left corner of the rectangular area of the source window to be copied.
cur set curs set The curs_set routine is used to set the visibility of the cursor. Syntax #include int curs_set(int visibility); Parameters visibility A value of 0 (invisible), 1 (normal), or 2 (very visible). Return Values On success, previous cursor visibility is returned; ERR is returned if the requested visibility is not supported. Description The curs_set() routine sets the visibility of the cursor to invisible (0), normal (1), or very visible (2).
def prog mode def prog mode def shell mode The def_prog_mode and def_shell_mode routines are used to save terminal modes. Syntax #include int def_prog_mode(); int def_shell_mode(); Return Values Successful completion. An error occurred. OK ERR Description The def_prog_mode() and def_shell_mode() routines save the current terminal modes as \program" (within CURSES) or \shell" (outside CURSES). These are used by the reset_prog_mode() and reset_shell_mode() routines.
def prog mode Portability UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
del curterm The del_curterm routine is used to free space pointed to by TERMINAL (interface to TERMINFO). Syntax #include int del_curterm(TERMINAL *oterm); Parameters oterm The terminal type for which to free space. Return Values Successful completion. An error occurred. OK ERR Description The del_curterm() routine is a low-level routine only used outside of CURSES when the program has to deal directly with the TERMINFO database to handle certain terminal capabilities.
del curterm See Also set_curterm() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
delay output The delay_output routine is used to delay output. Syntax #include int delay_output(int ms); Parameters ms The number of milliseconds to delay the output. Return Values Successful completion. An error occurred. OK ERR Description The delay_output() routine delays output for ms milliseconds by inserting pad characters in the output stream. Implementation Considerations Identical to XPG/3 Portability HP-UX, UNIX System V, XPG/3 4-48 CURSES FINAL TRIM SIZE : 7.0 in x 8.
delch delch wdelch mvdelch mvwdelch The delch set of routines is used to remove a character. Syntax #include int delch(); int wdelch(WINDOW *win); int mvdelch(int y, int x); int mvwdelch(WINDOW *win, int y, int x); Parameters x y win The x (column) coordinate of the position of the character to be removed. The y (row) coordinate of the position of the character to be removed. A pointer to the window containing the character to be removed. Return Values OK ERR Successful completion.
delch Description The delch() and wdelch() routines delete the character at the current cursor position from stdscr and win , respectively. All remaining characters on the same line to the right of the deleted character are moved left one character. The last character on the line becomes a space; characters on other lines are not a ected.
deleteln deleteln wdeleteln The deleteln and wdeleteln routines are used to remove a line. Syntax #include int deleteln(); int wdeleteln (WINDOW *win); Parameters win A pointer to the window from which the line is removed. Return Values OK ERR Successful completion. An error occurred. Description The deleteln() and wdeleteln() routines delete the line containing the cursor from stdscr and win , respectively. All lines below the one deleted are moved up one line.
deleteln Implementation Considerations Identical to XPG/3 See Also winsdeln(), winsertln(), wbkgdset() Portability HP-UX, UNIX System V, XPG/3 4-52 CURSES FINAL TRIM SIZE : 7.0 in x 8.
delscreen delscreen The delscreen routine is used to free space associated with the SCREEN data structure. Syntax #include int delscreen(SCREEN *sp); Parameters sp A pointer to the screen structure for which to free space. Return Values OK ERR Successful completion. An error occurred. Description The delscreen() routine frees space associated with the SCREEN data structure. This routine should be called after endwin() if a SCREEN data structure is no longer needed.
delwin The delwin routine is used to delete a window. Syntax #include int delwin(WINDOW *win); Parameters win A pointer to the window that is to be deleted. Return Values Successful completion. An error occurred. OK ERR Description The delwin() routine deletes the speci ed window, freeing up the memory associated with it. If you delete a parent window without deleting its subwindows and then try to manipulate the subwindows, you may encounter odd results.
delwin See Also newwin(), subwin(), derwin() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
derwin The derwin routine is used to create a subwindow relative to parent window. Syntax #include WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begin_y, int begin_x); Parameters orio nlines ncols begin y begin x A pointer to the parent window for the newly created subwindow. The number of lines in the subwindow. The number of columns in the subwindow. The y (row) coordinate of the upper-left corner of the subwindow, relative to the parent window.
derwin items.) This means that characters and attributes are identical in overlapping areas regardless of which window characters are written to. When using subwindows, it is often necessary to call touchwin() before wrefresh() to maintain proper screen contents. Note The subwin() routine creates a subwindow in exactly the same way, but allows you to specify coordinates relative to the physical screen.
dupwin The dupwin routine is used to create a duplicate of a window. Syntax #include WINDOW *dupwin(WINDOW, *win); Parameters win A pointer to the window that is to be duplicated. Return Values On success, a pointer to new window structure is returned; otherwise, a null pointer is returned. Description The dupwin() routine creates a duplicate of the window win . A pointer to the new window structure is returned.
echo echo noecho The echo and noecho routines are used to enable and disable terminal echo. Syntax #include int echo(); int noecho(); Return Values OK ERR Successful completion. An error occurred. Description The echo() and noecho() routines enable and disable the terminal echo, respectively. When enabled, characters received by getch() are echoed back to the terminal. When disabled, characters are transferred to the program without echoing them to the terminal display.
echo See Also wgetch(), wgetstr(), wscanw() Portability HP-UX, UNIX System V, XPG/3 4-60 CURSES FINAL TRIM SIZE : 7.0 in x 8.
echochar echochar wechochar The echochar and wechochar routines are used to add a character and refresh the window. Syntax #include int echochar(chtype ch); int wechochar(WINDOW *win, chtype ch); Parameters win ch A pointer to the window in which the character is to be added. A pointer to the character to be written to the window. Return Values OK ERR Successful completion. An error occurred.
echochar See Also waddch(), wrefresh() Portability UNIX System V 4-62 CURSES FINAL TRIM SIZE : 7.0 in x 8.
endwin endwin isendwin The endwin and isendwin routines are used to restore the initial terminal environment. Syntax #include int endwin(); int isendwin(); Return Values OK ERR Successful completion. An error occurred. Description The endwin() routine restores tty modes, resets the terminal, and moves the cursor to the lower-left corner of the screen. This routine should be called before exiting or escaping CURSES temporarily.
endwin See Also doupdate(), wrefresh() Portability The endwin() routine conforms to HP-UX, UNIX System V, and XPG/3. The isendwin() routine conforms to UNIX System V. 4-64 CURSES FINAL TRIM SIZE : 7.0 in x 8.
erase erase werase The erase and werase routines are used to erase a window. Syntax #include int erase(); int werase(WINDOW *win); Parameters win A pointer to the window that you want to erase. Return Values OK ERR Successful completion. An error occurred. Description The erase() routine erases the contents of the stdscr window, destroying its previous contents. The werase() routine performs the same action, but erases the content of win instead of stdscr.
erase Implementation Considerations Identical to XPG/3 See Also clearok(), wbkgdset(), wclear(), wclrtobot(), wclrtoeol() Portability HP-UX, UNIX System V, XPG/3 4-66 CURSES FINAL TRIM SIZE : 7.0 in x 8.
erasechar erasechar The erasechar routine is used to return the current ERASE character. Syntax #include char erasechar(); Return Values The terminal's current ERASE character is returned. Description The erasechar() routine returns the user's choice of ERASE character from the tty driver. This character is used to delete the previous character during keyboard input. The returned value can be used when including deletion capability in interactive programs.
flushinp The flushinp routine is used to discard type-ahead characters. Syntax #include int flushinp(); Return Values Successful completion. An error occurred. OK ERR Description The flushinp() routine discards all type-ahead characters (characters typed by the user, but not yet processed by CURSES). Implementation Considerations Identical to XPG/3 Portability HP-UX, UNIX System V, XPG/3 4-68 CURSES FINAL TRIM SIZE : 7.0 in x 8.
getch getch wgetch mvgetch mvwgetch ungetch The getch, wgetch, mvgetch, mvwgetch, and ungetch routines are used to get a character from the keyboard. Syntax #include int getch(); int wgetch (WINDOW *win); int mvgetch(int y, int x); int mvwgetch(WINDOW *win, int y, int x); int ungetch(int ch); Parameters ch x y win The character to be put back in the input queue for the next call to getch(). The x (column) coordinate for the position of the character to be read.
getch Return Values Successful completion. An error occurred. The nodelay() or wtimeout(0) routine is set, and no input is ready. OK ERR Description The getch() and wgetch() routines get a character from the terminal associated with the window stdscror window win , respectively. The mvgetch() and mvwgetch() routines move the cursor to the position speci ed in stdscr or win , respectively, then get a character.
getch Table 4-6 shows a list of tokens for the function keys that are returned by getch() if keypad handling is enabled. (Some terminals may not support all tokens.) Table 4-6. Constant Values for Function Keys Constant Description KEY_BREAK Break key KEY_DOWN The down arrow key KEY_UP The up arrow key KEY_LEFT The left arrow key KEY_RIGHT The right arrow key KEY_HOME Home key KEY_BACKSPACE Backspace KEY_F0 Function keys.
getch Table 4-6.
getch Table 4-6.
getch Table 4-6.
getch Table 4-6. Constant Values for Function Keys (continued) Constant Description KEY_SRIGHT Shifted right key KEY_SRSUME Shifted resume key KEY_SSAVE Shifted save key KEY_SSUSPEND Shifted suspend key KEY_SUNDO Shifted undo key KEY_SUSPEND Suspend key KEY_UNDO Undo key The ungetch() routine delays processing of ch until the next call to getch(). Note The getch(), mvgetch(), and mvwgetch() routines are macros.
getstr getstr wgetstr wgetnstr mvgetstr mvwgetstr The getstr set of routines is used to get a character string from keyboard. Syntax #include int getstr(char *str); int wgetstr(WINDOW *win, char *str); int wgetnstr(WINDOW *win, char *str, int n); int mvgetstr(int y, int x, char *str); int mvwgetch(WINDOW *win, int y, int x, char *str); Parameters n str The maximum number of characters to read from input. A pointer to the area where the character string is to be placed.
getstr Return Values OK ERR Successful completion. An error occurred. Description The getstr() and wgetstr() routines get a character string from the terminal associated with the window stdscr or window win , respectively. The mvgetch() and mvwgetch() routines move the cursor to the position speci ed in stdscr or win , respectively, then get a character. These routines call getch() for each character until a newline or carriage return is received, at which time, the string is placed in str .
getyx getyx getparyx getbegyx getmaxyx The getyx set of routines is used to get positional information for a window. Syntax #include void void void void getyx(WINDOW *win, int y, getparyx(WINDOW *win, int getbegyx(WINDOW *win, int getmaxyx(WINDOW *win, int int x); y, int x); y, int x); y, int x); Parameters win A pointer to the window from which to get positional information. The integer in which to place x coordinate position of cursor.
getyx Note These routines are all macros. An ampersand (&) before the y and x variables is not necessary. Implementation Considerations The getyx() routine is identical to XPG/3. The getparyx(), getbegyx(), and getmaxyx() routines are UNIX System V implementations. Portability The getyx() routine conforms to HP-UX, UNIX System V, and XPG/3. The getparyx(), getbegyx(), and getmaxyx() routines conform to UNIX System V. CURSES FINAL TRIM SIZE : 7.0 in x 8.
halfdelay The halfdelay routine is used to enable and disable the half-delay mode. Syntax #include int halfdelay(int tenths); Parameters tenths The number of tenths of seconds for which to block input (1 to 255). Return Values Successful completion. An error occurred. OK ERR Description The halfdelay() routine is similar to cbreak() in that when set, characters typed by the user are immediately processed by the program.
has color has color can change color color content pair content The has_color set of routines is used to get information about colors on terminal. Syntax #include bool has_colors(); bool can_change_color(); int pair_content(short pair, short *fg, short *bg); int color_content(short color, short *r, short *g, short *b); Parameters color pair r g b bg fg The number of the color for which to provide information (0 to COLORS).
has color Return Values Successful completion. An error occurred. OK ERR Description The has_colors() routine returns TRUE if the terminal supports color. The can_change_color() routine returns TRUE if the terminal can support color and the colors can be changed. These routines are useful when writing terminal-independent programs; these routines could be used to determine whether to replace color with another attribute on a particular terminal.
has ic has ic has il The has_ic and has_il routines are used to determine insert and delete a character or line capability. Syntax #include bool has_ic(); bool has_il(); Return Values TRUE FALSE Terminal has insert and delete capability. Terminal does not have insert and delete capability. Description The has_ic() routine returns TRUE if the terminal has insert and delete character capability, and FALSE otherwise.
idlok The idlok routine is used to enable the insert and delete line capability. Syntax #include int idlok (WINDOW *win, bool bf); Parameters bf win A Boolean expression. A pointer to the window in which to enable the insert and delete line capability. Return Values Successful completion. An error occurred. OK ERR Description The idlok() routine enables (bf is TRUE) or disables (bf is FALSE) the use of the insert and delete line capability of the terminal.
idlok See Also doupdate(), scroll(), wscrl() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
immedok The immedok routine is used to call wrefresh() on changes to window. Syntax #include int immedok(WINDOW *win, bool bf); Parameters win bf A pointer to the window that is to be refreshed. A Boolean expression. Return Values Successful completion. An error occurred. OK ERR Description If bf is TRUE, immedok() calls wrefresh() if any change to the window image is made (for example, through routines such as addch(), wclrtobot(), and wscrl()).
inch inch winch mvinch mvwinch The inch set of routines is used to return a character (with attributes). Syntax #include chtype inch; chtype winch(WINDOW *win); chtype mvinch(int y, int x); chtype mvwinch(WINDOW *win, int y, int x); Parameters ch win x y The character to be returned. A pointer to the window that contains the character to be returned. The x (column) coordinate of the position of the character to be returned.
inch Description The inch() and winch() routines return the chtype character located at the current cursor position of the stdscr window and window win , respectively. The mvinch() and mvwinch() routines return the chtype character located at the position indicated by the x (column) and y (row) parameters (the former in the stdscr window; the latter in window win ). The complete character and attribute pair is returned.
inchstr inchstr winchstr inchnstr winchnstr mvinchstr mvwinchstr mvinchnstr mvwinchnstr The inchstr set of routines is used to return a character string (with attributes). Syntax #include
inchstr x The x (column) coordinate of the starting position of the string to be returned. The y (row) coordinate of the starting position of the string to be returned. y Return Values Successful completion. An error occurred. OK ERR Description The inchstr() and winchstr() routines return the character string (with attributes) starting at the current cursor position of the stdscr window and window win , respectively, and ending at the right margin.
inchstr Implementation Considerations UNIX System V implementation See Also winch(), winstr() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
init color init color init pair The init_color and init_pair routines are used to initialize a color pair. The init_color and init_pair routines are not implemented at this time. Note Syntax #include int init_color(short color, short r, short g, short b); int init_pair(short pair, short fg, short bg); Parameters color pair The number of the color to be changed (0 to COLORS). The number of the color pair to be changed (1 to COLOR_PAIRS -1).
init color Description The init_pair() routine initializes a color pair so that the macro COLOR_PAIR(n ) can be used as an attribute. Its rst argument is the number of the color pair to be changed; the second argument is the number of the foreground color; the third argument is the number of the background color. The maximum number of color pairs and colors that the terminal can support are de ned in the global variables COLOR_PAIRS and COLORS, respectively.
init color See Also can_change_color() , color_content(), has_color() , pair_content() , start_color() Portability UNIX System V 4-94 CURSES FINAL TRIM SIZE : 7.0 in x 8.
initscr initscr The initscr routine is used to initialize single terminal environment. Syntax #include WINDOW *initscr(); Return Values On success, a pointer to stdscr is returned; otherwise, a null pointer is returned (for example, if the console could not be opened for write; the terminal could not be initialized; or memory could not be allocated for stdscr).
insch insch winsch mvinsch mvwinsch The insch set of routines is used to insert a character. Syntax #include int insch(chtype ch); int winsch(WINDOW *win, chtype ch); int mvinsch(int y, int x, chtype ch); int mvwinsch(WINDOW *win, int y, int x, chtype ch); Parameters ch win The character to be inserted. A pointer to the window in which the character is to be inserted. The x (column) coordinate of the position of the character. The y (row) coordinate of the position of the character.
insch Description The insch() routine inserts the chtype character at the current cursor position of the stdscr window. The winsch() routine performs the identical action but in window win . The mvinsch() and mvwinsch() routines insert the character at the position indicated by the x (column) and y (row) parameters (the former in the stdscr window; the latter in window win ). The cursor position does not change. All characters to the right of the inserted character are moved right one character.
insdelln insdelln winsdelln The insdelln and winsdelln routines are used to insert or delete lines to or from the window. Syntax #include int insdelln(int n); int winsdelln(WINDOW *win, int n); Parameters win n A pointer to the window in which to insert or delete a line. The number of lines to insert or delete (positive n inserts; negative n deletes). Return Values Successful completion. An error occurred.
insdelln Implementation Considerations UNIX System V implementation See Also wdeleteln(), winsertln() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
insertln insertln winsertln The insertln and winsertln routines are used to insert a line in a window. Syntax #include int insertln(); int winsertln(WINDOW *win); Parameters win A pointer to the window in which to insert the line. Return Values Successful completion. An error occurred. OK ERR Description The insertln() and winsertln() routines insert a blank line above the current line in stdscr or win , respectively. The new line becomes the current line.
insertln Implementation Considerations Identical to XPG/3 See Also wbkgdset(), wdeleteln() , winsdelln() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
insstr insstr winsstr insnstr winsnstr mvinsstr mvwinsstr mvinsnstr mvwinsnstr The insstr set of routines is used to insert a character string. Syntax #include
insstr y The y (row) coordinate of the starting position of the string. Return Values OK ERR Successful completion. An error occurred. Description The insstr() routine inserts str at the current cursor position of the stdscr window. The winsstr() routine performs the identical action, but in window win .
insstr Implementation Considerations UNIX System V implementation See Also waddstr(), winsch() Portability UNIX System V 4-104 CURSES FINAL TRIM SIZE : 7.0 in x 8.
instr instr winstr innstr winnstr mvinstr mvwinstr mvinnstr mvwinnstr The instr set of routines is used to return a character string (without attributes). Syntax #include
instr y The y (row) coordinate of the starting position of the string to be returned. Return Values Successful completion. An error occurred. OK ERR Description The instr() and winstr() routines return the character string (without attributes) starting at the current cursor position of the stdscr window and window win , respectively, and ending at the right margin.
instr See Also winch(), winchstr() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
intrflush The intrflush routine is used to ush output in tty on interrupt. Syntax #include int intrflush(WINDOW *win, bool bf); Parameters bf win A Boolean expression. An ignored parameter. Return Values Successful completion. An error occurred. OK ERR Description If this option is enabled (bf is TRUE), intrflush() ushes all output in the terminal driver when an interrupt, quit, or suspend character is sent to the terminal.
intrflush Implementation Considerations Identical to XPG/3 See Also flushinp(), qiflush(), noqiflush() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
keyname The keyname routine is used to return the character string for a key. Syntax #include char *keyname(int c); Parameters c The key for which to get the name. Return Values None Description The keyname() routine returns a string pointer to the key name. Make a duplicate of the returned string if you plan to modify it. Implementation Considerations UNIX System V implementation Portability UNIX System V 4-110 CURSES FINAL TRIM SIZE : 7.0 in x 8.
keypad keypad The keypad routine is used to enable keypad handling. Syntax #include int keypad(WINDOW *win, bool bf); Parameters win bf A pointer to the window in which to enable keypad handling. A Boolean expression. Return Values OK ERR Successful completion. An error occurred. Description If bf is TRUE, keypad() handles special keys from the keyboard on the terminal associated with win as single values instead of character sequences.
keypad See Also wgetch() Portability HP-UX, UNIX System V, XPG/3 4-112 CURSES FINAL TRIM SIZE : 7.0 in x 8.
killchar killchar The killchar routine is used to return the current KILL character. Syntax #include char killchar(); Return Values The terminal's current KILL character is returned. Description The killchar() routine returns the user's choice of KILL character from the tty driver. This character is used to start a new line of input when the current input is considered erroneous. The returned value can be used when including deletion capability in interactive programs.
leaveok The leaveok routine is used to ignore cursor relocation. Syntax #include int leaveok(WINDOW *win, bool bf); Parameters win A pointer to the window in which to ignore the position of the cursor. A Boolean expression. bf Return Values Successful completion. An error occurred. OK ERR Description If bf is TRUE, leaveok() leaves the cursor in a position that CURSES nds convenient at the time that the window is refreshed.
leaveok Implementation Considerations Identical to XPG/3 See Also wrefresh() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
longname The longname routine is used to return the full terminal type name. Syntax #include char *longname(); Return Values On success, pointer to verbose description of terminal is returned; otherwise, a null pointer is returned. Description The longname() routine returns a pointer to a static area containing a verbose description (128 characters or less) of the terminal. The area is de ned after calls to initscr(), newterm(), or setupterm().
meta meta The meta routine is used to control the number of bits returned on input. Syntax #include int meta(WINDOW *win, bool bf); Parameters bf win A Boolean expression. An ignored parameter. Return Values OK ERR Successful completion. An error occurred. The terminal or system cannot handle 8-bit character codes. Description Whether a terminal returns 7 or 8 signi cant bits initially depends on the control mode of the terminal driver.
meta The meta() routine is provided for compatability with older CURSES packages. The MPE/iX CURSES package handles 16-bit Note characters, therefore making this function unnecessary. Implementation Considerations HP-UX and UNIX System V implementations Portability HP-UX, UNIX System V 4-118 CURSES FINAL TRIM SIZE : 7.0 in x 8.
move move wmove The move and wmove routines are used to move the cursor in the window. Syntax #include int move(int y, int x); int wmove(WINDOW *win, int y, int x); Parameters win x y A pointer to the window in which the cursor is to be written. The x (column) coordinate of the position of the cursor in the window. The y (row) coordinate of the position of the cursor in the window. Return Values OK ERR Successful completion. An error occurred. The cursor is outside the window boundary.
move Implementation Considerations Identical to XPG/3 See Also doupdate(), wrefresh() Portability HP-UX, UNIX System V, XPG/3 4-120 CURSES FINAL TRIM SIZE : 7.0 in x 8.
mvcur mvcur The mvcur routine is used to move the cursor (interface to terminfo). Syntax #include int mvcur (int oldrow, int oldcol, int newrow, int newcol); Parameters oldrow oldcol newrow newcol The row from which cursor is to be moved. The column from which cursor is to be moved. The row to which cursor is to be moved. The column to which cursor is to be moved. Return Values OK ERR Successful completion. An error occurred.
mvcur Implementation Considerations Identical to XPG/3 Portability HP-UX, UNIX System V 4-122 CURSES FINAL TRIM SIZE : 7.0 in x 8.
mvwin mvwin The mvwin routine is used to move a window. Syntax #include int mvwin(WINDOW *win, int y, int x); Parameters win y x A pointer to the window to move. The y (row) coordinate of the upper-left corner of the window. is the x (column) coordinate of the upper-left corner of the window. Return Values OK ERR Successful completion. An error occurred.
mvwin Implementation Considerations Identical to XPG/3 See Also newwin(), subwin() Portability HP-UX, UNIX System V, XPG/3 4-124 CURSES FINAL TRIM SIZE : 7.0 in x 8.
napms napms Note The napms() routine is not implemented at this time. CURSES FINAL TRIM SIZE : 7.0 in x 8.
newpad The newpad routine is used to create a new pad. Syntax #include WINDOW *newpad(int nlines, int ncols); Parameters nlines ncols The number of lines in the window. The number of columns in the window. Return Values On success, a pointer to the new window structure is returned; otherwise, a null pointer is returned. Description The newpad() routine creates a new pad with the speci ed number of lines and columns. A pointer to the new pad structure is returned.
newpad See Also pnoutrefresh(), prefresh() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
newterm The newterm routine is used to open a new terminal. Syntax #include #include SCREEN *newterm(char *type, FILE *outfp, FILE *infp); Parameters type outfp infp A string de ning the terminal type to be used in place of TERM. A pointer to a le to be used for output to the terminal. The pointer to a le to be used for input to the terminal. Return Values On success, a pointer to new SCREEN structure is returned; otherwise, a null pointer is returned.
newterm See Also delscreen(), endwin(), initscr() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
newwin The newwin routine is used to create a window. Syntax #include WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x); Parameters nlines ncols begin y The number of lines in the new window. The number of columns in the new window. The y (row) coordinate of the position of the upper left corner of window. The x (column) coordinate of the position of the upper left corner of the window.
newwin Note The newwin() routine is a macro. Implementation Considerations Identical to XPG/3 See Also delwin(), derwin(), dupwin(), mvwin(), subwin(), touchwin() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
nl nl nonl The nl and nonl routines are used to enable and disable newline control. Syntax #include int nl(); int nonl(); Return Values Successful completion. An error occurred. OK ERR Description The nl() routine enables the handling of newlines. The nl() routine converts newline into carriage return and line feed on output and converts carriage return into newline on input. The nonl() routine disables the handling of newlines. The handling of newlines is initially enabled.
nodelay nodelay The nodelay routine is used to set blocking or non-blocking read. Syntax #include int nodelay(WINDOW *win, bool bf); Parameters bf win A Boolean expression. A pointer to the window in which to enable non-blocking. Return Values OK ERR Successful completion. An error occurred. Description If enabled (bf is TRUE), nodelay() causes getch() to return ERR if no input is ready. When disabled, getch() blocks until a key is pressed. Note The nodelay() routine is a macro.
nodelay See Also wgetch(), wtimeout() Portability HP-UX, UNIX System V, XPG/3 4-134 CURSES FINAL TRIM SIZE : 7.0 in x 8.
notimeout notimeout The notimeout routine is used to disable the timer used by getch(). Syntax #include int notimeout(WINDOW *win, bool bf); Parameters bf A Boolean expression. Return Values OK ERR Successful completion. An error occurred. Description If bool is TRUE, notimeout() disables a timer used by getch() when interpreting escape character sequences.
notimeout Implementation Considerations UNIX System V implementation See Also keypad(), wgetch() Portability UNIX System V 4-136 CURSES FINAL TRIM SIZE : 7.0 in x 8.
overlay overlay overwrite The overlay and overwrite routines are used to overlap or overwrite windows. Syntax #include int overlay(WINDOW *srcwin, WINDOW *dstwin); int overwrite(WINDOW *srcwin, WINDOW *dstwin); Parameters srcwin dstwin A pointer to the source window to be copied. A pointer to the destination window to be overlayed or overwritten. Return Values OK ERR Successful completion. An error occurred. Description The overwrite() and overlay() routines copy srcwin to destwin .
overlay d a #include c /* * Pop-up a window on top of curscr. If row and/or col * are -1 then that dimension will be centered within * curscr. Return 0 for success or -1 if malloc() failed. * Pass back the working window and the saved window for the * pop-up. The saved window should not be modified. */ int popup(work, save, nrows, ncols, row, col) WINDOW **work, **save; int nrows, ncols, row, col; { int mr, mc; getmaxyx(curscr, mr, mc); /* Windows are limited to the size of curscr.
overlay d } /* * * Restore the region covered by a popup window. Delete the working window and the saved window. * This function is the complement to popup(). * 0 for success or -1 for an error. */ int popdown(work, save) WINDOW *work, *save; { (void) overwrite(save, curscr); (void) delwin(save); (void) delwin(work); return (0); } c a } overwrite(curscr, *save); return (0); Return /* * Compute the size of a dialog box that would fit around * the string.
overlay d { } c a int rows, cols, col; for (rows = 1, cols = col = 0; *str != ' '; ++str) { if (*str == '0) { if (cols < col) cols = col; col = 0; ++rows; } else { ++col; } } if (cols < col) cols = col; *nrows = rows; *ncols = cols; /* * Write a string into a dialog box.
overlay d a } void dialog(str) char *str; { WINDOW *work, *save; int nrows, ncols, row, col; /* Figure out size of window. */ dialsize(str, &nrows, &ncols); /* Create a centered working window with extra */ /* room for a border. */ (void) popup(&work, &save, nrows+2, ncols+2, -1, -1); /* Write text into the working window. */ dialfill(work, str); /* Pause. Remember that wgetch() will do a wrefresh() */ /* for us. */ (void) wgetch(work); /* Restore curscr and free windows.
overlay Implementation Considerations Identical to XPG/3 See Also copywin() Portability HP-UX, UNIX System V, XPG/3 4-142 CURSES FINAL TRIM SIZE : 7.0 in x 8.
pair content pair content Note The pair_content routine is not implemented at this time. CURSES FINAL TRIM SIZE : 7.0 in x 8.
prefresh prefresh pnoutrefresh The prefresh and pnoutrefresh routines routines are used to copy the pad data structure to a physical window. Syntax #include int prefresh(WINDOW *pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol); int pnoutrefresh(WINDOW *pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol); Parameters pad pmincol pminrow smincol sminrow smaxcol smaxrow 4-144 A pointer to the pad to refresh.
prefresh Return Values OK ERROR Successful completion. An error occurred. Description The prefresh() routine copies the speci ed portion of the logical pad to the terminal screen. The parameters pmincol and pminrow specify the upper-left corner of the rectangular area of the pad to be displayed. The lower-right coordinate of the rectangular area of the pad that is to be displayed is calculated from the screen parameters (sminrow , smincol , smaxrow , and smaxcol ).
printw printw wprintw mvprintw mvwprintw vwprintw The printw set of routines is used to perform a formatted write to a window. Syntax #include int printw(char *fmt [,arg...]); int wprintw(WINDOW *win, char *fmt[,arg...]); int mvprintw(int y, int x, char *fmt [,arg...]); int mvwprintw(WINDOW *win, int y, int x, char *fmt [,arg...]) #include vwprintw(WINDOW *win, char *fmt, va_list arglist); Parameters fmt [,arg...
printw Return Values OK ERR Successful completion. An error occurred. Description These routines are functionally equivalent to printf(). Characters are written to the window using waddch(). With printw() and wprintw(), the characters are written to stdscr and win , respectively. The mvprintw() and mvwprintw() routines position the cursor as speci ed in stdscr or win , respectively, and then call printw(). The vwprintw() routine writes to the window.
qiflush qiflush noqiflush The qiflush and noqiflush set of routines is used to control the ush of input and output on interrupt. Syntax #include void qiflush(); void noqiflush(); Return Values None Description The qiflush() routine ushes input and output queues when an interrupt, quit, or suspend character is sent to the terminal. The noqiflush() routine does not ush input and output queues when these characters are sent.
raw raw noraw The raw and noraw routines are used to enable and disable the raw-mode operation. Syntax #include int raw(); int noraw(); Return Values OK ERR Successful completion. An error occurred. Description The raw() and noraw() routines enable and disable raw-mode operation, respectively. These routines are similar to cbreak() and nocbreak() in that raw() immediately processes characters typed by the user, and noraw() restores the previous state.
raw See Also cbreak(), wgetch(), halfdelay() , nodelay(), wtimeout() Portability HP-UX, UNIX System V, XPG/3 4-150 CURSES FINAL TRIM SIZE : 7.0 in x 8.
redrawwin redrawwin wredrawln The redrawwin and wredrawln routines are used to redraw the screen or portion of the screen. Syntax #include int redrawwin(WINDOW *win); int wredrawln(WINDOW *win, int beg_line, int num_lines); Parameters win beg line num lines A pointer to the window in which to redraw. The rst line to redraw. The number of lines to redraw. Return Values OK ERROR Successful completion. An error occurred.
redrawwin Implementation Considerations UNIX System V implementation Portability UNIX System V 4-152 CURSES FINAL TRIM SIZE : 7.0 in x 8.
refresh refresh wrefresh doupdate wnoutrefresh The refresh set of routines is used to copy a window data structure to a physical window. Syntax #include int refresh(); int wrefresh(WINDOW *win); int doupdate(); int wnoutrefresh(WINDOW *win); Parameters win A pointer to the window in which to refresh. Return Values OK ERROR Successful completion. An error occurred. Description The refresh() and wrefresh() routines copy stdscr and win , respectively, to the terminal screen.
refresh When outputting several windows at once, it is often more e cient to call the wnoutrefresh() and doupdate() routines directly. A call to wnoutrefresh()for each window rst, followed by only one call to doupdate() to update the screen, results in one burst of output, fewer characters sent, and less CPU time used. If the win parameter to wrefresh() is global variable curscr , the screen is immediately cleared and repainted from scratch.
reset prog mode reset prog mode reset shell mode The reset_prog_mode and reset_shell_mode routines are used to reset the terminal modes. Syntax #include int reset_prog_mode(); int reset_shell_mode(); Return Values OK Successful completion. Description The reset_prog_mode() and reset_shell_mode() routines reset the current terminal modes to \program" (within CURSES) or \shell" (outside CURSES). The reset is done automatically by endwin() and by doupdate() after a call to endwin().
resetty resetty savetty The resetty and savetty routines are used to restore and save terminal modes. Syntax #include int resetty(); int savetty(); Return Values Successful completion. An error occurred. OK ERR Description The savetty() and resetty() routines are low-level routines typically used within library routines. The savetty() and resetty() routines save and restore the terminal state, respectively.
scanw scanw wscanw mvscanw mvwscanw vwscanw The scanw set of routines is used to perform a formatted read from a window. Syntax #include int scanw(char *fmt [,arg...]); int wscanw(WINDOW *win, char *fmt [,arg...]); int mvscanw(int y, int x, char *fmt[,arg...]); int mvwscanw(WINDOW *win, int y, int x, char *fmt[,arg...]) #include vwscanw(WINDOW *win, char *fmt, va_list arglist); Parameters fmt [,arg...
scanw Return Values Successful completion. An error occurred. OK ERR Description These routines are functionally equivalent to scanf(). Characters are read from the window using wgetstr(). When a newline is received, the line is processed by scanw(), which places the result in the appropriate args . With scanw() and wscanw(), the characters are read from stdscr and win , respectively. The mvscanw() and mvwscanw() routines position the cursor in the window and then call scanw().
scr dump scr dump scr restore The scr_dump and scr_restore routines are used to write the screen contents to and from a le. Syntax #include int scr_dump(char *filename); int scr_restore(char *filename); Parameters lename A pointer to the le in which screen contents are written. Return Values OK ERR Successful completion. An error occurred. Description The scr_dump() routine writes the contents of the virtual screen, curscr , to lename .
scr dump See Also wrefresh() Portability UNIX System V 4-160 CURSES FINAL TRIM SIZE : 7.0 in x 8.
srcl srcl wscrl scrol The srcl set of routines is used to scroll a window. Syntax #include int scrl (int n); int wscrl (WINDOW *win, int n); int scroll (WINDOW *win); Parameters win n A pointer to the window in which to scroll. The number and direction of lines to scroll. Return Values OK ERR Successful completion. An error occurred. Description The scroll() routine scrolls the window win up one line. The current cursor position is not changed.
srcl Implementation Considerations The scroll() routine is identical to XPG/3. The wscrl() and scrl() routines are UNIX System V implementations. See Also scrollok(), waddch() Portability The scroll() routine conforms to HP-UX, UNIX System V, and XPG/3. The wscrl() and scrl() routines conform to UNIX System V. 4-162 CURSES FINAL TRIM SIZE : 7.0 in x 8.
scrollok scrollok The scrollok routine is used to enable scrolling of the screen. Syntax #include int scrollok (WINDOW *win, bool bf); Parameters bf win A Boolean expression. A pointer to the window in which to enable scrolling. Return Values OK ERR Successful completion. An error occurred. Description The scrollok() routine controls what happens when the cursor advances outside the bottom boundary of a window or scrolling region.
scrollok See Also idlok(), scroll(), waddch(), wscrl() Portability HP-UX, UNIX System V, XPG/3 4-164 CURSES FINAL TRIM SIZE : 7.0 in x 8.
set curterm set curterm The set_curterm routine is used to set the cur term variable (interface to terminfo). Syntax #include int set_curterm (TERMINAL *nterm); Parameters nterm The terminal type for which the variable is set. Return Values OK ERR Successful completion. An error occurred. Description The set_curterm() routine is a low-level routine used only outside of CURSES when the program has to deal directly with the terminfo database to handle certain terminal capabilities.
set curterm See Also del_curterm() Portability HP-UX, UNIX System V 4-166 CURSES FINAL TRIM SIZE : 7.0 in x 8.
set term set term The set_term routine is used to switch between terminals. Syntax #include SCREEN *set_term (SCREEN *new); Parameters new The new terminal to which to switch. Return Values On success, a pointer to the previous terminal is returned; otherwise, a null pointer is returned. Description The set_term() routine switches to the terminal speci ed by new and returns a screen reference to the previous terminal. Calls to subsequent CURSES routines a ect the new terminal.
setscrreg The setscrreg routine is used to set the scrolling region in a window. Syntax #include int setscrreg (int top, int bot); int wssetscrreg (WINDOW *win, int top, int bot); Parameters bot The bottom line of the scrolling region (top of the window is line 0). The top line of the scrolling region (top of the window is line 0). A pointer to the window in which to set up the scroll window.
setscrreg Implementation Considerations Identical to XPG/3 See Also idlok(), scroll(), scrollok(), waddch(), wscrl() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
setupterm setupterm setterm The setupterm and setterm routines are used to de ne a set of terminal-dependent variables (terminfo interface). Syntax #include int setupterm (char *term, int fildes, int *errret); int setterm (char *term); Parameters term ldes errret The terminal type for which variables are set. A le descriptor initialized for output. A pointer to an integer in which the status value is stored. Return Values Successful completion. An error occurred.
setupterm called, which is the default, the environment variables LINES and COLUMNS are used, if they exist. If the environment variables do not exist and the program is running in a window, the current window size is used. The term parameter of setupterm() speci es the terminal; if null, terminal type is taken from the TERM environment variable. All output is sent to ldes which is initialized for output.
start color The start_color routine is used to initialize the use of color. The start_color routine is not implemented at this time. Note Syntax #include int start_color(); Return Values Successful completion. An error occurred. OK ERR Description The start_color() routine initializes the use of color. It must be used if color is to be used in the program. It must be called before any other color routines, ideally right after initscr().
start color Implementation Considerations UNIX System V implementation See Also can_change_color(), color_content(), has_color(), init_color() , init_pair(), pair_content() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
subwin The subwin routine is used to create a subwindow relative to the physical screen. Syntax #include WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begin_y, int begin_x); Parameters orig nlines ncols begin y begin x The parent window of the subwindow. The number of lines in the subwindow. The number of columns in the subwindow The y (row) coordinate of the upper-left corner of the window. The x (column) coordinate of the upper-left corner of the window.
subwin When using subwindows, it is often necessary to call touchwin() before wrefresh() to maintain proper screen contents. Note The derwin() routine creates a subwindow in exactly the same way, but allows you to specify coordinates relative to window orig . Implementation Considerations Identical to XPG/3 See Also newwin(), touchwin(), derwin() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
termattrs The termattrs routine is used to return the video attributes supported by the terminal. Syntax #include chtype termattrs(); Return Values Successful completion. An error occurred. OK ERR Description The termattrs() routine returns a logical OR of all video attributes available on a terminal. Implementation Considerations UNIX System V implementation Portability UNIX System V 4-176 CURSES FINAL TRIM SIZE : 7.0 in x 8.
termname termname The termname routine is used to obtain the return value of the environmental variable TERM. Syntax #include char *termname(); Return Values On success, a pointer to the value of the environmental variable is returned; otherwise, a null pointer is returned. Description The termname() routine returns a pointer to the value of the environmental variable TERM (truncated to 14 characters).
tgetent The tgetent routine is used to look up the termcap name (interface to termcap library). Syntax #include int tgetent (char *bp, char *name); Parameters bp name A pointer to a bu er 1024 bytes long. The termcap entry to look up. Return Values -1 0 1 Cannot open termcap le. No entry in termcap. Successful completion. Description The tgetent() routine looks up the termcap entry for the terminal name.
tgetent Implementation Considerations UNIX System V implementation See Also setupterm() Portability HP-UX, UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
tgetflag The tgetflag routine is used to get the Boolean entry for termcap capability (interface to termcap library). Syntax #include int tgetflag (char id[2]); Parameters cap The capability for which to get the Boolean entry. Return Values Successful completion. An error occurred. TRUE FALSE Description The tgetflag() routine returns the Boolean value of the termcap cap . The tgetflag() routine is included for compatibility purposes with programs that use the termcap library.
tgetnum tgetnum The tgetnum routine is used to get the numeric entry for termcap capability (interface to termcap library). Syntax #include int tgetnum (char id[2]); Parameters cap The termcap capability for which to get the numeric entry. Return Values Returns the value of the numeric termcap entry, or returns -1 if the entry is not given for the terminal. Description The tgetnum() routine looks up the numeric entry for cap .
tgetstr The tgetstr routine is used to get the string entry for termcap capability (interface to termcap library). Syntax #include char *tgetstr (char cap[2], char **area); Parameters cap area The termcap capability for which to get the string entry. A pointer to the area where the decoded string is stored. Return Values On success, a pointer to the string is returned; otherwise, a null pointer is returned.
tgetstr See Also tigetstr(), tputs(), tparm() Portability HP-UX, UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
tgoto The tgoto routine is used to decode the cursor motion values (interface to termcap library). Syntax #include char *tgoto (char *cap, int col, int row); Parameters cap col row The pointer to the termcap capability for cursor motion. The column placement of the new cursor. The row placement of the new cursor. Return Values On success, a pointer to the decoded cursor addressing string is returned; otherwise, a null pointer is returned.
tgoto See Also mvcur() Portability HP-UX, UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
tigetflag tigetflag tigetnum tigetstr The tigetflag, tigetnum, and tigetstr routines are used to return the value of terminfo capability (interface to terminfo). Syntax #include int tigetflag (char *capname); int tigetnum (char *capname); char *tigetstr (char *capname); Parameters capname The name of the terminfo capability for which the value is required. Return Values The tigetflag() routine returns -1 if capname is not a Boolean capability.
tigetflag Implementation Considerations UNIX System V implementation See Also terminfo Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
timeout timeout wtimeout The timeout and wtimeout routines are used to set a timed blocking or nonblocking read for a window. Syntax #include int timeout(int delay); int wtimeout(WINDOW win, int delay); Parameters delay win The number of milliseconds to block or wait for input. A pointer to the window in which to set the timed blocking. Return Values Successful completion. An error occurred.
timeout Implementation Considerations UNIX System V implementation See Also wgetch(), nodelay() Portability UNIX System V CURSES FINAL TRIM SIZE : 7.0 in x 8.
touchwin touchwin touchline untouchwin wtouchln is linetouched is wintouched The touchwin set of routines is used to control the refresh of the window. Syntax #include
touchwin Return Values OK ERR Successful completion. An error occurred. Description The touchwin() routine marks the entire window as dirty. This makes it appear to CURSES as if the whole window has been changed, thus causing the entire window to be rewritten with the next call to wrefresh(). This is sometimes necessary when using overlapping windows; the change to one window is not re ected in the other and, hence is not recorded.
touchwin See Also wrefresh() Portability The touchwin() routine conforms to HP-UX, UNIX System V, and XPG/3. The touchline(), untouchwin(), wtouchln(), is_linetouched(), and is_wintouched() routines conform to UNIX System V. 4-192 CURSES FINAL TRIM SIZE : 7.0 in x 8.
tparm tparm The tparm routine is used to instantiate a parameterized string (interface to terminfo). Syntax #include char *tparm (char *str, long int p1, long int p2, long int p3, long int p4, long int p5, long int p6, int p7, long int p8, long int p9); Parameters p1...p9 str The parameters to be instantiated. A pointer to the string to be instantiated. Return Values On success, a pointer to parameterized string is returned; otherwise, a null pointer is returned.
tparm Implementation Considerations UNIX System V implementation See Also tputs() Portability HP-UX, UNIX System V 4-194 CURSES FINAL TRIM SIZE : 7.0 in x 8.
tputs tputs putp The tputs and putp routines are used to apply padding information and output string (interface to terminfo). Syntax #include int tputs (char *str, int affcnt, int (*putc) (int)); int putp (char *str); Parameters str a cnt putc A pointer to a terminfo variable or return value from tparm() or tigetstr(). The number of lines a ected, or 1 if not relevant. The output function. Return Values OK ERR Successful completion. An error occurred.
tputs The putp() routine calls tputs() as follows: tputs(str, 1, _putchar) The output of putp() goes to stdout, not to the le descriptor, ldes , speci ed in setupterm(). Note Implementation Considerations UNIX System V implementation See Also tigetstr(), tparm() Portability HP-UX, UNIX System V 4-196 CURSES FINAL TRIM SIZE : 7.0 in x 8.
traceon traceon traceoff The traceon and traceoff routines are used to enable or disable tracing. Syntax #include traceoff(); traceon(); Return Values OK ERR Successful completion. An error occurred. Description The traceon() and traceoff() routines turn on or turn o tracing, respectively. Since the volume of output produced by these routines can be very large, limit the area traced at a given time. The output generated by these routines is stored in a le called trace.out.
typeahead The typeahead routine is used to check for type-ahead characters. Syntax #include int typeahead (int fd); Parameters fd The le descriptor that is used to check for type-ahead characters. Return Values Successful completion. An error occurred. OK ERR Description The typeahead() routine speci es the le descriptor (fd ) to use to check for type-ahead characters (characters typed by the user but not yet processed by CURSES).
typeahead Implementation Considerations Identical to XPG/3 See Also wgetch(), wrefresh() Portability HP-UX, UNIX System V, XPG/3 CURSES FINAL TRIM SIZE : 7.0 in x 8.
unctrl The unctrl routine is used to convert a character to printable form. Syntax #include #include char *unctrl(chtype c); Return Values Returns a string. Description The uncntl() routine converts the character code c into a printable form (if unprintable). Control characters are displayed in the ^x notation where ^ identi es the control key, and x represents an alphanumeric character that is pressed while the control key is held down.
use env use env The use_env routine is used to set values of lines and columns. Syntax #include int use_env(char bool); Parameters bool A Boolean expression. Return Values OK ERR Successful completion. An error occurred. Description The use_env() routine takes the values for lines and columns from the terminfo database (if bool is FALSE), or from environmental variables (if bool is TRUE). If no environmental variables have been set, the window size is used.
vidputs vidputs vidattr The vidputs and vidattr routines are used to display a string with video attributes (interface to terminfo). Syntax #include int vidputs (chtype attrs, int (*putc) (int)); int vidattr (chtype attrs); Parameters attrs putc The attributes of the foreground window. The output function. Return Values Successful completion. An error occurred.
vidputs Table 4-8.
vidputs Implementation Considerations UNIX System V implementation Portability HP-UX, UNIX System V 4-204 CURSES FINAL TRIM SIZE : 7.0 in x 8.
Index A access control SVID IPC, 2-4 addch , 4-7 addchnstr, 4-12 addchstr, 4-12 addnstr, 4-15 addstr, 4-15 attaching shared memory, 2-38 attribute capabilities, 3-43 attro , 4-18 attron, 4-18 attrset, 4-18 B baudrate, 4-22 beep, 4-23 bkgd, 4-24 bkgdset, 4-24 boolean capabilities, 3-12, 3-55 border, 4-27 box, 4-27 C can change color, 4-81 capabilities attribute, 3-43 boolean, 3-3, 3-11, 3-55 con guration, 3-30 cursor movement, 3-36 edit, 3-40 margins, 3-48 miscellaneous, 3-52 names, 3-11 numeric, 3-3, 3-
baudrate, 4-22 beep, 4-23 bkgd, 4-24 bkgdset, 4-24 border, 4-27 box, 4-27 can change color, 4-81 cbreak, 4-31 clear, 4-33 clearok, 4-35 clrtobot, 4-36 clrtoeol, 4-38 color content, 4-81 color pair, 4-40 copywin, 4-41 cur set, 4-43 def prog mode, 4-44 def shell mode, 4-44 delay output, 4-48 delch, 4-49 del curterm, 4-46 deleteln, 4-51 delscreen, 4-53 delwin, 4-54 derwin, 4-56 doupdate, 4-153 dupwin, 4-58 echo, 4-59 echochar, 4-61 endwin, 4-63 erase, 4-65 erasechar, 4-67 ash, 4-23 ushinp, 4-68 getbegyx, 4-78
mvinsnstr, 4-102 mvinsstr, 4-102 mvinstr, 4-105 mvprintw, 4-146 mvscanw, 4-157 mvwaddch , 4-7 mvwaddchnstr, 4-12 mvwaddchstr, 4-12 mvwaddnstr, 4-15 mvwaddstr, 4-15 mvwdelch, 4-49 mvwgetch, 4-69 mvwgetstr, 4-76 mvwin, 4-123 mvwinch, 4-87 mvwinchnstr, 4-89 mvwinchstr, 4-89 mvwinnstr, 4-105 mvwinsch, 4-96 mvwinsnstr, 4-102 mvwinsstr, 4-102 mvwinstr, 4-105 mvwprintw, 4-146 mvwscanw, 4-157 napms, 4-125 newpad, 4-126 newterm, 4-128 newwin, 4-130 nl, 4-132 nocbreak, 4-31 nodelay, 4-133 noecho, 4-59 nonl, 4-132 noq
traceon, 4-197 typeahead, 4-198 unctrl, 4-200 ungetch, 4-69 untouchwin, 4-190 use env, 4-201 vidattr, 4-202 vidputs, 4-202 vwprintw, 4-146 vwscanw, 4-157 waddch , 4-7 waddchnstr, 4-12 waddchstr, 4-12 waddnstr, 4-15 waddstr, 4-15 wattro , 4-18 wattron, 4-18 wattrset, 4-18 wbkgd, 4-24 wbkgdset, 4-24 wborder, 4-27 wclear, 4-33 wclrtobot, 4-36 wclrtoeol, 4-38 wdelch, 4-49 wdeleteln, 4-51 wechochar, 4-61 werase, 4-65 wgetch, 4-69 wgetnstr, 4-76 wgetstr, 4-76 winch, 4-87 winchnstr, 4-89 winchstr, 4-89 winnstr, 4-
getbegyx, 4-78 getch, 4-69 getmaxyx, 4-78 getparyx, 4-78 getstr, 4-76 getyx, 4-78 insdelln, 4-98 insertln, 4-100 insnstr, 4-102 insstr, 4-102 instr, 4-105 intr ush, 4-108 IPCRM utility , 2-5 IPCS utility , 2-5 isendwin, 4-63 H K halfdelay, 4-80 has color, 4-81 has ic, 4-83 has il, 4-83 headers SVID IPC, 2-50 , 2-51 , 2-53 , 2-55
msgget(), 2-12 msgrcv(), 2-15 msgsnd(), 2-19 mvaddch , 4-7 mvaddchnstr, 4-12 mvaddchstr, 4-12 mvaddnstr, 4-15 mvaddstr, 4-15 mvcur, 4-121 mvdelch, 4-49 mvgetch, 4-69 mvgetstr , 4-76 mvinch, 4-87 mvinchnstr, 4-89 mvinchstr, 4-89 mvinnstr, 4-105 mvinsch, 4-96 mvinsnstr, 4-102 mvinsstr, 4-102 mvinstr, 4-105 mvprintw, 4-146 mvscanw, 4-157 mvwaddch , 4-7 mvwaddchnstr, 4-12 mvwaddchstr, 4-12 mvwaddnstr, 4-15 mvwaddstr, 4-15 mvwdelch, 4-49 mvwgetch, 4-69 mvwgetstr, 4-76 mvwin, 4-123 mvwinch, 4-87 mvwinchnstr, 4-89
returning shared memory identi er, 2-46 routines curses, 3-74, 4-1{204 terminfo, 3-1{77 S savetty, 4-156 scanw, 4-157 scr dump, 4-159 scrolling capabilities, 3-36 scrollok, 4-163 scr restore, 4-159 semaphores, 2-3 controlling, 2-23 header description, 2-55 operations, 2-32 returning identi er, 2-28 semctl(), 2-23 semget(), 2-28 semop(), 2-32 shmat(), 2-38 shmctl(), 2-41 shmdt(), 2-44 shmget(), 2-46 semctl(), 2-23 semget(), 2-28 semop(), 2-32 sending messages, 2-19 set curterm, 4-165 setscrreg, 4-168 set te
SVID IPC headers , 2-51 , 2-53 , 2-55 , 2-57 SVID IPC key ftok(), 2-7 SVID IPC message queues, 2-9 header description, 2-53 receiving messages, 2-15 returning identi er, 2-12 sending messages, 2-19 SVID IPC semaphore operations, 2-32 SVID IPC semaphores, 2-23 header description, 2-55 returning identi er, 2-28 SVID IPC shared memory header description, 2-57 SVIPC utility , 2-5 , 2-51 , 2-53 , 2-55
numeric, 3-57 string, 3-59 tabs, 3-48 terminfo, 3-11 vidattr, 4-202 vidputs, 4-202 vwprintw, 4-146 vwscanw, 4-157 W waddch , 4-7 waddchnstr, 4-12 waddchstr, 4-12 waddnstr, 4-15 waddstr, 4-15 wattro , 4-18 wattron, 4-18 wattrset, 4-18 wbkgd, 4-24 wbkgdset, 4-24 wborder, 4-27 wclear, 4-33 wclrtobot, 4-36 wclrtoeol, 4-38 wdelch, 4-49 wdeleteln, 4-51 wechochar, 4-61 werase, 4-65 wgetch, 4-69 wgetnstr, 4-76 wgetstr, 4-76 winch, 4-87 winchnstr, 4-89 winchstr, 4-89 winnstr, 4-105 winsch, 4-96 winsdelln, 4-98 win
FINAL TRIM SIZE : 7.0 in x 8.