Site Tools


getcap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

getcap [2007/02/02 23:17] (current)
Line 1: Line 1:
 +# $EPIC: getcap.txt,​v 1.3 2006/12/13 11:07:38 sthalik Exp $
 +======Synopsis:​======
 +$__getcap__(TERM <​capname>​ <​nametype>​ <​mangle>​)
 +
 +======Technical:​======
 +   * The first argument must be a capability type; currently only "​TERM"​ is supported.
 +   * If the <​capname>​ argument is omitted, the empty string is returned.
 +   * If the <​nametype>​ argument is omitted, the name type is taken as 0.
 +   * If the <​mangle>​ argument is omitted, the mangle value is taken as 1.
 +   * This function queries a capability database (currently only TERMinal capabilities are supported) for a given symbol (<​capname>​),​ the symbol is of a given type (<​nametype>​) and returns it.
 +   * The return value will be converted from a raw binary format into something that may be passed to /bind if <​mangle>​ is 1.
 +   * Values of <​nametype>:​ 0 - <​capname>​ is a full blown terminfo capability name
 +     * 1 - <​capname>​ is an abbreviated "​terminfo"​ capability name
 +     * 2 - <​capname>​ is an abbreviated "​termcap"​ capability name
 +   * Values of <​mangle>:​
 +     * 0 - The return value should not be modified [dangerous!]
 +     * 1 - Ascii characters 0 <= x < 32 shall be converted into the string "​^<​x+64>"​ and ascii character 127 converted into "​^?"​.
 +   * Values of <​capname>:​
 +     * See your system'​s 'man terminfo'​ man page for a list.
 +
 +======Practical:​======
 +If you need to query a terminal capability so you can output it to the screen
 +via /[[xecho]] -r, you could use this function to fetch the capability. You
 +could fetch a key capability (ie, key_f10) to bind a certain key, but the
 +/[[bind]] command already has a shortcut for that (/[[bind]] -symbolic
 +key_f10). The /[[bind]] -symbolic option uses the same underlying feature that
 +this function does.
 +
 +======Example:​======
 +$getcap(TERM has_meta_key 0 0) returns 1 if your TERM has a meta key.
 +
 +======Returns:​======
 +The terminal capability (if any) as requested.
  
getcap.txt ยท Last modified: 2007/02/02 23:17 (external edit)