[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


putp, tputs Subroutine

Purpose

Outputs commands to the terminal.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>
 
int putp(const char *str);
 
int tputs(const char *str,
int affcnt,
int (*putfunc)(int));

Description

These subroutines output commands contained in the terminfo database to the terminal.

The putp subroutine is equivalent to tputs(str, 1, putchar). The output of the putp subroutine always goes to stdout, not to the fildes specified in the setupterm subroutine.

The tputs subroutine outputs str to the terminal. The str argument must be a terminfo string variable or the return value from the tgetstr, tgoto, tigestr, or tparm subroutines. The affcnt argument is the number of lines affected, or 1 if not applicable. If the terminfo database indicates that the terminal in use requires padding after any command in the generated string, the tputs subroutine inserts pad characters into the string that is sent to the terminal, at positions indicated by the terminfo database. The tputs subroutine outputs each character of the generated string by calling the user-supplied putfunc subroutine (see below).

The user-supplied putfunc subroutine (specified as an argument to the tputs subroutine is either putchar or some other subroutine with the same prototype. The tputs subroutine ignores the return value of the putfunc subroutine.

Parameters


*str  
affcnt  
*putfunc  

Return Values

Upon successful completion, these subroutines return OK. Otherwise, they return ERR.

Examples

For the putp subroutine:

To call the tputs(my_string, 1, putchar) subroutine, enter:

char *my_string;
putp(my_string);

For the tputs subroutine:

  1. To output the clear screen sequence using the user-defined putchar-like subroutine my_putchar, enter:

    int_my_putchar();
    tputs(clear_screen, 1 ,my_putchar);
    
  2. To output the escape sequence used to move the cursor to the coordinates x=40, y=18 through the user-defined putchar-like subroutine my_putchar, enter:

    int_my_putchar();
    tputs(tparm(cursor_address, 18, 40), 1, my_putchar);
    

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The doupdate (doupdate, refresh, wnoutrefresh, or wrefresh Subroutines) subroutine, is_linetouched (is_linetouched, is_wintouched, touchline, touchwin, untouchwin, or wtouchin Subroutine) subroutine, putchar subroutine, tgetent (tgetent, tgetflag, tgetnum, tgetstr, or tgoto Subroutine) subroutine, tigetflag (tigetflag, tigetnum, tigetstr, or tparm Subroutine) subroutine, tputs (putp, tputs Subroutine) subroutine.

Curses Overview for Programming in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.

List of Curses Subroutines in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.

Understanding Terminals with Curses in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]