682
HP-UX Reference Section 3: Library Functions (A-M) HP-UX 11i Version 2 Volume 6 of 9 Manufacturing Part Number : B2355-90784 Printed In USA E0803 Printed in USA © Copyright 1983-2003 Hewlett-Packard Development Company LP.

HP-UX Referenceh20628. Preface HP-UX is the Hewlett-Packard Company’s implementation of an operating system that is compatible with various industry standards. It

  • Upload
    vodieu

  • View
    221

  • Download
    2

Embed Size (px)

Citation preview

HP-UX Reference

Section 3: Library Functions(A-M)

HP-UX 11i Version 2

Volume 6 of 9

Manufacturing Part Number : B2355-90784

Printed In USA

E0803

Printed in USA

© Copyright 1983-2003 Hewlett-Packard Development Company LP.

ii

Legal NoticesThe information in this document is subject to change without notice.

Hewlett-Packard makes no warranty of any kind with regard to thismanual, including, but not limited to, the implied warranties ofmerchantability and fitness for a particular purpose. Hewlett-Packardshall not be held liable for errors contained herein or direct, indirect,special, incidental or consequential damages in connection with thefurnishing, performance, or use of this material.

Use of this document and any supporting software media is restricted tothis product only. Additional copies of the programs may be made forsecurity and back-up purposes only. Resale of the programs, in theirpresent form or with alterations, is expressly prohibited.

Warranty

A copy of the specific warranty terms applicable to your Hewlett-Packardproduct and replacement parts can be obtained from your local Sales andService Office.

U.S. Government License

Proprietary computer software. Valid license from HP required forpossession, use or copying. Consistent with FAR 12.211 and 12.212,Commercial Computer Software, Computer Software Documentation,and Technical Data forCommercial Items are licensed to the U.S.Government under vendor’s standard commercial license.

Copyright Notices

Reproduction, adaptation, or translation of this document without priorwritten permission is prohibited, except as allowed under the copyrightlaws.

This document and the software it describes may also be protected underone or more of the following copyrights. Additional copyrights areacknowledged in some individual manpages.

Copyright 1983-2003 Hewlett-Packard Development Company, LP.

Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Universityof California.

iii

Copyright 1980, 1984, 1986 Novell, Inc.

Copyright 1985, 1986, 1988 Massachusetts Institute of Technology

Copyright 1986-2000 Sun Microsystems, Inc.

Copyright 1988 Carnegie Mellon University

Copyright 1989-1991 The University of Maryland

Copyright 1989-1993 The Open Software Foundation, Inc.

Copyright 1990 Motorola, Inc.

Copyright 1990-1992 Cornell University

Copyright 1991-2003 Mentat, Inc.

Copyright 1996 Morning Star Technologies, Inc.

Copyright 1996 Progressive Systems, Inc.

Trademark Notices

Intel and Itanium are registered trademarks of Intel Corporation inthe US and other countries and are used under license.

Java is a US trademark of Sun Microsystems, Inc.

Microsoft and MS-DOS are U.S. registered trademarks of MicrosoftCorporation.

OSF/Motif is a trademark of The Open Group in the US and othercountries.

UNIX is a registered trademark of The Open Group.

X Window System is a trademark of The Open Group.

iv

Revision HistoryThis document’s printing date and part number indicate its edition. Theprinting date changes when a new edition is printed. (Minor correctionsand updates which are incorporated at reprint do not cause the date tochange.) New editions of this manual incorporate all material updatedsince the previous edition.

Part Number Date, Release, Format, Distribution

B2355-60103 August 2003. HP-UX release 11i version 2, one volumeHTML, docs.hp.com and Instant Information.

B2355-90779-87 August 2003. HP-UX release 11i version 2, ninevolumes PDF, docs.hp.com and print.

B9106-90010 June 2002. HP-UX release 11i version 1.6, one volumeHTML, docs.hp.com and Instant Information.

B9106-90007 June 2001. HP-UX release 11i version 1.5, sevenvolumes HTML, docs.hp.com and Instant Information.

B2355-90688 December 2000. HP-UX release 11i version 1, ninevolumes.

B2355-90166 October 1997. HP-UX release 11.0, five volumes.

B2355-90128 July 1996. HP-UX release 10.20, five volumes, onlineonly.

B2355-90052 July 1995. HP-UX release 10.0, four volumes.

ConventionsWe use the following typographical conventions.

audit (5) An HP-UX manpage. audit is the name and 5 is thesection in the HP-UX Reference. On the web and on theInstant Information CD, it may be a hot link to the

v

manpage itself. From the HP-UX command line, youcan enter “man audit ” or “man 5 audit ” to view themanpage. See man (1).

Book Title The title of a book. On the web and on the InstantInformation CD, it may be a hot link to the book itself.

KeyCap The name of a keyboard key. Note that Return and Enterboth refer to the same key.

Emphasis Text that is emphasized.

Emphasis Text that is strongly emphasized.

ENVIRONVAR The name of an environment variable.

[ERRORNAME] The name of an error number, usually returned in theerrno variable.

Term The defined use of an important word or phrase.

ComputerOutput Text displayed by the computer.

UserInput Commands and other text that you type.

Command A command name or qualified command phrase.

Variable The name of a variable that you may replace in acommand or function or information in a display thatrepresents several possible values.

[ ] The contents are optional in formats and commanddescriptions. If the contents are a list separated by |,you may choose one of the items.

{ } The contents are required in formats and commanddescriptions. If the contents are a list separated by |,you must choose one of the items.

... The preceding element may be repeated an arbitrarynumber of times.

| Separates items in a list of choices.

vi

vii

PrefaceHP-UX is the Hewlett-Packard Company’s implementation of anoperating system that is compatible with various industry standards. Itis based on the UNIX System V Release 4 operating system andincludes important features from the Fourth Berkeley SoftwareDistribution.

The nine volumes of this manual contain the system referencedocumentation, made up of individual entries called manpages, namedfor the man command that displays them on the system. The entries arealso known as manual pages or reference pages.

GeneralIntroduction

For a general introduction to HP-UX and the structure and format of themanpages, please see the introduction (9) manpage in volume 9.

SectionIntroductions

The manpages are divided into sections that also have introduction(intro) manpages that describe the contents. These are:

intro (1) Section 1: User Commands(A-M in volume 1; N-Z in volume 2)

intro (1M) Section 1M: System Administration Commands(A-M in volume 3; N-Z in volume 4)

intro (2) Section 2: System Calls(in volume 5)

intro (3C) Section 3: Library Functions(A-M in volume 6; N-Z in volume 7)

intro (4) Section 4: File Formats(in volume 8)

intro (5) Section 5: Miscellaneous Topics(in volume 9)

intro (7) Section 7: Device (Special) Files(in volume 9)

intro (9) Section 9: General Information(in volume 9)

viii

Volume SixTable of Contents

Section 3

Volume SixTable of Contents

Section 3

Table of ContentsVolumes Six and Seven

Section 3: Library Functions Entry Name(Section): name Descriptionintro(3): intro() ............................................................................. introduction to subroutines and librariesa64l(3C): a64l() , l64a() , l64a_r() ....................... convert between long integer and base-64 ASCII stringabort(3C): abort() ......................................................................................... generate a software abort faultabs(3C): abs() , abs() ....................................................................................... return integer absolute valueaclentrystart() : convert string to access control list (ACL) structure ................................. see strtoacl(3C)aclsort(3C): aclsort ................................................................................................. sort ACL entries on JFSacltostr(3C): acltostr() ....................................... convert access control list (ACL) structure to string formacos(3M): acos() , acosf() , acosl() , acosw() , acosq() ............................................. arccosine functionsacosd(3M): acosd() , acosdf() , acosdl() , acosdw() , acosdq() ......... degree-valued arccosine functionsacosdf() : degree-valued arccosine function (float) ................................................................... see acosd(3M)acosdl() : degree-valued arccosine function (long double) ....................................................... see acosd(3M)acosdq() : degree-valued arccosine function (quad) .................................................................. see acosd(3M)acosdw() : degree-valued arccosine function (extended) ........................................................... see acosd(3M)acosf() : arccosine function (float) .............................................................................................. see acos(3M)acosh(3M): acosh() , acoshf() , acoshl() , acoshw() , acoshq() ............. arc hyperbolic cosine functionsacoshf() : arc hyperbolic cosine function (float) ....................................................................... see acosh(3M)acoshl() : arc hyperbolic cosine function (long double) ............................................................ see acosh(3M)acoshq() : arc hyperbolic cosine function (quad) ....................................................................... see acosh(3M)acoshw() : arc hyperbolic cosine function (extended) ................................................................ see acosh(3M)acosl() : arccosine function (long double) ................................................................................... see acos(3M)acosq() : arccosine function (quad) .............................................................................................. see acos(3M)acosw() : arccosine function (extended) ....................................................................................... see acos(3M)addch(3X): addch() , mvaddch() , mvwaddch() , waddch

........................................ add a single-byte character and rendition to a window and advance the cursoraddchnstr(3X): mvaddchnstr() , mvwaddchnstr() , waddchnstr()

........................................ add length limited string of single-byte characters and renditions to a windowaddchstr(3X): mvaddchstr() , mvwaddchstr() , waddchstr()

................................................................ add string of single-byte characters and renditions to a windowaddmntent() : get file system descriptor file entry ............................................................. see getmntent(3X)addnstr(3X): addstr() , mvaddnstr() , mvaddstr() , mvwaddnstr() , mvwaddstr() , waddnstr() ,

waddstr() ...... add a string of multi-byte characters without rendition to a window and advance cursoraddnwstr(3X): addnwstr() , addwstr() , mvaddnwstr() , mvaddwstr() , mvwaddnwstr() , mvwaddwstr() ,

waddnwstr() , waddwstr() ................ add a wide-character string to a window and advance the cursoraddsev(3C): addsev() ........................................................................................... define additional severitiesaddstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)addwstr() : add a wide-character string to a window and advance the cursor ...................... see addnwstr(3X)add_wch(3X): add_wch() , mvadd_wch() , mvwadd_wch() ,

wadd_ch() ................................................................ add a complex character and rendition to a windowadd_wchnstr(3X): add_wchstr() , mvadd_wchnstr() , mvadd_wchstr() , mvwadd_wchnstr() ,

mvwadd_wchstr , wadd_wchnstr ,wadd_wchstr ......................................... add an array of complex characters and renditions to a window

add_wchstr() : add an array of complex characters and renditions to a window ........... see add_wchnstr(3X)ADVANCE(): process 16-bit characters ............................................................................... see nl_tools_16(3X)advance() : regular expression compile and match routines ................................................... see regexp(3X)alloca() : allocate space from the stack .................................................................................. see malloc(3C)alphasort() - sort a directory pointer array ............................................................................ see scandir(3C)annuity(3M): annuity() , annuityf() , annuityl() , annuityw() , annuityq()present value factor for annuityannuityf() : present value factor for annuity (float) ............................................................ see annuity(3M)annuityl() : present value factor for annuity (long double) ................................................. see annuity(3M)annuityq() : present value factor for annuity (quad) ........................................................... see annuity(3M)annuityw() : present value factor for annuity (extended) ..................................................... see annuity(3M)asctime() : convert date and time to string ............................................................................... see ctime(3C)asctime_r() : convert date and time to string ........................................................................... see ctime(3C)asin(3M): asin() , asinf() , asinl() , asinw() , asinq() ................................................ arcsine functions

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company ix

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionasind(3M): asind() , asindf() , asindl() , asindw() , asindq() ............ degree-valued arcsine functionsasindf() : degree-valued arcsine function (float) ...................................................................... see asind(3M)asindl() : degree-valued arcsine function (long double) ........................................................... see asind(3M)asindq() : degree-valued arcsine function (quad) ..................................................................... see asind(3M)asindw() : degree-valued arcsine function (extended) ............................................................... see asind(3M)asinf() : arcsine function (float) .................................................................................................. see asin(3M)asinh(3M): asinh() , asinhf() , asinhl() , asinhw() , asinhq() ................. arc hyperbolic sine functionsasinhf() : arc hyperbolic sine function (float) ........................................................................... see asinh(3M)asinhl() : arc hyperbolic sine function (long double) ................................................................ see asinh(3M)asinhq() : arc hyperbolic sine function (quad) .......................................................................... see asinh(3M)asinhw() : arc hyperbolic sine function (extended) .................................................................... see asinh(3M)asinl() : arcsine function (long double) ....................................................................................... see asin(3M)asinq() : arcsine function (quad) ................................................................................................. see asin(3M)asinw() : arcsine function (extended) ........................................................................................... see asin(3M)assert(3X): assert() ................................................................................................ verify program assertionatan(3M): atan() , atanf() , atanl() , atanw() , atanq() .......................................... arctangent functionsatan2(3M): atan2() , atan2f() , atan2l() , atan2w() , atan2q() ....... arctangent-and-quadrant functionsatan2d(3M): atan2d() , atan2df() , atan2dl() , atan2dw() ,

atan2dq() .................................................................. degree-valued arctangent-and-quadrant functionsatan2df() : degree-valued arctangent-and-quadrant function (float) ..................................... see atan2d(3M)atan2dl() : degree-valued arctangent-and-quadrant function (long double) .......................... see atan2d(3M)atan2dq() : degree-valued arctangent-and-quadrant function (quad) .................................... see atan2d(3M)atan2dw() : degree-valued arctangent-and-quadrant function (extended) .............................. see atan2d(3M)atan2f() : arctangent-and-quadrant function (float) ................................................................. see atan2(3M)atan2l() : arctangent-and-quadrant function (long double) ..................................................... see atan2(3M)atan2q() : arctangent-and-quadrant function (quad) ................................................................ see atan2(3M)atan2w() : arctangent-and-quadrant function (extended) ......................................................... see atan2(3M)atand(3M): atand() , atandf() , atandl() , atandw() , atandq() ...... degree-valued arctangent functionsatandf() : degree-valued arctangent function (float) ................................................................ see atand(3M)atandl() : degree-valued arctangent function (long double) ..................................................... see atand(3M)atandq() : degree-valued arctangent function (quad) ............................................................... see atand(3M)atandw() : degree-valued arctangent function (extended) ......................................................... see atand(3M)atanf() : arctangent function (float) ............................................................................................ see atan(3M)atanh(3M): atanh() , atanhf() , atanhl() , atanhw() , atanhq() ........... arc hyperbolic tangent functionsatanhf() : arc hyperbolic tangent function (float) ..................................................................... see atanh(3M)atanhl() : arc hyperbolic tangent function (long double) .......................................................... see atanh(3M)atanhq() : arc hyperbolic tangent function (quad) .................................................................... see atanh(3M)atanhw() : arc hyperbolic tangent function (extended) ............................................................. see atanh(3M)atanl() : arctangent function (long double) ................................................................................. see atan(3M)atanq() : arctangent function (quad) ........................................................................................... see atan(3M)atanw() : arctangent function (extended) .................................................................................... see atan(3M)atexit(3): atexit() .................................................... register a function to be called at program terminationatof() : convert string to double-precision number ................................................................... see strtod(3C)atoi() : convert string to integer ................................................................................................ see strtol(3C)atol() : convert string to integer ................................................................................................ see strtol(3C)attroff(3X): attron() , attrset() , wattroff() , wattron() , wattrset()

............................................................................................. restricted window attribute control functionsattron() : restricted window attribute control functions ............................................................. see attroff(3X)attrset() : restricted window attribute control functions .......................................................... see attroff(3X)attr_get(3X): attr_off() , attr_on() , attr_set() , color_set() , wattr_get() , wattr_off() ,

wattr_on() , wattr_set() , wcolor_set() .................................... window attribute control functionsattr_off() : window attribute control functions ...................................................................... see attr_get(3X)attr_on() : window attribute control functions ........................................................................ see attr_get(3X)attr_set() : window attribute control functions ...................................................................... see attr_get(3X)authdes_create() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)authdes_seccreate() : library routines for secure remote procedure calls ................... see secure_rpc(3N)authnone_create() : library routines for client side rpc authentication .................. see rpc_clnt_auth(3N)authsys_create() : library routines for client side rpc authentication .................... see rpc_clnt_auth(3N)authsys_create_default() : library routines for client side rpc authentication .... see rpc_clnt_auth(3N)authunix_create() : obsolete library routine for RPC ......................................................... see rpc_soc(3N)authunix_create_default() : obsolete library routine for RPC ........................................ see rpc_soc(3N)

x Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionauth_destroy() : library routines for client side rpc authentication ......................... see rpc_clnt_auth(3N)basename(3C): basename() , dirname() ................................................ extract components of a path namebaudrate(3X): baudrate .............................................................................................. get terminal baud ratebcmp() : memory operations, compare bytes ........................................................................... see memory(3C)bcopy() : memory operations, copy bytes ............................................................................... see memory(3C)beep(3X): beep() ........................................................................................................................ audible signalbgets(3G): bgets() ....................................................................................... read stream up to next delimiterbigcrypt(3C): bigcrypt() ........................................................ generate hashing encryption on large stringsbindresvport(3N): bindresvport() ..................................................... bind a socket to a privileged IP portbkgd() : set or get background character and rendition using a single-byte character .................. see bkgd(3X)bkgd(3X): bkgd() , bkgdset() , getbkgd() , wbkgd() , wbkgdset()

............................................ set or get background character and rendition using a single-byte characterbkgdset() : set or get background character and rendition using a single-byte character ............ see bkgd(3X)bkgrnd() : set or get background character and rendition using a complex character .............. see bkgrnd(3X)bkgrnd(3X): bkgrnd() , bkgrndset() , getbkgrnd() , wbkgrnd() , wbkgrndset() , wgetbkgrnd()

................................................ set or get background character and rendition using a complex characterbkgrndset() : set or get background character and rendition using a complex character ........ see bkgrnd(3X)blclose( ) - terminal block-mode library interface .................................................................. see blmode(3C)blget( ) - terminal block-mode library interface ...................................................................... see blmode(3C)blmode(3C): blmode() ......................................................................... terminal block-mode library interfaceblopen( ) - terminal block-mode library interface .................................................................... see blmode(3C)blread( ) - terminal block-mode library interface .................................................................... see blmode(3C)blset( ) - terminal block-mode library interface ...................................................................... see blmode(3C)border(3X): wborder() .......................................... draw borders from single-byte characters and renditionsborder_set(3X): wborder_set() ............................... draw borders from complex characters and renditionsbox(3X): box() ......................................................... draw borders from single-byte characters and renditionsbox_set(3X): box_set() .............................................. draw borders from complex characters and renditionsbsdproc(3C): killpg() , getpgrp() , setpgrp() ,

signal() ............................................................................. 4.2 BSD-compatible process control facilitiesbsd_signal(3C): bsd_signal() .............................................................................. simplified signal facilitiesbsearch(3C): bsearch() ...................................................................................... binary search a sorted tablebtowc() : convert single-byte to wide-character ......................................................................... see btowc(3C)btowc(3C): wctob(3C) .......................................................... convert between single-byte and wide-characterbufsplit(3G): bufsplit() .............................................................................................. split buffer into fieldsbwtmpname() : write records into new wtmps and btmps database ........................................ see bwtmps(3C)bwtmps(3C): bwtmpname() , updatebwdb() , getbwent() , setbwent() ,

endbwent() ............................................................... write records into new wtmps and btmps databasebyteorder(3N): htonl() , htons() , ntohl() , ntohs() convert values between host and network byte orderbyte_status() , BYTE_STATUS(): process 16-bit characters ......................................... see nl_tools_16(3X)bzero() : memory operations, clear bytes .............................................................................. see memory(3C)cabs(3M): cabs() , cabsf() , cabsl() , cabsw() , cabsq() ....................... complex absolute value functionscabsf() : complex absolute value function (float) ........................................................................ see cabs(3M)cabsl() : complex absolute value function (long double) ............................................................. see cabs(3M)cabsq() : complex absolute value function (quad) ....................................................................... see cabs(3M)cabsw() : complex absolute value function (extended) ................................................................. see cabs(3M)cacos(3M): cacos() , cacosf() , cacosl() , cacosw() , cacosq() ................... complex arccosine functionscacosf() : complex arccosine function (float) ............................................................................. see cacos(3M)cacosh(3M): cacosh() , cacoshf() , cacoshl() , cacoshw() , cacoshq()complex arc hyperbolic cosine functionscacoshf() : complex arc hyperbolic cosine function (float) ...................................................... see cacosh(3M)cacoshl() : complex arc hyperbolic cosine function (long double) .......................................... see cacosh(3M)cacoshq() : complex arc hyperbolic cosine function (quad) ..................................................... see cacosh(3M)cacoshw() : complex arc hyperbolic cosine function (extended) .............................................. see cacosh(3M)cacosl() : complex arccosine function (long double) ................................................................. see cacos(3M)cacosq() : complex arccosine function (quad) ............................................................................ see cacos(3M)cacosw() : complex arccosine function (extended) ..................................................................... see cacos(3M)calloc() : allocate memory for array ....................................................................................... see malloc(3C)callrpc() : obsolete library routine for RPC ......................................................................... see rpc_soc(3N)can_change_color(3X): can_change_color() , color_content() , has_colors() , init_color() ,

init_pair() , start_color() , pair_content() ................................... color manipulation functionscarg(3M): carg() , cargf() , cargl() , cargw() , cargq() .............................. complex argument functionscargf() : complex argument function (float) ................................................................................ see carg(3M)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xi

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptioncargl() : complex argument function (long double) .................................................................... see carg(3M)cargq() : complex argument function (quad) ............................................................................... see carg(3M)cargw() : complex argument function (extended) ........................................................................ see carg(3M)casin(3M): casin() , casinf() , casinl() , casinw() , casinq() ...................... complex arcsine functionscasinf() : complex arcsine function (float) ................................................................................ see casin(3M)casinh(3M): casinh() , casinhf() , casinhl() , casinhw() , casinhq()complex arc hyperbolic sine functionscasinhf() : complex arc hyperbolic sine function (float) ......................................................... see casinh(3M)casinhl() : complex arc hyperbolic sine function (long double) .............................................. see casinh(3M)casinhq() : complex arc hyperbolic sine function (quad) ........................................................ see casinh(3M)casinhw() : complex arc hyperbolic sine function (extended) .................................................. see casinh(3M)casinl() : complex arcsine function (long double) ..................................................................... see casin(3M)casinq() : complex arcsine function (quad) ............................................................................... see casin(3M)casinw() : complex arcsine function (extended) ......................................................................... see casin(3M)catan(3M): catan() , catanf() , catanl() , catanw() , catanq() ................ complex arctangent functionscatanf() : complex arctangent function (float) .......................................................................... see catan(3M)catanh(3M): catanh() , catanhf() , catanhl() , catanhw() , catanhq()complex arc hyperbolic tangent functionscatanhf() : complex arc hyperbolic tangent function (float) ................................................... see catanh(3M)catanhl() : complex arc hyperbolic tangent function (long double) ........................................ see catanh(3M)catanhq() : complex arc hyperbolic tangent function (quad) .................................................. see catanh(3M)catanhw() : complex arc hyperbolic tangent function (extended) ............................................ see catanh(3M)catanl() : complex arctangent function (long double) ............................................................... see catan(3M)catanq() : complex arctangent function (quad) ......................................................................... see catan(3M)catanw() : complex arctangent function (extended) ................................................................... see catan(3M)catclose() : close NLS message catalog for reading ............................................................. see catopen(3C)catgets(3C): catgets() ............................................................................................... get a program messagecatopen(3C): catopen() , catclose() ................................. open or close NLS message catalog for readingcbreak(3X): cbreak() , nocbreak() , noraw() , raw() .................................... input mode control functionscbrt(3M): cbrt() , cbrtf() , cbrtl() , cbrtw() , cbrtq() ............................................. cube root functionscbrtf() : cube root function (float) ............................................................................................... see cbrt(3M)cbrtl() : cube root function (long double) .................................................................................... see cbrt(3M)cbrtq() : cube root function (quad) .............................................................................................. see cbrt(3M)cbrtw() : cube root function (extended) ........................................................................................ see cbrt(3M)ccos(3M): ccos() , ccosf() , ccosl() , ccosw() , ccosq() .................................... complex cosine functionsccosf() : complex cosine function (float) ...................................................................................... see ccos(3M)ccosh(3M): ccosh() , ccoshf() , ccoshl() , ccoshw() , ccoshq() ...... complex hyperbolic cosine functionsccoshf() : complex hyperbolic cosine function (float) ................................................................ see ccosh(3M)ccoshl() : complex hyperbolic cosine function (long double) .................................................... see ccosh(3M)ccoshq() : complex hyperbolic cosine function (quad) ............................................................... see ccosh(3M)ccoshw() : complex hyperbolic cosine function (extended) ........................................................ see ccosh(3M)ccosl() : complex cosine function (long double) .......................................................................... see ccos(3M)ccosq() : complex cosine function (quad) ..................................................................................... see ccos(3M)ccosw() : complex cosine function (extended) .............................................................................. see ccos(3M)ceil(3M): ceil() , ceilf() , ceill() , ceilw() , ceilq() .................................................. ceiling functionsceilf() : ceiling function (float) .................................................................................................... see ceil(3M)ceill() : ceiling function (long double) ......................................................................................... see ceil(3M)ceilq() : ceiling function (quad) ................................................................................................... see ceil(3M)ceilw() : ceiling function (extended) ............................................................................................. see ceil(3M)cexp(3M): cexp() , cexpf() , cexpl() , cexpw() , cexpq() ........................... complex exponential functionscexpf() : complex exponential function (float) ............................................................................ see cexp(3M)cexpl() : complex exponential function (long double) ................................................................. see cexp(3M)cexpq() : complex exponential function (quad) ........................................................................... see cexp(3M)cexpw() : complex exponential function (extended) ..................................................................... see cexp(3M)cfgetispeed() : get tty intput baud rate .................................................................................. see cfspeed(3C)cfgetospeed() : get tty output baud rate ................................................................................. see cfspeed(3C)cfsetispeed() : set tty intput baud rate .................................................................................. see cfspeed(3C)cfsetospeed() : set tty output baud rate ................................................................................. see cfspeed(3C)cfspeed(3C): cfgetospeed() , cfsetospeed() , cfgetispeed() , cfsetispeed() tty baud rate functionsCHARADV(): process 16-bit characters ............................................................................... see nl_tools_16(3X)CHARAT() : process 16-bit characters ................................................................................. see nl_tools_16(3X)chgat(3X): chgat() , mvchgat() , mvwchgat() , wchgat() ...... change renditions of characters in a windowchownacl(3C): chownacl() ....................................... change owner and/or group in access control list (ACL)

xii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptioncimag(3M): cimag() , cimagf() ................................................................ complex imaginary-part functionscimagf() : complex imaginary-part function (float) .................................................................. see cimag(3M)cimagl() : complex imaginary-part function (long double) ....................................................... see cimag(3M)cimagq() : complex imaginary-part function (quad) ................................................................. see cimag(3M)cimagw() : complex imaginary-part function (extended) ........................................................... see cimag(3M)cis(3M): cis() , cisf() , cisl() , cisw() , cisq() .................................................... cosine plus i times sinecisf() : cosine plus i times sine (float) ............................................................................................ see cis(3M)cisl() : cosine plus i times sine (long double) ................................................................................ see cis(3M)cisq() : cosine plus i times sine (quad) ........................................................................................... see cis(3M)cisw() : cosine plus i times sine (extended) .................................................................................... see cis(3M)clear(3X): clear() , erase() , wclear() , werase() ............................................................. clear a windowclearenv(3C): clearenv() ............................................................................... clear the process environmentclearerr() : stream status inquiries ......................................................................................... see ferror(3S)clearerr_unlocked() : stream status inquiries ...................................................................... see ferror(3S)clearok(3X): clearok() , idleok() , leaveok() , scrollok() , setscrreg() , wsetscrreg()

............................................................................................................... terminal output control functionsclntraw_create() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)clnttcp_create() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)clntudp_bufcreate() : obsolete library routine for RPC ..................................................... see rpc_soc(3N)clntudp_create() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)clnt_broadcast() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)clnt_call() : library routine for client side calls, rpc ............................................... see rpc_clnt_calls(3N)clnt_control() : library routines for dealing with CLIENT handles, rpc ............. see rpc_clnt_create(3N)clnt_create() : library routines for dealing with CLIENT handles, rpc ............... see rpc_clnt_create(3N)clnt_create_vers() : library routines for dealing with CLIENT handles, rpc ..... see rpc_clnt_create(3N)clnt_destroy() : library routines for dealing with CLIENT handles, rpc ............. see rpc_clnt_create(3N)clnt_dg_create() : library routines for dealing with CLIENT handles, rpc ......... see rpc_clnt_create(3N)clnt_freeres() : library routine for client side calls, rpc ......................................... see rpc_clnt_calls(3N)clnt_geterr() : library routine for client side calls, rpc ........................................... see rpc_clnt_calls(3N)clnt_pcreateerror() : library routines for dealing with CLIENT handles, rpc ... see rpc_clnt_create(3N)clnt_perrno() : library routine for client side calls, rpc ........................................... see rpc_clnt_calls(3N)clnt_perror() : library routine for client side calls, rpc ........................................... see rpc_clnt_calls(3N)clnt_raw_create() : library routines for dealing with CLIENT handles, rpc ....... see rpc_clnt_create(3N)clnt_spcreateerror() : library routines for dealing with CLIENT handles, rpc . see rpc_clnt_create(3N)clnt_sperrno() : library routine for client side calls, rpc ......................................... see rpc_clnt_calls(3N)clnt_sperror() : library routine for client side calls, rpc ......................................... see rpc_clnt_calls(3N)clnt_tli_create() : library routines for dealing with CLIENT handles, rpc ....... see rpc_clnt_create(3N)clnt_tp_create() : library routines for dealing with CLIENT handles, rpc ......... see rpc_clnt_create(3N)clnt_vc_create() : library routines for dealing with CLIENT handles, rpc ......... see rpc_clnt_create(3N)clock(3C): clock() ......................................................................................................... report CPU time usedclog(3M): clog() , clogf() , clogl() , clogw() , clogq() ............................... complex logarithm functionsclogf() : complex logarithm function (float) ................................................................................ see clog(3M)clogl() : complex logarithm function (long double) ..................................................................... see clog(3M)clogq() : complex logarithm function (quad) ............................................................................... see clog(3M)clogw() : complex logarithm function (extended) ......................................................................... see clog(3M)closedir() : directory operations ....................................................................................... see directory(3C)closelog() : control system log ................................................................................................ see syslog(3C)clrtobot(3X): clrtobot() , wclrtobot() ................................................ clear from cursor to end of windowclrtoeol(3X): clrtoeol() , wclrtoeol() ...................................................... clear from cursor to end of linecolor_content() : color manipulation functions ................................................... see can_change_color(3X)color_set() : window attribute control functions .................................................................... see attr_get(3X)COLS(3X): COLS() ............................................................................... number of columns on terminal screencompile() : regular expression compile and match routines ................................................... see regexp(3X)compound(3M): compound() , compoundf() , compoundl() , compoundw() , compoundq()

............................................................................................................................ compound interest factorcompoundf() : compound interest factor (float) ................................................................ see compound(3M)compoundl() : compound interest factor (long double) ..................................................... see compound(3M)compoundq() : compound interest factor (quad) ................................................................ see compound(3M)compoundw() : compound interest factor (extended) ......................................................... see compound(3M)confstr(3C): confstr() ....................................................................... get string-valued configuration valuesconj(3M): conj() , conjf() , conjl() , conjw() , conjq() ............................... complex conjugate functions

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xiii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionconjf() : complex conjugate function (float) ................................................................................ see conj(3M)conjl() : complex conjugate function (long double) ..................................................................... see conj(3M)conjq() : complex conjugate function (quad) ............................................................................... see conj(3M)conjw() : complex conjugate function (extended) ......................................................................... see conj(3M)conv(3C): toupper() , tolower() , _toupper() , _tolower() , toascii() ................ translate characterscopydvagent : copy device assignment structure ................................................................ see getdvagent(3)copylist(3C): copylist() ........................................................................................... copy a file into memorycopysign(3M): copysign() , copysignf() , copysignl() , copysignw() , copysignq() copysign functionscopysignf() : copysign function (float) ............................................................................... see copysign(3M)copysignl() : copysign function (long double) .................................................................... see copysign(3M)copysignq() : copysign function (quad) .............................................................................. see copysign(3M)copysignw() : copysign function (extended) ........................................................................ see copysign(3M)copywin(3X): copywin() ........................................................................................... copy a region of windowcos(3M): cos() , cosf() , cosl() , cosw() , cosq() .............................................................. cosine functionscosd(3M): cosd() , cosdf() , cosdl() , cosdw() , cosdq() ............... cosine functions of a degree argumentcosdf() : cosine function of a degree argument (float) ................................................................ see cosd(3M)cosdl() : cosine function of a degree argument (long double) ..................................................... see cosd(3M)cosdq() : cosine function of a degree argument (quad) ................................................................ see cosd(3M)cosdw() : cosine function of a degree argument (extended) ......................................................... see cosd(3M)cosf() : cosine function (float) ........................................................................................................ see cos(3M)cosh(3M): cosh() , coshf() , coshl() , coshw() , coshq() ................................ hyperbolic cosine functionscoshf() : hyperbolic cosine function (float) .................................................................................. see cosh(3M)coshl() : hyperbolic cosine function (long double) ...................................................................... see cosh(3M)coshq() : hyperbolic cosine function (quad) ................................................................................. see cosh(3M)coshw() : hyperbolic cosine function (extended) .......................................................................... see cosh(3M)cosl() : cosine function (long double) ............................................................................................ see cos(3M)cosq() : cosine function (quad) ....................................................................................................... see cos(3M)cosw() : cosine function (extended) ................................................................................................ see cos(3M)cpacl(3C): cpacl() , fcpacl() ................................................... copy access control list (ACL) to another filecpow(3M): cpow() , cpowf() , cpowl() , cpoww() , cpowq() ................................... complex power functionscpowf() : complex power function (float) .................................................................................... see cpow(3M)cpowl() : complex power function (long double) ......................................................................... see cpow(3M)cpowq() : complex power function (quad) ................................................................................... see cpow(3M)cpoww() : complex power function (extended) ............................................................................. see cpow(3M)cproj(3M): cproj() , cprojf() , cprojl() , cprojw() , cprojq() .................. complex projection functionscprojf() : complex projection function (float) ............................................................................ see cproj(3M)cprojl() : complex projection function (long double) ................................................................. see cproj(3M)cprojq() : complex projection function (quad) ........................................................................... see cproj(3M)cprojw() : complex projection function (extended) ..................................................................... see cproj(3M)creal(3M): creal() , crealf() , creall() , crealw() , crealq() .................... complex real-part functionscrealf() : complex real-part function (float) .............................................................................. see creal(3M)creall() : complex real-part function (long double) .................................................................. see creal(3M)crealq() : complex real-part function (quad) ............................................................................. see creal(3M)crealw() : complex real-part function (extended) ...................................................................... see creal(3M)crt0(3): crt0.o , mcrt0.o , frt0.o , mfrt0.o ........................................................ execution startup routinescrt0.o : execution startup routines .................................................................................................. see crt0(3)crypt(3C): crypt() ............................................................................................. generate hashing encryptioncr_close(3): cr_close() ................................................................................... close a crash dump descriptorcr_info(3): cr_info() .................................................................................. retrieve crash dump informationcr_isaddr(3): cr_isaddr() .......................................... validate whether physical page number was dumpedcr_open(3): cr_open() ....................................................................................... open crash dump for readingcr_perror(3): cr_perror() .............................................................. print libcrash error or warning messagecr_read(3): cr_read() .................................................................................................. read from crash dumpcr_set_node(3): cr_set_node() ....................................................................... set crash dump node numbercr_uncompress(3): cr_uncompress() ..................................................... uncompress a file in a crash dumpcr_verify(3): cr_verify() ............................................................................... verify integrity of crash dumpcsin(3M): csin() , csinf() , csinl() , csinw() , csinq() ........................................ complex sine functionscsinf() : complex sine function (float) ......................................................................................... see csin(3M)csinh(3M): csinh() , csinhf() , csinhl() , csinhw() , csinhq() ......... complex hyperbolic sine functionscsinhf() : complex hyperbolic sine function (float) ................................................................... see csinh(3M)csinhl() : complex hyperbolic sine function (long double) ........................................................ see csinh(3M)

xiv Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptioncsinhq() : complex hyperbolic sine function (quad) .................................................................. see csinh(3M)csinhw() : complex hyperbolic sine function (extended) ............................................................ see csinh(3M)csinl() : complex sine function (long double) .............................................................................. see csin(3M)csinq() : complex sine function (quad) ........................................................................................ see csin(3M)csinw() : complex sine function (extended) .................................................................................. see csin(3M)csqrt(3M): csqrt() , csqrtf() , csqrtl() , csqrtw() , csqrtq() ................ complex square root functionscsqrtf() : complex square root function (float) .......................................................................... see csqrt(3M)csqrtl() : complex square root function (long double) ............................................................... see csqrt(3M)csqrtq() : complex square root function (quad) ......................................................................... see csqrt(3M)csqrtw() : complex square root function (extended) ................................................................... see csqrt(3M)ctan(3M): ctan() , ctanf() , ctanl() , ctanw() , ctanq() ................................. complex tangent functionsctanf() : complex tangent function (float) ................................................................................... see ctan(3M)ctanh(3M): ctanh() , ctanhf() , ctanhl() , ctanhw() , ctanhq() ... complex hyperbolic tangent functionsctanhf() : complex hyperbolic tangent function (float) ............................................................. see ctanh(3M)ctanhl() : complex hyperbolic tangent function (long double) .................................................. see ctanh(3M)ctanhq() : complex hyperbolic tangent function (quad) ............................................................ see ctanh(3M)ctanhw() : complex hyperbolic tangent function (extended) ...................................................... see ctanh(3M)ctanl() : complex tangent function (long double) ........................................................................ see ctan(3M)ctanq() : complex tangent function (quad) .................................................................................. see ctan(3M)ctanw() : complex tangent function (extended) ............................................................................ see ctan(3M)ctermid(3S): ctermid() ................................................................................. generate file name for terminalctime() : convert date and time to string ................................................................................... see ctime(3C)ctime(3C): ctime() , ctime_r() , localtime() , localtime_r() , difftime() , mktime() ,

gmtime() , gmtime_r() ,asctime() , asctime_r() , timezone() , daylight() , tzname() ,tzset() .................................................................................................... convert date and time to string

ctime_r() : convert date and time to string ............................................................................... see ctime(3C)ctype(3C): isalpha() , isupper() , islower() , isdigit() , isxdigit() , isalnum() , isspace() ,

ispunct() , isprint() , isgraph() , iscntrl() , isascii() ................................ classify characterscurscr(3X): curscr() .............................................................................................................. current windowcurses_intro(3X): curses_intro ................................................................................. introduction to cursescurs_set(3X): curs_set() ................................................................................................ set the cursor modecur_term(3X): cur_term() ............................................................................... current terminal informationcuserid(3S): cuserid() .......................................................................... get character login name of the userc_colwidth() , C_COLWIDTH(): process 16-bit characters .............................................. see nl_tools_16(3X)datalock(3C): datalock() ........................... lock process into memory after allocating data and stack spacedaylight() : convert date and time to string ............................................................................. see ctime(3C)dbm(3X): dbminit() , fetch() , store() , delete() , firstkey() ,

nextkey() , dbmclose() ........................................................................................ database subroutinesdbmclose() : database subroutines ............................................................................................... see dbm(3X)dbminit() : database subroutines ................................................................................................. see dbm(3X)dbm_clearerr() : database subroutines .................................................................................... see ndbm(3X)dbm_close() : database subroutines .......................................................................................... see ndbm(3X)dbm_delete() : database subroutines ........................................................................................ see ndbm(3X)dbm_error() : database subroutines .......................................................................................... see ndbm(3X)dbm_fetch() : database subroutines .......................................................................................... see ndbm(3X)dbm_firstkey() : database subroutines .................................................................................... see ndbm(3X)dbm_nextkey() : database subroutines ...................................................................................... see ndbm(3X)dbm_open() : database subroutines ............................................................................................ see ndbm(3X)dbm_store() : database subroutines .......................................................................................... see ndbm(3X)db_add_entry() : NIS+ database access functions .................................................................. see nis_db(3N)db_checkpoint() : NIS+ database access functions ................................................................ see nis_db(3N)db_create_table() : NIS+ database access functions ........................................................... see nis_db(3N)db_destroy_table() : NIS+ database access functions ......................................................... see nis_db(3N)db_first_entry() : NIS+ database access functions .............................................................. see nis_db(3N)db_free_result() : NIS+ database access functions .............................................................. see nis_db(3N)db_initialize() : NIS+ database access functions ................................................................ see nis_db(3N)db_list_entries() : NIS+ database access functions ........................................................... see nis_db(3N)db_next_entry() : NIS+ database access functions ................................................................ see nis_db(3N)db_remove_entry() : NIS+ database access functions ........................................................... see nis_db(3N)db_reset_next_entry() : NIS+ database access functions ................................................... see nis_db(3N)db_standby() : NIS+ database access functions ...................................................................... see nis_db(3N)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xv

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptiondb_table_exists() : NIS+ database access functions ........................................................... see nis_db(3N)db_unload_table() : NIS+ database access functions ........................................................... see nis_db(3N)def_prog_mode(3X): def_prog_mode() , def_shell_mode() , reset_prog_mode() ,

reset_shell_mode() .................................................. save or restore program or shell terminal modesdef_shell_mode() : save current terminal modes as the ‘‘shell’’ (not in Curses) statesee def_prog_mode(3X)delay_output(3X) ............................................................................................................................ delay outputdelch(3X): delch() , mvdelch() , mvwdelch() , wdelch() .......................... delete character from a windowdelete() : database subroutines ................................................................................................... see dbm(3X)deleteln(): delete lines in window .......................................................................................... see deleteln(3X)deleteln(3X): deleteln() , wdeleteln() ................................................................... delete lines in windowdelmntent() : delete file system descriptor file entry ........................................................ see getmntent(3X)delmntent() : get file system descriptor file entry ............................................................. see getmntent(3X)delscreen(3X): delscreen() ................................................................ free storage associated with a screendelwin(3X): delwin() ............................................................................................................ delete a windowdel_curterm() : interface to terminfo database ............................................................ see del_curterm(3X)del_curterm(3X): del_curterm() , restartterm() , set_curterm() ,

setupterm() ........................................................................................... interfaces to terminfo databasederwin(3X): delwin() ................................................................................ relative window creation functiondevnm(3): devnm() .................................................................................................. map device ID to file pathdial(3C): dial() , undial() ................................................... establish an outgoing terminal line connectiondifftime() : difference between calendar times ........................................................................ see ctime(3C)directory(3C): directory() , opendir() , readdir() , telldir() , seekdir() , rewinddir() ,

closedir() ............................................................................................................... directory operationsdirname() : return path name of parent directory ............................................................. see basename(3C)div(3C): div() , ldiv() ................................................................................... integer division and remainderdladdr(3C): dladdr() ............................................................................. symbolic information for an addressdlclose(3C): dlclose() ...................................................................................................... close shared objectdlerror(3C): dlerror() ......................................... get diagnostic information from dynamic linking processdlget(3C): dlget() ................................. retrieve information on loaded module (program or shared library)dlgetmodinfo(3C): dlgetmodinfo() .... retrieve information on loaded module (program or shared library)dlgetname(3C): dlgetname() ........................................................................... retrieve name of load moduledlmodadd(3C): dlmodadd() ............................. register information about dynamically generated functionsdlmodinfo(3C): dlmodinfo() ................ retrieve information on loaded module (program or shared library)dlmodremove(3C): dlmodremove() ..................................... remove information registered using dlmodadddlopen(3C): dlopen() ........................................................................................................ open shared objectdlsym(3C): dlsym() ............................................................................. get address of symbol in shared objectdn_comp , dn_expand - resolver routines ....................................................................................... resolver(3N)dn_comp() : resolver routines ................................................................................................ see resolver(3N)dn_expand() : resolver routines ............................................................................................ see resolver(3N)doupdate(3X): doupdate() , refresh() , wnoutrefresh() , wrefresh() ......... refresh windows and linesdrand48(3C): drand48() , erand48() , lrand48() , nrand48() , mrand48() , jrand48() , srand48() ,

seed48() , lcong48() ..................................... generate uniformly distributed pseudo-random numbersdupwin(3x): dupwin() ...................................................................................................... duplicate a windowecho(3X): echo() , noecho() .............................................................................. enable/disable terminal echoechochar(3X): echochar() , wechochar() echo single-byte character and rendition to a window and refreshecho_wchar(3X): echo_wchar() , wecho_wchar()

............................................................... write a complex character and immediately refresh the windowecvt(3C): ecvt() , fcvt() , gcvt() .................................................... convert floating-point number to stringedata() : last locations in program ................................................................................................ see end(3C)elf(3E): elf .................................................................................................................. object file access libraryelf32_fsize() : return the size of an object file type for elf32 files ..................................... see elf_fsize(3E)elf32_getehdr() : retrieve class-dependent object file header for ELF files .................... see elf_getehdr(3E)elf32_getphdr() : retrieve class-dependent program header table for ELF files ............ see elf_getphdr(3E)elf32_getshdr() : retrieve class-dependent section header for ELF files ...................... see elf_getshdr(3E)elf32_newehdr() : retrieve class-dependent object file header for ELF files .................... see elf_getehdr(3E)elf32_newphdr() : retrieve class-dependent program header table for ELF files ............ see elf_getphdr(3E)elf32_xlatetof() : class-dependent data translation of ELF files ........................................ see elf_xlate(3E)elf32_xlatetom() : class-dependent data translation of ELF files ........................................ see elf_xlate(3E)elf64_fsize() : return the size of an object file type for elf64 files ..................................... see elf_fsize(3E)elf64_getehdr() : retrieve class-dependent object file header for ELF files .................... see elf_getehdr(3E)elf64_getphdr() : retrieve class-dependent program header table for ELF files ............ see elf_getphdr(3E)

xvi Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionelf64_getshdr() : retrieve class-dependent section header for ELF files ...................... see elf_getshdr(3E)elf64_newehdr() : retrieve class-dependent object file header for ELF files .................... see elf_getehdr(3E)elf64_newphdr() : retrieve class-dependent program header table for ELF files ............ see elf_getphdr(3E)elf64_xlatetof() : class-dependent data translation of ELF files ........................................ see elf_xlate(3E)elf64_xlatetom() : class-dependent data translation of ELF files ........................................ see elf_xlate(3E)elf_begin(3E): elf_begin() .................................................................... make a file descriptor for ELF fileself_cntl(3E): elf_cntl() ....................................................................... control a file descriptor for ELF fileself_end(3E): elf_end() ................................................................................... finish using an ELF object fileelf_errmsg() : ELF library error handling ......................................................................... see elf_error(3E)elf_errno() : ELF library error handling ........................................................................... see elf_error(3E)elf_error(3E): elf_errmsg() , elf_errno() ...................................................... ELF library error handlingelf_fill(3E): elf_fill() ............................................................................................ set fill byte for ELF fileself_flag(3E): elf_flagdata() , elf_flagehdr() , elf_flagelf() , elf_flagphdr() ,

elf_flagscn() , elf_flagshdr() .......................................................... manipulate flags for ELF fileself_flagdata() : manipulate flags for ELF files ...................................................................... see elf_flag(3E)elf_flagehdr() : manipulate flags for ELF files ...................................................................... see elf_flag(3E)elf_flagelf() : manipulate flags for ELF files ........................................................................ see elf_flag(3E)elf_flagphdr() : manipulate flags for ELF files ...................................................................... see elf_flag(3E)elf_flagscn() : manipulate flags for ELF files ........................................................................ see elf_flag(3E)elf_flagshdr() : manipulate flags for ELF files ...................................................................... see elf_flag(3E)elf_fsize(3E): elf32_fsize() , elf64_fsize() . return the size of an object file type for elf32 or elf64 fileself_getarhdr(3E): elf_getarhdr() ....................................... retrieve archive member header for ELF fileself_getarsym(3E): elf_getarsym() ............................................ retrieve archive symbol table for ELF fileself_getbase(3E): elf_getbase() ............................................................. get the base offset for an object fileelf_getdata(3E): elf_getdata() , elf_newdata() , elf_rawdata() manipulate section data for ELF fileself_getehdr(3E): elf32_getehdr() , elf32_newehdr() , elf64_getehdr() , elf_newehdr()

............................................................................ retrieve class-dependent object file header for ELF fileself_getident(3E): elf_getident() ........................................... retrieve file identification data for ELF fileself_getphdr(3E): elf32_getphdr() , elf32_newphdr() , elf64_getphdr() , elf64_newphdr()

..................................................................... retrieve class-dependent program header table for ELF fileself_getscn(3E: elf_getscn() , elf_ndxscn() , elf_newscn() , elf_nextscn()

.......................................................................................................... get section information for ELF fileself_getshdr(3E): elf32_getshdr() , elf64_getshdr() retrieve class-dependent section header for ELF fileself_hash(3E): elf_hash() ........................................................................... compute hash value for ELF fileself_kind(3E): elf_kind() ............................................................................. determine file type for ELF fileself_ndxscn() : get section information for ELF files ........................................................... see elf_getscn(3E)elf_newdata() : manipulate section data for ELF files ...................................................... see elf_getdata(3E)elf_newscn() : get section information for ELF files ........................................................... see elf_getscn(3E)elf_next(3E): elf_next() ........................................ provide sequential archive member access for ELF fileself_nextscn() : get section information for ELF files ......................................................... see elf_getscn(3E)elf_rand(3E): elf_rand() ........................................................ random archive member access for ELF fileself_rawdata() : manipulate section data for ELF files ...................................................... see elf_getdata(3E)elf_rawfile(3E): elf_rawfile() ........................................ retrieve uninterpreted file contents for ELF fileself_strptr(3E): elf_strptr() .................................................................. make a string pointer for ELF fileself_update(3E): elf_update() .............................................................................. update an ELF descriptorelf_version(3E): elf_version() ........................................ coordinate ELF library and application versionself_xlate(3E): elf32_xlatetof() , elf32_xlatetom() , elf64_xlatetof() , elf64_xlatetom()

............................................................................................ class-dependent data translation of ELF filesend(3C): end() , etext() , edata() ......................................................................... last locations in programendbwent() : write records into new wtmps and btmps database .......................................... see bwtmps(3C)enddvagent : free memory and closes file ............................................................................ see getdvagent(3)endfsent() : get file system descriptor file entry ................................................................... see getfsent(3X)endgrent() : get group file entry .......................................................................................... see getgrent(3C)endhostent() : end network host entry ........................................................................... see gethostent(3N)endmntent() : get file system descriptor file entry ............................................................. see getmntent(3X)endnetconfig() : get network configuration data base entry ....................................... see getnetconfig(3N)endnetent() : get network entry ........................................................................................... see getnetent(3N)endnetent_r() : get network entry ....................................................................................... see getnetent(3N)endnetpath() : get /etc/netconfig entry corresponding to NETPATH component ............ see getnetpath(3N)endprdfent() : close system default database .................................................................... see getprdfent(3)endprotoent() : end protocol entry ............................................................................... see getprotoent(3N)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xvii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionendprotoent_r() : end protocol entry (thread-safe) ...................................................... see getprotoent(3N)endprpwent() : manipulate protected password database entry ....................................... see getprpwent(3)endprtcent() : close terminal control database .................................................................. see getprtcent(3)endpwent() : get password file entry ................................................................................... see getpwent(3C)endpwent() : get secure password file entry ......................................................................... see getspent(3C)endservent() : end service entry ..................................................................................... see getservent(3N)endservent_r() : end service entry (thread-safe) ............................................................ see getservent(3N)endspwent() : get secure password file entry on trusted systems ...................................... see getspwent(3X)endspwent_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)endusershell() - close legal user shells file ................................................................... see getusershell(3C)endutent() : access utmp file entry ............................................................................................ see getut(3C)endutsent() : access/update routines for user-accounting database maintained by utmpd(1M)

............................................................................................................................................ see getuts(3C)endutxent() : access utmpx file entry ...................................................................................... see getutx(3C)endwin(3X): endwin() ................................................................................................ suspend Curses sessionerand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)erase() : clear a window ................................................................................................................ see clear(3X)erasechar(3X): erasechar() , killchar() .................... single-byte terminal environment query functionserasewchar(3X): erasewchar() , killwchar() ................................. current erase and line kill characterserf(3M): erf() , erff() , erfl() , erfw() , erfq() , erfc(), erfcf() , erfcl() , erfcw() , erfcq()

................................................................................................... error and complementary error functionserfc() : complementary error function (double) ............................................................................. see erf(3M)erfcf() : complementary error function (float) .............................................................................. see erf(3M)erfcl() : complementary error function (long double) ................................................................... see erf(3M)erfcq() : complementary error function (quad) ............................................................................. see erf(3M)erfcw() : complementary error function (extended) ....................................................................... see erf(3M)erff() : error function (float) .......................................................................................................... see erf(3M)erfl() : error function (long double) ............................................................................................... see erf(3M)erfq() : error function (quad) ......................................................................................................... see erf(3M)erfw() : error function (extended) ................................................................................................... see erf(3M)errno() : system error messages ............................................................................................... see perror(3C)etext() : last locations in program ................................................................................................ see end(3C)exp(3M): exp() , expf() , expl() , expw() , expq() ..................................................... exponential functionsexp10(3M): exp10() , exp10f() , exp10l() , exp10w() , exp10q() ............... base-10 exponential functionsexp10f() : base-10 exponential function (float) ......................................................................... see exp10(3M)exp10l() : base-10 exponential function (long double) .............................................................. see exp10(3M)exp10q() : base-10 exponential function (quad) ........................................................................ see exp10(3M)exp10w() : base-10 exponential function (extended) .................................................................. see exp10(3M)exp2(3M): exp2() , exp2f() , exp2l() , exp2w() , exp2q() ............................. base-2 exponential functionsexp2f() : base-2 exponential function (float) ............................................................................... see exp2(3M)exp2l() : base-2 exponential function (long double) .................................................................... see exp2(3M)exp2q() : base-2 exponential function (quad) .............................................................................. see exp2(3M)exp2w() : base-2 exponential function (extended) ........................................................................ see exp2(3M)expf() : exponential function (float) .............................................................................................. see exp(3M)expl() : exponential function (long double) ................................................................................... see exp(3M)expm1(3M): expm1() , expm1f() , expm1l() , expm1w() , expm1q() ............. exponential minus 1 functionsexpm1f() : exponential minus 1 function (float) ....................................................................... see expm1(3M)expm1l() : exponential minus 1 function (long double) ............................................................ see expm1(3M)expm1q() : exponential minus 1 function (quad) ...................................................................... see expm1(3M)expm1w() : exponential minus 1 function (extended) ................................................................ see expm1(3M)expq() : exponential function (quad) ............................................................................................. see exp(3M)expw() : exponential function (extended) ....................................................................................... see exp(3M)fabs(3M): fabs() , fabsf() , fabsl() , fabsw() , fabsq() ..................................... absolute value functionsfabsf() : absolute value function (float) ....................................................................................... see fabs(3M)fabsl() : absolute value function (long double) ............................................................................ see fabs(3M)fabsq() : absolute value function (quad) ...................................................................................... see fabs(3M)fabsw() : absolute value function (extended) ............................................................................... see fabs(3M)fattach(3C): fattach() ........... attach a STREAMS file descriptor to an object in the file system name spacefclose(3S): fclose() , fflush() .................................................................................. close or flush a streamfcpacl() : copy access control list (ACL) to another file ................................................................. see cpacl(3C)fcvt() : convert floating-point number to string ........................................................................... see ecvt(3C)

xviii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionfdetach(3C): fdetach() ........................................ detach a STREAMS-based file descriptor from a filenamefdim(3M): fdim() , fdimf() , fdiml() , fdimw() , fdimq() .............................. positive difference functionsfdimf() : positive difference function (float) ................................................................................ see fdim(3M)fdiml() : positive difference function (long double) ..................................................................... see fdim(3M)fdimq() : positive difference function (quad) ............................................................................... see fdim(3M)fdimw() : positive difference function (extended) ......................................................................... see fdim(3M)fdopen() : associate a stream with a file descriptor ................................................................... see fopen(3S)feclearexcept(3M): feclearexcept() ........................................................... clear floating-point exceptionsfegetenv(3M): fegetenv() .............................................................................. get floating-point environmentfegetexceptflag(3M): fegetexceptflag() ................................................ get floating-point exception flagsfegetflushtozero(3M): fegetflushtozero() .......................................... get floating-point underflow modefegetround(3M): fegetround() ................................................................. get floating-point rounding modefegettrapenable(3M): fegettrapenable() ......................................................... get exception trap enablesfeholdexcept(3M): feholdexcept() ........................................................... save floating-point environmentfeof() : stream status inquiries ................................................................................................. see ferror(3S)feof_unlocked() : stream status inquiries .............................................................................. see ferror(3S)feraiseexcept(3M): feraiseexcept() ........................................................... raise floating-point exceptionsferror(3S): ferror() , feof() , clearerr() , ferror_unlocked() ,

feof_unlocked() , clearerr_unlocked() ...................................................... stream status inquiriesferror_unlocked() : stream status inquiries .......................................................................... see ferror(3S)fesetenv(3M): fesetenv() .............................................................................. set floating-point environmentfesetexceptflag(3M): fesetexceptflag() ................................................. set floating-point exception flagsfesetflushtozero(3M): fesetflushtozero() ........................................... set floating-point underflow modefesetround(3M): fesetround() .................................................................. set floating-point rounding modefesettrapenable(3M): fesettrapenable() ......................................................... set exception trap enablesfetch() : database subroutines ..................................................................................................... see dbm(3X)fetestexcept(3M): fetestexcept() ................................................................. test floating-point exceptionsfeupdateenv(3M): feupdateenv() .......................................................... update floating-point environmentfflush() : flush a stream ........................................................................................................... see fclose(3S)ffs() : memory operations, find first bit set ........................................................................... see memory(3C)fgetc() : get character from a stream file ..................................................................................... see getc(3S)fgetgrent() : get group file entry ........................................................................................ see getgrent(3C)fgetpos(3S): fgetpos() , fsetpos() ................................ save or restore file position indicator for a streamfgetpos64(3S) : fopen64() , freopen64() , fseeko64() , fsetpos64() , fstatvfsdev64() , ftello64() ,

ftw64() , nftw64() , statvfsdev64() , tmpfile64() ............... file system APIs to support large filesfgetpwent() : get password file entry ................................................................................. see getpwent(3C)fgets() : get a string from a stream .............................................................................................. see gets(3S)fgetspent() : get secure password file entry ....................................................................... see getspent(3C)fgetspwent() : get secure password file entry on trusted systems .................................... see getspwent(3X)fgetspwent_r() : get secure password file entry on trusted systems ............................... see getspwent(3X)fgets_unlocked() : get a string from a stream ........................................................................... see gets(3S)fgetwc() : get a wide character from a stream file .................................................................... see getwc(3C)fgetwc_unlocked() : get a wide character from a stream file ................................................. see getwc(3C)fgetws(3C): fgetws() ..................................................................................... get a wide string from a streamfileno(3S): fileno() .............................................................................. map stream pointer to file descriptorfilter(3X): filter() ................................................................ disable the use of certain terminal capabilitiesfirstkey() : database subroutines ............................................................................................... see dbm(3X)firstof2() , FIRSTof2() : process 16-bit characters ...................................................... see nl_tools_16(3X)flash(3X): flash() ................................................................................................................... flash the screenflockfile(3S): flockfile() , funflockfile() explicit locking of streams within a multi-thread applicationfloor(3M): floor() , floorf() , floorl() , floorw() , floorq() ......................................... floor functionsfloorf() : floor function (float) ................................................................................................... see floor(3M)floorl() : floor function (long double) ........................................................................................ see floor(3M)floorq() : floor function (quad) ................................................................................................... see floor(3M)floorw() : floor function (extended) ............................................................................................ see floor(3M)flushinp(3X): flushinp() .......................................................................................................... discard inputfma(3M): fma() , fmaf() , fmal() , fmaw() , fmaq() ...................................... floating multiply-add functionsfmaf() : floating multiply-add function (extended) ........................................................................ see fma(3M)fmaf() : floating multiply-add function (float) ............................................................................... see fma(3M)fmaf() : floating multiply-add function (quad) .............................................................................. see fma(3M)fmal() : floating multiply-add function (long double) .................................................................... see fma(3M)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xix

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionfmax(3M): fmax() , fmaxf() , fmaxl() , fmaxw() , fmaxq() ................................. maximum value functionsfmaxf() : maximum value function (float) ................................................................................... see fmax(3M)fmaxl() : maximum value function (long double) ....................................................................... see fmax(3M)fmaxq() : maximum value function (quad) .................................................................................. see fmax(3M)fmaxw() : maximum value function (extended) ........................................................................... see fmax(3M)fmin(3M): fmin() , fminf() , fminl() , fminw() , fminq() .................................. minimum value functionsfminf() : minimum value function (float) .................................................................................... see fmin(3M)fminl() : minimum value function (long double) ......................................................................... see fmin(3M)fminq() : minimum value function (quad) ................................................................................... see fmin(3M)fminw() : minimum value function (extended) ............................................................................ see fmin(3M)fmod(3M): fmod() , fmodf() , fmodl() , fmodw() , fmodq() .......................................... remainder functionsfmodf() : remainder function (float) ........................................................................................... see fmod(3M)fmodl() : remainder function (long double) ................................................................................ see fmod(3M)fmodq() : remainder function (quad) ........................................................................................... see fmod(3M)fmodw() : remainder function (extended) .................................................................................... see fmod(3M)fmtmsg(3C): fmtmsg() ........................................ displays formatted message on standard error and consolefnmatch(3C): fnmatch() .......................................................................................... match filename patternsfopen(3S): fopen() , freopen() , fdopen() .................. open or re-open a stream file; convert file to streamfpclassify(3M): fpclassify() ................................................................... floating-point classification macrofprintf() : print formatted output to a file ............................................................................... see printf(3S)fputc() : put character or word on a stream ................................................................................ see putc(3S)fputs() : put a string on a stream ................................................................................................ see puts(3S)fputs_unlocked() : put a string on a stream .............................................................................. see puts(3S)fputwc() : put a wide character on a stream file ....................................................................... see putwc(3C)fputwc_unlocked() : put a wide character on a stream file .................................................... see putwc(3C)fputws() : put a wide-character string on a stream file ............................................................ see putws(3C)fputws_unlocked() : put a wide-character string on a stream file ......................................... see putws(3C)fread(3S): fread() , fwrite() , fread_unlocked() , fwrite_unlocked()

.............................................................................................. buffered binary input/output to a stream filefread_unlocked() : buffered binary input/output to a stream file ............................................ see fread(3S)free() : release allocated block of main memory ...................................................................... see malloc(3C)freeaddrinfo() : get hostname and address entry ....................................................... see getaddrinfo(3N)freenetconfigent() : get network configuration data base entry .............................. see getnetconfig(3N)freopen() : re-open a stream file; convert file to stream ............................................................ see fopen(3S)frexp(3M): frexp() , frexpf() , frexpl() , frexpw() , frexpq()

....................................................................... extract mantissa and exponent from floating-point numberfrexpf() : extract mantissa and exponent from floating-point number (float) .......................... see frexp(3M)frexpl() : extract mantissa and exponent from floating-point number (long double) ............... see frexp(3M)frexpq() : extract mantissa and exponent from floating-point number (quad) .......................... see frexp(3M)frexpw() : extract mantissa and exponent from floating-point number (extended) ................... see frexp(3M)fscanf() : formatted input conversion, read from stream file .................................................... see scanf(3S)fseek(3S): fseek() , fseeko() , ftell() , ftello() , rewind() ,

fseek_unlocked() , ftell_unlocked() , rewind_unlocked() . reposition a file pointer in a streamfseeko() : reposition a file pointer in a stream ........................................................................... see fseek(3S)fseek_unlocked() : reposition a file pointer in a stream .......................................................... see fseek(3S)fsetaclentry() : add, modify, or delete access control list entry ..................................... see setaclentry(3C)fsetpos() - restore file position indicator for a stream ............................................................. see fgetpos(3S)fstatfsdev() : get file system statistics ................................................................................. see statfsdev(3C)fstatvfsdev() : get file system statistics .......................................................................... see statvfsdev(3C)ftell() : reposition a file pointer in a stream ............................................................................. see fseek(3S)ftello() : reposition a file pointer in a stream ........................................................................... see fseek(3S)ftell_unlocked() : reposition a file pointer in a stream .......................................................... see fseek(3S)ftok(3C): ftok() ........................................................................ create interprocess communication identifierftw(3C): ftw() , nftw() , nftw2() ......................................................... walk a file tree, executing a functionfunflockfile() : explicit locking of streams within a multi-thread application .................. see flockfile(3S)fwide(3C): fwide() ....................................................................................................... set stream orientationfwprintf(3C): fwprintf() , wprintf() , swprintf()

....................................................................................................... print formatted wide-character outputfwrite() : buffered binary input/output to a stream file ............................................................. see fread(3S)fwrite_unlocked() : buffered binary input/output to a stream file .......................................... see fread(3S)fwscanf(3C): fwscanf() , wscanf() , swscanf()

xx Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Description.................................................................................................... convert formatted wide-character input

gai_strerror() : get hostname and address entry ....................................................... see getaddrinfo(3N)gamma() : log gamma function (double) .................................................................................. see lgamma(3M)gammaf() : log gamma function (float) .................................................................................... see lgamma(3M)gammal() : log gamma function (long double) ........................................................................ see lgamma(3M)gammaq() : log gamma function (quad) ................................................................................... see lgamma(3M)gammaw() : log gamma function (extended) ............................................................................ see lgamma(3M)gcvt() : convert floating-point number to string ........................................................................... see ecvt(3C)getaddrinfo(3N): getaddrinfo() , getnameinfo() , freeaddrinfo() , gai_strerror()get hostname and address entrygetbegyx(3X): getbegyx() , getmaxyx() , getparyx() ........ get additional cursor and window coordinatesgetbkgd() : set or get background character and rendition using a single-byte character ............ see bkgd(3X)getbkgrnd() : set or get background character and rendition using a complex character ........ see bkgrnd(3X)getbootpent(3X): getbootpent(), putbootpent(), setbootpent(), endbootpent(),

parse_bp_htype(), parse_bp_hpaddr(), parse_bp_iaddr() ............ get, or put bootptab entrygetbwent() : write records into new wtmps and btmps database .......................................... see bwtmps(3C)getc(3S): getc() , getc_unlocked() , getchar() , getchar_unlocked() , fgetc() ,

getw() , getw_unlocked() ....................................................... get character or word from a stream filegetcchar(3X): getcchar() .................................. get a wide character string and rendition from a cchar_tgetch(3X): getch() , wgetch() , mvgetch() , mvwgetch() ..... get a single-byte character from the terminalgetchar() : get character from a stream file ................................................................................. see getc(3S)getchar_unlocked() : get character from a stream file .............................................................. see getc(3S)getclock(3C): getclock() .................................................................. get current value of system-wide clockgetcwd(3C): getcwd() ................................................................ get path-name of current working directorygetc_unlocked() : get character from a stream file .................................................................... see getc(3S)getdate(3C): getdate() , getdate_r() ................................................... convert user format date and timegetdate_r() : convert user format date and time .................................................................. see getdate(3C)getdiskbyname(3C) :getdiskbyname() ...................................................... get disk description by its namegetdiskbyname_r(3C) : get disk description ........................................................... see getdiskbyname(3C)getdvagent : return pointer for device assignment database entry .................................... see getdvagent(3)getdvagent(3): getdvagent() , getdvagnam() , setdvagent() , enddvagent() , putdvagnam() ,

copydvagent() ............................... manipulate device assignment database entry for a trusted systemgetdvagnam : return success or failure information ............................................................ see getdvagent(3)getenv(3C): getenv() .............................................................................. return value for environment namegetfsent() : get file system descriptor file entry ................................................................... see getfsent(3X)getfsent(3X): getfsent() , getfsspec() , getfsfile() , getfstype() ,

setfsent() , endfsent() ................................................................. get file system descriptor file entrygetfsfile() : get file system descriptor file entry ................................................................. see getfsent(3X)getfsspec() : get file system descriptor file entry ................................................................. see getfsent(3X)getfstype() : get file system descriptor file entry ................................................................. see getfsent(3X)getgrent(3C): getgrent() , getgrgid() , getgrnam() , setgrent() , endgrent() ,

fgetgrent() .............................................................................................................. get group file entrygetgrgid() , getgrnam() : get group file entry ................................................................... see getgrent(3C)gethostbyaddr() : get network host entry ...................................................................... see gethostent(3N)gethostbyname() : get network host entry ...................................................................... see gethostent(3N)gethostent(3N): endhostent() , endhostent_r() , gethostbyaddr() , gethostbyaddr_r() ,

gethostbyname() , gethostbyname_r() , gethostent() , gethostent_r() ,sethostent() , sethostent_r() ..................................................... get, set, or end network host entry

gethrtime(3C): gethrtime() .................................................................................... get high resolution timegetlocale() : get the locale of a program ............................................................................ see setlocale(3C)getlocale_r() : get the locale of a program (MT-Safe) ....................................................... see setlocale(3C)getlogin(3C): getlogin() , getlogin_r() ................................ get name of user logged in on this terminalgetlogin_r() : get name of user logged and return to buffer ............................................... see getlogin(3C)getmaxyx() : get additional cursor and window coordinates ................................................... see getbegyx(3X)getmntent(3X): getmntent() , getmntent_r() , setmntent() , addmntent() , delmntent() ,

endmntent() , hasmntopt() ............................................................. get file system descriptor file entrygetmntent_r() : get file system descriptor file entry ........................................................ see getmntent(3X)getnameinfo() : get hostname and address entry ......................................................... see getaddrinfo(3N)getnetbyaddr() : get network entry ..................................................................................... see getnetent(3N)getnetbyaddr_r() : get network entry ................................................................................ see getnetent(3N)getnetbyname() : get network entry ..................................................................................... see getnetent(3N)getnetbyname_r() : get network entry ................................................................................ see getnetent(3N)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxi

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptiongetnetconfig(3N): getnetconfig() , setnetconfig() , endnetconfig() , getnetconfigent() ,

freenetconfigent() , nc_perror() , nc_sperror() ......... get network configuration database entrygetnetconfigent() : get network configuration data base entry ................................ see getnetconfig(3N)getnetent() : get network entry ........................................................................................... see getnetent(3N)getnetent(3N): getnetent() , getnetbyaddr() , getnetbyname() , setnetent() ,

endnetent() ................................................................................................................. get network entrygetnetent_r() : get network entry ....................................................................................... see getnetent(3N)getnetgrent(3C): getnetgrent() , setnetgrent() , endnetgrent() , innetgr() get network group entrygetnetname() : library routines for secure remote procedure calls ................................. see secure_rpc(3N)getnetpath(3N): getnetpath() , setnetpath() ,

endnetpath() ....................................... get /etc/netconfig entry corresponding to NETPATH componentgetnstr(3X): getnstr() , mvgetnstr() , mvwgetnstr() , wgetnstr()

............................................................ get a multi-byte character length limited string from the terminalgetn_wstr(3X): getn_wstr() , get_wstr() , mvgetn_wstr() , mvget_wstr() , mvwgetn_wstr() ,

mvwget_wstr() , wgetn_wstr() , wget_wstr()................................................... get an array of wide characters and function key codes from a terminal

getopt(3C): getopt() , optarg() , optind() , opterr() .................. get option letter from argument vectorgetparyx() : get additional cursor and window coordinates ................................................... see getbegyx(3X)getpass(3C): getpass() ......................................................................................................... read a passwordgetprdfent(3): getprdfent() , getprdfnam() , setprdfent() , endprdfent() ,

putprdfnam() ....................................... manipulate system default database entry for a trusted systemgetprdfnam() : search for file .............................................................................................. see getprdfent(3)getprotobyname() : get protocol entry .......................................................................... see getprotoent(3N)getprotobyname_r() : get protocol entry (thread-safe) ................................................ see getprotoent(3N)getprotobynumber() : get protocol entry ...................................................................... see getprotoent(3N)getprotobynumber_r() : get protocol entry (thread-safe) ............................................ see getprotoent(3N)getprotoent(3N): endprotoent() , endprotoent_r() , getprotobyname() , getprotobyname_r() ,

getprotobynumber() , getprotobynumber_r() , getprotoent() , getprotoent_r() ,setprotoent() , setprotoent_r() , ........................................................ get, set, or end protocol entry

getprotoent_r() : get protocol entry (thread-safe) ....................................................... see getprotoent(3N)getprpwaid() : get protected password database audit ID ................................................ see getprpwent(3)getprpwent(3): getprpwent() , getprpwuid() , getprpwnam() , getprpwaid() , setprpwent() ,

endprpwent() , putprpwnam() ..................................... manipulate protected password database entrygetprpwnam() : get protected password database user name ............................................ see getprpwent(3)getprpwuid() : get protected password database user ID ................................................. see getprpwent(3)getprtcent() : return pointer to terminal control database ............................................... see getprtcent(3)getprtcent(3): getprtcent() , getprtcnam() , setprtcent() , endprtcent() ,

putprtcnam() ..................................... manipulate terminal control database entry for a trusted systemgetprtcnam() : search terminal control database ............................................................... see getprtcent(3)getpublickey(3M): getpublickey() , getsecretkey() , publickey() ......... retrieve public or secret keygetpw(3C): getpw() ........................................................................................................... get name from UIDgetpwent() : get password file entry ................................................................................... see getpwent(3C)getpwent(3C): getpwent() , getpwuid() , getpwnam() , setpwent() , endpwent() ,

fgetpwent() ......................................................................................................... get password file entrygetresgid() : get real, effective, and saved group ID ........................................................... see getresuid(3)getresuid(3): getresuid() , getresgid() .......................... get real, effective, and saved user or group IDsgetrpcent(3C): getrpcent() , getrpcbyname() , getrpcbynumber() ...................................... get rpc entrygetrpcport(3N): getrpcport() ....................................................................................... get RPC port numbergets(3S): gets() , fgets() , fgets_unlocked() .................................................. get a string from a streamgetsecretkey() : retrieve public or secret key ........................................................... see getpublickey(3M)getservbyname() : get service entry ................................................................................ see getservent(3N)getservbyname_r() : get service entry (thread-safe) ...................................................... see getservent(3N)getservbyport() : get service entry ................................................................................ see getservent(3N)getservbyport_r() : get service entry (thread-safe) ...................................................... see getservent(3N)getservent() : get service entry ...................................................................................... see getservent(3N)getservent(3N): endservent() , endservent_r() , getservbyname() , getservbyname_r() ,

getservbyport() , getservbyport_r() , getservent() , getservent_r() ,setservent() , setservent_r() ............................................................... get, set, or end service entry

getservent_r() : get service entry (thread-safe) ............................................................. see getservent(3N)getspent() : get secure password file entry ......................................................................... see getspent(3C)getspent(3C): getspent() , fgetspent() , getspnam() , getspnam_r() ,

xxii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionsetspent() , endspent() ........................................................................ get secure password file entry

getspnam_r() : get secure password file entry ..................................................................... see getspent(3C)getspwaid() : get secure password file entry on trusted systems ...................................... see getspwent(3X)getspwaid_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)getspwent(3X): getspwent() , getspwuid() , getspwaid() , getspwnam() ,

setspwent() , endspwent() , fgetspwent() , getspwent_r() , getspwuid_r() ,getspwaid_r() , getspwnam_r() , setspwent_r() , endspwent_r() , fgetspwent_r()...................................................................................... get secure password file entry on trusted systems

getspwent_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)getspwnam() : get secure password file entry on trusted systems ...................................... see getspwent(3X)getspwnam_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)getspwuid() : get secure password file entry on trusted systems ...................................... see getspwent(3X)getspwuid_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)getstr(3X): getstr() , mvgetstr() , mvwgetstr() , wgetstr()

................................................................................... get a multi-byte character string from the terminalgetsubopt(3C): getsubopt() ......................................................................... parse suboptions from a string.gettimer(3C): gettimer() ............................................................................. get value of a per-process timergettxt(3C): gettxt() .................................................................................. read text string from message filegetusershell(3C): getusershell() , setusershell() , endusershell() ................. get legal user shellsgetut(3C): getutent() , getutent_r() , getutid() , getutid_r() , getutline() , getutline_r() ,

pututline() , pututline_r() , _pututline() , setutent() , setutent_r() , endutent() ,endutent_r() , utmpname() , utmpname_r() ...................................................... access utmp file entry

getutent() : access utmp file entry ............................................................................................ see getut(3C)getutid() : access utmp file entry .............................................................................................. see getut(3C)getutline() : access utmp file entry .......................................................................................... see getut(3C)getuts(3C): getutsent() , getutsid() , getutsline() , pututsline() ,

setutsent() , endutsent()..................................... access/update routines for user-accounting database maintained by utmpd(1M)

getutsent() : access/update routines for user-accounting database maintained by utmpd(1M)............................................................................................................................................ see getuts(3C)

getutsid() : access/update routines for user-accounting database maintained by utmpd(1M)............................................................................................................................................ see getuts(3C)

getutsline() : access/update routines for user-accounting database maintained by utmpd(1M)............................................................................................................................................ see getuts(3C)

getutx(3C): getutxent() , getutxid() , getutxline() , pututxline() , setutxent() ,endutxent() ......................................................................................................... access utmpx file entry

getutxent() : access utmpx file entry ...................................................................................... see getutx(3C)getutxid() : access utmpx file entry ........................................................................................ see getutx(3C)getutxline() : access utmpx file entry .................................................................................... see getutx(3C)getw() : get word from a stream file .............................................................................................. see getc(3S)getwc(3C): getwc() , getwchar() , fgetwc() , getwc_unlocked() ,

getwchar_unlocked() , fgetwc_unlocked() ......................... get a wide character from a stream filegetwchar() : get a wide character from a stream file ................................................................ see getwc(3C)getwchar_unlocked() : get a wide character from a stream file ............................................. see getwc(3C)getwc_unlocked() : get a wide character from a stream file ................................................... see getwc(3C)getwd(3C): getwd .......................................................................... get pathname of current working directorygetwin(3X): getwin() , putwin() ........................................ dump window to, and reload window from a filegetw_unlocked() : get word from a stream file ........................................................................... see getc(3S)getyx(3X): getyx() ................................................................................... get cursor and window coordinatesget_expiration_time(3T): get_expiration_time() ................ add a specific time interval to the current

absolute system timeget_myaddress() : obsolete library routine for RPC ............................................................. see rpc_soc(3N)get_resfield - resolver routines ................................................................................................. resolver(3N)get_resfield() : resolver routines ...................................................................................... see resolver(3N)get_wch(3X): get_wch() , mvget_wch() , mvwget_wch() , wget_wch () get a wide character from a terminalget_wstr() : get an array of wide characters and function key codes from a terminal ........ see getn_wstr(3X)glob(3C): glob() , globfree() ......................................................................... file name generation functionglobfree() : free space associated with file name generation function ....................................... see glob(3C)gmtime() : convert date and time to string ................................................................................. see ctime(3C)gmtime_r() : convert date and time to string ............................................................................. see ctime(3C)grantpt(3C): grantpt() .................................................................... grant access to the STREAMS slave pty

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxiii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptiongsignal() : software signals .................................................................................................... see ssignal(3C)gss_accept_sec_context(3): gss_accept_sec_context() .................................. establish security contextgss_acquire_cred(3): gss_acquire_cred() ................................................... acquire handle for credentialgss_add_cred(3): gss_add_cred()

............ allow application to acquire a handle for existing, named credential establishes security contextgss_add_oid_set_member(3): gss_add_oid_set_member() .. add an Object Identifier(OID) to an OID setgss_canonicalize_name(3): gss_canonicalize_name() ................................................................ convert

an internal name to an internal mechanism name (MN) representation of an opaque internal namegss_compare_name(3): gss_compare_name()

.............. allow an application to compare two internal names to determine whether they are equivalentgss_context_time(3): gss_context_time() ..... check the number of seconds the context will remain validgss_create_empty_oid_set(3): gss_create_empty_oid_set()

................................................................. create a new, empty OID set, to which members can be addedgss_delete_sec_context(3): gss_delete_sec_contest() .................................... delete a security contextgss_display_name(3): gss_display_name()

........................................... provide textual representation of an opaque internal name to an applicationgss_display_status(3): gss_display_status() .............................................. provides an application with

the textual representation of a GSSAPI status code that can be displayed to a user or used for logginggss_duplicate_name(3): gss_duplicate_name()

........................................ allow an application to create an exact duplicate of the existing internal namegss_export_name(3): gss_export_name()

............................................... convert a mechanism name (MN) to a form suitable for direct comparisongss_export_sec_context(3): gss_export_sec_context()

............................................................ transfer a security context to another process on a single machinegss_get_mic(3): gss_get_mic()

................... calculate a cryptographic message integrity code (MIC) for a message and return in a tokengss_import_name(3): gss_import_name() ............................ convert a printable name to an internal formgss_import_sec_context(3): gss_import_sec_context()

............................................................ transfer a security context to another process on a single machinegss_indicate_mechs(): gss_indicate_mechs()

.......................... allow an application to determine which underlying security mechanisms are availablegss_init_sec_context(3): gss_init_sec_context()

.............................................. establish a security context between context initiator and context acceptorgss_inquire_context(3): gss_inquire_context() ................. obtain information about a security contextgss_inquire_cred(3): gss_inquire_cred() provide the calling application information about a credentialgss_inquire_cred_by_mech(3): gss_inquire_cred_by_mech()

......................................... provide the calling application per-mechanism information about a credentialgss_inquire_mechs_for_name(3): gss_inquire_mechs_for_name()

......................................................................... list the mechanisms that support the specified name-typegss_inquire_names_for_mech(3): gss_inquire_names_for_mech()

........................................................................ list the name-types supported by the specified mechanismgss_process_context_token(3): gss_process_context_token() ... pass a context to the security servicegss_release_buffer(3): gss_release_buffer() .................................. free storage associated with a buffergss_release_cred(3): gss_release_cred() .................................................. mark a credential for deletiongss_release_name(3): gss_release_name()

.......................................... free storage associated with an internal name allocated by a GSSAPI routinegss_release_oid_set(3): gss_release_oid_set() ......... free storage associated with a gss_OID_set objectgss_test_oid_set_number(3): gss_test_oid_set_number() ........... check an OID set for a specified OIDgss_unwrap(3): gss_unwrap()

................... verify a message with attached message integrity code (MIC) and decrypt message contentgss_verify_mic(3): gss_verify_mic()

.................. check a cryptographic message integrity code (MIC) against a message to verify its integritygss_wrap(3): gss_wrap() ......... attach a message integrity code (MIC) to a message, and optionally encryptgss_wrap_size_limit(3): gss_wrap_size_limit() determine a token-size limit for gss_wrap on a contexthalfdelay(3X): halfdelay() .................................................................... control input character delay modehasmntopt() : get file system descriptor file entry ............................................................. see getmntent(3X)has_colors() : color manipulation functions ......................................................... see can_change_color(3X)has_ic(3X): has_ic() , has_il() ............................ query functions for terminal insert and delay capabilityhas_il() : query functions for terminal insert and delay capability ............................................ see has_ic(3X)hcreate() : manage hash search tables ................................................................................. see hsearch(3C)hdestroy() : manage hash search tables ............................................................................... see hsearch(3C)

xxiv Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionherror - resolver routines .............................................................................................................. resolver(3N)herror() : resolver routines .................................................................................................. see resolver(3N)hline(3X): hline() , mvhline() , mvvline() , mvwhline() , mvwvline() , vline() , whline() , wvline()

............................................................................... draw lines from single-byte characters and renditionshline_set(3X): hline_set() , mvhline_set() , mvvline_set() , mvwhline_set() , mvwvline_set() ,

vline_set() , whline_set() , wvline_set() ...... draw lines from complex characters and renditionshost2netname() : library routines for secure remote procedure calls ............................. see secure_rpc(3N)hosts_access(3): hosts_access() , hosts_ctl() , request_init() , request_set()

.................................................................................................................................. access control libraryhosts_ctl() : access control library ................................................................................ see hosts_access(3)hppac(3X): HPPACADDD(), HPPACCMPD(), HPPACCVAD(), HPPACCVBD(),

HPPACCVDA(), HPPACCVDB(), HPPACDIVD() , HPPACLONGDIVD(), HPPACMPYD(),HPPACNSLD(), HPPACSLD(), HPPACSRD(), HPPACSUBD() ......... HP 3000-mode packed-decimal library

HPPACADDD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACCMPD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACCVAD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACCVBD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACCVDA(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACCVDB(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACDIVD() : HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACLONGDIVD(): HP 3000-mode packed-decimal library ...................................................... see hppac(3X)HPPACMPYD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACNSLD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)HPPACSLD(): HP 3000-mode packed-decimal library ................................................................ see hppac(3X)HPPACSRD(): HP 3000-mode packed-decimal library ................................................................ see hppac(3X)HPPACSUBD(): HP 3000-mode packed-decimal library .............................................................. see hppac(3X)hsearch(3C): hsearch() , hcreate() , hdestroy() ........................................... manage hash search tableshtonl() , htons() : convert values from host to network byte order ................................. see byteorder(3N)hypot(3M): hypot() , hypotf() , hypotl() , hypotw() , hypotq() Euclidean distance (hypotenuse) functionshypotf() : Euclidean distance function (float) .......................................................................... see hypot(3M)hypotl() : Euclidean distance function (long double) ............................................................... see hypot(3M)hypotq() : Euclidean distance function (quad) .......................................................................... see hypot(3M)hypotw() : Euclidean distance function (extended) ................................................................... see hypot(3M)iconv() : convert characters ....................................................................................................... see iconv(3C)iconv(3C): iconv() , iconv_open() , iconv_close() ...................................... code set conversion routinesiconv_close() : deallocate conversion descriptor ..................................................................... see iconv(3C)iconv_open() : return conversion descriptor ............................................................................. see iconv(3C)idcok(3X): idcok() .......................... enable or disable use of hardware insert- and delete-character featuresidleok() : terminal output control functions ............................................................................. see clearok(3X)if_freenameindex() : interface name to index mapping .......................................... see if_nameindex(3N)if_indextoname() : interface name to index mapping ............................................... see if_nameindex(3N)if_nameindex(3N): if_nametoindex() , if_indextoname() , if_nameindex() ,

if_freenameindex() .......................................................................... interface name to index mappingif_nametoindex() : interface name to index mapping ............................................... see if_nameindex(3N)ilogb(3M): ilogb() , ilogbf() , ilogbl() , ilogbw() , ilogbq() ... radix-independent exponent functionsilogbf() : radix-independent exponent function (float) ............................................................. see ilogb(3M)ilogbl() : radix-independent exponent function (long double) .................................................. see ilogb(3M)ilogbq() : radix-independent exponent function (quad) ............................................................ see ilogb(3M)ilogbw() : radix-independent exponent function (extended) ...................................................... see ilogb(3M)immedok(3X): immedok() ........................................................ enable or disable immediate terminal refreshinch(3X): inch() , mvinch() , mvwinch() , winch input a single-byte character and rendition from a windowinchnstr(3X): inchnstr() , inchstr() , mvinchnstr() , mvinchstr() , mvwinchnstr() , mvwinchstr() ,

winchnstr() , winchstr() ...... input an array of single-byte characters and renditions from a windowinchstr() : input an array of single-byte characters and renditions from a window .............. see inchnstr(3X)index() : BSD portability string routine .................................................................................... see string(3C)inet(3N): inet_addr() , inet_lnaof() , inet_makeaddr() , inet_netof() ,

inet_network() , inet_ntoa() , inet_ntoa_r() .................. Internet address manipulation routinesinet6(3N): inet_pton() , inet_nton() ........................................... Internet address manipulation routinesinet6_opt_append() : IPv6 Hop-by-Hop and Destination options manipulation functions.

.............................................................................................................................. see inet6_opt_init(3N)inet6_opt_find() : IPv6 Hop-by-Hop and Destination options manipulation functions.

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxv

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Description.............................................................................................................................. see inet6_opt_init(3N)

inet6_opt_finish() : IPv6 Hop-by-Hop and Destination options manipulation functions............................................................................................................................... see inet6_opt_init(3N)

inet6_opt_get_val() : IPv6 Hop-by-Hop and Destination options manipulation functions............................................................................................................................... see inet6_opt_init(3N)

inet6_opt_init(3N): inet6_opt_init() , inet6_opt_append() , inet6_opt_find() ,inet6_opt_finish() , inet6_opt_get_val() , inet6_opt_next() , inet6_opt_set_val()........................................................... IPv6 Hop-by-Hop and Destination options manipulation functions

inet6_opt_next() : IPv6 Hop-by-Hop and Destination options manipulation functions............................................................................................................................... see inet6_opt_init(3N)

inet6_opt_set_val() : IPv6 Hop-by-Hop and Destination options manipulation functions............................................................................................................................... see inet6_opt_init(3N)

inet6_rth_addr() : IPv6 Routing header options manipulation functions ............ see inet6_rth_space(3N)inet6_rth_getaddr() : IPv6 Routing header options manipulation functions ..... see inet6_rth_space(3N)inet6_rth_init() : IPv6 Routing header options manipulation functions ............ see inet6_rth_space(3N)inet6_rth_reverse() : IPv6 Routing header options manipulation functions ..... see inet6_rth_space(3N)inet6_rth_segments() : IPv6 Routing header options manipulation functions

.......................................................................................................................... see inet6_rth_space(3N)inet6_rth_space() : IPv6 Routing header options manipulation functions .......... see inet6_rth_space(3N)inet6_rth_space(3N): inet6_rth_add() , inet6_rth_getaddr() , inet6_rth_init() ,

inet6_rth_reverse() , inet6_rth_segments() , inet6_rth_space()................................................................................. IPv6 Routing header options manipulation functions

inet_addr() : Internet address manipulation routines ................................................................ see inet(3N)inet_lnaof() : Internet address manipulation routines .............................................................. see inet(3N)inet_makeaddr() : Internet address manipulation routines ....................................................... see inet(3N)inet_netof() : Internet address manipulation routines .............................................................. see inet(3N)inet_network() : Internet address manipulation routines ......................................................... see inet(3N)inet_ntoa() : Internet address manipulation routines ................................................................ see inet(3N)inet_ntoa_r() : Internet address manipulation routines ........................................................... see inet(3N)inet_nton() : Internet address manipulation routines ................................................................ see inet6(3N)inet_pton() : Internet address manipulation routines ................................................................ see inet6(3N)initgroups(3C): initgroups() .............................................................................. initialize group access listinitscr(3X): initscr() , newterm() ................................................................ screen initialisation functionsinitstate() : pseudorandom number functions ................................................................... see random(3M)init_colors() : color manipulation functions ....................................................... see can_change_color(3X)init_pair() : color manipulation functions ........................................................... see can_change_color(3X)innstr(3X): innstr() , instr() , mvinnstr() , mvinstr() , mvwinnstr() , mvwinstr() , winnstr() ,

winstr() ................................................................... input a multi-byte character string from a windowinnwstr() : input a string of wide characters from a window ................................................... see innwstr(3X)innwstr(3X): innwstr() , inwstr() , mvinnwstr() , mvinwstr() , mvwinnwstr() , mvwinwstr() ,

winnwstr() , winwstr() .............................................. input a string of wide characters from a windowinsch(3X): insch() , mvinsch() , mvwinsch() , winsch()

....................................................................... insert a single-byte character and rendition into a windowinsdelln(3X): insdelln() , winsdelln() ............................................... delete or insert lines into a windowinsertln(3X): insertln() , winsertln() .............................................................. insert lines into a windowinsnstr(3X): insnstr() , insstr() , mvinsnstr() , mvinsstr() , mvwinsnstr() , mvwinsstr() ,

winsnstr() , winsstr() ..................................................... insert a multi-byte character into a windowinsque(3C): insque() , remque() ..................................................... insert or remove an element in a queueinsstr() : insert a multi-byte character into a window ............................................................. see insnstr(3X)instr() : input a multi-byte character string from a window ...................................................... see innstr(3X)ins_nwstr(3X): ins_nwstr() , ins_wstr() , mvins_nwstr() , mvins_wstr() , mvwins_nwstr() ,

mvwins_wstr() , wins_nwstr() , wins_wstr() .............. insert a wide-character string into a windowins_wch(3X): ins_wch() , mvins_wch() , mvwins_wch() , wins_wch()

............................................................................ insert a complex character and rendition into a windowins_wstr() : insert a wide-character string into a window ................................................... see ins_nwstr(3X)intrflush(3X): intrflush() .................................................................... enable or disable flush on interruptinwstr() : input a string of wide characters from a window ..................................................... see innwstr(3X)in_wch(3X): in_wch() , mvin_wch() , mvwin_wch() , win_wch()

........................................................................... input a complex character and rendition from a windowin_wchnstr(3X): in_wchnstr() , in_wchstr() , mvin_wchnstr() , mvin_wchstr() , mvwin_wchnstr() ,

mvwin_wchstr() , win_wchnstr() , win_wchstr()

xxvi Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Description........................................................ input an array of complex characters and renditions from a window

in_wchstr() : input an array of complex characters and renditions from a window ......... see in_wchnstr(3X)isalnum() : classify characters ................................................................................................... see ctype(3C)isalpha() : classify characters ................................................................................................... see ctype(3C)isascii() : classify characters ................................................................................................... see ctype(3C)isastream(3C): isastream() determine if file descriptor refers to STREAMS device or STREAMS-based pipeisatty() : find name of a terminal ........................................................................................ see ttyname(3C)iscntrl() : classify characters ................................................................................................... see ctype(3C)isdigit() : classify characters ................................................................................................... see ctype(3C)isendwin(3X): isendwin() .................................................. determine whether a screen has been refreshedisfinite(3M): isfinite() ................................................................................ floating-point finiteness macroisgraph() : classify characters ................................................................................................... see ctype(3C)isgreater(3M): isgreater() ......................................................... floating-point quiet comparison macro (>)isgreaterequal(3M): isgreaterequal() ................................... floating-point quiet comparison macro (>=)isinf(3M): isinf() .................................................................................................................... test for infinityisless(3M): isless() ...................................................................... floating-point quiet comparison macro (<)islessequal(3M): islessequal() ............................................... floating-point quiet comparison macro (<=)islessgreater(3M): islessgreater() ........................................ floating-point quiet comparison macro (<>)islower() : classify characters ................................................................................................... see ctype(3C)isnan(3M): isnan() ...................................................................................................................... test for NaNisnormal(3M): isnormal() ............................................................................................ test for normal valueisprint() : classify characters ................................................................................................... see ctype(3C)ispunct() : classify characters ................................................................................................... see ctype(3C)isspace() : classify characters ................................................................................................... see ctype(3C)isunordered(3M): isunordered() .......................................... floating-point comparison macro (unordered)isupper() : classify characters ................................................................................................... see ctype(3C)iswalnum() : classify wide characters ..................................................................................... see wctype(3C)iswalpha() : classify wide characters ..................................................................................... see wctype(3C)iswcntrl() : classify wide characters ..................................................................................... see wctype(3C)iswctype() : classify wide characters ..................................................................................... see wctype(3C)iswdigit() : classify wide characters ..................................................................................... see wctype(3C)iswgraph() : classify wide characters ..................................................................................... see wctype(3C)iswlower() : classify wide characters ..................................................................................... see wctype(3C)iswprint() : classify wide characters ..................................................................................... see wctype(3C)iswpunct() : classify wide characters ..................................................................................... see wctype(3C)iswspace() : classify wide characters ..................................................................................... see wctype(3C)iswupper() : classify wide characters ..................................................................................... see wctype(3C)iswxdigit() : classify wide characters ................................................................................... see wctype(3C)isxdigit() : classify characters ................................................................................................. see ctype(3C)is_linetouched(3X): is_linetouched() , is_wintouched() , touchline() , untouchwin() ,

wtouchln() ........................................................................................... window refresh control functionsis_wintouched() : window refresh control functions .................................................. see is_linetouched(3X)j0(3M): j0() , j1() , jn() .............................................................................. Bessel functions of the first kindj1() : Bessel function ........................................................................................................................ see j0(3M)jn() : Bessel function ........................................................................................................................ see j0(3M)jrand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)keyname(3X): keyname() , key_name() ................................................................................ get name of keykeypad(3X): keypad() ............................................................... enable/disable abbreviation of function keyskey_decryptsession() : library routines for secure remote procedure calls ................ see secure_rpc(3N)key_encryptsession() : library routines for secure remote procedure calls ................ see secure_rpc(3N)key_gendes() : library routines for secure remote procedure calls ................................. see secure_rpc(3N)key_name() : get name of key .................................................................................................. see keyname(3X)key_secretkey_is_set() : library routines for secure remote procedure calls ............ see secure_rpc(3N)key_setsecret() : library routines for secure remote procedure calls ........................... see secure_rpc(3N)killchar() : single-byte line kill character .......................................................................... see erasechar(3X)killwchar() : current line kill character ........................................................................... see erasewchar(3X)l64a() : convert between long integer and base-64 ASCII string .................................................. see a64l(3C)l64a_r : convert between long integer and base-64 ASCII string .................................................. see a64l(3X)lckpwdf(3C): lckpwdf() , ulckpwdf() ............................ control access to /etc/passwd and /etc/shadow fileslcong48() : generate pseudo-random numbers ..................................................................... see drand48(3C)ldcvt(3C): _ldecvt() , _ldfcvt() , _ldgcvt() ............ convert long double floating-point number to string

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxvii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionldecvt() (_ldecvt() ): convert long double floating-point number to string ............................ see ldcvt(3C)ldexp(3M): ldexp() , ldexpf() , ldexpl() , ldexpw() , ldexpq() scale exponent of a floating-point numberldexpf() : scale exponent of a floating-point number (float) ..................................................... see ldexp(3M)ldexpl() : scale exponent of a floating-point number (long double) .......................................... see ldexp(3M)ldexpq() : scale exponent of a floating-point number (quad) .................................................... see ldexp(3M)ldexpw() : scale exponent of a floating-point number (extended) .............................................. see ldexp(3M)ldfcvt() (_ldfcvt() ): convert long double floating-point number to string ............................ see ldcvt(3C)ldgcvt() (_ldgcvt() ): convert long double floating-point number to string ............................ see ldcvt(3C)ldiv() : long integer division and remainder .................................................................................... see div(3C)leaveok() : terminal output control functions ........................................................................... see clearok(3X)lfind() : linear search and update ......................................................................................... see lsearch(3C)lgamma(3M): lgamma() , lgammaf() , lgammal() , lgammaw() , lgammaq() , lgamma_r() , lgammaf_r() ,

lgammal_r() , lgammaw_r() , lgammaq_r() , gamma(), gammaf() , gammal() , gammaw() , gammaq() ,signgam .................................................................................................................... log gamma functions

lgammaf() : log gamma function (float) ................................................................................. see lgamma(3M)lgammaf_r() : reentrant log gamma function (float) ............................................................. see lgamma(3M)lgammal() : log gamma function (long double) ...................................................................... see lgamma(3M)lgammal_r() : reentrant log gamma function (long double) .................................................. see lgamma(3M)lgammaq() : log gamma function (quad) ................................................................................. see lgamma(3M)lgammaq_r() : reentrant log gamma function (quad) ............................................................ see lgamma(3M)lgammaw() : log gamma function (extended) .......................................................................... see lgamma(3M)lgammaw_r() : reentrant log gamma function (extended) ...................................................... see lgamma(3M)lgamma_r() : reentrant log gamma function (double) ............................................................ see lgamma(3M)libkrb5(3): libkrb5() , libkrb5.sl() , libk5crypto() , libk5crypto.sl() , libcom_err() ,

libcom_err.sl() .............................................................................................. Kerberos client librarieslibslp(3N): SLPOpen() , SLPClose() , SLPReg() , SLPDereg() ,

SLPDelAttrs() , SLPFindSrvs() , SLPFindSrvTypes() , SLPFindAttrs() ,SLPParseSrvURL() , SLPEscape() , SLPUnescape() , SLPFree() ,SLPGetRefreshInterval() , SLPFindScopes() , SLPGetProperty() , SLPSetProperty()........................................................................................ SLP (Service Location Protocol) library routines

LINES(3X): LINES ..................................................................................... number of lines on terminal screenllrint(3M): llrint() , llrintf() , llrintl() , llrintw() , llrintq() round to nearest long long functionsllrintf() : round to nearest long long function (float) .............................................................. see llrint(3M)llrintl() : round to nearest long long function (long double) .................................................. see llrint(3M)llrintq() : round to nearest long long function (quad) ............................................................. see llrint(3M)llrintw() : round to nearest long long function (extended) ...................................................... see llrint(3M)llround(3M): llround() , llroundf() , llroundl() , llroundw() , llroundq() round to long long functionsllroundf() : round to long long function (float) .................................................................... see llround(3M)llroundl() : round to long long function (long double) ......................................................... see llround(3M)llroundq() : round to long long function (quad) ................................................................... see llround(3M)llroundw() : round to long long function (extended) ............................................................. see llround(3M)localeconv(3C): localeconv() ............................... query numeric formatting conventions of current localelocaltime() : convert date and time to string ........................................................................... see ctime(3C)localtime_r() : convert date and time to string ....................................................................... see ctime(3C)log(3M): log() , logf() , logl() , logw() , logq() ............................................ natural logarithm functionslog10(3M): log10() , log10f() , log10l() , log10w() , log10q() .................. common logarithm functionslog10f() : common logarithm function (float) ............................................................................ see log10(3M)log10l() : common logarithm function (long double) ................................................................. see log10(3M)log10q() : common logarithm function (quad) ........................................................................... see log10(3M)log10w() : common logarithm function (extended) .................................................................... see log10(3M)log1p(3M): log1p() , log1pf() , log1pl() , log1pw() , log1pq()natural logarithm of one-plus-argument functionslog1pf() : natural logarithm of one-plus-argument function (float) .......................................... see log1p(3M)log1pl() : natural logarithm of one-plus-argument function (long double) .............................. see log1p(3M)log1pq() : natural logarithm of one-plus-argument function (quad) ......................................... see log1p(3M)log1pw() : natural logarithm of one-plus-argument function (extended) .................................. see log1p(3M)log2(3M): log2() , log2f() , log2l() , log2w() , log2q() .............................. logarithm base two functionslog2f() : logarithm base two function (float) ............................................................................... see log2(3M)log2l() : logarithm base two function (long double) .................................................................... see log2(3M)log2q() : logarithm base two function (quad) .............................................................................. see log2(3M)log2w() : logarithm base two function (extended) ........................................................................ see log2(3M)logb(3M): logb() , logbf() , logbl() , logbw() , logbq() ............... radix-independent exponent functions

xxviii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionlogbf() : radix-independent exponent function (float) ................................................................. see logb(3M)logbl() : radix-independent exponent function (long double) ..................................................... see logb(3M)logbq() : radix-independent exponent function (quad) ................................................................ see logb(3M)logbw() : radix-independent exponent function (extended) ......................................................... see logb(3M)logf() : natural logarithm function (float) ..................................................................................... see log(3M)logl() : natural logarithm function (long double) .......................................................................... see log(3M)logname(3C): logname() ........................................................................................ return login name of userlogq() : natural logarithm function (quad) .................................................................................... see log(3M)logw() : natural logarithm function (extended) .............................................................................. see log(3M)longjmp() : restore stack environment for non-local goto ........................................................ see setjmp(3C)longname(3X): longname() ......................................................... get verbose description of current terminallrand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)lrint(3M): lrint() , lrintf() , lrintl() , lrintw() , lrintq() ......... round to nearest long int functionslrintf() : round to nearest long int function (float) ................................................................... see lrint(3M)lrintl() : round to nearest long int function (long double) ........................................................ see lrint(3M)lrintq() : round to nearest long int function (quad) .................................................................. see lrint(3M)lrintw() : round to nearest long int function (extended) ............................................................ see lrint(3M)lround(3M): lround() , lroundf() , lroundl() , lroundw() , lroundq() ........ round to long int functionslroundf() : round to long int function (float) .......................................................................... see lround(3M)lroundl() : round to long int function (long double) ............................................................... see lround(3M)lroundq() : round to long int function (quad) ......................................................................... see lround(3M)lroundw() : round to long int function (extended) ................................................................... see lround(3M)lsearch(3C): lsearch() , lfind() .......................................................................... linear search and updateltoa() : long to ASCII decimal .................................................................................................... see ltostr(3C)ltoa_r() : long to ASCII decimal (MT-Safe) ............................................................................... see ltostr(3C)ltostr(3C): ltostr() , ltostr_r() , ultostr() , ultostr_r() , ltoa() ,

ltoa_r() , ultoa() , ultoa_r() ............................................................. convert long integers to stringsltostr_r() : unsigned long to ASCII (MT-Safe) ........................................................................ see ltostr(3C)mallinfo() : display memory space usage ............................................................................... see malloc(3C)malloc(3C): alloca() , calloc() , free() , mallinfo() ,

malloc() , mallopt() , memorymap() , realloc() , valloc() ......................... main memory allocatormallopt() : control memory space allocation ........................................................................... see malloc(3C)mblen() : multibyte characters and strings conversions ...................................................... see multibyte(3C)mbrlen(3C): mbrlen() ............................................................................... get number of bytes in a charactermbrtowc(3C): mbrtowc() .......................................................... convert a character to a wide-character codembsinit(3C): mbsinit() ............................................................................ determine conversion object statusmbsrtowcs(3C): mbsrtowcs() ...................................................... convert a string to a wide-character stringmbstowcs() : multibyte characters and strings conversions ............................................... see multibyte(3C)mbtowc() : multibyte characters and strings conversions ................................................... see multibyte(3C)memalign(3C): memalign() ..................................................................................... allocate aligned memorymemccpy() : memory operations, copy bytes ........................................................................... see memory(3C)memchr() : memory operations, locate first character ............................................................ see memory(3C)memcmp() : memory operations, compare bytes ...................................................................... see memory(3C)memcpy() : memory operations, copy bytes ............................................................................. see memory(3C)memmove() : memory operations, copy bytes ........................................................................... see memory(3C)memory(3C): memccpy() , memchr() , memcmp() , memcpy() , memset() ,

bcopy() , bcmp() , bzero() , ffs() ........................................................................... memory operationsmemorymap() : display contents of memory allocator ................................................................ see malloc(3C)memset() : memory operations, set memory ........................................................................... see memory(3C)meta(3X): meta() ...................................................................................................... enable/disable meta-keysmkdirp(3G): mkdirp() , rmdirp() ......................................................... create, remove directories in a pathmkfifo(3C): mkfifo() ................................................................................................. make a FIFO special filemktemp(3C): mktemp() ............................................................................................ make a unique file namemktime() : create calendar time value ........................................................................................ see ctime(3C)mktimer(3C): mktimer() ..................................................................................... allocate a per-process timermodf(3M): modf() , modff() , modfl() , modfw() , modfq() ..................... decompose floating-point numbermodff() : decompose floating-point number (float) ..................................................................... see modf(3M)modfl() : decompose floating-point number (long double) .......................................................... see modf(3M)modfq() : decompose floating-point number (quad) ..................................................................... see modf(3M)modfw() : decompose floating-point number (extended) .............................................................. see modf(3M)monitor(3C): monitor() .......................................................................................... prepare execution profile

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxix

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionmount(3N) ...................................................................................... keep track of remotely mounted file systemsmove(3X): move() , wmove() ........................................................................ window cursor location functionsmrand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)multibyte(3C): mblen() , mbtowc() , mbstowcs() , wctomb() ,

wcstombs() ....................................................................... multibyte characters and strings conversionsmvaddch() : add a single-byte character and rendition to a window and advance the cursor ...... see addch(3X)mvaddchnstr() : add length limited string of single-byte characters and renditions to a window

..................................................................................................................................... see addchnstr(3X)mvaddchstr() : add string of single-byte characters and renditions to a window .................. see addchstr(3X)mvaddnstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)mvaddnwstr() : add a wide-character string to a window and advance the cursor ................ see addnwstr(3X)mvaddstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)mvaddwstr() : add a wide-character string to a window and advance the cursor .................. see addnwstr(3X)mvadd_wch() : add a complex character and rendition to a window ........................................ see add_wch(3X)mvadd_wchnstr() : add an array of complex characters and renditions to a window ..... see add_wchnstr(3X)mvadd_wchstr() : add an array of complex characters and renditions to a window ....... see add_wchnstr(3X)mvchgat() : change renditions of characters in a window ............................................................. see chgat(3X)mvcur(3X): mvcur() ....................................................... output cursor movement commands to the terminalmvdelch(): delete character from a window ............................................................................... see delch(3X)mvderwin(3X): mvderwin() ........................................................... define window coordinate transformationmvgetch() : get a single-byte character from the terminal ............................................................ see getch(3X)mvgetnstr() : get a multi-byte character length limited string from the terminal .................... see getnstr(3X)mvgetn_wstr() : get an array of wide characters and function key codes from a terminal .. see getn_wstr(3X)mvgetstr() : get a multi-byte character string from the terminal ............................................... see getstr(3X)mvget_wch() : get a wide character from a terminal ................................................................ see get_wch(3X)mvget_wstr() : get an array of wide characters and function key codes from a terminal .... see getn_wstr(3X)mvhline() : draw lines from single-byte characters and renditions ............................................... see hline(3X)mvhline_set() : draw lines from complex characters and renditions .................................... see hline_set(3X)mvinch() : input a single-byte character and rendition from a window .......................................... see inch(3X)mvinchnstr() : input an array of single-byte characters and renditions from a window ........ see inchnstr(3X)mvinchstr() : input an array of single-byte characters and renditions from a window .......... see inchnstr(3X)mvinnstr() : input a multi-byte character string from a window ................................................ see innstr(3X)mvinnwstr() : input a string of wide characters from a window .............................................. see innwstr(3X)mvinsch() : insert a single-byte character and rendition into a window ....................................... see insch(3X)mvinsnstr() : insert a multi-byte character into a window ....................................................... see insnstr(3X)mvinsstr() : insert a multi-byte character into a window ......................................................... see insnstr(3X)mvinstr() : input a multi-byte character string from a window .................................................. see innstr(3X)mvins_nwstr() : insert a wide-character string into a window ............................................. see ins_nwstr(3X)mvins_wch() : insert a complex character and rendition into a window .................................. see ins_wch(3X)mvins_wstr() : insert a wide-character string into a window ............................................... see ins_nwstr(3X)mvinwstr() : input a string of wide characters from a window ................................................. see innwstr(3X)mvin_wch() : input a complex character and rendition from a window ...................................... see in_wch(3X)mvin_wchnstr() : input an array of complex characters and renditions from a window ... see in_wchnstr(3X)mvin_wchstr() : input an array of complex characters and renditions from a window ..... see in_wchnstr(3X)mvprintw(3X): mvprintw() , mvwprintw() , printw() , wprintw ........... print formatted output in windowmvscanw(3X): mvscanw() , mvwscanw() , scanw() , wscanw() ....... convert formatted input from a windowmvvline() : draw lines from single-byte characters and renditions ............................................... see hline(3X)mvvline_set() : draw lines from complex characters and renditions .................................... see hline_set(3X)mvwaddch() : add a single-byte character and rendition to a window and advance the cursor .... see addch(3X)mvwaddchnstr() : add length limited string of single-byte characters and renditions to a window

..................................................................................................................................... see addchnstr(3X)mvwaddchstr() : add string of single-byte characters and renditions to a window ................ see addchstr(3X)mvwaddnstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)mvwaddnwstr() : add a wide-character string to a window and advance the cursor .............. see addnwstr(3X)mvwaddstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)mvwaddwstr() : add a wide-character string to a window and advance the cursor ................ see addnwstr(3X)mvwadd_wch() : add a complex character and rendition to a window ...................................... see add_wch(3X)

xxx Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionmvwadd_wchnstr() : add an array of complex characters and renditions to a window ... see add_wchnstr(3X)mvwadd_wchstr() : add an array of complex characters and renditions to a window ..... see add_wchnstr(3X)mvwchgat() : change renditions of characters in a window ........................................................... see chgat(3X)mvwdelch(): delete character from a window ............................................................................ see delch(3X)mvwgetch() : get a single-byte character from the terminal .......................................................... see getch(3X)mvwgetnstr() : get a multi-byte character length limited string from the terminal .................. see getnstr(3X)mvwgetn_wstr() : get an array of wide characters and function key codes from a terminal see getn_wstr(3X)mvwgetstr() : get a multi-byte character string from the terminal ............................................. see getstr(3X)mvwget_wch() : get a wide character from a terminal .............................................................. see get_wch(3X)mvwget_wstr() : get an array of wide characters and function key codes from a terminal .. see getn_wstr(3X)mvwhline() : draw lines from single-byte characters and renditions ............................................ see hline(3X)mvwhline_set() : draw lines from complex characters and renditions .................................. see hline_set(3X)mvwin(3X): mvwin() ................................................................................................................... move windowmvwinch() : input a single-byte character and rendition from a window ........................................ see inch(3X)mvwinchnstr() : input an array of single-byte characters and renditions from a window ...... see inchnstr(3X)mvwinchstr() : input an array of single-byte characters and renditions from a window ........ see inchnstr(3X)mvwinnstr() : input a multi-byte character string from a window .............................................. see innstr(3X)mvwinnwstr() : input a string of wide characters from a window ............................................ see innwstr(3X)mvwinsch() : insert a single-byte character and rendition into a window ..................................... see insch(3X)mvwinsnstr() : insert a multi-byte character into a window ..................................................... see insnstr(3X)mvwinsstr() : insert a multi-byte character into a window ....................................................... see insnstr(3X)mvwinstr() : input a multi-byte character string from a window ................................................ see innstr(3X)mvwins_nwstr() : insert a wide-character string into a window ........................................... see ins_nwstr(3X)mvwins_wch() : insert a complex character and rendition into a window ................................ see ins_wch(3X)mvwins_wstr() : insert a wide-character string into a window ............................................. see ins_nwstr(3X)mvwinwstr() : input a string of wide characters from a window .............................................. see innwstr(3X)mvwin_wch() : input a complex character and rendition from a window .................................... see in_wch(3X)mvwin_wchnstr() : input an array of complex characters and renditions from a window . see in_wchnstr(3X)mvwin_wchstr() : input an array of complex characters and renditions from a window ... see in_wchnstr(3X)mvwprintw() : print formatted output in window .................................................................. see mvprintw(3X)mvwscanw() : convert formatted input from a window ............................................................ see mvscanw(3X)mvwvline() : draw lines from single-byte characters and renditions ............................................ see hline(3X)mvwvline_set() : draw lines from complex characters and renditions .................................. see hline_set(3X)nan(3M): nan() , nanf() , nanl() , nanw() , nanq() ............................... string-to-NaN conversion functionsnanf() : string-to-NaN conversion function (float) ........................................................................ see nan(3M)nanl() : string-to-NaN conversion function (long double) ............................................................. see nan(3M)nanq() : string-to-NaN conversion function (quad) ....................................................................... see nan(3M)nanw() : string-to-NaN conversion function (extended) ................................................................. see nan(3M)napms(3X): napms() ............................................................................................. suspend the calling processnc_perror() : get network configuration data base entry ............................................. see getnetconfig(3N)nc_sperror() : get network configuration data base entry ........................................... see getnetconfig(3N)ndbm(3X): dbm_open() , dbm_close() , dbm_fetch() , dbm_store() , dbm_delete() ,

dbm_firstkey() , dbm_nextkey() , dbm_error() , dbm_clearerr() ............... database subroutinesnearbyint(): round to nearest int function ................................................................................... see rint(3M)nearbyintf(): round to nearest int function (float) ........................................................................ see rint(3M)nearbyintl(): round to nearest int function (long double) ............................................................ see rint(3M)nearbyintq(): round to nearest int function (quad) ...................................................................... see rint(3M)nearbyintw(): round to nearest int function (extended) .............................................................. see rint(3M)netdir(3N): netdir() , netdir_getbyname() , netdir_getbyaddr() , netdir_free() ,

netdir_options() , taddr2uaddr() , uaddr2taddr() , netdir_perror() ,netdir_sperror() ......................................................... generic transport name-to-address translation

netdir_free() : generic transport name-to-address translation ............................................ see netdir(3N)netdir_getbyaddr() : generic transport name-to-address translation ................................. see netdir(3N)netdir_getbyname() : generic transport name-to-address translation ................................. see netdir(3N)netdir_options() : generic transport name-to-address translation ...................................... see netdir(3N)netdir_perror() : generic transport name-to-address translation ........................................ see netdir(3N)netdir_sperror() : generic transport name-to-address translation ...................................... see netdir(3N)netname2host() : library routines for secure remote procedure calls ............................. see secure_rpc(3N)netname2user() : library routines for secure remote procedure calls ............................. see secure_rpc(3N)net_aton(3C): net_aton() , net_ntoa() ....................... network station address string conversion routinesnet_ntoa() : network station address string conversion routines .......................................... see net_aton(3C)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxxi

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionnewpad(3X): newpad() , pnoutrefresh() , prefresh() ................................... pad management functionsnewterm() : screen initialisation functions .................................................................................. see initscr(3X)newwin(3X): newwin() , subwin() ........................................................................ window creation functionsnextafter(3M): nextafter() , nextafterf() , nextafterl() , nextafterw() , nextafterq() ,

nexttoward() , nexttowardf() , nexttowardl() , nexttowardw() , nexttowardq()..................................................................................................... next representable floating-point values

nextafterf() : next representable floating-point value (float) .......................................... see nextafter(3M)nextafterl() : next representable floating-point value (long double) ............................... see nextafter(3M)nextafterq() : next representable floating-point value (quad) ......................................... see nextafter(3M)nextafterw() : next representable floating-point value (extended) ................................... see nextafter(3M)nextkey() : database subroutines ................................................................................................. see dbm(3X)nexttoward() : next representable floating-point value (double) ....................................... see nextafter(3M)nexttowardf() : next representable floating-point value (float) ........................................ see nextafter(3M)nexttowardl() : next representable floating-point value (long double) ............................. see nextafter(3M)nexttowardq() : next representable floating-point value (quad) ....................................... see nextafter(3M)nexttowardw() : next representable floating-point value (extended) ................................. see nextafter(3M)nftw() : walk a file tree, executing a function ................................................................................. see ftw(3C)nftw2() : walk a file tree, executing a function .............................................................................. see ftw(3C)nis_add() : NIS+ namespace functions ............................................................................. see nis_names(3N)nis_addmember() : NIS+ group manipulation functions ................................................. see nis_groups(3N)nis_add_entry() : NIS+ table functions .......................................................................... see nis_tables(3N)nis_checkpoint() : NIS+ log administration function ....................................................... see nis_ping(3N)nis_clone_object() : NIS+ subroutine ............................................................................. see nis_subr(3N)nis_creategroup() : NIS+ group manipulation functions ............................................. see nis_groups(3N)nis_db(3N): nis_db() , db_initialize() , db_create_table() , db_destroy_table() ,

db_first_entry() , db_next_entry() , db_reset_next_entry() , db_list_entries() ,db_remove_entry() , db_add_entry() , db_table_exists() , db_unload_table() ,db_checkpoint() , db_standby() , db_free_result() ......................................... write data to a file

nis_destroygroup() : NIS+ group manipulation functions ........................................... see nis_groups(3N)nis_destroy_object() : NIS+ subroutine ......................................................................... see nis_subr(3N)nis_dir_cmp() : NIS+ subroutine ........................................................................................ see nis_subr(3N)nis_domain_of() : NIS+ subroutine .................................................................................... see nis_subr(3N)nis_error(3N) : nis_error() , nis_sperrno() , nis_perror() , nis_lerror() , nis_sperror() ,

nis_sperror_r() ....................................................................................... display NIS+ error messagesnis_first_entry() : NIS+ table functions ...................................................................... see nis_tables(3N)nis_freenames() : NIS+ subroutine .................................................................................... see nis_subr(3N)nis_freeresult() : NIS+ namespace functions .............................................................. see nis_names(3N)nis_freeservlist() : NIS+ misc functions .................................................................. see nis_servers(3N)nis_freetags() : NIS+ misc functions ........................................................................... see nis_servers(3N)nis_getnames() : NIS+ subroutine ...................................................................................... see nis_subr(3N)nis_getservlist() : NIS+ misc functions ..................................................................... see nis_servers(3N)nis_groups(3N): nis_groups() , nis_ismember() , nis_addmember() , nis_removemember() ,

nis_creategroup() , nis_destroygroup() , nis_verifygroup() , nis_print_group_entry() ,nis_map_group() , _nis_map_group() ......................................... NIS+ group manipulation functions

nis_ismember() : NIS+ group manipulation functions ................................................... see nis_groups(3N)nis_leaf_of() : NIS+ subroutine ........................................................................................ see nis_subr(3N)nis_lerror() : display NIS+ error messages ..................................................................... see nis_error(3N)nis_list() : NIS+ table functions ..................................................................................... see nis_tables(3N)nis_local_directory() : NIS+ local names ........................................................ see nis_local_names(3N)nis_local_group() : NIS+ local names ................................................................ see nis_local_names(3N)nis_local_host() : NIS+ local names .................................................................. see nis_local_names(3N)nis_local_names(3N): nis_local_names() , nis_local_directory() , nis_local_host() ,

nis_local_group() , nis_local_principal() ...................................................... NIS+ local namesnis_local_principal() : NIS+ local names ........................................................ see nis_local_names(3N)nis_lookup() : NIS+ namespace functions ...................................................................... see nis_names(3N)nis_map_group() : NIS+ group manipulation functions ................................................. see nis_groups(3N)nis_mkdir() : NIS+ misc functions ................................................................................. see nis_servers(3N)nis_modify() : NIS+ namespace functions ...................................................................... see nis_names(3N)nis_modify_entry() : NIS+ table functions .................................................................... see nis_tables(3N)nis_names(3N): nis_names() , nis_lookup() , nis_add() , nis_remove() , nis_modify() ,

nis_freeresult() ........................................................................................ NIS+ namespace functions

xxxii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionnis_name_of () : NIS+ subroutine ...................................................................................... see nis_subr(3N)nis_next_entry() : NIS+ table functions ........................................................................ see nis_tables(3N)nis_objects(3N): nis_objects() .................................................................................... NIS+ object formatsnis_perror() : display NIS+ error messages ..................................................................... see nis_error(3N)nis_ping(3N): nis_ping() , nis_checkpoint() ..................................... NIS+ log administration functionsnis_print_group_entry() : NIS+ group manipulation functions ................................ see nis_groups(3N)nis_print_object() : NIS+ subroutine ............................................................................. see nis_subr(3N)nis_remove() : NIS+ namespace functions ...................................................................... see nis_names(3N)nis_removemember() : NIS+ group manipulation functions ........................................... see nis_groups(3N)nis_remove_entry() : NIS+ table functions .................................................................... see nis_tables(3N)nis_rmdir() : NIS+ misc functions ................................................................................. see nis_servers(3N)nis_servers(3N): nis_mkdir() , nis_rmdir() , nis_servstate() , nis_stats() , nis_getservlist() ,

nis_freeservlist() , nis_freetags() ............................................................... NIS+ misc functionsnis_servstate() : NIS+ misc functions ......................................................................... see nis_servers(3N)nis_sperrno() : display NIS+ error messages ................................................................... see nis_error(3N)nis_sperror() : display NIS+ error messages ................................................................... see nis_error(3N)nis_sperror_r() : display NIS+ error messages ............................................................... see nis_error(3N)nis_stats() : NIS+ misc functions ................................................................................. see nis_servers(3N)nis_subr(3N): nis_leaf_of() , nis_name_of() , nis_domain_of() , nis_getnames() ,

nis_freenames() , nis_dir_cmp() , nis_clone_object() , nis_destroy_object() ,nis_print_object() .................................................................................................. NIS+ subroutines

nis_tables(3N): nis_list() , nis_add_entry() , nis_remove_entry() , nis_modify_entry() ,nis_first_entry() , nis_next_entry() ...................................................... NIS+ table functions file

nis_verifygroup() : NIS+ group manipulation functions ............................................. see nis_groups(3N)nl(3X): nl() , nonl() .................................................................................. enable/disable newline translationnlist(3E): nlist() ................................................................................................... get entries from name listnl_langinfo(3C): nl_langinfo() ................................................... NLS information about native languagesnl_tools_16(3X): ADVANCE(), byte_status() , BYTE_STATUS(), CHARADV(),

CHARAT() , C_COLWIDTH(), c_colwidth() , firstof2() , FIRSTof2() ,secof2() , SECof2() , WCHAR(), WCHARADV()..................................... tools to process 16-bit characters

nocbreak() : input mode control functions ................................................................................. see cbreak(3X)nodelay(3X): nodelay() .............................................................................. enable/disable block during readnoecho() : enable/disable terminal echo ......................................................................................... see echo(3X)nonl() : enable/disable newline translation ......................................................................................... see nl(3X)noqiflush(3X): noqiflush() , qiflush() ....................................................... enable/disable queue flushingnoraw() : input mode control functions ....................................................................................... see cbreak(3X)notimeout(3X): notimeout() , timeout() , wtimeout() ...................................... control blocking on inputnrand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)ntohl() , ntohs() : convert values from network to host byte order ................................. see byteorder(3N)opendir() : directory operations ......................................................................................... see directory(3C)openlog() : control system log .................................................................................................. see syslog(3C)optarg() : get option letter from argument vector .................................................................... see getopt(3C)opterr() : get option letter from argument vector .................................................................... see getopt(3C)optind() : get option letter from argument vector .................................................................... see getopt(3C)overlay(3X): overlay() , overwrite() ................................................................. copy overlapped windowsoverwrite() : copy overlapped windows ................................................................................... see overlay(3X)pair_content() : color manipulation functions ..................................................... see can_change_color(3X)pam(3): pam .................................................................................................. Pluggable Authentication Modulepam_acct_mgmt(3): pam_acct_mgmt() ................................... perform PAM account validation procedurespam_authenticate(3): pam_authenticate() .............. perform authentication within the PAM frameworkpam_chauthtok(3): pam_chauthtok() ..... perform password related functions within the PAM frameworkpam_close_session() : perform PAM session termination operations ................ see pam_open_session(3)pam_end() : authentication routines for PAM ....................................................................... see pam_start(3)pam_get_data() : PAM routines to maintain module specific state ............................... see pam_set_data(3)pam_get_item() : authentication information routines for PAM ................................... see pam_set_item(3)pam_get_user(3): pam_get_user() ........................................................ PAM routine to retrieve user namepam_open_session(3): pam_open_session() , pam_close_session()

........................................................................ perform PAM session creation and termination operationspam_setcred(3): pam_setcred() .............. modify and delete user credentials for an authentication servicepam_set_data(3): pam_set_data() , pam_get_data() ..... PAM routines to maintain module specific statepam_set_item(3): pam_set_item() , pam_get_item() ......... authentication information routines for PAM

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxxiii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionpam_sm(3): pam_sm() ............................................................................................. PAM Service Module APIspam_sm_acct_mgmt(3): pam_sm_acct_mgmt() ....... service provider implementation for pam_acct_mgmtpam_sm_authenticate(3): pam_sm_authenticate()

.................................................................... service provider implementation for pam_authenticate()pam_sm_chauthtok(3): pam_sm_chauthtok() .... service provider implementation for pam_chauthtok()pam_sm_close_session() : service provider for pam_open_session() and pam_close_session()

.................................................................................................................. see pam_sm_open_session(3)pam_sm_open_session(3): pam_sm_open_session() , pam_sm_close_session()

..................... service provider implementation for pam_open_session() and pam_close_session()pam_sm_setcred(3): pam_sm_setcred() .................. service provider implementation for pam_setcred()pam_start(3): pam_start() , pam_end() .................................................... authentication routines for PAMpam_strerror(3): pam_strerror() ................................................................. get PAM error message stringpathfind(3G): pathfind() ........................................................... search for named file in named directoriespclose() : initiate pipe I/O to/from a process ............................................................................ see popen(3S)pechochar(3X): pechochar() , pecho_wchar() write a character rendition and immediately refresh the padpecho_wchar() : write a character rendition and immediately refresh the pad .................. see pechochar(3X)perror(3C): perror() , errno() , sys_errlist() , sys_nerr() .............................. system error messagespfmt(3C): pfmt() , vpfmt() ..................................................................... display message in standard formatpmap_getmaps() : obsolete library routine for RPC ............................................................... see rpc_soc(3N)pmap_getport() : obsolete library routine for RPC ............................................................... see rpc_soc(3N)pmap_rmtcall() : obsolete library routine for RPC ............................................................... see rpc_soc(3N)pmap_set() : obsolete library routine for RPC ....................................................................... see rpc_soc(3N)pmap_unset() : obsolete library routine for RPC ................................................................... see rpc_soc(3N)pnoutrefresh() : pad management functions ......................................................................... see newpad(3X)popen(3S): popen() , pclose() ................................................................. initiate pipe I/O to/from a processpow(3M): pow() , powf() , powl() , poww() , powq() , pown() ,

pownf() , pownl() , pownw() , pownq() , powlln() , powllnf() , powllnl() , powllnw() , powllnq()........................................................................................................................................... power functions

powf() : power function (float) ...................................................................................................... see pow(3M)powl() : power function (long double) ........................................................................................... see pow(3M)powlln() : power function (double,long long) ............................................................................... see pow(3M)powllnf() : power function (float,long long) ................................................................................ see pow(3M)powllnl() : power function (long double,long long) ..................................................................... see pow(3M)powllnq() : power function (quad,long long) ............................................................................... see pow(3M)powllnw() : power function (extended,long long) ......................................................................... see pow(3M)pown() : power function (double,int) ............................................................................................. see pow(3M)pownf() : power function (float,int) ............................................................................................... see pow(3M)pownl() : power function (long double,int) ................................................................................... see pow(3M)pownq() : power function (quad,int) .............................................................................................. see pow(3M)pownw() : power function (extended,int) ....................................................................................... see pow(3M)powq() : power function (quad) ..................................................................................................... see pow(3M)poww() : power function (extended) ............................................................................................... see pow(3M)prcmd(3N): prcmd() ................................................................. return streams to parallel remote commandsprefresh() : pad management functions .................................................................................. see newpad(3X)printf(3S): printf() , fprintf() , sprintf() , snprintf() ................................... print formatted outputprintw() : print formatted output in window ........................................................................ see mvprintw(3X)pthread(3T): pthread() ............................................................................ introduction to POSIX.1c Threadspthread_atfork(3T): pthread_atfork() .................................................................... register fork handlerspthread_attr_destroy() : destroy a thread attribute ....................................... see pthread_attr_init(3T)pthread_attr_getdetachstate(3T): pthread_attr_setdetachstate() ,

pthread_attr_setstacksize() , pthread_attr_getstacksize() ,pthread_attr_setstackaddr() , pthread_attr_getstackaddr() ,pthread_attr_setguardsize() , pthread_attr_getguardsize() ,pthread_attr_setinheritsched() , pthread_attr_getinheritsched().................................................................................................................................. set and get attributes

pthread_attr_getdetachstate(3T): pthread_attr_setschedpolicy() ,pthread_attr_getschedpolicy() , pthread_attr_setschedparam()f1,pthread_attr_getschedparam() , pthread_attr_setscope() ,pthread_attr_getscope() , pthread_attr_setprocessor_np() ,pthread_attr_getprocessor_np() ................................................................... set and get attributes

pthread_attr_getguardsize() : get guardsize attribute ............. see pthread_attr_getdetachstate(3T)

xxxiv Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionpthread_attr_getinheritsched() : get inheritsched attribute ... see pthread_attr_getdetachstate(3T)pthread_attr_getprocessor_np() : get processor

and binding_type attributes ........................................................ see pthread_attr_getdetachstate(3T)pthread_attr_getschedparam() : get schedparam attribute ....... see pthread_attr_getdetachstate(3T)pthread_attr_getschedpolicy() : get schedpolicy attribute ...... see pthread_attr_getdetachstate(3T)pthread_attr_getscope() : get contentionscope attribute ............ see pthread_attr_getdetachstate(3T)pthread_attr_getstackaddr() : get stackaddr attribute ............. see pthread_attr_getdetachstate(3T)pthread_attr_getstacksize() : get stacksize attribute .............. see pthread_attr_getdetachstate(3T)pthread_attr_init(3T): pthread_attr_init() , pthread_attr_destroy()

............................................................................................. initialize or destroy a thread attribute objectpthread_attr_setdetachstate() : set detachstate attribute ....... see pthread_attr_getdetachstate(3T)pthread_attr_setguardsize() : set guardsize attribute .............. see pthread_attr_getdetachstate(3T)pthread_attr_setinheritsched() : set inheritsched attribute ... see pthread_attr_getdetachstate(3T)pthread_attr_setprocessor_np() : set processor

and binding_type attributes ........................................................ see pthread_attr_getdetachstate(3T)pthread_attr_setschedparam() : set schedparam attribute ........ see pthread_attr_getdetachstate(3T)pthread_attr_setschedpolicy() : set schedpolicy attribute ....... see pthread_attr_getdetachstate(3T)pthread_attr_setscope() : set contentionscope attribute ............ see pthread_attr_getdetachstate(3T)pthread_attr_setstackaddr() : set stackaddr attribute ............. see pthread_attr_getdetachstate(3T)pthread_attr_setstacksize() : set stacksize attribute ............... see pthread_attr_getdetachstate(3T)pthread_cancel(3T): thread_cancel() ............................................................ cancel execution of a threadpthread_cleanup_pop(3T): pthread_cleanup_pop() , pthread_cleanup_push()

......................................................................... register or remove a thread cancellation cleanup handlerpthread_cleanup_push() : register a thread cancellation cleanup handler see pthread_cleanup_pop(3T)pthread_condattr_destroy() : destroy a thread condition variable

attribute object ....................................................................................... see pthread_condattr_init(3T)pthread_condattr_getpshared(3T): pthread_condattr_getpshared() ,

pthread_condattr_setpshared() ............................... get or set the thread process-shared attributepthread_condattr_init(3T): pthread_condattr_init() , pthread_condattr_destroy()

................................................................ initialize or destroy a thread condition variable attribute objectpthread_condattr_setpshared() : set the thread process-shared

attribute .................................................................................... see pthread_condattr_getpshared(3T)pthread_cond_broadcast() : unblock all threads waiting on a condition

variable ..................................................................................................... see pthread_cond_signal(3T)pthread_cond_destroy() : destroy a thread condition variable ....................... see pthread_cond_init(3T)pthread_cond_init(3T): pthread_cond_init() , pthread_cond_destroy()

......................................................................................... initialize or destroy a thread condition variablepthread_cond_signal(3T): pthread_cond_signal() , pthread_cond_broadcast()

........................................................................ unblock one or all threads waiting on a condition variablepthread_cond_timedwait() : timed wait on a thread condition variable ....... see pthread_cond_wait(3T)pthread_cond_wait(3T): pthread_cond_wait() , pthread_cond_timedwait()

...................................................................................... wait or timed wait on a thread condition variablepthread_continue() : continue execution of a thread .................................... see pthread_resume_np(3T)pthread_create(3T): pthread_create() ................................................... create a new thread of executionpthread_detach(3T): pthread_detach()

.................................................... mark a thread as detached to reclaim its resources when it terminatespthread_equal(3T): pthread_equal() ......................................................... compare two thread identifierspthread_exit(3T): pthread_exit() .................................................... cause the calling thread to terminatepthread_getconcurrency(3T): pthread_getconcurrency() , pthread_setconcurrency()

...................................................................................... get and set concurrency level of unbound threadspthread_getschedparam(3T): pthread_getschedparam() , pthread_setschedparam()

........................................................................... get and set scheduling policy and associated parameterspthread_getspecific(3T): pthread_getspecific() , pthread_setspecific()

......................................................................... get and set the thread-specific data associated with a keypthread_gettimeslice_np() : set or get the scheduling timeslice value for PTHREAD_SCOPE_PROCESS

threads with SCHED_TIMESHAREscheduling policy .......................... see pthread_gettimeslice_np(3T)pthread_gettimeslice_np(3T): pthread_settimeslice_np() , pthread_gettimeslice_np()

............................. set or get the scheduling timeslice value for PTHREAD_SCOPE_PROCESSthreads withSCHED_TIMESHAREscheduling policy

pthread_join(3T): pthread_join() ....................................... wait for the termination of a specified threadpthread_key_create(3T): pthread_key_create() , pthread_key_delete()

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxxv

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Description............................................................................................... create or destroy a thread-specific data key

pthread_key_delete() : destroy a thread-specific data key .......................... see pthread_key_create(3T)pthread_kill(3T): pthread_kill() ........................................................................ send a signal to a threadpthread_launch_policy(3T): pthread_launch_policy() ............................. setting thread launch policypthread_ldom_bind_np() : bind threads to locality domain ............ see pthread_processor_bind_np(3T)pthread_ldom_id_np() : obtain locality domain ID ......................... see pthread_processor_bind_np(3T)pthread_mutexattr_destroy() : destroy a mutex attribute object ........ see pthread_mutexattr_init(3T)pthread_mutexattr_disable_handoff_np() : disable mutex-specific handoff mode

................................................................................................ see pthread_mutexattr_getspin_np(3T)pthread_mutexattr_getprioceiling() : get the prioceiling attribute

..................................................................................................... see pthread_mutex_getprotocol(3T)pthread_mutexattr_getprotocol(3T): pthread_mutexattr_getprotocol() ,

pthread_mutexattr_setprotocol() , pthread_mutexattr_getprioceiling() ,pthread_mutexattr_setprioceiling() ................. get or set the protocol and prioceiling attributes

pthread_mutexattr_getpshared(3T): pthread_mutexattr_getpshared() ,pthread_mutexattr_setpshared() , pthread_mutexattr_gettype() ,pthread_mutexattr_settype().......................................................................................... get or set the process-shared or type attributes

pthread_mutexattr_getspin_np(3T): pthread_mutexattr_getspin_np() ,pthread_mutexattr_setspin_np() , pthread_mutex_getyieldfreq_np() ,pthread_mutex_setyieldfreq_np() , pthread_mutexattr_disable_handoff_np() ,pthread_mutex_disable_handoff_np() . get and set the mutex spin and yield frequency attributes;disable mutex-specific or process-wide mutex handoff mode

pthread_mutexattr_gettype() : get the type attribute ........... see pthread_mutexattr_getpshared(3T)pthread_mutexattr_init(3T): pthread_mutexattr_init() , pthread_mutexattr_destroy()

.............................................................................................. initialize or destroy a mutex attribute objectpthread_mutexattr_setprioceiling() : set the prioceiling attribute

..................................................................................................... see pthread_mutex_getprotocol(3T)pthread_mutexattr_setprotocol() : set the protocol attribute ... see pthread_mutex_getprotocol(3T)pthread_mutexattr_setpshared() : set the process-shared attribute

............................................................................................... see pthread_mutexattr_getpshared(3T)pthread_mutexattr_setspin_np() : set the spin attribute ...... see pthread_mutexattr_getspin_np(3T)pthread_mutexattr_settype() : set the type attribute ........... see pthread_mutexattr_getpshared(3T)pthread_mutex_destroy() : destroy a mutex ................................................ see pthread_mutex_init(3T)pthread_mutex_disable_handoff_np() : disable process-wide mutex handoff mode

................................................................................................ see pthread_mutexattr_getspin_np(3T)pthread_mutex_getprioceiling(3T): pthread_mutex_getprioceiling() ,

pthread_mutex_setprioceiling() .......................................... get and set the prioceiling of a mutexpthread_mutex_getyieldfreq_np() : get the yield frequency attribute

...................................................................................................... see pthread_mutex_getspin_np(3T)pthread_mutex_init(3T): pthread_mutex_init() , pthread_mutex_destroy()

....................................................................................................................... initialize or destroy a mutexpthread_mutex_lock(3T): pthread_mutex_lock() , pthread_mutex_trylock() lock/try to lock a mutexpthread_mutex_setprioceiling() : set the prioceiling of a mutexsee pthread_mutex_getprioceiling(3T)pthread_mutex_setyieldfreq_np() : set the yield frequency attribute

...................................................................................................... see pthread_mutex_getspin_np(3T)pthread_mutex_trylock() : try to lock a mutex ........................................... see pthread_mutex_lock(3T)pthread_mutex_unlock(3T): pthread_mutex_unlock() ................................................... unlock a mutexpthread_num_ldomprocs_np() : number of processors in locality domain

..................................................................................................... see pthread_processor_bind_np(3T)pthread_num_ldoms_np() : number of locality domains on system

..................................................................................................... see pthread_processor_bind_np(3T)pthread_num_processors_np() : determined how many processors

are available ................................................................................. see pthread_processor_bind_np(3T)pthread_once(3T): pthread_once() ................................................. call an initialization routine only oncepthread_processor_bind_np(3T): pthread_num_processors_np() , pthread_processor_bind_np() ,

pthread_pset_bind_np() , pthread_processor_id_np()pthread_num_ldoms_np() , pthread_num_ldomprocs_np() , pthread_spu_to_ldom_np() ,pthread_ldom_bind_np() , pthread_ldom_id_np() .................. determine number of processors orlocality domains, available, processor IDs, locality domain IDs, and bind threads to processors andlocality domains

xxxvi Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionpthread_processor_id_np() : bind threads to processors ............. see pthread_processor_bind_np(3T)pthread_pset_bind_np() : bind threads to processor set ................ see pthread_processor_bind_np(3T)pthread_resume_np(3T): pthread_continue() , pthread_resume_np() , pthread_suspend()

................................................................................... continue, resume, or suspend execution of a threadpthread_rwlockattr_destroy() : destroy a read-write lock attribute object

............................................................................................................ see pthread_rwlockattr_init(3T)pthread_rwlockattr_getpshared(3T): pthread_rwlockattr_getpshared() ,

pthread_rwlockattr_setpshared() ....................................... get or set the process-shared attributepthread_rwlockattr_init(3T): pthread_rwlockattr_init() , pthread_rwlockattr_destroy()

................................................................................ initialize or destroy a read-write lock attribute objectpthread_rwlockattr_setpshared() : set the process-shared attribute

.............................................................................................. see pthread_rwlockattr_getpshared(3T)pthread_rwlock_destroy() : destroy a read-write lock ............................... see pthread_rwlock_init(3T)pthread_rwlock_init(3T): pthread_rwlock_init() , pthread_rwlock_destroy()

......................................................................................................... initialize or destroy a read-write lockpthread_rwlock_rdlock(3T): pthread_rwlock_rdlock() , pthread_rwlock_tryrdlock()

.................................................................................. lock or attempt to lock a read-write lock for readingpthread_rwlock_tryrdlock() : attempt to lock a read-write lock for reading

............................................................................................................. see pthread_rwlock_rdlock(3T)pthread_rwlock_trywrlock() : attempt to lock a read-write lock for writing

............................................................................................................ see pthread_rwlock_wrlock(3T)pthread_rwlock_unlock(3T): pthread_rwlock_unlock() .................................. unlock a read-write lockpthread_rwlock_wrlock(3T): pthread_rwlock_wrlock() , pthread_rwlock_trywrlock()

.................................................................................. lock or attempt to lock a read-write lock for writingpthread_self(3T): pthread_self() ............................................ obtain the thread ID for the calling threadpthread_setcancelstate(3T): pthread_setcanceltype() , pthread_setcancelstate()

.............................................................. set and retrieve the current thread’s cancelability state and typepthread_setcanceltype() : set and retrieve the current thread’s cancelability type

............................................................................................................. see pthread_setcancelstate(3T)pthread_setconcurrency() : set concurrency level of unbound threadssee pthread_getconcurrency(3T)pthread_setschedparam() : set scheduling policy and associated parameters

............................................................................................................ see pthread_getschedparam(3T)pthread_setspecific() : set the thread-specific data associated with a key see pthread_getspecific(3T)pthread_sigmask(3T): pthread_sigmask() ..... examine and change the signal mask of the calling threadpthread_spu_to_ldom_np() : ID of locality domain specified by spusee pthread_processor_bind_np(3T)pthread_suspend() : suspend execution of a thread ...................................... see pthread_resume_np(3T)pthread_testcancel(3T): pthread_testcancel() .................... process any pending cancellation requestsptsname(3C): ptsname() , ptsname_r() ........................................................... get the name of a slave ptyptsname_r() : get the name of a slave pty ............................................................................ see ptsname(3C)publickey() : retrieve public or secret key ................................................................. see getpublickey(3M)putc(3S): putc() , fputc() , putchar() , putw() , putc_unlocked() ,

putchar_unlocked() , putw_unlocked() ....................................... put character or word on a streamputchar() : put character or word on a stream ............................................................................ see putc(3S)putchar_unlocked() : put character or word on a stream ......................................................... see putc(3S)putc_unlocked() : put character or word on a stream ............................................................... see putc(3S)putdvagnam : add or rewrite device assignment database entry ......................................... see getdvagent(3)putenv(3C): putenv() ............................................................................ change or add value to environmentputp(3X): putp() , tputs() ........................................................................ output commands to the terminalputprdfnam() : put default control entry ............................................................................ see getprdfent(3)putprpwnam() : manipulate protected password database entry ...................................... see getprpwent(3)putprtcnam() : put entry into terminal control database .................................................... see getprtcent(3)putpwent(3C): putpwent() ..................................................................................... write password file entryputs(3S): puts() , fputs() , puts_unlocked() , fputs_unlocked()

.............................................................................................................................. put a string on a streamputspent(3C): putspent .............................................................................. write shadow password file entryputs_unlocked() : put a string on a stream ................................................................................ see puts(3S)pututline() : access utmp file entry .......................................................................................... see getut(3C)pututsline() : access/update routines for user-accounting database maintained by utmpd(1M)

............................................................................................................................................ see getuts(3C)pututxline() : access utmpx file entry .................................................................................... see getutx(3C)putw() : put character or word on a stream .................................................................................. see putc(3S)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxxvii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionputwc(3C): putwc() , putwchar() , fputwc() , putwc_unlocked() ,

putwchar_unlocked() , fputwc_unlocked() ............................ put a wide character on a stream fileputwchar() : put a wide character on a stream file .................................................................. see putwc(3C)putwchar_unlocked() : put a wide character on a stream file ................................................ see putwc(3C)putwc_unlocked() : put a wide character on a stream file ...................................................... see putwc(3C)putwin() : dump window to and reload window from a file ........................................................ see getwin(3X)putws(3C): putws() , fputws() , putws_unlocked() , fputws_unlocked()

............................................................................................... put a wide-character string on a stream fileputws_unlocked() : put a wide-character string on a stream file ............................................ see putws(3C)putw_unlocked() : put character or word on a stream ............................................................... see putc(3S)qiflush() : enable/disable queue flushing ............................................................................. see noqiflush(3X)qsort(3C): qsort() ........................................................................................................................ quicker sortrand(3C): rand() , srand() ....................................................................... simple random-number generatorrandom() : pseudorandom number generation functions ....................................................... see random(3M)random(3M): random() , srandom() , initstate() , setstate() ........ generate a pseudorandom numberraw() : input mode control functions ........................................................................................... see cbreak(3X)rcmd() : return a stream to a remote command .......................................................................... see rcmd(3N)rcmd(3N): rcmd() , rcmd_af() , rresvport() , rresvport_af() , ruserok()

........................................................................................................ return a stream to a remote commandreaddir() : directory operations ......................................................................................... see directory(3C)realloc() : change size of allocated memory block .................................................................. see malloc(3C)realpath(1): realpath() ..................................................................................................... resolve pathnameredrawwin(3X): redrawwin() , wredrawln() ................................................... line update status functionsrefresh(): refresh windows and lines ................................................................................... see doupdate(3X)regcmp(3X): regcmp() , regex() ...................................................... compile and execute regular expressionregcomp(3C): regcomp() , regerror() , regexec() , regfree() ..... regular expression matching routinesregerror() : regular expression matching routines ............................................................. see regcomp(3C)regex() : compile and execute regular expression .................................................................. see regcmp(3X)regexec() : regular expression matching routines ............................................................... see regcomp(3C)regexp(3X): compile() , step() , advance() ...................... regular expression compile and match routinesregfree() : regular expression matching routines ............................................................... see regcomp(3C)registerrpc() : obsolete library routine for RPC ................................................................. see rpc_soc(3N)reltimer(3C): reltimer() ......................................................................... relatively arm a per-process timerremainder(3M): remainder() , remainderf() , remainderl() , remainderw() , remainderq()

.................................................................................................................................... remainder functionsremainderf() : remainder function (float) ....................................................................... see remainder(3M)remainderl() : remainder function (long double) ............................................................ see remainder(3M)remainderq() : remainder function (quad) ...................................................................... see remainder(3M)remainderw() : remainder function (extended) ................................................................ see remainder(3M)remove(3C): remove() ................................................................................................................ remove a fileremque() : remove an element in a queue ................................................................................ see insque(3C)remquo(3M): remquo() , remquof() , remquol() , remquow() , remquoq()remainder functions with quotientremquof() : remainder function with quotient (float) ............................................................ see remquo(3M)remquol() : remainder function with quotient (long double) ................................................. see remquo(3M)remquoq() : remainder function with quotient (quad) ........................................................... see remquo(3M)remquow() : remainder function with quotient (extended) ..................................................... see remquo(3M)request_init() : access control library .......................................................................... see hosts_access(3)request_set() : access control library ............................................................................ see hosts_access(3)resetty(3X): resetty() , savetty() .................................................................... save/restore terminal modereset_prog_mode() : restore terminal modes to ‘‘program’’ (in Curses) state ......... see def_prog_mode(3X)reset_shell_mode() : restore terminal modes to ‘‘shell’’ (not in Curses) state ....... see def_prog_mode(3X)resolver(3N) : dn_comp() , dn_expand() , get_resfield() , herror() ,

res_init() , res_mkquery() , res_query() , res_search() , res_send() ,set_resfield() ............................................................................................................ resolver routines

resolver(3N) : res_init() , res_mkquery() , res_query() , res_search() , res_send() , dn_comp() ,dn_expand() , herror() , get_resfield() , set_resfield() ................................. resolver routines

restartterm() : interface to terminfo database ............................................................ see del_curterm(3X)res_init() , res_mkquery() , res_query() , res_search() , res_send() , - resolver routines

.............................................................................................................................................. resolver(3N)res_init() : resolver routines .............................................................................................. see resolver(3N)res_mkquery() : resolver routines ........................................................................................ see resolver(3N)

xxxviii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionres_query() : resolver routines ............................................................................................ see resolver(3N)res_search() : resolver routines .......................................................................................... see resolver(3N)res_send() : resolver routines .............................................................................................. see resolver(3N)rewind() : reposition a file pointer in a stream ........................................................................... see fseek(3S)rewinddir() : directory operations ..................................................................................... see directory(3C)rewind_unlocked() : reposition a file pointer in a stream ........................................................ see fseek(3S)rexec(3N): rexec() ................................................................................. return stream to a remote commandre_comp(3X): re_comp() , re_exec() ............................................ compile and execute regular expressionsre_exec() : compile and execute regular expressions ........................................................... see re_comp(3X)rindex() : BSD portability string routine .................................................................................. see string(3C)rint(3M): rint() , rintf() , rintl() , rintw() , rintq() , nearbyint() , nearbyintf() ,

nearbyintl() , nearbyintw() , nearbyintq() ..................................... round to nearest int functionsrintf() : round to nearest integer function function (float) ......................................................... see rint(3M)rintl() : round to nearest integer function function (long double) .............................................. see rint(3M)rintq() : round to nearest integer function function (quad) ......................................................... see rint(3M)rintw() : round to nearest integer function function (extended) .................................................. see rint(3M)ripoffline(3X): ripoffline() ............................................................. reserve a dedicated line for a purposermdirp() : remove directories in a path .................................................................................. see mkdirp(3G)rmtimer(3C): rmtimer() ........................................................................................... free a per-process timerrnusers(3N): rnusers() , rusers() ................................ return information about users on remote machinesround(3M): round() , roundf() , roundl() , roundw() , roundq() ..................................... round functionsroundf() : round function (float) ............................................................................................... see round(3M)roundl() : round function (long double) ................................................................................... see round(3M)roundq() : round function (quad) .............................................................................................. see round(3M)roundw() : round function (extended) ....................................................................................... see round(3M)rpc(3N): rpc ................................................................................... library routines for remote procedure callsrpcbind(3N): rpcb)getmaps() , rpcb_getaddr() , rpcb_gettime() , rpcb_rmtcall() ,

rpcb_set() , rpcb_unset() ......................................................... library routines for RPC bind servicerpcb_getaddr() : library routine for RPC bind service ........................................................ see rpcbind(3N)rpcb_getmaps() : library routine for RPC bind service ........................................................ see rpcbind(3N)rpcb_gettime() : library routine for RPC bind service ........................................................ see rpcbind(3N)rpcb_rmtcall() : library routine for RPC bind service ........................................................ see rpcbind(3N)rpcb_set() : library routine for RPC bind service ................................................................ see rpcbind(3N)rpcb_unset() : library routine for RPC bind service ............................................................ see rpcbind(3N)rpc_broadcast() : library routine for client side calls, rpc ....................................... see rpc_clnt_calls(3N)rpc_broadcast_exp() : library routine for client side calls, rpc ............................... see rpc_clnt_calls(3N)rpc_call() : library routine for client side calls, rpc .................................................. see rpc_clnt_calls(3N)rpc_clnt_auth(3N): rpc_clnt_auth() , auth_destroy() ,authnone_create() , authsys_create() ,

authsys_create_default() ...... library routines for client side remote procedure call authenticationrpc_clnt_calls(3N): clnt_call() , clnt_freeres() , clnt_geterr() , clnt_perrno() , clnt_perror() ,

clnt_sperrno() , clnt_sperror() , rpc_broadcast() , rpc_broadcast_exp() ,rpc_call() ................................................................................ library routines for client side calls, rpc

rpc_clnt_create(3N): clnt_control() , clnt_create() , clnt_create_vers() , clnt_destroy() ,clnt_dg_create() , clnt_pcreateerror() , clnt_raw_create() , clnt_spcreateerror() ,clnt_tli_create() , clnt_tp_create() , clnt_vc_create() , rpc_createerr()..................................................................................... library routines for dealing with CLIENT handles

rpc_createerr() : library routines for dealing with CLIENT handles, rpc ........... see rpc_clnt_create(3N)rpc_reg() : library routine for registering rpc servers ................................................... see rpc_svc_reg(3N)rpc_soc(3N): authdes_create() , authunix_create() , authunix_create_default() , callrpc() ,

clnt_broadcast() , clntraw_create() , clnttcp_create() , clntudp_bufcreate() ,clntudp_create() , get_myaddress() , pmap_getmaps() , pmap_getport() , pmap_rmtcall() ,pmap_set() , pmap_unset() , registerrpc() , svc_fds() , svc_getcaller() ,svc_getreq() ...................................................................................... obsolete library routines for RPC

rpc_soc(3N): svc_register() , svc_unregister() , svcfd_create() , svcraw_create() ,svctcp_create() , svcudp_bufcreate() , svcudp_create() , xdr_authunix()................................................................................................................ obsolete library routines for RPC

rpc_svc_calls(3N): svc_dg_enablecache() , svc_done() , svc_exit() , svc_fdset() , svc_freeargs() ,svc_getargs() , svc_getreq_common() , svc_getreq_poll() , svc_getreqset() ,svc_getrpccaller() , svc_pollset() , svc_run() , svc_sendreply()................................................................................................................. library routines for RPC servers

rpc_svc_create(3N): svc_control() , svc_create() , svc_destroy() , svc_dg_create() ,

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xxxix

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionsvc_fd_create() , svc_raw_create() , svc_tli_create() , svc_tp_create() ,svc_vc_create() ............................................... library routines for the creation of server handles, rpc

rpc_svc_err(3N): svcerr_auth() , svcerr_decode() , svcerr_noproc() , svcerr_noprog() ,svcerr_progvers() , svcerr_systemerr() , svcerr_weakauth()..................................................................... library routines for server side remote procedure call errors

rpc_svc_reg(3N): rpc_reg() , svc_reg() , svc_unreg() , svc_auth_reg() , xprt_register() ,xprt_unregister() ............................................................ library routines for registering servers, rpc

rpc_xdr(3N): xdr_accepted_reply() , xdr_authsys_parms() , xdr_callhdr() , xdr_callmsg() ,xdr_opaque_auth() , xdr_rejected_reply() , xdr_replymsg()........................................................................................ XDR library routines for remote procedure calls

rresvport() : return a stream to a remote command ................................................................ see rcmd(3N)rresvport_af() : return a stream to a remote command .......................................................... see rcmd(3N)rsqrt(3M): rsqrt() , rsqrtf() , rsqrtl() , rsqrtw() , rsqrtq() ............. reciprocal square root functionsrsqrtf() : reciprocal square root function (float) ....................................................................... see rsqrt(3M)rsqrtl() : reciprocal square root function (long double) ............................................................ see rsqrt(3M)rsqrtq() : reciprocal square root function (quad) ...................................................................... see rsqrt(3M)rsqrtw() : reciprocal square root function (extended) ................................................................ see rsqrt(3M)rstat(3N): rstat() , havedisk() ...................................................... get performance data from remote kernelruserok() : return a stream to a remote command .................................................................... see rcmd(3N)rwall(3N): rwall() ...................................................................................... write to specified remote machinessavetty() : save/restore terminal mode ..................................................................................... see resetty(3X)scalb(3M): scalb() .......................................... scale exponent of a radix-independent floating-point numberscalbf() : scale exponent of a radix-independent floating-point number (float) ........................ see scalb(3M)scalbl() : scale exponent of a radix-independent floating-point number (long double) ............ see scalb(3M)scalbln(3M): scalbln() , scalblnf() , scalblnl() , scalblnw() , scalblnq()

.................................................................... scale exponent of a radix-independent floating-point numberscalblnf() : scale exponent of a radix-independent floating-point number (float) ................ see scalbln(3M)scalblnl() : scale exponent of a radix-independent floating-point number (long double) ..... see scalbln(3M)scalblnq() : scale exponent of a radix-independent floating-point number (quad) ............... see scalbln(3M)scalblnw() : scale exponent of a radix-independent floating-point number (extended) ........ see scalbln(3M)scalbn(3M): scalbn() , scalbnf() , scalbnl() , scalbnw() , scalbnq()

.................................................................... scale exponent of a radix-independent floating-point numberscalbnf() : scale exponent of a radix-independent floating-point number (float) ................... see scalbn(3M)scalbnl() : scale exponent of a radix-independent floating-point number (long double) ........ see scalbn(3M)scalbnq() : scale exponent of a radix-independent floating-point number (quad) .................. see scalbn(3M)scalbnw() : scale exponent of a radix-independent floating-point number (extended) ............ see scalbn(3M)scalbq() : scale exponent of a radix-independent floating-point number (quad) ....................... see scalb(3M)scalbw() : scale exponent of a radix-independent floating-point number (extended) ................ see scalb(3M)scandir(3C): scandir() , alphasort() ................................................................................ scan a directoryscanf(3S): scanf() , fscanf() , sscanf() ....................... formatted input conversion, read from stream filescanw() : convert formatted input from a window .................................................................. see mvscanw(3X)scrl(3X): scrl() , wscrl() ............................................................ enhanced scroll a curses window functionsscroll(3X): scroll() ..................................................................................................... scroll a curses windowscrollok() : terminal output control functions ......................................................................... see clearok(3X)scr_dump(3X): scr_dump() , scr_init() , scr_restore() , scr_set() screen file input/output functionsscr_init() : screen file input/output functions ..................................................................... see scr_dump(3X)scr_restore() : screen file input/output functions ............................................................... see scr_dump(3X)scr_set() : screen file input/output functions ....................................................................... see scr_dump(3X)secdef(3): secdef ......................................................................... security defaults configuration file routinessecof2() , SECof2() : process 16-bit characters .............................................................. see nl_tools_16(3X)secure_rpc(3N): _authdes_getucred() , authdes_seccreate() , getnetname() ,

host2netname() , key_decryptsession() , key_encryptsession() , key_gendes() ,key_setsecret() , key_secretkey_is_set() , netname2host() , netname2user() ,user2netname() ........................................................ library routines for secure remote procedure calls

seed48() : generate pseudo-random numbers ....................................................................... see drand48(3C)seekdir() : directory operations ......................................................................................... see directory(3C)setaclentry(3C): setaclentry() , fsetaclentry() ........... add, modify, or delete access control list entrysetbuf(3S): setbuf() , setvbuf() , setvbuf_unlocked()

.................................................................................................................. assign buffering to a stream filesetbwent() : write records into new wtmps and btmps database .......................................... see bwtmps(3C)setcat(3): setcat() ......................................................................................... set the default message catalog

xl Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionsetcchar(3X): setcchar() ................................................ set cchar_t from a wide character and renditionsetclock(3C): setclock() ................................................................................ set value of system-wide clocksetdvagent : set device assignment database entry ........................................................... see getdvagent(3)setfsent() : get file system descriptor file entry ................................................................... see getfsent(3X)setgrent() : get group file entry .......................................................................................... see getgrent(3C)sethostent() : set network host entry ............................................................................. see gethostent(3N)setjmp(3S): setjmp() , longjmp() , sigsetjmp() , siglongjmp()

...................................................................................... save/restore stack environment for non-local gotosetlabel(3): setlabel() ........................................................................... define label for formatting routinessetlocale(3C): setlocale_r() , getlocale() , getlocale_r() ........... set and get the locale of a programsetlocale_r() : set the locale of a program (MT-Safe) ....................................................... see setlocale(3C)setlogmask() : control system log ............................................................................................ see syslog(3C)setmntent() : get file system descriptor file entry ............................................................. see getmntent(3X)setnetconfig() : get network configuration data base entry ....................................... see getnetconfig(3N)setnetent() : get network entry ........................................................................................... see getnetent(3N)setnetent_r() : get network entry ....................................................................................... see getnetent(3N)setnetpath() : get /etc/netconfig entry corresponding to NETPATH component ............ see getnetpath(3N)setprdfent() : rewind default control files ......................................................................... see getprdfent(3)setprotoent() : set protocol entry ................................................................................. see getprotoent(3N)setprotoent_r() : set protocol entry (thread-safe) ....................................................... see getprotoent(3N)setprpwent() : set protected password database entry .................................................... see getprpwent(3)setprtcent() : rewind terminal control database ............................................................... see getprtcent(3)setpwent() : get password file entry ................................................................................... see getpwent(3C)setpwent() : get secure password file entry ......................................................................... see getspent(3C)setscrreg() : terminal output control functions ....................................................................... see clearok(3X)setservent() : set service entry ...................................................................................... see getservent(3N)setservent_r() : set service entry (thread-safe) ............................................................. see getservent(3N)setspwent() : get secure password file entry on trusted systems ...................................... see getspwent(3X)setspwent_r() : get secure password file entry on trusted systems ................................. see getspwent(3X)setstate() : pseudorandom number functions ..................................................................... see random(3M)setupterm() : interface to terminfo database ................................................................ see del_curterm(3X)setusershell() - rewind legal user shells file ............................................................... see getusershell(3C)setutent() : access utmp file entry ............................................................................................ see getut(3C)setutsent() : access/update routines for user-accounting database maintained by utmpd(1M)

............................................................................................................................................ see getuts(3C)setutxent() : access utmpx file entry ...................................................................................... see getutx(3C)setvbuf() : assign buffering to a stream file ............................................................................. see setbuf(3S)setvbuf_unlocked() : assign buffering to a stream file .......................................................... see setbuf(3S)set_curterm() : interface to terminfo database ............................................................ see del_curterm(3X)set_resfield - resolver routines ................................................................................................. resolver(3N)set_resfield() : resolver routines ...................................................................................... see resolver(3N)set_term(3X): set_term() .......................................................................................... switch between screensshl_definesym() : explicit load of shared libraries ............................................................. see shl_load(3X)shl_findsym() : explicit load of shared libraries ................................................................. see shl_load(3X)shl_get() : explicit load of shared libraries .......................................................................... see shl_load(3X)shl_gethandle() : explicit load of shared libraries ............................................................. see shl_load(3X)shl_gethandle_r() : explicit load of shared libraries ......................................................... see shl_load(3X)shl_getsymbols() : explicit load of shared libraries ........................................................... see shl_load(3X)shl_get_r() : explicit load of shared libraries ...................................................................... see shl_load(3X)shl_load(3X): shl_load() , shl_definesym() , shl_findsym() , shl_gethandle() ,

shl_getsymbols() , shl_unload() , shl_get() , shl_gethandle_r() , shl_get_r().................................................................................................................. explicit load of shared libraries

shl_unload() : explicit load of shared libraries .................................................................... see shl_load(3X)sigaddset() : initialize, manipulate, and test signal sets ...................................................... see sigsetops(3C)sigdelset() : initialize, manipulate, and test signal sets ...................................................... see sigsetops(3C)sigemptyset() : initialize, manipulate, and test signal sets ................................................. see sigsetops(3C)sigfillset() : initialize, manipulate, and test signal sets ................................................... see sigsetops(3C)sigismember() : initialize, manipulate, and test signal sets ................................................. see sigsetops(3C)siglongjmp() : restore signal mask if its is saved by sigsetjmp() ...................................... see setjmp(3C)signbit(3M): signbit() .............................................................................. floating-point sign-determinationsigngam() : log gamma function ............................................................................................ see lgamma(3M)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xli

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionsigpause(3C): sigpause() .................................... atomically release blocked signals and wait for interruptsigset(3C): sigset() , sighold() , sigrelse() , sigignore() , sigpause() ............. signal managementsigsetjmp() : save signal mask if savemask is non-zero ......................................................... see setjmp(3C)sigsetops(3C): sigemptyset() , sigfillset() , sigaddset() ,

sigdelset() , sigismember() ............................................. initialize, manipulate, and test signal setssin(3M): sin() , sinf() , sinl() , sinw() , sinq() .................................................................. sine functionssincos(3M): sincos() , sincosf() , sincosl() , sincosw() , sincosq() ................... both sine and cosinesincosd(3M): sincosd() , sincosdf() , sincosdl() , sincosdw() , sincosdq()

.................................................................................................... both sine and cosine of degree argumentsincosdf() : both sine and cosine of degree argument (float) ............................................... see sincosd(3M)sincosdl() : both sine and cosine of degree argument (long double) .................................... see sincosd(3M)sincosdq() : both sine and cosine of degree argument (quad) .............................................. see sincosd(3M)sincosdw() : both sine and cosine of degree argument (extended) ........................................ see sincosd(3M)sincosf() : both sine and cosine (float) .................................................................................... see sincos(3M)sincosl() : both sine and cosine (long double) ........................................................................ see sincos(3M)sincosq() : both sine and cosine (quad) ................................................................................... see sincos(3M)sincosw() : both sine and cosine (extended) ............................................................................ see sincos(3M)sind(3M): sind() , sindf() , sindl() , sindw() , sindq() ..................... sine functions of degree argumentsindf() : sine function of degree argument (float) ....................................................................... see sind(3M)sindl() : sine function of degree argument (long double) ............................................................ see sind(3M)sindq() : sine function of degree argument (quad) ...................................................................... see sind(3M)sindw() : sine function of degree argument (extended) ................................................................ see sind(3M)sinf() : sine function (float) ........................................................................................................... see sin(3M)sinh(3M): sinh() , sinhf() , sinhl() , sinhw() , sinhq() .................................... hyperbolic sine functionssinhf() : hyperbolic sine function (float) ..................................................................................... see sinh(3M)sinhl() : hyperbolic sine function (long double) .......................................................................... see sinh(3M)sinhq() : hyperbolic sine function (quad) .................................................................................... see sinh(3M)sinhw() : hyperbolic sine function (extended) .............................................................................. see sinh(3M)sinl() : sine function (long double) ................................................................................................ see sin(3M)sinq() : sine function (quad) .......................................................................................................... see sin(3M)sinw() : sine function (extended) .................................................................................................... see sin(3M)sleep(3C): sleep() ........................................................................................... suspend execution for intervalslk_attroff(3X): slk_attroff() , slk_attr_off() , slk_attron() , slk_attr_on() , slk_attrset() ,

slk_attr_set() , slk_clear() , slk_color() , slk_init() , slk_label() ,slk_noutrefresh() , slk_refresh() , slk_restore() , slk_set() , slk_touch() , slk_wset()...................................................................................................................................... soft label functions

slk_attron() : soft label functions ...................................................................................... see slk_attroff(3X)slk_attrset() : soft label functions .................................................................................... see slk_attroff(3X)slk_attr_off() : soft label functions .................................................................................. see slk_attroff(3X)slk_attr_on() : soft label functions .................................................................................... see slk_attroff(3X)slk_attr_set() : soft label functions .................................................................................. see slk_attroff(3X)slk_clear() : soft label functions ........................................................................................ see slk_attroff(3X)slk_color() : soft label functions ........................................................................................ see slk_attroff(3X)slk_init() : soft label functions .......................................................................................... see slk_attroff(3X)slk_label() : soft label functions ........................................................................................ see slk_attroff(3X)slk_noutrefresh() : soft label functions ............................................................................ see slk_attroff(3X)slk_refresh() : soft label functions .................................................................................... see slk_attroff(3X)slk_restore() : soft label functions .................................................................................... see slk_attroff(3X)slk_set() : soft label functions ............................................................................................. see slk_attroff(3X)slk_touch() : soft label functions ........................................................................................ see slk_attroff(3X)slk_wset() : soft label functions .......................................................................................... see slk_attroff(3X)SLPClose() : SLP (Service Location Protocol) library routines .................................................. see libslp(3N)SLPDelAttrs() : SLP (Service Location Protocol) library routines ........................................... see libslp(3N)SLPDereg() : SLP (Service Location Protocol) library routines .................................................. see libslp(3N)SLPError(3N): SLPError() ...................................................... SLP (Service Location Protocol) Error CodesSLPEscape() : SLP (Service Location Protocol) library routines ................................................ see libslp(3N)SLPFindAttrs() : SLP (Service Location Protocol) library routines ......................................... see libslp(3N)SLPFindScopes() : SLP (Service Location Protocol) library routines ....................................... see libslp(3N)SLPFindSrvs() : SLP (Service Location Protocol) library routines ........................................... see libslp(3N)SLPFindSrvTypes() : SLP (Service Location Protocol) library routines ................................... see libslp(3N)SLPFree() : SLP (Service Location Protocol) library routines .................................................... see libslp(3N)

xlii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name DescriptionSLPGetProperty() : SLP (Service Location Protocol) library routines ..................................... see libslp(3N)SLPGetRefreshInterval() : SLP (Service Location Protocol) library routines ...................... see libslp(3N)SLPOpen() : SLP (Service Location Protocol) library routines .................................................... see libslp(3N)SLPParseSrvURL() : SLP (Service Location Protocol) library routines ..................................... see libslp(3N)SLPReg() : SLP (Service Location Protocol) library routines ...................................................... see libslp(3N)SLPSetProperty() : SLP (Service Location Protocol) library routines ..................................... see libslp(3N)SLPUnescape() : SLP (Service Location Protocol) library routines ........................................... see libslp(3N)snprintf() : print formatted output to a string ........................................................................ see printf(3S)spray(3N): spray() ....................................................................................... scatter data for network checkingsprintf() : print formatted output to a string ........................................................................... see printf(3S)sqrt(3M): sqrt() , sqrtf() , sqrtl() , sqrtw() , sqrtq() .......................................... square root functionssqrtf() : square root function (float) ............................................................................................ see sqrt(3M)sqrtl() : square root function (long double) ................................................................................. see sqrt(3M)sqrtq() : square root function (quad) ........................................................................................... see sqrt(3M)sqrtw() : square root function (extended) .................................................................................... see sqrt(3M)srand() : simple random-number generator ................................................................................ see rand(3C)srand48() : generate pseudo-random numbers ..................................................................... see drand48(3C)srandom() : pseudorandom number generation functions ..................................................... see random(3M)sscanf() : formatted input conversion, read from stream file .................................................... see scanf(3S)ssignal(3C): ssignal() , gsignal() ..................................................................................... software signalsstandend(3X): standend() , standout() , wstandend() , wstandout() .. set and clear window attributesstandout() : set and clear window attributes ........................................................................ see standend(3X)start_color() : color manipulation functions ....................................................... see can_change_color(3X)statfsdev(3C): statfsdev() , fstatfsdev() ........................................................... get file system statisticsstatvfsdev(3C): statvfsdev() , fstatvfsdev() ..................................................... get file system statisticsstdio(3S): stdio() ........................................................... standard buffered input/output stream file packagestdscr(3X): stdscr() ............................................................................................................... default windowstep() : regular expression compile and match routines .......................................................... see regexp(3X)store() : database subroutines ..................................................................................................... see dbm(3X)strcasecmp() , strncasecmp() : character string operations ................................................. see string(3C)strcat() , strncat() : character string operations ................................................................. see string(3C)strchr() , strrchr() : character string operations ................................................................. see string(3C)strcmp() , strncmp() : character string operations ................................................................. see string(3C)strcoll() : character string operations .................................................................................... see string(3C)strcpy() , strncpy() : character string operations ................................................................. see string(3C)strdup() : character string operations ...................................................................................... see string(3C)strerror() : system error messages ........................................................................................ see perror(3C)strfmon(3C): strfmon() .............................................................................. convert monetary value to stringstrftime(3C): strftime() ............................................................................... convert date and time to stringstring(3C): string() ............................................................................................ character string operationsstrlen() : character string operations ...................................................................................... see string(3C)strord(3C): strord() ............................................................................................... convert string data orderstrpbrk() : character string operations .................................................................................... see string(3C)strptime(3C): strptime ........................................................................................... date and time conversionstrrstr() : character string operations .................................................................................... see string(3C)strspn() , strcspn() : character string operations ................................................................. see string(3C)strstr() : character string operations ...................................................................................... see string(3C)strtoacl(3C): strtoacl() , strtoaclpatt() ................ convert string to access control list (ACL) structurestrtoaclpatt() : convert string to access control list (ACL) structure ................................... see strtoacl(3C)strtod(3C): strtod() , strtof() , strtold() , strtow() , strtoq() ,

atof() .......................................................................................... convert string to floating-point numberstrtof() : convert string to floating-point number (float) ......................................................... see strtod(3C)strtoimax(3C): strtoimax() , strtoumax() ........................................................... convert string to integerstrtok() : character string operations ...................................................................................... see string(3C)strtok_r() : character string operations .................................................................................. see string(3C)strtol(3C): strtol() , strtoul() , atol() , atoi() , strtoll() , strtoull() .... convert string to integerstrtold() : convert string to floating-point number (long double) ............................................ see strtod(3C)strtoll() : convert string to integer .......................................................................................... see strtol(3C)strtoq() : convert string to floating-point number (quad) ........................................................ see strtod(3C)strtoul() : convert string to integer .......................................................................................... see strtol(3C)strtoull() : convert string to integer ........................................................................................ see strtol(3C)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xliii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionstrtoumax() : convert string to integer .............................................................................. see strtoimax(3C)strtow() : convert string to floating-point number (extended) .................................................. see strtod(3C)strxfrm() : character string operations .................................................................................... see string(3C)subpad(3X): subpad() ............................................................................ enhanced pad management functionsubwin() : window creation functions ........................................................................................ see subwin(3X)svcerr_auth() : library routine for server side remote procedure call errors ............... see rpc_svc_err(3N)svcerr_decode() : library routine for server side remote procedure call errors ........... see rpc_svc_err(3N)svcerr_noproc() : library routine for server side remote procedure call errors ........... see rpc_svc_err(3N)svcerr_noprog() : library routine for server side remote procedure call errors ........... see rpc_svc_err(3N)svcerr_progvers() : library routine for server side remote procedure call errors ....... see rpc_svc_err(3N)svcerr_systemerr() : library routine for server side remote procedure call errors ..... see rpc_svc_err(3N)svcerr_weakauth() : library routine for server side remote procedure call errors ....... see rpc_svc_err(3N)svcfd_create() : obsolete library routine for RPC ............................................................... see rpc_soc(3N)svcraw_create() : obsolete library routine for RPC ............................................................. see rpc_soc(3N)svctcp_create() : obsolete library routine for RPC ............................................................. see rpc_soc(3N)svcudp_bufcreate() : obsolete library routine for RPC ....................................................... see rpc_soc(3N)svcupd_create() : obsolete library routine for RPC ............................................................. see rpc_soc(3N)svc_auth_reg() : library routine for registering rpc servers ........................................ see rpc_svc_reg(3N)svc_control() : library routine for the creation of server handles, rpc ................... see rpc_svc_create(3N)svc_create() : library routine for the creation of server handles, rpc ..................... see rpc_svc_create(3N)svc_destroy() : library routine for the creation of server handles, rpc ................... see rpc_svc_create(3N)svc_dg_create() : library routine for the creation of server handles, rpc .............. see rpc_svc_create(3N)svc_dg_enablecache() : library routine for RPC servers .......................................... see rpc_svc_calls(3N)svc_done() : library routine for RPC servers ............................................................... see rpc_svc_calls(3N)svc_exit() : library routine for RPC servers ............................................................... see rpc_svc_calls(3N)svc_fds() : obsolete library routine for RPC ......................................................................... see rpc_soc(3N)svc_fdset() : library routine for RPC servers ............................................................. see rpc_svc_calls(3N)svc_fd_create() : library routine for the creation of server handles, rpc .............. see rpc_svc_create(3N)svc_freeargs() : library routine for RPC servers ...................................................... see rpc_svc_calls(3N)svc_getargs() : library routine for RPC servers ........................................................ see rpc_svc_calls(3N)svc_getcaller() : obsolete library routine for RPC ............................................................. see rpc_soc(3N)svc_getreq() : obsolete library routine for RPC ................................................................... see rpc_soc(3N)svc_getreqset() : library routine for RPC servers .................................................... see rpc_svc_calls(3N)svc_getreq_common() : library routine for RPC servers ............................................ see rpc_svc_calls(3N)svc_getreq_poll() : library routine for RPC servers ................................................ see rpc_svc_calls(3N)svc_getrpccaller() : library routine for RPC servers .............................................. see rpc_svc_calls(3N)svc_pollset() : library routine for RPC servers ........................................................ see rpc_svc_calls(3N)svc_raw_create() : library routine for the creation of server handles, rpc ............ see rpc_svc_create(3N)svc_reg() : library routine for registering rpc servers ................................................... see rpc_svc_reg(3N)svc_register() : obsolete library routine for RPC ............................................................... see rpc_soc(3N)svc_run() : library routine for RPC servers ................................................................. see rpc_svc_calls(3N)svc_sendreply() : library routine for RPC servers .................................................... see rpc_svc_calls(3N)svc_tli_create() : library routine for the creation of server handles, rpc ............ see rpc_svc_create(3N)svc_tp_create() : library routine for the creation of server handles, rpc .............. see rpc_svc_create(3N)svc_unreg() : library routine for registering rpc servers ............................................... see rpc_svc_reg(3N)svc_unregister() : obsolete library routine for RPC ........................................................... see rpc_soc(3N)svc_vc_create() : library routine for the creation of server handles, rpc .............. see rpc_svc_create(3N)swab(3C): swab() ............................................................................................................................ swap bytesswprintf(): print formatted wide-character output ................................................................ see fwprintf(3C)swscanf() : convert formatted wide-character input ............................................................. see fwscanf(3C)syncok(3X): syncok() , wcursyncup() , wsyncdown() , wsyncup()

.................................................................................... synchronise a window with its parents or childrensyslog(3C): syslog() , openlog() , closelog() , setlogmask() .................................... control system logsystem(3S): system() .................................................................................................. issue a shell commandsys_errlist() : system error messages .................................................................................. see perror(3C)sys_nerr() : system error messages ........................................................................................ see perror(3C)taddr2uaddr() : generic transport name-to-address translation ............................................ see netdir(3N)tan(3M): tan() , tanf() , tanl() , tanw() , tanq() ............................................................ tangent functionstand(3M): tand() , tandf() , tandl() , tandw() , tandq() ............ tangent functions of a degree argumenttandf() : tangent function of a degree argument (float) .............................................................. see tand(3M)tandl() : tangent function of a degree argument (long double) ................................................... see tand(3M)

xliv Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptiontandq() : tangent function of a degree argument (quad) ............................................................. see tand(3M)tandw() : tangent function of a degree argument (extended) ...................................................... see tand(3M)tanf() : tangent function (float) ..................................................................................................... see tan(3M)tanh(3M): tanh() , tanhf() , tanhl() , tanhw() , tanhq() ............................. hyperbolic tangent functionstanhf() : hyperbolic tangent function (float) ............................................................................... see tanh(3M)tanhl() : hyperbolic tangent function (long double) .................................................................... see tanh(3M)tanhq() : hyperbolic tangent function (quad) .............................................................................. see tanh(3M)tanhw() : hyperbolic tangent function (extended) ........................................................................ see tanh(3M)tanl() : tangent function (long double) .......................................................................................... see tan(3M)tanq() : tangent function (quad) .................................................................................................... see tan(3M)tanw() : tangent function (extended) .............................................................................................. see tan(3M)tcattribute(3C): tcgetattr() , tcsetattr() .................................................................... control tty devicetccontrol(3C): tcsendbreak() , tcdrain() , tcflush() , tcflow() .................... tty line control functionstcdrain() : tty line control functions ..................................................................................... see tccontrol(3C)tcflow() : tty line control functions ........................................................................................ see tccontrol(3C)tcflush() : tty line control functions ..................................................................................... see tccontrol(3C)tcgetattr() : get tty device attributes ............................................................................. see tcattribute(3C)tcgetpgrp(3C): tcgetpgrp() ....................................................................... get foreground process group IDtcgetsid(3C): tcgetsid() ........................................................................................... get terminal session IDtcsendbreak() : tty line control functions ............................................................................. see tccontrol(3C)tcsetattr() : set tty device attributes ............................................................................. see tcattribute(3C)tcsetpgrp(3C): tcsetpgrp() ........................................................................ set foreground process group IDtdelete() : manage binary search trees ................................................................................. see tsearch(3C)telldir() : directory operations ......................................................................................... see directory(3C)tempnam() : create a name for a temporary file ..................................................................... see tmpnam(3S)termattrs(3X): termattrs() , term_attrs() ................................. get supported terminal video attributestermcap(3X): tgetent() , tgetflag() , tgetnum() , tgetstr() , tgoto() ,

tputs() ............................................................................ emulate /usr/share/lib/termcap access routinestermname(3X): termname() ............................................................................................... get terminal nameterm_attrs() : get supported terminal video attributes ....................................................... see termattrs(3X)tfind() : manage binary search trees ..................................................................................... see tsearch(3C)tgamma(3M): tgamma() , tgammaf() , tgammal() , tgammaw() , tgammaq() ............. true gamma functionstgammaf() : true gamma function (float) ............................................................................... see tgamma(3M)tgammal() : true gamma function (long double) .................................................................... see tgamma(3M)tgammaq() : true gamma function (quad) .............................................................................. see tgamma(3M)tgammaw() : true gamma function (extended) ........................................................................ see tgamma(3M)tgetent() : emulate /usr/share/lib/termcap access routines .................................................. see termcap(3X)tgetflag() : emulate /usr/share/lib/termcap access routines ................................................ see termcap(3X)tgetnum() : emulate /usr/share/lib/termcap access routines .................................................. see termcap(3X)tgetstr() : emulate /usr/share/lib/termcap access routines .................................................. see termcap(3X)tgoto() : emulate /usr/share/lib/termcap access routines ...................................................... see termcap(3X)tigetflag(3X): tigetflag() , tigetnum() , tigetstr() , tparm()

..................................................................................... retrieve capabilities from the terminfo databasetigetnum() : retrieve capabilities from the terminfo database ............................................. see tigetflag(3X)tigetstr() : retrieve capabilities from the terminfo database ............................................. see tigetflag(3X)timeout() : control blocking on input ................................................................................... see notimeout(3X)timezone() : convert date and time to string ............................................................................. see ctime(3C)tmpfile(3S): tmpfile() ................................................................................................ create a temporary filetmpnam(3S): tmpnam() , tempnam() ......................................................... create a name for a temporary filetoascii() : translate characters .................................................................................................. see conv(3C)tolower() , _tolower : translate characters ............................................................................... see conv(3C)touchline() : window refresh control functions ........................................................... see is_linetouched(3X)touchwin(3X): touchwin() ........................................................................... window refresh control functiontoupper() , _toupper : translate characters ............................................................................... see conv(3C)towctrans(3C): wctrans() ....................................................................................... character transliterationtowlower() : translate wide characters .................................................................................... see wconv(3C)towupper() : translate wide characters .................................................................................... see wconv(3C)tparm() : retrieve capabilities from the terminfo database ................................................... see tigetflag(3X)tputs() : emulate /usr/share/lib/termcap access routines ...................................................... see termcap(3X)tputs() : output commands to the terminal .................................................................................... see putp(3X)trunc(3M): trunc() , truncf() , truncl() , truncw() , truncq() .............................. truncation functions

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xlv

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptiontruncf() : truncation function (float) ........................................................................................ see trunc(3M)truncl() : truncation function (long double) ............................................................................. see trunc(3M)truncq() : truncation function (quad) ....................................................................................... see trunc(3M)truncw() : truncation function (extended) ................................................................................. see trunc(3M)tsearch(3C): tsearch() , tfind() , tdelete() , twalk() ................................. manage binary search treesttyname(3C): ttyname() , isatty() ......................................................................... find name of a terminalttyslot(3C): ttyslot() ....................................................... find the slot in the utmpx file of the current usertwalk() : manage binary search trees ..................................................................................... see tsearch(3C)typeahead(3X): typeahead() ........................................................................ control checking for typeaheadtzname() : convert date and time to string ................................................................................. see ctime(3C)tzset() : convert date and time to string ................................................................................... see ctime(3C)t_accept(3): t_accept() .......................................................... X/OPEN TLI-XTI - accept a library structuret_alloc(3): t_alloc() ................................................................ X/OPEN TLI-XTI - allocate library structuret_bind(3): t_bind() ................................................... X/OPEN TLI-XTI - bind address to transport endpointt_close(3): t_close() ................................................................. X/OPEN TLI-XTI - close transport endpointt_connect(3): t_connect() ................. X/OPEN TLI-XTI - establish connection with another transport usert_error(3): t_error() ................................................................... X/OPEN TLI-XTI - error message functiont_free(3): t_free() .......................................................................... X/OPEN TLI-XTI - free library structuret_getinfo(3): t_getinfo() ................................. X/OPEN TLI-XTI - get protocol-specific service informationt_getprotaddr(3): t_getprotaddr() ...................................................... X/OPEN XTI - get protocol addresst_getstate(3): t_getstate() .................................................................. X/OPEN TLI-XTI - get current statet_listen(3): t_listen() ............................................................ X/OPEN TLI-XTI - listen for connect requestt_look(3): t_look() ...................................... X/OPEN TLI-XTI - look at current event on transport endpointt_open(3): t_open() ............................................................. X/OPEN TLI-XTI - establish transport endpointt_optmgmt(3): t_optmgmt() ............................... X/OPEN TLI-XTI - manage options for transport endpointt_rcv(3): t_rcv() .................................................................. X/OPEN TLI-XTI - receive data over connectiont_rcvconnect(3): t_rcvconnect() ................ X/OPEN TLI-XTI - receive confirmation from connect requestt_rcvdis(3): t_rcvdis() ......................................... X/OPEN TLI-XTI - retrieve information from disconnectt_rcvrel(3): t_rcvrel() ................ X/OPEN TLI-XTI - acknowledge receipt of release at transport endpointt_rcvudata(3): t_rcvudata() ..... X/OPEN TLI-XTI - receive data unit from remote transport provider usert_rcvuderr(3): t_rcvuderr() X/OPEN TLI-XTI - receive error information from unit data error indicationt_snd(3): t_snd() ...................................... X/OPEN TLI-XTI - send data or expedited data over a connectiont_snddis(3): t_sndis() ......................................... X/OPEN TLI-XTI - send user-initiated disconnect requestt_sndrel(3): t_sndrel() ............................ X/OPEN TLI-XTI - initiate orderly release at transport endpointt_sndudata(3): t_sndudata() ....................................... X/OPEN TLI-XTI - send data unit to transport usert_strerror(3): t_strerror() .................................................. X/OPEN - XTI - produce error message stringt_sync(3): t_sync() ........................ X/OPEN TLI-XTI - synchronize transport library for transport endpointt_unbind(3): t_unbind() ........................................................ X/OPEN TLI-XTI - disable transport endpointuaddr2taddr() : generic transport name-to-address translation ............................................ see netdir(3N)uc_access(3): __uc_get_ar_csd() , __uc_set_ar_csd() , __uc_get_ar_ssd() ,

__uc_set_ar_ssd() , __uc_get_ar_ccv() , __uc_set_ar_ccv() , __uc_get_ar_unat() ,__uc_set_ar_unat() , __uc_get_ar_fpsr() , __uc_set_ar_fpsr() , __uc_get_ar_pfs() ,__uc_set_ar_pfs() , __uc_get_ar_lc() , __uc_set_ar_lc() , __uc_get_ar_ec() ,__uc_set_ar_ec() , __uc_get_ed() ................................................... ucontext_t (user context) access

uc_access(3): __uc_get_reason() , __uc_get_grs() , __uc_set_grs() ,__uc_get_frs() , __uc_set_frs() , __uc_get_prs() , __uc_set_prs() , __uc_get_brs() ,__uc_set_brs() , __uc_get_ip() , __uc_set_ip() , __uc_get_cfm() , __uc_set_cfm() ,__uc_get_um() , __uc_set_um() , __uc_get_ar_rsc() , __uc_set_ar_rsc() ,__uc_get_ar_bsp() , __uc_get_ar_bspstore() .............................. ucontext_t (user context) access

uc_access(3): __uc_set_ed() , __uc_get_rsebs() , __uc_set_rsebs() ,__uc_get_rsebs64() , __uc_set_rsebs64() , __uc_get_ar() , __uc_set_ar() ,__uc_get_cr() ....................................................................................... ucontext_t (user context) access

ulckpwdf(): unlock access to /etc/passwd and /etc/shadow files .............................................. see lckpwd(3C)ultoa() : unsigned long to ASCII decimal .................................................................................. see ltostr(3C)ultoa_r() : unsigned long to ASCII decimal (MT-Safe) ............................................................. see ltostr(3C)ultostr() : unsigned long to ASCII ........................................................................................... see ltostr(3C)ultostr_r() : unsigned long to ASCII (MT-Safe) ...................................................................... see ltostr(3C)unctrl(3X): unctrl() .......................................................... generate printable representation of a characterundial() : establish an outgoing terminal line connection ........................................................... ‘see dial(3C)ungetc(3S): ungetc() , ungetc_unlocked() .................................... push character back into input streamungetch(3X): ungetch() , unget_wch() ............................................ push a character onto the input queue

xlvi Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionungetc_unlocked() : push character back into input stream ................................................ see ungetc(3S)ungetwc(3C): ungetwc() , ungetwc_unlocked() ............ push a wide character back into an input streamungetwc_unlocked() : push a wide character back into an input stream ........................... see ungetwc(3C)unget_wch() : push a character onto the input queue .............................................................. see ungetch(3X)unlockpt(3C): unlockpt ......................................................... unlock a STREAMS pty master and slave pairuntouchwin() : window refresh control functions ........................................................ see is_linetouched(3X)updatebwdb() : write records into new wtmps and btmps database ...................................... see bwtmps(3C)user2netname() : library routines for secure remote procedure calls ............................. see secure_rpc(3N)use_env(3X): use_env() .................................................................. specify source of screen size informationutmpname() : access utmp file entry ............................................................................................ see getut(3C)utmpx file entry ............................................................................................................................. see getutx(3C)uwx(3X): uwx() ........................................................................................................... Unwind Express libraryU_STACK_TRACE(3X): U_STACK_TRACE(), _UNW_STACK_TRACE()

............................................... produce a trace back of the procedure call stack using the unwind libraryvalloc() : allocate space on boundary aligned to sysconf value .............................................. see malloc(3C)vfprintf() : print formatted output of a varargs argument list ............................................. see vprintf(3S)vfscanf() : formatted input conversion to a varargs argument .................................................. see vscanf(3S)vfwprintf() : print formatted output to a file ..................................................................... see vwprintf(3C)vidattr(3X): vidattr() ................................................................................ output attributes to the terminalvidputs(): output attributes to the terminal ............................................................................. see vidattr(3X)vid_attr(): output attributes to the terminal ............................................................................ see vidattr(3X)vid_puts(): output attributes to the terminal ........................................................................... see vidattr(3X)vline() : draw lines from single-byte characters and renditions ................................................... see hline(3X)vline_set() : draw lines from complex characters and renditions ........................................ see hline_set(3X)vpfmt() : display message in standard format, using argument list ............................................ see pfmt(3C)vprintf(3S): vprintf() , vfprintf() , vsprintf() , vsnprintf()

..................................................................................... print formatted output of a varargs argument listvscanf(3S): vscanf() , vfscanf() , vsscanf() .............. formatted input conversion to a varargs argumentvsnprintf() : print formatted output of a varargs argument list ........................................... see vprintf(3S)vsprintf() : print formatted output of a varargs argument list ............................................. see vprintf(3S)vsscanf() : formatted input conversion to a varargs argument .................................................. see vscanf(3S)vswprintf() : print formatted output to a string ................................................................. see vwprintf(3C)vwprintf(3S): vwprintf() , vfwprintf() , vswprintf() ......................................... print formatted outputvwprintw(3X): vwprintw() .................................................................... print formatted output in a windowvwscanw(3X): vwscanw() .................................................................. convert formatted input from a windowvw_printw(3X): vw_printw() ........................ print formatted output in a window (TO BE WITHDRAWN)vw_scanw(3X): vw_scanw() ..................... convert formatted input from a window (TO BE WITHDRAWN)waddch() : add a single-byte character and rendition to a window and advance the cursor ........ see addch(3X)waddchnstr() : add length limited string of single-byte characters and renditions to a window

..................................................................................................................................... see addchnstr(3X)waddchstr() : add string of single-byte characters and renditions to a window ..................... see addchstr(3X)waddnstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)waddnwstr() : add a wide-character string to a window and advance the cursor .................. see addnwstr(3X)waddstr() : add a string of multi-byte characters without rendition to a window and advance

cursor ............................................................................................................................... see addnstr(3X)waddwstr() : add a wide-character string to a window and advance the cursor .................... see addnwstr(3X)wadd_wch() : add a complex character and rendition to a window .......................................... see add_wch(3X)wadd_wchnstr() : add an array of complex characters and renditions to a window ....... see add_wchnstr(3X)wadd_wchstr() : add an array of complex characters and renditions to a window ......... see add_wchnstr(3X)wattroff() : restricted window attribute control functions ........................................................ see attroff(3X)wattron() : restricted window attribute control functions .......................................................... see attroff(3X)wattrset() : restricted window attribute control functions ........................................................ see attroff(3X)wattr_get() : window attribute control functions .................................................................... see attr_get(3X)wattr_off() : window attribute control functions .................................................................... see attr_get(3X)wattr_on() : window attribute control functions ...................................................................... see attr_get(3X)wattr_set() : window attribute control functions .................................................................... see attr_get(3X)wbkgd() : set or get background character and rendition using a single-byte character ................ see bkgd(3X)wbkgdset() : set or get background character and rendition using a single-byte character .......... see bkgd(3X)wbkgrnd() : set or get background character and rendition using a complex character ............ see bkgrnd(3X)wbkgrndset() : set or get background character and rendition using a complex character ...... see bkgrnd(3X)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xlvii

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionwborder() : draw borders from single-byte characters and renditions ....................................... see border(3X)wborder_set() : draw borders from complex characters and renditions ............................ see border_set(3X)WCHAR(): process 16-bit characters ................................................................................... see nl_tools_16(3X)WCHARADV(): process 16-bit characters ............................................................................. see nl_tools_16(3X)wchgat() : change renditions of characters in a window ............................................................... see chgat(3X)wclear() : clear a window .............................................................................................................. see clear(3X)wclrtobot() : clear from cursor to end of window ................................................................... see clrtobot(3X)wclrtoeol() : clear from cursor to end of line .......................................................................... see clrtoeol(3X)wcolor_set() : window attribute control functions .................................................................. see attr_get(3X)wconv(3C): towupper() , towlower() ................................................................... translate wide characterswcrtomb(3C): wcrtomb() ............................................................. convert wide-character code to a characterwcscat() , wcsncat() : wide character string operations .................................................... see wcstring(3C)wcschr() , wcsrchr() : wide character string operations .................................................... see wcstring(3C)wcscmp() , wcsncmp() : wide character string operations .................................................... see wcstring(3C)wcscoll() : wide character string operations ....................................................................... see wcstring(3C)wcscpy , wcsncpy() : wide character string operations ........................................................ see wcstring(3C)wcsftime(3C): wcsftime() .................................................... convert date and time to wide-character stringwcslen() : wide character string operations ......................................................................... see wcstring(3C)wcspbrk() : wide character string operations ....................................................................... see wcstring(3C)wcsrtombs(3C): wcsrtombs() ...................................................... convert a wide-character string to a stringwcsspn() , wcscspn() : wide character string operations .................................................... see wcstring(3C)wcsstr() : wide character string operations ......................................................................... see wcstring(3C)wcstod(3C): wcstod() ........................................... convert wide character string to double-precision numberwcstoimax(3C): wcstoimax() , wcstoumax() ......................... convert wide character string to long integerwcstok() : wide character string operations ......................................................................... see wcstring(3C)wcstok_r() : wide character string operations ..................................................................... see wcstring(3C)wcstol(3C): wcstol() , wcstoll(), wcstoul() , wcstoull() ..... convert wide character string to integerwcstoll(): convert wide character string to integer ................................................................... see wcstol(3C)wcstoul(): convert wide character string to integer .................................................................. see wcstol(3C)wcstoull(): convert wide character string to integer ................................................................. see wcstol(3C)wcstoumax() : convert wide character string to long integer ............................................ see wcstoimax(3C)wcstring(3C): wcscat() , wcsncat() , wcscmp() , wcsncmp() , wcscpy() , wcsncpy() , wcslen() ,

wcschr() ,wcsrchr() , wcsstr() , wcspbrk() , wcsspn() , wcscspn() , wcstok() , wcstok_r() ,nl_wcscmp() , nl_wcsncmp() .............................................................. wide character string operations

wcswcs() : wide character string operations ......................................................................... see wcstring(3C)wcswidth() : wide character string operations ..................................................................... see wcstring(3C)wctob() : convert wide-character to single-byte .............................................................................. btowc(3C)wctomb() : multibyte characters and strings conversions ...................................................... see multibyte(3C)wctombs() : multibyte characters and strings conversions .................................................... see multibyte(3C)wctrans() : define character mapping ............................................................................... see towctrans(3C)wctype(3C): iswalpha() , iswupper() , iswlower() , iswdigit() , iswxdigit() , iswalnum() ,

iswspace() ,iswpunct() , iswprint() , iswgraph() , iswcntrl() , iswctype().............................................................................................................................. classify wide characters

wcursyncup() : synchronise a window with its parents or children ........................................... see syncok(3X)wcwidth() : wide character string operations ....................................................................... see wcstring(3C)wdelch(): delete character from a window .................................................................................. see delch(3X)wdeleteln(): delete lines in window ....................................................................................... see deleteln(3X)wechochar() : echo single-byte character and rendition to a window and refresh ................. see echochar(3X)wecho_wchar() : write a complex character and immediately refresh the window ........... see echo_wchar(3X)werase() : clear a window .............................................................................................................. see clear(3X)wgetbkgrnd() : set or get background character and rendition using a complex character ...... see bkgrnd(3X)wgetch() : get a single-byte character from the terminal .............................................................. see getch(3X)wgetnstr() : get a multi-byte character length limited string from the terminal ...................... see getnstr(3X)wgetn_wstr() : get an array of wide characters and function key codes from a terminal .... see getn_wstr(3X)wgetstr() : get a multi-byte character string from the terminal .................................................. see getstr(3X)wget_wch() : get a wide character from a terminal .................................................................. see get_wch(3X)wget_wstr() : get an array of wide characters and function key codes from a terminal ...... see getn_wstr(3X)whline() : draw lines from single-byte characters and renditions ................................................. see hline(3X)whline_set() : draw lines from complex characters and renditions ...................................... see hline_set(3X)winch() : input a single-byte character and rendition from a window ............................................ see inch(3X)winchnstr() : input an array of single-byte characters and renditions from a window .......... see inchnstr(3X)

xlviii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionwinchstr() : input an array of single-byte characters and renditions from a window ............ see inchnstr(3X)winnstr() : input a multi-byte character string from a window .................................................. see innstr(3X)winnwstr() : input a string of wide characters from a window ................................................. see innwstr(3X)winsch() : insert a single-byte character and rendition into a window ......................................... see insch(3X)winsdelln() : delete or insert lines into a window .................................................................. see insdelln(3X)winsertln() : insert lines into a window ................................................................................. see insertln(3X)winsnstr() : insert a multi-byte character into a window ......................................................... see insnstr(3X)winsstr() : insert a multi-byte character into a window ........................................................... see insnstr(3X)winstr() : input a multi-byte character string from a window .................................................... see innstr(3X)wins_nwstr() : insert a wide-character string into a window ............................................... see ins_nwstr(3X)wins_wch() : insert a complex character and rendition into a window .................................... see ins_wch(3X)wins_wstr() : insert a wide-character string into a window ................................................. see ins_nwstr(3X)winwstr() : input a string of wide characters from a window ................................................... see innwstr(3X)win_wch() : input a complex character and rendition from a window ........................................ see in_wch(3X)win_wchnstr() : input an array of complex characters and renditions from a window ..... see in_wchnstr(3X)win_wchstr() : input an array of complex characters and renditions from a window ....... see in_wchnstr(3X)wmemchr() : find a wide-character in memory .................................................................... see wmemory(3C)wmemcmp(): compare wide-characters in memory .............................................................. see wmemory(3C)wmemcpy() : copy wide-characters in memory ..................................................................... see wmemory(3C)wmemmove(): copy wide-characters in memory with overlapping areas ............................. see wmemory(3C)wmemory(3C): wmemchr() , wmemcmp(), wmemcpy() , wmemmove(), wmemset()

.............................................................................................. memory operations based on wide-characterwmemset() : set wide-characters in memory ........................................................................ see wmemory(3C)wmove() : window cursor location functions ................................................................................... see move(3X)wnoutrefresh(): refresh windows and lines ........................................................................ see doupdate(3X)wordexp(3C): wordexp() , wordfree() ................................................................. perform word expansionswordfree() : free memory associated with word expansions ................................................ see wordexp(3C)wprintf() : print formatted wide-character output .............................................................. see fwprintf(3C)wprintw() : print formatted output in window ...................................................................... see mvprintw(3X)wpthread_default_stacksize_np(3T): pthread_default_stacksize_np() change the default stacksizewredrawln() : line update status functions ......................................................................... see redrawwin(3X)wrefresh(): refresh windows and lines ................................................................................ see doupdate(3X)wscanf() : convert formatted wide-character input ............................................................... see fwscanf(3C)wscanw() : convert formatted input from a window ................................................................ see mvscanw(3X)wscrl() : scroll the window, enhanced curses .................................................................................. see scrl(3X)wsetscrreg() : terminal output control functions .................................................................... see clearok(3X)wstandend() : set and clear window attributes ...................................................................... see standend(3X)wstandout() : set and clear window attributes ...................................................................... see standend(3X)wsyncdown() : synchronise a window with its parents or children ............................................. see syncok(3X)wsyncup() : synchronise a window with its parents or children ................................................. see syncok(3X)wtimeout() : control blocking on input ................................................................................. see notimeout(3X)wtouchln() : window refresh control functions ............................................................. see is_linetouched(3X)wunctrl(3X): wunctrl() ............................................. generate printable representation of a wide characterwvline() : draw lines from single-byte characters and renditions ................................................. see hline(3X)wvline_set() : draw lines from complex characters and renditions ...................................... see hline_set(3X)xdr(3N): xdr ......................................................................... library routines for external data representationxdrmem_create() : library routines for external data representation stream creation ... see xdr_create(3N)xdrrec_create() : library routines for external data representation stream creation ... see xdr_create(3N)xdrrec_endofrecord() : library routines for external data representation ................... see xdr_admin(3N)xdrrec_eof() : library routines for external data representation ................................... see xdr_admin(3N)xdrrec_readbytes() : library routines for external data representation ....................... see xdr_admin(3N)xdrrec_skiprecord() : library routines for external data representation ..................... see xdr_admin(3N)xdrstdio_create() : library routines for external data representation stream creation see xdr_create(3N)xdr_accepted_reply() : XDR library routine for remote procedure calls .......................... see rpc_xdr(3N)xdr_admin(3N): xdr_control() , xdr_getpos() , xdr_inline() , xdrrec_endofrecord() ,

xdrrec_eof() , xdrrec_readbytes() , xdrrec_skiprecord() , xdr_setpos() , xdr_sizeof()....................................................................................... library routines for external data representation

xdr_array() : library routine for external data representation ................................... see xdr_complex(3N)xdr_authsys_parms() : XDR library routine for remote procedure calls ............................ see rpc_xdr(3N)xdr_authunix_parms() : obsolete library routine for RPC .................................................. see rpc_soc(3N)xdr_bool() : library routine for external data representation ........................................ see xdr_simple(3N)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company xlix

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionxdr_bytes() : library routine for external data representation ................................... see xdr_complex(3N)xdr_callhdr() : XDR library routine for remote procedure calls ......................................... see rpc_xdr(3N)xdr_callmsg() : XDR library routine for remote procedure calls ......................................... see rpc_xdr(3N)xdr_char() : library routine for external data representation ........................................ see xdr_simple(3N)xdr_complex(3N): xdr_array() , xdr_bytes() , xdr_opaque() , xdr_pointer() , xdr_reference() ,

xdr_string() , xdr_string() , xdr_vector() , xdr_wrapstring()....................................................................................... library routines for external data representation

xdr_control() : library routines for external data representation ................................. see xdr_admin(3N)xdr_create(3N): xdr_destroy() , xdrmem_create() , xdrrec_create() , xdrstdio_create()

............................................................. library routines for external data representation stream creationxdr_destroy() : library routines for external data representation stream creation ....... see xdr_create(3N)xdr_double() : library routine for external data representation .................................... see xdr_simple(3N)xdr_enum() : library routine for external data representation ........................................ see xdr_simple(3N)xdr_float() : library routine for external data representation ...................................... see xdr_simple(3N)xdr_free() : library routine for external data representation ........................................ see xdr_simple(3N)xdr_getpos() : library routines for external data representation ................................... see xdr_admin(3N)xdr_hyper() : library routine for external data representation ...................................... see xdr_simple(3N)xdr_inline() : library routines for external data representation ................................... see xdr_admin(3N)xdr_int() : library routine for external data representation ........................................... see xdr_simple(3N)xdr_long() : library routine for external data representation ........................................ see xdr_simple(3N)xdr_longlong_t() : library routine for external data representation ............................ see xdr_simple(3N)xdr_opaque() : library routine for external data representation ................................. see xdr_complex(3N)xdr_opaque_auth() : XDR library routine for remote procedure calls ................................. see rpc_xdr(3N)xdr_pointer() : library routine for external data representation ............................... see xdr_complex(3N)xdr_quadruple() : library routine for external data representation .............................. see xdr_simple(3N)xdr_reference() : library routine for external data representation ........................... see xdr_complex(3N)xdr_rejected_reply() : XDR library routine for remote procedure calls .......................... see rpc_xdr(3N)xdr_replymsg() : XDR library routine for remote procedure calls ....................................... see rpc_xdr(3N)xdr_setpos() : library routines for external data representation ................................... see xdr_admin(3N)xdr_short() : library routine for external data representation ...................................... see xdr_simple(3N)xdr_simple(3N): xdr_bool() , xdr_char() , xdr_double() , xdr_enum() , xdr_float() , xdr_free() ,

xdr_hyper() , xdr_int() , xdr_long() , xdr_longlong_t() , xdr_quadruple() , xdr_short() ,xdr_u_char() , xdr_u_hyper() , xdr_u_int() , xdr_u_long() , xdr_u_longlong_t() ,xdr_u_short() , xdr_void() ..................................... library routines for external data representation

xdr_sizeof() : library routines for external data representation ................................... see xdr_admin(3N)xdr_string() : library routine for external data representation ................................. see xdr_complex(3N)xdr_union() : library routine for external data representation ................................... see xdr_complex(3N)xdr_u_char() : library routine for external data representation .................................... see xdr_simple(3N)xdr_u_hyper() : library routine for external data representation .................................. see xdr_simple(3N)xdr_u_int() : library routine for external data representation ...................................... see xdr_simple(3N)xdr_u_long() : library routine for external data representation .................................... see xdr_simple(3N)xdr_u_longlong_t() : library routine for external data representation ........................ see xdr_simple(3N)xdr_u_short() : library routine for external data representation .................................. see xdr_simple(3N)xdr_vector() : library routine for external data representation ................................. see xdr_complex(3N)xdr_void() : library routine for external data representation ........................................ see xdr_simple(3N)xdr_wrapstring() : library routine for external data representation ......................... see xdr_complex(3N)xprt_register() : library routine for registering rpc servers ...................................... see rpc_svc_reg(3N)xprt_unregister() : library routine for registering rpc servers .................................. see rpc_svc_reg(3N)y0(3M): y0() , y1() , yn() ......................................................................... Bessel functions of the second kindy1() : Bessel function ....................................................................................................................... see y0(3M)yn() : Bessel function ....................................................................................................................... see y0(3M)ypclnt(3C): ypclnt() , yp_all() , yp_bind() , yp_first() , yp_get_default_domain() ,

yp_master() , yp_match() , yp_next() , yp_order() , yp_unbind() ,yperr_string() , ypprot_err() .................................... Network Information Service client interface

yperr_string() - Network Information Service client interface ............................................... see ypclnt(3C)yppasswd(3N): yppasswd() ......................................... update user password in Network Information Serviceypprot_err() - Network Information Service client interface ................................................... see ypclnt(3C)ypupdate(3C): ypupdate() ..................................................................................... changes NIS informationyp_all() - Network Information Service client interface ........................................................... see ypclnt(3C)yp_bind() - Network Information Service client interface ......................................................... see ypclnt(3C)yp_first() - Network Information Service client interface ....................................................... see ypclnt(3C)

l Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Descriptionyp_get_default_domain() - Network Information Service client interface ............................ see ypclnt(3C)yp_master() - Network Information Service client interface ..................................................... see ypclnt(3C)yp_match() - Network Information Service client interface ....................................................... see ypclnt(3C)yp_next() - Network Information Service client interface ......................................................... see ypclnt(3C)yp_order() - Network Information Service client interface ....................................................... see ypclnt(3C)yp_unbind() - Network Information Service client interface ..................................................... see ypclnt(3C)_authdes_getucred() : library routines for secure remote procedure calls ................... see secure_rpc(3N)_ldecvt() : convert long double floating-point number to string ................................................ see ldcvt(3C)_ldfcvt() : convert long double floating-point number to string ................................................ see ldcvt(3C)_ldgcvt() : convert long double floating-point number to string ................................................ see ldcvt(3C)_longjmp() : restore stack environment for non-local goto ...................................................... see setjmp(3C)_nis_map_group() : NIS+ group manipulation functions ............................................... see nis_groups(3N)_pututline() : access utmp file entry ........................................................................................ see getut(3C)_setjmp() : save stack environment for non-local goto ............................................................ see setjmp(3C)_UNW_clear() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_clearAlertCode() : query values in unwind library data structure ................ see _UNW_getGR(3X)_UNW_createContext() : allocate and deallocate unwind library data structure

.................................................................................................... see _UNW_createContextForSelf(3X)_UNW_createContextForSelf(3X): _UNW_createContextForSelf() , _UNW_createContext() ,

_UNW_destroyContext() ................................... allocate and deallocate unwind library data structure_UNW_currentContext(3X): _UNW_currentContext() , _UNW_clear() ,

_UNW_jmpbufContext() , _UNW_setAR() , _UNW_setBR() , _UNW_setCFM() , _UNW_setFR() ,_UNW_setGR() , _UNW_setGR_NaT() , _UNW_setIP() , _UNW_setPR() , _UNW_setPreds() ,_UNW_GR_PhysicalNumber() , _UNW_FR_PhysicalNumber() , _UNW_PR_PhysicalNumber() ,_UNW_step() ........................................................... manipulate values in unwind library data structure

_UNW_destroyContext() : allocate and deallocate unwind library data structure.................................................................................................... see _UNW_createContextForSelf(3X)

_UNW_FR_PhysicalNumber() : manipulate values in unwind library data structure.............................................................................................................. see _UNW_currentContext(3X)

_UNW_getAlertCode() : query values in unwind library data structure .................... see _UNW_getGR(3X)_UNW_getAR() : query values in unwind library data structure ................................... see _UNW_getGR(3X)_UNW_getBR() : query values in unwind library data structure ................................... see _UNW_getGR(3X)_UNW_getCFM() : query values in unwind library data structure ................................. see _UNW_getGR(3X)_UNW_getFR() : query values in unwind library data structure ................................... see _UNW_getGR(3X)_UNW_getGR(3X): _UNW_getGR() , _UNW_getGR_NaT() , _UNW_getFR() , _UNW_getBR() ,

_UNW_getAR() , _UNW_getPR() , _UNW_getPreds() , _UNW_getIP() , _UNW_getCFM() ,_UNW_getAlertCode() , _UNW_clearAlertCode() , _UNW_getKernelSavedContext()........................................................................................... query values in unwind library data structure

_UNW_getGR_NaT() : query values in unwind library data structure ........................... see _UNW_getGR(3X)_UNW_getIP() : query values in unwind library data structure ................................... see _UNW_getGR(3X)_UNW_getKernelSavedContext() : query values in unwind library data structure . see _UNW_getGR(3X)_UNW_getPR() : query values in unwind library data structure ................................... see _UNW_getGR(3X)_UNW_getPreds() : query values in unwind library data structure ............................. see _UNW_getGR(3X)_UNW_GR_PhysicalNumber() : manipulate values in unwind library data structure

.............................................................................................................. see _UNW_currentContext(3X)_UNW_jmpbufContext() : manipulate values in unwind library data structure

.............................................................................................................. see _UNW_currentContext(3X)_UNW_PR_PhysicalNumber() : manipulate values in unwind library data structure

.............................................................................................................. see _UNW_currentContext(3X)_UNW_setAR() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setBR() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setCFM() : manipulate values in unwind library data structure ....... see _UNW_currentContext(3X)_UNW_setFR() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setGR() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setGR_NaT() : manipulate values in unwind library data structure . see _UNW_currentContext(3X)_UNW_setIP() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setPR() : manipulate values in unwind library data structure ......... see _UNW_currentContext(3X)_UNW_setPreds() : manipulate values in unwind library data structure ... see _UNW_currentContext(3X)_UNW_STACK_TRACE(): produce a trace back of the procedure call stack using the unwind library

....................................................................................................................... see U_STACK_TRACE(3X)_UNW_step() : manipulate values in unwind library data structure ........... see _UNW_currentContext(3X)

HP-UX 11i Version 2: August 2003 Hewlett-Packard Company li

Table of ContentsVolumes Six and Seven

Entry Name(Section): name Description__uc_get_ar() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_get_ar_bsp() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_bspstore() : ucontext_t (user context) access .............................................. see uc_access(3)__uc_get_ar_ccv() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_csd() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_ec() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_get_ar_fpsr() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_get_ar_lc() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_get_ar_pfs() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_rsc() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_ssd() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_ar_unat() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_get_brs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_get_cfm() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_get_cr() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_get_ed() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_get_frs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_get_grs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_get_ip() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_get_prs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_get_reason() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_get_rsebs() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_get_rsebs64() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_get_um() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_set_ar() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_set_ar_ccv() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_set_ar_csd() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_set_ar_ec() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_set_ar_fpsr() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_set_ar_lc() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_set_ar_pfs() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_set_ar_rsc() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_set_ar_ssd() : ucontext_t (user context) access ........................................................ see uc_access(3)__uc_set_ar_unat() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_set_brs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_set_cfm() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_set_ed() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_set_frs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_set_grs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_set_ip() : ucontext_t (user context) access ................................................................. see uc_access(3)__uc_set_prs() : ucontext_t (user context) access ............................................................... see uc_access(3)__uc_set_rsebs() : ucontext_t (user context) access ........................................................... see uc_access(3)__uc_set_rsebs64() : ucontext_t (user context) access ...................................................... see uc_access(3)__uc_set_um() : ucontext_t (user context) access ................................................................. see uc_access(3)

lii Hewlett-Packard Company HP-UX 11i Version 2: August 2003

Section 3Part 1

Library FunctionsA-M

Section 3Part 1

Library FunctionsA-M

A A

intro(3C) intro(3C)

NAMEintro - introduction to subroutines and libraries

DESCRIPTIONThis section describes functions found in various libraries, other than those functions that directly invokeHP-UX system primitives, which are described in Section (2) of this volume. Certain major collections areidentified by a letter after the section identifier (3):

(3C) These functions, together with the Operating System Calls and those marked (3S), consti-tute the Standard C Library, libc , which is automatically loaded by the C compiler,cc(1). Declarations for some of these functions can be obtained from #include filesindicated in the appropriate entries.

(3E) These functions constitute the ELF access library (libelf ) which lets a program mani-pulate ELF (Executable and Linking Format ) object files, archive files, and archivemembers. The link editor searches this library if the -lelf option is specified. Theheader file <libelf.h> provides type and function declarations for all library services(described in elf (3E).

(3G) These functions constitute the graphics library and are documented in separate manuals.

(3I) These functions constitute the instrument support (Device I/O) library.

(3M) These functions constitute the Math Library, libm . The link editor searches this libraryif the -lm option is specified. Declarations for these functions are available in theheader files <math.h> and <fenv.h> . Several generally useful mathematical con-stants are also defined in <math.h> (see math (5)).

(3N) These functions are applicable to the Internet network and are part of the standard Clibrary, libc .

(3S) These functions constitute the ‘‘standard I/O package’’ (see stdio (3S)). These functionsare in the library libc , already mentioned. Declarations for these functions can beobtained from the #include file <stdio.h> .

(3T) These functions constitute the Pthreads Library. The link editor ld (see ld(1)) searchesthis library if the -lpthread option is specified. See pthread (3T) for more detailedinformation on threads.

(3X) Various specialized libraries. The files in which these libraries are found are specified inthe appropriate entries.

DIAGNOSTICSFunctions in the C and Math Libraries, (3C) and (3M), may return the conventional values 0 or +|-HUGE_VALwhen the function is undefined for the given arguments or when the value is not represent-able. HUGE_VALis defined as +INFINITY in the <math.h> header file. Functions in the MathLibrary may also return +|-INFINITY or a NaN. In these cases, the external variable errno (seeerrno (2)) may also be set to the value [EDOM] or [ERANGE].

FILES/usr/lib/libc.a (For PA-RISC systems.) Standard I/O, operating system calls, and

general purpose routines archive library.

/usr/lib/libc.sl (For PA-RISC systems.) Standard I/O, operating system calls, andgeneral purpose routines shared library.

/usr/lib/hpuxXX/libc.so (For Itanium(R)-based systems.) Standard I/O, operating systemcalls, and general purpose routines 32-bit and 64-bit sharedlibraries.

/usr/lib/libcurses.sl (For PA-RISC systems.) CRT screen handling shared library.

/usr/lib/hpuxXX/libcurses.so(For Itanium-based systems.) CRT screen handling 32-bit and 64-bit shared libraries.

/usr/lib/libelf.a (For PA-RISC systems.) ELF archive library.

/usr/lib/libelf.sl (For PA-RISC systems.) ELF shared library.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−1

A A

intro(3C) intro(3C)

/usr/lib/hpuxXX/libelf.so (For Itanium-based systems.) ELF 32-bit and 64-bit sharedlibraries.

/usr/lib/libm.a (For PA-RISC systems.) SVID3, XPG4.2, and ANSI C compliantmath archive library.

/usr/lib/libm.sl (For PA-RISC systems.) SVID3, XPG4.2, and ANSI C compliantmath archive library.

/usr/lib/hpuxXX/libm.so (For Itanium-based systems.) SVID3, XPG4.2, and ANSI C compli-ant 32-bit and 64-bit math shared libraries.

SEE ALSOar(1), elf(3E), ld(1), nm(1), intro(2), stdio(3S), hier(5), math(5), thread_safety(5), introduction(9).

Web access to HP-UX documentation at http://docs.hp.com .

Section 3−−2 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A aA

a64l(3C) a64l(3C)

NAMEa64l( ), l64a( ) - convert between long integer and base-64 ASCII string

SYNOPSIS#include <stdlib.h>

long int a64l(const char *s);

char *l64a(long int l);

Obsolescent Interfaceint l64a_r(long int l, char *buffer, int buflen);

DESCRIPTIONThese functions are used to maintain numbers stored in base-64 ASCII characters. This is a notation bywhich long integers can be represented by up to six characters; each character represents a "digit" in aradix-64 notation.

The characters used to represent "digits" are . for 0, / for 1, 0 through 9 for 2-11, A through Z for12-37, and a through z for 38-63.

The leftmost character is the least significant digit. For example,a0 = (38 x 640) + (2 x 641) = 166

a64l() takes a pointer to a null-terminated base-64 representation and returns a corresponding longvalue. If the string pointed to by s contains more than six characters, a64l() uses the first six.

l64a() takes a long argument and returns a pointer to the corresponding base-64 representation. Ifthe argument is 0, l64a() returns a pointer to a null string.

Obsolescent Interfacel64a_r() converts between long integer and base-64 ASCII string.

WARNINGSThe value returned by l64a() is a pointer into a buffer, the contents of which are overwritten subse-quent calls by the same thread.

l64a_r() is an obsolescent interface supported only for compatibility with existing DCE applications.New multithreaded applications should use l64a() .

SEE ALSOthread_safety(5).

STANDARDS CONFORMANCEa64l() : SVID2, SVID3l64a() : SVID2, SVID3

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−3

A aA

abort(3C) abort(3C)

NAMEabort( ) - generate a software abort fault

SYNOPSIS#include <stdlib.h>

void abort(void);

DESCRIPTIONabort() first closes all open files, streams, directory streams, and message catalogue descriptors, if pos-sible, then causes the signal SIGABRT to be sent to the calling process. This may cause a core dump tobe generated (see signal (2)).

If the signal SIGABRTis caught, the handling function is executed. If the handling function returns, theaction for SIGABRT is then reset to SIG_DFL, and the signal SIGABRT is sent again to the process toensure that it terminates.

RETURN VALUEabort() does not return.

ERRORSNo errors are defined.

APPLICATION USAGESIGABRTis not intended to be caught.

DIAGNOSTICSIf SIGABRTis neither caught nor ignored, and the current directory is writable, a core dump is producedand the message abort - core dumped is written by the shell.

SEE ALSOadb(1), exit(2), kill(2), signal(2), signal(5), thread_safety(5).

STANDARDS CONFORMANCEabort() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−4 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

abs(3C) abs(3C)

NAMEabs( ), labs( ) - return integer absolute value

SYNOPSIS#include <stdlib.h>

int abs(int i);

long int labs(long int i);

DESCRIPTIONabs() returns the absolute value of its integer operand.

labs() is similar to abs() , except that the argument and the returned value each have type longint .

The largest negative integer returns itself.

WARNINGSIn two’s-complement representation, the absolute value of the negative integer with largest magnitude isundefined. Some implementations trap this error, but others simply ignore it.

SEE ALSOfloor(3M), thread_safety(5).

STANDARDS CONFORMANCEabs() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

labs() : AES, SVID3, XPG4, ANSI C

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−5

A aA

aclsort(3C) aclsort(3C)

NAMEaclsort( ) - sort an Access Control List (JFS File Systems only)

SYNOPSIS#include <sys/types.h>#include <sys/aclv.h>

int aclsort(int nentries, int calclass, struct acl *aclbufp);

DESCRIPTIONThe aclsort() routine sorts JFS Access Control List (ACL) entries into the correct order to be acceptedby the acl (2) system call.

aclbufp points to a buffer containing ACL entries; calclass , if non-zero, indicates that theCLASS_OBJpermissions should be recalculated; and nentries specifies the number of ACL entries inthe buffer.

aclsort() sorts the contents of the ACL buffer as follows:

Entries will be in order USER_OBJ, USER, GROUP_OBJ, GROUP, CLASS_OBJ, OTHER_OBJ,DEF_USER_OBJ, DEF_USER, DEF_GROUP_OBJ, DEF_GROUP, DEF_CLASS_OBJ, andDEF_OTHER_OBJ.

Entries of type USER, GROUP, DEF_USER, and DEF_GROUPwill be sorted in increasing order bynumeric ID.

The aclsort() call will succeed if all of the following are true:

There is exactly one entry each of type USER_OBJ, GROUP_OBJ, CLASS_OBJ, and OTHER_OBJ.

There is at most one entry each of type DEF_USER_OBJ, DEF_GROUP_OBJ, DEF_CLASS_OBJ,and DEF_OTHER_OBJ.

Entries of type USER, GROUP, DEF_USER, or DEF_GROUPmay not contain duplicate entries. Aduplicate entry is one of the same type containing the same numeric id, irrespective of permissionbits.

If the calclass argument is zero and there are no entries of type USERand no entries of typeGROUP, the permissions of the GROUP_OBJand CLASS_OBJentries must be the same.

If there are no entries of type DEF_USER and no entries of type DEF_GROUP, and theDEF_GROUP_OBJentry is specified, then the DEF_CLASS_OBJentry must also be specified, andthe permissions of the DEF_GROUP_OBJand DEF_CLASS_OBJentries must be the same.

RETURN VALUEUpon successful completion, the return value is 0. If there are duplicate entries, the return value is theposition of the first duplicate entry. If there is more than one entry of type USER_OBJ, GROUP_OBJ,CLASS_OBJ, OTHER_OBJ, DEF_USER_OBJ, DEF_GROUP_OBJ, DEF_CLASS_OBJ orDEF_OTHER_OBJ, they are treated as duplicate entries, and the return value is the position of the firstduplicate entry. For all other errors, the return value is -1.

NOTICESThe buffer is sorted by type and ID before checking for any failures. Therefore the buffer is alwayssorted, even if there is a failure.

The position of a duplicate entry returned on failure is not the byte offset of the duplicate entry from itsbase; rather it refers to the entry number of the duplicate entry within the sorted buffer.

Checks will be performed in order of entry type. If there are multiple failures, the failure returned willbe the first encountered, for example, if the ACL buffer contains a duplicate USERentry and does not con-tain an OTHER_OBJentry, the return value will be the first duplicate USERentry.

ACLs do not have to be sorted with aclsort() prior to passing them to acl (2).

DEPENDENCIESaclsort() is only supported on JFS file system on the standard HP-UX operating system.

AUTHORaclsort() was developed by AT&T.

Section 3−−6 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

aclsort(3C) aclsort(3C)

SEE ALSOacl(2), aclv(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−7

A aA

acltostr(3C) acltostr(3C)

NAMEacltostr( ) - convert access control list (ACL) structure to string form (HFS File Systems only)

SYNOPSIS#include <acllib.h>

char *acltostr(int nentries, const struct acl_entry acl[], int form);

Obsolescent Interfaceint acltostr_r(

int nentries,const struct acl_entry acl[],int form,char *strbuf,int length);

Remarks:To ensure continued conformance with emerging industry standards, features described in thismanual entry are likely to change in a future release.

DESCRIPTIONacltostr() converts an access control list from structure form to string representation. acltostr()takes a pointer to the first element of an array of ACL entries (acl ), containing the indicated number(nentries ) of valid entries (zero or more), and the output form desired (FORM_SHORTor FORM_LONG). Itreturns a pointer to a static string (overwritten by the next call), which is a symbolic representation of theACL, ending in a null character. The output forms are described in acl (5). In long form, the stringreturned contains newline characters.

A user ID of ACL_NSUSERand a group ID of ACL_NSGROUPare both represented by %. As with the lscommand (see ls (1)), if an entry contains any other user ID or group ID value not listed in /etc/passwdor /etc/group , acltostr() returns a string equivalent of the ID number instead.

Just as in routines that manage the /etc/passwd file, acltostr() truncates user and group namesto eight characters.

Note: acltostr() is complementary in function to strtoacl() .

Obsolescent Interfaceacltostr_r() converts access control list (ACL) structure to string form.

RETURN VALUEIf acltostr() succeeds, it returns a pointer to a null-terminated string. If nentries is zero or less, thestring is of zero length. If nentries is greater than NACLENTRIES(defined in <sys/acl.h >), or if formis an invalid value, the call returns (char ∗) NULL .

If acltostr_r() succeeds, it returns 0. If it fails, it returns -1 and sets errno . If nentries is zero orless, the string is of zero length.

ERRORS[EINVAL] strbuf equals to NULL, or nentries is greater than NACLENTRIES (defined in

<sys/acl.h >), or form is not one of the valid forms, or length of strbuf is too short.

[ERANGE] length is less than or equal zero.

EXAMPLESThe following code fragment reads the ACL on file /users/ggd/test and prints its short-formrepresentation.

#include <stdio.h>#include <acllib.h>

int nentries;struct acl_entry acl [NACLENTRIES];

if ((nentries = getacl ("/users/ggd/test", NACLENTRIES, acl)) < 0)error (...);

Section 3−−8 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

acltostr(3C) acltostr(3C)

fputs (acltostr (nentries, acl, FORM_SHORT), stdout);

WARNINGSThe value returned by acltostr() is a pointer into a buffer, the contents of which are overwritten bysubsequent calls to acltostr() by the same thread.

acltostr_r() is an obsolescent interface supported only for compatibility with existing DCE applica-tions. New multithreaded applications should use acltostr() .

DEPENDENCIESacltostr() is only supported on HFS file system on standard HP-UX operating system.

AUTHORacltostr() was developed by HP.

FILES/etc/passwd/etc/group

SEE ALSOgetacl(2), setacl(2), cpacl(3C), chownacl(3C), setaclentry(3C), strtoacl(3C), acl(5), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−9

A aA

acos(3M) acos(3M)

NAMEacos( ), acosf( ), acosl( ), acosw( ), acosq( ) - arccosine functions

SYNOPSIS#include <math.h>

double acos(double x);

float acosf(float x);

Itanium(R)-based System Onlylong double acosl(long double x);

extended acosw(extended x);

quad acosq(quad x);

DESCRIPTIONacos() returns the arccosine of x , in the range 0 to π.

acosf() is a float version of acos() ; it takes a float argument and returns a float result.

Itanium-based System Onlyacosl() is a long double version of acos() ; it takes a long double argument and returns along double result.

acosw() is an extended version of acos() ; it takes an extended argument and returns anextended result.

acosq() is equivalent to acosl() on HPUX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) acosw() or acosq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC System OnlyMillicode versions of the acos() and acosf() functions are available. Millicode versions of mathlibrary functions are usually faster than their counterparts in the standard library. To use these ver-sions, compile your program with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the values described in the RETURN VALUE section, butdo not set errno .

RETURN VALUEacos() returns +0.

If the magnitude of x is greater than one, acos() returns NaN and raises the invalid exception.

If x is NaN, acos() returns NaN.

When it raises no other exception, whether acos() raises the inexact exception is unspecified.

ERRORSIf the magnitude of x is greater than one, acos() sets errno to [EDOM].

Itanium-based System OnlyHPUX libm functions on Itanium-based system do not set errno by default. For errno setting, compilewith the +Olibmerrno option.

SEE ALSOacosd(3M), asin(3M), atan(3M), atan2(3M), cacos(3M), cos(3M), sin(3M), tan(3M), math(5).

Section 3−−10 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

acos(3M) acos(3M)

STANDARDS CONFORMANCEacos() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

acosf() , acosl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−11

A aA

acosd(3M) acosd(3M)

NAMEacosd( ), acosdf( ), acosdl( ), acosdw( ), acosdq( ) - degree-valued arccosine functions

SYNOPSIS#include <math.h>

double acosd(double x);

float acosdf(float x);

Itanium(R)-based System Onlylong double acosdl(long double x);

extended acosdw(extended x);

quad acosdq(quad x);

DESCRIPTIONacosd() returns the degree-valued arccosine of x , in the range 0 to 180.

acosdf() is a float version of acosd() ; it takes a float argument and returns a float result.

Itanium-based System Onlyacosdl() is a long double version of acosd() ; it takes a long double argument and returns along double result.

acosdw() is an extended version of acosd() ; it takes an extended argument and returns anextended result.

acosdq() is equivalent to acosdl() on HPUX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) acosdw() or acosdq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEacosd() returns +0.

If the magnitude of x is greater than one, acosd() returns NaN and raises the invalid exception.

If x is NaN, acosd() returns NaN.

ERRORSIf the magnitude of x is greater than one, acosd() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on IPF do not set errno by default. For errno setting, compile with the +Olib-merrno option.

SEE ALSOacos(3M), asind(3M), atand(3M), atan2d(3M), cosd(3M), sind(3M), tand(3M), atan2d(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

Section 3−−12 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

acosh(3M) acosh(3M)

NAMEacosh( ), acoshf( ), acoshl( ), acoshw( ), acoshq( ) - arc hyperbolic cosine functions

SYNOPSIS#include <math.h>

double acosh(double x);

Itanium(R)-based System Onlyfloat acoshf(float x);

long double acoshl(long double x);

extended acoshw(extended x);

quad acoshq(quad x);

DESCRIPTIONacosh() returns the arc hyperbolic cosine of x , in the range +zero to +INFINITY.

Itanium-based System Onlyacoshf() is a float version of acosh() ; it takes a float argument and returns a float result.

acoshl() is a long double version of acosh() ; it takes a long double argument and returns along double result.

acoshw() is an extended version of acosh() ; it takes an extended argument and returns anextended result.

acoshq() is equivalent to acoshl() on HP-UX systems.

USAGETo use (for Itanium-based systems) acoshf() , acoshl() , acoshw() , or acoshq() , compile eitherwith the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) acoshw() or acoshq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEacosh() returns +0.

If x < 1.0, acosh() returns NaN and raises the invalid exception.

If x is +INFINITY, acosh() returns +INFINITY.

If x is NaN, acosh() returns NaN.

When it raises no other exception, whether acosh() raises the inexact exception is unspecified.

ERRORSIf x < 1.0, acosh() sets errno to [EDOM].

Itanium-based System OnlyHPUX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOasinh(3M), atanh(3M), cacosh(3M), cosh(3M), math(5).

STANDARDS CONFORMANCEacosh() , acoshf() , acoshl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−13

A aA

addch(3X) addch(3X)(CURSES)

NAMEaddch, mvaddch, mvwaddch, waddch — add a single-byte character and rendition to a window andadvance the cursor

SYNOPSIS#include <curses.h>

int addch(const chtype ch);

int mvaddch(int y, int x, const chtype ch);

int mvwaddch(WINDOW * win, int y, int x, const chtype ch);

int waddch(WINDOW * win, const chtype ch);

DESCRIPTIONThe addch() , mvaddch() , mvwaddch() and waddch() functions place ch into the current orspecified window at the current or specified position, and then advance the window’s cursor position.These functions perform wrapping. These functions perform special-character processing.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOadd_wch(3X), attroff(3X), doupdate(3X), curses_intro(3X), see section Rendition of Characters Placed intoa Window ; <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. Also the type of argument ch is changed from chtype to const chtype.

Section 3−−14 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

addchnstr(3X) addchnstr(3X)(ENHANCED CURSES)

NAMEaddchnstr, mvaddchnstr, mvwaddchnstr, waddchnstr — add length limited string of single-byte charac-ters and renditions to a window

SYNOPSIS#include <curses.h>

int addchnstr(const chtype * chstr, int n);

int mvaddchnstr(int y, int x, const chtype * chstr, int n);

int mvwaddchnstr(WINDOW * win, int y, int x, const chtype * chstr,int n);

int waddchnstr(WINDOW * win, const chtype * chstr, int n);

DESCRIPTIONThese functions overlay the contents of the current or specified window, starting at the current orspecified position, with the contents of the array pointed to by chstr until a null chtype is encountered inthe array pointed to by chstr .

These functions do not change the cursor position. These functions do not perform special-character pro-cessing. These functions do not perform wrapping.

These functions copy at most n items, but no more than will fit on the line. If n is −1 then the wholestring is copied, to the maximum number that fit on the line.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOaddch(3X), add_wch(3X), add_wchstr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−15

A aA

addchstr(3X) addchstr(3X)(CURSES)

NAMEaddchstr, mvaddchstr, mvwaddchstr, waddchstr — add string of single-byte characters and renditions toa window

SYNOPSIS#include <curses.h>

int addchstr(const chtype * chstr);

int mvaddchstr(int y, int x, const chtype * chstr);

int mvwaddchstr(WINDOW * win, int y, int x, const chtype * chstr);

int waddchstr(WINDOW * win, const chtype * chstr);

DESCRIPTIONThese functions overlay the contents of the current or specified window, starting at the current orspecified position, with the contents of the array pointed to by chstr until a null chtype is encounteredin the array pointed to by chstr .

These functions do not change the cursor position. These functions do not perform special-character pro-cessing. These functions do not perform wrapping.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOaddch(3X), addchnstr(3X), add_wch(3X), add_wchnstr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−16 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

addnstr(3X) addnstr(3X)(ENHANCED CURSES)

NAMEaddnstr, addstr, mvaddnstr, mvaddstr, mvwaddnstr, mvwaddstr, waddnstr, waddstr - add a string ofmulti-byte characters without rendition to a window and advance cursor

SYNOPSIS#include <curses.h>

int addnstr(const char * str, int n);

int addstr(const char * str);

int mvaddnstr(int y, int x, const char * str, int n);

int mvaddstr(int y, int x, const char * str);

int mvwaddnstr(WINDOW * win, int y, int x, const char * str, int n);

int mvwaddstr(WINDOW * win, int y, int x, const char * str);

int waddnstr(WINDOW * win, const char * str, int n);

int waddstr(WINDOW * win, const char * str);

DESCRIPTIONThese functions write the characters of the string str on the current or specified window starting at thecurrent or specified position using the background rendition.

These functions advance the cursor position. These functions perform special character processing.These functions perform wrapping.

The addstr() , mvaddstr() , mvwaddstr() and waddstr() functions are similar to callingmbstowcs() on str, and then calling addwstr() , mvaddwstr() , mvwaddwstr() andwaddwstr() , respectively.

The addnstr() , mvaddnstr() , mvwaddnstr() and waddnstr() functions use at most n bytesfrom str. These functions add the entire string when n is −1. These functions are similar to callingmbstowcs() on the first n bytes of str, and then calling addwstr() , mvaddwstr() , mvwaddwstr()and waddwstr() , respectively.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOaddnwstr(3X), mbstowcs() (in the X/Open System Interfaces and Headers, Issue 4, Version 2specification), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

In X/Open Curses, Issue 3, the addstr() , mvaddstr() , mvwaddstr() and waddstr() functionswere described in the addstr() entry. In X/Open Curses, Issue 4, the type of the str argument definedfor these functions is changed from char * to char *const, and the DESCRIPTION is changed to indi-cate that the functions will handle multi-byte sequences correctly.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−17

A aA

addnwstr(3X) addnwstr(3X)(ENHANCED CURSES)

NAMEaddnwstr, addwstr, mvaddnwstr, mvaddwstr, mvwaddnwstr, mvwaddwstr, waddnwstr, waddwstr — adda wide-character string to a window and advance the cursor

SYNOPSIS#include <curses.h>

int addnwstr(const wchar_t * wstr, int n);

int addwstr(const wchar_t * wstr);

int mvaddnwstr(int y, int x, const wchar_t * wstr, int n);

int mvaddwstr(int y, int x, const wchar_t * wstr);

int mvwaddnwstr(WINDOW * win, int y, int x, const wchar_t * wstr, int n);

int mvwaddwstr(WINDOW * win, int y, int x, const wchar_t * wstr);

int waddnwstr(WINDOW * win, const wchar_t * wstr, int n);

int waddwstr(WINDOW * win, const wchar_t * wstr);

DESCRIPTIONThese functions write the characters of the wide character string wstr on the current or specified windowat that window’s current or specified cursor position.

These functions advance the cursor position. These functions perform special character processing.These functions perform wrapping.

The effect is similar to building a cchar_t from the wchar_t and the background rendition and callingwadd_wch() once for each wchar_t character in the string. The cursor movement specified by the mvfunctions occurs only once at the start of the operation.

The addnwstr() , mvaddnwstr() , mvwaddnwstr() and waddnwstr() functions write at most nwide characters. If n is −1, then the entire string will be added.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOadd_wch(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−18 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

addsev(3C) addsev(3C)

NAMEaddsev() - define additional severities for formatting routines

SYNOPSIS#include <pfmt.h>

int addsev(int sev, const char *sev_string);

DESCRIPTIONThe addsev() routine allows the user to define additional severities to be used by formatting routines(see pfmt (3C)) in the standard message format. sev is the severity level. It must be between 5 and 255inclusively. sev_string is a character string to be associated for this severity level. If the severity com-ponent of the flags parameter of the formatting routines matches sev , sev_string is printed as the severitystring.

The addsev() routine may be called multiple times to set up a list of associations. If sev is already set,sev_string overwrites the previous string. If sev_string is NULL, the association is removed from the list.

addsev() assumes that sev_string has already been translated into a locale-specific string using thecurrent locale.

RETURN VALUEIf successful, addsev() returns zero. Otherwise, it returns −1.

EXAMPLE#define MM_USER 10addsev(MM_USER, "MY_NOTE");pfmt(stdout, MM_USER|MM_GET,"my_appl_cat:1:The file is writable");

This example writes the following message to standard output:

MY_NOTE: The file is writable

SEE ALSOpfmt(3C), thread_safety(5).

STANDARDS COMPLIANCEaddsev() : SVID3

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−19

A aA

add_wch(3X) add_wch(3X)(ENHANCED CURSES)

NAMEadd_wch, mvadd_wch, mvwadd_wch, wadd_wch — add a complex character and rendition to a window

SYNOPSIS#include <curses.h>

int add_wch(const cchar_t * wch);

int wadd_wch(WINDOW * win, const cchar_t * wch);

int mvadd_wch(int y, int x, const cchar_t * wch);

int mvwadd_wch(WINDOW * win, int y, int x, const cchar_t * wch);

DESCRIPTIONThese functions add information to the current or specified window at the current or specified position,and then advance the cursor. These functions perform wrapping. These functions perform special-character processing.

• If wch refers to a spacing character, then any previous character at that location is removed, anew character specified by wch is placed at that location with rendition specified by wch; thenthe cursor advances to the next spacing character on the screen.

• If wch refers to a non-spacing character, all previous characters at that location are preserved,the non-spacing characters of wch are added to the spacing complex character, and the renditionspecified by wch is ignored.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOaddch(3X), curses_intro(3X), section called Rendition of Characters Placed into a Window , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−20 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

add_wchnstr(3X) add_wchnstr(3X)(ENHANCED CURSES)

NAMEadd_wchnstr, add_wchstr, mvadd_wchnstr, mvadd_wchstr, mvwadd_wchnstr, mvwadd_wchstr,wadd_wchnstr, wadd_wchstr — add an array of complex characters and renditions to a window

SYNOPSIS#include <curses.h>

int add_wchnstr(const cchar_t * wchstr, int n);

int add_wchstr(const cchar_t * wchstr);

int wadd_wchnstr(WINDOW * win, const cchar_t * wchstr, int n);

int wadd_wchstr(WINDOW * win, const cchar_t * wchstr);

int mvadd_wchnstr(int y, int x, const cchar_t * wchstr, int n);

int mvadd_wchstr(int y, int x, const cchar_t * wchstr);

int mvwadd_wchnstr(WINDOW * win, int y, int x, const cchar_t * wchstr,int n);

int mvwadd_wchstr(WINDOW * win, int y, int x, const cchar_t * wchstr);

DESCRIPTIONThese functions write the array of cchar_t specified by wchstr into the current or specified window start-ing at the current or specified cursor position.

These functions do not advance the cursor. The results are unspecified if wchstr contains any specialcharacters.

The functions end successfully on encountering a null cchar_t. The functions also end successfully whenthey fill the current line. If a character cannot completely fit at the end of the current line, those columnsare filled with the background character and rendition.

The add_wchnstr() , mvadd_wchnstr() , mvwadd_wchnstr() and wadd_wchnstr() functionsend successfully after writing n cchar_ts (or the entire array of cchar_ts, if n is −1).

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−21

A aA

annuity(3M) annuity(3M)(Itanium(R)-based System Only)

NAMEannuity( ), annuityf( ), annuityl( ), annuityw( ), annuityq( ) - present value factor for annuity

SYNOPSIS#include <math.h>

double annuity(double rate, double periods);

float annuityf(float rate, float periods);

long double annuityl(long double rate, long double periods);

extended annuityw(extended rate, extended periods);

quad annuityq(quad rate, quad periods);

DESCRIPTIONThe annuity() function computes the present value factor for an annuity:

(1 - (1 + rate ) ** (-periods )) / rate

annuityf() is a float version of annuity() ; it takes float arguments and returns a floatresult.

annuityl() is a long double version of annuity() ; it takes long double arguments andreturns a long double result.

annuityw() is an extended version of annuity() ; it takes extended arguments and returns anextended result.

annuityq() is equivalent to annuityl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. To use annuityw() or annuityq() , compile with the -fpwidetypesoption. Make sure your program includes <math.h> . Link in the math library by specifying -lm on thecompiler or linker command line.

RETURN VALUEIf periods equals zero, annuity() returns 0.0.

Else, if rate equals zero, annuity() returns periods .

Else, if either argument is a NaN, annuity() returns a NaN.

Else, if rate < -1, annuity() returns a NaN and raises the invalid exception.

Else, if rate = -1 and periods = +INFINITY, annuity() returns +INFINITY.

Else, if rate equals -1 and periods > 0, annuity() is equivalent to 1.0 / 0.0 .

Else, if rate equals -1, annuity() returns -1.

Else, if rate equals +INFINITY and periods >= 0, annuity() returns +0.0.

Else, if rate equals +INFINITY and -1 < periods < 0, annuity() returns -0.0.

Else, if rate equals +INFINITY and periods = -1, annuity() returns -1.

Else, if rate equals +INFINITY, annuity() returns -INFINITY.

Else, if periods is infinite and (rate * periods ) > 0, annuity() is equivalent to 1.0 / rate.

Else, if periods is infinite, annuity() returns periods .

annuity() returns a properly signed infinity in lieu of a value whose magnitude is too large, and raisesthe overflow and inexact exceptions.

annuity() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormalor zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

ERRORSNo errors are defined.

Section 3−−22 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

annuity(3M) annuity(3M)(Itanium(R)-based System Only)

SEE ALSOcompound(3M), exp(3M), expm1(3M), pow(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−23

A aA

asin(3M) asin(3M)

NAMEasin( ), asinf( ), asinl( ), asinw( ), asinq( ) - arcsine functions

SYNOPSIS#include <math.h>

double asin(double x);

float asinf(float x);

Itanium(R)-based System Onlylong double asinl(long double x);

extended asinw(extended x);

quad asinq(quad x);

DESCRIPTIONasin() returns the arcsine of x , in the range −π/2 to π/2.

asinf() is a float version of asin() ; it takes a float argument and returns a float result.

Itanium-based System Onlyasinl() is a long double version of asin() ; it takes a long double argument and returns along double result.

asinw() is an extended version of asin() ; it takes an extended argument and returns anextended result.

asinq() is equivalent to asinl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) asinw() or asinq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the asin() and asinf() functions are available. Millicode versions of mathlibrary functions are usually faster than their counterparts in the standard library. To use these ver-sions, compile your program with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the values described in the RETURN VALUE section, butdo not set errno .

RETURN VALUEasin( ±0) returns ±0.

If the magnitude of x is greater than one, asin() returns NaN and raises the invalid exception.

If x is NaN, asin() returns NaN.

When it raises no other exception, whether asin() raises the inexact exception is unspecified.

ERRORSIf the magnitude of x is greater than one, asin() sets errno to [EDOM].

Itanium-based SystemHP-UX libm functions on Itanium-based system do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOacos(3M), asind(3M), atan(3M), atan2(3M), casin(3M), cos(3M), sin(3M), tan(3M), math(5).

Section 3−−24 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

asin(3M) asin(3M)

STANDARDS CONFORMANCEasin() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

asinf() , asinl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−25

A aA

asind(3M) asind(3M)

NAMEasind( ), asindf( ), asindl( ), asindw( ), asindq( ) - degree-valued arcsine functions

SYNOPSIS#include <math.h>

double asind(double x);

float asindf(float x);

Itanium(R)-based System Onlylong double asindl(long double x);

extended asindw(extended x);

quad asindq(quad x);

DESCRIPTIONasind() returns the degree-valued arcsine of x , in the range −90 to 90.

asindf() is a float version of asind() ; it takes a float argument and returns a float result.

Itanium-based System Onlyasindl() is a long double version of asind() ; it takes a long double argument and returns along double result.

asindw() is an extended version of asind() ; it takes an extended argument and returns anextended result.

asindq() is equivalent to asindl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) asindw() or asindq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEasind( ±0) returns ±0.

If the magnitude of x is greater than one, asind() returns NaN and raises the invalid exception.

If x is NaN, asind() returns NaN.

ERRORSIf the magnitude of x is greater than one, asind() sets errno to [EDOM].

Itanium-based SystemHP-UX libm functions on Itanium-based system do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOacosd(3M), asin(3M), atand(3M), atan2d(3M), cosd(3M), sind(3M), tand(3M), atan2d(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

Section 3−−26 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

asinh(3M) asinh(3M)

NAMEasinh( ), asinhf( ), asinhl( ), asinhw( ), asinhq( ) - arc hyperbolic sine functions

SYNOPSIS#include <math.h>

double asinh(double x);

Itanium(R)-based System Onlyfloat asinhf(float x);

long double asinhl(long double x);

extended asinhw(extended x);

quad asinhq(quad x);

DESCRIPTIONasinh() returns the arc hyperbolic sine of x .

Itanium-based System Onlyasinhf() is a float version of asinh() ; it takes a float argument and returns a float result.

asinhl() is a long double version of asinh() ; it takes a long double argument and returns along double result.

asinhw() is an extended version of asinh() ; it takes an extended argument and returns anextended result.

asinhq() is equivalent to asinhl() on HP-UX systems.

USAGETo use (for Itanium-based systems) asinhf() , asinhl() , asinhw() , or asinhq() , compile eitherwith the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) asinhw() or asinhq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEasinh( ±0) returns ±0.

If x is ±INFINITY, asinh() returns ±INFINITY respectively.

If x is NaN, asinh() returns NaN.

Whether asinh() raises the inexact exception is unspecified.

ERRORSNo errors are defined.

SEE ALSOacosh(3M), atanh(3M), casinh(3M), sinh(3M), math(5).

STANDARDS CONFORMANCEasinh() , asinhf() , asinhl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−27

A aA

assert(3X) assert(3X)

NAMEassert( ) - verify program assertion

SYNOPSIS#include <assert.h>

void assert(int expression);

DESCRIPTIONThis macro is useful for putting diagnostics into programs. When it is executed, if expression is false(zero), assert() prints:

Assertion failed: expression , file xyz, line nnn

on the standard error output and aborts. In the error message, xyz is the name of the source file and nnnthe source line number of the assert() statement.

Compiling with the preprocessor option -DNDEBUG(see cpp (1)), or with the preprocessor control state-ment #define NDEBUG ahead of the #include <assert.h> statement, stops assertions frombeing compiled into the program.

WARNINGSThe expression argument used by assert() in compatibility mode cannot contain string literals or dou-ble quotes without escapes.

SEE ALSOcpp(1), abort(3C), thread_safety(5).

STANDARDS CONFORMANCEassert() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−28 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

atan(3M) atan(3M)

NAMEatan( ), atanf( ), atanl( ), atanw( ), atanq( ) - arctangent functions

SYNOPSIS#include <math.h>

double atan(double x);

float atanf(float x);

Itanium(R)-based System Onlylong double atanl(long double x);

extended atanw(extended x);

quad atanq(quad x);

DESCRIPTIONatan() returns the arctangent of x , in the range −π/2 to π/2.

atanf() is a float version of atan() ; it takes a float argument and returns a float result.

Itanium-based System Onlyatanl() is a long double version of atan() ; it takes a long double argument and returns along double result.

atanw() is an extended version of atan() ; it takes an extended argument and returns anextended result.

atanq() is equivalent to atanl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) atanw() or atanq() , compile also with -fpwidetypes .

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line. For more information, see the HP-UXFloating-Point Guide .

PA-RISC OnlyMillicode versions of the atan() and atanf() functions are available. Millicode versions of mathlibrary functions are usually faster than their counterparts in the standard library. To use these ver-sions, compile your program with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the same values as their standard library counterparts(see the RETURN VALUE section).

RETURN VALUEatan( ±0) returns ±0.

If x is ±INFINITY, atan() returns ±π/2 respectively.

If x is NaN, atan() returns NaN.

Whether atan() raises the inexact exception is unspecified.

ERRORSNo errors are defined.

SEE ALSOacos(3M), asin(3M), atand(3M), atan2(3M), catan(3M), cos(3M), sin(3M), tan(3M), math(5).

STANDARDS CONFORMANCEatan() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

atanf() , atanl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−29

A aA

atan2(3M) atan2(3M)

NAMEatan2( ), atan2f( ), atan2l( ), atan2w( ), atan2q( ) - arctangent and quadrant functions

SYNOPSIS#include <math.h>

double atan2(double y, double x);

float atan2f(float y, float x);

Itanium(R)-based System Onlylong double atan2l(long double y, long double x);

extended atan2w(extended y, extended x);

quad atan2q(quad y, quad x);

DESCRIPTIONatan2() returns the arctangent of y /x , in the range −π to π, using the signs of both arguments to deter-mine the quadrant of the return value.

atan2f() is a float version of atan2() ; it takes float arguments and returns a float result.

Itanium-based System Onlyatan2l() is a long double version of atan2() ; it takes long double arguments and returns along double result.

atan2w() is an extended version of atan2() ; it takes extended arguments and returns anextended result.

atan2q() is equivalent to atan2l() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) atan2w() or atan2q() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the atan2() function are available. Millicode versions of math library functionsare usually faster than their counterparts in the standard library. To use these versions, compile yourprogram with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the same values as their standard library counterparts(see the RETURN VALUE section).

RETURN VALUEIf y is ±0 and x is −0 atan2() returns ±π respectively.

If y is ±0 and x is +0 atan2() returns ±0 respectively.

If y is ±0 and x is less than zero, atan2() returns returns ±π respectively.

If y is ±0 and x is greater than zero, atan2() returns returns ±0 respectively.

If y is less than zero and x is zero, atan2() returns −π/2.

If y is greater than zero and x is zero, atan2() returns π/2.

If y is greater than zero and x is −INFINITY, atan2() returns Pi.

If y is less than zero and x is −INFINITY, atan2() returns −π.

If y is greater than zero and x is INFINITY, atan2() returns +0.

If y is less than zero and x is INFINITY, atan2() returns −0.

If y is ±INFINITY and x is finite, atan2() returns ±π/2 respectively.

Section 3−−30 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

atan2(3M) atan2(3M)

If y is ±INFINITY and x is −INFINITY, atan2() returns ±3π/4 respectively.

If y is ±INFINITY and x is +INFINITY, atan2() returns ±π/4 respectively.

If x or y is NaN, atan2() returns NaN.

Whether atan2() raises the inexact exception is unspecified.

ERRORSNo errors are defined.

SEE ALSOacos(3M), asin(3M), atan(3M), atan2d(3M), carg(3M), cos(3M), sin(3M), tan(3M), math(5).

STANDARDS CONFORMANCEatan2() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

atan2f() , atan2l() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−31

A aA

atan2d(3M) atan2d(3M)

NAMEatan2d( ), atan2df( ), atan2dl( ), atan2dw( ), atan2dq( ) - degree-valued arctangent-and-quadrant functions

SYNOPSIS#include <math.h>

double atan2d(double y, double x);

float atan2df(float y, float x);

Itanium(R)-based System Onlylong double atan2dl(long double y, long double x);

extended atan2dw(extended y, extended x);

quad atan2dq(quad y, quad x);

DESCRIPTIONatan2d() is a degree-valued version of the atan2() function. It returns the arctangent of y /x , in therange −180 to 180, using the signs of both arguments to determine the quadrant of the return value.

atan2df() is a float version of atan2d() ; it takes float arguments and returns a float result.

Itanium-based System Onlyatan2dl() is a long double version of atan2d() ; it takes long double arguments and returnsa long double result.

atan2dw() is an extended version of atan2d() ; it takes extended arguments and returns anextended result.

atan2dq() is equivalent to atan2dl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) atan2dw() or atan2dq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf y is ±0 and x is −0, atan2d() returns ±180 respectively.

If y is ±0 and x is +0, atan2d() returns ±0 respectively.

If y is ±0 and x is less than zero, atan2d() returns ±180 respectively.

If y is ±0 and x is greater than zero, atan2d() returns returns ±0 respectively.

If y is less than zero and x is zero, atan2d() returns −90.

If y is greater than zero and x is zero, atan2d() returns 90.

If y is greater than zero and x is −INFINITY, atan2d() returns 180.

If y is less than zero and x is −INFINITY, atan2d() returns −180.

If y is greater than zero and x is INFINITY, atan2d() returns +0.

If y is less than zero and x is INFINITY, atan2d() returns −0.

If y is ±INFINITY and x is finite, atan2d() returns ±90 respectively.

If y is ±INFINITY and x is −INFINITY, atan2d() returns ±135 respectively.

If y is ±INFINITY and x is +INFINITY, atan2d() returns ±45 respectively.

If x or y is NaN, atan2d() returns NaN.

Section 3−−32 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

atan2d(3M) atan2d(3M)

ERRORSNo errors are defined.

SEE ALSOacosd(3M), asind(3M), atand(3M), atan2(3M), cosd(3M), sind(3M), tand(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−33

A aA

atand(3M) atand(3M)

NAMEatand( ), atandf( ), atandl( ), atandw( ), atandq( ) - degree-valued arctangent functions

SYNOPSIS#include <math.h>

double atand(double x);

float atandf(float x);

Itanium(R)-based System Onlylong double atandl(long double x);

extended atandw(extended x);

quad atandq(quad x);

DESCRIPTIONatand() returns the degree-valued arctangent of x , in the range −90 to 90.

atandf() is a float version of atand() ; it takes a float argument and returns a float result.

Itanium-based System Onlyatandl() is a long double version of atand() ; it takes a long double argument and returns along double result.

atandw() is an extended version of atand() ; it takes an extended argument and returns anextended result.

atandq() is equivalent to atandl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) atandw() or atandq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEatand( ±0) returns ±0.

If x is ±INFINITY, atand() returns ±90 respectively.

If x is NaN, atand() returns NaN.

ERRORSNo errors are defined.

SEE ALSOacosd(3M), asind(3M), atan(3M), atan2d(3M), cosd(3M), sind(3M), tand(3M), atan2d(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

Section 3−−34 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

atanh(3M) atanh(3M)

NAMEatanh( ), atanhf( ), atanhl( ), atanhw( ), atanhq( ) - arc hyperbolic tangent functions

SYNOPSIS#include <math.h>

double atanh(double x);

Itanium(R)-based System Onlyfloat atanhf(float x);

long double atanhl(long double x);

extended atanhw(extended x);

quad atanhq(quad x);

DESCRIPTIONatanh() returns the arc hyperbolic tangent of x .

Itanium-based System Onlyatanhf() is a float version of atanh() ; it takes a float argument and returns a float result.

atanhl() is a long double version of atanh() ; it takes a long double argument and returns along double result.

atanhw() is an extended version of atanh() ; it takes an extended argument and returns anextended result.

atanhq() is equivalent to atanhl() on HP-UX systems.

USAGETo use (for Itanium-based systems) atanhf() , atanhl() , atanhw() , or atanhq() , compile eitherwith the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) atanhw() or atanhq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEatanh( ±0) returns ±0.

atanh( ±1) returns ±Inf and raises the divide-by-zero floating-point exception.

If |x| > 1.0, atanh() returns NaN and raises the invalid exception.

If x is NaN, atanh() returns NaN.

When it raises no other exception, whether atanh() raises the inexact exception is unspecified.

ERRORSIf |x| > 1.0, atanh() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on Itanium-based system do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOacosh(3M), asinh(3M), catanh(3M), tanh(3M), math(5).

STANDARDS CONFORMANCEatanh() , atanhf() , atanhl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−35

A aA

atexit(3) atexit(3)

NAMEatexit - register a function to be called at program termination

SYNOPSIS#include <stdlib.h>

int atexit(void (*func)(void));

DESCRIPTIONatexit() registers the function func to be called, without arguments, at normal program termination.Functions registered by atexit() are called in reverse order of registration.

An atexit() call during exit processing is always unsuccessful.

The number of registered functions should not exceed ATEXIT_MAXas specified in <limits.h >.

When necessary, crt0() or dld.sl() (see crt0 (3) and dld.sl (5)) registers one or more functions withatexit() to allow some processing at normal program termination. This registration occurs before anyother.

RETURN VALUEatexit() returns zero if the registration is successful; non-zero if unsuccessful.

SEE ALSOexit(2), crt0(3), dld.sl(5).

STANDARDS CONFORMANCEatexit() : AES, SVID3, XPG4, ANSI C

Section 3−−36 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A aA

attroff(3X) attroff(3X)(CURSES)

NAMEattroff, attron, attrset, wattroff, wattron, wattrset — restricted window attribute control functions

SYNOPSIS#include <curses.h>

int attroff(int attrs);

int attron(int attrs);

int attrset(int attrs);

int wattroff(WINDOW * win, int attrs);

int wattron(WINDOW * win, int attrs);

int wattrset(WINDOW * win, int attrs);

DESCRIPTIONThese functions manipulate the window attributes of the current or specified window.

The attroff() and wattroff() functions turn off attrs in the current or specified window withoutaffecting any others.

The attron() and wattron() functions turn on attrs in the current or specified window withoutaffecting any others.

The attrset() and wattrset() functions set the background attributes of the current or specifiedwindow to attrs.

It is unspecified whether these functions can be used to manipulate attributes other than A_BLINK ,A_BOLD, A_DIM, A_REVERSE, A_STANDOUTand A_UNDERLINE.

RETURN VALUEThese functions always return either OKor 1.

ERRORSNo errors are defined.

SEE ALSOattr_get(3X), standend(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4This entry is rewritten for clarity. The DESCRIPTION is updated to specify that it is undefined whetherthese functions can be used to manipulate attributes beyond those defined in X/Open Curses, Issue 3.The standend() , standout() , wstandend() and wstandout() functions are moved to thestandend() entry.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−37

A aA

attr_get(3X) attr_get(3X)(ENHANCED CURSES)

NAMEattr_get, attr_off, attr_on, attr_set, color_set, wattr_get, wattr_off, wattr_on, wattr_set, wcolor_set — win-dow attribute control functions

SYNOPSIS#include <curses.h>

int attr_get(attr_t * attrs, short * color, void * opts);

int attr_off(attr_t attrs, void * opts);

int attr_on(attr_t attrs, void * opts);

int attr_set(attr_t attrs, short color, void * opts);

int color_set(short color, void * opts);

int wattr_get(WINDOW * win, attr_t * attrs, short * color, void * opts);

int wattr_off(WINDOW * win, attr_t attrs, void * opts);

int wattr_on(WINDOW * win, attr_t attrs, void * opts);

int wattr_set(WINDOW * win, attr_t attrs, short color, void * opts);

int wcolor_set(WINDOW * win, short color, void * opts);

DESCRIPTIONThese functions manipulate the attributes and color of the window rendition of the current or specifiedwindow.

The attr_get() and wattr_get() functions obtain the current rendition of a window.

The attr_off() and wattr_off() functions turn off attrs in the current or specified window withoutaffecting any others.

The attr_on() and wattr_on() functions turn on attrs in the current or specified window withoutaffecting any others.

The attr_set() and wattr_set() functions set the window rendition of the current or specifiedwindow to attrs and color.

The color_set() and wcolor_set() functions set the window color of the current or specified win-dow to color.

The opts argument is reserved for definition in a future edition of this document. Currently, the applica-tion must provide a null pointer as opts.

RETURN VALUEThese functions always return OK.

ERRORSNo errors are defined.

SEE ALSOattroff(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−38 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

basename(3C) basename(3C)

NAMEbasename( ), dirname( ) - extract components of a path name

SYNOPSIS#include <libgen.h>

char *basename(char *path);

char *dirname(char *path);

DESCRIPTIONbasename() takes the path name pointed to by path and returns a pointer to the final component of thepath name, deleting any trailing ’/’ characters. If the string consists entirely of ’/’ characters,basename() returns a pointer to the string "/". If path is a null pointer or points to the empty string,basename() returns a pointer to the string ".".

dirname() takes the path name pointed to by path and returns a pointer to a string that is a path nameof the parent directory of that file. If path is a null pointer, points to the empty string, or does not containa ’/’ character, then dirname() returns a pointer to the string ".".

RETURN VALUEbasename() returns a pointer to the final component of path .

dirname() returns a pointer to a string that is the parent directory of path .

EXAMPLESThe following code fragment calls basename() and dirname() .

#include <libgen.h>

const char *path="/usr/local/bin/foo";char *base, *dir;char *dup0, *dup1;char *dup2, *dup3;

/*Use strdup in case literals* are in text, or basename()* and dirname() modify the* input string.*/

dup0=strdup(path);dup1=strdup(path);

base=basename(dup0);dir=dirname(dup1);

/* Use strdup before modifying* return string in case a* pointer to a literal is* returned.*/

dup2=strdup(base);dup3=strdup(dir);

WARNINGSbasename() and dirname() may overwrite path.

basename() and dirname() in non-threaded applications currently use a static buffer in each func-tion to hold the result string. Any subsequent calls to basename() and dirname() may overwrite thestatic buffer. At some release after HP-UX 11i Version 1, HP may use malloc() to allocate the buffers.Once allocated, those buffers will be reused and their addresses will not change; however, if the mal-loc() fails, basename() and dirname() would return "." and errno would be set to [ENOMEM].

AUTHORbasename() and dirname() were developed by HP.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−39

A bA

basename(3C) basename(3C)

SEE ALSObasename(1), thread_safety(5).

STANDARDS CONFORMANCEbasename() : XPG4.2dirname() : XPG4.2

Section 3−−40 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A bA

baudrate(3X) baudrate(3X)(CURSES)

NAMEbaudrate — get terminal baud rate

SYNOPSIS#include <curses.h>

int baudrate(void);

DESCRIPTIONThe baudrate() function extracts the output speed of the terminal in bits per second.

RETURN VALUEThe baudrate() function returns the output speed of the terminal.

ERRORSNo errors are defined.

SEE ALSOtcgetattr() (in the X/Open System Interfaces and Headers, Issue 4, Version 2 specification), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The argument list is explicitly declared as void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−41

A bA

beep(3X) beep(3X)(CURSES)

NAMEbeep — audible signal

SYNOPSIS#include <curses.h>

int beep(void);

DESCRIPTIONThe beep() function alerts the user. It sounds the audible alarm on the terminal, or if that is not possi-ble, it flashes the screen (visible bell). If neither signal is possible, nothing happens.

RETURN VALUEThe beep() function always returns OK.

ERRORSNo errors are defined.

APPLICATION USAGENearly all terminals have an audible alarm, but only some can flash the screen.

SEE ALSOflash(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The argument list is explicitly declared as void. The RETURN VALUE section is changed to indicatethat the function always returns OK. The flash() function is moved to its own entry.

Section 3−−42 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bgets(3G) bgets(3G)

NAMEbgets() - read stream up to next delimiter

SYNOPSIS#include <libgen.h>

char *bgets (char * buffer , size_t * count , FILE * stream ,

const char * breakstring );

DESCRIPTIONbgets reads characters from stream into buffer until either count is exhausted or one of the charactersin breakstring is encountered in the stream. The read data is terminated with a null byte (’ \0 ’) and apointer to the trailing null is returned. If a breakstring character is encountered, the last non-null is thedelimiter character that terminated the scan.

Note that, except for the fact that the returned value points to the end of the read string rather than tothe beginning, the call

bgets(buffer, sizeof buffer, stream, \n);

is identical to

fgets(buffer, sizeof buffer, stream);

There is always enough room reserved in the buffer for the trailing null.

If breakstring is a null pointer, the value of breakstring from the previous call is used. If breakstring isnull at the first call, no characters will be used to delimit the string.

RETURN VALUENULL is returned on error or end-of-file. Reporting the condition is delayed to the next call if any charac-ters were read but not yet returned.

EXAMPLES#include <libgen.h>char buffer[8];/* read in first user name from /etc/passwd */fp = fopen("/etc/passwd","r");bgets(buffer, 8, fp, ":");

SEE ALSOgets(3S), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−43

A bA

bigcrypt(3C) bigcrypt(3C)

NAMEbigcrypt - generate hashing encryption on large strings

SYNOPSIS#include <hpsecurity.h>#include <prot.h>

char *bigcrypt(char *key, char *salt);

DESCRIPTIONbigcrypt() acts like crypt (3C), but handles much larger strings. bigcrypt takes the segments ofcleartext and encrypts them individually, at first using the salt passed in, and then using the first twocharacters of the previous encrypted segment as the salt for the next segment. This avoids duplicatedciphertext chunks when the password characters are repeated, so that the encryption of a segmentinvolves the encryption of all the previous segments.

Each ciphertext segment is concatenated, with the salt at the beginning, to form the entire encryptedstring.

AUTHORbigcrypt was developed by HP.

SEE ALSOcrypt(3C).

Section 3−−44 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bindresvport(3N) bindresvport(3N)

NAMEbindresvport() - bind socket to privileged IP port

SYNOPSIS#include <sys/types.h>#include <netinet/in.h>

int bindresvport(int sd, struct sockaddr_in *sin);

DESCRIPTIONThe bindresvport() function binds a socket descriptor to a privileged IP port; that is, a port numberin the range 0 to 1023.

sd is a socket descriptor that was previously defined by a successful call to socket() (see socket (2)).

Upon successful completion of bindresvport() , the sin_port field in the struct pointed to by sincontains the number of the privileged port bound to the sd socket. Due to the need to protect the portnumbers used by various networking commands, bindresvport() only returns a port number withina smaller subrange in the range of 0 to 1023.

Only superuser can bind to a privileged port.

RETURN VALUEbindresvport() returns the following values:

0 Successful completion.-1 Failure. errno is set to indicate the error.

ERRORSIf bindresvport() fails, errno is set to one of the following values:

[EACCES] The requested address is protected, and the current user has inadequatepermission to access it.

[EADDRINUSE] The specified address is already in use.

[EADDRNOTAVAIL] The specified address is bad or not available from the local machine.

[EAFNOSUPPORT] Requested address does not match the address family of this socket.

[EBADF] sd is not a valid descriptor.

[EINVAL] The socket is already bound to an address, or the socket has been shutdown.

[ENOBUFS] Insufficient buffer memory is available.

[ENOTSOCK] sd is not a socket.

[EOPNOTSUPP] The socket whose descriptor is sd is of a type that does not support addressbinding.

[EPFNOSUPPORT] The value specified in the sin_family field of the sockaddr_in struct was notAF_INET .

AUTHORbindresvport() was developed by Sun Microsystems, Inc.

SEE ALSObind(2), socket(2).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−45

A bA

bkgd(3X) bkgd(3X)(ENHANCED CURSES)

NAMEbkgd, bkgdset, getbkgd, wbkgd, wbkgdset — set or get background character and rendition using asingle-byte character

SYNOPSIS#include <curses.h>

int bkgd(chtype ch);

void bkgdset(chtype ch);

chtype getbkgd(WINDOW * win);

int wbkgd(WINDOW * win, chtype ch);

void wbkgdset(WINDOW * win, chtype ch);

DESCRIPTIONThe bkgdset() and wbkgdset() functions set the background property of the current or specifiedwindow based on the information in ch. If ch refers to a multi-column character, the results areundefined.

The bkgd() and wbkgd() functions set the background property of the current or specified window andthen apply this setting to every character position in that window:

• The rendition of every character on the screen is changed to the new background rendition.

• Wherever the former background character appears, it is changed to the new background char-acter.

The getbkgd() function extracts the specified window’s background character and rendition.

RETURN VALUEUpon successful completion, bkgd() and wbkgd() return OK. Otherwise, they return ERR.

The bkgdset() and wbkgdset() functions do not return a value.

Upon successful completion, getbkgd() returns the specified window’s background character and rendi-tion. Otherwise, it returns (chtype)ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOcurses_intro(3X), subsection Rendition , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−46 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bkgrnd(3X) bkgrnd(3X)(ENHANCED CURSES)

NAMEbkgrnd, bkgrndset, getbkgrnd, wbkgrnd, wbkgrndset, wgetbkgrnd — set or get background character andrendition using a complex character

SYNOPSIS#include <curses.h>

int bkgrnd(const cchar_t * wch);

void bkgrndset(const cchar_t * wch);

int getbkgrnd(cchar_t * wch);

int wbkgrnd(WINDOW * win, const cchar_t * wch);

void wbkgrndset(WINDOW * win, const cchar_t * wch);

int wgetbkgrnd(WINDOW * win, cchar_t * wch);

DESCRIPTIONThe bkgrndset() and wbkgrndset() functions set the background property of the current orspecified window based on the information in wch.

The bkgrnd() and wbkgrnd() functions set the background property of the current or specified win-dow and then apply this setting to every character position in that window:

• The rendition of every character on the screen is changed to the new background rendition.

• Wherever the former background character appears, it is changed to the new background char-acter.

If wch refers to a non-spacing complex character for bkgrnd() , bkgrndset() , wbkgrnd() andwbkgrndset() , then wch is added to the existing spacing complex character that is the backgroundcharacter. If wch refers to a multi-column character, the results are unspecified.

The getbkgrnd() and wgetbkgrnd() functions store, into the area pointed to by wch, the value ofthe window’s background character and rendition.

RETURN VALUEThe bkgrndset() and wbkgrndset() functions do not return a value.

Upon successful completion, the other functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOcurses_intro(3X), subsection called Rendition , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−47

A bA

blmode(3C) blmode(3C)(OBSOLETED in Itanium(R)-based Systems)

NAMEblopen( ), blclose( ), blread( ), blget( ), blset( ) - terminal block-mode library interface

SYNOPSIS#include <sys/blmodeio.h>

int blopen(int fildes);

int blclose(int bfdes);

int blread(int bfdes, char *buf, size_t nbyte);

int blget(int bfdes, struct blmodeio *arg);

int blset(int bfdes, const struct blmodeio *arg);

DESCRIPTIONThis terminal library interface allows support of block-mode transfers with HP terminals. Block modeonly affects input processing. Therefore, data is written with the standard write() interface (seewrite (2)).

In character mode, the terminal sends each character to the system as it is typed. However, in blockmode, data is buffered and possibly edited locally in the terminal memory as it is typed, then sent as ablock of data when the [Enter] key is pressed on the terminal. During block-mode data transmissions,the incoming data is not echoed by the interface and no special character processing is performed, otherthan recognizing a data block terminator character. For subsequent character mode transmissions, theexisting termio state (see termio (7)) continues to determine echo and character processing.

Block-mode protocol has two component parts: block-mode handshake and block-mode transmission.

Block-Mode HandshakeAt the beginning of a read, a trigger character is sent to the terminal to notify it that the system wants ablock of data (the trigger character, if defined, is sent at the beginning of all reads, whether in character-or block-mode. It is necessary for block-mode reads to work correctly).

After receiving the trigger character, and when the user has typed all the data into the terminal’smemory and pressed the [Enter] key, the terminal sends an alert character to the system to notify it thatthe terminal has a block of data to send.

The system might then send user-definable cursor-positioning or other data sequences to the terminal,such as for cursor-home or lock-keyboard.

The system then sends a second trigger character to the terminal. In response, the terminal transmitsthe data block as described in the Block-Mode Transmission section.

Block-Mode TransmissionThe second part of the block-mode protocol is the block-mode transmission. After the block-modehandshake has successfully completed, the terminal transmits the data block to the system. During thistransmission of data, the incoming data is not echoed by the system and no special character processing isperformed, other than recognizing the data block termination character. It is possible to bypass theblock-mode handshake and have the block-mode transmission occur after only the first trigger characteris sent, see CB_BMTRANSbelow.

It is possible to intermix both character-mode and block-mode data transmissions. If CB_BMTRANS(seebelow) is set, all transfers are block-mode transfers. When CB_BMTRANSis not set, character modetransmissions are processed as described in termio (7). In this case, if an alert character is received any-where in the input data, the transmission mode is automatically switched to block mode for a singletransmission. Any data received before the alert is discarded. The alert character can be escaped with abackslash (\ ) character.

XON/XOFF Flow ControlTo prevent data loss, XON/XOFF flow control should be used between the system and the terminal. TheIXOFF bit (see termio (7)) should be set and the terminal strapped appropriately. If flow control is notused, it is possible for incoming data to overflow and be lost. (Note: some older terminals do not supportXON/XOFF flow control.)

Section 3−−48 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

blmode(3C) blmode(3C)(OBSOLETED in Itanium(R)-based Systems)

Read RequestsRead requests that receive data from block-mode transmissions do not return until the transmission iscomplete (the terminal has transmitted all characters). If the read is satisfied by byte count or if a datatransmission error occurs, all subsequent data is discarded until the transmission is complete. The readwaits until a terminator character is seen, or until a time interval specified by the system has passed thatis longer than necessary for the number of characters specified.

The data-block-terminator character is included in the data returned to the user, and is included in thebyte count. If the number of bytes transferred by the terminal in a block-mode transfer exceeds thenumber of bytes requested by the user, the read returns the requested number of bytes and the remainingbytes are discarded. The user can determine if data was discarded by checking the last character of thereturned data. If the last character is not the terminator character, then more data was received thanwas requested and data was discarded.

The [EIO] error can be caused by several events, including errors in transmission, framing, parity, break,and overrun, or if the internal timer expires. The internal timer starts when the second trigger characteris sent by the computer, and ends when the terminating character is received by the computer. Thelength of this timer is determined by the number of bytes requested in the read and the current baudrate, plus an additional ten seconds.

User Control of HandshakingIf desired, the application program can provide its own handshake mechanism in response to the alertcharacter by selecting the OWNTERMmode (see CB_OWNTERMbelow). With this mode selected, thedriver completes a read request when the alert character is received. No data is discarded before thealert , and the alert is returned in the data read. The alert character may be escaped with a backslash (\ )character. The second trigger is sent when the application issues the next read.

blmode Control CallsFirst, the standard open() call to a tty device must be made to obtain a file descriptor for the subse-quent block-mode control calls (an open() is done automatically by the system for stdin on the termi-nal).

int bfdes;

bfdes = blopen (int fildes)A call to blopen() must be made before any block-mode access is allowed on the specifiedfile descriptor. blopen() initializes the block-mode parameters as described below. Thereturn value from blopen() is a block-mode file descriptor that must be passed to all subse-quent block-mode control calls.

int blclose (int bfdes)A call to blclose() must be issued before the standard close() to ensure proper closureof the device (see close (2)). Otherwise unpredictable results can occur. The argument bfdes isthe file descriptor returned from a previous blopen() system call.

int blread (int bfdes, char *buf, size_t nbyte)The blread() routine has the same parameters as the read() sytem call (see read (2)). Atthe beginning of a read, the cb_trig1c character (if defined) is sent to the device. IfCB_BMTRANSis not set, and no cb_alertc character is received, the read data is processedaccording to termio (7). If CB_BMTRANSis set, or if a non-escaped cb_alertc character isreceived, echo is turned off for the duration of the transfer, and no further special characterprocessing is done other than that required for the termination character. The argument bfdesis the file descriptor returned from a previous blopen() system call.

int blget (int bfdes, struct blmodeio *arg)A call to blget() returns the current values of the blmodeio structure (see below). Theargument bfdes is the file descriptor returned from a previous blopen() system call.

int blset (int bfdes, const struct blmodeio *arg)A call to blset() sets the block-mode values from the structure whose address is arg . Theargument bfdes is the file descriptor returned from a previous blopen() system call.

blmode StructureThe two block-mode control calls, blget() and blset() , use the following structure, defined in<sys/blmodeio.h> :

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−49

A bA

blmode(3C) blmode(3C)(OBSOLETED in Itanium(R)-based Systems)

#define NBREPLY 64struct blmodeio {

unsigned long cb_flags; /* Modes */unsigned char cb_trig1c; /* First trigger */unsigned char cb_trig2c; /* Second trigger */unsigned char cb_alertc; /* Alert character */unsigned char cb_termc; /* Terminating char */unsigned char cb_replen; /* cb_reply length */char cb_reply[NBREPLY]; /* optional reply */

};

The cb_flags field controls the basic block-mode protocol:

CB_BMTRANS 0000001 Enable mandatory block-mode transmission.CB_OWNTERM 0000002 Enable user control of handshake.

If CB_BMTRANSis set, all transmissions are processed as block-mode transmissions. The block-modehandshake is not required and data read is processed as block-mode transfer data. The block-modehandshake can still be invoked by receipt of an alert character as the first character seen. A blread()issued with the CB_BMTRANSbit set causes any existing input buffer data to be flushed.

If CB_BMTRANSis not set, and if the alert character is defined and is detected anywhere in the inputstream, the input buffer is flushed and the block-mode handshake is invoked. The system then sends thecb_trig2c character to the terminal, and a block-mode transfer follows. The alert character can beescaped by preceding it with a backslash (\ ).

If CB_OWNTERMis set, reads are terminated upon receipt of a non-escaped alert character. No inputbuffer flushing is performed, and the alert character is returned in the data read. This allows applicationcode to perform its own block-mode handshaking. If the bit is clear, a non-escaped alert character causesnormal block-mode handshaking to be used.

The initial cb_flags value is all-bits-cleared.

There are several special characters (both input and output) that are used with block mode. These char-acters and the initial values for these characters are described below. Any of these characters can beundefined by setting its value to 0377.

cb_trig1c (default DC1) is the initial trigger character sent to the terminal at the beginning of aread request.

cb_trig2c (default DC1) is the secondary trigger character sent to the terminal after the alert char-acter has been seen.

cb_alertc (default DC2) is the alert character sent by the terminal in response to the first triggercharacter. It signifies that the terminal is ready to send the data block. The alert char-acter can be escaped by preceding it with a backslash ("\").

cb_termc (default RS) is sent by the terminal after the block-mode transfer has completed. Itsignifies the end of the data block to the computer.

The cb_replen field specifies the length in bytes of the cb_reply field. If set to zero, thecb_reply string is not used. The cb_replen field is initially set to zero.

The cb_reply array contains a string to be sent out after receipt of the alert character, but before thesecond trigger character is sent by the computer. Any character can be included in the reply string. Thenumber of characters sent is specified by cb_replen . The initial value of all characters in thecb_reply array is NULL.

RETURN VALUEIf an error occurs, all calls return a value of −1 and errno is set to indicate the error. If no error isdetected, blread() returns the number of characters read. All other calls return 0 upon successfulcompletion.

During a read, it is possible for the user’s buffer to be altered, even if an error value is returned. Thedata in the user’s buffer should be ignored as it is not complete. The following errors can be returned bythe library calls indicated:

Section 3−−50 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A bA

blmode(3C) blmode(3C)(OBSOLETED in Itanium(R)-based Systems)

blopen()[ENOTTY] The file descriptor specified is not related to a terminal device.

blclose()[ENOTTY] No previous blopen has been issued for the specified file descriptor.

blread()[EDEADLK] A resource deadlock would occur as a result of this operation (see lockf (2)).

[EFAULT] buf points outside the allocated address space. The reliable detection of this erroris implementation dependent.

[EINTR] A signal was caught during the read system call.

[EIO] An I/O error occurred during block-mode data transmissions.

[ENOTTY] No previous blopen has been issued for the specified file descriptor.

blget()[ENOTTY] No previous blopen has been issued for the specified file descriptor.

blset()[EINVAL] An illegal value was specified in the structure passed to the system.

[ENOTTY] No previous blopen has been issued for the specified file descriptor.

WARNINGSblopen() , blclose() , blread() , blget() and blset() are not thread-safe.

Once blopen has been called with a file descriptor and returned successfully, that file descriptor shouldnot subsequently be used as a parameter to the following system calls: close() , dup() , dup2() ,fcntl() , ioctl() , read() , or select() until a blclose is called with the same file descriptor asits parameter. Additionally, scanf() , fscanf() , getc() , getchar() , fgetc() , and fgetw()should not be called for a stream associated with a file descriptor that has been used in a blopen() callbut has not been used in a blclose() call. These functions call read() , and calling these routinesresults in unpredictable behavior.

Obsolescent Interfacesblopen() , blclose() , blread() , blget() , and blset() are obsoleted in Itanium-based systemsand will be obsoleted in future PA-RISC release streams. Use X-Open curses APIs instead.

AUTHORblopen() , blclose() , blread() , blget() , and blset() were developed by HP.

SEE ALSOtermio(7).

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−51

A bA

border(3X) border(3X)(ENHANCED CURSES)

NAMEborder, wborder — draw borders from single-byte characters and renditions

SYNOPSIS#include <curses.h>

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);

DESCRIPTIONThe border() and wborder() functions draw a border around the edges of the current or specifiedwindow. These functions do not advance the cursor position. These functions do not perform specialcharacter processing. These functions do not perform wrapping.

The arguments in the left-hand column of the following table contain single-byte characters with rendi-tions, which have the following uses in drawing the border:

Argument DefaultName Usage Value

ls Starting-column side ACS_VLINErs Ending-column side ACS_VLINEts First-line side ACS_HLINEbs Last-line side ACS_HLINEtl Corner of the first line and the starting column ACS_ULCORNERtr Corner of the first line and the ending column ACS_URCORNERbl Corner of the last line and the starting column ACS_BLCORNERbr Corner of the last line and the ending column ACS_BRCORNER

If the value of any argument in the left-hand column is 0, then the default value in the right-hand columnis used. If the value of any argument in the left-hand column is a multi-column character, the results areundefined.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOborder_set(3X), box(3X), hline(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−52 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

border_set(3X) border_set(3X)(ENHANCED CURSES)

NAMEborder_set, wborder_set — draw borders from complex characters and renditions

SYNOPSIS#include <curses.h>

int border_set(const cchar_t * ls, const cchar_t * rs, const cchar_t * ts,const cchar_t * bs, const cchar_t * tl, const cchar_t * tr,const cchar_t * bl, const cchar_t * br);

int wborder_set(WINDOW * win, const cchar_t * ls, const cchar_t * rs,const cchar_t * ts, const cchar_t * bs,const cchar_t * tl, const cchar_t * tr,const cchar_t * bl, const cchar_t * br);

DESCRIPTIONThe border_set() and wborder_set() functions draw a border around the edges of the current orspecified window. These functions do not advance the cursor position. These functions do not performspecial character processing. These functions do not perform wrapping.

The arguments in the left-hand column of the following table contain spacing complex characters withrenditions, which have the following uses in drawing the border:

Argument DefaultName Usage Value

ls Starting-column side WACS_VLINErs Ending-column side WACS_VLINEts First-line side WACS_HLINEbs Last-line side WACS_HLINEtl Corner of the first line and the starting column WACS_ULCORNERtr Corner of the first line and the ending column WACS_URCORNERbl Corner of the last line and the starting column WACS_BLCORNERbr Corner of the last line and the ending column WACS_BRCORNER

If the value of any argument in the left-hand column is a null pointer, then the default value in theright-hand column is used. If the value of any argument in the left-hand column is a multi-column char-acter, the results are undefined.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSObox_set(3X), hline_set(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−53

A bA

box(3X) box(3X)(CURSES)

NAMEbox — draw borders from single-byte characters and renditions

SYNOPSIS#include <curses.h>

int box(WINDOW * win, chtype verch, chtype horch);

DESCRIPTIONThe box() function draws a border around the edges of the specified window. This function does notadvance the cursor position. This function does not perform special character processing. This functiondoes not perform wrapping.

The function box( win, verch, horch) has an effect equivalent to:

wborder( win, verch, verch, horch, horch, 0, 0, 0, 0);

RETURN VALUEUpon successful completion, box() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOborder(3X), box_set(3X), hline(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The DESCRIPTION is changed to describe this function in terms of a call to the wborder() function.

Section 3−−54 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

box_set(3X) box_set(3X)(ENHANCED CURSES)

NAMEbox_set — draw borders from complex characters and renditions

SYNOPSIS#include <curses.h>

int box_set(WINDOW * win, const cchar_t * verch, const cchar_t * horch);

DESCRIPTIONThe box_set() function draws a border around the edges of the specified window. This function doesnot advance the cursor position. This function does not perform special character processing. This func-tion does not perform wrapping.

The function box_set( win, verch, horch) has an effect equivalent to:

wborder_set( win, verch, verch, horch, horch, NULL, NULL, NULL, NULL);

RETURN VALUEUpon successful completion, this function returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOborder_set(3X), hline_set(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−55

A bA

bsdproc(3C) bsdproc(3C)

NAMEkillpg, getpgrp, setpgrp, sigvec, signal - 4.2 BSD-compatible process control facilities

SYNOPSIS#include <signal.h>

int killpg(int pgrp, int sig);

int getpgrp(int pid);

int setpgrp(int pid, int pgrp);

The following is now longer supported. See remarks below.

int sigvec(int sig,struct sigvec *vec,struct sigvec *ovec

);

void (*signal(int sig, void (*func)(int)))(int);

DESCRIPTIONThese calls simulate (and are provided for backward compatibility with) functions of the same name inthe 4.2 Berkeley Software Distribution.

This version of setpgrp() is equivalent to the system call setpgid( pid , pgrp ) (see setpgid (2)).

This version of getpgrp() is equivalent to the system call getpgrp2( pid ) (see getpid (2)).

killpg() is equivalent to the system call kill(- pgrp , sig) (see kill (2)).

The function sigvec() is no longer supported. Please see the manual page for sigaction (2).

This version of signal() has the same effect as sigvec( sig, vec , ovec ) , where vec−>sv_handler isequal to func , vec−>sv_mask is equal to 0, and vec−>sv_flags is equal to 0. signal() returns thevalue that would be stored in ovec−>sv_handler if the equivalent sigvec() call would have succeeded.Otherwise, signal() returns −1 and errno is set to indicate the reason as it would have been set bythe equivalent call to sigvec().

For applications that use BSD signal, it is recommended that they use sigaction(2). The system supportsan alternative with similar behavior to Berkeley Software Distribution, and the API is bsd_signal butits use is not recommended.

WARNINGSWhile the 4.3 BSD release defined extensions to some of the interfaces described here, only the 4.2 BSDinterfaces are emulated by this package.

bsdproc() should not be used in conjunction with the facilities described under sigset (3C).

APPLICATION USAGEThreads Considerations

The signal disposition (such as catch/ignore/default) established by sigvec() and signal() isshared by all threads in the process.

For more information regarding signals and threads, refer to signal (5).

AUTHORbsdproc() was developed by HP and the University of California, Berkeley.

SEE ALSOld(1), kill(2), getpid(2), msgsnd(2), msgrcv(2), read(2), semop(2), setpgid(2), setsid(2), sigvector(2), wait(2),write(2), sigaction(2) sigset(3C), sigstack(2), bsd_signal(3C), signal(5).

Section 3−−56 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bsd_signal(3C) bsd_signal(3C)(TO BE OBSOLETED)

NAMEbsd_signal - simplified signal facilities

SYNOPSIS#include <signal.h>

void (*bsd_signal(int sig, void (*func)(int)))(int);

DESCRIPTIONThe bsd_signal() function provides a partially compatible interface for programs written to historicalsystem interfaces (see APPLICATION USAGE below).

The function call bsd_signal(sig,func) has an effect as if implemented as:

void (*bsd_signal(int sig, void (*func)(int)))(int){

struct sigaction act, oact;

act.sa_handler = func;act.sa_flags = SA_RESTART;sigemptyset(&act.sa_mask);sigaddset(&act.sa_mask, sig);if (sigaction(sig, &act, &oact) == -1)

return(SIG_ERR);return(oact.sa_handler);

}

The handler function should be declared:

void handler(int sig);

where sig is the signal number. The behaviour is undefined if func is a function that takes more than oneargument, or an argument of a different type.

RETURN VALUEUpon successful completion, bsd_signal() returns the previous action for sig . Otherwise, [SIG_ERR]is returned and errno is set to indicate the error.

ERRORSRefer to sigaction() .

APPLICATION USAGEThis function is a direct replacement for the BSD signal() function for simple applications that areinstalling a single-argument signal handler function. If a BSD signal handler function is being installedthat expects more than one argument, the application has to be modified to use sigaction() . Thebsd_signal() function differs from signal() in that the SA_RESTARTflag is set and theSA_RESETHANDwill be clear when bsd_signal() is used. The state of these flags is not specified forsignal() .

WARNINGSObsolescent Interfaces

bsd_signal() is to be obsoleted at a future date.

SEE ALSOsigaction(2), sigaddset(3C), sigemptyset(3C), signal(2), <signal.h>.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−57

A bA

bsearch(3C) bsearch(3C)

NAMEbsearch( ) - binary search a sorted table

SYNOPSIS#include <stdlib.h>

void *bsearch(const void *key,const void *base,size_t nel,size_t size,int (*compar)(const void *, const void *)

);

DESCRIPTIONbsearch() is a binary search routine generalized from Knuth (6.2.1) Algorithm B. It returns a pointerinto a table indicating where a datum may be found. The table must be previously sorted in increasingorder according to a provided comparison function. key points to a datum instance to be sought in thetable. base points to the element at the base of the table. nel is the number of elements in the table. sizeis the size of each element in the table. compar is the name of the comparison function, which is calledwith two arguments that point to the elements being compared. The function must return an integer lessthan, equal to, or greater than zero indicating that the first argument (the key) is to be considered lessthan, equal to, or greater than the second argument (the array element).

NOTESThe pointers to the key and the element at the base of the table should be of type pointer-to-element, andcast to type pointer-to-void.

The comparison function need not compare every byte, so arbitrary data can be contained in the elementsin addition to the values being compared.

Although declared as type pointer-to-void, the value returned should be cast into type pointer-to-element.

RETURN VALUEA NULL pointer is returned if the key cannot be found in the table.

EXAMPLESThe example below searches a table containing pointers to nodes consisting of a string and its length.The table is ordered alphabetically on the string in the node pointed to by each entry.

This code fragment reads in strings and either finds the corresponding node and prints out the string andits length, or prints an error message.

#include <stdio.h>#include <stdlib.h>#include <string.h>

#define TABSIZE 1000

struct node { /* these are stored in the table */char *string;int length;

};struct node table[TABSIZE]; /* table to be searched */

.

.

.{

struct node *node_ptr, node;/* routine to compare 2 nodes */int node_compare(const void *, const void *);char str_space[20]; /* space to read string into */...

Section 3−−58 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bsearch(3C) bsearch(3C)

node.string = str_space;while (scanf("%s", node.string) != EOF) {

node_ptr = (struct node *)bsearch((void *)(&node),(void *)table, TABSIZE,sizeof(struct node), node_compare);

if (node_ptr != NULL) {(void)printf("string = %20s, length = %d\n",

node_ptr->string, node_ptr->length);} else {

(void)printf("not found: %s\n", node.string);}

}}

/* This routine compares two nodes based on analphabetical ordering of the string field.

*/intnode_compare(const void *node1, const void *node2)struct node *node1, *node2;{

return strcoll(((const struct node *)node1)->string,((const struct node *)node2)->string);

}

WARNINGSIf the table being searched contains two or more entries that match the selection criteria, a random entryis returned by bsearch() as determined by the search algorithm.

SEE ALSOhsearch(3C), lsearch(3C), qsort(3C), tsearch(3C), thread_safety(5).

STANDARDS CONFORMANCEbsearch() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−59

A bA

btowc(3C) btowc(3C)

NAMEbtowc( ), wctob( ) - conversion between single-byte and wide-character

SYNOPSIS#include <stdio.h>#include <wchar.h>

wint_t btowc(int c);

int wctob(wint_t c);

DESCRIPTIONbtowc() The btowc() function determines whether c constitutes a valid (one-byte) character in

the initial shift state.

wctob() The wctob() function determines whether c corresponds to a member of the extendedcharacter set whose character representation is a single byte when in the initial shiftstate.

EXTERNAL INFLUENCESlocale

The behavior of these functions is affected by the LC_CTYPEcategory.

RETURN VALUEThe btowc() function returns WEOFif c has the value EOFor if c as an unsigned character does not con-stitute a valid (one-byte) character in the initial shift state. Otherwise, it returns the wide-characterrepresentation of that character.

The wctob() function returns EOFif c does not correspond to a character with length one in the initialshift state. Otherwise, it returns the single-byte representation of that character.

ERRORSNo errors are defined.

AUTHORbtowc() was developed by HP and Mitsubishi Electric Corp.

SEE ALSOthread_safety(5).

Section 3−−60 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bufsplit(3G) bufsplit(3G)

NAMEbufsplit() - split buffer into fields

SYNOPSIS#include <libgen.h>

size_t bufsplit(char * buf , size_t n, char ** a);

DESCRIPTIONbufsplit examines the buffer, buf , and assigns values to the pointer array, a , so that the pointers pointto the first n fields in buf that are delimited by tabs or new-lines.

To change the characters used to separate fields, call bufsplit with buf pointing to the string of charac-ters, and n and a set to zero. For example, to use ’: ’, ’. ’, and ’, ’ as separators along with tab and new-line:

bufsplit(":.,\t\n", 0, (char ∗∗)0);

RETURN VALUEThe number of fields assigned in the array a . If buf is zero, the return value is zero and the array isunchanged. Otherwise the value is at least one. The remainder of the elements in the array are assignedthe address of the null byte at the end of the buffer.

EXAMPLES/*

∗ set a[0] = "This", a[1] = "is", a[2] = "a",∗ a[3] = "test"*/

bufsplit("This\tis\ta\ttest\n", 4, a);

WARNINGSbufsplit changes the delimiters to null bytes in buf .

SEE ALSOthread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−61

A bA

bwtmps(3C) bwtmps(3C)

NAMEbwtmps: bwtmpname(), updatebwdb(), getbwent(), setbwent(), endbwent() - access and update routinesfor the wtmps and btmps databases

SYNOPSIS#include <utmps.h>

void bwtmpname(char *file);

int updatebwdb(struct utmps *utmps, size_t size);

struct utmps * getbwent(size_t size);

void setbwent(void);

void endbwent(void);

DESCRIPTIONgetbwent() returns a pointer to a utmps structure. The key members of utmps structure are :

char ut_user[] User login namechar ut_id[] Unique Id to distinguish an entrychar ut_line[] Device namepid_t ut_pid Process Idshort ut_type Type of Entrystruct ut_exit The exit status of a processstruct timeval ut_tv Time entry was madechar ut_host[] Host name, if remoteuint8_t ut_addr[] Internet Address of the Host,

if remoteshort ut_addr_type Flag to identify type of address

in ut_addr

RoutinesThe following routines are provided:

bwtmpname() Allows the user to set the database being examined to either WTMPS_FILEorBTMPS_FILE. bwtmpname() does not open the database -- it merely closesthe old file if it is currently open, and saves the new file name. WTMPS_FILEand BTMPS_FILE are macros defined in <utmps.h> header file, which refer to/var/adm/wtmps and /var/adm/btmps files respectively .

getbwent() Reads in the next entry from either WTMPS_FILEor BTMPS_FILE dependingon the previous call to bwtmpname() . If the database is not already open,getbwent() opens it. If it reaches end of file, getbwent() fails.

updatebwdb() Appends the utmps structure pointed to by utmps to either BTMPS_FILE orWTMPS_FILEas set by the previous call to bwtmpname() .

setbwent() Resets the requests for getbwent() to begin from the start of the database, asspecified by a previous call to bwtmpname() .

endbwent() Closes the handle of the currently open database.

RETURN VALUEgetbwent() returns pointer to structure of type struct utmps on success. If size is not one of thesupported utmps structure sizes , getbwent() returns NULL and sets errno to [EINVAL]. On reach-ing end of database, getbwent returns NULL.

updatebwdb() returns 0 if append to the database is successful. updatebwdb() returns -1 on failureto append to database.

ERRORS[EINVAL] The size parameter passed to the bwtmps (3C) functions does not match any of the

utmps structure sizes supported .

WARNINGSApplications should not access the wtmps and btmps databases directly, but should use these functionsas the structure written to these databases is a superset of the utmps structure. updatebwdb() does

Section 3−−62 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A bA

bwtmps(3C) bwtmps(3C)

not update /var/adm/wtmp and /var/adm/btmp files.

bwtmps (3C) interfaces load shared library libuseracct.so.1/libuseracct.1 .

Compile/link for Archive Applications (PA-RISC only)If you use bwtmps (3C) interfaces and compile/link your application archive, please note that bwtmps (3C)interfaces have a dependency on libdld.sl that will require a change to the compile/link command:

Compile :

cc -Wl,-a,archive -Wl,-E -Wl,+n -l:libdld.sl -o outfile source

Or compile with CCOPTSand LDOPTS:

export CCOPTS="-Wl,-a,archive options -Wl,-E -l:libdld.sl"

export LDOPTS="options -E +n -l:libdld.sl"

cc -o outfile source

The option -Wl,-a,archive is positionally dependent and should occur at the beginning of the com-pile line. For optimum compatibility in future releases, you should avoid using archive libc with othershared libraries except for libdld.sl as needed above.

AUTHORThe bwtmps routines were developed by Hewlett-Packard Company.

FILES/var/adm/wtmps/var/adm/btmps

SEE ALSOgetuts(3C), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−63

A bA

byteorder(3N) byteorder(3N)

NAMEhtonl( ), htons( ), ntohl( ), ntohs( ) - convert values between host and network byte order

SYNOPSIS#include <netinet/in.h>

_XOPEN_SOURCE_EXTENDED only#include <arpa/inet.h>

unsigned long htonl(unsigned long hostlong);

unsigned short htons(unsigned short hostshort);

unsigned long ntohl(unsigned long netlong);

unsigned short ntohs(unsigned short netshort);

DESCRIPTIONThese routines convert 16- and 32-bit quantities between network byte order and host byte order. OnHP-UX systems, network and host byte orders are identical, so these routines are defined as null macrosin the include file <netinet/in.h> . If _XOPEN_SOURCE_EXTENDEDis defined then these routinesare defined in the include file <arpa/inet.h> .

These routines are most often used in conjunction with Internet addresses and ports as returned bygethostent() and getservent() (see gethostent (3N) and getservent (3N)). Use these routines towrite portable programs.

AUTHORbyteorder() was developed by the University of California, Berkeley.

SEE ALSOgethostent(3N), getservent(3N).

STANDARDS CONFORMANCEbyteorder() : XPG4

Section 3−−64 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cabs(3M) cabs(3M)(Itanium(R)-based System Only)

NAMEcabs( ), cabsf( ), cabsl( ), cabsw( ), cabsq( ) - complex absolute value (also called norm, modulus, or magni-tude) functions

SYNOPSIS#include <complex.h>

double cabs(double complex z);

float cabsf(float complex z);

long double cabsl(long double complex z);

extended cabsw(extended complex z);

quad cabsq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cabs() returns the complex absolute value of z.

cabsf() is a float complex version of cabs() ; it takes a float complex argument and returns afloat result.

cabsl() is a long double complex version of cabs() ; it takes a long double complex argu-ment and returns a long double result.

cabsw() is an extended complex version of cabs() ; it takes an extended complex argumentand returns an extended result.

cabsq() is equivalent to cabsl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cabsw() or cabsq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcabs(z) returns the same values and raises the same floating-point exceptions ashypot(creal(z),cimag(z)) . If the +Onocxlimitedrange compiler option (default for HP’sC/C++) is not in effect, then cabs() may be computed with a simpler formula that does not match thespecification for extreme values.

ERRORSNo errors are defined.

SEE ALSOfabs(3M), carg(3M), complex(5), hypot(3M).

STANDARDS CONFORMANCEcabs() , cabsf() , cabsl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−65

A cA

cacos(3M) cacos(3M)(Itanium(R)-based System Only)

NAMEcacos( ), cacosf( ), cacosl( ), cacosw( ), cacosq( ) - complex arccosine functions

SYNOPSIS#include <complex.h>

double complex cacos(double complex z);

float complex cacosf(float complex z);

long double complex cacosl(long double complex z);

extended complex cacosw(extended complex z);

quad complex cacosq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cacos() returns the complex arccosine of z, in the range of a strip mathematically unbounded along theimaginary axis and in the interval [0,Pi] along the real axis.

Branch cuts are outside the interval [-1,+1] along the real axis.

cacosf() is a float complex version of cacos() ; it takes a float complex argument andreturns a float complex result.

cacosl() is a long double complex cacos() ; it takes a long double complex argument andreturns a long double complex result.

cacosw() is an extended complex version of cacos() ; it takes an extended complex argumentand returns an extended complex result.

cacosq() is equivalent to cacosl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cacosw() or cacosq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> , and link in themath library by specifying -lm on the compiler or linker command line.

RETURN VALUEcacos( conj(z)) = conj(cacos( z) )

cacos( ±0+i0) returns Pi/2-i0.

cacos( ±0+iNaN) returns Pi/2+iNaN.

cacos( x+iInf) returns Pi/2-iInf, for finite x.

cacos( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, fornonzero finite x.

cacos( -Inf+iy) returns Pi-iInf, for positive-signed finite y.

cacos( +Inf+iy) returns +0-iInf, for positive-signed finite y.

cacos( -Inf+iInf) returns 3Pi/4-iInf.

cacos( +Inf+iInf) returns Pi/4-iInf.

cacos( ±Inf+iNaN) returns NaN±iInf (where the sign of the imaginary part of the result is unspecified).

cacos( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitey.

cacos( NaN+iInf) returns NaN-iInf.

cacos( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

Section 3−−66 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cacos(3M) cacos(3M)(Itanium(R)-based System Only)

SEE ALSOacos(3M), ccos(3M), complex(5).

STANDARDS CONFORMANCEcacos() , cacosf() , cacosl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−67

A cA

cacosh(3M) cacosh(3M)(Itanium(R)-based System Only)

NAMEcacosh( ), cacoshf( ), cacoshl( ), cacoshw( ), cacoshq( ) - complex arc hyperbolic cosine functions

SYNOPSIS#include <complex.h>

double complex cacosh(double complex z);

float complex cacoshf(float complex z);

long double complex cacoshl(long double complex z);

extended complex cacoshw(extended complex z);

quad complex cacoshq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cacosh() returns the complex arc hyperbolic cosine of z, in the range of a half-strip of non-negativevalues along the real axis and in the interval [-iPi,iPi] along the imaginary axis. There is a branch cut atvalues less than 1 along the real axis.

cacoshf() is a float complex version of cacosh() ; it takes a float complex argument andreturns a float complex result.

cacoshl() is a long double complex version of cacosh() ; it takes a long double complexargument and returns a long double complex result.

cacoshw() is an extended complex version of cacosh() ; it takes an extended complex argu-ment and returns an extended complex result.

cacoshq() is equivalent to cacoshl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cacoshw() or cacoshq() , com-pile with the -fpwidetypes option. Make sure your program includes <complex.h> . Link in themath library by specifying -lm on the compiler or linker command line.

RETURN VALUEcacosh( conj(z)) = conj(cacosh( z) )

cacosh( ±0+i0) returns +0+iPi/2.

cacosh( x+iInf) returns +Inf+iPi/2, for finite x.

cacosh( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, forfinite x.

cacosh( -Inf+iy) returns +Inf+iPi, for positive-signed finite y.

cacosh( +Inf+iy) returns +Inf+i0, for positive-signed finite y.

cacosh( -Inf+iInf) returns +Inf+i3Pi/4.

cacosh( +Inf+iInf) returns +Inf+iPi/4.

cacosh( ±Inf+iNaN) returns +Inf+iNaN.

cacosh( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, forfinite y.

cacosh( NaN+iInf) returns +Inf+iNaN.

cacosh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOacosh(3M), ccosh(3M), complex(5).

Section 3−−68 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cacosh(3M) cacosh(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEcacosh() , cacoshf() , cacoshl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible com-plex arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−69

A cA

can_change_color(3X) can_change_color(3X)(ENHANCED CURSES)

NAMEcan_change_color, color_content, has_colors, init_color, init_pair, start_color, pair_content — color mani-pulation functions

SYNOPSIS#include <curses.h>

bool can_change_color(void);

int color_content(short color, short * red, short * green, short * blue);

int COLOR_PAIR(int n);

bool has_colors(void);

int init_color(short color, short red, short green, short blue);

int init_pair(short pair, short f, short b);

int pair_content(short pair, short * f, short * b);

int PAIR_NUMBER(int value);

int start_color(void);

extern int COLOR_PAIRS;

extern int COLORS;

DESCRIPTIONThese functions manipulate colour on terminals that support colour.

Querying CapabilitiesThe has_colors() function indicates whether the terminal is a colour terminal. Thecan_change_color() function indicates whether the terminal is a colour terminal on which colourscan be redefined.

InitialisationThe start_color() function must be called in order to enable use of colours and before any colourmanipulation function is called. The function initialises eight basic colours (black, blue, green, cyan, red,magenta, yellow, and white) that can be specified by the colour macros (such as COLOR_BLACK) definedin <curses.h> . (See Colour-related Macros in <curses.h> .) The initial appearance of these eightcolours is not specified.

The function also initialises two global external variables:

• COLORSdefines the number of colours that the terminal supports. (See Colour Identificationbelow.) If COLORS is 0, the terminal does not support redefinition of colours (andcan_change_colour() will return FALSE).

• COLOR_PAIRSdefines the maximum number of colour-pairs that the terminal supports. (SeeUser-Defined Colour Pairs below.)

The start_color() function also restores the colours on the terminal to terminal-specific initialvalues. The initial background colour is assumed to be black for all terminals.

Colour IdentificationThe init_color() function redefines colour number color, on terminals that support the redefinitionof colours, to have the red, green, and blue intensity components specified by red, green, and blue, respec-tively. Calling init_color() also changes all occurrences of the specified colour on the screen to thenew definition.

The color_content() function identifies the intensity components of colour number color. It storesthe red, green, and blue intensity components of this colour in the addresses pointed to by red, green, andblue, respectively.

For both functions, the color argument must be in the range from 0 to and including COLORS− 1. Validintensity values range from 0 (no intensity component) up to and including 1000 (maximum intensity inthat component).

Section 3−−70 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

can_change_color(3X) can_change_color(3X)(ENHANCED CURSES)

User-Defined Colour PairsCalling init_pair() defines or redefines colour-pair number pair to have foreground colour f andbackground colour b. Calling init_pair() changes any characters that were displayed in the colourpair’s old definition to the new definition and refreshes the screen.

After defining the colour pair, the macro COLOR_PAIR(n) returns the value of colour pair n. This valueis the colour attribute as it would be extracted from a chtype . Conversely, the macroPAIR_NUMBER(value) returns the colour pair number associated with the colour attribute value.

The pair_content() function retrieves the component colours of a colour-pair number pair. It storesthe foreground and background colour numbers in the variables pointed to by f and b, respectively.

With init_pair() and pair_content() , the value of pair must be in a range from 0 to and includ-ing COLOR_PAIRS− 1. (There may be an implementation-specific lower limit on the valid value of pair,but any such limit is at least 63.) Valid values for f and b are the range from 0 to and includingCOLORS− 1.

RETURN VALUEThe has_colors() function returns TRUE if the terminal can manipulate colors; otherwise, it returnsFALSE.

The can_change_color() function returns TRUE if the terminal supports colors and can changetheir definitions; otherwise, it returns FALSE.

Upon successful completion, the other functions return OK; otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGETo use these functions, start_color() must be called, usually right after initscr() .

The can_change_color() and has_colors() functions facilitate writing terminal-independentprograms. For example, a programmer can use them to decide whether to use colour or some other videoattribute.

On color terminals, a typical value of COLORSis 8 and the macros such as COLOR_BLACKreturn a valuewithin the range from 0 to and including 7. However, applications cannot rely on this to be true.

SEE ALSOattroff(3X), delscreen(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−71

A cA

carg(3M) carg(3M)(Itanium(R)-based System Only)

NAMEcarg( ), cargf( ), cargl( ), cargw( ), cargq( ) - complex argument (also called phase angle) functions

SYNOPSIS#include <complex.h>

double carg(double complex z);

float cargf(float complex z);

long double cargl(long double complex z);

extended cargw(extended complex z);

quad cargq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

carg() returns the complex argument of z in the interval [-pi,+pi].

cargf() is a float complex version of carg() ; it takes a float complex argument and returns afloat result.

cargl() is a long double complex version of carg() ; it takes a long double complex argu-ment and returns a long double result.

cargw() is an extended complex version of carg() ; it takes an extended complex argumentand returns an extended result.

cargq() is equivalent to cargl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cargw() or cargq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcarg( z) returns the same values and raises the same exceptions as atan2(cimag( z),creal( z)) .

ERRORSNo errors are defined.

SEE ALSOatan2(3M), cabs(3M), complex(5).

STANDARDS CONFORMANCEcarg() , cargf() , cargl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

Section 3−−72 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

casin(3M) casin(3M)(Itanium(R)-based System Only)

NAMEcasin( ), casinf( ), casinl( ), casinw( ), casinq( ) - complex arcsine functions

SYNOPSIS#include <complex.h>

double complex casin(double complex z);

float complex casinf(float complex z);

long double complex casinl(long double complex z);

extended complex casinw(extended complex z);

quad complex casinq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

casin() returns the complex arcsine of z, in the range of a strip mathematically unbounded along theimaginary axis and in the interval [-Pi/2,+Pi/2] along the real axis. Branch cuts are outside the interval[-1,+1] along the real axis.

casinf() is a float complex version of casin() ; it takes a float complex argument andreturns a float complex result.

casinl() is a long double complex version of casin() ; it takes a long double complex argu-ment and returns a long double complex result.

casinw() is an extended complex version of casin() ; it takes an extended complex argumentand returns an extended complex result.

casinq() is equivalent to casinl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use casinw() or casinq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcasin( conj(z)) = conj(casin( z) ) and casinh is an odd function.

casin( +0+i0) returns 0+i0.

casin( Inf+iy) returns Pi/2+iInf for positive-signed finite y.

casin( NaN+iy) returns NaN+iNaN and may raise the invalid exception for finite y.

casin( x+iInf) returns +0+iInf for positive-signed finite x.

casin( +Inf+iInf) returns Pi/4+iInf.

casin( NaN+iInf) returns NaN+iInf.

casin( +0+iNaN) returns +0+iNaN.

casin( x+iNaN) returns NaN+iNaN and may raise the invalid exception for finite nonzero x.

casin( Inf+iNaN) returns NaN±iInf (where the sign of the imaginary part of the result is unspecified).

casin( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOasin(3M), asinh(3M), csin(3M), complex(5).

STANDARDS CONFORMANCEcasin() , casinf() , casinl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−73

A cA

casinh(3M) casinh(3M)(Itanium(R)-based System Only)

NAMEcasinh( ), casinhf( ), casinhl( ), casinhw( ), casinhq( ) - complex arc hyperbolic sine functions

SYNOPSIS#include <complex.h>

double complex casinh(double complex z);

float complex casinhf(float complex z);

long double complex casinhl(long double complex z);

extended complex casinhw(extended complex z);

quad complex casinhq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

casinh() returns the complex arc hyperbolic sine of z, in the range of a strip mathematicallyunbounded along the real axis and in the interval [-i*Pi/2,+i*Pi/2] along the imaginary axis. Branch cutsare outside the interval [-i,+i] along the imaginary axis.

casinhf() is a float complex version of casinh() ; it takes a float complex argument andreturns a float complex result.

casinhl() is a long double complex version of casinh() ; it takes a long double complexargument and returns a long double complex result.

casinhw() is an extended complex version of casinh() ; it takes an extended complex argu-ment and returns an extended complex result.

casinhq() is equivalent to casinhl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use casinhw() or casinhq() , com-pile with the -fpwidetypes option. Make sure your program includes <complex.h> . Link in themath library by specifying -lm on the compiler or linker command line.

RETURN VALUEcasinh( conj(z)) = conj(casinh( z) ) and casinh is an odd function.

casinh( +0+i0) returns 0+i0.

casinh( x+iInf) returns +Inf+iPi/2 for positive-signed finite x.

casinh( x+iNaN) returns NaN+iNaN and may raise the invalid exception for finite x.

casinh( +Inf+iy) returns +Inf+i0 for positive-signed finite y.

casinh( +Inf+iInf) returns +Inf+iPi/4.

casinh( +Inf+iNaN) returns +Inf+iNaN.

casinh( NaN+i0) returns NaN+i0.

casinh( NaN+iy) returns NaN+iNaN and may raise the invalid exception for finite nonzero y.

casinh( NaN+iInf) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified).

casinh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOcsinh(3M), complex(5).

STANDARDS CONFORMANCEcasinh() , casinhf() , casinhl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible com-plex arithmetic’’)

Section 3−−74 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

catan(3M) catan(3M)(Itanium(R)-based System Only)

NAMEcatan( ), catanf( ), catanl( ), catanw( ), catanq( ) - complex arctangent functions

SYNOPSIS#include <complex.h>

double complex catan(double complex z);

float complex catanf(float complex z);

long double complex catanl(long double complex z);

extended complex catanw(extended complex z);

quad complex catanq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

catan() returns the complex arctangent of z, in the range of a strip mathematically unbounded alongthe imaginary axis and in the interval [-Pi/2,+Pi/2] along the real axis. Branch cuts are outside the inter-val [-1,+1] along the imaginary axis.

catanf() is a float complex version of catan() ; it takes a float complex argument andreturns a float complex result.

catanl() is a long double complex version of catan() ; it takes a long double complex argu-ment and returns a long double complex result.

catanw() is an extended complex version of catan() ; it takes an extended complex argumentand returns an extended complex result.

catanq() is equivalent to catanl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use catanw() or catanq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h>. Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcatan( conj(z)) = conj(catan( z) ) and catan is odd.

catan( +0+i0) returns +0+i0.

catan( +NaN+i0) returns +NaN+i0.

catan( +0+i1) returns +0+iInf and raises the divide-by-zero floating-point exception.

catan( Inf+iy) returns Pi/2+i0, for finite positive-signed y.

catan( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, fornonzero finite y.

catan( +x+iInf) returns Pi/2+i0, for finite positive-signed x.

catan( +Inf+iInf) returns Pi/2+i0.

catan( +NaN+iInf) returns +NaN+i0.

catan( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitex.

catan( Inf+iNaN) returns Pi/2±i0 (where the sign of the imaginary part of the result is unspecified).

catan( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOatan(3M), ctan(3M), complex(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−75

A cA

catan(3M) catan(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEcatan() , catanf() , catanl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

Section 3−−76 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

catanh(3M) catanh(3M)(Itanium(R)-based System Only)

NAMEcatanh( ), catanhf( ), catanhl( ), catanhw( ), catanhq( ) - complex arc hyperbolic tangent functions

SYNOPSIS#include <complex.h>

double complex catanh(double complex z);

float complex catanhf(float complex z);

long double complex catanhl(long double complex z);

extended complex catanhw(extended complex z);

quad complex catanhq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

catanh() returns the complex arc hyperbolic tangent of z, in the range of a strip mathematicallyunbounded along the real axis and in the interval [-iπ/2,iπ/2] along the imaginary axis. Branch cuts areoutside the interval [-1,+1] along the real axis.

catanhf() is a float complex version of catanh() ; it takes a float complex argument andreturns a float complex result.

catanhl() is a long double complex version of catanh() ; it takes a long double complexargument and returns a long double complex result.

catanhw() is an extended complex version of catanh() ; it takes an extended complex argu-ment and returns an extended complex result.

catanhq() is equivalent to catanhl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use catanhw() or catanhq() , com-pile with the -fpwidetypes option. Make sure your program includes <complex.h> . Link in themath library by specifying -lm on the compiler or linker command line.

RETURN VALUEcatanh(conj( z)) = conj(catanh( z)) and catanh is odd.

catanh( +0+i0) returns +0+i0.

catanh( +0+iNaN) returns +0+iNaN.

catanh( +1+i0) returns +Inf+i0 and raises the divide-by-zero floating-point exception.

catanh( x+iInf) returns +0+iπ/2, for finite positive-signed x .

catanh( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, fornonzero finite x .

catanh( +Inf+iy) returns +0+iπ/2, for finite positive-signed y .

catanh( +Inf+iInf) returns +0+iπ/2.

catanh( +Inf+iNaN) returns +0+iNaN.

catanh( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, forfinite y .

catanh( NaN+iInf) returns ±0+iπ/2 (where the sign of the real part of the result is unspecified).

catanh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOatanh(3M), ctanh(3M), complex(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−77

A cA

catanh(3M) catanh(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEcatanh() , catanhf() , catanh() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible com-plex arithmetic’’)

Section 3−−78 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

catgets(3C) catgets(3C)

NAMEcatgets( ) - get a program message

SYNOPSIS#include <nl_types.h>

char *catgets(nl_catd catd,int set_num,int msg_num,const char *def_str

);

DESCRIPTIONThe catgets() function reads message msg_num in set set_num from the message catalog identifiedby catd , a catalog descriptor returned from a previous call to catopen() (see catopen (3C)). If the callfails, def_str points to a default message string returned by catgets() .

A message longer than NL_TEXTMAXbytes is truncated. The returned message string is always ter-minated with a null byte. NL_TEXTMAXis defined in <limits.h >.

EXTERNAL INFLUENCESInternational Code Set Support

Single- and multi-byte character code sets are supported.

RETURN VALUEIf the call is successful, catgets() returns a pointer to an internal buffer area containing the null-terminated message string. If the call is unsuccessful, catgets() returns a pointer to def_str .

ERRORScatgets() fails and sets errno under any of the following conditions:

[EBADF] catd is not a valid catalog descriptor.

[EINTR] A signal was caught during the read (2) system call.

[EINVAL] The message catalog identified by catd is corrupted.

[ENOMSG] The message identified by set_num or msg_numis not in the message catalog.

[ERANGE] A message longer than NL_TEXTMAXbytes was truncated.

WARNINGSThe catgets() function returns a pointer to a static area that is overwritten on each call.

AUTHORcatgets() was developed by HP.

FILES/usr/include/nl_types.h

SEE ALSOdumpmsg(1), findmsg(1), gencat(1), catclose(3C), catopen(3C), thread_safety(5).

STANDARDS CONFORMANCEcatgets() : AES, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−79

A cA

catopen(3C) catopen(3C)

NAMEcatopen( ), catclose( ) - open and close a message catalog for reading

SYNOPSIS#include <nl_types.h>

nl_catd catopen(const char *name, int oflag);

int catclose(nl_catd catd);

DESCRIPTIONThe catopen() function opens a message catalog and returns a catalog descriptor. The name specifiesthe name of the message catalog being opened. A name containing a slash (/ ) specifies a path name forthe message catalog. Otherwise, the environment variable NLSPATH is used (see environ (5)). IfNLSPATHspecifies more than one path, catopen() returns the catalog descriptor for the first path onwhich it is able to successfully open the specified message catalog. If NLSPATHdoes not exist in theenvironment, or if a message catalog cannot be opened for any NLSPATH-specified path, catopen()uses a system-wide default path. The default is affected by LC_MESSAGESif the value of oflag isNL_CAT_LOCALE. If the value of oflag is zero, the default is affected by the environment variableLANG. See environ (5) for details.

If catopen() is invoked from a setuid or setgid programs with owner root, the environment vari-able NLSPATHis not directly used to locate message catalogs. Instead, the paths which are availableboth in the configuration file /etc/default/nlspath and environment variable NLSPATHare con-sidered to locate message catalogs. See nlspath (4) for details.

Example: If the environment variable is set to:

NLSPATH=/usr/lib/nls/msg/%L/%N.cat:/tmp/%L/%N.cat

and the configuration file has an entry:

NLSPATH=/usr/lib/nls/msg/%L/%N.cat ,

only path /usr/lib/nls/msg/%L/%N.cat is considered for locating catalog files. This feature isprovided only for backward compatibility for those setuid or setgid root programs which are depend-ing on environment variable NLSPATH. All new setgid or setuid root programs should not dependon the environment variable NLSPATH, and use only absolute path names.

A message catalog descriptor remains valid in a process until the process closes it, or until a successfulcall to one of the exec() functions. A change in the setting of the LC_MESSAGEScategory may invali-date existing open catalogs.

If a file descriptor is used to implement message catalog descriptors, the FD_CLOEXECflag will be set.

If oflag is zero, the LANG environment variable is used to locate the catalog. If oflag isNL_CAT_LOCALE, the LC_MESSAGEScategory is used to locate the message catalog only if a successfulcall to setlocale() has been made prior to the call to catopen() . The result of setting oflag toany other value is undefined.

The catclose() function closes the message catalog catd , a message catalog descriptor returned froman earlier successful call to catopen() .

RETURN VALUEUpon success, catopen() returns a message catalog descriptor. Otherwise, catopen() returns avalue of (nl_catd ) − 1 and sets errno to indicate the error.

Upon success, catclose() returns zero. Otherwise, catclose() returns −1 and sets errno to indi-cate the error.

ERRORScatopen() fails without opening a message catalog, and sets errno for the last path attempted underany of the following conditions:

[EACCES] A component of the path prefix denies search permission, or read permis-sion is denied for the named file.

[EMFILE] The maximum number of file descriptors allowed are currently open.

[ENAMETOOLONG] The length of the specified path name exceeds PATH_MAXbytes, or thelength of a component of the path name exceeds NAME_MAXbytes while

Section 3−−80 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

catopen(3C) catopen(3C)

_POSIX_NO_TRUNCis in effect.

[ENFILE] The system file table is full.

[ENOENT] The named catalog does not exist or the path is null.

[ENOTDIR] A component of the path prefix is not a directory.

catgets() can be used to provide default messages when called following a failed catopen() (seecatgets (3C)). catgets() returns its def_str parameter if it is passed an invalid catalog descriptor.

catclose() fails if the following is true:

[EBADF] catd is not a valid open message catalog descriptor.

WARNINGSWhen using NLSPATH, catopen() does not provide a default value for LANG.

AUTHORcatopen() and catclose() were developed by HP.

FILES/usr/include/nl_types.h

/usr/lib/nls/msg Message catalog default path for core HP-UX products only.

SEE ALSOcatgets(3C), setlocale(3C), nlspath(4), environ(5), thread_safety(5).

STANDARDS CONFORMANCEcatopen() : AES, SVID3, XPG2, XPG3, XPG4

catclose() : AES, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−81

A cA

cbreak(3X) cbreak(3X)(CURSES)

NAMEcbreak, nocbreak, noraw, raw — input mode control functions

SYNOPSIS#include <curses.h>

int cbreak(void);

int nocbreak(void);

int noraw(void);

int raw(void);

DESCRIPTIONThe cbreak() function sets the input mode for the current terminal to cbreak mode and overrides a callto raw() .

The nocbreak() function sets the input mode for the current terminal to Cooked Mode without chang-ing the state of ISIG and IXON.

The noraw() function sets the input mode for the current terminal to Cooked Mode and sets the ISIGand IXON flags.

The raw() function sets the input mode for the current terminal to Raw Mode.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEIf the application is not certain what the input mode of the process was at the time it called initscr() ,it should use these functions to specify the desired input mode.

SEE ALSOcurses_intro(3X), subsection called Input Mode , <curses.h>.

X/Open System Interface Definitions, Issue 4, Version 2 specification, Chapter 9, General Terminal Inter-face .

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The raw() and noraw() functions are merged with this entry. In previous issues, they appeared inentries of their own.

The entry is rewritten for clarity. The argument list for all these functions is explicitly declared as void.

Section 3−−82 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cbrt(3M) cbrt(3M)

NAMEcbrt( ), cbrtf( ), cbrtl( ), cbrtw( ), cbrtq( ) - cube root functions

SYNOPSIS#include <math.h>

double cbrt(double x);

float cbrtf(float x);

Itanium(R)-based System Onlylong double cbrtl(long double x);

extended cbrtw(extended x);

quad cbrtq(quad x);

DESCRIPTIONcbrt() computes the cube root of x .

cbrtf() is a float version of cbrt() ; it takes a float argument and returns a float result.

Itanium-based System Onlycbrtl() is a long double version of cbrt() ; it takes a long double argument and returns along double result.

cbrtw() is an extended version of cbrt() ; it takes an extended argument and returns anextended result.

cbrtq() is equivalent to cbrtl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) cbrtw() or cbrtq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is ±INFINITY or ±zero, cbrt() returns x .

If x is NaN, cbrt() returns NaN.

cbrt() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSNo errors are defined.

SEE ALSOexp(3M), log(3M), pow(3M), sqrt(3M), math(5).

STANDARDS CONFORMANCEcbrt() : SVID3, XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

cbrtf() , cbrtl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−83

A cA

ccos(3M) ccos(3M)(Itanium(R)-based System Only)

NAMEccos( ), ccosf( ), ccosl( ), ccosw( ), ccosq( ) - complex cosine functions

SYNOPSIS#include <complex.h>

double complex ccos(double complex z);

float complex ccosf(float complex z);

long double complex ccosl(long double complex z);

extended complex ccosw(extended complex z);

quad complex ccosq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

ccos() returns the complex cosine of z.

ccosf() is a float complex version of ccos() ; it takes a float complex argument and returns afloat complex result.

ccosl() is a long double complex version of ccos() ; it takes a long double complex argu-ment and returns a long double complex result.

ccosw() is an extended complex version of ccos() ; it takes an extended complex argumentand returns an extended complex result.

ccosq() is equivalent to ccosl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use ccosw() or ccosq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEccos(conj( z)) = conj(ccos( z)) and ccos is even.

ccos( +0+i0) returns 1-i0.

ccos( +0+iInf) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified) andraises the invalid floating-point exception.

ccos( +0+iNaN) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified).

ccos( x+iInf) returns NaN+iNaN and raises the invalid floating-point exception, for finite nonzero x .

ccos( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitenonzero x .

ccos( +Inf+i0) returns +Inf-i0.

ccos( +Inf+iy) returns +Inf(cos(y)-isin(y)), for finite nonzero y .

ccos( +Inf+iInf) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified) andraises the invalid floating-point exception.

ccos( +Inf+iNaN) returns +Inf+iNaN.

ccos( NaN+i0) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified).

ccos( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers y .

ccos( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOcos(3M), cacos(3M), complex(5).

Section 3−−84 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ccos(3M) ccos(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEccos() , ccosf() , ccosl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−85

A cA

ccosh(3M) ccosh(3M)(Itanium(R)-based System Only)

NAMEccosh( ), ccoshf( ), ccoshl( ), ccoshw( ), ccoshq( ) - complex hyperbolic cosine functions

SYNOPSIS#include <complex.h>

double complex ccosh(double complex z);

float complex ccoshf(float complex z);

long double complex ccoshl(long double complex z);

extended complex ccoshw(extended complex z);

quad complex ccoshq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

ccosh() returns the complex hyperbolic cosine of z.

ccoshf() is a float complex version of ccosh() ; it takes a float complex argument andreturns a float complex result.

ccoshl() is a long double complex version of ccosh() ; it takes a long double complex argu-ment and returns a long double complex result.

ccoshw() is an extended complex version of ccosh() ; it takes an extended complex argumentand returns an extended complex result.

ccoshq() is equivalent to ccoshl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use ccoshw() or ccoshq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEccosh(conj( z)) = conj(ccosh( z)) and ccosh is even.

ccosh( +0+i0) returns 1+i0.

ccosh( +0+iInf) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified) andraises the invalid floating-point exception.

ccosh( +0+iNaN) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified).

ccosh( x+iInf) returns NaN+iNaN and raises the invalid floating-point exception, for finite nonzero x .

ccosh( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitenonzero x .

ccosh( +Inf+i0) returns +Inf+i0.

ccosh( +Inf+iy) returns +Inf(cos( y)+isin( y)) , for finite nonzero y .

ccosh( +Inf+iInf) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified) andraises the invalid floating-point exception.

ccosh( +Inf+iNaN) returns +Inf+iNaN.

ccosh( NaN+i0) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified).

ccosh( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers y .

ccosh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOcosh(3M), cacosh(3M), complex(5).

Section 3−−86 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ccosh(3M) ccosh(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEccosh() , ccoshf() , ccoshf() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−87

A cA

ceil(3M) ceil(3M)

NAMEceil( ), ceilf( ), ceill( ), ceilw( ), ceilq( ) - ceiling functions

SYNOPSIS#include <math.h>

double ceil(double x);

Itanium(R)-based System Onlyfloat ceilf(float x);

long double ceill(long double x);

extended ceilw(extended x);

quad ceilq(quad x);

DESCRIPTIONThe ceil() returns the smallest integer (represented as a double-precision number) not less than x .

Itanium-based System Onlyceilf() is a float version of ceil() ; it takes a float argument and returns a float result.

ceill() is a long double version of ceil() ; it takes a long double argument and returns along double result.

ceilw() is an extended version of ceil() ; it takes an extended argument and returns anextended result.

ceilq() is equivalent to ceill() on HP-UX systems.

USAGETo use (for Itanium-based systems) ceilf() , compile either with the default -Ae option or with the -Aaoption.

To use (for Itanium-based systems) ceill() , ceilw() , or ceilq() , compile either with the default-Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) ceilw() or ceilq() , compile also with the -fpwidetypesoption.

To use these functions, make sure your program includes <math.h> . Link in the math library by speci-fying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is ±INFINITY or ±zero, ceil() returns x .

If x is NaN, ceil() returns NaN.

ceil() may raise the inexact exception if x is non integral and finite.

ERRORSNo errors are defined.

SEE ALSOfabs(3M), floor(3M), fmod(3M), rint(3M), math(5).

STANDARDS CONFORMANCEceil() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

ceilf() , ceill() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−88 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cexp(3M) cexp(3M)(Itanium(R)-based System Only)

NAMEcexp( ), cexpf( ), cexpl( ), cexpw( ), cexpq( ) - complex exponential functions

SYNOPSIS#include <complex.h>

double complex cexp(double complex z);

float complex cexpf(float complex z);

long double complex cexpl(long double complex z);

extended complex cexpw(extended complex z);

quad complex cexpq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cexp() returns the complex base-e exponential of z.

cexpf() is a float complex version of cexp() ; it takes a float complex argument and returns afloat complex result.

cexpl() is a long double complex version of cexp() ; it takes a long double complex argu-ment and returns a long double complex result.

cexpw() is an extended complex version of cexp() ; it takes an extended complex argumentand returns an extended complex result.

cexpq() is equivalent to cexpl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cexpw() or cexpq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcexp(conj( z)) = conj(cexp( z)) .

cexp( ±0+i0) returns 1+i0.

cexp( x+iInf) returns NaN+iNaN and raises the invalid floating-point exception, for finite x .

cexp( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finite x .

cexp( +Inf+i0) returns +Inf+i0.

cexp( -Inf+iy) returns +0(cos( y)+isin( y)) , for finite y .

cexp( +Inf+iy) returns +Inf(cos( y)+isin (y)) , for finite nonzero y .

cexp( -Inf+iInf) returns ±0±i0 (where the signs of the real and imaginary parts of the result areunspecified).

cexp( +Inf+iInf) returns ±Inf+iNaN and raises the invalid floating-point exception (where the sign ofthe real part of the result is unspecified).

cexp( -Inf+iNaN) returns ±0±i0 (where the signs of the real and imaginary parts of the result areunspecified).

cexp( +Inf+iNaN) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified).

cexp( NaN+i0) returns NaN+i0.

cexp( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnon-zero numbers y .

cexp( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−89

A cA

cexp(3M) cexp(3M)(Itanium(R)-based System Only)

SEE ALSOexp(3M), cis(3M), clog(3M), complex(5).

STANDARDS CONFORMANCEcexp() , cexpf() , cexpl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

Section 3−−90 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

cfspeed(3C) cfspeed(3C)

NAMEcfgetospeed( ), cfsetospeed( ), cfgetispeed( ), cfsetispeed( ) - tty baud rate functions

SYNOPSIS#include <termios.h>

speed_t cfgetospeed(const struct termios *termios_p);

int cfsetospeed(struct termios *termios_p, speed_t speed);

speed_t cfgetispeed(const struct termios *termios_p);

int cfsetispeed(struct termios *termios_p, speed_t speed);

DESCRIPTIONThese functions set and get the input and output speed codes in the termios structure referenced bytermios_p . The termios structure contains these speed codes representing input and output baud rates aswell as other terminal related parameters. Setting the parameters on a terminal file does not becomeeffective until tcsetattr() is successfully called.

cfgetospeed() returns the output speed code from the termios structure referenced bytermios_p .

cfsetospeed() sets the output speed code in the termios structure referenced by termios_p tospeed . The speed code for a baud rate of zero, B0, is used to terminate theconnection. If B0 is specified, the modem control lines are no longer asserted,which normally disconnects the line.

cfgetispeed() returns the input speed code from the termios structure referenced bytermios_p .

cfsetispeed() sets the input speed code in the termios structure referenced by termios_p tospeed .

RETURN VALUEcfgetospeed() returns the output speed code from the termios structure referenced by termios_p .

cfgetispeed() returns the input speed code from the termios structure referenced by termios_p .

cfsetispeed() and cfsetospeed() return zero upon successful completion. Otherwise, theyreturn -1 and set errno to indicate the error.

ERRORScfsetispeed() and cfsetospeed() fail when the following condition is encountered:

[EINVAL] The value of speed is outside the range of possible speed codes as specified in<termios.h >.

WARNINGScfsetispeed() and cfsetospeed() can be used to set speed codes in the termios structure thatare not supported by the terminal hardware.

SEE ALSOtcattribute(3C), thread_safety(5), termio(7).

STANDARDS CONFORMANCEcfgetispeed() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1

cfgetospeed() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1

cfsetispeed() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1

cfsetospeed() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−91

A cA

chgat(3X) chgat(3X)(ENHANCED CURSES)

NAMEchgat, mvchgat, mvwchgat, wchgat — change renditions of characters in a window

SYNOPSIS#include <curses.h>

int chgat(int n, attr_t attr, short color, const void * opts);

int mvchgat(int y, int x, int n, attr_t attr, short color,const void * opts);

int mvwchgat(WINDOW * win, int y, int x, int n, attr_t attr,short color, const void * opts);

int wchgat(WINDOW * win, int n, attr_t attr, short color,const void * opts);

DESCRIPTIONThese functions change the renditions of the next n characters in the current or specified window (or ofthe remaining characters on the line, if n is −1), starting at the current or specified cursor position. Theattributes and colors are specified by attr and color as for setcchar() .

These functions do not update the cursor. These functions do not perform wrapping.

A value of n that is greater than the remaining characters on a line is not an error.

The opts argument is reserved for definition in a future edition of this document. Currently, the applica-tion must provide a null pointer as opts.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOsetcchar(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−92 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

chownacl(3C) chownacl(3C)

NAMEchownacl( ) - change owner and/or group represented in a file’s access control list (ACL) (HFS File Sys-tems only)

SYNOPSIS#include <acllib.h>

void chownacl(int nentries,const struct acl_entry *acl,uid_t olduid,gid_t oldgid,uid_t newuid,gid_t newgid

);

Remarks:To ensure continued conformance with emerging industry standards, features described in thismanual entry are likely to change in a future release.

DESCRIPTIONThis routine alters an access control list (ACL) to reflect the change in a file’s owner or group ID when anold file is copied to a new file and the ACL is also copied. chownacl() transfers ownership (that is, itmodifies base ACL entries) in a manner similar to chown() (see chown(2)). The algorithm is describedbelow and also in acl (5).

The nentries parameter is the current number of ACL entries in the acl[] array (zero or more; a nega-tive value is treated as zero). The olduid and oldgid values are the user and group IDs of the originalfile’s owner, typically the st_uid and st_gid values from stat() (see stat (2)). The newuid andnewgid values are the user and group IDs of the new file’s owner, typically the return values fromgeteuid() and getegid() (see geteuid (2) and getegid (2) in getuid (2)).

If an ACL entry in acl[] has a uid of olduid and a gid of ACL_NSGROUP(that is, an owner base ACLentry), chownacl() changes uid to newuid (with exceptions − see below). If an entry has a uid ofACL_NSUSERand a gid of oldgid (that is, a group base ACL entry), chownacl() changes gid tonewgid . In either case, only the last matching ACL entry is altered; a valid ACL can have only one of eachtype.

As with chown(2), if the new user or group already has an ACL entry (that is, a uid of newuid and a gid ofACL_NSGROUP, or a uid of ACL_NSUSERand a gid of newgid), chownacl() does not change the olduser or group base ACL entry; both the old and new ACL entries are preserved.

As a special case, if olduid (oldgid ) is equal to newuid (newgid), chownacl() does not search acl[]for an old user (group) base ACL entry to change. Calling it with both olduid equal to newuid and oldgidequal to newgid causes chownacl() to do nothing.

Suggested UseThis routine is useful in a program that creates a new or replacement copy of a file whose original was (orpossibly was) owned by a different user or group, and that copies the old file’s ACL to the new file. Copy-ing another user’s and/or group’s file is equivalent to having the original file’s owner and/or group copyand then transfer a file to a new owner and/or group using chown() . This routine is not needed formerely changing a file’s ownership; chown() modifies the ACL appropriately in that case.

If a program also copies file miscellaneous mode bits from an old file to a new one, it must use chmod()(see chmod(2)). However, since chmod() deletes optional ACL entries, it must be called beforesetacl() (see setacl (2)). Furthermore, to avoid leaving a new file temporarily unprotected, thechmod() call should set only the file miscellaneous mode bits, with all access permission mode bits set tozero (that is, mask the mode with 07000). The cpacl() library call encapsulates this operation, andhandles remote files appropriately too.

EXAMPLESThe following code fragment gets stat() information and the ACL from oldfile , transfers ownershipof newfile to the caller, and sets the revised ACL to newfile .

#include <sys/types.h>#include <sys/stat.h>

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−93

A cA

chownacl(3C) chownacl(3C)

#include <sys/acl.h>

int nentries;struct acl_entry acl [NACLENTRIES];struct stat statbuf;

if (stat ("oldfile", & statbuf) < 0)error (...);

if ((nentries = getacl ("oldfile", NACLENTRIES, acl)) < 0)error (...);

chownacl (nentries, acl, statbuf.st_uid, statbuf.st_gid,geteuid(), getegid());

if (setacl ("newfile", nentries, acl))error (...);

DEPENDENCIESchownacl() is only supported on HFS file system on standard HP-UX operating system.

AUTHORchownacl() was developed by HP.

SEE ALSOchown(2), getacl(2), getegid(2), geteuid(2), getuid(2), setacl(2), stat(2), acltostr(3C), cpacl(3C),setaclentry(3C), strtoacl(3C), acl(5), thread_safety(5).

Section 3−−94 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

cimag(3M) cimag(3M)(Itanium(R)-based System Only)

NAMEcimag( ), cimagf( ), cimagl( ), cimagw( ), cimagq( ) - the imaginary part of a complex value

SYNOPSIS#include <complex.h>

double cimag(double complex z);

float cimagf(float complex z);

long double cimagl(long double complex z);

extended cimagw(extended complex z);

quad cimagq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cimag() returns the imaginary part of z (as a real).

cimagf() is a float complex version of cimag() ; it takes a float complex argument andreturns a float result.

cimagl() is a long double complex version of cimag() ; it takes a long double complex argu-ment and returns a long double result.

cimagw() is an extended complex version of cimag() ; it takes an extended complex argumentand returns an extended result.

cimagq() is equivalent to cimagl() on HP-UX systems.

These functions raise no floating-point exceptions.

USAGETo use these functions, compile with the default -Ae option. To use cimagw() or cimagq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

ERRORSNo errors are defined.

SEE ALSOcreal(3M), complex(5).

STANDARDS CONFORMANCEcimag() , cimagf() , cimagl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−95

A cA

cis(3M) cis(3M)(Itanium(R)-base System Only)

NAMEcis( ), cisf( ), cisl( ), cisw( ), cisq( ) - complex value with unit magnitude and given angle (specified in radi-ans)

SYNOPSIS#include <complex.h>

double complex cis(double x);

float complex cisf(float x);

long double complex cisl(long double x);

extended complex cisw(extended x);

quad complex cisq(quad x);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cis() returns the complex value whose real and imaginary parts are the cosine and sine of x , respec-tively. cis( x) is equivalent to cexp( ix).

cisf() is a float complex version of cis() ; it takes a float argument and returns a floatcomplex result.

cisl() is a long double complex version of cis() ; it takes a long double argument and returnsa long double complex result.

cisw() is an extended complex version of cis() ; it takes an extended argument and returns anextended complex result.

cisq() is equivalent to cisl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cisw() or cisq() , compile withthe -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcis( -x) = conj(cis( x)) .

cis( ±0) returns 1±i0.

cis( +Inf) returns NaN+iNaN.

cis( NaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOcexp(3M), sincos(3M), sincosd(3M), complex(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

Section 3−−96 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

clear(3X) clear(3X)(CURSES)

NAMEclear, erase, wclear, werase — clear a window

SYNOPSIS#include <curses.h>

int clear(void);

int erase(void);

int wclear(WINDOW * win);

int werase(WINDOW * win);

DESCRIPTIONThe clear() , erase() , wclear() and werase() functions clear every position in the current orspecified window.

The clear() and wclear() functions also achieve the same effect as calling clearok() , so that thewindow is cleared completely on the next call to wrefresh() for the window and is redrawn in itsentirety.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOclearok(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The erase() and werase() functions are merged with this entry. In previous issues, they appearedin entries of their own.

The entry is rewritten for clarity. The argument list for the clear() and erase() functions is expli-citly declared as void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−97

A cA

clearenv(3C) clearenv(3C)

NAMEclearenv - clear the process environment

SYNOPSIS#include <stdlib.h>

int clearenv(void);

DESCRIPTIONclearenv() clears the process environment. No environment variables are defined immediately after acall to clearenv() .

clearenv() modifies the value of the pointer environ . This means that copies of that pointer areinvalid after a call to clearenv() .

RETURN VALUEUpon successful completion, clearenv() returns zero; otherwise, it returns −1 and sets errno toindicate the error.

ERRORSclearenv() fails if the following condition is encountered:

[ENOMEM] Failed to free or reallocate memory for the process environment.

SEE ALSOenviron(5), getenv(3C), putenv(3C), thread_safety(5), <stdlib.h>.

STANDARDS CONFORMANCEclearenv() : AES

Section 3−−98 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

clearok(3X) clearok(3X)(CURSES)

NAMEclearok, idlok, leaveok, scrollok, setscrreg, wsetscrreg — terminal output control functions

SYNOPSIS#include <curses.h>

int clearok(WINDOW * win, bool bf);

int idlok(WINDOW * win, bool bf);

int leaveok(WINDOW * win, bool bf);

int scrollok(WINDOW * win, bool bf);

int setscrreg(int top, int bot);

int wsetscrreg(WINDOW * win, int top, int bot);

DESCRIPTIONThese functions set options that deal with output within Curses.

The clearok() function assigns the value of bf to an internal flag in the specified window that governsclearing of the screen during a refresh. If, during a refresh operation on the specified window, the flag incurscr is TRUE or the flag in the specified window is TRUE, then the implementation clears the screen,redraws it in its entirety, and sets the flag to FALSE in curscr and in the specified window. The initialstate is unspecified.

The idlok() function specifies whether the implementation may use the hardware insert-line, delete-line, and scroll features of terminals so equipped. If bf is TRUE, use of these features is enabled. If bf isFALSE, use of these features is disabled and lines are instead redrawn as required. The initial state isFALSE.

The leaveok() function controls the cursor position after a refresh operation. If bf is TRUE, refreshoperations on the specified window may leave the terminal’s cursor at an arbitrary position. If bf isFALSE, then at the end of any refresh operation, the terminal’s cursor is positioned at the cursor positioncontained in the specified window. The initial state is FALSE.

The scrollok() function controls the use of scrolling. If bf is TRUE, then scrolling is enabled for thespecified window, with the consequences discussed in Truncation, Wrapping and Scrolling incurses_intro (3X). If bf is FALSE, scrolling is disabled for the specified window. The initial state isFALSE.

The setscrreg() and wsetscrreg() functions define a software scrolling region in the current orspecified window. The top and bot arguments are the line numbers of the first and last line defining thescrolling region. (Line 0 is the top line of the window.) If this option and scrollok() are enabled, anattempt to move off the last line of the margin causes all lines in the scrolling region to scroll one line inthe direction of the first line. Only characters in the window are scrolled. If a software scrolling region isset and scrollok() is not enabled, an attempt to move off the last line of the margin does not reposi-tion any lines in the scrolling region.

RETURN VALUEUpon successful completion, setscrreg() and wsetscrreg() return OK. Otherwise, they returnERR.

The other functions always return OK.

ERRORSNo errors are defined.

APPLICATION USAGEThe only reason to enable the idlok() feature is to use scrolling to achieve the visual effect of motion ofa partial window, such as for a screen editor. In other cases, the feature can be visually annoying.

The leaveok() option provides greater efficiency for applications that do not use the cursor.

SEE ALSOclear(3X), delscreen(3X), doupdate(3X), scrl(3X), <curses.h>.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−99

A cA

clearok(3X) clearok(3X)(CURSES)

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The idlok() , leaveok() , scrollok() , setscrreq() and wsetscrreq() functions are mergedwith this entry. In previous issues, they appeared in entries of their own.

The entry is rewritten for clarity. The DESCRIPTION of clearok() is updated to indicate that clear-ing of a screen applies if the flag is TRUE in either curscr or the specified window.

The RETURN VALUE is changed to indicate that the clearok() , leaveok() and scrollok() func-tions always return OK.

Section 3−−100 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

clock(3C) clock(3C)

NAMEclock( ) - report CPU time used

SYNOPSIS#include <time.h>

clock_t clock(void);

DESCRIPTIONclock() returns the amount of CPU time (in microseconds) used since the first call to clock() . Thetime reported is the sum of the user and system times of the calling process and its terminated childprocesses for which it has executed wait() , system() or pclose() (see wait (2) , system (3S), andpopen (3S)). To determine the time in seconds, the value returned by clock() should be divided by thevalue of the macro CLOCKS_PER_SEC.

The resolution of the clock varies, depending on the hardware and on software configuration.

If the processor time used is not available or its value cannot be represented, the function returns thevalue (clock_t ) − 1.

WARNINGSThe value returned by clock() is defined in microseconds for compatibility with systems that have CPUclocks with much higher resolution. Because of this, the value returned wraps around after accumulatingonly 4295 seconds of CPU time (about 72 minutes).

DEPENDENCIESThe default clock resolution is 10 milliseconds.

SEE ALSOtimes(2), wait(2), system(3S), thread_safety(5).

STANDARDS CONFORMANCEclock() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−101

A cA

clog(3M) clog(3M)(Itanium(R)-based System Only)

NAMEclog( ), clogf( ), clogl( ), clogw( ), clogq( ) - complex natural (base-e) logarithm functions

SYNOPSIS#include <complex.h>

double complex clog(double complex z);

float complex clogf(float complex z);

long double complex clogl(long double complex z);

extended complex clogw(extended complex z);

quad complex clogq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

clog() returns the complex natural logarithm of z in the range of a strip mathematically unboundedalong the real axis and in the interval [-iPi,+iPi] along the imaginary axis. There is a branch cut alongthe negative real axis.

clogf() is a float complex version of clog() ; it takes a float complex argument and returns afloat complex result.

clogl() is a long double complex version of clog() ; it takes a long double complex argu-ment and returns a long double complex result.

clogw() is an extended complex version of clog() ; it takes an extended complex argumentand returns an extended complex result.

clogq() is equivalent to clogl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use clogw() or clogq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEclog(conj( z)) = conj(clog( z)) .

clog( -0+i0) returns -Inf+iPi and raises the divide-by-zero floating-point exception.

clog( +0+i0) returns -Inf+i0 and raises the divide-by-zero floating-point exception.

clog( x+iInf) returns +Inf+iPi/2, for finite x .

clog( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finite x .

clog( -Inf+iy) returns +Inf+iPi, for finite positive-signed y .

clog( +Inf+iy) returns +Inf+i0, for finite positive-signed y .

clog( -Inf+iInf) returns +Inf+i3Pi/4.

clog( +Inf+iInf) returns +Inf+ipi/4.

clog( ±Inf+iNaN) returns +Inf+iNaN.

clog( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finite y .

clog( NaN+iInf) returns +Inf+iNaN.

clog( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOlog(3M), cexp(3M), complex(5).

Section 3−−102 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

clog(3M) clog(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEclog() , clogf() , clogl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−103

A cA

clrtobot(3X) clrtobot(3X)(CURSES)

NAMEclrtobot, wclrtobot — clear from cursor to end of window

SYNOPSIS#include <curses.h>

int clrtobot(void);

int wclrtobot(WINDOW * win);

DESCRIPTIONThe clrtobot() and wclrtobot() functions erase all lines following the cursor in the current orspecified window, and erase the current line from the cursor to the end of the line, inclusive.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOdoupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the clrtobot() function is explicitly declaredas void.

Section 3−−104 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

clrtoeol(3X) clrtoeol(3X)(CURSES)

NAMEclrtoeol, wclrtoeol — clear from cursor to end of line

SYNOPSIS#include <curses.h>

int clrtoeol(void);

int wclrtoeol(WINDOW * win);

DESCRIPTIONThe clrtoeol() and wclrtoeol() functions erase the current line from the cursor to the end of theline, inclusive, in the current or specified window.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOdoupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the clrtoeol() function is explicitly declaredas void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−105

A cA

COLS(3X) COLS(3X)(ENHANCED CURSES)

NAMECOLS — number of columns on terminal screen

SYNOPSIS#include <curses.h>

extern int COLS;

DESCRIPTIONThe external variable COLS indicates the number of columns on the terminal screen.

SEE ALSOinitscr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−106 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

compound(3M) compound(3M)(Itanium(R)-based System Only)

NAMEcompound( ), compoundf( ), compoundl( ), compoundw( ), compoundq( ) - compound interest factor

SYNOPSIS#include <math.h>

double compound(double rate, double periods);

float compoundf(float rate, float periods);

long double compoundl(long double rate, long double periods);

extended compoundw(extended rate, extended periods);

quad compoundq(quad rate, quad periods);

DESCRIPTIONThe compound() function computes the compound interest factor:

(1 + rate ) ** periods

compoundf() is a float version of compound() ; it takes float arguments and returns a floatresult.

compoundl() is a long double version of compound() ; it takes long double arguments andreturns a long double result.

compoundw() is an extended version of compound() ; it takes extended arguments and returnsan extended result.

compoundq() is equivalent to compoundl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use compoundw() or compoundq() , compile also with the -fpwidetypes option. Make sureyour program includes <math.h> .

Link in the math library by specifying -lm on the compiler or linker command line.

RETURN VALUEIf periods equals zero, compound() returns 1.0.

Else, if either argument is a NaN, compound() returns a NaN.

Else, if rate is less than -1, compound() returns a NaN and raises the invalid exception.

Else, if rate equals -1, compound() is equivalent to pow( 0, periods ) .

Else, if rate equals +INFINITY, compound() is equivalent to pow( rate , periods ) .

Else, if periods is infinite and rate equals zero, compound() returns 1.0.

Else, if periods is infinite and rate does not equal zero, compound() is equivalent to exp( rate *periods ) .

compound() returns a properly signed infinity in lieu of a value whose magnitude is too large, andraises the overflow and inexact exceptions.

compound() raises the underflow and inexact exceptions whenever a result is tiny (essentially denor-mal or zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merelytiny.

ERRORSNo errors are defined.

SEE ALSOannuity(3M), exp(3M), expm1(3M), pow(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−107

A cA

confstr(3C) confstr(3C)

NAMEconfstr( ) - get string-valued configuration values

SYNOPSIS#include <unistd.h>

size_t confstr(int name, char *buf, size_t len);

DESCRIPTIONconfstr() provides a method for applications to get configuration-defined string values. Its use andpurpose are similar to sysconf() (see sysconf (2)), except that it is used where string values rather thannumeric values are returned.

The name parameter can take on the following name values, which are defined in <unistd.h> .

_CS_PATH A default value for the PATHenvironment variable which can be used to locate com-mands in Section 1 of the HP-UX Reference and utilities defined in the POSIX.2standard that are currently implemented in the HP-UX operating system.

_CS_HW_CPU_SUPP_BITSWhich kernel is supported on the hardware. Current values returned include "32","32/64" or "64".

_CS_KERNEL_BITSWhether the kernel is 32-bit or 64-bit. Current values returned include "32" or "64".

_CS_MACHINE_MODELThe hardware model string.

_CS_MACHINE_IDENTIdentifier for each physical machine. Returned as an opaque string of printable asciicharacters. This string has the same value for all partitions in a physical machine.For hardware classes first released with HP-UX 11i or later, this ID is uniqueacross all hardware classes. For earlier hardware classes, the ID number is uniqueonly within the hardware class. A null string is returned if no ID number is avail-able; this is expected to be the case only for prototype machines or other systemsimproperly configured in manufacturing. Comparisons of this value must be madeusing the string compare functions, see string (3C).

_CS_PARTITION_IDENTIdentifier for each partition existing on a machine. Returned as an opaque string ofprintable ascii characters. For any machine not supporting partitions this valuewill be same as _CS_MACHINE_IDENT. Comparisons of this value must be madeusing the string compare functions, see string (3C).

_CS_MACHINE_SERIALMachine serial number as found labeled on the external machine chassis. Thevalue will be a printable ascii string. This string is not available on all classes ofmachines; if unavailable, the string will be empty. This string is not a uniqueidentifier of the machine, since machines of different classes can have the sameserial number.

If a unique identifier is needed, use _CS_MACHINE_IDENT or_CS_PARTITION_IDENT.

_CS_XBS5_ILP32_OFF32_CFLAGSThe set of initial options to be given to the cc(1) and c89(1) utilities to build anapplication using a programming model with 32-bit int, long, pointer, and off_ttypes.

_CS_XBS5_ILP32_OFF32_LDFLAGSThe set of final options to be given to the cc(1) and c89(1) utilities to build an appli-cation using a programming model with 32-bit int, long, pointer, and off_t types.

_CS_XBS5_ILP32_OFF32_LIBSThe set of libraries to be given to the cc(1) and c89(1) utilities to build an applica-tion using a programming model with 32-bit int, long, pointer, and off_t types.

Section 3−−108 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

confstr(3C) confstr(3C)

_CS_XBS5_ILP32_OFF32_LINTFLAGSThe set of options to be given to the lint (1) utility to check application source usinga programming model with 32-bit int, long, pointer, and off_t types.

_CS_XBS5_ILP32_OFFBIG_CFLAGSThe set of initial options to be given to the cc(1) and c89(1) utilities to build anapplication using a programming model with 32-bit int, long, and pointer types, andan off_t type using at least 64-bits.

_CS_XBS5_ILP32_OFFBIG_LDFLAGSThe set of final options to be given to the cc(1) and c89(1) utilities to build an appli-cation using a programming model with 32-bit int, long, and pointer types, and anoff_t type using at least 64-bits.

_CS_XBS5_ILP32_OFFBIG_LIBSThe set of libraries to be given to the cc(1) and c89(1) utilities to build an applica-tion using a programming model with 32-bit int, long, and pointer types, and anoff_t type using at least 64-bits.

_CS_XBS5_ILP32_OFFBIG_LINTFLAGSThe set of options to be given to the lint (1) utility to check application source usinga programming model with 32-bit int, long, and pointer types, and an off_t typeusing at least 64-bits.

_CS_XBS5_LP64_OFF64_CFLAGSThe set of initial options to be given to the cc(1) and c89(1) utilities to build anapplication using a programming model with 32-bit int, and 64-bit long, pointer,and off_t types.

_CS_XBS5_LP64_OFF64_LDFLAGSThe set of final options to be given to the cc(1) and c89(1) utilities to build an appli-cation using a programming model with 32-bit int, and 64-bit long, pointer, andoff_t types.

_CS_XBS5_LP64_OFF64_LIBSThe set of libraries to be given to the cc(1) and c89(1) utilities to build an applica-tion using a programming model with 32-bit int, and 64-bit long, pointer, and off_ttypes.

_CS_XBS5_LP64_OFF64_LINTFLAGSThe set of options to be given to the lint (1) utility to check application source usinga programming model with 32-bit int, and 64-bit long, pointer, and off_t types.

_CS_XBS5_LPBIG_OFFBIG_CFLAGSThe set of initial options to be given to the cc(1) and c89(1) utilities to build anapplication using a programming model with an int type using 32 bits and long,pointer, and off_t types using at least 64-bits.

_CS_XBS5_LPBIG_OFFBIG_LDFLAGSThe set of libraries to be given to the cc(1) and c89(1) utilities to build an applica-tion using a programming model with an int type using 32 bits and long, pointer,and off_t types using at least 64-bits.

_CS_XBS5_LPBIG_OFFBIG_LIBSThe set of libraries to be given to the cc(1) and c89(1) utilities to build an applica-tion using a programming model with an int type using 32 bits and long, pointer,and off_t types using at least 64-bits.

_CS_XBS5_LPBIG_OFFBIG_LINTFLAGSThe set of options to be given to the lint (1) utility to check application source usinga programming model with an int type using 32 bits and long, pointer, and off_ttypes using at least 64-bits.

If len is not zero, and if name is known and has a configuration-defined value, confstr() copies thatvalue into the len -byte buffer pointed to by buf . If the string to be returned is longer than len bytes,including the terminating null, confstr() truncates the string to len - 1 bytes and null-terminates theresult. The application can detect that the string was truncated by comparing the value returned byconfstr() with len .

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−109

A cA

confstr(3C) confstr(3C)

If len is zero and buf is NULL, confstr() returns the integer value as defined below, but does notreturn a string. If len is zero but buf is not NULL, the result is unspecified.

RETURN VALUEIf name is invalid, confstr() returns zero and sets errno to [EINVAL].

If name does not have a configuration-defined value, confstr() returns 0 (zero) and leaves errnounchanged.

If name has a configuration-defined value, confstr() returns the size of buffer that would be needed tohold the entire configuration-defined value. If this return value is less than len , the string returned inbuf has been truncated.

EXAMPLESThe following code fragment calls confstr() to determine the correct buffer size for _CS_PATH, allo-cates space for this buffer, then gets the configuration value for _CS_PATH.

#include <unistd.h>#include <stddef.h>

size_t bufsize;char *buffer;

bufsize=confstr(_CS_PATH,NULL,(size_t)0);buffer=(char *)malloc(bufsize);confstr(_CS_PATH,buffer,bufsize);

AUTHORconfstr() was developed by HP.

FILES/usr/include/unistd.h

SEE ALSOgetconf(1), errno(2), fpathconf(2), pathconf(2), sysconf(2), malloc(3C), thread_safety(5).

STANDARDS CONFORMANCEconfstr() : XPG4, POSIX.2

Section 3−−110 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A cA

conj(3M) conj(3M)(Itanium(R)-based System Only)

NAMEconj( ), conjf( ), conjl( ), conjw( ), conjq( ) - complex conjugate functions

SYNOPSIS#include <complex.h>

double complex conj(double complex z);

float complex conjf(float complex z);

long double complex conjl(long double complex z);

extended complex conjw(extended complex z);

quad complex conjq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

conj() returns the complex conjugate of z, computed by reversing the sign of its imaginary part.

conjf() is a float complex version of conj() ; it takes a float complex argument and returns afloat complex result.

conjl() is a long double complex version of conj() ; it takes a long double complex argu-ment and returns a long double complex result.

conjw() is an extended complex version of conj() ; it takes an extended complex argumentand returns an extended complex result.

conjq() is equivalent to conjl() on HP-UX systems.

These functions raise no exceptions.

USAGETo use these functions, compile with the default -Ae option. To use conjw() or conjq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

ERRORSNo errors are defined.

SEE ALSOcreal(3M), cimag(3M), complex(5).

STANDARDS CONFORMANCEconj() , conjf() , conjl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−111

A cA

conv(3C) conv(3C)

NAMEtoupper( ), tolower( ), _toupper( ), _tolower( ), toascii( ) - translate characters

SYNOPSIS#include <ctype.h>

int toupper(int c);

int tolower(int c);

int _toupper(int c);

int _tolower(int c);

int toascii(int c);

DESCRIPTIONtoupper() and tolower() have as domain the range of getc (3S): the integers from −1 through 255.If the argument of toupper() represents a lower-case letter, the result is the corresponding upper-caseletter. If the argument of tolower() represents an upper-case letter, the result is the correspondinglower-case letter. All other arguments in the domain are returned unchanged. Arguments outside thedomain cause undefined results.

The macros _toupper() and _tolower() are identical to toupper() and tolower() , respec-tively.

toascii() yields its argument with all bits that are not part of a standard 7-bit ASCII charactercleared; it is intended for compatibility with other systems.

WARNINGStoascii() is supplied both as a library function and as a macro defined in the <ctype.h > header.Normally, the macro version is used. To obtain the library function, either use a #undef to remove themacro definition or, if compiling in ANSI C mode, enclose the function name in parenthesis or take itsaddress. The following examples use the library function for toascii() :

#include <ctype.h>#undef toascii

...main(){

...c1 = toascii(c);

...}

or#include <ctype.h>

...main(){

int (*conv_func)();...c1 = (toascii)(c);...conv_func = toascii;...

}

The following example use the library function for toupper() :

#include <ctype.h>#undef toupper

...main(){

...char *c;*c=toupper ((unsigned char*) c);

Section 3−−112 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

conv(3C) conv(3C)

...}

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the translations to be done.

International Code Set SupportSingle-byte character code sets are supported.

AUTHORconv() was developed by IBM, OSF, and HP.

SEE ALSOctype(3C), getc(3S), setlocale(3C), lang(5), thread_safety(5).

STANDARDS CONFORMANCE_tolower() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

_toupper() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

toascii() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

tolower() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

toupper() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−113

A cA

copylist(3G) copylist(3G)

NAMEcopylist() - copy a file into memory

SYNOPSIS#include <libgen.h>

char *copylist(const char * filenm , off_t * szptr );

DESCRIPTIONcopylist copies a list of items from a file into freshly allocated memory, replacing new-lines with nullcharacters. It expects two arguments: a pointer filenm to the name of the file to be copied, and a pointerszptr to a variable where the size of the file will be stored.

Upon success, copylist returns a pointer to the memory allocated. Otherwise it returns NULL if it hastrouble finding the file, calling malloc , or opening the file.

EXAMPLES/* read "file" into buf */off_t size;char *buf;buf = copylist("file", &size) ;"for (i = 0; i < size; i++)

if(buf[i])putchar(buf[i]);

elseputchar(’\n’);

SEE ALSOmalloc(3C), thread_safety(5).

Section 3−−114 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

copysign(3M) copysign(3M)

NAMEcopysign( ), copysignf( ), copysignl( ), copysignw( ), copysignq( ) - copysign functions

SYNOPSIS#include <math.h>

double copysign(double x, double y);

float copysignf(float x, float y);

Itanium(R)-based System Onlylong double copysignl(long double x, long double y);

extended copysignw(extended x, extended y);

quad copysignq(quad x, quad y);

DESCRIPTIONThe copysign() function returns x with its sign changed to the sign of y .

copysignf() is a float version of copysign() ; it takes float arguments and returns a floatresult.

Itanium-based System Onlycopysignl() is a long double version of copysign() ; it takes long double arguments andreturns a long double result.

copysignw() is an extended version of copysign() ; it takes extended arguments and returnsan extended result.

copysignq() is equivalent to copysignl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. To use (for Itanium-based systems) copysignw() or copysignq() , com-pile with the -fpwidetypes option. Make sure your program includes <math.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEThe copysign() function returns a value with the magnitude of x and the sign of y .

These functions raise no exceptions.

ERRORSNo errors are defined.

SEE ALSOfabs(3M), fpclassify(3M), remainder(3M), scalbn(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEcopysign() , copysignf() , copysignl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−115

A cA

copywin(3X) copywin(3X)(CURSES)

NAMEcopywin — copy a region of a window

SYNOPSIS#include <curses.h>

int copywin(const WINDOW * srcwin, WINDOW *dstwin, int sminrow,int smincol, int dminrow, int dmincol, int dmaxrow,int dmaxcol, int overlay);

DESCRIPTIONThe copywin() function provides a finer granularity of control over the overlay() andoverwrite() functions. As in the prefresh() function, a rectangle is specified in the destinationwindow, (dminrow, dmincol) and (dmaxrow, dmaxcol), and the upper-left-corner coordinates of the sourcewindow, (sminrow, smincol). If overlay is TRUE, then copying is non-destructive, as in overlay() . Ifoverlay is FALSE, then copying is destructive, as in overwrite() .

RETURN VALUEUpon successful completion, copywin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOnewpad(3X), overlay(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−116 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cos(3M) cos(3M)

NAMEcos( ), cosf( ), cosl( ), cosw( ), cosq( ) - cosine functions

SYNOPSIS#include <math.h>

double cos(double x);

float cosf(float x);

Itanium(R)-based System Onlylong double cosl(long double x);

extended cosw(extended x);

quad cosq(quad x);

DESCRIPTIONcos() returns the cosine of x (x specified in radians).

On PA-RISC systems, cos() may lose accuracy when x is far from zero.

cosf() is a float version of cos() ; it takes a float argument and returns a float result.

Itanium-based System Onlycosl() is a long double version of cos() ; it takes a long double argument and returns along double result.

cosw() is an extended version of cos() ; it takes an extended argument and returns anextended result.

cosq() is equivalent to cosl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) cosw() or cosq() , compile also with the -fpwidetypes option.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the cos() and cosf() functions are available. Millicode versions of math libraryfunctions are usually faster than their counterparts in the standard library. To use these versions, com-pile your program with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the same values as their standard library counterparts(see the RETURN VALUE section).

RETURN VALUEcos( ±0) returns 1.

If x is ±INFINITY, cos() returns NaN and raises the invalid exception.

If x is NaN, cos() returns NaN.

When it raises no other exception, whether cos() raises the inexact exception is unspecified.

ERRORSNo errors are defined.

SEE ALSOacos(3M), asin(3M), atan(3M), atan2(3M), ccos(3M), cosd(3M), sin(3M), sincos(3M), tan(3M), math(5).

STANDARDS CONFORMANCEcos() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−117

A cA

cos(3M) cos(3M)

cosf() , cosl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−118 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

cosd(3M) cosd(3M)

NAMEcosd( ), cosdf( ), cosdl( ), cosdw( ), cosdq( ) - cosine functions of an argument specified in degrees

SYNOPSIS#include <math.h>

double cosd(double x);

float cosdf(float x);

Itanium(R)-based System Onlylong double cosdl(long double x);

extended cosdw(extended x);

quad cosdq(quad x);

DESCRIPTIONcosd() returns the cosine of x (x specified in degrees).

On PA-RISC systems, cosd() may lose accuracy when x is far from zero.

cosdf() is a float version of cosd() ; it takes a float argument and returns a float result.

Itanium-based System Onlycosdl() is a long double version of cosd() ; it takes a long double argument and returns along double result.

cosdw() is an extended version of cosd() ; it takes an extended argument and returns anextended result.

cosdq() is equivalent to cosdl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) cosdw() or cosdq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEcosd( ±0) returns 1.

If x is ±INFINITY, cosd() returns NaN and raises the invalid exception.

If x is NaN, cosd() returns NaN.

ERRORSNo errors are defined.

SEE ALSOacosd(3M), asind(3M), atand(3M), atan2d(3M), cos(3M), sincosd(3M), sind(3M), tand(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−119

A cA

cosh(3M) cosh(3M)

NAMEcosh( ), coshf( ), coshl( ), coshw( ), coshq( ) - hyperbolic cosine functions

SYNOPSIS#include <math.h>

double cosh(double x);

float coshf(float x);

Itanium(R)-based System Onlylong double coshl(long double x);

extended coshw(extended x);

quad coshq(quad x);

DESCRIPTIONcosh() returns the hyperbolic cosine of x .

coshf() is a float version of cosh() ; it takes a float argument and returns a float result.

Itanium-based System Onlycoshl() is a long double version of cosh() ; it takes a long double argument and returns along double result.

coshw() is an extended version of cosh() ; it takes an extended argument and returns anextended result.

coshq() is equivalent to coshl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) coshw() or coshq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEcosh( ±0) returns 1.

If x is ±INFINITY, cosh() returns +INFINITY.

If x is NaN, cosh() returns NaN.

cosh() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, and raisethe overflow and inexact exceptions.

When it raises no other exception, whether cosh() raises the inexact exception is unspecified.

ERRORSIf the correct value would overflow, cosh() sets errno to [ERANGE].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOacosh(3M), ccosh(3M), sinh(3M), tanh(3M), math(5).

STANDARDS CONFORMANCEcosh() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

coshf() , coshl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−120 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cpacl(3C) cpacl(3C)

NAMEcpacl( ), fcpacl( ) - copy the access control list (ACL) and mode bits from one file to another (HFS and JFSFile Systems only)

SYNOPSIS#include <acllib.h>

int cpacl(const char *fromfile,const char *tofile,mode_t frommode,uid_t fromuid,gid_t fromgid,uid_t touid,gid_t togid

);

int fcpacl(int fromfd,int tofd,mode_t frommode,uid_t fromuid,gid_t fromgid,uid_t touid,gid_t togid

);

Remarks:To ensure continued conformance with emerging industry standards, features described in thismanual entry are likely to change in a future release.

DESCRIPTIONBoth cpacl() (HFS and JFS file systems) and fcpacl() (HFS file systems only) copy the access con-trol list and mode bits (that is, file access permission bits and miscellaneous mode bits; see chmod(2))from one file to another, and transfer ownership much like chown(2). cpacl() can only copy HFSACLs to other HFS files and JFS ACLs to other JFS files; it does not convert HFS ACLs to JFS ACLs orvice versa. cpacl() and fcpacl() take the following parameters:

• Path names (fromfile and tofile ) or open file descriptors (fromfd and tofd ).

• A mode value (frommode , typically the st_mode value returned by stat() − see stat (2)) con-taining file miscellaneous mode bits which are always copied, and file access permission bitswhich are copied instead of the access control list if either file is remote.

• User ID and group ID of the file (fromuid , touid and fromgid , togid ) for transferring ownership.(Typically fromuid and fromgid are the st_uid and st_gid values returned by stat() , andtouid and togid are the return values from geteuid() and getegid() − see geteuid (2) andgetegid (2) in getuid (2)).

When both files are local, the cpacl() routines copy the access control list and call chownacl()(HFS only; see chownacl (3C)) to transfer ownership from the fromfile to the tofile , if necessary.

cpacl() (fcpacl() ) handles remote copying (via NFS) and copying from HFS to JFS or vice versaafter recognizing failures of acl() , getacl() (fgetacl() ) or setacl() (fsetacl() ) (see acl (2)and setacl (2)). When copying the mode from fromfile (fromfd ) to tofile (tofd ), cpacl() copies the entirefrommode (that is, the file miscellaneous mode bits and the file access permission bits) to tofile (tofd )using chmod() (fchmod() ). Some of the miscellaneous mode bits can be turned off; see chmod(2).

cpacl() (fcpacl() ) can copy an access control list from fromfile (fromfd ) to tofile (tofd ) withouttransferring ownership, but ensuring error checking and handling of remote files. This is done by passingfromuid equal to touid and fromgid equal to togid (that is, four zeros). For remote files, fromuid , touid ,fromgid , and togid are ignored.

RETURN VALUEIf successful, cpacl() and fcpacl() return zero. If an error occurs, they set errno to indicate thecause of failure and return a negative value, as follows:

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−121

A cA

cpacl(3C) cpacl(3C)

−1 Unable to perform acl() or getacl() (fgetacl() ) on a local fromfile (fromfd ).

−2 Unable to perform chmod() (fchmod() ) on tofile (tofd ) to set its file miscellaneous mode bits.cpacl() (fcpacl() ) attempts this regardless of whether a file is local or remote, as long asfromfile (fromfd ) is local.

−3 Unable to perform acl() or setacl() (fsetacl() ) on a local tofile (tofd ). As a consequence,the file’s optional ACL entries are deleted (HFS only), its file access permission bits are zeroed, andits miscellaneous mode bits might be altered.

−4 Unable to perform chmod() (fchmod() ) on tofile (tofd ) to set its mode. As a consequence, iffromfile (fromfd ) is local, tofile ’s (tofd ’s) optional ACL entries are deleted (HFS only), its access per-mission bits are zeroed, and its file miscellaneous mode bits might be altered, regardless of whetherthe file is local or remote.

EXAMPLESThe following code fragment gets stat information on oldfile and copies its file miscellaneous bits andaccess control list to newfile owned by the caller. If either file is remote, only the st_mode on old-file is copied.

#include <sys/types.h>#include <sys/stat.h>

struct stat statbuf;

if (stat ("oldfile", & statbuf) < 0)error (...);

if (cpacl ("oldfile", newfile , statbuf.st_mode,statbuf.st_uid, statbuf.st_gid, geteuid(), getegid()) < 0){error (...);}

DEPENDENCIEScpacl() and fcpacl() are only supported on HFS file system on standard HP-UX operating system.

AUTHORcpacl() and fcpacl() were developed by HP.

SEE ALSOacl(2), chown(2), getacl(2), getegid(2), geteuid(2), getuid(2), setacl(2), stat(2), acltostr(3C), chownacl(3C),strtoacl(3C), acl(5), aclv(5), thread_safety(5).

Section 3−−122 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

cpow(3M) cpow(3M)(Itanium(R)-based System Only)

NAMEcpow( ), cpowf( ), cpowl( ), cpoww( ), cpowq( ) - complex power functions

SYNOPSIS#include <complex.h>

double complex cpow(double complex x, double complex y);

float complex cpowf(float complex x, float complex y);

long double complex cpowl(long double complex x, long double complex y);

extended complex cpoww(extended complex x, extended complex y);

quad complex cpowq(quad complex x, quad complex y);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cpow() returns xy. There is a branch cut for the first parameter along the negative real axis.

cpowf() is a float complex version of cpow() ; it takes float complex arguments and returns afloat complex result.

cpowl() is a long double complex version of cpow() ; it takes long double complex argu-ments and returns a long double complex result.

cpoww() is an extended complex version of cpow() ; it takes a extended complex argumentsand returns an extended complex result.

cpowq() is equivalent to cpowl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use cpoww() or cpowq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcpow( x, y) returns the value calculated by cexp( y*clog( x)) and raises the exceptions from that cal-culation, for non-zero y . (The intermediate calculations may be done to greater precision and range.)

cpow( x,±0±i0) returns 1+i0.

ERRORSNo errors are defined.

SEE ALSOcexp(3M), clog(3M), csqrt(3M), pow(3M), complex(5).

STANDARDS CONFORMANCEcpow() , cpowf() , cpowl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−123

A cA

cproj(3M) cproj(3M)(Itanium(R)-based System Only)

NAMEcproj( ), cprojf( ), cprojl( ), cprojw( ), cprojq( ) - functions that project all infinities onto the one on the posi-tive real axis

SYNOPSIS#include <complex.h>

double complex cproj(double complex z);

float complex cprojf(float complex z);

long double complex cprojl(long double complex z);

extended complex cprojw(extended complex z);

quad complex cprojq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

cproj() returns its argument z, except if the argument is a complex infinity (even if it is a complexinfinity which has one infinite part and one NaN part), then cproj() returns a positive infinity on thereal axis, with imaginary part copysign(0.0,cimag( z )) . It is intended as an aide for modeling theRiemann sphere.

cprojf() is a float complex version of cproj() ; it takes a float complex argument andreturns a float complex result.

cprojl() is a long double complex version of cproj() ; it takes a long double complex argu-ment and returns a long double complex result.

cprojw() is an extended complex version of cproj() ; it takes an extended complex argumentand returns an extended complex result.

cprojq() is equivalent to cprojl() on HP-UX systems.

These functions raise no exceptions.

USAGETo use these functions, compile with the default -Ae option. To use cprojw() or cprojq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

ERRORSNo errors are defined.

SEE ALSOcreal(3M), cimag(3M), complex(5).

STANDARDS CONFORMANCEcproj() , cprojf() , cprojl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

Section 3−−124 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

creal(3M) creal(3M)(Itanium(R)-based System Only)

NAMEcreal( ), crealf( ), creall( ), crealw( ), crealq( ) - the real part of a complex value

SYNOPSIS#include <complex.h>

double creal(double complex z);

float crealf(float complex z);

long double creall(long double complex z);

extended crealw(extended complex z);

quad crealq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

creal() returns the real part of z.

crealf() is a float complex version of creal() ; it takes a float complex argument andreturns a float result.

creall() is a long double complex version of creal() ; it takes a long double complex argu-ment and returns a long double result.

crealw() is an extended complex version of creal() ; it takes an extended complex argumentand returns an extended result.

crealq() is equivalent to creall() on HP-UX systems.

These functions raise no exceptions.

USAGETo use these functions, compile with the default -Ae option. To use crealw() or crealq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

ERRORSNo errors are defined.

SEE ALSOcimag(3M), complex(5).

STANDARDS CONFORMANCEcreal() , crealf() , creall() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−125

A cA

crt0(3) crt0(3)

NAMEcrt0.o - execution startup routines

DESCRIPTIONThe C, aC++, and FORTRAN compilers link in the object file crt0.o for statically-bound programs toprovide startup capabilities and environments for program execution. It contains startup code that mustbe linked using ld(1) to every statically-bound program. In a dynamically linked program (the defaultmethod), the crt0.o object file is not used, and all actions normally associated with it are instead doneby the dynamic loader dld.so (5).

crt0.o processes initializers and terminators. Initializers are routines that are called before the pro-gram entry point and terminators are routines that are called when the program terminates via the exitroutine. Initializers are invoked in reverse order of the link line so that dependent libraries are initial-ized before the libraries that depend on them. Terminators , on the other hand, are invoked in the for-ward order.

crt0.o does not define any variables. It, however, sets the following global variables:

_ _argc A variable of type long containing the number of arguments.

_ _argv An array of character pointers to the arguments themselves.

_environ, __envpAn array of character pointers to the environment in which the program willrun. This array is terminated by a null pointer.

_SYSTEM_ID A variable of type long containing the system id value for an executable pro-gram.

__tls_size A variable of type long containing the requested thread local storage size.This variable is initialized with data from the kernel.

__load_info A variable of type void * containing load information passed from the kernel.

AUTHORThe features described in this entry originated from AT&T UNIX System III.

FILEScrt0.h

SEE ALSOSystem Tools:

aCC(1) invoke the HP-UX aC++ compiler

cc(1) invoke the HP-UX C compilerdld.so (5) the dynamic loaderexec (2) execute a filef90 (1) invoke the HP-UX FORTRAN compilerld(1) invoke the link editor

Miscellaneous:end(3C) symbol of the last locations in program

Section 3−−126 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

crypt(3C) crypt(3C)

NAMEcrypt - generate hashing encryption

SYNOPSIS#include <crypt.h>#include <unistd.h>

char *crypt(const char *key, const char *salt);

Obsolescent Interfaceschar *crypt_r(const char *key, const char *salt, CRYPTD *cd);

void setkey_r(const char *key, CRYPTD *cd);

void encrypt_r(char block[64], int edflag, CRYPTD *cd);

void setkey(const char *key);

void encrypt(char block[64], int edflag);

DESCRIPTIONcrypt( ):

crypt() is the password encryption function. It is based on a one way hashing encryption algorithmwith variations intended (among other things) to frustrate use of hardware implementations of a keysearch.

key is a user’s typed password. salt is a two-character string chosen from the set [a-zA-Z0-9./] ; thisstring is used to perturb the hashing algorithm in one of 4096 different ways, after which the password isused as the key to encrypt repeatedly a constant string. The returned value points to the encrypted pass-word. The first two characters are the salt itself.

Obsolescent Interfacescrypt_r() , setkey_r() , encrypt_r(), setkey(), encrypt() generate hashing encryption.

WARNINGSThe return value for crypt() points to data whose content is overwritten by each call.

crypt_r() , setkey_r() , and encrypt_r() are obsolescent interfaces supported only for compati-bility with existing DCE applications. New multithreaded applications should use crypt() .

SEE ALSOcrypt(1), login(1), passwd(1), getpass(3C), passwd(4), thread_safety(5).

STANDARDS CONFORMANCEcrypt() : SVID2, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−127

A cA

cr_close(3) cr_close(3)

NAMEcr_close - close a crash dump descriptor

SYNOPSIS#include <libcrash.h>

int cr_close(CRASH *crash_cb);

DESCRIPTIONThe cr_close() function closes the crash dump descriptor structure pointed to by crash_cb . Thecrash_cb structure is a crash dump descriptor filled in by a cr_open (3) call. All associated resources(memory and files) are released.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

AUTHORcr_close() was developed by HP.

SEE ALSOcr_open(3), libcrash(5).

Section 3−−128 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cr_info(3) cr_info(3)

NAMEcr_info - retrieve crash dump information

SYNOPSIS#include <libcrash.h>

cr_info_t *cr_info(CRASH *crash_cb);

DESCRIPTIONThe cr_info() function returns a pointer to a cr_info_t structure with information about an opencrash dump.

cr_info_tThe cr_info_t structure contains the following fields. Note that there is no necessary correlationbetween the placement in this list and the order in the structure, and the structure may contain other,reserved fields. In the future, this structure may change in size and should not be copied to avoid compa-tibility problems with various releases.

char *cri_hostname Name of system dumpedchar *cri_model Model string from systemchar *cri_panic Panic messagechar *cri_release Release string from systemchar *cri_dumptime Time of the crash dumpchar *cri_savetime Time crash dump saveduint64_t cri_chunksize Size of uncompressed image files.uint64_t cri_memsize Physical size of memory (bytes)uint64_t cri_num_err Number of error messageschar **cri_errmsg Error messages from INDEX fileuint64_t cri_num_warn Number of warning messageschar **cri_warnmsg Warning messages from INDEX fileuint64_t cri_num_mod Number of module structurescri_modinfo_t *cri_modinfo Array of module structuresuint32_t cri_num_nodes Number of nodesuint32_t cri_monarch_node Physical monarch node number

The fields cri_hostname , cri_model , cri_panic , cri_release , cri_dumptime , and cri_savetime are all null-terminated strings; respectively, representing the name and model of the system that dumped, the panicmessage, the release version string of the kernel, and the times that the system dumped and the dumpwas saved. The amount, in bytes, of physical memory on the system is in cri_memsize . The target size, inbytes, of individual uncompressed image files is in cri_chunksize . cri_errmsg and cri_warnmsg arearrays of null-terminated strings with the list of saved messages. cri_num_err and cri_num_warn are thenumber of strings in each list. cri_modinfo is an array of cri_modinfo_t structures defining theloaded kernel modules; there are cri_num_mod elements in the array. cri_num_nodes is the number ofnodes contained on the machine and cri_monarch_node is the physical node number of the monarch.

cri_modinfo_tThe cri_modinfo_t structure contains information specific to kernel modules loaded into memory atthe time of the system crash. The specific fields are:

char *mdi_loadpath File path when loaded into memorychar *mdi_savepath File path when saved in crash directoryuint64_t mdi_size Size in bytesuint64_t mdi_checksum Checksum of the file from cksum(1)

Again, the order of these fields within the structure is not specified, and other reserved fields may bepresent in the structure.

The caller must not modify any information in any of the structures returned by cr_info() .

RETURN VALUEcr_info() returns a pointer to the cr_info_t structure described above. If crash_cb is not a validdescriptor of a crash dump opened with cr_open() , the return value is undefined.

EXAMPLESAssuming a process opened a crash dump, the following call to cr_info (3) retrieves the information aboutthe open crash dump.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−129

A cA

cr_info(3) cr_info(3)

#include <libcrash.h>

CRASH *crshdes;cr_info_t *cri;

cri = cr_info(crshdes);

AUTHORcr_info() was developed by HP.

SEE ALSOcr_open(3), libcrash(5).

Section 3−−130 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

cr_isaddr(3) cr_isaddr(3)

NAMEcr_isaddr - validate whether physical page number was dumped

SYNOPSIS#include <libcrash.h>

int cr_isaddr(CRASH *crash_cb, uint64_t pagenum, int *avail);

DESCRIPTIONThe cr_isaddr() checks to see if the specified page number, pagenum , is present in the open crashdump represented by crash_cb . It sets the Boolean to which avail points to indicate the presence (1) orabsence (0) of the page.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLESAssuming a process opened a crash dump, the following call to cr_isaddr (3) tests for the availability ofpage 256:

#include <libcrash.h>

CRASH cr_cb;int avail;

int retval = cr_isaddr(&cr_cb, (uint64_t)256, &avail);

if (retval >= 0 && avail > 0) {/* Read and process page 256 */

} /* Else ignore pages that are not available */

AUTHORcr_isaddr() was developed by HP.

SEE ALSOcr_open(3), cr_read(3), libcrash(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−131

A cA

cr_open(3) cr_open(3)

NAMEcr_open() - open crash dump for reading

SYNOPSIS#include <libcrash.h>

int cr_open(const char *path, CRASH **crash_cb, int flags);

DESCRIPTIONThe cr_open() library call opens a crash dump and passes back a crash dump descriptor.

The path argument points to a path name naming a crash dump directory or file, and must not exceedPATH_MAXbytes in length.

The CRASH *to which crash_cb points is set to a crash dump descriptor, which can then be passed to theother cr_* () functions to access the crash dump.

flags is a bitmask of zero or more of the following flag values, which affect the operation of future calls tolibcrash routines for this crash dump, except for cr_verify (3), which has its own flags parameter.

CR_NOCHECKSUM The library will not attempt to verify checksums of files in the crash dump if thisflag is set.

CR_DELAYMSGS The library will write messages to stderr during time-consuming operations(decompressions and checksums) if this flag is set.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLESThe following call to cr_open() opens crash dump contained in the directory/var/adm/crash/core.0 and returns the crash dump descriptor crash_cb . For an example ofreading the crash dump /var/adm/crash/core.0 , see the cr_read (3) manual entry.

#include <libcrash.h>

CRASH *crash_cb;int ret;

ret = cr_open ("/var/adm/crash/core.0", &crash_cb, CR_DELAYMSGS);

AUTHORcr_open() was developed by HP.

SEE ALSOcr_close(3), cr_perror(3), libcrash(5).

Section 3−−132 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cr_perror(3) cr_perror(3)

NAMEcr_perror - print a libcrash error or warning message

SYNOPSIS#include <libcrash.h>

void cr_perror(CRASH *crash_cb, int error);

DESCRIPTIONcr_perror() prints to standard error an error or warning message corresponding to error , whichshould be the return value from an immediately previous call to one of the libcrash calls. The messagedescribes the problem that occurred, explains its implications when appropriate, and gives correctiveaction where appropriate.

If called with a zero error value, indicating success, cr_perror() prints nothing. Therefore, it can becalled after each libcrash call without harm. (If called after cr_verify() with the CR_ERRORMSGSflag set, repeated error messages may result.)

crash_cb should be the same crash dump descriptor as was passed to the call that returned error . If thecall was cr_open() , pass the crash dump descriptor returned by that call, even if it is NULL.

If error is CRERR_ERRNO, indicating that the system variable errno contains the error information,cr_perror() will refer to errno to print the appropriate message. In these cases it is critical thatcr_perror() be called immediately after the offending libcrash call returns.

AUTHORcr_perror () was developed by HP.

SEE ALSOcr_open(3), cr_verify(3), libcrash(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−133

A cA

cr_read(3) cr_read(3)

NAMEcr_read - read from crash dump

SYNOPSIS#include <libcrash.h>

int cr_read(CRASH *crash_cb, void *buf,uint64_t mem_page, int *num_pages);

DESCRIPTIONThe cr_read() function attempts to read the memory area defined by mem_page and num_pages intothe buffer pointed to by buf from the crash dump opened using crash_cb .

The cr_read() starts at the position in the crash dump associated with the physical memory offsetgiven by mem_page . If the physical memory page mem_page does not exist in the crash dump,cr_read() sets *num_pages to 0 and returns 0.

No data transfer will occur past a page of memory that does not exist in the crash dump. If the startingposition, mem_page , plus the read length, *num_pages , goes past an area of memory that does not existin the crash dump, cr_read() sets *num_pages to the number of consecutive pages (starting atmem_page ) actually read.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLESAssuming a process opened a crash dump, the following call to cr_read (3) reads the first CRSIZE pagesfrom the crash dump into the buffer pointed to by mybuf :

#include <libcrash.h>

CRASH in_cb;char mybuf[CRSIZE*NBPG];int rstat;int size = CRSIZE;

rstat = cr_read (in_cb, mybuf, 0, &size);

WARNINGScr_read() may return fewer pages than requested due to implementation details. Always check thenumber of pages returned. If they are fewer than requested, issue a new request starting at the first pagenot returned. Only if that new request reads zero pages (or returns an error) can you be sure that thepage was not dumped.

AUTHORcr_read() was developed by HP.

SEE ALSOcr_open(3), libcrash(5).

Section 3−−134 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cr_set_node(3) cr_set_node(3)

NAMEcr_set_node - set node number

SYNOPSIS#include <libcrash.h>

int cr_set_node(CRASH *crash_cb, int node_num, int *old_node_num);

DESCRIPTIONThe cr_set_node() function expects the physical node number passed in node_num. The nodenumber will be used by cr_read() and cr_isaddr() to access the node private memory contained ona particular node. This function is only valid for ccnumadir (version 4) dumps. If the old_node_numargument is non-NULL, the address referenced by old_node_num will be set to the previous nodenumber. If old_node_num is NULL, the previous node number will not be returned.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLESAssuming a process opened a crash dump, the following call to cr_set_node() sets the physical nodenumber to zero.

#include <libcrash.h>

CRASH *cr_cb;int old_node;int retval;

retval = cr_set_node(cr_cb, 0, &old_node);

AUTHORcr_set_node() was developed by HP.

SEE ALSOcr_open(3), libcrash(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−135

A cA

cr_uncompress(3) cr_uncompress(3)

NAMEcr_uncompress - uncompress a file in a crash dump

SYNOPSIS#include <libcrash.h>

int cr_uncompress(CRASH *crash_cb, const char *pathname,uint64_t size, uint64_t checksum);

DESCRIPTIONThe cr_uncompress() ensures that a file, part of a crash dump described by crash_cb , isuncompressed and matches its expected size and checksum (as computed by cksum(1)). This call is mostoften used to ensure the integrity of module files that are a part of the crash dump; see cr_info (3).

pathname is the name of the file to uncompress. Supported compression methods include gzip(1), whichappends a .gz to the filename, and compress (1), which appends .Z . Respectively, size and checksum arethe expected size and checksum of the uncompressed file. Either validity check can be disabled by speci-fying zero for the corresponding parameter.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLEThe following call to cr_uncompress(3) ensures that the kernel file vmunix is uncompressed and vali-dated.

#include <libcrash.h>

result = cr_uncompress (crash, "vmunix", vmunix_size, vmunix_cksum);

AUTHORcr_uncompress() was developed by HP.

SEE ALSOgunzip(1), uncompress(1), cr_info(3), cr_open(3), libcrash(5).

Section 3−−136 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cr_verify(3) cr_verify(3)

NAMEcr_verify - verify integrity of crash dump

SYNOPSIS#include <libcrash.h>

int cr_verify(CRASH *crash_cb, int flags);

DESCRIPTIONcr_verify() uncompresses and verifies the sizes and checksums of every file in the crash dumpidentified by crash_cb .

flags is a bitmask of zero or more of the following flag values:

CR_NOCHECKSUM cr_verify() will not attempt to verify checksums of files in the crash dump ifthis flag is set. Only sizes will be verified.

CR_DELAYMSGS cr_verify() will write messages to stderr during time-consuming operations(decompressions and checksums) if this flag is set.

CR_ERRORMSGS cr_verify() will write messages to stderr describing any validation problemsthat are encountered. If this flag is set, cr_perror() should not be calledwhen cr_verify() returns; repeated error messages would result.

RETURN VALUEReturns zero for success. Other possible return values are described in libcrash (5).

EXAMPLESThe following call to cr_verify (3) verifies the integrity of the dump.

#include <libcrash.h>

CRASH *crash_cb;int ret;

ret = cr_verify(crash_cb, CR_DELAYMSGS | CR_ERRORMSGS);

WARNINGSBecause it uncompresses and checksums all files in a dump, cr_verify() can be very time-consuming.If CR_DELAYMSGSwas not specified, the calling application should notify its user before callingcr_verify() that there may be a significant delay.

AUTHORcr_verify() was developed by HP.

SEE ALSOcr_open(3), cr_perror(3), libcrash(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−137

A cA

csin(3M) csin(3M)(Itanium(R)-based System Only)

NAMEcsin( ), csinf( ), csinl( ), csinw( ), csinq( ) - complex sine functions

SYNOPSIS#include <complex.h>

double complex csin(double complex z);

float complex csinf(float complex z);

long double complex csinl(long double complex z);

extended complex csinw(extended complex z);

quad complex csinq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

csin() returns the complex sine of z.

csinf() is a float complex version of csin() ; it takes a float complex argument and returns afloat complex result.

csinl() is a long double complex version of csin() ; it takes a long double complex argu-ment and returns a long double complex result.

csinw() is an extended complex version of csin() ; it takes an extended complex argumentand returns an extended complex result.

csinq() is equivalent to csinl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use csinw() or csinq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcsin(conj( z)) = conj(csin( z)) and csin is odd.

csin( +0+i0) returns +0+i0.

csin( +Inf+i0) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified) andraises the invalid floating-point exception.

csin( +NaN+i0) returns NaN±i0 (where the sign of the imaginary part of the result is unspecified).

csin( Inf+iy) returns NaN+iNaN and raises the invalid floating-point exception, for positive finite y .

csin( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitenonzero y .

csin( +0+iInf) returns +0+iInf.

csin( +x+iInf) returns +Inf(sin( y)+icos( y)) , for positive finite x .

csin( +Inf+iInf) returns NaN±iInf (where the sign of the imaginary part of the result is unspecified)and raises the invalid floating-point exception.

csin( +NaN+iInf) returns +NaN±iInf (where the sign of the imaginary part of the result is unspecified).

csin( 0+iNaN) returns 0+iNaN.

csin( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers x .

csin( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOsin(3M), casin(3M), complex(5).

Section 3−−138 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

csin(3M) csin(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEcsin() , csinf() , csinl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−139

A cA

csinh(3M) csinh(3M)(Itanium(R)-based System Only)

NAMEcsinh( ), csinhf( ), csinhl( ), csinhw( ), csinhq( ) - complex hyperbolic sine functions

SYNOPSIS#include <complex.h>

double complex csinh(double complex z);

float complex csinhf(float complex z);

long double complex csinhl(long double complex z);

extended complex csinhw(extended complex z);

quad complex csinhq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

csinh() returns the complex hyperbolic sine of z.

csinhf() is a float complex version of csinh() ; it takes a float complex argument andreturns a float complex result.

csinhl() is a long double complex version of csinh() ; it takes a long double complex argu-ment and returns a long double complex result.

csinhw() is an extended complex version of csinh() ; it takes an extended complex argumentand returns an extended complex result.

csinhq() is equivalent to csinhl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use csinhw() or csinhq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcsinh(conj( z)) = conj(csinh( z)) and csinh is odd.

csinh( +0+i0) returns +0+i0.

csinh( +0+iInf) returns ±0+iNaN (where the sign of the real part of the result is unspecified) and raisesthe invalid floating-point exception.

csinh( +0+iNaN) returns ±0+iNaN (where the sign of the real part of the result is unspecified).

csinh( x+iInf) returns NaN+iNaN and raises the invalid floating-point exception, for positive finite x .

csinh( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitenonzero x .

csinh( +Inf+i0) returns +Inf+i0.

csinh( +Inf+iy) returns +Inf(cos( y)+isin( y)) , for positive finite y .

csinh( +Inf+iInf) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified) andraises the invalid floating-point exception.

csinh( +Inf+iNaN) returns ±Inf+iNaN (where the sign of the real part of the result is unspecified).

csinh( NaN+i0) returns NaN+i0.

csinh( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers y .

csinh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOsinh(3M), casinh(3M), complex(5).

Section 3−−140 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

csinh(3M) csinh(3M)(Itanium(R)-based System Only)

STANDARDS CONFORMANCEcsinh() , csinhf() , csinhl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−141

A cA

csqrt(3M) csqrt(3M)(Itanium(R)-based System Only)

NAMEcsqrt( ), csqrtf( ), csqrtl( ), csqrtw( ), csqrtq( ) - complex square root functions

SYNOPSIS#include <complex.h>

double complex csqrt(double complex z);

float complex csqrtf(float complex z);

long double complex csqrtl(long double complex z);

extended complex csqrtw(extended complex z);

quad complex csqrtq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

csqrt() returns the complex square root of z in the range of the right half-plane (including the ima-ginary axis). There is a branch cut along the negative real axis.

csqrtf() is a float complex version of csqrt() ; it takes a float complex argument andreturns a float complex result.

csqrtl() is a long double complex version of csqrt() ; it takes a long double complex argu-ment and returns a long double complex result.

csqrtw() is an extended complex version of csqrt() ; it takes an extended complex argumentand returns an extended complex result.

csqrtq() is equivalent to csqrtl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use csqrtw() or csqrtq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEcsqrt(conj( z)) = conj(csqrt( z)) .

csqrt( ±0+i0) returns +0+i0.

csqrt( x+iInf) returns +Inf+iInf, for all x (including NaN).

csqrt( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitex .

csqrt( -Inf+iy) returns +0+iInf, for finite positive-signed y .

csqrt( +Inf+iy) returns +Inf+i0, for finite positive-signed y .

csqrt( -Inf+iNaN) returns NaN±iInf (where the sign of the imaginary part of the result is unspecified).

csqrt( +Inf+iNaN) returns +Inf+iNaN.

csqrt( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitey .

csqrt( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOsqrt(3M), cpow(3M), complex(5).

STANDARDS CONFORMANCEcsqrt() , csqrtf() , csqrtl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

Section 3−−142 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ctan(3M) ctan(3M)(Itanium(R)-based System Only)

NAMEctan( ), ctanf( ), ctanl( ), ctanw( ), ctanq( ) - complex tangent functions

SYNOPSIS#include <complex.h>

double complex ctan(double complex z);

float complex ctanf(float complex z);

long double complex ctanl(long double complex z);

extended complex ctanw(extended complex z);

quad complex ctanq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

ctan() returns the complex tangent of z.

ctanf() is a float complex version of ctan() ; it takes a float complex argument and returns afloat complex result.

ctanl() is a long double complex version of ctan() ; it takes a long double complex argu-ment and returns a long double complex result.

ctanw() is an extended complex version of ctan() ; it takes an extended complex argumentand returns an extended complex result.

ctanq() is equivalent to ctanl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use ctanw() or ctanq() , compile withthe -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEctan(conj( z)) = conj(ctan( z)) and ctan is odd.

ctan( +0+i0) returns +0+i0.

ctan( Inf+iy) returns NaN+iNaN and raises the invalid floating-point exception, for finite y .

ctan( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finite y .

ctan( +x+iInf) returns 0sin( 2x)+ i1, for positive-signed finite x .

ctan( +Inf+iInf) returns ±0+i1 (where the sign of the real part of the result is unspecified).

ctan( +NaN+iInf) returns ±01+i1 (where the sign of the real part of the result is unspecified).

ctan( 0+iNaN) returns 0+iNaN.

ctan( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers x .

ctan( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOtan(3M), catan(3M), complex(5).

STANDARDS CONFORMANCEctan() , ctanf() , ctanl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complex arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−143

A cA

ctanh(3M) ctanh(3M)(Itanium(R)-based System Only)

NAMEctanh( ), ctanhf( ), ctanhl( ), ctanhw( ), ctanhq( ) - complex hyperbolic tangent functions

SYNOPSIS#include <complex.h>

double complex ctanh(double complex z);

float complex ctanhf(float complex z);

long double complex ctanhl(long double complex z);

extended complex ctanhw(extended complex z);

quad complex ctanhq(quad complex z);

DESCRIPTIONThese functions are available only for Itanium-based systems.

ctanh() returns the complex hyperbolic tangent of z.

ctanhf() is a float complex version of ctanh() ; it takes a float complex argument andreturns a float complex result.

ctanhl() is a long double complex version of ctanh() ; it takes a long double complex argu-ment and returns a long double complex result.

ctanhw() is an extended complex version of ctanh() ; it takes an extended complex argumentand returns an extended complex result.

ctanhq() is equivalent to ctanhl() on HP-UX systems.

USAGETo use these functions, compile with the default -Ae option. To use ctanhw() or ctanhq() , compilewith the -fpwidetypes option. Make sure your program includes <complex.h> . Link in the mathlibrary by specifying -lm on the compiler or linker command line.

RETURN VALUEctanh(conj( z)) = conj(ctanh( z)) and ctanh is odd.

ctanh( +0+i0) returns +0+i0.

ctanh( x+iInf) returns NaN+iNaN and raises the invalid floating-point exception, for finite x .

ctanh( x+iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finitex .

ctanh( +Inf+iy) returns 1+i0sin( 2y) , for positive-signed finite y .

ctanh( +Inf+iInf) returns 1±i0 (where the sign of the imaginary part of the result is unspecified).

ctanh( +Inf+iNaN) returns 1±i0 (where the sign of the imaginary part of the result is unspecified).

ctanh( NaN+i0) returns NaN+i0.

ctanh( NaN+iy) returns NaN+iNaN and optionally raises the invalid floating-point exception, for allnonzero numbers y .

ctanh( NaN+iNaN) returns NaN+iNaN.

ERRORSNo errors are defined.

SEE ALSOtanh(3M), catanh(3M), complex(5).

STANDARDS CONFORMANCEctanh() , ctanhf() , ctanhl() : ISO/IEC C99 (including Annex G, ‘‘IEC 60559-compatible complexarithmetic’’)

Section 3−−144 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ctermid(3S) ctermid(3S)

NAMEctermid( ) - generate file name for terminal

SYNOPSIS#include <stdio.h>

char *ctermid(char *s);

DESCRIPTIONctermid() generates a string that, when used as a pathname, refers to the the controlling terminal forthe current process.

If s is a NULL pointer, the string is stored in an internal static area, the contents of which are overwrittenat the next call to ctermid() , and the address of which is returned. Otherwise, s is assumed to point toa character array of at least L_ctermid elements; the path name is placed in this array and the value ofs is returned. The constant L_ctermid is defined in the <stdio.h > header file.

If the process has no controlling terminal, the pathname for the controlling terminal cannot be deter-mined, or some other error occurs, ctermid() returns an empty string.

For multi-thread applications, if s is a NULL pointer, the operation is not performed and a NULL pointeris returned.

NOTESThe difference between ctermid() and ttyname() is that ttyname() must be handed a file descrip-tor and returns the actual name of the terminal associated with that file descriptor, while ctermid()returns a string (/dev/tty ) that refers to the terminal if used as a file name. (see ttyname (3C)). Thusttyname() is useful only if the process already has at least one file open to a terminal.

SEE ALSOttyname(3C), thread_safety(5).

STANDARDS CONFORMANCEctermid() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−145

A cA

ctime(3C) ctime(3C)

NAMEctime( ), ctime_r( ), localtime( ), localtime_r( ), gmtime( ), gmtime_r( ), mktime( ), difftime( ), asctime( ),asctime_r( ), timezone( ), daylight( ), tzname( ), tzset( ) - convert date and time to string

SYNOPSIS#include <time.h>

char *asctime(const struct tm *timeptr);

char *asctime_r(const struct tm *timeptr, char *buffer);

char *ctime(const time_t *timer);

char *ctime_r(const time_t *timer, char *buffer);

double difftime(time_t time1, time_t time0);

struct tm *gmtime(const time_t *timer);

struct tm *gmtime_r(const time_t *timer, struct tm *result);

struct tm *localtime(const time_t *timer);

struct tm *localtime_r(const time_t *timer, struct tm *result);

time_t mktime(struct tm *timeptr);

extern long timezone;

extern int daylight;

extern char *tzname[2];

void tzset(void);

DESCRIPTIONasctime() Convert the broken-down time contained in the structure pointed to by timeptr and

return a pointer to a 26-character string in the form:

Sun Sep 16 01:03:52 1973\n\0

All the fields have constant width.

asctime() returns NULL and sets errno to ERANGEif tm_year in timeptr is lessthan 0 or is greater than 8099. In both 32-bit and 64-bit HP-UX, the minimum datesupported by asctime() is January 1 00:00:00 1900 and the maximum date sup-ported by asctime() is December 31 23:59:59 9999.

asctime_r() is identical to asctime() , except that it places the result in the user suppliedbuffer and returns a pointer to buffer upon success. A buffer length of at least26 is required.

ctime() Convert the calendar time pointed to by timer , representing the time in seconds sincethe Epoch, and return a pointer to the local time in the form of a string. Equivalentto:

asctime(localtime(timer))

The minimum date supported by ctime() in both 32-bit and 64-bit HP-UX is FridayDecember 13 20:45:52 UTC 1901. The maximum dates supported by ctime() areTuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC 9999in 32-bit HP-UX and 64-bit HP-UX, respectively.

In 64-bit HP-UX, ctime() returns NULL and sets errno to ERANGEif timer is lessthan the number of seconds that corresponds to the minimum date supported (i.e.,INT_MIN , as defined in limits.h ), or exceeds the number of seconds thatcorresponds to the maximum date supported.

ctime_r() is identical to ctime() , except that it places the result in the user supplied bufferand returns a pointer to buffer upon success. A buffer length of at least 26 isrequired.

gmtime() Convert directly to Coordinated Universal Time (UTC), the time standard used by theHP-UX operating system. gmtime() returns a pointer to the tm structuredescribed below.

Section 3−−146 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ctime(3C) ctime(3C)

The minimum date supported by gmtime() in both 32-bit and 64-bit HP-UX is Fri-day December 13 20:45:52 UTC 1901. The maximum dates supported by gmtime()are Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC9999 in 32-bit HP-UX and 64-bit HP-UX, respectively.

In 64-bit HP-UX, gmtime() returns NULL and sets errno to ERANGEif timer is lessthan the number of seconds that corresponds to the minimum date supported (i.e.,INT_MIN , as defined in limits.h ), or exceeds the number of seconds thatcorresponds to the maximum date supported.

gmtime_r() is identical to gmtime() , except that gmtime_r() stores the result in the tmstruct pointed to by result and returns result upon success.

localtime() Correct for the time zone and any summer time zone adjustments (such as DaylightSavings Time in the USA), according to the contents of the TZ environment variable(see Environment Variables below). localtime() returns a pointer to the tmstructure described below.

The minimum date supported by localtime() in both 32-bit and 64-bit HP-UX isFriday December 13 20:45:52 UTC 1901. The maximum dates supported by local-time() are Tuesday January 19 03:14:07 UTC 2038 and Friday December 3123:59:59 UTC 9999 in 32-bit HP-UX and 64-bit HP-UX, respectively.

In 64-bit HP-UX, localtime() returns NULL and sets errno to ERANGEif timer isless than the number of seconds that corresponds to the minimum date supported(i.e., INT_MIN, as defined in limits.h ), or exceeds the number of seconds thatcorresponds to the maximum date supported.

localtime_r() is identical to localtime() , except that localtime_r() stores the result in thetm struct pointed to by result and returns result upon success.

difftime() Return the difference in seconds between two calendar times: time1 - time0 .

mktime() Convert the broken-down time (expressed as local time) in the structure pointed to bytimeptr into a calendar time value with the same encoding as that of the valuesreturned by time (2). The original values of the tm_wday and tm_yday com-ponents of the structure are ignored, and the original values of the other componentsare not restricted to the ranges indicated below.

A positive or zero value for tm_isdst causes mktime() to initially presume thatDaylight Saving Time respectively is or is not in effect for the specified time. A nega-tive value for tm_isdst causes mktime() to attempt to determine whether Day-light Saving Time is in effect for the specified time.

Upon successful completion, all the components are set to represent the specifiedcalendar time, but with their values forced to the ranges indicated below. The finalvalue of tm_mday is not set until tm_mon and tm_year are determined.mktime() returns the specified calendar time encoded as a value of type time_t .

If the calendar time cannot be represented, the function returns the value(time_t ) — 1 and sets errno to ERANGE. Note the value (time_t ) — 1 alsocorresponds to the time 23:59:59 on Dec 31, 1969 (plus or minus time zone and Day-light Saving Time adjustments). Thus it is necessary to check both the return valueand errno to reliably detect an error condition.

tzset() Sets the values of the external variables timezone , daylight , and tzname according tothe contents of the TZ environment variable (independent of any time value). Thefunctions localtime() , mktime() , ctime() , asctime() , and strftime()(see strftime (3C)) call tzset() and use the values returned in the external vari-ables described below for their operations. tzset() can also be called directly bythe user.

When the environment variable TZ is not set, tzset() checks the default file/etc/default/tz for the timezone value and sets timezone values based on that.The file /etc/default/tz contains the timezone value used by tzset() whenthe environment variable TZ is not set. The format for the file is same as TZ formatwithout the prefix TZ=. Please check environ (5) for TZ format. The order of TZ set-ting is as follows.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−147

A cA

ctime(3C) ctime(3C)

1) if the environment variable TZ is present, it takes precedence.

2) if TZ is not present, then the value contained in /etc/default/tz is used forthe default.

3) if /etc/default/tz is not set then the default value is equivalent to EST5EDT(Eastern Standard Time) of the USA.

/etc/default/tz can be modified for an appropriate default value for timezone.

The <time.h > header file contains declarations of all relevant functions and externals. It also containsthe tm structure, which includes the following members:

int tm_sec; /* seconds after the minute - [0,61] */int tm_min; /* minutes after the hour - [0,59] */int tm_hour; /* hours - [0,23] */int tm_mday; /* day of month - [1,31] */int tm_mon; /* month of year - [0,11] */int tm_year; /* years since 1900 */int tm_wday; /* days since Sunday - [0,6] */int tm_yday; /* days since January 1 - [0,365] */int tm_isdst; /* daylight savings time flag */

The value of tm_isdst is positive if a summer time zone adjustment such as Daylight Savings Time isin effect, zero if not in effect, and negative if the information is not available.

The external variable timezone contains the difference, in seconds, between UTC and local standardtime (for example, in the U.S. Eastern time zone (EST), timezone is 5∗60∗60). The external variabledaylight is non-zero only if a summer time zone adjustment is specified in the TZ environment vari-able. The external variable tzname[2] contains the local standard and local summer time zone abbre-viations as specified by the TZ environment variable.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the interpretation of the bytes within format as single and/ormulti-byte characters.

Environment VariablesThe tzset() function uses the contents of TZ to set the values of the external variables timezone ,daylight , and tzname . TZ also determines the time zone name substituted for the %Zand %zdirectives and the time zone adjustments performed by localtime() , mktime() , and ctime() . Twomethods for specifying a time zone within TZ are described in environ (5).

International Code Set SupportSingle- and multi-byte character code sets are supported.

RETURN VALUEFor asctime_r() and ctime_r() , if the buffer is of insufficient length, a NULL is returned anderrno set to EINVAL.

asctime_r() , ctime_r() , gmtime_r() , and localtime_r() return a NULL and set errno toEINVAL if NULL pointers are passed in as arguments.

A NULL is returned and errno is set to ERANGEif the input to the following routines is not within thesupported range: asctime() , asctime_r() , ctime() , ctime_r() , gmtime() , gmtime_r() ,localtime() , localtime_r() .

APPLICATION USAGEThe return values for asctime() , ctime() , gmtime() , and localtime() point to static datawhose contents is overwritten by each call.

WARNINGSUsers of asctime_r() , ctime_r() , gmtime_r() , and localtime_r() should also note that thesefunctions now conform to POSIX.1c. The old prototypes of these functions are supported for compatibilitywith existing DCE applications only.

The range of tm_sec([0,61]) extends to 61 to allow for the occasional one or two leap seconds. How-ever, the ‘‘seconds since the Epoch’’ value returned by time (2) and passed as the timer argument does not

Section 3−−148 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A cA

ctime(3C) ctime(3C)

include accumulated leap seconds. The tm structure generated by localtime() and gmtime() willnever reflect any leap seconds. Upon successful completion, mktime() forces the value of the tm_seccomponent to the range [0,59].

AUTHORctime() was developed by AT&T and HP.

SEE ALSOtime(2), getdate(3C), setlocale(3C), strftime(3C), tztab(4), environ(5), lang(5), langinfo(5),thread_safety(5).

STANDARDS CONFORMANCEctime() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

asctime() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

daylight : AES, SVID2, SVID3, XPG2, XPG3, XPG4

difftime() : AES, SVID3, XPG4, ANSI C

gmtime() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

localtime() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

mktime() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

timezone : AES, SVID3, XPG2, XPG3, XPG4

tzname : AES, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

tzset() : AES, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

asctime_r() , ctime_r() , localtime_r() , gmtime_r() : POSIX.1c

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−149

A cA

ctype(3C) ctype(3C)

NAMEisalpha( ), isupper( ), islower( ), isdigit( ), isxdigit( ), isalnum( ), isspace( ), ispunct( ), isprint( ), isgraph( ),iscntrl( ), isascii( ) - classify characters

SYNOPSIS#include <ctype.h>

int isalnum(int c);int isalpha(int c);int iscntrl(int c);int isdigit(int c);int isgraph(int c);int islower(int c);int isprint(int c);int ispunct(int c);int isspace(int c);int isupper(int c);int isxdigit(int c);int isascii(int c);

DESCRIPTIONThese functions classify character-coded integer values according to the rules of the coded character setidentified by the last successful call to setlocale() (see setlocale (3C)). Each function is a predicatereturning non-zero for true, zero for false.

If setlocale() has not been called successfully, characters are classified according to the rules of thedefault ASCII 7-bit coded character set (see setlocale (3C)).

isascii() is defined on all integer values; the other functions are defined for the range -1 (EOF)through 255 .

The functions return non-zero under the following circumstances; zero otherwise:

isalpha( c) c is a letter.

isupper( c) c is an uppercase letter.

islower( c) c is a lowercase letter.

isdigit( c) c is a decimal digit (in ASCII: characters [0-9]).

isxdigit( c) c is a hexadecimal digit (in ASCII: characters [0-9], [A-F] or [a-f]).

isalnum( c) c is an alphanumeric (letters or digits).

isspace( c) c is a character that creates ‘‘white space’’ in displayed text (in ASCII: space, tab,carriage return, new-line, vertical tab, and form-feed).

ispunct( c) c is a punctuation character (in ASCII: any printing character except the spacecharacter (040), digits, letters).

isprint( c) c is a printing character.

isgraph( c) c is a visible character (in ASCII: printing characters, excluding the space char-acter (040)).

iscntrl( c) c is a control character (in ASCII: character codes less than 040 and the deletecharacter (0177)).

isascii( c) c is any ASCII character code between 0 and 0177, inclusive.

If the argument to any of these functions is outside the domain of the function, the result is undefined.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the classification of character type.

International Code Set SupportSingle-byte character code sets are supported.

Section 3−−150 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

ctype(3C) ctype(3C)

WARNINGSThese functions are supplied both as library functions and as macros defined in the <ctype.h > header.Normally, the macro versions are used. To obtain the library function, either use a #undef to removethe macro definition or, if compiling in ANSI-C mode, enclose the function name in parenthesis or take itsaddress. The following example uses the library functions for isalpha() , isdigit() , andisspace() :

#include <ctype.h>#undef isalpha

...main(){

int (*ctype_func)();...if ( isalpha(c) )

...if ( (isdigit)(c) )

...ctype_func = isspace;

...}

AUTHORctype() was developed by IBM, OSF, and HP.

SEE ALSOsetlocale(3C), ascii(5), thread_safety(5).

STANDARDS CONFORMANCEisalnum() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isalpha() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isascii() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

iscntrl() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isdigit() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isgraph() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

islower() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isprint() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

ispunct() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isspace() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isupper() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

isxdigit() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−151

A cA

curscr(3X) curscr(3X)(ENHANCED CURSES)

NAMEcurscr — current window

SYNOPSIS#include <curses.h>

extern WINDOW *curscr;

DESCRIPTIONThe external variable curscr points to an internal data structure. It can be specified as an argument tocertain functions, such as clearok() , where permitted in this specification.

SEE ALSOclearok(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−152 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

NAMEcurses( ) - Terminal and printer handling and optimization package

DESCRIPTIONUse and Implementation of Interfaces

These routines provide a method for updating screens with reasonable optimization in a terminalindependent manner. Each of the following statements applies unless explicitly stated otherwise in thedetailed descriptions that follow. If an argument to a function has an invalid value (such as a value out-side the domain of the function, or a pointer outside the address space of the program, or a null pointer),the behaviour is undefined. Any function declared in a header may also be implemented as a macrodefined in the header, so a library function should not be declared explicitly if its header is included. Anymacro definition of a function can be suppressed locally by enclosing the name of the function inparentheses, because the name is then not followed by the left parenthesis that indicates expansion of amacro function name. For the same syntactic reason, it is permitted to take the address of a library func-tion even if it is also defined as a macro. The use of the C-language #undef construct to remove any suchmacro definition will also ensure that an actual function is referred to. Any invocation of a library func-tion that is implemented as a macro will expand to code that evaluates each of its arguments exactly once,fully protected by parentheses where necessary, so it is generally safe to use arbitrary expressions asarguments. Likewise, those function-like macros described in the following sections may be invoked in anexpression anywhere a function with a compatible return type could be called.

Provided that a library function can be declared without reference to any type defined in a header, it isalso permissible to declare the function, either explicitly or implicitly, and use it without including itsassociated header. If a function that accepts a variable number of arguments is not declared (explicitly orby including its associated header), the behaviour is undefined.

As a result of changes introduced in this version of the Curses Specification , application writers are onlyrequired to include the minimum number of headers. Implementations of XSI-conformant systems willmake all necessary symbols visible as described in the Headers section of this document.

C Language DefinitionThe C language that is the basis for the synopses and code examples in this document is ISO C, asspecified in the referenced ISO C standard. Common Usage C, which refers to the C language beforestandardisation, was the basis for previous editions of this specification.

The Compilation EnvironmentApplications should ensure that the feature test macro _XOPEN_SOURCE is defined before inclusion ofany header. This is needed to enable the functionality described in this document, and possibly to enablefunctionality defined elsewhere in the Common Applications Environment.

The _XOPEN_SOURCE macro may be defined automatically by the compilation process, but to ensuremaximum portability, applications should make sure that _XOPEN_SOURCE is defined by using eithercompiler options or #define directives in the source files, before any #include directives. Identifiers inthis document may only be undefined using the #undef directive. These #undef directives must followall #include directives of any headers.

Most strictly conforming POSIX and ISO C applications will compile on systems compliant to thisspecification. However, an application which uses any of the items marked as an extension to POSIX andISO C, for any purpose other than that shown here, may not compile. In such cases, it may be necessaryto alter those applications to use alternative identifiers.

Since this document is aligned with the ISO C standard, and since all functionality enabled by the_POSIX_C_SOURCE set equal to 2 should be enabled by _XOPEN_SOURCE, there should be no need todefine either _POSIX_SOURCE or _POSIX_C_SOURCE if _XOPEN_SOURCE is defined. Therefore if_XOPEN_SOURCE is defined and _POSIX_SOURCE is defined, or _POSIX_C_SOURCE is set equal to 1or 2, the behaviour is the same as if only _XOPEN_SOURCE is defined. However should_POSIX_C_SOURCE be set to a value greater than 2, the behaviour is undefined.

The c89 and cc utilities recognise the additional −−l operand for standard libraries:

−−l curses This operand makes visible all library functions referenced in this specification,(except for those labelled ENHANCED CURSES and except for portions markedwith the EC margin legend).

If the implementation defines _XOPEN_CURSES and if the application defines the_XOPEN_SOURCE_EXTENDED feature test macro, then -l curses also makes

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−153

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

visible all library functions referenced in this specification and labelledENHANCED CURSES.

An application that uses any API specified as ENHANCED CURSES must define_XOPEN_SOURCE_EXTENDED = 1 in each source file or as part of its compilation environment. When_XOPEN_SOURCE_EXTENDED = 1 is defined in a source file, it must appear before any header isincluded.

If the implementation supports the utilities marked DEVELOPMENT in the Curses Specification , the lintutility recognises the additional −−l curses operand for standard libraries:

−−l curses Names the library llib-lcurses.ln , which will contain functions specified in thisdocument.

It is unspecified whether the library llib-lcurses.ln exists as a regular file.

The X/Open Name Space (ENHANCED CURSES)The requirements in this section are in effect only for implementations that claim Enhanced Curses com-pliance.

All identifiers in this document are defined in at least one of the headers <curses.h> , <term.h> ,<unctrl.h> . When _XOPEN_SOURCE is defined, each header defines or declares some identifiers,potentially conflicting with identifiers used by the application. The set of identifiers visible to the applica-tion consists of precisely those identifiers from the header pages of the included headers, as well as addi-tional identifiers reserved for the implementation. In addition, some headers may make visibleidentifiers from other headers as indicated on the relevant header pages.

The identifiers reserved for use by the implementation are described below.

1 Each identifier with external linkage described in the header section is reserved for useas an identifier with external linkage if the header is included.

2 Each macro name described in the header section is reserved for any use if the header isincluded.

3 Each identifier with file scope described in the header section is reserved for use as anidentifier with file scope in the same name space if the header is included.

4 All identifiers consisting of exactly 2 upper-case letters.

If any header in the following table is included, identifiers with the prefixes, suffixes or complete namesshown are reserved for use by the implementation.

Header Prefix Suffix CompleteName

<curses.h> add, attr, get, in, mousr, mv,scr, slk, un, wadd, wattr, wbkg, win

ANY header _t

If any header in the following table is included, macros with the prefixes shown may be defined. After thelast inclusion of a given header, an application may use identifiers with the corresponding prefixes for itsown purpose, provided their use is preceded by an #undef of the corresponding macro.

Header Prefix<curses.h> A_, ACS_, ALL_, BUTTON, COLOR_, KEY_, MOUSE, REPORT_,

WA_, WACS_<term.h> ext_

The following identifiers are reserved regardless of the inclusion of headers:

1 All identifiers that begin with an underscore and either an upper-case letter or anotherunderscore are always reserved for any use by the implementation.

2 All identifiers that begin with an underscore are always reserved for use as identifierswith file scope in both the ordinary identifier and tag name spaces.

3 All identifiers listed as reserved in the X/Open System Interfaces and Headers, Issue 4,Version 2 specification are reserved for use as identifiers with external linkage.

All the identifiers defined in this document that have external linkage are always reserved for use asidentifiers with external linkage.

Section 3−−154 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

No other identifiers are reserved.

Applications must not declare or define identifiers with the same name as an identifier reserved in thesame context. Since macro names are replaced whenever found, independent of scope and name space,macro names matching any of the reserved identifier names must not be defined if any associated headeris included.

Headers may be included in any order, and each may be included more than once in a given scope, withno difference in effect from that of being included only once.

If used, a header must be included outside of any external declaration or definition, and it must be firstincluded before the first reference to any type or macro it defines, or to any function or object it declares.However, if an identifier is declared or defined in more than one header, the second and subsequent asso-ciated headers may be included after the initial reference to the identifier. Prior to the inclusion of aheader, the program must not define any macros with names lexically identical to symbols defined by thatheader.

Interfaces Implemented as Macros (ENHANCED CURSES)The requirements in this section are in effect only for implementations that claim Enhanced Curses com-pliance.

The following interfaces with arguments must be implemented as macros. The relevance to the applica-tion programmer is that the ‘&’ character cannot be used before the arguments.

Macros Man PageCOLOR_PAIR( ), PAIR_NUMBER( ) can_change_color( )getbegyx ( ), getmaxyx ( ), getparyx ( ), getyx ( ) getbegyx( )

The descriptions in <curses.h> , <term.h> , <unctrl.h> list other macros, like COLOR_BLACK,that do not take arguments.

Relationship to the X/Open System Interfaces and Headers, Issue 4, Version 2 specificationError Numbers

Most functions provide an error number in errno , which is either a variable or macro defined in<errno.h> ; the macro expands to a modifiable lvalue of type int .

A list of valid values for errno and advice to application writers on the use of errno appears in theX/Open System Interfaces and Headers, Issue 4, Version 2 specification .

Data TypesAll of the data types used by Curses functions are defined by the implementation. The following listdescribes these types:

attr_t An integral type that can contain at least an unsigned short. The type attr_t is usedto hold an OR-ed set of attributes defined in <curses.h> that begin with the prefixWA_.

bool Boolean data type

chtype An integral type that can contain at least an unsigned char and attributes. Values oftype chtype are formed by OR-ing together an unsigned char value and zero or moreof the base attribute flags defined in <curses.h> that have the A_ prefix. The appli-cation can extract these components of a chtype value using the base masks defined in<curses.h> for this purpose.

The chtype data type also contains a colour-pair. Values of type chtype are formed by OR-ingtogether an unsigned char value, a colour pair, and zero or more of the attributes defined in<curses.h> that begin with the prefix A_. The application can extract these components of achtype value using the masks defined in <curses.h> for this purpose.

SCREEN An opaque terminal representation.

wchar_t As described in <stddef.h> .

cchar_t A type that can reference a string of wide characters of up to an implementation-dependent length, a colour-pair, and zero or more attributes from the set of all attri-butes defined in this document. A null cchar_t object is an object that references aempty wide-character string. Arrays of cchar_t objects are terminated by a nullcchar_t object.

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−155

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

WINDOW An opaque window representation.

Interface OverviewComponents

A Curses initialisation function, usually initscr() , determines the terminal model in use, by referenceto either an argument or an environment variable. If that model is defined in terminfo, then the sameterminfo entry tells Curses exactly how to operate the terminal.

In this case, a comprehensive API lets the application perform terminal operations. The Curses run-timesystem receives each terminal request and sends appropriate commands to the terminal to achieve thedesired effect.

Relationship to the X/Open System Interface Definitions, Issue 4, Version 2 specificationApplications using Curses should not also control the terminal using capabilities of the general terminalinterface defined in the X/Open System Interface Definitions, Issue 4, Version 2 specification, Chapter 9,General Terminal Interface .

There is no requirement that the paradigms that exist while in Curses mode be carried over outside theCurses environment (see the def_prog_mode() page).

Relationship to SignalsCurses implementations may provide for special handling of the SIGINT, SIGQUIT and SIGTSTP signalsif their disposition is SIGDFL at the time initscr() is called (see the initscr() page).

Any special handling for these signals may remain in effect for the life of the process or until the processchanges the disposition of the signal.

None of the Curses functions are required to be safe with respect to signals (see sigaction() in theX/Open System Interfaces and Headers, Issue 4, Version 2 specification).

The behaviour of Curses with respect to signals not defined by the X/Open System Interfaces andHeaders, Issue 4, Version 2 specification is unspecified.

Screens, Windows and TerminalsScreen

A screen is the physical output device of the terminal. In Curses, a SCREEN data type is an opaquedata type associated with a terminal. Each window (see below) is associated with a SCREEN.

WindowsThe Curses functions permit manipulation of window objects, which can be thought of as two-dimensionalarrays of characters and their renditions. A default window called stdscr , which is the size of the termi-nal screen, is supplied. Others may be created with newwin() .

Variables declared as WINDOW * refer to windows (and to subwindows, derived windows, and pads, asdescribed below). These data structures are manipulated with functions described on the referencemanual pages in terminfo(4). Among the most basic functions are move() and addch() . More generalversions of these functions are included that allow a process to specify a window.

After using functions to manipulate a window, refresh() is called, telling Curses to make the CRTscreen look like stdscr .

Line drawing characters may be specified to be output. On input, Curses is also able to translate arrowand function keys that transmit escape sequences into single values. The line drawing characters andinput values use names defined in <curses.h> .

Each window has a flag that indicates that the information in the window could differ from the informa-tion displayed on the terminal device. Making any change to the contents of the window, moving or modi-fying the window, or setting the window’s cursor position, sets this flag (touches the window).

SubwindowsA subwindow is a window, created within another window (called the parent window ), and positionedrelative to the parent window. A subwindow can be created by calling derwin() , newpad() orsubwin() . Changes made to a subwindow do not affect its parent window.

Subwindows can be created from a parent window by calling subwin() . The position and size ofsubwindows on the screen must be identical to or totally within the parent window. Changes to either theparent window or the subwindow affect both. Window clipping is not a property of subwindows.

Section 3−−156 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

AncestorsThe term ancestor refers to a window’s parent, or its parent, or so on.

Derived WindowsDerived windows are subwindows whose position is defined by reference to the parent window ratherthan in absolute screen coordinates. Derived windows are otherwise no different from subwindows.

PadsA pad is a specialised case of subwindow that is not necessarily associated with a viewable part of ascreen. Functions that deal with pads are all discussed in newpad() .

TerminalA terminal is the logical input and output device through which character-based applications interactwith the user. TERMINAL is an opaque data type associated with a terminal. A TERMINAL datastructure primarily contains information about the capabilities of the terminal, as defined by terminfo.A TERMINAL also contains information about the terminal modes and current state for input and out-put operations. Each screen (see above) is associated with a TERMINAL.

CharactersCharacter Storage Size

Historically, a position on the screen has corresponded to a single stored byte. This correspondence is nolonger true for several reasons:

• Some characters may occupy several columns when displayed on the screen (see Multi-columnCharacters ).

• Some characters may be non-spacing characters, defined only in association with a spacingcharacter (see Non-spacing Characters (ENHANCED CURSES) ).

• The number of bytes to hold a character from the extended character sets depends on theLC_CTYPE locale category.

The internal storage format of characters and renditions is unspecified. There is no implied correspon-dence between the internal storage format and the external representation of characters and renditionsin objects of type chtype and cchar_t.

Multi-column CharactersSome character sets define multi-column characters that occupy more than one column position whendisplayed on the screen.

Writing a character whose width is greater than the width of the destination window is an error.

AttributesEach character can be displayed with attributes such as underlining, reverse video or colour on terminalsthat support such display enhancements. Current attributes of a window are applied to all charactersthat are written into the window with waddch() , wadd_wch() , waddstr() , waddchstr() ,waddwstr() , waddwchstr() and wprintw() . Attributes can be combined.

Attributes can be specified using constants with the A_ prefix specified in <curses.h> . The A_ con-stants manipulate attributes in objects of type chtype. Additional attributes can be specified using con-stants with the WA_ prefix. The WA_ constants manipulate attributes in objects of type attr_t.

Two constants that begin with A_ and WA_ and that represent the same terminal capability refer to thesame attribute in the terminfo database and in the window data structure. The effect on a window doesnot differ depending on whether the application specifies A_ or WA_ constants. For example, when anapplication updates window attributes using the interfaces that support the A_ values, a query of the win-dow attribute using the function that returns WA_ values reflects this update. When it updates windowattributes using the interfaces that support the WA_ values, for which corresponding A_ values exist, aquery of the window attribute using the function that returns A_ values reflects this update.

RenditionThe rendition of a character displayed on the screen is its attributes and a colour pair.

The rendition of a character written to the screen becomes a property of the character and moves with thecharacter through any scrolling and insert/delete line/character operations. To the extent possible on aparticular terminal, a character’s rendition corresponds to the graphic rendition of the character put onthe screen.

HP-UX 11i Version 2: August 2003 − 5 − Hewlett-Packard Company Section 3−−157

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

If a given terminal does not support a rendition that an application program is trying to use, Curses maysubstitute a different rendition for it.

Colours are always used in pairs (referred to as colour-pairs). A colour-pair consists of a foregroundcolour (for characters) and a background colour (for the field on which the characters are displayed).

Non-spacing CharactersThe requirements in this section are in effect only for implementations that claim Enhanced Curses com-pliance.

Some character sets may contain non-spacing characters. (Non-spacing characters are those for whichwcwidth() returns a width of zero.) The application may write non-spacing characters to a window.Every non-spacing character in a window is associated with a spacing character and modifies the spacingcharacter. Non-spacing characters in a window cannot be addressed separately. A non-spacing characteris implicitly addressed whenever a Curses operation affects the spacing character with which the non-spacing character is associated.

Non-spacing characters do not support attributes. For interfaces that use wide characters and attributes,the attributes are ignored if the wide character is a non-spacing character. Multi-column characters havea single set of attributes for all columns. The association of non-spacing characters with spacing charac-ters can be controlled by the application using the wide character interfaces. The wide character stringfunctions provide codeset-dependent association.

Two typical effects of a non-spacing character associated with a spacing character called c, are as follows:

• The non-spacing character may modify the appearance of c. (For instance, there may be non-spacing characters that add diacritical marks to characters. However, there may also be spac-ing characters with built-in diacritical marks.)

• The non-spacing character may bridge c to the character following c. (Examples of this usageare the formation of ligatures and the conversion of characters into compound display forms,words, or ideograms.)

Implementations may limit the number of non-spacing characters that can be associated with a spacingcharacter, provided any limit is at least 5.

Complex CharactersA complex character is a set of associated characters, which may include a spacing character and mayinclude any non-spacing characters associated with it. A spacing complex character is a spacing charac-ter followed by any non-spacing characters associated with it. That is, a spacing complex character is acomplex character that includes one spacing character. An example of a code set that has complex char-acters is ISO/IEC 10646-1:1993.

A complex character can be written to the screen; if it does not include a spacing character, any non-spacing characters are associated with the spacing complex character that exists at the specified screenposition. When the application reads information back from the screen, it obtains spacing complex char-acters.

The cchar_t data type represents a complex character and its rendition. When a cchar_t represents anon-spacing complex character (that is, when there is no spacing character within the complex character),then its rendition is not used; when it is written to the screen, it uses the rendition specified by the spac-ing character already displayed.

An object of type cchar_t can be initialised using setcchar() and its contents can be extracted usinggetcchar() . The behaviour of functions that take a cchar_t input argument is undefined if the appli-cation provides a cchar_t value that was not initialised in this way or obtained from a Curses functionthat has a cchar_t output argument.

Window PropertiesAssociated with each window are the following properties that affect the placing of characters into thewindow (see Rendition of Characters Placed into a Window in curses_intro).

Window RenditionEach window has a rendition, which is separate from the rendition component of the window’s back-ground property described below.

Section 3−−158 Hewlett-Packard Company − 6 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

Window BackgroundEach window has a background property. The background property specifies:

• A spacing complex character (the background character) that will be used in a variety of situa-tions where visible information is deleted from the screen.

• A rendition to use in displaying the background character in those situations, and in othersituations specified in Rendition of Characters Placed into a Window in curses_intro.

Conceptual OperationsScreen Addressing

Many Curses functions use a coordinate pair. In the DESCRIPTION, coordinate locations arerepresented as (y, x) since the y argument always precedes the x argument in the function call. Thesecoordinates denote a line/column position, not a character position.

The coordinate y always refers to the row (of the window), and x always refers to the column. The firstrow and the first column is number 0, not 1. The position (0, 0) is the window’s origin .

For example, for terminals that display the ISO 8859-1 character set (with left-to-right writing), (0, 0)represents the upper left-hand corner of the screen.

Functions that start with mv take arguments that specify a (y, x) position and move the cursor (as thoughmove() were called) before performing the requested action. As part of the requested action, furthercursor movement may occur, specified on the respective reference manual page.

Basic Character OperationsAdding (Overwriting)

The Curses functions that contain the word add, such as addch() , actually specify one or more charac-ters to replace (overwrite) characters already in the window. If these functions specify only non-spacingcharacters, they are appended to a spacing character already in the window; see also Non-spacing Char-acters (ENHANCED CURSES) .

When replacing a multi-column character with a character that requires fewer columns, the new charac-ter is added starting at the specified or implied column position. All columns that the former multi-column character occupied that the new character does not require are orphaned columns, which arefilled using the background character and rendition.

Replacing a character with a character that requires more columns also replaces one or more subsequentcharacters on the line. This process may also produce orphaned columns.

Truncation, Wrapping and ScrollingIf the application specifies a character or a string of characters such that writing them to a window wouldextend beyond the end of the line (for example, if the application tries to deposit any multi-column char-acter at the last column in a line), the behaviour depends on whether the function supports line wrap-ping:

• If the function does not wrap, it fails.

• If the function wraps, then it places one or more characters in the window at the start of thenext line, beginning with the first character that would not completely fit on the original line.

If the final character on the line is a multi-column character that does not completely fit on the line,the entire character wraps to the next line and columns at the end of the original line may beorphaned.

If the original line was the last line in the window, the wrap may cause a scroll to occur:

— If scrolling is enabled, a scroll occurs. The contents of the first line of the window arelost. The contents of each remaining line in the window move to the previous line. Thelast line of the window is filled with any characters that wrapped. Any remaining spaceon the last line is filled with the background character and rendition.

— If scrolling is disabled, any characters that would extend beyond the last column of thelast line are truncated.

The scrollok() function enables and disables scrolling.

Some add functions move the cursor just beyond the end of the last character added. If this position isbeyond the end of a line, it causes wrapping and scrolling under the conditions specified in the secondbullet above.

HP-UX 11i Version 2: August 2003 − 7 − Hewlett-Packard Company Section 3−−159

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

InsertionInsertion functions (such as insch() ) insert characters immediately before the character at thespecified or implied cursor position.

The insertion shifts all characters that were formerly at or beyond the cursor position on the cursor linetoward the end of that line. The disposition of the characters that would thus extend beyond the end ofthe line depends on whether the function supports wrapping:

• If the function does not wrap, those characters are removed from the window. This may pro-duce orphaned columns.

• If the function supports wrapping, the effect is as described above in truncation (except thatthe overwriting discussed in the final dash is an insertion).

If multi-column characters are displayed, some cursor positions are within a multi-column character butnot at the beginning of a character. Any request to insert data at a position that is not the beginning of amulti-column character will be adjusted so that the actual cursor position is at the beginning of themulti-column character in which the requested position occurs.

There are no warning indications relative to cursor relocation. The application should not maintain animage of the cursor position, since this constitutes placing terminal-specific information in the applicationand defeats the purpose of using Curses.

Portable applications cannot assume that a cursor position specified in an insert function is a reusableindication of the actual cursor position.

DeletionDeletion functions (such as delch() ) delete the simple or complex character at the specified or impliedcursor position, no matter which column of the character this is. All column positions are replaced bythe background character and rendition and the cursor is not relocated. If a character-deletion operationwould cause a previous wrapping operation to be undone, then the results are unspecified.

Window OperationsOverlapping a window (that is, placing one window on top of another) and overwriting a window (that is,copying the contents of one window into another) follows the operation of overwriting multi-column glyphs around its edge. Any orphaned columns are handled as in the character operations.

Characters that Straddle the Subwindow BorderA subwindow can be defined such that multi-column characters straddle the subwindow border. Thecharacter operations deal with these straddling characters as follows:

• Reading the subwindow with a function such as in_wch() reads the entire straddling charac-ter.

• Adding, inserting or deleting in the subwindow deletes the entire straddling character beforethe requested operation begins and does not relocate the cursor.

• Scrolling lines in the subwindow has the following effects:

— A straddling character at the start of the line is completely erased before the scroll opera-tion begins.

— A straddling character at the end of the line moves in the direction of the scroll and con-tinues to straddle the subwindow border. Column positions outside the subwindow at thestraddling character’s former position are orphaned unless another straddling characterscrolls into those positions.

If the application calls a function such as border() , the above situations do not occur because writingthe border on the subwindow deletes any straddling characters.

In the above cases involving multi-column characters, operations confined to a subwindow can modify thescreen outside the subwindow. Therefore, saving a subwindow, performing operations within the subwin-dow, and then restoring the subwindow may disturb the appearance of the screen. To overcome theseeffects (for example, for pop-up windows), the application should refresh the entire screen.

Special CharactersSome functions process special characters as specified below.

In functions that do not move the cursor based on the information placed in the window, these specialcharacters would only be used within a string in order to affect the placement of subsequent characters;

Section 3−−160 Hewlett-Packard Company − 8 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

the cursor movement specified below does not persist in the visible cursor beyond the end of the opera-tion. In functions that do move the cursor, these special characters can be used to affect the placement ofsubsequent characters and to achieve movement of the visible cursor.

<backspace> Unless the cursor was already in column 0, <backspace> moves the cursor onecolumn toward the start of the current line and any characters after the <back-space> are added or inserted starting there.

<carriage return>Unless the cursor was already in column 0, <carriage return> moves the cursorto the start of the current line. Any characters after the <carriage return> areadded or inserted starting there.

<newline> In an add operation, Curses adds the background character into successivecolumns until reaching the end of the line. Scrolling occurs as described inTruncation, Wrapping and Scrolling in curses_intro. Any characters after the<newline> character are added at the start of the new line.

In an insert operation, <newline> moves the cursor to the start of a new line(causing scrolling as described in Truncation, Wrapping and Scrolling incurses_intro). Any characters after the <newline> character are placed at thestart of the new line.

The filter() function may inhibit this processing.

<tab> Tab characters in text move subsequent characters to the next horizontal tabstop. By default, tab stops are in column 0, 8, 16, and so on.

In an insert or add operation, Curses inserts or adds, respectively, the background character intosuccessive columns until reaching the next tab stop. If there are no more tab stops in the currentline, wrapping and scrolling occur as described in Truncation, Wrapping and Scrolling incurses_intro.

Control CharactersThe Curses functions that perform special-character processing conceptually convert control characters tothe caret (’ˆ ’) character followed by a second character (which is an upper-case letter if it is alphabetic)and write this string to the window in place of the control character. The functions that retrieve textfrom the window will not retrieve the original control character.

Rendition of Characters Placed into a WindowWhen the application adds or inserts characters into a window, the effect is as follows:

If the character is not the space character, then the window receives:

• the character that the application specifies

• the colour that the application specifies; or the window colour, if the application does notspecify a colour

• the attributes specified, OR-ed with the window attributes.

If the character is the space character, then the window receives:

• the background character

• the colour that the application specifies; or the background colour, if the application does notspecify a colour

• the attributes specified, OR-ed with the background attributes.

Input ProcessingThe Curses input model provides a variety of ways to obtain input from the keyboard.

Keypad ProcessingThe application can enable or disable keypad translation by calling keypad() . When translation isenabled, Curses attempts to translate a sequence of terminal input that represents the pressing of a func-tion key into a single key code. When translation is disabled, Curses passes terminal input to the appli-cation without such translation, and any interpretation of the input as representing the pressing of akeypad key must be done by the application.

HP-UX 11i Version 2: August 2003 − 9 − Hewlett-Packard Company Section 3−−161

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

The complete set of key codes for keypad keys that Curses can process is specified by the constantsdefined in <curses.h> whose names begin with ‘‘KEY_’’. Each terminal type described in the ter-minfo database may support some or all of these key codes. The terminfo database specifies thesequence of input characters from the terminal type that correspond to each key code (see Keypad in ter-minfo (4)).

The Curses implementation cannot translate keypad keys on terminals where pressing the keys does nottransmit a unique sequence.

When translation is enabled and a character that could be the beginning of a function key (such asescape) is received, Curses notes the time and begins accumulating characters. If Curses receives addi-tional characters that represent the pressing of a keypad key, within an unspecified interval from thetime the first character was received, then Curses converts this input to a key code for presentation to theapplication. If such characters are not received during this interval, translation of this input does notoccur and the individual characters are presented to the application separately. (Because Curses waitsfor this interval to accumulate a key code, many terminals experience a delay between the time a userpresses the escape key and the time the escape is returned to the application.)

In addition, No Timeout Mode provides that in any case where Curses has received part of a function keysequence, it waits indefinitely for the complete key sequence. The ‘‘unspecified interval’’ in the previousparagraph becomes infinite in No Timeout Mode. No Timeout Mode allows the use of function keys overslow communication lines. No Timeout Mode lets the user type the individual characters of a functionkey sequence, but also delays application response when the user types a character (not a function key)that begins a function key sequence. For this reason, in No Timeout Mode many terminals will appear tohang between the time a user presses the escape key and the time another key is pressed. No TimeoutMode is switchable by calling notimeout() .

If any special characters (see Special Characters in curses_intro) are defined or redefined to be charactersthat are members of a function key sequence, then Curses will be unable to recognise and translate thosefunction keys.

Several of the modes discussed below are described in terms of availability of input. If keypad translationis enabled, then input is not available once Curses has begun receiving a keypad sequence until thesequence is completely received or the interval has elapsed.

Input ModeThe X/Open System Interface Definitions, Issue 4, Version 2 specification (Special Characters ) definesflow-control characters, the interrupt character, the erase character, and the kill character. Fourmutually-exclusive Curses modes let the application control the effect of these input characters:

Section 3−−162 Hewlett-Packard Company − 10 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

Input Mode EffectThis achieves normal line-at-a-time processing withall special characters handled outside the application.This achieves the same effect as canonical-mode inputprocessing as specified in the X/Open System Inter-face Definitions, Issue 4, Version 2 specification . Thestate of the ISIG and IXON flags are not changedupon entering this mode by calling cbreak (), and areset upon entering this mode by calling noraw ().

Cooked Mode

The implementation supports erase and kill charac-ters from any supported locale, no matter what thewidth of the character is.

Characters typed by the user are immediately avail-able to the application and Curses does not performspecial processing on either the erase character or thekill character. An application can select cbreak modeto do its own line editing but to let the abort characterbe used to abort the task. This mode achieves thesame effect as non-canonical-mode, Case B input pro-cessing (with MIN set to 1 and ICRNL cleared) asspecified in the X/Open System Interface Definitions,Issue 4, Version 2 specification. The state of the ISIGand IXON flags are not changed upon entering thismode.

cbreak Mode

The effect is the same as cbreak, except that inputfunctions wait until a character is available or aninterval defined by the application elapses, whichevercomes first. This mode achieves the same effect asnon-canonical-mode, Case C input processing (withTIME set to the value specified by the application) asspecified in the X/Open System Interface Definitions,Issue 4, Version 2 specification . The state of the ISIGand IXON flags are not changed upon entering thismode.

Half-Delay Mode

Raw mode gives the application maximum controlover terminal input. The application sees each char-acter as it is typed. This achieves the same effect asnon-canonical mode, Case D input processing asspecified in the X/Open System Interface Definitions,Issue 4, Version 2 specification . The ISIG and IXONflags are cleared upon entering this mode.

Raw Mode

The terminal interface settings are recorded when the process calls initscr() or newterm() to ini-tialise Curses and restores these settings when endwin() is called. The initial input mode for Cursesoperations is unspecified unless the implementation supports Enhanced Curses compliance, in which theinitial input mode is cbreak mode.

The behaviour of the BREAK key depends on other bits in the display driver that are not set by Curses.

Delay ModeTwo mutually-exclusive delay modes specify how quickly certain Curses functions return to the applica-tion when there is no terminal input waiting when the function is called:

No Delay The function fails.

Delay The application waits until the implementation passes text through to the applica-tion. If cbreak or Raw Mode is set, this is after one character. Otherwise, this isafter the first <newline> character, end-of-line character, or end-of-file character.

The effect of No Delay Mode on function key processing is unspecified.

HP-UX 11i Version 2: August 2003 − 11 − Hewlett-Packard Company Section 3−−163

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

Echo ProcessingEcho mode determines whether Curses echoes typed characters to the screen. The effect of Echo mode isanalogous to the effect of the ECHO flag in the local mode field of the termios structure associated withthe terminal device connected to the window. However, Curses always clears the ECHO flag while it isoperating, to inhibit the operating system from performing echoing. The method of echoing characters isnot identical to the operating system’s method of echoing characters, because Curses performs additionalprocessing of terminal input.

If in Echo mode, Curses performs its own echoing: Any visible input character is stored in the current orspecified window by the input function that the application called, at that window’s cursor position, asthough addch() were called, with all consequent effects such as cursor movement and wrapping.

If not in Echo mode, any echoing of input must be performed by the application. Applications often per-form their own echoing in a controlled area of the screen, or do not echo at all, so they disable Echo mode.

The Set of Curses FunctionsThe Curses functions allow: overall screen, window and pad manipulation; output to windows and pads;reading terminal input; control over terminal and Curses input and output options; environment queryfunctions; colour manipulation; use of soft label keys; access to the terminfo database of terminal capa-bilities; and access to low-level functions.

Function Name ConventionsThe reference manual pages present families of multiple Curses functions. Most function families havedifferent functions that give the programmer the following options:

• A function with the basic name operates on the window stdscr . A function with the same nameplus the w prefix operates on a window specified by the win argument.

When the reference manual page for a function family refers to the current or specifiedwindow, it means stdscr for the basic functions and the window specified by win for any wfunction.

Functions whose names have the p prefix require an argument that is a pad instead of a win-dow.

• A function with the basic name operates based on the current cursor position (of the current orspecified window, as described above). A function with the same name plus the mv prefixmoves the cursor to a position specified by the y and x arguments before performing thespecified operation.

When the reference manual page for a function family refers to the current or specifiedposition, it means the cursor position for the basic functions and the position (y, x) for any mvfunction.

The mvw prefix exists and combines the mv semantics discussed here with the w semanticsdiscussed above. The window argument is always specified before the coordinates.

• A function with the basic name is often provided for historical compatibility and operates onlyon single-byte characters. A function with the same name plus the w infix operates on wide(multi-byte) characters. A function with the same name plus the _w infix operates on complexcharacters and their renditions.

• When a function with the basic name operates on a single character, there is sometimes afunction with the same name plus the n infix that operates on multiple characters. An n argu-ment specifies the number of characters to process. The respective manual page specifies theoutcome if the value of n is inappropriate.

Section 3−−164 Hewlett-Packard Company − 12 − HP-UX 11i Version 2: August 2003

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

Function Families ProvidedFunction Names Description s w c Refer to

Add (Overwrite)[mv][w]addch(3X) add a character Y Y Y addch(3X)[mv][w]addch[n]str(3X) add a character string N N N addchstr(3X)[mv][w]add[n]str(3X) add a string Y Y Y addnstr(3X)[mv][w]add[n]wstr(3X) add a wide character string Y Y Y addnwstr(3X)[mv][w]add_wch(3X) add a wide character and rendition Y Y Y add_wch(3X)[mv][w]add_wch[n]str(3X) add an array of wide characters and renditions ? N N add_wchnstr(3X)

Change Renditions[mv][w]chgat(3X) change renditions of characters in a window - N N chgat(3X)

Delete[mv][w]delch(3X) delete a character - - N delch(3X)

Get (Input from Keyboard to Window)[mv][w]getch(3X) get a character Y Y Y getch(3X)[mv][w]get[n]str(3X) get a character string Y Y Y getnstr(3X)[mv][w]get_wch(3X) get a wide character Y Y Y get_wch(3X)[mv][w]get[n]_wstr(3X) get an array of wide characters and key codes Y Y Y get_wstr(3X)

Explicit Cursor Movement[w]move(3X) move the cursor - - - move(3X)

Input (Read Back from Window)[mv][w]inch(3X) input a character - - - inch(3X)[mv][w]inch[n]str(3X) input an array of characters and attributes - - - inchnstr(3X)[mv][w]in[n]str(3X) input a string - - - innstr(3X)[mv][w]in[n]wstr(3X) input a string of wide characters - - - innwstr(3X)[mv][w]in_wch(3X) input a wide character and rendition - - - in_wch(3X)[mv][w]in_wch[n]str(3X) input an array of wide characters and renditions - - - inwchnstr(3X)

Insert[mv][w]insch(3X) insert a character Y N N insch(3X)[mv][w]ins[n]str(3X) insert a character string Y N N insnstr(3X)[mv][w]ins_[n]wstr(3X) insert a wide-character string Y N N ins_nwstr(3X)[mv][w]ins_wch(3X) insert a wide character Y N N ins_wch(3X)

Print and Scan[mv][w]printw(3X) print formatted output - - - mvprintw(3X)[mv][w]scanw(3X) convert formatted output - - - mvscanw(3X)

LegendThe following notation indicates the effect when characters are moved to the screen. (For the Get func-tions, this applies only when echoing is enabled.)

s Y means these functions perform special-character processing (see Special Characters incurses_intro). N means they do not. ? means the results are unspecified when these functionsare applied to special characters.

w Y means these functions perform wrapping (see Truncation, Wrapping and Scrolling incurses_intro). N means they do not.

c Y means these functions advance the cursor (see Truncation, Wrapping and Scrolling incurses_intro). N means they do not.

- The attribute specified by this column does not apply to these functions.

Interfaces Implemented as MacrosThe following interfaces with arguments must be implemented as macros. The relevance to the applica-tion programmer is that the ‘&’ character cannot be used before the arguments.

Macros Man page EntryCOLOR_PAIR( ) can_change_color( )getbegyx ( ), getmaxyx ( ), getparyx ( ), getyx ( ) getbegyx ( )

The header file reference manual pages list other macros, like COLOR_BLACK, that do not take argu-ments.

HP-UX 11i Version 2: August 2003 − 13 − Hewlett-Packard Company Section 3−−165

A cA

curses_intro(3X) curses_intro(3X)(X/Open CURSES)

Initialised Curses EnvironmentBefore executing an application that uses Curses, the terminal must be prepared as follows:

• If the terminal has hardware tab stops, they should be set.

• Any initialisation strings defined for the terminal must be output to the terminal.

The resulting state of the terminal must be compatible with the model of the terminal that Curses has, asreflected in the terminal’s entry in the terminfo database (see terminfo (4)).

To initialise Curses, the application must call initscr() or newterm() before calling any of the otherfunctions that deal with windows and screens, and it must call endwin() before exiting. To getcharacter-at-a-time input without echoing (most interactive, screen-oriented programs want this), the fol-lowing sequence should be used:

initscr();cbreak();noecho();

Most programs would additionally use the sequence:

nonl();intrflush( stdscr , FALSE);keypad( stdscr , TRUE);

Synchronous and Networked Asynchronous TerminalsThis section indicates to the application writer some considerations to be borne in mind when driving syn-chronous, networked asynchronous (NWA) or non-standard directly-connected asynchronous terminals.

Such terminals are often used in a mainframe environment and communicate to the host in block mode.That is, the user types characters at the terminal then presses a special key to initiate transmission of thecharacters to the host.

Frequently, although it may be possible to send arbitrary sized blocks to the host, it is not possible ordesirable to cause a character to be transmitted with only a single keystroke.

This can cause severe problems to an application wishing to make use of single-character input; see InputProcessing in curses_intro.

OutputThe Curses interface can be used in the normal way for all operations pertaining to output to the termi-nal, with the possible exception that on some terminals the refresh() routine may have to redraw theentire screen contents in order to perform any update.

If it is additionally necessary to clear the screen before each such operation, the result could be undesir-able.

InputBecause of the nature of operation of synchronous (block-mode) and NWA terminals, it might not be pos-sible to support all or any of the Curses input functions. In particular, the following points should benoted:

• Single-character input might not be possible. It may be necessary to press a special key tocause all characters typed at the terminal to be transmitted to the host.

• It is sometimes not possible to disable echo. Character echo may be performed directly by theterminal. On terminals that behave in this way, any Curses application that performs inputshould be aware that any characters typed will appear on the screen at wherever the cursor ispositioned. This does not necessarily correspond to the position of the cursor in the window.

SEE ALSOcurses(5).

Section 3−−166 Hewlett-Packard Company − 14 − HP-UX 11i Version 2: August 2003

A cA

curs_set(3X) curs_set(3X)(ENHANCED CURSES)

NAMEcurs_set — set the cursor mode

SYNOPSIS#include <curses.h>

int curs_set(int visibility);

DESCRIPTIONThe curs_set() function sets the appearance of the cursor based on the value of visibility :

Value of visibility Appearance of Cursor0 Invisible1 Terminal-specific normal mode2 Terminal-specific high visibility mode

The terminal does not necessarily support all the above values.

RETURN VALUEIf the terminal supports the cursor mode specified by visibility , then curs_set() returns the previouscursor state. Otherwise, the function returns ERR.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−167

A cA

cur_term(3X) cur_term(3X)(ENHANCED CURSES)

NAMEcur_term — current terminal information

SYNOPSIS#include <term.h>

extern TERMINAL *cur_term;

DESCRIPTIONThe external variable cur_term identifies the record in the terminfo database associated with the terminalcurrently in use.

SEE ALSOdel_curterm(3X), tigetflag(3X), <term.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−168 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A cA

cuserid(3S) cuserid(3S)(TO BE OBSOLETED)

NAMEcuserid( ) - get character login name of the user

SYNOPSIS#include <stdio.h>

char *cuserid(char *s);

Remarks:Because this function behaved differently in previous releases of HP-UX, and behaves differentlyon other systems, its use is not recommended. It is provided only for conformance to currentindustry standards, and is subject to withdrawal in future releases of HP-UX.

For portability and security, application writers and maintainers should search their existing codeand replace references to cuserid() with equivalent calls to getpwuid (getuid() ),getpwuid (geteuid() ), or getlogin() , depending on which user name is desired.

DESCRIPTIONcuserid() generates a character-string representation of the user name corresponding to the effectiveuser ID of the process. If s is a NULL pointer, this representation is generated in an internal static area,the address of which is returned. Otherwise, s is assumed to point to an array of at least L_cuseridcharacters; the representation is left in this array. The constant L_cuserid is defined in the<stdio.h > header file.

For multi-thread applications, if s is a NULL pointer, the operation is not performed and a NULL pointeris returned.

DIAGNOSTICSIf the login name cannot be found, cuserid() returns a NULL pointer; if s is not a NULL pointer, a nullcharacter (\0 ) is placed at s[0].

WARNINGSObsolescent Interfaces

csuserid() is to be obsoleted at a future date.

SEE ALSOgeteuid(2), getuid(2), getlogin(3C), getpwent(3C), getpwuid(3C), thread_safety(5).

STANDARDS CONFORMANCEcuserid() : AES, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−169

A dA

datalock(3C) datalock(3C)

NAMEdatalock( ) - lock process into memory after allocating data and stack space

SYNOPSIS#include <sys/lock.h>

int datalock(size_t datsiz, size_t stsiz);

DESCRIPTIONdatalock() allocates at least datsiz bytes of data space and stsiz bytes of stack space, then locks theprogram in memory. The data space is allocated by malloc() (see malloc (3C)). After the program islocked, this space is released by free() (see malloc (3C)), making it available for use. This allows thecalling program to use that much space dynamically without receiving the SIGSEGVsignal.

The effective user ID of the calling process must be super-user or be a member of or have an effectivegroup ID of a group having PRIV_MLOCK access to use this call (see setprivgrp (2) in getprivgrp (2)).

EXAMPLESThe following call to datalock() allocates 4096 bytes of data space and 2048 bytes of stack space, thenlocks the process in memory:

datalock (4096, 2048);

RETURN VALUEdatalock() returns -1 if malloc() cannot allocate enough memory or if plock() returned anerror (see plock (2)).

WARNINGSMultiple datalocks cannot be the same as one big one.

Methods for calculating the required size are not yet well developed.

AUTHORdatalock() was developed by HP.

SEE ALSOgetprivgrp(2), plock(2), thread_safety(5).

Section 3−−170 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dbm(3C) dbm(3C)

NAMEdbminit, fetch, store, delete, firstkey, nextkey, dbmclose - database subroutines

SYNOPSIS#include <dbm.h>

int dbminit(const char *file);

datum fetch(datum key);

int store(datum key, datum content);

int delete(datum key);

datum firstkey(void);

datum nextkey(datum key);

int dbmclose(void);

DESCRIPTIONThese functions maintain key/content pairs in a database. They handle very large (a billion blocks (block= 1024 bytes)) databases and can locate a keyed item in one or two file system accesses.

key and content parameters are described by the datum type. A datum specifies a string of dsize bytespointed to by dptr . Arbitrary binary data, as well as normal ASCII strings, are allowed. The database isstored in two files. One file is a directory containing a bit map of keys and has .dir as its suffix. Thesecond file contains all data and has .pag as its suffix.

Before a database can be accessed, it must be opened by dbminit . At the time of this call, the filesfile .dir and file .pag must exist. (An empty database is created by creating zero-length .dir and.pag files.)

Once open, data stored under a key is accessed by fetch , and data is placed under a key by store . Stor-ing data on an existing key replaces the existing data. A key (and its associated contents) is deleted bydelete . A linear pass through all keys in a database can be made, in (apparently) random order byusing firstkey and nextkey . firstkey returns the first key in the database. With any key,nextkey returns the next key in the database. The following code can be used to traverse the database:

for (key = firstkey(); key.dptr != NULL; key = nextkey(key))

A database can be closed by calling dbmclose. A currently open database must be closed before open-ing a new one.

DIAGNOSTICSAll functions that return an int indicate errors with negative values and success with zero. Functionsthat return a datum indicate errors with a null dptr .

WARNINGSThe dbm functions provided in this library should not be confused in any way with those of a general-purpose database management system such as ALLBASE/HP-UX SQL. These functions do not provide formultiple search keys per entry, they do not protect against multi-user access (in other words they do notlock records or files), and they do not provide the many other useful data base functions that are found inmore robust database management systems. Creating and updating databases by use of these functionsis relatively slow because of data copies that occur upon hash collisions. These functions are useful forapplications requiring fast lookup of relatively static information that is to be indexed by a single key.

The .pag file will contain holes so that its apparent size is about four times its actual content. Someolder UNIX systems create real file blocks for these holes when touched. These files cannot be copied bynormal means (such as cp (1), cat (1), tar (1), or ar (1)) without expansion.

dptr pointers returned by these subroutines point into static storage that is changed by subsequent calls.

The sum of the sizes of a key/content pair must not exceed the internal block size (currently 1024 bytes).Moreover, all key/content pairs that hash together must fit on a single block. store returns an error ifa disk block fills with inseparable data.

delete does not physically reclaim file space, although it does make it available for reuse.

The order of keys presented by firstkey and nextkey depends on a hashing function, not on any-thing interesting.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−171

A dA

dbm(3C) dbm(3C)

A store or delete during a pass through the keys by firstkey and nextkey may yield unex-pected results.

AUTHORdbm(3C) was developed by the University of California, Berkeley.

SEE ALSOndbm(3X).

Section 3−−172 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A dA

def_prog_mode(3X) def_prog_mode(3X)(CURSES)

NAMEdef_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode — save or restore program or shellterminal modes

SYNOPSIS#include <curses.h>

int def_prog_mode(void);

int def_shell_mode(void);

int reset_prog_mode(void);

int reset_shell_mode(void);

DESCRIPTIONThe def_prog_mode() function saves the current terminal modes as the ‘‘program’’ (in Curses) statefor use by reset_prog_mode() .

The def_shell_mode() function saves the current terminal modes as the ‘‘shell’’ (not in Curses) statefor use by reset_shell_mode() .

The reset_prog_mode() function restores the terminal to the ‘‘program’’ (in Curses) state.

The reset_shell_mode() function restores the terminal to the ‘‘shell’’ (not in Curses) state.

These functions affect the mode of the terminal associated with the current screen.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe initscr() function achieves the effect of calling def_shell_mode() to save the prior terminalsettings so they can be restored during the call to endwin() , and of calling def_prog_mode() tospecify an initial definition of the program terminal mode.

Applications normally do not need to refer to the shell terminal mode. Applications may find it useful tosave and restore the program terminal mode.

SEE ALSOdoupdate(3X), endwin(3X), initscr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The reset_prog_mode() and reset_shell_mode() functions are merged with this entry. In pre-vious issues, they appeared in entries of their own.

The entry is rewritten for clarity. The argument list for all these functions is explicitly declared as void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−173

A dA

delay_output(3X) delay_output(3X)(CURSES)

NAMEdelay_output — delay output

SYNOPSIS#include <curses.h>

int delay_output(int ms);

DESCRIPTIONOn terminals that support pad characters, delay_output() pauses the output for at least ms mil-liseconds. Otherwise, the length of the delay is unspecified.

RETURN VALUEUpon successful completion, delay_output() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEWhether or not the terminal supports pad characters, the delay_output() function is not a precisemethod of timekeeping.

SEE ALSODefined Capabilities in terminfo(4), napms(), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

Section 3−−174 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

delch(3X) delch(3X)(CURSES)

NAMEdelch, mvdelch, mvwdelch, wdelch — delete a character from a window.

SYNOPSIS#include <curses.h>

int delch(void);

int mvdelch(int y, int x);

int mvwdelch(WINDOW * win, int y, int x);

int wdelch(WINDOW * win);

DESCRIPTIONThese functions delete the character at the current or specified position in the current or specified win-dow. This function does not change the cursor position.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the delch() function is explicitly declared asvoid.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−175

A dA

deleteln(3X) deleteln(3X)(CURSES)

NAMEdeleteln, wdeleteln — delete lines in a window

SYNOPSIS#include <curses.h>

int deleteln(void);

int wdeleteln(WINDOW * win);

DESCRIPTIONThe deleteln() and wdeleteln() functions delete the line containing the cursor in the current orspecified window and move all lines following the current line one line toward the cursor. The last line ofthe window is cleared. The cursor position does not change.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOinsdelln(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the deleteln() function is explicitly declaredas void.

Section 3−−176 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

delscreen(3X) delscreen(3X)(CURSES)

NAMEdelscreen — free storage associated with a screen

SYNOPSIS#include <curses.h>

void delscreen(SCREEN * sp);

DESCRIPTIONThe delscreen() function frees storage associated with the SCREEN pointed to by sp.

RETURN VALUEThe delscreen() function does not return a value.

ERRORSNo errors are defined.

SEE ALSOendwin(3X), initscr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−177

A dA

delwin(3X) delwin(3X)(CURSES)

NAMEdelwin — delete a window

SYNOPSIS#include <curses.h>

int delwin(WINDOW * win);

DESCRIPTIONThe delwin() function deletes win, freeing all memory associated with it. The application must deletesubwindows before deleting the main window.

RETURN VALUEUpon successful completion, delwin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOderwin(3X), dupwin(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

Section 3−−178 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

del_curterm(3X) del_curterm(3X)(ENHANCED CURSES)

NAMEdel_curterm, restartterm, set_curterm, setupterm — interfaces to the terminfo database

SYNOPSIS#include <term.h>

int del_curterm(TERMINAL * oterm);

int restartterm(char * term, int fildes, int * errret);

TERMINAL *set_curterm(TERMINAL * nterm);

int setupterm(char * term, int fildes, int * errret);

extern TERMINAL *cur_term;

DESCRIPTIONThese functions retrieve information from the terminfo database.

To gain access to the terminfo database, setupterm() must be called first. It is automatically calledby initscr() and newterm() . The setupterm() function initializes the other functions to use theterminfo record for a specified terminal (which depends on whether use_env() was called). It sets thecur_term external variable to a TERMINAL structure that contains the record from the terminfo data-base for the specified terminal.

The terminal type is the character string term; if term is a null pointer, the environment variable TERMis used. If TERM is not set or if its value is an empty string, then "unknown" is used as the terminaltype. The application must set fildes to a file descriptor, open for output, to the terminal device, beforecalling setupterm() . If errret is not null, the integer it points to is set to one of the following values toreport the function outcome:

−1 The terminfo database was not found (function fails).

0 The entry for the terminal was not found in terminfo (function fails).

1 Success.

If setupterm() detects an error and errret is a null pointer, setupterm() writes a diagnostic mes-sage and exits.

A simple call to setupterm() that uses all the defaults and sends the output to stdout is:

setupterm((char *)0, fileno(stdout), (int *)0);

The set_curterm() function sets the variable cur_term to nterm, and makes all of the terminfoboolean, numeric, and string variables use the values from nterm.

The del_curterm() function frees the space pointed to by oterm and makes it available for furtheruse. If oterm is the same as cur_term, references to any of the terminfo boolean, numeric, and stringvariables thereafter may refer to invalid memory locations until setupterm() is called again.

The restartterm() function assumes a previous call to setupterm() (perhaps from initscr() ornewterm() ). It lets the application specify a different terminal type in term and updates the informa-tion returned by baudrate() based on fildes, but does not destroy other information created byinitscr() , newterm() or setupterm() .

RETURN VALUEUpon successful completion, set_curterm() returns the previous value of cur_term. Otherwise, itreturns a null pointer.

Upon successful completion, the other functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEAn application would call setupterm() if it required access to the terminfo database but did not oth-erwise need to use Curses.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−179

A dA

del_curterm(3X) del_curterm(3X)(ENHANCED CURSES)

SEE ALSObaudrate(3X), erasechar(3X), has_ic(3X), longname(3X), putc(3S), termattrs(3X), termname(3X),tgetent(3X), tigetflag(3X), use_env(3X), terminfo(4), see section Selecting a Terminal , <term.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−180 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A dA

derwin(3X) derwin(3X)(CURSES)

NAMEderwin - relative window creation function

SYNOPSIS#include <curses.h>

WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begin_y,int begin_x);

DESCRIPTIONThe derwin() function creates a new window with nlines lines and ncols columns, positioned so thatthe origin is at (begin_y, begin_x) relative to the origin of the window orig. If any part of the new windowis outside orig, the function fails and the window is not created.

RETURN VALUEUpon successful completion, these functions return a pointer to the new window. Otherwise, they returna null pointer.

ERRORSNo errors are defined.

APPLICATION USAGEBefore performing the first refresh of a subwindow, portable applications should call touchwin() ortouchline() on the parent window.

Each window maintains internal descriptions of the screen image and status. The screen image is sharedamong all windows in the window hierarchy. Refresh operations rely on information on what haschanged within a window, which is private to each window. Refreshing a window, when updates weremade to a different window, may fail to perform needed updates because the windows do not share thisinformation.

SEE ALSOdelwin(3X), newwin(3X), is_linetouched(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−181

A dA

devnm(3) devnm(3)

NAMEdevnm - map device ID to file path

SYNOPSIS#include <devnm.h>

int devnm (mode_t devtype,dev_t devid,char *path,size_t pathlen,int cache

);

DESCRIPTIONGiven a device type, a device ID, and a string in which to return the result, devnm() maps the type andID to a block or character special file (device file) name by searching /dev . It returns in path the fullpath name of the first special file encountered with a matching device type and ID. It searches /dev andall its subdirectories recursively in unspecified order.

The parameters are:

devtype One of the file type values S_IFBLK or S_IFCHR documented in stat (5). Bits otherthan those in the S_IFMT set are ignored. Hence the value can be, for example, anst_mode value returned by stat() (see stat (2)).

devid A device ID (the combined major and minor numbers) such as returned by stat() inthe st_dev or st_rdev field.

path Pointer to the buffer in which to return the path name result.

pathlen Tells the available length of the path string, including the NUL terminator character. Ifpath is too short to hold the full path name, only the first pathlen−1 characters arereturned in a null-terminated string, and the return value is altered (see below).

cache A flag that tells devnm() whether to save file information in memory allocated by mal-loc() , and later, whether to use that saved information instead of searching /devagain. A subsequent call with cache non-zero can be much faster, especially if /dev is alarge tree. However, the first call with cache true might be slower because devnm()must read all of the /dev tree once to create the cache, rather than returning immedi-ately upon finding a matching file. Any call with cache set to zero ignores the cache, ifany, and reads the directory.

To allow for possible future enhancements, cache should be restricted to the values 0 and1.

There is no way to tell devnm() to free its cached memory.

devnm() ignores unreadable directories and files for which stat() fails.

RETURN VALUEdevnm() returns one of the following values:

0 Successful. The result is in path .

−1 ftw() failed. errno contains the value returned from ftw() . path might be altered ifcache is set. If cache was set for the first time, devnm() freed any memory allocated bythe current call.

−2 No matching special file was found. errno is undefined. path is unaltered.

−3 A matching special file was found, but the name was truncated to fit in path . errno isundefined.

If malloc() fails, devnm() silently abandons the attempt to do caching in the current or any latercall with cache true, and frees any memory allocated by the current call.

AUTHORdevnm() was created by HP.

Section 3−−182 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

devnm(3) devnm(3)

SEE ALSOdevnm(1M), stat(2), ftw(3C), malloc(3C), ttyname(3C), stat(5), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−183

A dA

dial(3C) dial(3C)

NAMEdial(), undial() - establish an outgoing terminal line connection

SYNOPSIS#include <dial.h>

int dial(CALL call);

void undial(int fd);

DESCRIPTIONThe dial() function returns a file descriptor for a terminal line open for read/write. The argument todial() is a CALL structure (defined in the <dial.h > header file).

When finished with the terminal line, the calling program must invoke undial() to release the sema-phore that has been set during the allocation of the terminal device.

The definition of CALL in the <dial.h > header file is:

typedef struct {struct termio *attr; /* pointer to termio attribute struct */int baud; /* transmission data rate */int speed; /* 212A modem: low=300, high=1200 */char *line; /* device name for out-going line */char *telno; /* pointer to tel-no digits string */int modem; /* specify modem control for direct lines */char *device; /* Will hold the name of the device used

to make a connection */int dev_len; /* The length of the device used to

make connection */} CALL;

CALL elements are as follows:

speed Intended only for use with an outgoing dialed call, in which case its value should beeither 300 or 1200 to identify the 113A modem, or the high- or low-speed setting on the212A modem. Note that the 113A modem or the low-speed setting of the 212A modemtransmits at any rate between 0 and 300 bits per second. However, the high-speed set-ting of the 212A modem transmits and receives at 1200 bits per second only.

baud Desired transmission baud rate. For example, one might set baud to 110 and speed to300 (or 1200). However, if speed is set to 1200, baud must be set to high (1200).

line If the desired terminal line is a direct line, a string pointer to its device name should beplaced in the line element in the CALL structure. Legal values for such terminal dev-ice names are kept in the Devices file. In this case, the value of the baud elementneed not be specified as it will be determined from the Devices file.

telno A pointer to a character string representing the telephone number to be dialed. Suchnumbers can consist only of symbols described below. The termination symbol is sup-plied by the dial() function, and should not be included in the telno string passed todial() in the CALL structure.

Section 3−−184 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dial(3C) dial(3C)

Permissible Codes

0-9 dial 0-9

* or : dial *

# or ; dial #

- 4-second delay for second dial tone

e or < end-of-number

w or = wait for secondary dial tone

f flash off hook for 1 second

modem Specifies modem control for direct lines. Set to non-zero if modem control is required.

attr Pointer to a termio structure, as defined in the <termio.h > header file. A NULLvalue for this pointer element can be passed to the dial() function, but if such astructure is included, the elements specified in it are set for the outgoing terminal linebefore the connection is established. This is often important for certain attributes suchas parity and baud rate.

device Holds the device name that establishes the connection.

dev_len Length of the device name that is copied into the array device.

RETURN VALUEOn failure, a negative value indicating the reason for the failure is returned. Mnemonics for these nega-tive indices as listed here are defined in the <dial.h > header file.

INTRPT -1 /* interrupt occurred */D_HUNG -2 /* dialer hung (no return from write) */NO_ANS -3 /* no answer within 10 seconds */ILL_BD -4 /* illegal baud-rate */A_PROB -5 /* automatic call unit (acu) problem (open() failure) */L_PROB -6 /* line problem (open() failure) */NO_Ldv -7 /* can’t open LDEVS file */DV_NT_A -8 /* requested device not available */DV_NT_K -9 /* requested device not known */NO_BD_A -10 /* no device available at requested baud */NO_BD_K -11 /* no device known at requested baud */

WARNINGSIncluding the <dial.h > header file automatically includes the <termio.h > header file.

The above routine uses <stdio.h >, which causes unexpected increases in the size of programs that oth-erwise do not use standard I/O.

The dial() function will modify the values of some of the fields of the the CALL structure so if dial() ,is reinvoked, reinitialize the values of the CALL structure.

FILES/etc/uucp/Devices

SEE ALSOuucp(1), alarm(2), read(2), write(2), thread_safety(5), termio(7).

UUCP tutorial in Remote Access User’s Guide .

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−185

A dA

directory(3C) directory(3C)

NAMEopendir( ), readdir( ), readdir_r( ), telldir( ), seekdir( ), rewinddir( ), closedir( ) - directory operations

SYNOPSIS#include <dirent.h>

DIR *opendir(const char *dirname);

struct dirent *readdir(DIR *dirp);

int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);

long int telldir(DIR *dirp);

void seekdir(DIR *dirp, long int loc);

void rewinddir(DIR *dirp);

int closedir(DIR *dirp);

DESCRIPTIONThis library package provides functions that allow programs to read directory entries without having toknow the actual directory format associated with the file system. Because these functions allow programsto be used portably on file systems with different directory formats, this is the recommended way to readdirectory entries.

opendir() opens the directory dirname and associates a directory stream with it. opendir()returns a pointer used to identify the directory stream in subsequent operations.opendir() uses malloc (3C) to allocate memory.

readdir() returns a pointer to the next directory entry. It returns a NULL pointer upon reach-ing the end of the directory or detecting an invalid seekdir() operation. Seedirent (5) for a description of the fields available in a directory entry.

readdir_r() initializes the dirent structure refrenced by entry to represent the current posi-tion in the directory stream referenced by dirp , and stores a pointer to this structureat the location referenced by result .

telldir() returns the current location (encoded) associated with the directory stream to whichdirp refers.

seekdir() sets the position of the next readdir() operation on the directory stream to whichdirp refers. The loc argument is a location within the directory stream obtained fromtelldir() . The position of the directory stream is restored to where it was whentelldir() returned that loc value. Values returned by telldir() are valid onlywhile the DIR pointer from which they are derived remains open. If the directorystream is closed and then reopened, the telldir() value might be invalid.

rewinddir() resets the position of the directory stream to which dirp refers to the beginning of thedirectory. It also causes the directory stream to refer to the current state of thecorresponding directory, as a call to opendir() would have done.

closedir() closes the named directory stream, then frees the structure associated with the DIRpointer.

RETURN VALUEopendir() upon successful completion, returns a pointer to an object of type DIR referring to an

open directory stream. Otherwise, it returns a NULL pointer and sets the global vari-able errno to indicate the error.

readdir() upon successful completion, returns a pointer to an object of type struct direntdescribing a directory entry. Upon reaching the end of the directory, readdir()returns a NULL pointer and does not change the value of errno . Otherwise, itreturns a NULL pointer and sets errno to indicate the error.

readdir_r() upon successful completion returns a 0. On successful return, the pointer returned atresult has the same value as the argument entry . Upon reaching end of thedirectory stream, result has the value NULL. An error number is returned uponerror.

Section 3−−186 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

directory(3C) directory(3C)

telldir() upon successful completion, returns a long value indicating the current position in thedirectory. Otherwise it returns -1 and sets errno to indicate the error.

seekdir() does not return any value, but if an error is encountered, errno is set to indicate theerror.

closedir() upon successful completion, returns a value of 0. Otherwise, it returns a value of -1and sets errno to indicate the error.

ERRORSopendir() fails if any of the following conditions are encountered:

[EACCES] Search permission is denied for a component of dirname , or read permission isdenied for dirname .

[EFAULT] dirname points outside the allocated address space of the process. The reli-able detection of this error is implementation dependent.

[ELOOP] Too many symbolic links were encountered in translating the path name.

[EMFILE] Too many open file descriptors are currently open for the calling process.

[ENAMETOOLONG]A component of dirname exceeds PATH_MAXbytes, or the entire length of dir-name exceeds PATH_MAX− 1 bytes while _POSIX_NO_TRUNCis in effect.

[ENFILE] Too many open file descriptors are currently open on the system.

[ENOENT] A component of dirname does not exist.

[ENOMEM] malloc() failed to provide sufficient memory to process the directory.

[ENOTDIR] A component of dirname is not a directory.

[ENOENT] The dirname argument points to an empty string.

readdir() or readdir_r() might fail if any of the following conditions are encountered:

[EBADF] dirp does not refer to an open directory stream.

[ENOENT] The directory stream to which dirp refers is not located at a valid directoryentry.

[EFAULT] dirp points outside the allocated address space of the process.

telldir() might fail if any of the following conditions are encountered:

[EBADF] dirp does not refer to an open directory stream.

[ENOENT] dirp specifies an improper file system block size.

seekdir() might fail if the following condition is encountered:

[ENOENT] dirp specifies an improper file system block size.

closedir() might fail if any of the following conditions are encountered:

[EBADF] dirp does not refer to an open directory stream.

[EFAULT] dirp points outside the allocated address space of the process.

rewinddir() might fail if any of the following conditions are encountered:

[EBADF] dirp does not refer to an open directory stream.

[EFAULT] dirp points outside the allocated address space of the process.

EXAMPLESThe following code searches the current directory for an entry name :

DIR *dirp;struct dirent *dp;

dirp = opendir(".");while ((dp = readdir(dirp)) != NULL) {

if (strcmp(dp->d_name, name) == 0) {(void) closedir(dirp);

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−187

A dA

directory(3C) directory(3C)

return FOUND;}

}(void) closedir(dirp);return NOT_FOUND;

WARNINGSreaddir() and getdirentries() (see getdirentries(2)) are the only ways to access remote NFSdirectories. Attempting to read a remote directory via NFS by using read() returns -1 and sets errnoto [EISDIR] (see read (2)).

For 32-bit applications, the d_ino field of the dirent struct may overflow for filesystems that use 64-bitvalues. In this case the most-significant bytes will be truncated without generating an error and d_inovalues may not be unique.

APPLICATION USAGEThe header file required for these functions and the type of the return value from readdir() has beenchanged for compatibility with System V Release 3 and the X/Open Portability Guide . See ndir (5) for adescription of the header file <ndir.h> , which is provided to allow existing HP-UX applications to com-pile unmodified. <ndir.h> header file is obsoleted starting from HP-UX 10.30 and is available in/usr/old/usr/include directory.

New applications should use the <dirent.h> header file for portability to System V and X/Open sys-tems. The <ndir.h> header file is obsoleted starting from HP-UX 10.30 and is going to be removed infuture releases.

Users of readdir_r() should note that readdir_r() now conforms with the POSIX.1c Threads standard.The old prototype of readdir_r() is supported for compatibility with existing DCE applications only.

AUTHORdirectory was developed by AT&T, HP, and the University of California, Berkeley.

SEE ALSOclose(2), getdirentries(2), lseek(2), open(2), read(2), dir(4), dirent(5), ndir(5), thread_safety(5).

STANDARDS CONFORMANCEclosedir() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

opendir() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

readdir() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

readdir_r() : POSIX.1c

rewinddir() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

seekdir() : AES, SVID3, XPG2, XPG3, XPG4

telldir() : AES, XPG2, XPG3, XPG4

Section 3−−188 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A dA

div(3C) div(3C)

NAMEdiv( ), ldiv( ) - integer division and remainder

SYNOPSIS#include <stdlib.h>

div_t div(int numer, int denom);

ldiv_t ldiv(long int numer, long int denom);

DESCRIPTIONdiv() Computes the quotient and remainder of the division of the numerator numer by the

denominator denom . If the division is inexact, the sign of the resulting quotient is that ofthe algebraic quotient, and the magnitude of the resulting quotient is the largest integerless than the magnitude of the algebraic quotient. If the result can be represented, theresult is returned in a structure of type div_t (defined in <stdlib.h >) havingmembers quot and rem for the quotient and remainder respectively. Both members havetype int and values such that quot × denom + rem = numer . If the result cannot berepresented, the behavior is undefined.

ldiv() Similar to div() , except that the arguments each have type long int and the resultis returned in a structure of type ldiv_t (defined in <stdlib.h >) having long intmembers quot and rem for the quotient and remainder respectively.

WARNINGSBehavior is undefined if denom is zero.

SEE ALSOfloor(3M), thread_safety(5).

STANDARDS CONFORMANCEdiv() : AES, SVID3, XPG4, ANSI C

ldiv() : AES, SVID3, XPG4, ANSI C

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−189

A dA

dladdr(3C) dladdr(3C)

NAMEdladdr - get the symbolic information for an address.

SYNOPSIScc [flag ... ] cfile ... -ldl [library ] ...

#include <dlfcn.h>int dladdr(void *address, Dl_info *dlip);

DESCRIPTIONdladdr is one of a family of routines that give the user direct access to the dynamic linking facilities(using the -ldl option on the compiler or ld command line). dladdr allows a process to obtain infor-mation about the symbol that most closely defines a given address . dladdr determines whether thespecified address is located within one of the load modules (executable or shared libraries) that make upthe process’ address space. An address is deemed to fall within a load module when it is between the baseaddress at which the load module was mapped and the highest virtual address mapped for that loadmodule, inclusive. If a load module fits this criteria, its dynamic symbol table is searched to locate thenearest symbol to the specified address . The nearest symbol is the one whose value is equal to, or closestto but less than the specified address .

dlip is a pointer to a Dl_info structure. The structure must be allocated by the user. The structuremembers are set by dladdr if the specified address falls within one of the load modules. The Dl_infostructure contains the following members:

struct {const char *dli_fname;void *dli_fbase;const char *dli_sname;void *dli_saddr;size_t dli_size;int dli_bind;int dli_type;

};

The dli_fname field contains a pointer to the filename of the load module containing the address . Thecontents of this memory location can change between calls to dladdr .

The dli_fbase field contains a handle to the load module. This can be used as the first argument todlsym .

The dli_sname field contains a pointer to the name of the nearest symbol to the specified address . Thissymbol either has the same address, or is the nearest symbol with a lower address. The contents of thismemory location can change between calls to dladdr .

The dli_saddr field contains the actual address of the nearest symbol. For code symbols, it contains theaddress of the OPD (Official Plabel Descriptor) for the nearest code symbol.

The dli_size field contains the size of the nearest symbol as defined in the dynamic symbol table.

The dli_bind field contains the binding attribute of the nearest symbol as defined in the dynamic symboltable. The values for this are those used for a symbol’s binding in the ELF symbol table (see <elf.h> )

The dli_type field contains the type of the nearest symbol as defined in the dynamic symbol table. Thevalues for this are those used for a symbol’s type in the ELF symbol table (see <elf.h> ).

MULTITHREAD USAGEThis routine is thread-safe.

RETURN VALUEIf the specified address does not fall within one of the load modules, 0 is returned; the contents of theDl_info structure are not modified. Otherwise, a non-zero value is returned and the fields of theDl_info structure are set.

DIAGNOSTICSIf no symbol is found within the load module containing address whose value is less than or equal toaddress , the dli_sname , dli_saddr and dli_size fields are set to 0; the dli_bind field is set to STB_LOCAL,and the dli_type field is set to STT_NOTYPE.

Section 3−−190 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dladdr(3C) dladdr(3C)

For a.out ’s, only a subset of externally visible symbols are typically exported: specifically those refer-enced by the load modules with which the a.out is linked. The exact set of exported symbols for anyshared library or the a.out can be controlled using the linker (see ld(1)).

SEE ALSOcc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerror(3C), dlsym(3C).

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−191

A dA

dlclose(3C) dlclose(3C)

NAMEdlclose - close a shared library

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>int dlclose(void *handle);

DESCRIPTIONdlclose is one of a family of routines that give the user direct access to the dynamic linking facilities(using the -ldl option on the compiler or ld command line). dlclose disassociates a shared objectpreviously opened by dlopen from the current process. Once an object has been closed using dlclose ,its symbols are no longer available to dlsym . All objects loaded automatically as a result of invokingdlopen on the referenced object (see dlopen (3C)) are also closed. handle is the value returned by a pre-vious invocation of dlopen .

MULTITHREAD USAGEThis routine is thread-safe.

RETURN VALUEIf the referenced object was successfully closed, dlclose returns 0. If the object could not be closed, orif handle does not refer to an open object, dlclose returns a non-0 value. More detailed diagnosticinformation is available through dlerror .

WARNINGSA successful invocation of dlclose does not guarantee that the objects associated with handle haveactually been removed from the address space of the process. Objects loaded by one invocation of dlopenmay also be loaded by another invocation of dlopen . The same object may also be opened multipletimes. An object is not removed from the address space until all references to that object through anexplicit dlopen invocation have been closed and all other objects implicitly referencing that object havealso been closed.

Once an object has been closed by dlclose , referencing symbols contained in that object can causeundefined behavior.

SEE ALSOdlerror(3C), dlopen(3C), dlsym(3C).

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

Section 3−−192 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlerror(3C) dlerror(3C)

NAMEdlerror - get diagnostic information

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>char *dlerror(void);

DESCRIPTIONdlopen is one of a family of routines that give the user direct access to the dynamic linking facilities(using the -ldl option on the compiler or ld command line). dlerror returns a null-terminated char-acter string (with no trailing newline) that describes the last error that occurred during dynamic linkingprocessing. If no dynamic linking errors have occurred since the last invocation of dlerror , dlerrorreturns NULL. Thus, invoking dlerror a second time, immediately following a prior invocation, resultsin NULL being returned.

MULTITHREAD USAGEThis routine is thread-safe.

WARNINGSThe messages returned by dlerror may reside in a static buffer that is overwritten on each call todlerror . Application code should not write to this buffer. Programs wishing to preserve an error mes-sage should make their own copies of that message.

SEE ALSOdlclose(3C), dlopen(3C), dlsym(3C).

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−193

A dA

dlget(3C) dlget(3C)

NAMEdlget - retrieve information about a loaded module (program or shared library)

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>void *dlget(int index,

struct load_module_desc *desc,size_t desc_size);

DESCRIPTIONdlget is one of a family of routines that give the user direct access to the dynamic linking facilities.dlget returns information about a loaded module for a process. retrieves information about a loadmodule from an index specifying the placement of the load module in the dynamic loader’s search list. Anindex of -1 requests information about the dynamic loader. An index of -2 requests information about theprogram file itself.

If successful, dlget returns a handle for the shared library as defined by the return value from dlo-pen() .

desc must be preallocated by the user. The structure members are filled in by the dynamic loader withinformation about the requested shared library.

A load_module_desc structure has the following members:

struct load_module_desc {unsigned long text_base;unsigned long text_size;unsigned long data_base;unsigned long data_size;unsigned long unwind_base;unsigned long linkage_ptr;unsigned long phdr_base;unsigned long tls_size;unsigned long tls_start_addr;}

desc_size specifies the size in bytes of the load_module_desc structure sent in by the user.

If a call to dlget is unsuccessful, a NULL pointer is returned and desc remains unchanged.

MULTITHREAD USAGEThis routine is thread-safe.

AUTHORdlget() was developed by HP.

SEE ALSOSystem Tools

exec (2) System loader.ld(1) Invokes the link editor.

Miscellaneousa.out (4) Assembler, compiler, and linker output.dlclose (3C) Unloads a shared library previously loaded by dlopen() .dlerror (3C) Prints the last error message recorded by dld .dlgetname (3C) Returns the name of the storage containing a load module.dlmodinfo (3C) Returns information about a loaded module.dlopen (3C) Loads a shared library.dlsym (3C) Gets the address of a symbol in a shared library.

Texts and TutorialsHP-UX Linker and Libraries Online User Guide

(See the +help option)

Section 3−−194 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlget(3C) dlget(3C)

HP-UX Linker and Libraries User’s Guide(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−195

A dA

dlgetmodinfo(3C) dlgetmodinfo(3C)

NAMEdlgetmodinfo - retrieve information about a loaded module (program or shared library)

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>uint64_t dlgetmodinfo(int index,

struct load_module_desc *desc,size_t desc_size,void *(*read_tgt_mem)(void* buffer,

uint64_t ptr,size_t bufsiz,int ident),

int ident_parm,uint64_t load_map_parm);

DESCRIPTIONdlgetmodinfo is one of a family of routines that give the user direct access to the dynamic linkingfacilities. dlgetmodinfo retrieves information about a load module from an index specifying the place-ment of the load module in the dynamic loader’s search list. Unlike dlget , dlgetmodinfo canretrieve information about a load module in another process. index of -1 requests information about thedynamic loader. An index of -2 requests information about the program file itself. The dlgetmodinforoutine fills the load_module_desc with information from the matching load module.

The desc , desc_size , read_tgt_mem , ident_parm , and load_map_parm parameters are identical to thosefor dlmodinfo (3C).

RETURN VALUEIf successful, dlgetmodinfo returns a handle for the shared library as defined by the return valuefrom dlopen() . NULL is returned otherwise. The return values are type-converted to uint64_t .

MULTITHREAD USAGEThread safe in libdl.sl but not in libxpdl.sl .

AUTHORdlgetmodinfo was developed by HP.

SEE ALSOSystem Tools

exec (2) System loader.ld(1) Invokes the link editor.

Miscellaneousa.out (4) Assembler, compiler, and linker output.dlclose (3C) Unloads a shared library previously loaded by dlopen() .dlerror (3C) Prints the last error message recorded by dld .dlget (3C) Returns information about a loaded module.dlgetname (3C) Returns the name of the storage containing a load module.dlopen (3C) Loads a shared library.dlsym (3C) Gets the address of a symbol in a shared library.dlmodinfo (3C) Retrieve information about a loaded module (program or shared library).

Texts and TutorialsHP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

Section 3−−196 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlgetname(3C) dlgetname(3C)

NAMEdlgetname - retrieve the name of a load module given a load module descriptor

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>char *dlgetname(struct load_module_desc *desc,

size_t desc_size,void *(*read_tgt_mem)(void* buffer,

unsigned long long ptr,size_t bufsiz,int ident),

int ident_parm,unsigned long long load_map_parm);

DESCRIPTIONdlgetname is one of a family of routines that give the user direct access to the dynamic linking facili-ties. dlgetname returns the pathname of a load module represented by desc . The read_tgt_mem ,ident_parm , and load_map_parm parameters are identical to those for dlmodinfo .

The caller of dlgetname must copy the return value to insure that it is not corrupted. If desc does notdescribe a loaded module, then NULL is returned.

MULTITHREAD USAGEThis routine is thread-safe.

AUTHORdlgetname() was developed by HP.

SEE ALSOSystem Tools:

exec (2) System loader.ld(1) Invokes the link editor.

Miscellaneous:a.out (4) Assembler, compiler, and linker output.dlclose (3C) Unloads a shared library previously loaded by dlopen() .dlerror (3C) Prints the last error message recorded by dld .dlget (3C) Returns information on a loaded module.dlmodinfo (3C) Returns information about a loaded module.dlopen (3C) Loads a shared library.dlsym (3C) Gets the address of a symbol in a shared library.

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−197

A dA

dlmodadd(3C) dlmodadd(3C)

NAMEdlmodadd - register information about dynamically generated functions

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>void* dlmodadd(void* associate_handle,

void *func_start,size_t func_size,void *linkage_ptr,void *unwind_info);

DESCRIPTIONdlmodadd registers information about a dynamically generated function, which can be retrived throughdlmodinfo . The dlmodremove interface can be used to remove the registered information.

associate_handle is the module handle for an existing module with which the new function is associated.When the dynamic loader is called from the new function, it will behave as if it had been called from theassociated module. This handle must be a handle returned by dlopen() or dlget() .

func_start is the starting address of the generated machine code for the function. It is NOT the addressof a function descriptor.

func_size is the size, in bytes, of the generated machine code.

linkage_ptr is the gp (global pointer) value to be used for the function. It could be the gp of the associatedmodule. It must be set to a valid value, even if the generated code doesn’t actually use gp, as it isrequired at a minimum for following the personality routine pointer in the unwind information.

unwind_info is a pointer to the beginning of the unwind info block for the function. The unwind infoblock contains the header word, unwind descriptors, personality routine pointer, and language-specificdata, as described in the Itanium-based system Software Conventions and Runtime Architecture docu-ment.

When dlmodadd is invoked to register information about a dynamically generated function, the dynamicloader will create an unwind header and a single-entry unwind table for the function. The unwindheader will be associated with the address range occupied by the dynamically generated function. Thedlmodadd() routine will return a handle as identification of the newly-added function. Handlesreturned by dlmodadd() share the same namespace as handles returned by dlopen() and dlget() ,but they may not be used in calls to dlclose() . A handle returned by dlmodadd() will be treated bydlsym() as if the associated handle had been used instead. If dlmodinfo() is called with an ip_valuethat belongs to a function that has been registered with dlmodadd() , it will return the handle of thedynamically generated function, as originally returned by dlmodadd() , along with a load_module_descstructure describing the function. A load_module_desc for a dynamically generated function will alwayshave a 0 value in the phdr_base field. The text_base , text_size , data_base, and data_size fields may beused for converting segment-relative offsets to virtual addresses, but they may not be relied on to identifya range of memory belonging exclusively to the function. The unwind_base field will contain the addressof the unwind header built for the function. If a library is unloaded by dlclose() , the unwind info forall dynamically generated functions associated with the library being unloaded will also be removed.

RETURN VALUEIf successful, dlmodadd will return a handle as identification of the newly-added function. NULL isreturned otherwise.

MULTITHREAD USAGEThis routine is thread-safe.

AUTHORdlmodadd was developed by HP.

SEE ALSOld(1), dlclose(3C), dlerror(3C), dlget(3C), dlmodremove(3C), dlopen(3C), dlsym(3C), a.out(4), dld.so(5).

Section 3−−198 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlmodadd(3C) dlmodadd(3C)

Texts and TutorialsHP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−199

A dA

dlmodinfo(3C) dlmodinfo(3C)

NAMEdlmodinfo - retrieve information about a loaded module (program or shared library)

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>uint64_t dlmodinfo(uint64_t ip_value,

struct load_module_desc *desc,size_t desc_size,void *(*read_tgt_mem)(void* buffer,

uint64_t ptr,size_t bufsiz,int ident),

int ident_parm,uint64_t load_map_parm);

DESCRIPTIONdlmodinfo is one of a family of routines that give the user direct access to the dynamic linking facili-ties. dlmodinfo retrieves information about a loaded module from a given address value. dlmo-dinfo() searches all currently loaded load modules looking for a load module whose address range(address range of all loaded segments) holds the given address value. The dlmodinfo routine fills theload_module_desc with information from the matching load module.

ip_value is the instruction pointer value of the requested library. If the value is NULL, then desc willcontain the module info of dld itself. desc is a buffer of memory allocated by the user program. Thedynamic loader will fill this in with module information. desc_size is the size in bytes of the desc buffer.read_tgt_mem is a pointer to a function used by dlmodinfo to retrieve needed information. If the valueis NULL, the dynamic loader will use its own internal data structures to find the correct load module andthe following two parameters are ignored.

ident_parm Is only used to pass the fourth parameter to read_tgt_mem .

load_map_parmIs only used when calling through read_tgt_mem . It contains the starting address of theload map.

Otherwise, the function pointer will be used to read memory during its search, using these parameters:

buffer a buffer supplied by dlmodinfo to read into

ptr the virtual memory address to read from

bufsiz the size of buffer in bytes

ident the value of the ident_parm parameter to dlmodinfo

On success, read_tgt_mem will return the value of its buffer parameter, otherwise, it will return NULL.read_tgt_mem allows dlmodinfo to find a load module in one process on behalf of another. The callingprocess passes a callback via read_tgt_mem in order to read memory in a different process address spacefrom the one in which dlmodinfo resides. ip_value , load_map_parm, and ptr from read_tgt_mem canbe pointers to objects in another process. For example, when a 32 bit program wants to enquire about a64 bit program, the ip_value and load_map_parm should be 64 bit values. Any 32 bit pointers should betypecasted to 64 bits by the user program when passed in the ip_value or load_map_parm parameters.

If the calling process calls dlmodinfo with a callback registered via read_tgt_mem , it must supply thestarting address of the target process’ load map in the load_map_parm parameter to dlmodinfo . Thiscan be retrieved by using the DT_HP_LOAD_MAPdynamic table entry in the target program file.

A cross-process load module operation can be done via dlmodinfo , for example, by issuing a call tottrace().

RETURN VALUEIf successful, dlmodinfo returns a handle for the shared library as defined by the return value fromdlopen() . NULL is returned otherwise. The return values are type-converted to uint64_t .

Section 3−−200 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlmodinfo(3C) dlmodinfo(3C)

MULTITHREAD USAGEThread safe in libdl.sl but not in libxpdl.sl .

AUTHORdlmodinfo was developed by HP.

SEE ALSOSystem Tools:

exec (2) System loader.ld(1) Invokes the link editor.

Miscellaneous:a.out (4) Assembler, compiler, and linker output.dlclose (3C) Unloads a shared library previously loaded by dlopen() .dlerror (3C) Prints the last error message recorded by dld .dlget (3C) Returns information about a loaded module.dlgetname (3C) Returns the name of the storage containing a load module.dlopen (3C) Loads a shared library.dlsym (3C) Gets the address of a symbol in a shared library.

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−201

A dA

dlmodremove(3C) dlmodremove(3C)

NAMEdlmodremove - remove information registered using dlmodadd

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>int dlmodremove(void* handle);

DESCRIPTIONdlmodremove removes the registered information of individual dynamically generated functions.

handle must be a handle returned by dlmodadd() .

The dlmodadd() removes the registration of the indicated function, and frees the space used by theunwind header and unwind table created by dlmodadd() . It will not free the space used by the unwindinfo block or by the generated code, which was allocated by the user, and must be freed by the user.

RETURN VALUEThe dlmodremove routine returns 0 on success. If handle does not refer to a valid handle, dlmo-dremove returns a non-0 value.

MULTITHREAD USAGEThis routine is thread-safe.

AUTHORdlmodadd was developed by HP.

SEE ALSOld(1), dlerror(3C), dlmodremove(3C), a.out(4), dld.so(5).

Texts and Tutorials:HP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

Section 3−−202 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlopen(3C) dlopen(3C)

NAMEdlopen - open a shared library

SYNOPSIScc [flag ... ] cfile ... -ldl [library ] ...

#include <dlfcn.h>void *dlopen(const char *file, int mode);

DESCRIPTIONdlopen is one of a family of routines that give the user direct access to the dynamic linking facilities(using the -ldl option on the compiler or ld command line). dlopen makes a shared object specifiedby a file available to a running process. A shared object may specify other objects that it ‘‘needs’’ in orderto execute properly. These dependencies are specified by DT_NEEDEDentries int the .dynamic sectionof the original object. Each needed object may, in turn, specify other needed objects. All such objects areloaded along with the original object as a result of the call to dlopen .

A successful dlopen call returns to the process a handle which the process may use on subsequent callsto dlsym and dlclose . This value should not be interpreted in any way by the process.

file is used to construct a pathname to the object file. If file contains a slash character, the file argumentitself is used as the pathname. Otherwise a series of directories is searched for file . First, any directoriesspecified by the environment variable LD_LIBRARY_PATHare searched. Next, any directories specifiedby SHLIB_PATH are searched. Then, any directories specified by a DT_RPATHentry in the .dynamicsection of the original program object are searched. Finally, the directories /usr/lib/hpux32 in 32-bit mode and /usr/lib/hpux64 in 64-bit mode are searched.

If the value of file is 0, dlopen provides a handle on a ‘‘global symbol object.’’ This object provides accessto the symbols from an ordered set of objects consisting of the original a.out , all of the objects that wereloaded at program startup along with the a.out , and all objects loaded using a dlopen operation alongwith the RTLD_GLOBALflag. As the latter set of objects can change during execution, the set identifiedby handle can also change dynamically.

Only a single copy of an object file is brought into the address space, even if dlopen is invoked multipletimes in reference to the file, and even if different pathnames are used to reference the file.

When a shared object is brought into the address space of a process, it may contain references to symbolswhose addresses are not known until the object is loaded. These references must be relocated before thesymbols can be accessed. The mode parameter governs when these relocations take place and may havethe following values:

RTLD_LAZY Under this mode , only references to data symbols are relocated when the object is loaded.References to functions are not relocated until a given function is invoked for the firsttime. This mode should result in better performance, since a process may not referenceall of the functions in any given shared object.

RTLD_NOW Under this mode , all necessary relocations are performed when the object is first loaded.This may result in some wasted effort, if relocations are performed for functions that arenever referenced, but is useful for applications that need to know as soon as an object isloaded that all symbols referenced during execution will be available.

Any object loaded by dlopen that requires relocations against global symbols can reference the symbolsin the original a.out , any objects loaded at program startup, from the object itself as well as any otherobject included in the same dlopen invocation, and any objects that were loaded in any dlopen invoca-tion that specified the RTLD_GLOBALflag. To determine the scope of visibility for the symbols loadedwith a dlopen invocation, the mode parameter should be bitwise or’ed with one of the following values:

RTLD_GLOBALThe object’s symbols are made available for the relocation processing of any other object.In addition, symbol lookup using dlopen (0, mode) and an associated dlsym() allowsobjects loaded with RTLD_GLOBALto be searched.

RTLD_LOCAL The object’s symbols are made available for relocation processing only to objects loaded inthe same dlopen invocation.

If neither RTLD_GLOBALnor RTLD_LOCALare specified, the default is RTLD_LOCAL.

If a file is specified in multiple dlopen invocations, mode is interpreted at each invocation. Note, how-ever, that once RTLD_NOWhas been specified, all relocations will have been completed, rendering any

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−203

A dA

dlopen(3C) dlopen(3C)

further RTLD_NOWoperations redundant and any further RTLD_LAZYoperations irrelevant. Similarlynote that once RTLD_GLOBALhas been specified, the object will maintain the RTLD_GLOBALstatusregardless of any previous or future specification of RTLD_LOCAL, so long as the object remains in theaddress space (see dlclose (3C)).

To determine the scope of symbols that are made available for relocation processing of objects loaded in adlopen invocation, the mode parameter can be bitwise or’ed with one of the following values:

RTLD_GROUPUnder this mode , the specified object and its dependencies behave as if they were builtwith -B group (see ld(1)). Only symbols from objects loaded in the same dlopen invo-cation are made available for relocation. This ensures that all relocations are satisfiedusing symbol definitions from the same dlopen invocation.

RTLD_WORLDUnder this mode , only symbols from global objects and from the object itself are availablefor relocation processing. It does not use symbol definitions from other objects loaded aspart of the dlopen invocation. This flag has no effect on objects build with -B group(see ld(1)).

RTLD_PARENTUnder this mode , symbols from the object that invoked dlopen are also made availablefor relocation.

The default modes for dlopen are RTLD_WORLD|RTLD_GROUP. These flags are or’ed together whenthe same object is loaded with different modes.

The following flags do not affect relocation processing but provide other features:

RTLD_NODELETEUnder this mode , the specified object and its dependencies behave as if they were builtwith -B nodelete (see ld(1)). An explicit unload using dlclose or shl_loadreturns success silently without detaching the shared library from the process. Subse-quently, the shared library handle is valid only for shl_findsym . It stays invalid fordlsym , dlclose , and shl_unload until the next explicit load using shl_load ordlclose .

RTLD_NOLOADUnder this mode , the specified object is not loaded into the process’s address space, but avalid handle is returned if the object already exists in the process address space. If thespecified object does not already exist, then an error is returned. RTLD_NOLOADcan beused to query the presence, or for overriding the modes, of an existing object.

Symbols introduced into a program through calls to dlopen may be used in relocation activities. Sym-bols so introduced may duplicate symbols already defined by the program or previous dlopen opera-tions. To resolve the ambiguities such a situation might present, the resolution of a symbol reference to asymbol definition is based on a symbol resolution order. Two such resolution orders are defined: loadand dependency ordering. Load order establishes an ordering among symbol definitions using the tem-poral order in which the objects containing the definitions were loaded, such that the definition firstloaded has priority over definitions added later. Load ordering is used in relocation processing. Depen-dency ordering uses a ‘‘breadth-first’’ order starting with a given object, then all of its dependencies, thenany dependents of those, iterating until all dependencies are satisfied. With the exception of the globalsymbol object obtained via a dlopen operation on a file with a value 0, dependency ordering is used bythe dlsym function. Load ordering is used in dlsym operations on the global symbol object.

When an object is first made accessible via dlopen , it and its dependent objects are added in dependencyorder. Once all objects are added, relocations are performed using load order. Note that if an object andits dependencies have been loaded by a previous dlopen invocation or on startup, the load and depen-dency order may yield different resolutions.

The symbols introduced by dlopen operations and available through dlsym are those which are‘‘exported’’ as symbols of global scope by the object. For shared objects, such symbols will typically bethose that were specified in (for example) C source code as having extern linkage. For a.out ’s, only asubset of externally visible symbols are typically exported: specifically those referenced by the sharedobjects with which the a.out is linked. The exact set of exported symbols for any shared object or thea.out can be controlled using the linker (see ld(1)).

MULTITHREAD USAGEThis routine is thread-safe.

Section 3−−204 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A dA

dlopen(3C) dlopen(3C)

RETURN VALUEIf file cannot be found, cannot be opened for reading, is not a shared object, or if an error occurs duringthe process of loading file or relocating its symbolic references, dlopen returns NULL. More detaileddiagnostic information is available through dlerror .

WARNINGSThe environment variable LD_LIBRARY_PATHand SHLIB_PATH should contain a colon-separated listof directories, in the same format as the PATH variable (see sh(1)). LD_LIBRARY_PATH andSHLIB_PATH will be ignored if the process’ real user id is different from its effective user id or its realgroup id is different from its effective group id (see exec (2)).

With the +compat option specified, LD_LIBRARY_PATHand +b embedded path will be ignored whilesearching for dependent libraries.

Use caution when building shared libraries with external library dependencies. Any library that containsThread Local Storage (TLS) and uses static TLS model should not be used as a dependency. See "ThreadLocal Storage" in dld.so (5) for more information. If a dependent library contains TLS, was built withstatic TLS model and it is not loaded during program startup (that is, not linked against the executable),the dynamic loader fails to perform the operation. You can use +tls=dynamic compiler option to re-compile the library to avoid errors.

SEE ALSOcc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerror(3C), dlsym(3C).

Texts and TutorialsHP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−205

A dA

dlsym(3C) dlsym(3C)

NAMEdlsym - get the address of a symbol in shared library

SYNOPSIScc [flag ... ] file ... -ldl [library ] ...

#include <dlfcn.h>void *dlsym(void *handle, const char *name);

DESCRIPTIONdlsym is one of a family of routines that give the user direct access to the dynamic linking facilities(using the -ldl option on the compiler or ld command line). dlsym allows a process to obtain theaddress of a symbol defined within a shared object previously opened by dlopen . handle is a either thevalue returned by a call to dlopen or one of the special flags RTLD_NEXT, RTLD_SELF, andRTLD_DEFAULT. In the former case, the corresponding shared object must not have been closed usingdlclose . name is the symbol’s name as a character string.

dlsym searches for the named symbol in all shared objects loaded automatically as a result of loadingthe object referenced by handle (see dlopen (3C)).

If handle is RTLD_NEXT, the search begins with the ‘‘next’’ object after the object from which dlsym wasinvoked. Objects are searched using a load order symbol resolution algorithm (see dlopen (3C)). The‘‘next’’ object, and all other objects searched, are either of global scope (because they were loaded atstartup or as part of a dlopen operation with the RTLD_GLOBALflag) or are objects loaded by the samedlopen operation that loaded the caller of dlsym .

If handle is RTLD_SELF, the search begins with the object from which dlsym was invoked. Objects aresearched using the load order symbol resolution algorithm.

If handle is RTLD_DEFAULT, then the symbol search is done in the scope of the object that invokeddlsym . For example, if the caller object was loaded as a result of dlopen with RTLD_GROUP(seedlopen (3C)), it will not search symbols in objects that were not loaded in same dlopen invocation as thecaller object.

MULTITHREAD USAGEThis routine is thread-safe.

RETURN VALUEIf handle does not refer to a valid object opened by dlopen , or if the named symbol cannot be foundwithin any of the objects associated with handle , dlsym will return NULL. More detailed diagnosticinformation will be available through dlerror .

APPLICATION USAGERTLD_NEXTcan be used to navigate an intentionally created hierarchy of multiply defined symbolscreated through interposition. For example, if a program wished to create an implementation of mallocthat embedded some statistics gathering about memory allocations, such an implementation could defineits own malloc which would gather the necessary information, and use dlsym with RTLD_NEXTto findthe ‘‘real’’ malloc , which would perform the actual memory allocation. Of course, this ‘‘real’’ malloccould be another user-defined interface that added its own value and then used RTLD_NEXTto find thesystem malloc .

EXAMPLESThe following example shows how one can use dlopen and dlsym to access either function or dataobjects. For simplicity, error checking has been omitted.

void *handle;int i, *iptr;int (*fptr)(int);

/* open the needed object */handle = dlopen("/usr/mydir/mylib.so", RTLD_LAZY);

/* find address of function and data objects */fptr = (int (*)(int))dlsym(handle, "some_function");

iptr = (int *)dlsym(handle, "int_object");

Section 3−−206 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

dlsym(3C) dlsym(3C)

/* invoke function, passing value of integer as a parameter */

i = (*fptr)(*iptr);

The next example shows how one can use dlsym with RTLD_NEXTto add functionality to an existinginterface. Again, error checking has been omitted.

extern void record_malloc(void *, size_t);

void *malloc(size_t sz){

void *ptr;void *(*real_malloc)(size_t);

real_malloc = (void * (*) (size_t))dlsym(RTLD_NEXT, "malloc");

ptr = (*real_malloc)(sz);record_malloc(ptr, sz);return ptr;

}

SEE ALSOdlclose(3C), dlerror(3C), dlopen(3C).

Texts and TutorialsHP-UX Linker and Libraries Online User Guide

(See the +help option)HP-UX Linker and Libraries User’s Guide

(See manuals (5) for ordering information)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−207

A dA

doupdate(3X) doupdate(3X)(CURSES)

NAMEdoupdate, refresh, wnoutrefresh, wrefresh — refresh windows and lines

SYNOPSIS#include <curses.h>

int doupdate(void);

int refresh(void);

int wnoutrefresh(WINDOW * win);

int wrefresh(WINDOW * win);

DESCRIPTIONThe refresh() and wrefresh() functions refresh the current or specified window. The functionsposition the terminal’s cursor at the cursor position of the window, except that if the leaveok() modehas been enabled, they may leave the cursor at an arbitrary position.

The wnoutrefresh() function determines which parts of the terminal may need updating. Thedoupdate() function sends to the terminal the commands to perform any required changes.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGERefreshing an entire window is typically more efficient than refreshing several subwindows separately.An efficient sequence is to call wnoutrefresh() on each subwindow that has changed, followed by acall to doupdate() , which updates the terminal.

The refresh() or wrefresh() function (or wnoutrefresh() followed by doupdate() ) must becalled to send output to the terminal, as other Curses functions merely manipulate data structures.

SEE ALSOclearok(3X), redrawwin(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

This entry is a merger of the X/Open Curses, Issue 3 entries refresh() and wnoutrefresh() . TheDESCRIPTION is rewritten for clarity and the argument list for the doupdate() and refresh()functions is explicitly declared as void. Otherwise the functionality is identical to that defined in X/OpenCurses, Issue 3.

Section 3−−208 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A dA

drand48(3C) drand48(3C)

NAMEdrand48( ), erand48( ), lrand48( ), nrand48( ), mrand48( ), jrand48( ), srand48( ), seed48( ), lcong48( ) - gen-erate uniformly distributed pseudo-random numbers

SYNOPSIS#include <stdlib.h>

double drand48(void);

double erand48(unsigned short int xsubi[3]);

long int lrand48(void);

long int nrand48(unsigned short int xsubi[3]);

long int mrand48(void);

long int jrand48(unsigned short int xsubi[3]);

void srand48(long int seedval);

unsigned short int *seed48(unsigned short int seed16v[3]);

void lcong48(unsigned short int param[7]);

Obsolescent Interfacesint drand48_r(struct drand48_data *dp, double *randval);

int erand48_r(unsigned short int xsubi[3],struct drand48_data *dp,double *randval);

int lrand48_r(struct drand48_data *dp, long int *randval);

int nrand48_r(unsigned short int xsubi[3],struct drand48_data *dp,long int *randval);

int mrand48_r(struct drand48_data *dp, long int *randval);

int jrand48_r(unsigned short int xsubi[3],struct drand48_data *dp,long int *randval);

int srand48_r(long int seedval, struct drand48_data *dp);

int seed48_r(unsigned short int seed16v[3], struct drand48_data *dp);

int lcong48_r(unsigned short int param[7], struct drand48_data *dp);

DESCRIPTIONThis family of functions generates pseudo-random numbers using the well-known linear congruentialalgorithm and 48-bit integer arithmetic.

In the following description, the formal mathematical notation [low ,high) indicates an interval includinglow but not including high .

drand48() and erand48() return nonnegative double-precision floating-point values uniformly distri-buted over the interval [0.0,1.0).

lrand48() and nrand48() return nonnegative long integers uniformly distributed over the interval[0,2ˆ31).

mrand48() and jrand48() return signed long integers uniformly distributed over the interval[−2ˆ31,2ˆ31).

srand48() , seed48() , and lcong48() are initialization entry points, one of which should beinvoked before either drand48() , lrand48() , or mrand48() is called. (Although it is not recom-mended practice, constant default initializer values are supplied automatically if drand48() ,lrand48() , or mrand48() is called without a prior call to an initialization entry point.) erand48() ,

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−209

A dA

drand48(3C) drand48(3C)

nrand48() , and jrand48() do not require an initialization entry point to be called first.

All the routines work by generating a sequence of 48-bit integer values, X[i], according to the linearcongruential formula

X[n+1] = (a*X[n] + c) modulo m n>=0

The parameter m = 2ˆ48; hence 48-bit integer arithmetic is performed.

Unless lcong48() has been invoked, the default multiplier value a and the default addend value c aregiven by

a = 0x5DEECE66D (base 16) = 0273673163155 (base 8)c = 0xB (base 16) = 013 (base 8)

The value returned by any of the functions drand48() , erand48() , lrand48() , nrand48() ,mrand48() , or jrand48() is computed by first generating the next 48-bit X[i] in the sequence. Thenthe appropriate number of bits, according to the type of data item to be returned, are copied from thehigh-order (leftmost) bits of X[i] and transformed into the returned value.

The functions drand48() , lrand48() , and mrand48() store the last 48-bit X[i] generated in aninternal buffer; that is why they must be initialized prior to being invoked. The functions erand48() ,nrand48() , and jrand48() require the calling program to provide storage for the successive X[i]values in the array specified as an argument when the functions are invoked. That is why these routinesdo not have to be initialized; the calling program merely has to place the desired initial value of X[i] intothe array and pass it as an argument. By using different arguments, erand48() , nrand48() , andjrand48() allow separate modules of a large program to generate several independent streams ofpseudo-random numbers; i.e., the sequence of numbers in each stream do not depend upon how manytimes the routines have been called to generate numbers for the other streams.

The initializer function srand48() sets the high-order 32 bits of X[i] to the 32 bits contained in itsargument. The low-order 16 bits of X[i] are set to the arbitrary value 0x330E (base 16).

The initializer function seed48() sets the value of X[i] to the 48-bit value specified in the argumentarray. In addition, the previous value of X[i] is copied into a 48-bit internal buffer, used only byseed48() , and a pointer to this buffer is the value returned by seed48() . This returned pointer,which can be ignored if not needed, is useful if a program is to be restarted from a given point at somefuture time; use the pointer to get at and store the last X[i] value, and then use this value to reinitializevia seed48() when the program is restarted.

The initialization function lcong48() allows the user to specify the initial X[i], the multiplier value a ,and the addend value c . Argument array elements param [0-2] specify X[i], param [3-5] specify the multi-plier a , and param [6] specifies the 16-bit addend c . After lcong48() has been called, a subsequent callto either srand48() or seed48() restores the default multiplier and addend values for a and c ,specified above.

Obsolescent Interfacesdrand48_r() , erand48_r() , lrand48_r() , nrand48_r() , mrand48_r() , jrand48_r() ,srand48_r() , seed48_r() , lcong48_r() generate uniformly distributed pseudo-random numbers.

WARNINGSdrand48_r() , erand48_r() , lrand48_r() , nrand48_r() , mrand48_r() , jrand48_r() ,srand48_r() , seed48_r() and lcong48_r() are obsolescent interfaces supported only for compa-tibility with existing DCE applications. New multithreaded applications should use drand48() ,erand48() , lrand48() , nrand48() , mrand48() , jrand48() , srand48() , seed48() , andlcong48() .

SEE ALSOrand(3C), random(3M), thread_safety(5), random(7).

STANDARDS CONFORMANCEdrand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

erand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

jrand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

lcong48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

Section 3−−210 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A dA

drand48(3C) drand48(3C)

lrand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

mrand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

nrand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

seed48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

srand48() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−211

A dA

dupwin(3X) dupwin(3X)(ENHANCED CURSES)

NAMEdupwin — duplicate a window

SYNOPSIS#include <curses.h>

WINDOW *dupwin(WINDOW *win);

DESCRIPTIONThe dupwin() function creates a duplicate of the window win.

RETURN VALUEUpon successful completion, dupwin() returns a pointer to the new window. Otherwise, it returns anull pointer.

ERRORSNo errors are defined.

SEE ALSOderwin(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−212 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

echo(3X) echo(3X)(CURSES)

NAMEecho, noecho — enable/disable terminal echo

SYNOPSIS#include <curses.h>

int echo(void);

int noecho(void);

DESCRIPTIONThe echo() function enables Echo mode for the current screen. The noecho() function disables Echomode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode ofthe tty driver is disabled.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOgetch(3X), curses_intro(3X), subsection called Input Processing, <curses.h>, X/Open System InterfaceDefinitions, Issue 4, Version 2 specification, Section 9.2, Parameters That Can Be Set .

CHANGE HISTORYFirst released in Issue .

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the echo() and noecho() functions is expli-citly declared as void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−213

A eA

echochar(3X) echochar(3X)(ENHANCED CURSES)

NAMEechochar, wechochar — echo single-byte character and rendition to a window and refresh

SYNOPSIS#include <curses.h>

int echochar(const chtype ch);

int wechochar(WINDOW * win, const chtype ch);

DESCRIPTIONThe echochar() function is equivalent to a call to addch() followed by a call to refresh() .

The wechochar() function is equivalent to a call to waddch() followed by a call to wrefresh() .

RETURN VALUEUpon successful completion, these functions return OK. Otherwise they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOaddch(3X), doupdate(3X), echo_wchar(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−214 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

echo_wchar(3X) echo_wchar(3X)(ENHANCED CURSES)

NAMEecho_wchar, wecho_wchar — write a complex character and immediately refresh the window

SYNOPSIS#include <curses.h>

int echo_wchar(const cchar_t * wch);

int wecho_wchar(WINDOW * win, const cchar_t * wch);

DESCRIPTIONThe echo_wchar() function is equivalent to calling add_wch() and then calling refresh() .

The wecho_wchar() function is equivalent to calling wadd_wch() and then calling wrefresh() .

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOaddch(3X), add_wch(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−215

A eA

ecvt(3C) ecvt(3C)

NAMEecvt( ), fcvt( ), gcvt( ) - convert floating-point number to string

SYNOPSIS#include <stdlib.h>

char *ecvt(double value, int ndigit, int *decpt, int *sign);

char *fcvt(double value, int ndigit, int *decpt, int *sign);

char *gcvt(double value, int ndigit, char *buf);

Obsolescent Interfacesint ecvt_r(

double value,int ndigit,int *decpt,int *sign,char *buffer,int buflen);

int fcvt_r(double value,int ndigit,int *decpt,int *sign,char *buffer,int buflen);

DESCRIPTIONecvt() Converts value to a null-terminated string of ndigit digits and returns a pointer to the

string. The high-order digit is non-zero, unless the value is zero. The low-order digit isrounded. The position of the radix character relative to the beginning of the string is storedindirectly through decpt (negative means to the left of the returned digits). The radix char-acter is not included in the returned string. If the sign of the result is negative, the wordpointed to by sign is non-zero, otherwise it is zero.

One of three non-digit characters strings could be returned if the converted value is out ofrange. A - - or + + is returned if the value is larger than the exponent can contain, and isnegative, or positive, respectively. The third string is returned if the number is illegal, azero divide for example. The result value is Not A Number (NAN) and would return a ?character.

fcvt() Identical to ecvt() , except that the correct digit has been rounded for printf %f (FORTRAN

F-format) output of the number of digits specified by ndigit .

gcvt() Converts the value to a null-terminated string in the array pointed to by buf and returnsbuf . It produces ndigit significant digits in FORTRAN F-format if possible, or E-format other-wise. A minus sign, if required, and a radix character is included in the returned string.Trailing zeros are suppressed. The radix character is determined by the currently loadedNLS environment (see setlocale (3C)). If setlocale() has not been called successfully,the default NLS environment, "C", is used (see lang (5)). The default environment specifies aperiod (. ) as the radix character.

Obsolescent Interfacesecvt_r() and fcvt_r() convert floating-point number to string.

EXTERNAL INFLUENCESLocale

The LC_NUMERICcategory determines the value of the radix character within the current NLS environ-ment.

WARNINGSThe values returned by ecvt() and fcvt() point to an array whose content is overwritten by subse-quent calls to these interfaces by the same thread.

Section 3−−216 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

ecvt(3C) ecvt(3C)

ecvt_r() and fcvt_r() are obsolescent interfaces supported only for compatibility with existingDCE applications. New multi-threaded applications should use ecvt() and fcvt() .

AUTHORecvt() and fcvt() were developed by AT&T. gcvt() was developed by AT&T and HP.

SEE ALSOsetlocale(3C), printf(3S), lang(5), thread_safety(5).

STANDARDS CONFORMANCEecvt() : XPG2

fcvt() : XPG2

gcvt() : XPG2

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−217

A eA

elf(3E) elf(3E)

NAMEelf - object file access library

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

DESCRIPTIONFunctions in the ELF access library let a program manipulate ELF (Executable and Linking Format)object files, archive files, and archive members. The header file provides type and function declarationsfor all library services.

Programs communicate with many of the higher-level routines using an ELF descriptor. That is, whenthe program starts working with a file, elf_begin creates an ELF descriptor through which the pro-gram manipulates the structures and information in the file. These ELF descriptors can be used both toread and to write files. After the program establishes an ELF descriptor for a file, it may then obtain sec-tion descriptors to manipulate the sections of the file (see elf_getscn (3E)). Sections hold the bulk of anobject file’s real information, such as text, data, the symbol table, and so on. A section descriptor‘‘belongs’’ to a particular ELF descriptor, just as a section belongs to a file. Finally, data descriptors areavailable through section descriptors, allowing the program to manipulate the information associatedwith a section. A data descriptor ‘‘belongs’’ to a section descriptor.

Descriptors provide private handles to a file and its pieces. In other words, a data descriptor is associatedwith one section descriptor, which is associated with one ELF descriptor, which is associated with one file.Although descriptors are private, they give access to data that may be shared. Consider programs thatcombine input files, using incoming data to create or update another file. Such a program might get datadescriptors for an input and an output section. It then could update the output descriptor to reuse theinput descriptor’s data. That is, the descriptors are distinct, but they could share the associated databytes. This sharing avoids the space overhead for duplicate buffers and the performance overhead forcopying data unnecessarily.

File ClassesELF provides a framework in which to define a family of object files, supporting multiple processors andarchitectures. An important distinction among object files is the class , or capacity, of the file. The 32-bitclass supports architectures in which a 32-bit object can represent addresses, file sizes, and so forth, as inthe following.

Name PurposeElf32_Addr Unsigned addressElf32_Half Unsigned medium integerElf32_Off Unsigned file offsetElf32_Sword Signed large integerElf32_Word Unsigned large integerunsigned char Unsigned small integer

Other classes will be defined as necessary, to support larger (or smaller) machines. Some library servicesdeal only with data objects for a specific class, while others are class- independent. To make this distinc-tion clear, library function names reflect their status, as described below.

Data RepresentationsConceptually, two parallel sets of objects support cross compilation environments. One set corresponds tofile contents, while the other set corresponds to the native memory image of the program manipulatingthe file. Type definitions supplied by the header files work on the native machine, which may havedifferent data encodings (size, byte order, and so forth) than the target machine. Although nativememory objects should be at least as big as the file objects (to avoid information loss), they may be biggerif that is more natural for the host machine.

Translation facilities exist to convert between file and memory representations. Some library routinesconvert data automatically, while others leave conversion as the program’s responsibility. Either way,programs that create object files must write file-typed objects to those files; programs that read object filesmust take a similar view. See elf_xlate (3E) and elf_fsize (3E) for more information.

Section 3−−218 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf(3E) elf(3E)

Programs may translate data explicitly, taking full control over the object file layout and semantics. Ifthe program prefers not to have and exercise complete control, the library provides a higher-level inter-face that hides many object file details. elf_begin and related functions let a program deal with the nativememory types, converting between memory objects and their file equivalents automatically when readingor writing an object file.

ELF VersionsObject file versions allow ELF to adapt to new requirements. Three-independent-versions can be impor-tant to a program. First, an application program knows about a particular version by virtue of beingcompiled with certain header files. Second, the access library similarly is compiled with header files thatcontrol what versions it understands. Third, an ELF object file holds a value identifying its version,determined by the ELF version known by the file’s creator. Ideally, all three versions would be the same,but they may differ.

If a program’s version is newer than the access library, the program might use information unknown tothe library. Translation routines might not work properly, leading to undefined behavior. This conditionmerits installing a new library.

The library’s version might be newer than the program’s and the file’s. The library understands old ver-sions, thus avoiding compatibility problems in this case.

Finally, a file’s version might be newer than either the program or the library understands. The programmight or might not be able to process the file properly, depending on whether the file has extra informa-tion and whether that information can be safely ignored. Again, the safe alternative is to install a newlibrary that understands the file’s version.

To accommodate these differences, a program must use elf_version to pass its version to the library,thus establishing the working version for the process. Using this, the library accepts data from andpresents data to the program in the proper representations. When the library reads object files, it useseach file’s version to interpret the data. When writing files or converting memory types to the fileequivalents, the library uses the program’s working version for the file data.

System ServicesAs mentioned above, elf_begin and related routines provide a higher-level interface to ELF files, per-forming input and output on behalf of the application program. These routines assume a program canhold entire files in memory, without explicitly using temporary files. When reading a file, the library rou-tines bring the data into memory and perform subsequent operations on the memory copy. Programs thatread or write large object files with this model must execute on a machine with a large process virtualaddress space. If the underlying operating system limits the number of open files, a program can useelf_cntl to retrieve all necessary data from the file, allowing the program to close the file descriptorand reuse it.

Although the elf_begin interfaces are convenient and efficient for many programs, they might be inap-propriate for some. In those cases, an application may invoke the elf_xlate data translation routinesdirectly. These routines perform no input or output, leaving that as the application’s responsibility. Byassuming a larger share of the job, an application controls its input and output model.

Library NamesNames associated with the library take several forms.

elf_name These class-independent names perform some service, name , for the program.

elf32_name Service names with an embedded class, 32 here,indicate they work only for thedesignated class of files.

elf64_name Service names with an embedded class, 64 here,indicate they work only for thedesignated class of files.

Elf_Type Data types can be class-independent as well, distinguished by Type .

Elf32_Type Class-dependent data types have an embedded class name, 32 here.

Elf64_Type Class-dependent data types have an embedded class name, 64 here.

ELF_C_CMD Several functions take commands that control their actions. These values aremembers of the Elf_Cmd enumeration; they range from zero throughELF_C_NUM-1.

ELF_F_FLAG Several functions take flags that control library status and/or actions. Flags arebits that may be combined.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−219

A eA

elf(3E) elf(3E)

ELF32_FSZ_TYPEThese constants give the file sizes in bytes of the basic ELF types for the 32-bitclass of files. See elf_fsize for more information.

ELF64_FSZ_TYPEThese constants give the file sizes in bytes of the basic ELF types for the 64-bitclass of files. See elf_fsize for more information.

ELF_K_KIND The function elf_kind identifies the KIND of file associated with an ELFdescriptor. These values are members of the Elf_Kind enumeration; theyrange from zero through ELF_K_NUM-1.

ELF_T_TYPE When a service function, such as elf_xlate , deals with multiple types, namesof this form specify the desired TYPE . Thus, for example, ELF_T_EHDR isdirectly related to Elf32_Ehdr These values are members of the Elf_Typeenumeration; they range from zero through ELF_T_NUM-1.

NOTICESInformation in the ELF header files is separated into common parts and processor-specific parts. A pro-gram can make a processor’s information available by including the appropriate header file:sys/elf_NAME.h where NAME matches the processor name as used in the ELF file header.

Symbol Processorparisc PA RISC

Other processors will be added to the table as necessary. To illustrate, a program could use the followingcode to ‘‘see’’ the processor-specific information for the WE 32100.

#include <libelf.h>

#include <sys/elf_M32.h>

Without the sys/elf_M32.h definition, only the common ELF information would be visible.

SEE ALSOa.out(4), ar(4), elf_begin(3E), elf_cntl(3E), elf_end(3E), elf_error(3E), elf_fill(3E), elf_flag(3E),elf_fsize(3E), elf_getarhdr(3E), elf_getarsym(3E), elf_getbase(3E), elf_getdata(3E), elf_getehdr(3E),elf_getident(3E), elf_getphdr(3E), elf_getscn(3E), elf_getshdr(3E), elf_hash(3E), elf_kind(3E),elf_next(3E), elf_rand(3E), elf_rawfile(3E), elf_strptr(3E), elf_update(3E), elf_version(3E), elf_xlate(3E).

Section 3−−220 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A eA

elf_begin(3E) elf_begin(3E)

NAMEelf_begin - make a file descriptor

SYNOPSIScc [flag]... file ... -lelf [library ]...

#include <libelf.h>

Elf *elf_begin(int fildes, Elf_Cmd cmd, Elf *ref);

DESCRIPTIONelf_begin , elf_next , elf_rand , and elf_end work together to process ELF object files, eitherindividually or as members of archives. After obtaining an ELF descriptor from elf_begin , the pro-gram may read an existing file, update an existing file, or create a new file. fildes is an open file descrip-tor that elf_begin uses for reading or writing. The initial file offset (see lseek (2)) is unconstrained,and the resulting file offset is undefined. cmd may have the following values.

ELF_C_NULL When a program sets cmd to this value, elf_begin returns a null pointer, withoutopening a new descriptor. ref is ignored for this command. See elf_next (3E) and theexamples below for more information.

ELF_C_READ When a program wishes to examine the contents of an existing file, it should set cmdto this value. Depending on the value of ref , this command examines archivemembers or entire files. Three cases can occur.

First, if ref is a null pointer, elf_begin allocates a new ELF descriptor andprepares to process the entire file. If the file being read is an archive, elf_beginalso prepares the resulting descriptor to examine the initial archive member on thenext call to elf_begin , as if the program had used elf_next or elf_rand to‘‘move’’ to the initial member.

Second, if ref is a non-null descriptor associated with an archive file, elf_begin letsa program obtain a separate ELF descriptor associated with an individual member.The program should have used elf_next or elf_rand to position ref appropriately(except for the initial member, which elf_begin prepares; see the example below).In this case, fildes should be the same file descriptor used for the parent archive.

Finally, if ref is a non-null ELF descriptor that is not an archive, elf_begin incre-ments the number of activations for the descriptor and returns ref , without allocatinga new descriptor and without changing the descriptor’s read/write permissions. Toterminate the descriptor for ref , the program must call elf_end once for each activa-tion. See elf_next (3E) and the examples below for more information.

ELF_C_RDWR This command duplicates the actions of ELF_C_READand additionally allows theprogram to update the file image (see elf_update (3E)). That is, using ELF_C_READgives a read-only view of the file, while ELF_C_RDWRlets the program read and writethe file. ELF_C_RDWRis not valid for archive members. If ref is non-null, it musthave been created with the ELF_C_RDWRcommand.

ELF_C_WRITE If the program wishes to ignore previous file contents, presumably to create a new file,it should set cmd to this value. ref is ignored for this command.

elf_begin ‘‘works’’ on all files (including files with zero bytes), providing it can allocate memory for itsinternal structures and read any necessary information from the file. Programs reading object files thusmay call elf_kind or elf_getehdr to determine the file type (only object files have an ELF header).If the file is an archive with no more members to process, or an error occurs, elf_begin returns a nullpointer. Otherwise, the return value is a non-null ELF descriptor. Before the first call to elf_begin , aprogram must call elf_version to coordinate versions.

System ServicesWhen processing a file, the library decides when to read or write the file, depending on the program’srequests. Normally, the library assumes the file descriptor remains usable for the life of the ELF descrip-tor. If, however, a program must process many files simultaneously and the underlying operating systemlimits the number of open files, the program can use elf_cntl to let it reuse file descriptors. After cal-ling elf_cntl with appropriate arguments, the program may close the file descriptor without interfer-ing with the library.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−221

A eA

elf_begin(3E) elf_begin(3E)

All data associated with an ELF descriptor remain allocated until elf_end terminates the descriptor’slast activation. After the descriptors have been terminated, the storage is released; attempting to refer-ence such data gives undefined behavior. Consequently, a program that deals with multiple input (or out-put) files must keep the ELF descriptors active until it finishes with them.

NoteWhen a program calls elf_begin on a COFF file, the library translates COFF structures to their ELFequivalents, allowing programs to read (but not to write) a COFF file as if it were ELF. This conversionhappens only to the memory image and not to the file itself.

EXAMPLESA prototype for reading a file appears below. If the file is a simple object file, the program executes theloop one time, receiving a null descriptor in the second iteration. In this case, both elf and arf willhave the same value, the activation count will be two, and the program calls elf_end twice to terminatethe descriptor. If the file is an archive, the loop processes each archive member in turn, ignoring thosethat are not object files.

if (elf_version(EV_CURRENT) == EV_NONE){

/* library out of date *//* recover from error */

}cmd = ELF_C_READ;arf = elf_begin(fildes, cmd, (Elf *)0);while ((elf = elf_begin(fildes, cmd, arf)) != 0){

if ((ehdr = elf32_getehdr(elf)) != 0){

/* process the fil e . . . */}cmd = elf_next(elf);elf_end(elf);

}elf_end(arf);

Alternatively, the next example illustrates random archive processing. After identifying the file as anarchive, the program repeatedly processes archive members of interest. For clarity, this example omitserror checking and ignores simple object files. Additionally, this fragment preserves the ELF descriptorsfor all archive members, because it does not call elf_end to terminate them.

elf_version(EV_CURRENT);arf = elf_begin(fildes, ELF_C_READ, (Elf *)0);if (elf_kind(arf) != ELF_K_AR){

/* not an archive */}/* initial processing *//* set offse t = . . . for desired member header */while (elf_rand(arf, offset) == offset){

if ((elf = elf_begin(fildes, ELF_C_READ, arf)) == 0)break;

if ((ehdr = elf32_getehdr(elf)) != 0){

/* process archive membe r . . . */}/* set offse t = . . . for desired member header */

}

The following outline shows how one might create a new ELF file. This example is simplified to show theoverall flow.

elf_version(EV_CURRENT);fildes = open("path/name", O_RDWR|O_TRUNC|O_CREAT, 0666);if ((elf = elf_begin(fildes, ELF_C_WRITE, (Elf *)0)) == 0)

Section 3−−222 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A eA

elf_begin(3E) elf_begin(3E)

return;ehdr = elf32_newehdr(elf);phdr = elf32_newphdr(elf, count);scn = elf_newscn(elf);shdr = elf32_getshdr(scn);data = elf_newdata(scn);elf_update(elf, ELF_C_WRITE);elf_end(elf);

Finally, the following outline shows how one might update an existing ELF file. Again, this example issimplified to show the overall flow.

elf_version(EV_CURRENT);fildes = open("path/name", O_RDWR);elf = elf_begin(fildes, ELF_C_RDWR, (Elf *)0);

/* add new or delete old informatio n . . . */

close(creat("path/name", 0666));elf_update(elf, ELF_C_WRITE);elf_end(elf);

In the example above, the call to creat truncates the file, thus ensuring the resulting file will have the‘‘right’’ size. Without truncation, the updated file might be as big as the original, even if information weredeleted. The library truncates the file, if it can, with ftruncate (see truncate (2)). Some systems, how-ever, do not support ftruncate , and the call to creat protects against this. Notice that both file crea-tion examples open the file with write and read permissions. On systems that support mmap, the libraryuses it to enhance performance, and mmaprequires a readable file descriptor. Although the library canuse a write-only file descriptor, the application will not obtain the performance advantages of mmap.

SEE ALSOar(4), creat(2), elf(3E), elf_cntl(3E), elf_end(3E), elf_getarhdr(3E), elf_getbase(3E), elf_getdata(3E),elf_getehdr(3E), elf_getphdr(3E), elf_getscn(3E), elf_kind(3E), elf_next(3E), elf_rand(3E), elf_rawfile(3E),elf_update(3E), elf_version(3E), lseek(2), mmap(2), open(2), truncate(2).

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−223

A eA

elf_cntl(3E) elf_cntl(3E)

NAMEelf_cntl - control a file descriptor

SYNOPSIScc [flag... ] file ... -lelf [library ] ...

#include <libelf.h>

int elf_cntl(Elf *elf, Elf_Cmd cmd);

DESCRIPTIONelf_cntl instructs the library to modify its behavior with respect to an ELF descriptor, elf . Aself_begin (3E) describes, an ELF descriptor can have multiple activations, and multiple ELF descriptorsmay share a single file descriptor. Generally, elf_cntl commands apply to all activations of elf . More-over, if the ELF descriptor is associated with an archive file, descriptors for members within the archivewill also be affected as described below. Unless stated otherwise, operations on archive members do notaffect the descriptor for the containing archive.

The cmd argument tells what actions to take and may have the following values.

ELF_C_FDDONE This value tells the library not to use the file descriptor associated with elf . A pro-gram should use this command when it has requested all the information it cares touse and wishes to avoid the overhead of reading the rest of the file. The memory forall completed operations remains valid, but later file operations, such as the initialelf_getdata for a section, will fail if the data is not in memory already.

ELF_C_FDREAD This command is similar to ELF_C_FDDONE, except it forces the library to read therest of the file. A program should use this command when it must close the filedescriptor but has not yet read everything it needs from the file. After elf_cntlcompletes the ELF_C_FDREAD command, future operations, such aself_getdata, will use the memory version of the file without needing to use thefile descriptor.

If elf_cntl succeeds, it returns zero. Otherwise, elf was null or an error occurred, and the functionreturns -1.

NOTICESIf the program wishes to use the ‘‘raw’’ operations (see elf_rawdata , described in elf_getdata (3E), andelf_rawfile (3E)) after disabling the file descriptor with ELF_C_FDDONEor ELF_C_FDREAD, it must exe-cute the raw operations explicitly beforehand. Otherwise, the raw file operations will fail. Callingelf_rawfile makes the entire image available, thus supporting subsequent elf_rawdata calls.

SEE ALSOelf(3E), elf_begin(3E), elf_getdata(3E), elf_rawfile(3E).

Section 3−−224 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_end(3E) elf_end(3E)

NAMEelf_end - finish using an object file

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

int elf_end(Elf *elf);

DESCRIPTIONA program uses elf_end to terminate an ELF descriptor, elf , and to deallocate data associated with thedescriptor. Until the program terminates a descriptor, the data remain allocated. elf should be a valuepreviously returned by elf_begin ; a null pointer is allowed as an argument, to simplify error handling.If the program wishes to write data associated with the ELF descriptor to the file, it must useelf_update before calling elf_end .

As elf_begin (3E) explains, a descriptor can have more than one activation. Calling elf_end removesone activation and returns the remaining activation count. The library does not terminate the descriptoruntil the activation count reaches zero. Consequently, a zero return value indicates the ELF descriptor isno longer valid.

SEE ALSOelf(3E), elf_begin(3E), elf_update(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−225

A eA

elf_error(3E) elf_error(3E)

NAMEelf_errmsg, elf_errno - error handling

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>const char *elf_errmsg(int err);int elf_errno(void);

DESCRIPTIONIf an ELF library function fails, a program may call elf_errno to retrieve the library’s internal errornumber. As a side effect, this function resets the internal error number to zero, which indicates no error.

elf_errmsg takes an error number, err , and returns a null-terminated error message (with no trailingnew-line) that describes the problem. A zero err retrieves a message for the most recent error. If no errorhas occurred, the return value is a null pointer (not a pointer to the null string). Using err of -1 alsoretrieves the most recent error, except it guarantees a non-null return value, even when no error hasoccurred. If no message is available for the given number, elf_errmsg returns a pointer to anappropriate message. This function does not have the side effect of clearing the internal error number.

EXAMPLESThe following fragment clears the internal error number and checks it later for errors. Unless an erroroccurs after the first call to elf_errno , the next call will return zero.

(void)elf_errno();while (more_to_do){

/* processing ... */if ((err = elf_errno()) != 0){

msg = elf_errmsg(err);/* print msg */

}}

SEE ALSOelf(3E), elf_version(3E).

Section 3−−226 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_fill(3E) elf_fill(3E)

NAMEelf_fill - set fill byte

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

void elf_fill(int fill);

DESCRIPTIONAlignment constraints for ELF files sometimes require the presence of ‘‘holes.’’ For example, if the datafor one section are required to begin on an eight-byte boundary, but the preceding section is too ‘‘short,’’the library must fill the intervening bytes. These bytes are set to the fill character. The library uses zerobytes unless the application supplies a value. See elf_getdata (3E) for more information about these holes.

NOTICESAn application can assume control of the object file organization by setting the ELF_F_LAYOUTbit (seeelf_flag(3E)). When this is done, the library does not fill holes.

SEE ALSOelf(3E), elf_getdata(3E), elf_flag(3E), elf_update(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−227

A eA

elf_flag(3E) elf_flag(3E)

NAMEelf_flagdata, elf_flagehdr, elf_flagelf, elf_flagphdr, elf_flagscn, elf_flagshdr - manipulate flags

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

unsigned elf_flagdata(Elf_Data *data, Elf_Cmd cmd, unsigned flags);unsigned elf_flagehdr(Elf *elf, Elf_Cmd cmd, unsigned flags);unsigned elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags);unsigned elf_flagphdr(Elf *elf, Elf_Cmd cmd, unsigned flags);unsigned elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags);unsigned elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags);

DESCRIPTIONThese functions manipulate the flags associated with various structures of an ELF file. Given an ELFdescriptor elf , a data descriptor data , or a section descriptor scn , the functions may set or clear the asso-ciated status bits, returning the updated bits. A null descriptor is allowed, to simplify error handling; allfunctions return zero for this degenerate case.

cmd may have the following values:

ELF_C_CLR The functions clear the bits that are asserted in flags. Only the non-zero bits in flagsare cleared; zero bits do not change the status of the descriptor.

ELF_C_SET The functions set the bits that are asserted in flags. Only the non-zero bits in flagsare set; zero bits do not change the status of the descriptor.

Descriptions of the defined flags bits appear below.

ELF_F_DIRTY When the program intends to write an ELF file, this flag asserts the associated infor-mation needs to be written to the file. Thus, for example, a program that wished toupdate the ELF header of an existing file would call elf_flagehdr with this bit setin flags and cmd equal to ELF_C_SET. A later call to elf_update would write themarked header to the file.

ELF_F_LAYOUT Normally, the library decides how to arrange an output file. That is, it automaticallydecides where to place sections, how to align them in the file, etc. If this bit is set foran ELF descriptor, the program assumes responsibility for determining all file posi-tions. This bit is meaningful only for elf_flagelf and applies to the entire fileassociated with the descriptor.

When a flag bit is set for an item, it affects all the subitems as well. Thus, for example, if the programsets the ELF_F_DIRTY bit with elf_flagelf , the entire logical file is ‘‘dirty.’’

EXAMPLESThe following fragment shows how one might mark the ELF header to be written to the output file.

ehdr = elf32_getehdr(elf);/* dirty ehd r . . . */elf_flagehdr(elf, ELF_C_SET, ELF_F_DIRTY);

SEE ALSOelf(3E), elf_end(3E), elf_getdata(3E), elf_getehdr(3E), elf_update(3E).

Section 3−−228 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_fsize(3E) elf_fsize(3E)

NAMEelf32_fsize, elf64_fsize - return the size of an object file type for elf32 files, return the size of an object filetype for elf64 files, respectively.

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>size_t elf32_fsize(Elf_Type type, size_t count, unsigned ver);size_t elf64_fsize(Elf_Type type, size_t count, unsigned ver);

DESCRIPTIONelf32_fsize gives the size in bytes of the 32-bit file representation of count data objects with the giventype . The library uses version ver to calculate the size (see elf (3E) and elf_version (3E)).

Constant values are available for the sizes of fundamental types.

Elf_Type File Size Memory SizeELF_T_ADDR ELF32_FSZ_ADDR sizeof(Elf32_Addr)ELF_T_BYTE 1 sizeof(unsigned char)ELF_T_HALF ELF32_FSZ_HALF sizeof(Elf32_Half)ELT_T_OFF ELF32_FSZ_OFF sizeof(Elf32_Off)ELF_T_SWORD ELF32_FSZ_SWORD sizeof(Elf32_Sword)ELF_T_WORD ELF32_FSZ_WORD sizeof(Elf32_Word)

elf32_fsize returns zero if the value of type or ver is unknown. See elf_xlate (3E) for a list of the typevalues.

elf64_fsize gives the size in bytes of the 64-bit file representation of count data objects with the giventype. The library uses version ver to calculate the size (see elf (3E) and elf_version (3E)).

Constant values are available for the sizes of fundamental types.

Elf_Type File Size Memory SizeELF_T_ADDR ELF64_FSZ_ADDR sizeof(Elf64_Addr)ELF_T_BYTE 1 sizeof(unsigned char)ELF_T_HALF ELF64_FSZ_HALF sizeof(Elf64_Half)ELT_T_OFF ELF64_FSZ_OFF sizeof(Elf64_Off)ELF_T_SWORD ELF64_FSZ_SWORD sizeof(Elf64_Sword)ELF_T_WORD ELF64_FSZ_WORD sizeof(Elf64_Word)

elf64_fsize returns zero if the value of type or ver is unknown. See elf_xlate (3E) for a list of the typevalues.

SEE ALSOelf(3E), elf_version(3E), elf_xlate(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−229

A eA

elf_getarhdr(3E) elf_getarhdr(3E)

NAMEelf_getarhdr - retrieve archive member header

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Arhdr *elf_getarhdr(Elf *elf);

DESCRIPTIONelf_getarhdr returns a pointer to an archive member header, if one is available for the ELF descrip-tor elf . Otherwise, no archive member header exists, an error occurred, or elf was null; elf_getarhdrthen returns a null value. The header includes the following members.

char *ar_name;time_t ar_date;long ar_uid;long ar_gid;unsigned long ar_mode;off_t ar_size;char *ar_rawname;

An archive member name, available through ar_name , is a null-terminated string, with the ar formatcontrol characters removed. The ar_rawname member holds a null-terminated string that representsthe original name bytes in the file, including the terminating slash and trailing blanks as specified in thearchive format.

In addition to ‘‘regular’’ archive members, the archive format defines some special members. All specialmember names begin with a slash (/ ), distinguishing them from regular members (whose names may notcontain a slash). These special members have the names (ar_name ) defined below.

/ This is the archive symbol table. If present, it will be the first archive member. A program mayaccess the archive symbol table through elf_getarsym . The information in the symbol table isuseful for random archive processing (see elf_rand (3E)).

// This member, if present, holds a string table for long archive member names. An archive member’sheader contains a 16-byte area for the name, which may be exceeded in some file systems. Thelibrary automatically retrieves long member names from the string table, setting ar_name to theappropriate value.

Under some error conditions, a member’s name might not be available. Although this causes the libraryto set ar_name to a null pointer, the ar_rawname member will be set as usual.

SEE ALSOar(4), elf(3E), elf_begin(3E), elf_getarsym(3E), elf_rand(3E).

Section 3−−230 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_getarsym(3E) elf_getarsym(3E)

NAMEelf_getarsym - retrieve archive symbol table

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Arsym *elf_getarsym(Elf *elf, size_t *ptr);

DESCRIPTIONelf_getarsym returns a pointer to the archive symbol table, if one is available for the ELF descriptorelf . Otherwise, the archive doesn’t have a symbol table, an error occurred, or elf was null;elf_getarsym then returns a null value. The symbol table is an array of structures that include thefollowing members.

char *as_name;size_t as_off;unsigned long as_hash;

These members have the following semantics.

as_name A pointer to a null-terminated symbol name resides here.

as_off This value is a byte offset from the beginning of the archive to the member’s header. Thearchive member residing at the given offset defines the associated symbol. Values inas_off may be passed as arguments to elf_rand to access the desired archivemember.

as_hash This is a hash value for the name, as computed by elf_hash.

If ptr is non-null, the library stores the number of table entries in the location to which ptr points. Thisvalue is set to zero when the return value is null. The table’s last entry, which is included in the count,has a null as_name , a zero value for as_off , and ˜0UL for as_hash .

SEE ALSOar(4), elf(3E), elf_getarhdr(3E), elf_hash(3E), elf_rand(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−231

A eA

elf_getbase(3E) elf_getbase(3E)

NAMEelf_getbase - get the base offset for an object file

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

off_t elf_getbase(Elf *elf);

DESCRIPTIONelf_getbase returns the file offset of the first byte of the file or archive member associated with elf , ifit is known or obtainable, and -1 otherwise. A null elf is allowed, to simplify error handling; the returnvalue in this case is -1. The base offset of an archive member is the beginning of the member’s informa-tion, not the beginning of the archive member header.

SEE ALSOar(4), elf(3E), elf_begin(3E).

Section 3−−232 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_getdata(3E) elf_getdata(3E)

NAMEelf_getdata, elf_newdata, elf_rawdata - get section data

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>Elf_Data *elf_getdata(Elf_Scn *scn, Elf_Data *data);Elf_Data *elf_newdata(Elf_Scn *scn);Elf_Data *elf_rawdata(Elf_Scn *scn, Elf_Data *data);

DESCRIPTIONThese functions access and manipulate the data associated with a section descriptor, scn . When readingan existing file, a section will have a single data buffer associated with it. A program may build a newsection in pieces, however, composing the new data from multiple data buffers. For this reason, ‘‘the’’data for a section should be viewed as a list of buffers, each of which is available through a data descrip-tor.

elf_getdata lets a program step through a section’s data list. If the incoming data descriptor, data , isnull, the function returns the first buffer associated with the section. Otherwise, data should be a datadescriptor associated with scn , and the function gives the program access to the next data element for thesection. If scn is null or an error occurs, elf_getdata returns a null pointer.

elf_getdata translates the data from file representations into memory representations (seeelf_xlate (3E)) and presents objects with memory data types to the program, based on the file’s class (seeelf (3E)). The working library version (see elf_version (3E)) specifies what version of the memory struc-tures the program wishes elf_getdata to present.

elf_newdata creates a new data descriptor for a section, appending it to any data elements alreadyassociated with the section. As described below, the new data descriptor appears empty, indicating theelement holds no data. For convenience, the descriptor’s type (d_type below) is set to ELF_T_BYTE,and the version (d_version below) is set to the working version. The program is responsible for setting(or changing) the descriptor members as needed. This function implicitly sets the ELF_F_DIRTY bit forthe section’s data (see elf_flag(3E)). If scn is null or an error occurs, elf_newdata returns a nullpointer.

elf_rawdata differs from elf_getdata by returning only uninterpreted bytes, regardless of the sec-tion type. This function typically should be used only to retrieve a section image from a file being read,and then only when a program must avoid the automatic data translation described below. Moreover, aprogram may not close or disable (see elf_cntl (3E)) the file descriptor associated with elf before the initialraw operation, because elf_rawdata might read the data from the file to ensure it doesn’t interferewith elf_getdata . See elf_rawfile (3E) for a related facility that applies to the entire file. Whenelf_getdata provides the right translation, its use is recommended over elf_rawdata . If scn is nullor an error occurs, elf_rawdata returns a null pointer.

The Elf_Data structure includes the following members.

Elf_Void *d_buf;Elf_Type d_type;Elf64_Xword d_size;Elf64_Off d_off;Elf64_Xword d_align;unsigned d_version;

These members are available for direct manipulation by the program. Descriptions appear below.

d_buf A pointer to the data buffer resides here. A data element with no data has a null pointer.

d_type This member’s value specifies the type of the data to which d_buf points. A section’stype determines how to interpret the section contents, as summarized below.

d_size This member holds the total size, in bytes, of the memory occupied by the data. This maydiffer from the size as represented in the file. The size will be zero if no data exist. (Seethe discussion of SHT_NOBITSbelow for more information.)

d_off This member gives the offset, within the section, at which the buffer resides. This offsetis relative to the file’s section, not the memory object’s.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−233

A eA

elf_getdata(3E) elf_getdata(3E)

d_align This member holds the buffer’s required alignment, from the beginning of the section.That is, d_off will be a multiple of this member’s value. For example, if this member’svalue is four, the beginning of the buffer will be four-byte aligned within the section.Moreover, the entire section will be aligned to the maximum of its constituents, thusensuring appropriate alignment for a buffer within the section and within the file.

d_version This member holds the version number of the objects in the buffer. When the library ori-ginally read the data from the object file, it used the working version to control the trans-lation to memory objects.

Data AlignmentAs mentioned above, data buffers within a section have explicit alignment constraints. Consequently,adjacent buffers sometimes will not abut, causing ‘‘holes’’ within a section. Programs that create outputfiles have two ways of dealing with these holes.

First, the program can use elf_fill to tell the library how to set the intervening bytes. When thelibrary must generate gaps in the file, it uses the fill byte to initialize the data there. The library’s initialfill value is zero, and elf_fill lets the application change that.

Second, the application can generate its own data buffers to occupy the gaps, filling the gaps with valuesappropriate for the section being created. A program might even use different fill values for different sec-tions. For example, it could set text sections’ bytes to no-operation instructions, while filling data sectionholes with zero. Using this technique, the library finds no holes to fill, because the application eliminatedthem.

Section and Memory Typeself_getdata interprets sections’ data according to the section type, as noted in the section headeravailable through elf_getshdr (3E). The following table shows the section types and how the libraryrepresents them with memory data types for the 32-bit file class. Other classes would have similar tables.By implication, the memory data types control translation by elf_xlate (3E).

Section Type Elf_Type 32-Bit TypeSHT_DYNAMIC ELF_T_DYN Elf32_DynSHT_DYNSYM ELF_T_SYM Elf32_SymSHT_HASH ELF_T_WORD Elf32_WordSHT_NOBITS ELF_T_BYTE unsigned charSHT_NOTE ELF_T_BYTE unsigned charSHT_NULL none noneSHT_PROGBITS ELF_T_BYTE unsigned charSHT_REL ELF_T_REL Elf32_RelSHT_RELA ELF_T_RELA Elf32_RelaSHT_STRTAB ELF_T_BYTE unsigned charSHT_SYMTAB ELF_T_SYM Elf32_Symother ELF_T_BYTE unsigned char

elf_rawdata creates a buffer with type ELF_T_BYTE.

As mentioned above, the program’s working version controls what structures the library creates for theapplication. The library similarly interprets section types according to the versions. If a section type‘‘belongs’’ to a version newer than the application’s working version, the library does not translate the sec-tion data. Because the application cannot know the data format in this case, the library presents anuntranslated buffer of type ELF_T_BYTE, just as it would for an unrecognized section type.

A section with a special type, SHT_NOBITS, occupies no space in an object file, even when the sectionheader indicates a non-zero size. elf_getdata and elf_rawdata ‘‘work’’ on such a section, settingthe data structure to have a null buffer pointer and the type indicated above. Although no data ispresent, the d_size value is set to the size from the section header. When a program is creating a newsection of type SHT_NOBITS, it should use elf_newdata to add data buffers to the section. These‘‘empty’’ data buffers should have the d_size members set to the desired size and the d_buf membersset to null.

EXAMPLESThe following fragment obtains the string table that holds section names (ignoring error checking). Seeelf_strptr (3E) for a variation of string table handling.

Section 3−−234 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A eA

elf_getdata(3E) elf_getdata(3E)

ehdr = elf32_getehdr(elf);scn = elf_getscn(elf, (size_t)ehdr->e_shstrndx);shdr = elf32_getshdr(scn);if (shdr->sh_type != SHT_STRTAB){

/* not a string table */}data = 0;if ((data = elf_getdata(scn, data)) == 0

|| data->d_size == 0){

/* error or no data */}

The e_shstrndx member in an ELF header holds the section table index of the string table. The pro-gram gets a section descriptor for that section, verifies it is a string table, and then retrieves the data.When this fragment finishes, data->d_buf points at the first byte of the string table, anddata->d_size holds the string table’s size in bytes.

SEE ALSOelf(3E), elf_cntl(3E), elf_fill(3E), elf_flag(3E), elf_getehdr(3E), elf_getscn(3E), elf_getshdr(3E),elf_rawfile(3E), elf_strptr(3E), elf_version(3E), elf_xlate(3E).

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−235

A eA

elf_getehdr(3E) elf_getehdr(3E)

NAMEelf32_getehdr, elf32_newehdr, elf64_getehdr, elf64_newehdr - retrieve class-dependent object file headerfor elf32 and elf64 files, respectively

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf32_Ehdr *elf32_getehdr(Elf *elf);Elf32_Ehdr *elf32_newehdr(Elf *elf);Elf64_Ehdr *elf64_getehdr(Elf *elf);Elf64_Ehdr *elf64_newehdr(Elf *elf);

DESCRIPTIONFor a 32-bit class file, elf32_getehdr returns a pointer to an ELF header, if one is available for theELF descriptor elf . If no header exists for the descriptor, elf32_newehdr allocates a ‘‘clean’’ one, but itotherwise behaves the same as elf32_getehdr . It does not allocate a new header if one exists already.If no header exists (for elf_getehdr ), one cannot be created (for elf_newehdr ), a system erroroccurs, the file is not a 32-bit class file, or elf is null, both functions return a null pointer. The headerincludes the following members.

unsigned char e_ident[EI_NIDENT];Elf32_Half e_type;Elf32_Half e_machine;Elf32_Word e_version;Elf32_Addr e_entry;Elf32_Off e_phoff;Elf32_Off e_shoff;Elf32_Word e_flags;Elf32_Half e_ehsize;Elf32_Half e_phentsize;Elf32_Half e_phnum;Elf32_Half e_shentsize;Elf32_Half e_shnum;Elf32_Half e_shstrndx;

elf32_newehdr automatically sets the ELF_F_DIRTY bit (see elf_flag(3E)). A program may useelf_getident to inspect the identification bytes from a file.

For a 64-bit class file, elf64_getehdr returns a pointer to an ELF header, if one is available for theELF descriptor elf . If no header exists for the descriptor, elf64_newehdr allocates a ‘‘clean’’ one, but itotherwise behaves the same as elf64_getehdr . It does not allocate a new header if one exists already.If no header exists (for elf_getehdr ), one cannot be created (for elf_newehdr ), a system erroroccurs, the file is not a 64-bit class file, or elf is null, both functions return a null pointer. The headerincludes the following members.

unsigned char e_ident[EI_NIDENT];Elf64_Half e_type;Elf64_Half e_machine;Elf64_Word e_version;Elf64_Addr e_entry;Elf64_Off e_phoff;Elf64_Off e_shoff;Elf64_Word e_flags;Elf64_Half e_ehsize;Elf64_Half e_phentsize;Elf64_Half e_phnum;Elf64_Half e_shentsize;Elf64_Half e_shnum;Elf64_Half e_shstrndx;

elf64_newehdr automatically sets the ELF_F_DIRTY bit (see elf_flag(3E)). A program may useelf_getident to inspect the identification bytes from a file.

Section 3−−236 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_getehdr(3E) elf_getehdr(3E)

SEE ALSOelf(3E), elf_begin(3E), elf_flag(3E), elf_getident(3E).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−237

A eA

elf_getident(3E) elf_getident(3E)

NAMEelf_getident - retrieve file identification data

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

char *elf_getident(Elf *elf, size_t *ptr);

DESCRIPTIONAs elf (3E) explains, ELF provides a framework for various classes of files, where basic objects may have32 bits, 64 bits, and so forth. To accommodate these differences, without forcing the larger sizes onsmaller machines, the initial bytes in an ELF file hold identification information common to all fileclasses. Every ELF header’s e_ident has EI_NIDENT bytes with the following interpretation.

e_ident Index Value PurposeEI_MAG0 ELFMAG0 File identificationEI_MAG1 ELFMAG1EI_MAG2 ELFMAG2EI_MAG3 ELFMAG3EI_CLASS ELFCLASSNONE File class

ELFCLASS32ELFCLASS64

EI_DATA ELFDATANONE Data encodingELFDATA2LSBELFDATA2MSB

EI_VERSION EV_CURRENT File versionEI_OSABI ELFOSABI_NONE OS/ABI identification

ELFOSABI_HPUXEI_ABIVERSION 0 ABI version

1EI_PAD Start of padding bytes

10-15 0 Unused, set to zero

Other kinds of files (see elf_kind (3E)) also may have identification data, though they would not conformto e_ident .

elf_getident returns a pointer to the file’s ‘‘initial bytes.’’ If the library recognizes the file, a conver-sion from the file image to the memory image may occur. In any case, the identification bytes areguaranteed not to have been modified, though the size of the unmodified area depends on the file type. Ifptr is non-null, the library stores the number of identification bytes in the location to which ptr points. Ifno data is present, elf is null, or an error occurs, the return value is a null pointer, with zero optionallystored through ptr .

SEE ALSOelf(3E), elf_begin(3E), elf_getehdr(3E), elf_kind(3E), elf_rawfile(3E).

Section 3−−238 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_getphdr(3E) elf_getphdr(3E)

NAMEelf32_getphdr, elf32_newphdr, elf64_getphdr, elf64_newphdr - retrieve class-dependent program headertable for elf32 and elf64 files, respectively

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf32_Phdr *elf32_getphdr(Elf *elf);Elf32_Phdr *elf32_newphdr(Elf *elf, size_t count);Elf64_Phdr *elf64_getphdr(Elf *elf);Elf64_Phdr *elf64_newphdr(Elf *elf, size_t count);

DESCRIPTIONFor a 32-bit class file, elf32_getphdr returns a pointer to the program execution header table, if oneis available for the ELF descriptor elf .

elf32_newphdr allocates a new table with count entries, regardless of whether one existed previously,and sets the ELF_F_DIRTY bit for the table (see elf_flag(3E)). Specifying a zero count deletes an exist-ing table. Note this behavior differs from that of elf32_newehdr (see elf_getehdr (3E)), allowing a pro-gram to replace or delete the program header table, changing its size if necessary.

If no program header table exists, the file is not a 32-bit class file, an error occurs, or elf is null, both func-tions return a null pointer. Additionally, elf32_newphdr returns a null pointer if count is zero.

The table is an array of Elf32_Phdr structures, each of which includes the following members.

Elf32_Word p_type;Elf32_Off p_offset;Elf32_Addr p_vaddr;Elf32_Addr p_paddr;Elf32_Word p_filesz;Elf32_Word p_memsz;Elf32_Word p_flags;Elf32_Word p_align;

The ELF header’s e_phnum member tells how many entries the program header table has (seeelf_getehdr (3E)). A program may inspect this value to determine the size of an existing table;elf32_newphdr automatically sets the member’s value to count. If the program is building a new file,it is responsible for creating the file’s ELF header before creating the program header table.

For a 64-bit class file, elf64_getphdr returns a pointer to the program execution header table, if oneis available for the ELF descriptor elf .

elf64_newphdr allocates a new table with count entries, regardless of whether one existed previously,and sets the ELF_F_DIRTY bit for the table (see elf_flag (3E)). Specifying a zero count deletes anexisting table. Note this behavior differs from that of elf64_newehdr (see elf_getehdr (3E)), allowing aprogram to replace or delete the program header table, changing its size if necessary.

If no program header table exists, the file is not a 64-bit class file, an error occurs, or elf is null, both func-tions return a null pointer. Additionally, elf64_newphdr returns a null pointer if count is zero.

The table is an array of Elf64_Phdr structures, each of which includes the following members.

Elf64_Word p_type;Elf64_Off p_offset;Elf64_Addr p_vaddr;Elf64_Addr p_paddr;Elf64_Xword p_filesz;Elf64_Xword p_memsz;Elf64_Word p_flags;Elf64_Xword p_align;

The ELF header’s e_phnum member tells how many entries the program header table has (seeelf_getehdr (3E)). A program may inspect this value to determine the size of an existing table;elf64_newphdr automatically sets the member’s value to count. If the program is building a new file,it is responsible for creating the file’s ELF header before creating the program header table.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−239

A eA

elf_getphdr(3E) elf_getphdr(3E)

SEE ALSOelf(3E), elf_begin(3E), elf_flag(3E), elf_getehdr(3E).

Section 3−−240 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A eA

elf_getscn(3E) elf_getscn(3E)

NAMEelf_getscn, elf_ndxscn, elf_newscn, elf_nextscn - get section information

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Scn *elf_getscn(Elf *elf, size_t index);size_t elf_ndxscn(Elf_Scn *scn);Elf_Scn *elf_newscn(Elf *elf);Elf_Scn *elf_nextscn(Elf *elf, Elf_Scn *scn);

DESCRIPTIONThese functions provide indexed and sequential access to the sections associated with the ELF descriptorelf . If the program is building a new file, it is responsible for creating the file’s ELF header before creat-ing sections; see elf_getehdr (3E).

elf_getscn returns a section descriptor, given an index into the file’s section header table. Note thefirst ‘‘real’’ section has index 1. Although a program can get a section descriptor for the section whoseindex is 0 (SHN_UNDEF, the undefined section), the section has no data and the section header is ‘‘empty’’(though present). If the specified section does not exist, an error occurs, or elf is null, elf_getscnreturns a null pointer.

elf_newscn creates a new section and appends it to the list for elf . Because the SHN_UNDEFsection isrequired and not ‘‘interesting’’ to applications, the library creates it automatically. Thus the first call toelf_newscn for an ELF descriptor with no existing sections returns a descriptor for section 1. If anerror occurs or elf is null, elf_newscn returns a null pointer.

After creating a new section descriptor, the program can use elf_getshdr to retrieve the newlycreated, ‘‘clean’’ section header. The new section descriptor will have no associated data (seeelf_getdata (3E)). When creating a new section in this way, the library updates the e_shnum member ofthe ELF header and sets the ELF_F_DIRTY bit for the section (see elf_flag(3E)). If the program is build-ing a new file, it is responsible for creating the file’s ELF header (see elf_getehdr (3E)) before creating newsections.

elf_nextscn takes an existing section descriptor, scn , and returns a section descriptor for the nexthigher section. One may use a null scn to obtain a section descriptor for the section whose index is 1(skipping the section whose index is SHN_UNDEF). If no further sections are present or an error occurs,elf_nextscn returns a null pointer.

elf_ndxscn takes an existing section descriptor, scn , and returns its section table index. If scn is nullor an error occurs, elf_ndxscn returns SHN_UNDEF.

EXAMPLESAn example of sequential access appears below. Each pass through the loop processes the next section inthe file; the loop terminates when all sections have been processed.

scn = 0;while ((scn = elf_nextscn(elf, scn)) != 0){

/* process section */}

SEE ALSOelf(3E), elf_begin(3E), elf_flag(3E), elf_getdata(3E), elf_getehdr(3E), elf_getshdr(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−241

A eA

elf_getshdr(3E) elf_getshdr(3E)

NAMEelf32_getshdr, elf64_getshdr - retrieve class-dependent section header for elf32 and elf64 files, respec-tively

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf32_Shdr *elf32_getshdr(Elf_Scn *scn);Elf64_Shdr *elf64_getshdr(Elf_Scn *scn);

DESCRIPTIONFor a 32-bit class file, elf32_getshdr returns a pointer to a section header for the section descriptorscn . Otherwise, the file is not a 32-bit class file, scn was null, or an error occurred; elf32_getshdrthen returns NULL. The header includes the following members.

Elf32_Word sh_name;Elf32_Word sh_type;Elf32_Word sh_flags;Elf32_Addr sh_addr;Elf32_Off sh_offset;Elf32_Word sh_size;Elf32_Word sh_link;Elf32_Word sh_info;Elf32_Word sh_addralign;Elf32_Word sh_entsize;

For a 64-bit class file, elf64_getshdr returns a pointer to a section header for the section descriptorscn . Otherwise, the file is not a 64-bit class file, scn was null, or an error occurred; elf64_getshdrthen returns NULL. The header includes the following members.

Elf64_Word sh_name;Elf64_Word sh_type;Elf64_Xword sh_flags;Elf64_Addr sh_addr;Elf64_Off sh_offset;Elf64_Xword sh_size;Elf64_Word sh_link;Elf64_Word sh_info;Elf64_Xword sh_addralign;Elf64_Xword sh_entsize;

If the program is building a new file, it is responsible for creating the file’s ELF header before creatingsections.

SEE ALSOelf(3E), elf_flag(3E), elf_getscn(3E), elf_strptr(3E).

Section 3−−242 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_hash(3E) elf_hash(3E)

NAMEelf_hash - compute hash value

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

unsigned long elf_hash(const char *name);

DESCRIPTIONelf_hash computes a hash value, given a null terminated string, name . The returned hash value, h,can be used as a bucket index, typically after computing h mod x to ensure appropriate bounds.

Hash tables may be built on one machine and used on another because elf_hash uses unsigned arith-metic to avoid possible differences in various machines’ signed arithmetic. Although name is shown aschar* above, elf_hash treats it as unsigned char* to avoid sign extension differences. Usingchar* eliminates type conflicts with expressions such as elf_hash ("name").

ELF files’ symbol hash tables are computed using this function (see elf_getdata (3E) and elf_xlate (3E)).The hash value returned is guaranteed not to be the bit pattern of all ones (˜0UL ).

SEE ALSOelf(3E), elf_getdata(3E), elf_xlate(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−243

A eA

elf_kind(3E) elf_kind(3E)

NAMEelf_kind - determine file type

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Kind elf_kind(Elf *elf);

DESCRIPTIONThis function returns a value identifying the kind of file associated with an ELF descriptor elf . Currentlydefined values appear below.

ELF_K_AR The file is an archive (see ar (4)). An ELF descriptor may also be associated with anarchive member , not the archive itself, and then elf_kind identifies the member’s type.

ELF_K_ELF The file is an ELF file. The program may use elf_getident to determine the class.Other functions, such as elf_getehdr , are available to retrieve other file information.

ELF_K_NONE This indicates a kind of file unknown to the library.

Other values are reserved, to be assigned as needed to new kinds of files. elf should be a value previouslyreturned by elf_begin . A null pointer is allowed, to simplify error handling, and causes elf_kind toreturn ELF_K_NONE.

SEE ALSOar(4), elf(3E), elf_begin(3E), elf_getehdr(3E), elf_getident(3E).

Section 3−−244 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_next(3E) elf_next(3E)

NAMEelf_next - sequential archive member access

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Cmd elf_next(Elf *elf);

DESCRIPTIONelf_next , elf_rand , and elf_begin manipulate simple object files and archives. elf is an ELFdescriptor previously returned from elf_begin .

elf_next provides sequential access to the next archive member. That is, having an ELF descriptor,elf , associated with an archive member, elf_next prepares the containing archive to access the follow-ing member when the program calls elf_begin . After successfully positioning an archive for the nextmember, elf_next returns the value ELF_C_READ. Otherwise, the open file was not an archive, elfwas null, or an error occurred, and the return value is ELF_C_NULL. In either case, the return valuemay be passed as an argument to elf_begin , specifying the appropriate action.

SEE ALSOar(4), elf(3E), elf_begin(3E), elf_getarsym(3E), elf_rand(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−245

A eA

elf_rand(3E) elf_rand(3E)

NAMEelf_rand - random archive member access

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

size_t elf_rand(Elf *elf, size_t offset);

DESCRIPTIONelf_rand , elf_next , and elf_begin manipulate simple object files and archives. elf is an ELFdescriptor previously returned from elf_begin .

elf_rand provides random archive processing, preparing elf to access an arbitrary archive member. elfmust be a descriptor for the archive itself, not a member within the archive. offset gives the byte offsetfrom the beginning of the archive to the archive header of the desired member. See elf_getarsym (3E) formore information about archive member offsets. When elf_rand works, it returns offset . Otherwise itreturns 0, because an error occurred, elf was null, or the file was not an archive (no archive member canhave a zero offset). A program may mix random and sequential archive processing.

EXAMPLESAn archive starts with a ‘‘magic string’’ that has SARMAGbytes; the initial archive member followsimmediately. An application could thus provide the following function to rewind an archive (the functionreturns -1 for errors and 0 otherwise).

#include <ar.h>#include <libelf.h>

intrewindelf(Elf *elf){

if (elf_rand(elf, (size_t)SARMAG) == SARMAG)return 0;

return -1;}

SEE ALSOar(4), elf(3E), elf_begin(3E), elf_getarsym(3E), elf_next(3E).

Section 3−−246 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_rawfile(3E) elf_rawfile(3E)

NAMEelf_rawfile - retrieve uninterpreted file contents

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

char *elf_rawfile(Elf *elf, size_t *ptr);

DESCRIPTIONelf_rawfile returns a pointer to an uninterpreted byte image of the file. This function should be usedonly to retrieve a file being read. For example, a program might use elf_rawfile to retrieve the bytesfor an archive member.

A program may not close or disable (see elf_cntl (3E)) the file descriptor associated with elf before the ini-tial call to elf_rawfile , because elf_rawfile might have to read the data from the file if it doesnot already have the original bytes in memory. Generally, this function is more efficient for unknown filetypes than for object files. The library implicitly translates object files in memory, while it leavesunknown files unmodified. Thus asking for the uninterpreted image of an object file may create a dupli-cate copy in memory.

elf_rawdata (see elf_getdata (3E)) is a related function, providing access to sections within a file.

If ptr is non-null, the library also stores the file’s size, in bytes, in the location to which ptr points. If nodata is present, elf is null, or an error occurs, the return value is a null pointer, with zero optionallystored through ptr .

NOTICESA program that uses elf_rawfile and that also interprets the same file as an object file potentially hastwo copies of the bytes in memory. If such a program requests the raw image first, before it asks fortranslated information (through such functions as elf_getehdr , elf_getdata , and so on), thelibrary ‘‘freezes’’ its original memory copy for the raw image. It then uses this frozen copy as the sourcefor creating translated objects, without reading the file again. Consequently, the application should viewthe raw file image returned by elf_rawfile as a read-only buffer, unless it wants to alter its own viewof data subsequently translated. In any case, the application may alter the translated objects withoutchanging bytes visible in the raw image.

Multiple calls to elf_rawfile with the same ELF descriptor return the same value; the library doesnot create duplicate copies of the file.

SEE ALSOelf(3E), elf_begin(3E), elf_cntl(3E), elf_getdata(3E), elf_getehdr(3E), elf_getident(3E), elf_kind(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−247

A eA

elf_strptr(3E) elf_strptr(3E)

NAMEelf_strptr - make a string pointer

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

char *elf_strptr(Elf *elf, size_t section, size_t offset);

DESCRIPTIONThis function converts a string section offset to a string pointer. elf identifies the file in which the stringsection resides, and section gives the section table index for the strings. elf_strptr normally returnsa pointer to a string, but it returns a null pointer when elf is null, section is invalid or is not a section oftype SHT_STRTAB, the section data cannot be obtained, offset is invalid, or an error occurs.

EXAMPLESA prototype for retrieving section names appears below. The file header specifies the section name stringtable in the e_shstrndx member. The following code loops through the sections, printing their names.

if ((ehdr = elf32_getehdr(elf)) == 0){

/* handle the error */return;

}ndx = ehdr->e_shstrndx;scn = 0;while ((scn = elf_nextscn(elf, scn)) != 0){

char *name = 0;if ((shdr = elf32_getshdr(scn)) != 0)

name = elf_strptr(elf, ndx,(size_t)shdr->sh_name);

printf("’%s’\n", name? name: "(null)");}

NOTICESA program may call elf_getdata to retrieve an entire string table section. For some applications, thatwould be both more efficient and more convenient than using elf_strptr .

SEE ALSOelf(3E), elf_getdata(3E), elf_getshdr(3E), elf_xlate(3E).

Section 3−−248 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_update(3E) elf_update(3E)

NAMEelf_update - update an ELF descriptor

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

off_t elf_update(Elf *elf, Elf_Cmd cmd);

DESCRIPTIONelf_update causes the library to examine the information associated with an ELF descriptor, elf , andto recalculate the structural data needed to generate the file’s image.

cmd may have the following values.

ELF_C_NULL This value tells elf_update to recalculate various values, updating only the ELFdescriptor’s memory structures. Any modified structures are flagged with theELF_F_DIRTY bit. A program thus can update the structural information and thenreexamine them without changing the file associated with the ELF descriptor.Because this does not change the file, the ELF descriptor may allow reading, writing,or both reading and writing (see elf_begin (3E)).

ELF_C_WRITE If cmd has this value, elf_update duplicates its ELF_C_NULL actions and alsowrites any ‘‘dirty’’ information associated with the ELF descriptor to the file. That is,when a program has used elf_getdata or the elf_flag facilities to supply new(or update existing) information for an ELF descriptor, those data will be examined,coordinated, translated if necessary (see elf_xlate (3E)), and written to the file. Whenportions of the file are written, any ELF_F_DIRTY bits are reset, indicating thoseitems no longer need to be written to the file (see elf_flag(3E)). The sections’ data iswritten in the order of their section header entries, and the section header table iswritten to the end of the file.

When the ELF descriptor was created with elf_begin , it must have allowed writingthe file. That is, the elf_begin command must have been either ELF_C_RDWRorELF_C_WRITE.

If elf_update succeeds, it returns the total size of the file image (not the memory image), in bytes.Otherwise an error occurred, and the function returns -1.

When updating the internal structures, elf_update sets some members itself. Members listed beloware the application’s responsibility and retain the values given by the program.

Member Notese_ident[EI_DATA] Library controls other

e_ident valuese_type

e_machinee_version

ELF Header e_entrye_phoff Only when ELF_F_LAYOUT

assertede_shoff Only when ELF_F_LAYOUT

assertede_flags

e_shstrndx

Member Notesp_type The application controls all

p_offset program header entriesp_vaddrp_paddr

Program Header p_filesz

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−249

A eA

elf_update(3E) elf_update(3E)

p_memszp_flagsp_align

Member Notessh_namesh_type

sh_flagssh_addr

sh_offset Only when ELF_F_LAYOUTasserted

Section Header sh_size Only when ELF_F_LAYOUTasserted

sh_linksh_info

sh_addralign Only when ELF_F_LAYOUTasserted

sh_entsize

Member Notesd_buf

d_typed_size

Data Descriptor d_off Only when ELF_F_LAYOUTasserted

d_alignd_version

Note the program is responsible for two particularly important members (among others) in the ELFheader. The e_version member controls the version of data structures written to the file. If the ver-sion is EV_NONE, the library uses its own internal version. The e_ident[EI_DATA] entry controls thedata encoding used in the file. As a special case, the value may be ELFDATANONEto request the nativedata encoding for the host machine. An error occurs in this case if the native encoding doesn’t match afile encoding known by the library.

Further note that the program is responsible for the sh_entsize section header member. Although thelibrary sets it for sections with known types, it cannot reliably know the correct value for all sections.Consequently, the library relies on the program to provide the values for unknown section type. If theentry size is unknown or not applicable, the value should be set to zero.

When deciding how to build the output file, elf_update obeys the alignments of individual data buffersto create output sections. A section’s most strictly aligned data buffer controls the section’s alignment.The library also inserts padding between buffers, as necessary, to ensure the proper alignment of eachbuffer.

NOTICESAs mentioned above, the ELF_C_WRITEcommands translate data as necessary, before writing them tothe file. This translation is not always transparent to the application program. If a program hasobtained pointers to data associated with a file (for example, see elf_getehdr (3E) and elf_getdata (3E)), theprogram should reestablish the pointers after calling elf_update .

As elf_begin (3E) describes, a program may ‘‘update’’ a COFF file to make the image consistent for ELF.(COFF is an object file format that preceded ELF on some computer architectures (Intel, for example).When a program calls elf_begin on a COFF file, the library translates COFF structures to their ELFequivalents, allowing programs to read (but not to write) a COFF file as if it were ELF. This conversionhappens only to the memory image and not to the file itself.) The ELF_C_NULLcommand updates onlythe memory image; one can use the ELF_C_WRITEcommand to modify the file as well. Absolute execut-able files (a.out files) require special alignment, which cannot normally be preserved between COFFand ELF. Consequently, one may not update an executable COFF file with the ELF_C_WRITEcommand(though ELF_C_NULLis allowed).

SEE ALSOelf(3E), elf_begin(3E), elf_flag(3E), elf_fsize(3E), elf_getdata(3E), elf_getehdr(3E), elf_getshdr(3E),elf_xlate(3E).

Section 3−−250 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A eA

elf_version(3E) elf_version(3E)

NAMEelf_version - coordinate ELF library and application versions

SYNOPSIScc [flag ... ] file ... -lelf [library ]...

#include <libelf.h>

unsigned elf_version(unsigned ver);

DESCRIPTIONAs elf (3E) explains, the program, the library, and an object file have independent notions of the ‘‘latest’’ELF version. elf_version lets a program determine the ELF library’s internal version. It further letsthe program specify what memory types it uses by giving its own working version, ver, to the library.Every program that uses the ELF library must coordinate versions as described below.

The header file libelf.h supplies the version to the program with the macro EV_CURRENT. If thelibrary’s internal version (the highest version known to the library) is lower than that known by the pro-gram itself, the library may lack semantic knowledge assumed by the program. Accordingly,elf_version will not accept a working version unknown to the library.

Passing ver equal to EV_NONEcauses elf_version to return the library’s internal version, withoutaltering the working version. If ver is a version known to the library, elf_version returns the previ-ous (or initial) working version number. Otherwise, the working version remains unchanged andelf_version returns EV_NONE.

EXAMPLESThe following excerpt from an application program protects itself from using an older library.

if (elf_version(EV_CURRENT) == EV_NONE){

/* library out of date *//* recover from error */

}

NOTICESThe working version should be the same for all operations on a particular elf descriptor. Changing theversion between operations on a descriptor will probably not give the expected results.

SEE ALSOelf(3E), elf_begin(3E), elf_xlate(3E).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−251

A eA

elf_xlate(3E) elf_xlate(3E)

NAMEelf32_xlatetof, elf32_xlatetom, elf64_xlatetof, elf64_xlatetom - class-dependent data translation for elf32and elf64 files, respectively

SYNOPSIScc [flag ... ] file ... -lelf [library ] ...

#include <libelf.h>

Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,unsigned encode);

Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src,unsigned encode);

Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,unsigned encode);

Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src,unsigned encode);

DESCRIPTIONelf32_xlatetom translates various data structures from their 32-bit class file representations to theirmemory representations; elf64_xlatetom translates various data structures from their 64-bit classfile representations to their memory representations; elf32_xlatetof and elf64_xlatetof pro-vide the inverse. This conversion is particularly important for cross development environments. src is apointer to the source buffer that holds the original data; dst is a pointer to a destination buffer that willhold the translated copy. encode gives the byte encoding in which the file objects are (to be) representedand must have one of the encoding values defined for the ELF header’s e_ident[EI_DATA] entry (seeelf_getident (3E)). If the data can be translated, the functions return dst . Otherwise, they return nullbecause an error occurred, such as incompatible types, destination buffer overflow, and so forth.

elf_getdata (3E) describes the Elf_Data descriptor, which the translation routines use as follows.

d_buf Both the source and destination must have valid buffer pointers.

d_type This member’s value specifies the type of the data to which d_buf points and thetype of data to be created in the destination. The program supplies a d_typevalue in the source; the library sets the destination’s d_type to the same value.These values are summarized below.

d_size This member holds the total size, in bytes, of the memory occupied by the sourcedata and the size allocated for the destination data. If the destination buffer is notlarge enough, the routines do not change its original contents. The translation rou-tines reset the destination’s d_size member to the actual size required, after thetranslation occurs. The source and destination sizes may differ.

d_version This member holds version number of the objects (desired) in the buffer. The sourceand destination versions are independent.

Translation routines allow the source and destination buffers to coincide. That is, dst->d_buf mayequal src->d_buf . Other cases where the source and destination buffers overlap give undefinedbehavior.

Section 3−−252 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

elf_xlate(3E) elf_xlate(3E)

For elf32 files:

Elf_Type 32-Bit Memory TypeELF_T_ADDR Elf32_AddrELF_T_BYTE unsigned charELF_T_DYN Elf32_DynELF_T_EHDR Elf32_EhdrELF_T_HALF Elf32_HalfELT_T_OFF Elf32_OffELF_T_PHDR Elf32_PhdrELF_T_REL Elf32_RelELF_T_RELA Elf32_RelaELF_T_SHDR Elf32_ShdrELF_T_SWORD Elf32_SwordELF_T_SYM Elf32_SymELF_T_WORD Elf32_Word

For elf64 files:

Elf_Type 64-Bit Memory TypeELF_T_ADDR Elf64_AddrELF_T_BYTE unsigned charELF_T_DYN Elf64_DynELF_T_EHDR Elf64_EhdrELF_T_HALF Elf64_HalfELT_T_OFF Elf64_OffELF_T_PHDR Elf64_PhdrELF_T_REL Elf64_RelELF_T_RELA Elf64_RelaELF_T_SHDR Elf64_ShdrELF_T_SWORD Elf64_SwordELF_T_SYM Elf64_SymELF_T_WORD Elf64_Word

‘‘Translating’’ buffers of type ELF_T_BYTEdoes not change the byte order.

SEE ALSOelf(3E), elf_fsize(3E), elf_getdata(3E), elf_getident(3E).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−253

A eA

end(3C) end(3C)

NAMEend, etext, edata, __data_start, __text_start - last locations in program

SYNOPSISextern void *_end, *end, *_etext, *etext, *_edata, *edata, *__data_start,

*__text_start;

DESCRIPTIONThese names refer neither to routines nor to locations with interesting contents. The address of the sym-bols _etext and etext is the first address above the program text, the address of _edata andedata is the first address above the initialized data region, and the address of _end and end is thefirst address above the uninitialized data region.

The address of the symbols __data_start is the beginning address of the program’s data area, and__text_start is the beginning address of the program’s text area.

The linker defines these symbols with the appropriate values if they are referenced by the program butnot defined. The linker issues an error if the user attempts to define _etext , _edata , _end ,__data_start , or __text_start .

When execution begins, the program break (the first location beyond the data) coincides with _end , butthe program break can be reset by the routines of brk(2), malloc (3C), standard input/output (stdio (3S)),the profile (-p ) option of cc(1), and so on. Thus, the current value of the program break should be deter-mined by sbrk(0) (see brk(2)).

WARNINGSIn C, these names must look like addresses. Thus, use &end instead of end to access the current valueof end .

SEE ALSOSystem Tools:

cc(1) invoke the HP-UX C compilerld(1) invoke the link editor

Miscellaneous:brk(2) change data segment space allocationcrt0 (3) execution startup routinemalloc (3C) main memory allocatorstdio (3S) standard buffered input/output stream file package

STANDARDS CONFORMANCEend() : XPG2

edata() : XPG2

etext() : XPG2

Section 3−−254 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

endwin(3X) endwin(3X)(CURSES)

NAMEendwin — suspend Curses session

SYNOPSIS#include <curses.h>

int endwin(void);

DESCRIPTIONThe endwin() function restores the terminal after Curses activity by at least restoring the saved shellterminal mode, flushing any output to the terminal and moving the cursor to the first column of the lastline of the screen. Refreshing a window resumes program mode. The application must call endwin()for each terminal being used before exiting. If newterm() is called more than once for the same termi-nal, the first screen created must be the last one for which endwin() is called.

RETURN VALUEUpon successful completion, endwin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe endwin() function does not free storage associated with a screen, so delscreen() should becalled after endwin() if a particular screen is no longer needed.

To leave Curses mode temporarily, portable applications should call endwin() . Subsequently, to returnto Curses mode, they should call doupdate() , refresh() or wrefresh() .

SEE ALSOdelscreen(3X), doupdate(3X), initscr(3X), isendwin(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list is explicitly declared as void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−255

A eA

erasechar(3X) erasechar(3X)(CURSES)

NAMEerasechar, killchar — single-byte terminal environment query functions

SYNOPSIS#include <curses.h>

char erasechar(void);

char killchar(void);

DESCRIPTIONThe erasechar() function returns the current erase character. The erasewchar() function storesthe current erase character in the object pointed to by ch. If no erase character has been defined, thefunction will fail and the object pointed to by ch will not be changed.

The killchar() function returns the current line kill character.

RETURN VALUEThe erasechar() function returns the erase character and killchar() returns the line kill charac-ter. The return value is unspecified when these characters are multi-byte characters.

ERRORSNo errors are defined.

APPLICATION USAGEThe erasechar() and killchar() functions are only guaranteed to operate reliably on charactersets in which each character fits into a single byte, whose attributes can be expressed using only con-stants with the A_ prefix. Moreover, they do not reliably indicate cases in which when the erase or linekill character, respectively, has not been defined. The erasewchar() and killwchar() functionsovercome these limitations.

SEE ALSOclearok(3X), delscreen(3X), erasewchar(3X), curses_intro(3X), see Attributes , <curses.h>, tcattribute(3C)(in the X/Open System Interfaces and Headers, Issue 4, Version 2 specification).

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The killchar() function is merged with this entry. In previous issues, it appeared in an entry of itsown.

The entry is rewritten for clarity. The argument list for the erasechar() and killchar() functionsis explicitly declared as void.

Section 3−−256 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

erasewchar(3X) erasewchar(3X)(ENHANCED CURSES)

NAMEerasewchar, killwchar — terminal environment query functions

SYNOPSIS#include <curses.h>

int erasewchar(wchar_t * ch);

int killwchar(wchar_t * ch);

DESCRIPTIONThe erasewchar() function stores the current erase character in the object pointed to by ch. If noerase character has been defined, the function will fail and the object pointed to by ch will not bechanged.

The killwchar() function stores the current line kill character in the object pointed to by ch. If noline kill character has been defined, the function will fail and the object pointed to by ch will not bechanged.

RETURN VALUEUpon successful completion, erasewchar() and killwchar() return OK. Otherwise, they returnERR.

ERRORSNo errors are defined.

SEE ALSOAttributes in curses_intro(3X), clearok(3X), delscreen(3X), <curses.h>, tcattribute(3C) (in the X/OpenSystem Interfaces and Headers, Issue 4, Version 2 specification).

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−257

A eA

erf(3M) erf(3M)

NAMEerf( ), erff( ), erfl( ), erfw( ), erfq( ), erfc( ), erfcf( ), erfcl( ), erfcw( ), erfcq( ) - error function and complemen-tary error functions

SYNOPSIS#include <math.h>

double erf(double x);

double erfc(double x);

Itanium(R)-based System Onlyfloat erff(float x);

long double erfl(long double x);

extended erfw(extended x);

quad erfq(quad x);

float erfcf(float x);

long double erfcl(long double x);

extended erfcw(extended x);

quad erfcq(quad x);

DESCRIPTIONerf() returns the error function of x , defined as:

(2/sqrt (pi )) *(integral with respect to t from 0 to x of (exp (pow(-t,2))))

erfc() returns the complementary value, 1.0 − erf( x) . It prevents the extreme loss of relative accu-racy if erf( x) is called for a large x and the result is subtracted from 1.0. (For example, for x = 5, twelvedecimal places are lost.)

Itanium-based System Onlyerff() and erfcf() are float versions of erf() and erfc() respectively; they take a floatargument and return a float result.

erfl() and erfcl() are long double versions of erf() and erfc() respectively; they take along double argument and return a long double result.

erfw() and erfcw() are extended versions of erf() and erfc() respectively; they take anextended argument and return an extended result.

erfq() and erfcq() are equivalent to erfl() and erfcl() respectively on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) erfw() , erfcw() , erfq() , or erfcq() , compile also with the-fpwidetypes option.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEerf( ±0) returns ±0.

If x is +INFINITY, erf() returns 1.0.

If x is −INFINITY, erf() returns −1.0.

If x is +INFINITY, erfc() returns zero.

If x is −INFINITY, erfc() returns 2.0.

Section 3−−258 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

erf(3M) erf(3M)

Whether erf() and erfc() raise the inexact exception is unspecified.

If x is NaN, erf() and erfc() return NaN.

ERRORSNo errors are defined.

SEE ALSOexp(3M), pow(3M), sqrt(3M), math(5).

STANDARDS CONFORMANCEerf() , erfc() : SVID3, XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

erff() , erfl() , erfcf() , erfcl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-pointarithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−259

A eA

exp(3M) exp(3M)

NAMEexp( ), expf( ), expl( ), expw( ), expq( ) - exponential functions

SYNOPSIS#include <math.h>

double exp(double x);

float expf(float x);

Itanium(R)-based System Onlylong double expl(long double x);

extended expw(extended x);

quad expq(quad x);

DESCRIPTIONexp() returns ex.

expf() is a float version of exp() ; it takes a float argument and returns a float result.

Itanium-based System Onlyexpl() is a long double version of exp() ; it takes a long double argument and returns along double result.

expw() is an extended version of exp() ; it takes an extended argument and returns anextended result.

expq() is equivalent to expl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) expw() or expq() , compile also with the -fpwidetypes option.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the exp() functions are available. Millicode versions of math library functions areusually faster than their counterparts in the standard library. To use these versions, compile your pro-gram with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the same values as their standard library counterparts(see the RETURN VALUE section), but do not set errno .

RETURN VALUEexp( ±0) returns 1.

If x is +INFINITY, exp() returns +INFINITY.

If x is −INFINITY, exp() returns +0.

If x is NaN, exp() returns NaN.

exp() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, and raisesthe overflow and inexact exceptions.

exp() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

When it raises no other exception, whether exp() raises the inexact exception is unspecified.

ERRORSIf the correct value would overflow, exp() sets errno to [ERANGE].

Section 3−−260 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

exp(3M) exp(3M)

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOcbrt(3M), cexp(3M), exp10(3M), exp2(3M), expm1(3M), log(3M), pow(3M), sqrt(3M), math(5).

STANDARDS CONFORMANCEexp() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

expf() , expl() : ISO/IEC C99 (including Annex F,‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−261

A eA

exp10(3M) exp10(3M)

NAMEexp10( ), exp10f( ), exp10l( ), exp10w( ), exp10q( ) - base-10 exponential functions

SYNOPSIS#include <math.h>

Itanium(R)-based System Onlydouble exp10(double x);

float exp10f(float x);

long double exp10l(long double x);

extended exp10w(extended x);

quad exp10q(quad x);

DESCRIPTIONItanium-based System Only

exp10() returns 10x.

exp10f() is a float version of exp10() ; it takes a float argument and returns a float result.

exp10l() is a long double version of exp10() ; it takes a long double argument and returns along double result.

exp10w() is an extended version of exp10() ; it takes an extended argument and returns anextended result.

exp10q() is equivalent to exp10l() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use exp10w() or exp10q() , compile also with the -fpwidetypes option.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEexp10( ±0) returns 1.

If x is +INFINITY, exp10() returns +INFINITY.

If x is −INFINITY, exp10() returns zero.

If x is NaN, exp10() returns NaN.

exp10() returns infinity in lieu of a value whose magnitude is too large, and raises the overflow andinexact exceptions.

exp10() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

exp10() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSNo errors are defined.

SEE ALSOcbrt(3M), exp(3M), exp2(3M), expm1(3M), log10(3M), pow(3M), sqrt(3M), math(5).

STANDARDS CONFORMANCEThese functions are not specified by any standard.

Section 3−−262 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A eA

exp2(3M) exp2(3M)

NAMEexp2( ), exp2f( ), exp2l( ), exp2w( ), exp2q( ) - base-2 exponential functions

SYNOPSIS#include <math.h>

double exp2(double x);

Itanium(R)-based System Onlyfloat exp2f(float x);

long double exp2l(long double x);

extended exp2w(extended x);

quad exp2q(quad x);

DESCRIPTIONexp2() returns 2x.

Itanium-based Sysstem Onlyexp2f() is a float version of exp2() ; it takes a float argument and returns a float result.

exp2l() is a long double version of exp2() ; it takes a long double argument and returns along double result.

exp2w() is an extended version of exp2() ; it takes an extended argument and returns anextended result.

exp2q() is equivalent to exp2l() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) exp2w() or exp2q() , compile also with the -fpwidetypesoption.

To use these functions, make sure your program includes <math.h> , and link in the math library byspecifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEexp2( ±0) returns 1.

If x is +INFINITY, exp2() returns +INFINITY.

If x is −INFINITY, exp2() returns zero.

If x is NaN, exp2() returns NaN.

exp2() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, and raisesthe overflow and inexact exceptions.

exp2() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

exp2() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSItanium-based System Only

If the correct value would overflow, exp2() sets errno to [ERANGE].

HP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOcbrt(3M), exp(3M), exp10(3M), expm1(3M), log2(3M), pow(3M), sqrt(3M), math(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−263

A eA

exp2(3M) exp2(3M)

STANDARDS CONFORMANCEexp2() , exp2f() , exp2l() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−264 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A eA

expm1(3M) expm1(3M)

NAMEexpm1( ), expm1f( ), expm1l( ), expm1w( ), expm1q( ) - exponential minus 1 functions

SYNOPSIS#include <math.h>

double expm1(double x);

Itanium(R)-based System Onlyfloat expm1f(float x);

long double expm1l(long double x);

extended expm1w(extended x);

quad expm1q(quad x);

DESCRIPTIONThe expm1() function is equivalent to exp( x) - 1, but may be more accurate for very small values of x .

The expm1() and log1p() functions are useful to guarantee that financial calculations of(((1+x)**n)-1)/x are accurate when x is very small, namely:

expm1(n * log1p (x))/x

The preceding example might be applicable when calculating small daily interest rates.

See also annuity() .

Itanium-based System Onlyexpm1f() is a float version of expm1() ; it takes a float argument and returns a float result.

expm1l() is a long double version of expm1() ; it takes a long double argument and returns along double result.

expm1w() is an extended version of expm1() ; it takes an extended argument and returns anextended result.

expm1q() is equivalent to expm1l() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) expm1w() or expm1q() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> , and link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEexpm1( ±0) returns ±0.

If x is +INFINITY, expm1() returns +INFINITY.

If x is −INFINITY, expm1() returns -1.0.

If x is NaN, expm1() returns NaN.

expm1() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, andraises the overflow and inexact exceptions.

When it raises no other exception, whether expm1() raises the inexact exception is unspecified.

ERRORSIf the correct value would overflow, expm1() sets errno to [ERANGE].

Itanium-based System OnlyHP-UX libm functions on Itanium-based system do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−265

A eA

expm1(3M) expm1(3M)

SEE ALSOannuity(3M), compound(3M), exp(3M), log1p(3M), math(5).

STANDARDS CONFORMANCEexpm1() : XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

expm1f() , expm1l() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−266 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

fabs(3M) fabs(3M)

NAMEfabs( ), fabsf( ), fabsl( ), fabsw( ), fabsq( ) - absolute value functions

SYNOPSIS#include <math.h>

double fabs(double x);

float fabsf(float x);

Itanium(R)-based System Onlylong double fabsl(long double x);

extended fabsw(extended x);

quad fabsq(quad x);

DESCRIPTIONThe fabs() function returns the absolute value of x , |x|.

fabsf() is a float version of fabs() ; it takes a float argument and returns a float result.

Itanium-based System Onlyfabsl() is a long double version of fabs() ; it takes a long double argument and returns along double result.

fabsw() is an extended version of fabs() ; it takes an extended argument and returns anextended result.

fabsq() is equivalent to fabsl() on HP-UX systems.

USAGETo use fabsf() , compile either with the default -Ae option or with the -Aa option. For PA-RISC only,the -D_HPUX_SOURCEoption must be used along with the -Aa option.

To use (for Itanium-based systems) fabsl() , fabsw() , or fabsq() , compile either with the default-Ae option or with the -Aa and -D_HPUX_SOURCEoptions. To use fabsw() or fabsq() , compilewith the -fpwidetypes option.

To use these functions, make sure your program includes <math.h> , and link in the math library byspecifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is ±INFINITY, fabs() returns +INFINITY.

If x is NaN, fabs() returns NaN.

These functions raise no exceptions.

ERRORSNo errors are defined.

SEE ALSOabs(3C), cabs(3M), ceil(3M), floor(3M), fmod(3M), rint(3M), math(5).

STANDARDS CONFORMANCEfabs() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arith-metic")

fabsf() , fabsl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−267

A fA

fattach(3C) fattach(3C)

NAMEfattach( ) - attach a STREAMS file descriptor to an object in the file system name space

SYNOPSIS#include <stropts.h>

int fattach(int fd, const char *path);

DESCRIPTIONThe fattach() function attaches the fd file descriptor to an object in the file system name space desig-nated by path . fd specifies an open file descriptor to a STREAMS device or STREAMS-based pipe. pathspecifies the pathname of an existing object in the file system. A STREAMS device or pipe can beattached to more than one node in the file system name space. In other words, a STREAMS device or pipeis allowed to have several associated names. Until the STREAMS device or pipe is detached from thenode (with fdetach (3C) or fdetach (1M)), all operations on path will act on the STREAMS device or pipeinstead of the file system object path .

The fattach ed stream’s attributes (see the stat (2) reference page) are set according to the followingscheme:

• The group ID, user ID, times, and permissions are set to those of path .

• The size as well as the device number are set to those of the STREAMS device or pipe designated bythe fd parameter. Note that although the attributes of the fattach ed STREAMS device or pipe maychange (see the chmod(2) reference page), the attributes of the underlying file system object path willnot be changed.

• The number of links is set to 1.

RETURN VALUEUpon successful completion, the fattach() function returns a value of 0 (zero). Otherwise, it returns avalue of -1, and errno is set to indicate the error.

ERRORSIf any of the following conditions occurs, the fattach() function sets errno to the value thatcorresponds to the condition.

[EACCES] Although the user is the owner of path , the user has no write permissions for it.

[EBADF] The fd parameter is an invalid file descriptor.

[EBUSY] The existing object specified by the path parameter is already mounted or has afile descriptor attached to it.

[EFAULT] The path parameter points to a location outside of the allocated address space ofthe process.

[EINVAL] The fd parameter does not refer to a STREAMS device or STREAMS-based pipe.

[ELOOP] When path was translated, too many symbolic links were found.

[ENOENT] path does not exist.

[ENOTDIR] The directory portion of the path parameter does not exist.

[ENAMETOOLONG] The size of a pathname component is longer than NAME_MAXwhen_POSIX_NO_TRUNCis in effect, or the pathname length is longer thanPATH_MAX.

[EPERM] The current effective user ID is not the owner of the existing object specified bythe path parameter.

SEE ALSOfdetach(3C), isastream(3C), chmod(2), stat(2), fdetach(1M), streamio(7).

STANDARDS COMPLIANCEfattach() : SVID3

Section 3−−268 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fclose(3S) fclose(3S)

NAMEfclose(), fflush(), fclose_unlocked(), fflush_unlocked() - close or flush a stream

SYNOPSIS#include <stdio.h>

int fclose(FILE *stream);

int fflush(FILE *stream);

Obsolescent Interfacesint fclose_unlocked(FILE *stream);

int fflush_unlocked(FILE *stream);

DESCRIPTIONfclose() causes any buffered data for the named stream to be written out, and the stream to be closed.Buffers allocated by the standard input/output system may be freed.

fclose() is performed automatically for all open files upon calling exit (2).

If stream points to an output stream or an update stream in which the most recent operation was output,fflush() causes any buffered data for the stream to be written to that file; otherwise any buffered datais discarded. The stream remains open.

If stream is a null pointer, fflush() performs this flushing action on all currently open streams.

Obsolescent Interfacesfclose_unlocked() and fflush_unlocked() close or flush a stream.

RETURN VALUEUpon successful completion, fclose() and fflush() return 0. Otherwise, they return EOF and seterrno to indicate the error.

ERRORSIf fclose() , fflush() , fclose_unlocked() , or fflush_unlocked() fails, errno is set to oneof:

[EAGAIN] The O_NONBLOCKflag is set for the file descriptor underlying stream and the pro-cess would be delayed in the write operation.

[EBADF] The file descriptor underlying stream is not valid.

[EFBIG] An attempt was made to write a file that exceeds the process’s file size limit or themaximum file size (see ulimit (2)).

[EINTR] fclose() or fflush() was interrupted by a signal.

[EIO] The process is in a background process group and is attempting to write to its con-trolling terminal, TOSTOPis set, the process is neither ignoring nor blocking theSIGTTOUsignal, and the process group of the process is orphaned.

[ENOSPC] There was no free space remaining on the device containing the file.

[EPIPE] An attempt was made to write to a pipe that is not open for reading by any process.A SIGPIPE signal is also sent to the process.

Additional errno values may be set by the underlying write() , lseek() , and close() functions(see write (2), lseek (2) and close (2)).

WARNINGSfclose_unlocked() and fflush_unlocked() are obsolescent interfaces supported only for com-patibility with existing DCE applications. New multithreaded applications should use fclose() andfflush() .

SEE ALSOclose(2), exit(2), lseek(2), write(2), flockfile(3S), fopen(3S), setbuf(3S), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−269

A fA

fclose(3S) fclose(3S)

STANDARDS CONFORMANCEfclose() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

fflush() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−270 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

fdetach(3C) fdetach(3C)

NAMEfdetach( ) - detach a name from a STREAMS file descriptor

SYNOPSIS#include <stropts.h>

int fdetach(const char *path);

DESCRIPTIONThe fdetach() function detaches a file descriptor from a name in the file system designated by path .path specifies the pathname of an existing object in the file system name space that was previouslyattached (see the fattach() reference page). As a result of the fdetach() operation, the node’sstatus and permissions return to the state prior to the file attaching to the node. Any later operations onpath will affect only the file system node and not the attached file. The user must either be superuser orown path and have write permission.

RETURN VALUEUpon successful completion, the fdetach() function returns a value of 0 (zero). Otherwise, it returns avalue of -1 is returned, and errno is set to indicate the error.

ERRORSIf any of the following conditions occurs, the fdetach() function sets errno to the value thatcorresponds to the condition.

[EFAULT] The path parameter points outside the process’ allocated address space.

[EACCES] The user is not the owner of the file or does not have the correct permissions toaccess the file.

[EINVAL] The object pointed to by the path parameter is not fattached to a STREAMS dev-ice or pipe.

[ELOOP] When path was translated, too many symbolic links were found.

[ENOENT] The path parameter points to a pathname that does not exist.

[ENOTDIR] The directory portion of the path parameter does not exist.

[ENAMETOOLONG] The size of a pathname component is longer than NAME_MAXwhen_POSIX_NO_TRUNCis in effect, or the pathname length is longer thanPATH_MAX.

[EPERM] The current effective user ID is not the owner of the existing object specified bythe path parameter, or the current effective user ID does not specify a user withthe correct permissions.

SEE ALSOfattach(3C), isastream(3C), umount(2), fdetach(1M), streamio(7).

STANDARDS COMPLIANCEfdetach() : SVID3

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−271

A fA

fdim(3M) fdim(3M)

NAMEfdim( ), fdimf( ), fdiml( ), fdimw( ), fdimq( ) - positive difference functions

SYNOPSIS#include <math.h>

double fdim(double x, double y);

Itanium(R)-based System Onlyfloat fdimf(float x, float y);

long double fdiml(long double x, long double y);

extended fdimw(extended x, extended y);

quad fdimq(quad x, quad y);

DESCRIPTIONThe fdim() function determines the positive difference between its arguments.

Itanium-based System Onlyfdimf() is a float version of fdim() ; it takes float arguments and returns a float result.

fdiml() is a long double version of fdim() ; it takes long double arguments and returns along double result.

fdimw() is an extended version of fdim() ; it takes extended arguments and returns anextended result.

fdimq() is equivalent to fdiml() on HP-UX systems.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. To use (for Itanium-based systems) fdimw() or fdimq() , compile with the -fpwidetypesoption. Make sure your program includes <math.h> . Link in the math library by specifying -lm on thecompiler or linker command line.

RETURN VALUEThe fdim() function returns the positive difference between x and y .

If x > y , fdim() returns x - y (and raises any exceptions resulting from the subtraction).

If x <= y , fdim() returns +zero.

If x or y is NaN, fdim() returns NaN.

If both arguments are NaNs, fdim() returns NaN.

fdim() returns a positively signed infinity in lieu of a value whose magnitude is too large, and raises theoverflow and inexact exceptions.

ERRORSNo errors are defined.

SEE ALSOfdim(3M), fmin(3M), math(5).

STANDARDS CONFORMANCEfdim() , fdimf() , fdiml() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−272 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

feclearexcept(3M) feclearexcept(3M)

NAMEfeclearexcept( ) - clear floating-point exception flags

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint feclearexcept(int excepts);

PA-RISC Onlyvoid feclearexcept(int excepts);

DESCRIPTIONThe feclearexcept() function clears the exception flags represented by its argument. The argumentcan be constructed as a bitwise OR of the exception macros: FE_INEXACT, FE_DIVBYZERO,FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID . FE_ALL_EXCEPT represents all the floating-point exceptions.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimizationsthat can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating all specified exceptions were cleared.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESClear the underflow and inexact floating-point exception flags:

#include <fenv.h>/*...*/

feclearexcept(FE_UNDERFLOW | FE_INEXACT);

Clear all floating-point exception flags:

#include <fenv.h>/*...*/

feclearexcept(FE_ALL_EXCEPT);

SEE ALSOfegetexceptflag(3M), fegettrapenable(3M), feraiseexcept(3M), fesetexceptflag(3M), fesettrapenable(3M),fetestexcept(3M), fenv(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−273

A fA

feclearexcept(3M) feclearexcept(3M)

STANDARDS CONFORMANCEfeclearexcept() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

Section 3−−274 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

fegetenv(3M) fegetenv(3M)

NAMEfegetenv( ) - get floating-point environment

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint fegetenv(fenv_t *envp);

PA-RISC Onlyvoid fegetenv(fenv_t *envp);

DESCRIPTIONThe fegetenv() function stores the current floating-point environment in the object pointed to by theargument envp .

To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimizationsthat can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that a representation of the current environment was success-fully stored.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESStore the current floating-point environment:

#include <fenv.h>/*...*/

fenv_t env;/*...*/fegetenv(&env);

SEE ALSOfeholdexcept(3M), fesetenv(3M), feupdateenv(3M), fenv(5).

STANDARDS CONFORMANCEfegetenv() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−275

A fA

fegetexceptflag(3M) fegetexceptflag(3M)

NAMEfegetexceptflag( ) - get floating-point exception flags

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint fegetexceptflag(fexcept_t *flagp, int excepts);

PA-RISC Onlyvoid fegetexceptflag(fexcept_t *flagp, int excepts);

DESCRIPTIONThe fegetexceptflag() function stores a representation of the states of the floating-point exceptionflags indicated by the argument excepts in the object pointed to by the argument flagp . The excepts argu-ment can be constructed as a bitwise OR of the floating-point exception macros: FE_INEXACT,FE_DIVBYZERO, FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID . FE_ALL_EXCEPTrepresentsall the floating-point exceptions. The object into which the floating-point exception flags are stored can bepassed to fesetexceptflag to restore the system exception flags, but the representation of thefloating-point exception flags stored in the object is otherwise unspecified.

Use fetestexcept() , instead of fegetexceptflag() , to determine which floating-point exceptionflags are set.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that a representation was successfully stored.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESStore the overflow and invalid floating-point exception flags:

#include <fenv.h>/*...*/

fexcept_t flags;/*...*/fegetexceptflag(&flags, FE_OVERFLOW | FE_INVALID);

SEE ALSOfeclearexcept(3M), fegettrapenable(3M), feraiseexcept(3M), fesetexceptflag(3M), fesettrapenable(3M),fetestexcept(3M), fenv(5).

Section 3−−276 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fegetexceptflag(3M) fegetexceptflag(3M)

STANDARDS CONFORMANCEfegetexceptflag() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−277

A fA

fegetflushtozero(3M) fegetflushtozero(3M)

NAMEfegetflushtozero( ) - get floating-point underflow mode

SYNOPSIS#include <fenv.h>

int fegetflushtozero(void);

DESCRIPTIONThe fegetflushtozero() function retrieves the value representing the current underflow mode,which is either IEEE-754-compliant (gradual) underflow mode or flush-to-zero mode.

The default underflow mode is IEEE-754-compliant.

Flush-to-zero mode, also known as fast underflow mode, is supported on most PA1.1 systems and on allPA2.0 and Itnaium(R)-based systems. In IEEE-754-compliant mode, underflow cases may be handled bytrapping into the kernel, where the IEEE-mandated conversion of the result into a denormalized value orzero is accomplished by software emulation. On PA-RISC systems, flush-to-zero mode allows the substitu-tion of a zero for denormal operands and operation results, without trapping into the kernel. OnItanium-based systems, flush-to-zero mode causes a zero to be substituted for denormal results (but notoperands), without trapping into the kernel. Flush-to-zero mode may offer a significant performanceimprovement for some applications.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe fegetflushtozero() function returns zero if the current underflow mode is IEEE-754-compliant. The function returns 1 if the current underflow mode is flush-to-zero.

On systems that do not support flush-to-zero mode, this function returns an undefined value.

ERRORSNo errors are defined.

EXAMPLESSave the current underflow mode, set flush-to-zero mode, and restore the previous mode.

#include <fenv.h>/*...*/

int fm_saved;

fm_saved = fegetflushtozero();fesetflushtozero(1);/*...*/fesetflushtozero(fm_saved);

Section 3−−278 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fegetflushtozero(3M) fegetflushtozero(3M)

AUTHORfegetflushtozero() was developed by HP and is not required by any current standard.

SEE ALSOfesetflushtozero(3M), fenv(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−279

A fA

fegetround(3M) fegetround(3M)

NAMEfegetround( ) - get floating-point rounding direction mode

SYNOPSIS#include <fenv.h>

int fegetround(void);

DESCRIPTIONThe fegetround() function gets the current rounding direction, as specified by the IEEE 754 (IEC60559) floating-point standard.

The default rounding direction mode is round to nearest (FE_TONEAREST).

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe fegetround() function returns the value of the rounding direction macro representing the currentrounding direction. The return value will match one of the following macros, which are defined in<fenv.h> :

FE_TONEAREST Round to nearest. If the two nearest representable are equally near, the onewith its least significant bit zero is delivered.

FE_UPWARD Round upwards (towards +infinity).

FE_DOWNWARD Round downwards (towards -infinity).

FE_TOWARDZERORound toward zero.

ERRORSNo errors are defined.

EXAMPLESSave, set, and restore the rounding direction.

#include <fenv.h>/*...*/{

int save_round;

save_round = fegetround();fesetround(FE_UPWARD);/*...*/fesetround(save_round);/*...*/

}

Section 3−−280 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fegetround(3M) fegetround(3M)

SEE ALSOfesetround(3M), fenv(5).

STANDARDS CONFORMANCEfegetround() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−281

A fA

fegettrapenable(3M) fegettrapenable(3M)

NAMEfegettrapenable( ) - get floating-point exception trap enables

SYNOPSIS#include <fenv.h>

int fegettrapenable(void);

DESCRIPTIONThe fegettrapenable() function determines which floating-point exception traps are currentlyenabled.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe fegettrapenable() function returns the bitwise OR of the floating-point exception macroscorresponding to the currently enabled exception traps. The macros are FE_INEXACT, FE_DIVBYZERO,FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID . FE_ALL_EXCEPT represents all the floating-point exceptions.

ERRORSNo errors are defined.

EXAMPLESRetrieve the current trap settings and determine whether a trap for the divide by zero exception isenabled.

#include <fenv.h>/*...*/

if (fegettrapenable() & FE_DIVBYZERO)printf("divide by zero trap set\\n");

AUTHORfegettrapenable() was developed by HP and is not required by any current standard.

SEE ALSOfeclearexcept(3M), fegetexceptflag(3M), feraiseexcept(3M), fesetexceptflag(3M), fesettrapenable(3M),fenv(5).

Section 3−−282 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

feholdexcept(3M) feholdexcept(3M)

NAMEfeholdexcept( ) - save floating-point environment

SYNOPSIS#include <fenv.h>

int feholdexcept(fenv_t *envp);

DESCRIPTIONThe feholdexcept() function saves the current floating-point environment in the object pointed to bythe argument envp . This function also clears the floating-point exception flags and disables all traps.

Use feholdexcept() with feupdateenv() to hide spurious floating-point exceptions. Use it withfesetenv() to hide all floating-point exceptions.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe feholdexcept() function returns a zero value, indicating the successful disabling of any traps.

ERRORSNo errors are defined.

EXAMPLESStore the current floating-point environment in holdenv , hide spurious underflow exceptions, and con-tinue on any floating-point exceptions that occur until the call to feupdateenv() is encountered.

#include <fenv.h>/*...*/

fenv_t holdenv;

feholdexcept(&holdenv);/* perform operations */if (/* test for spurious underflow */)

feclearexcept(FE_UNDERFLOW);feupdateenv(&holdenv); /* raise accumulated exceptions */

SEE ALSOfegetenv(3M), fesetenv(3M), feupdateenv(3M), fenv(5).

STANDARDS CONFORMANCEfeholdexcept() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−283

A fA

feraiseexcept(3M) feraiseexcept(3M)

NAMEferaiseexcept( ) - raise floating-point exceptions

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint feraiseexcept(int excepts);

PA-RISC Onlyvoid feraiseexcept(int excepts);

DESCRIPTIONThe feraiseexcept() function raises the floating-point exceptions represented by its argument. Theargument can be constructed as a bitwise OR of the exception macros: FE_INEXACT, FE_DIVBYZERO,FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID . FE_ALL_EXCEPTrepresents all the exceptions.

Any traps enabled for the specified exceptions will be taken.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that all the specified exceptions were successfully raised.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESRaise the underflow and inexact exceptions:

#include <fenv.h>/*...*/

feraiseexcept(FE_UNDERFLOW | FE_INEXACT);

Raise all exceptions:

#include <fenv.h>/*...*/

feraiseexcept(FE_ALL_EXCEPT);

SEE ALSOfeclearexcept(3M), fegetexceptflag(3M), fegettrapenable(3M), fesetexceptflag(3M), fesettrapenable(3M),fetestexcept(3M), fenv(5).

Section 3−−284 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

feraiseexcept(3M) feraiseexcept(3M)

STANDARDS CONFORMANCEferaiseexcept() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−285

A fA

ferror(3S) ferror(3S)

NAMEferror(), feof(), clearerr(), ferror_unlocked(), feof_unlocked(), clearerr_unlocked() - stream status inquiries

SYNOPSIS#include <stdio.h>

int ferror(FILE *stream);

int feof(FILE *stream);

void clearerr(FILE *stream);

Obsolescent Interfacesint ferror_unlocked(FILE *stream);

int feof_unlocked(FILE *stream);

void clearerr_unlocked(FILE *stream);

DESCRIPTIONferror() Returns nonzero when an I/O error has previously occurred reading from or writing to

the named stream , otherwise zero. Unless cleared by clearerr() , or unless thespecific stdio routine so indicates, the error indication lasts until the stream is closed.

feof() Returns nonzero when EOF has previously been detected reading the named inputstream , otherwise zero.

clearerr() Resets the error indicator and EOF indicator on the named stream to zero.

Obsolescent Interfacesferror_unlocked() , feof_unlocked() , and clearerr_unlocked() stream status inquiries.

WARNINGSAll these routines are implemented both as library functions and as macros. The macro versions, whichare used by default, are defined in <stdio.h> . To obtain the library function, either use a #undef toremove the macro definition or, if compiling in ANSI-C mode, enclose the function name in parentheses oruse the function address. The following example illustrates each of these methods :

#include <stdio.h>#undef ferror

...main(){

int (*find_error()) ();...

return_val=ferror(fd);...

return_val=(feof)(fd1);...

find_error = feof;};

Reentrant InterfacesIf _REENTRANTis defined before including <stdio.h> , the locked versions of the library functions forferror() , feof() , and clearerr() are used by default.

ferror_unlocked() , feof_unlocked() , and clearerr_unlocked() are obsolescent inter-faces supported only for compatibility with existing DCE applications. New multithreaded applicationsshould use ferror() , feof() and clearerr() .

SEE ALSOopen(2), flockfile(3S), fopen(3S), thread_safety(5).

STANDARDS CONFORMANCEferror() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

clearerr() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−286 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

ferror(3S) ferror(3S)

feof() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−287

A fA

fesetenv(3M) fesetenv(3M)

NAMEfesetenv( ) - set floating-point environment

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint fesetenv(const fenv_t *envp);

PA-RISC Onlyvoid fesetenv(const fenv_t *envp);

DESCRIPTIONThe fesetenv() function establishes the floating-point environment represented by the object pointedto by envp . The argument envp must point to an object set by a call to fegetenv() or feholdex-cept() , or equal the macro FE_DFL_ENV.

Note that fesetenv() merely installs the state of the floating-point exception flags represented throughits argument, and does not raise these floating-point exceptions (hence no traps will be taken).

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that the environment was successfully established.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESStore the current floating-point environment, continue on exceptions, and then restore the previousenvironment without raising the accumulated floating-point exceptions.

#include <fenv.h>/*...*/

fenv_t holdenv;

feholdexcept(&holdenv);/* perform operations */

fesetenv(&holdenv);

Restore the default environment:

#include <fenv.h>/*...*/

fesetenv(FE_DFL_ENV);

Section 3−−288 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fesetenv(3M) fesetenv(3M)

SEE ALSOfegetenv(3M), feholdexcept(3M), feupdateenv(3M), fenv(5).

STANDARDS CONFORMANCEfesetenv() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−289

A fA

fesetexceptflag(3M) fesetexceptflag(3M)

NAMEfesetexceptflag( ) - set floating-point exception flags

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint fesetexceptflag(const fexcept_t *flagp, int excepts);

PA-RISC Onlyvoid fesetexceptflag(const fexcept_t *flagp, int excepts);

DESCRIPTIONThe fesetexceptflag() function sets the status for the floating-point exception flags indicated by theargument excepts to the states stored in the object pointed to by flagp . The value of *flagp must havebeen set by a previous call to fegetexceptflag() whose second argument represented at least thosefloating-point exceptions represented by the argument excepts ; otherwise, the effect on the indicatedfloating-point exception flags is undefined. This function does not raise exceptions, but only sets the stateof the flags (hence no traps will be taken). The excepts argument can be constructed as a bitwise OR ofthe floating-point exception macros: FE_INEXACT, FE_DIVBYZERO, FE_UNDERFLOW, FE_OVERFLOW,and FE_INVALID . FE_ALL_EXCEPTrepresents all the floating-point exceptions.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to preventoptimizations that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that all the specified flags were successfully set to the appropri-ate state.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESUse fegetexceptflag() to save the current state of two floating-point exception flags. Later, usefesetexceptflag() to restore the saved state.

#include <fenv.h>/*...*/

fexcept_t saved_flags;/*...*/fegetexceptflag(&saved_flags, FE_DIVBYZERO | FE_INEXACT);/*...*/fesetexceptflag(&saved_flags, FE_DIVBYZERO | FE_INEXACT);

Section 3−−290 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fesetexceptflag(3M) fesetexceptflag(3M)

SEE ALSOfeclearexcept(3M), fegetexceptflag(3M), fegettrapenable(3M), feraiseexcept(3M), fesettrapenable(3M),fetestexcept(3M), fenv(5).

STANDARDS CONFORMANCEfesetexceptflag() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−291

A fA

fesetflushtozero(3M) fesetflushtozero(3M)

NAMEfesetflushtozero( ) - set floating-point underflow mode

SYNOPSIS#include <fenv.h>

void fesetflushtozero(int);

DESCRIPTIONThe fesetflushtozero() function sets the current underflow mode. If the argument is 1, theunderflow mode is set to flush-to-zero mode. If the argument is zero, the underflow mode is set to IEEE-754-compliant (gradual) underflow mode. For arguments other than 1 or zero, the effect is undefined.

The default underflow mode is IEEE-754-compliant.

Flush-to-zero mode, also known as fast underflow mode, is supported on most PA1.1 systems and on allPA2.0 and Itanium(R)-based systems. In IEEE-754-compliant mode, cases that might underflow may behandled by trapping into the kernel, where the IEEE-mandated conversion of the result into a denormal-ized value or zero is accomplished by software emulation.

On PA-RISC systems, flush-to-zero mode allows the substitution of a zero for denormal operands andoperation results, without trapping into the kernel.

On Itanium-based systems, flush-to-zero mode causes a zero to be substituted for denormal results (butnot operands), without trapping into the kernel.

Flush-to-zero mode may offer a significant performance improvement for some applications.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUENone.

ERRORSNo errors are defined.

EXAMPLESSave the current underflow mode, set flush-to-zero mode, and restore the previous mode.

#include <fenv.h>/*...*/

int fm_saved;

fm_saved = fegetflushtozero();fesetflushtozero(1);/*...*/fesetflushtozero(fm_saved);

Section 3−−292 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fesetflushtozero(3M) fesetflushtozero(3M)

AUTHORfesetflushtozero() was developed by HP and is not required by any current standard.

SEE ALSOfegetflushtozero(3M), fenv(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−293

A fA

fesetround(3M) fesetround(3M)

NAMEfesetround( ) - set floating-point rounding direction mode

SYNOPSIS#include <fenv.h>

int fesetround(int round);

DESCRIPTIONThe fesetround() function establishes the rounding direction represented by its argument round .The round argument must equal one of the macros: FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, andFE_TOWARDZERO. If the argument does not match a rounding direction macro, the rounding direction isnot changed.

The default rounding direction mode is round to nearest (FE_TONEAREST).

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe fesetround() function returns a zero value if and only if the argument is equal to a roundingdirection macro.

ERRORSNo errors are defined.

EXAMPLESSave, set, and restore the rounding direction.

#include <fenv.h>/*...*/{

int save_round;

save_round = fegetround();fesetround(FE_UPWARD);/*...*/fesetround(save_round);/*...*/

}

SEE ALSOfegetround(3M), fenv(5).

STANDARDS CONFORMANCEfesetround() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

Section 3−−294 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fesettrapenable(3M) fesettrapenable(3M)

NAMEfesettrapenable( ) - set exception trap enables

SYNOPSIS#include <fenv.h>

void fesettrapenable(int excepts);

DESCRIPTIONThe fesettrapenable() function enables the exception traps indicated by the argument excepts anddisables the exception traps not indicated by the argument. The argument can be constructed as a bit-wise OR of the exception macros: FE_INEXACT, FE_DIVBYZERO, FE_UNDERFLOW, FE_OVERFLOW,and FE_INVALID . FE_ALL_EXCEPTrepresents all the exceptions.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUENone.

ERRORSNo errors are defined.

EXAMPLESEnable overflow and divide by zero traps and disable the others

#include <fenv.h>/*...*/

fesettrapenable(FE_OVERFLOW | FE_DIVBYZERO);

AUTHORfesettrapenable() was developed by HP and is not required by any current standard.

SEE ALSOfeclearexcept(3M), fegetexceptflag(3M), fegettrapenable(3M), feraiseexcept(3M), fesetexceptflag(3M),fetestexcept(3M), fenv(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−295

A fA

fetestexcept(3M) fetestexcept(3M)

NAMEfetestexcept( ) - test floating-point exceptions

SYNOPSIS#include <fenv.h>

int fetestexcept(int excepts);

DESCRIPTIONThe fetestexcept() function determines which of a specified subset of the floating-point exceptionflags are currently set. The excepts argument specifies the floating-point exception flags to be queried.The argument can be constructed as a bitwise OR of the exception macros: FE_INEXACT,FE_DIVBYZERO, FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID . FE_ALL_EXCEPTrepresentsall the floating-point exceptions.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium(R)-based systems, specify +Ofenvaccess on the compiler command line or place the callto this function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEThe fetestexcept() function returns the bitwise OR of the exception macros corresponding to thecurrently set floating-point exceptions included in excepts .

ERRORSNo errors are defined.

EXAMPLESCall f() if invalid is set, then g() if overflow is set:

#include <fenv.h>/*...*/

int set_excepts;/* operations that may raise exceptions */set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);if (set_excepts & FE_INVALID) f();if (set_excepts & FE_OVERFLOW) g();

SEE ALSOfeclearexcept(3M), fegetexceptflag(3M), fegettrapenable(3M), feraiseexcept(3M), fesetexceptflag(3M),fesettrapenable(3M), fenv(5).

STANDARDS CONFORMANCEfetestexcept() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

Section 3−−296 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

feupdateenv(3M) feupdateenv(3M)

NAMEfeupdateenv( ) - update floating-point environment

SYNOPSIS#include <fenv.h>

Itanium(R)-based System Onlyint feupdateenv(const fenv_t *envp);

PA-RISC Onlyvoid feupdateenv(const fenv_t *envp);

DESCRIPTIONThe feupdateenv() function saves the currently raised floating-point exceptions in its automaticstorage, installs the floating-point environment represented by the object pointed to by envp , and thenraises the saved floating-point exceptions. Use feholdexcept() with feupdateenv() to hide spuri-ous floating-point exceptions.

The argument envp must point to an object set by a call to fegetenv() or feholdexcept() , or equalthe macro FE_DFL_ENV.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. Make sure your program includes <fenv.h> .

For Itanium-based systems, specify +Ofenvaccess on the compiler command line or place the call tothis function under the effect of an affirmative FENV_ACCESSpragma:

#pragma STDC FENV_ACCESS ON

If the FENV_ACCESSpragma is placed outside of any top-level declarations in a file, the pragma willapply to all declarations in the compilation following the pragma until another FENV_ACCESSpragmais encountered or until the end of the file is reached.

If the FENV_ACCESSpragma is placed at the beginning of a block (compound statement), the pragmawill apply until another FENV_ACCESSpragma is encountered or until the end of the block is reached.

For PA-RISC, you might need to use the +Onomoveflops compiler option in order to prevent optimiza-tions that can undermine the specified behavior of this function.

Link in the math library by specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEItanium-based System Only

This function always returns 0, indicating that all the actions were successfully carried out.

PA-RISC OnlyNone.

ERRORSNo errors are defined.

EXAMPLESStore the current floating-point environment in holdenv , hide spurious underflow exceptions, and con-tinue on any floating-point exceptions that occur until the call to feupdateenv() is encountered.

#include <fenv.h>/*...*/

fenv_t holdenv;

feholdexcept(&holdenv);/* perform operations */if (/* test for spurious underflow */)

feclearexcept(FE_UNDERFLOW);feupdateenv(&holdenv); /* raise accumulated exceptions */

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−297

A fA

feupdateenv(3M) feupdateenv(3M)

SEE ALSOfegetenv(3M), feholdexcept(3M), fesetenv(3M), fenv(5).

STANDARDS CONFORMANCEfeupdateenv() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

Section 3−−298 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

fgetpos(3S) fgetpos(3S)

NAMEfgetpos( ), fsetpos( ) - save and restore a file position indicator for a stream

SYNOPSIS#include <stdio.h>

int fgetpos(FILE *stream, fpos_t *pos);

int fsetpos(FILE *stream, const fpos_t *pos);

DESCRIPTIONfgetpos() Store the current value of the file position indicator for the stream pointed to by stream

in the object pointed to by pos . The value stored contains information usable by fset-pos() for repositioning the stream to its position at the time of the call to fgetpos() .

fsetpos() Set the file position indicator for the stream pointed to by stream according to the valueof the object pointed to by pos , which must be a value set by an earlier call to fget-pos() on the same stream.

A successful call to fsetpos() clears the end-of-file indicator for the stream andundoes any effects of ungetc (3S) on the same stream. After a fsetpos() call, the nextoperation on a update stream can be either input or output.

RETURN VALUEIf successful, these functions return zero; otherwise non-zero.

ERRORSIf fgetpos() fails, errno is set to one of the following values.

[EINVAL] The current value of the file position cannot be represented correctly in an object of sizefpos_t in this environment.

Additional errno values may be set by the underlying ftell() function (see fseek (3S)).

WARNINGSFailure can occur if these functions are used on a file that has not been opened via fopen() . In particu-lar, they must not be used on a terminal or on a file opened via popen (3S).

fsetpos() has no effect on streams that are open for append (see fopen (3S)).

SEE ALSOfgetpos64(3S), fseek(3S), fopen(3S), popen(3S), ungetc(3S), thread_safety(5).

STANDARDS CONFORMANCEfgetpos() : AES, SVID3, XPG4, ANSI C

fsetpos() : AES, SVID3, XPG4, ANSI C

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−299

A fA

fgetpos64(3S) fgetpos64(3S)

NAMEfgetpos64( ), fopen64( ), freopen64( ), fseeko64( ), fsetpos64( ), fstatvfsdev64( ), ftello64( ), ftw64( ), nftw64( ),statvfsdev64( ), tmpfile64( ) - non-POSIX standard API interfaces to support large files.

SYNOPSIS#include <stdio.h>

int fgetpos64(FILE *stream, fpos64_t *pos);

#include <stdio.h>

FILE *fopen64(const char *pathname, const char *type);

#include <stdio.h>

FILE *freopen64(const char *pathname, const char *type, FILE *stream);

#include <stdio.h>

int fseeko64(FILE *stream, off64_t *offset, int whence);

#include <stdio.h>

int fsetpos64(FILE *stream, const fpos64_t *pos);

#include <sys/statvfs.h>

int fstatvfsdev64(int filedes, struct statvfs64 *buf);

#include <stdio.h>

off64_t ftello64(FILE *stream);

#include <ftw.h>

int ftw64(const char *path,int (*fn)(const char *obj_path,

const struct stat64 *obj_stat,int obj_flags),

int depth);

#include <ftw.h>

int nftw64(const char *path,int (*fn)(const char *obj_path,

const struct stat64 *obj_stat,int obj_flags,struct FTW obj_FTW),

int depth,int flags);

#include <sys/statvfs.h>

int statvfsdev64(const char *path, struct statvfs64 *buf);

#include <stdio.h>

FILE *tmpfile64(void);

DESCRIPTIONNew API’s to support large files. These API interfaces are not a part of the POSIX standard and may beremoved in the future.

fgetpos64() The fgetpos64() function is identical to fgetpos() except that fget-pos64() returns the position in a fpos64_t instead of a fpos_t . All otherfunctional behaviors, returns, and errors are identical.

fopen64() The fopen64() function is identical to fopen() in 64-bit compile environ-ment. The fopen64() function returns a pointer to a FILE which can be usedto grow the file past 2 GB if desired. All other functional behaviors, returns, anderrors are identical to fopen() .

freopen64() The freopen64() function is identical to freopen() in 64-bit compileenvironment. The freopen64() function returns a pointer to a FILE whichcan be used to grow the file past 2 GB if desired. All other functional behaviors,

Section 3−−300 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fgetpos64(3S) fgetpos64(3S)

returns, and errors are identical to freopen() .

fseeko64() The fseeko64() function is identical to fseeko() except thatfseeko64() accepts an off64_t for the size parameter instead of off_t . Allother functional behaviors, returns, and errors are identical.

fsetpos64() The fsetpos64() function is identical to fsetpos() except that fset-pos64() accepts an fpos64_t for the pos parameter instead of fpos_t . Allother functional behaviors, returns, and errors are identical.

fstatvfsdev64() The fstatvfsdev64() function is identical to fstatvfsdev() except thatfstatvfsdev64() accepts a struct statvfs64 for the second parameterinstead of struct statvfs . All other functional behaviors, returns, anderrors are identical.

ftello64() The ftello64() function is identical to ftello() except thatftello64() returns the file position in an off64_t instead of an off_t . Allother functional behaviors, returns, and errors are identical.

ftw64() The ftw64() function is identical to ftw() except that it that it utilizes astruct stat64 as the second parameter to the function whose pointer ispassed to ftw64() . All other functional behaviors, returns, and errors areidentical.

nftw64() The nftw64() function is identical to nftw() except that it that it utilizes astruct stat64 as the second parameter to the function whose pointer ispassed to nftw64() . All other functional behaviors, returns, and errors areidentical.

statvfsdev64() The statvfsdev64() function is identical to statvfsdev() except thatstatvfsdev64() accepts a struct statvfs64 for the second parameterinstead of struct statvfs . All other functional behaviors, returns, anderrors are identical.

tmpfile64() The tmpfile64() function is identical to tmpfile() in the 64-bit compileenvironment. Both interfaces create a temporary file that is capable of growingbeyond 2GB’s if desired. All other functional behaviors, returns, and errors areidentical.

SEE ALSOthread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−301

A fA

fgetws(3C) fgetws(3C)

NAMEfgetws(), fgetws_unlocked() - get a wide character string from a stream file

SYNOPSIS#include <stdio.h>

#include <wchar.h>

wchar_t *fgetws(wchar_t *ws, int n, FILE *stream);

Obsolescent Interfacewchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *stream);

Remarksfgetws() is compliant with the XPG4 Worldwide Portability Interface wide-character I/O functions. Itparallels the 8-bit character I/O function defined in gets (3S).

DESCRIPTIONfgetws() Reads characters from the stream , converts them into corresponding wide characters,

and places them into the array pointed to by ws , until n − 1 characters are read, a new-line character is read and transferred to ws , or an end-of-file condition is encountered.The wide string is then terminated with a null wide character.

The definition for this functions and the type wchar_t are provided in the <wchar.h> header.

Obsolescent Interfacefgetws_unlocked() get a wide character string from a stream file.

APPLICATION USAGEAfter fgetws() is applied to a stream, the stream becomes wide-oriented (see orientation (5)).

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines how wide character conversions are done.

International Code Set SupportSingle- and multi-byte character code sets are supported.

RETURN VALUEUpon successful completion, fgetws() and fgetws_unlocked() return ws . If the stream is at end-of-file, the end-of-file indicator for the stream is set and a null pointer is returned. If a read error occurs,the error indicator for the stream is set, errno is set to indicate the error, and a null pointer is returned.

ferror() and feof() can be used to distinguish between an error condition and an end-of-file condi-tion.

ERRORSfgetws() or fgetws_unlocked() fails if data needs to be read into the stream ’s buffer and anothererror occurs, errno is set to one of the following:

[EAGAIN] The O_NONBLOCKflag is set for the file descriptor underlying stream and the pro-cess would be delayed in the read operation.

[EBADF] The file descriptor underlying stream is not a valid file descriptor open for reading.

[EINTR] The read operation was terminated due to the receipt of a signal, and either no datawas transferred or the implementation does not report partial transfer for this file.

[EIO] The process is a member of a background process and is attempting to read from itscontrolling terminal, and either the process is ignoring or blocking the SIGTTINsignal or the process group of the process is orphaned.

[EILSEQ] The data obtained from the input stream do not form a valid wide character string.

Additional errno values can be set by the underlying read() function (see read (2)).

Section 3−−302 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fgetws(3C) fgetws(3C)

WARNINGSfgetws_unlocked() is an obsolescent interface supported only for compatibility with existing DCEapplications. New multithreaded applications should use fgetws() .

AUTHORfgetws() was developed by OSF and HP.

SEE ALSOferror(3S), flockfile(3S), fopen(3S), fread(3S), getwc(3C), putws(3C), scanf(3S), orientation(5),thread_safety(5).

STANDARDS COMPLIANCEfgetws() : XPG4

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−303

A fA

fileno(3S) fileno(3S)

NAMEfileno( ) - map stream pointer to file descriptor

SYNOPSIS#include <stdio.h>

int fileno(FILE *stream);

Obsolescent Interfacesint fileno_unlocked(FILE *stream);

DESCRIPTIONfileno() returns the integer file descriptor associated with the named stream ; see open (2).

The following symbolic values in <unistd.h > define the file descriptors associated with stdin ,stdout , and stderr when a program is started :

STDIN_FILENO Value of zero for standard input, stdin .STDOUT_FILENO Value of 1 for standard output, stdout .STDERR_FILENO Value of 2 for standard error, stderr .

Obsolescent Interfacesfileno_unlocked() map stream pointer to file descriptor

APPLICATION USAGEfileno_unlocked() is an obsolescent interface supported only for compatibility with existing DCEapplications. New multithreaded applications should use fileno() .

RETURN VALUEUpon error, fileno() and fileno_unlocked() return -1.

SEE ALSOopen(2), flockfile(3S), fopen(3S), thread_safety(5).

STANDARDS CONFORMANCEfileno() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Section 3−−304 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

filter(3X) filter(3X)(ENHANCED CURSES)

NAMEfilter — disable use of certain terminal capabilities

SYNOPSIS#include <curses.h>

void filter(void);

DESCRIPTIONThe filter() function changes the algorithm for initialising terminal capabilities that assume that theterminal has more than one line. A subsequent call to initscr() or newterm() performs the follow-ing additional actions:

• Disable use of clear , cud , cud1 , cup , cuu1 and vpa .

• Set the value of the home string to the value of the cr string

• Set lines equal to 1.

Any call to filter() must precede the call to initscr() or newterm() .

RETURN VALUEThe filter() function does not return a value.

ERRORSNo errors are defined.

SEE ALSOinitscr(3X), terminfo(4), see Defined Capabilities , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−305

A fA

flash(3X) flash(3X)(CURSES)

NAMEflash — flash the screen

SYNOPSIS#include <curses.h>

int flash(void);

DESCRIPTIONThe flash() function alerts the user. It flashes the screen, or if that is not possible, it sounds the audi-ble alarm on the terminal. If neither signal is possible, nothing happens.

RETURN VALUEThe flash() function always returns OK.

ERRORSNo errors are defined.

APPLICATION USAGENearly all terminals have an audible alarm, but only some can flash the screen.

SEE ALSObeep(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

In previous issues, this function was included in the entry for beep() . It is moved to its own entry inX/Open Curses, Issue 4, the argument list is explicitly declared as void, and the RETURN VALUE sec-tion is changed to indicate that the function always returns OK.

Section 3−−306 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

flockfile(3S) flockfile(3S)

NAMEflockfile( ), ftrylockfile( ), funlockfile( ) - explicit locking of streams within a multithread application

SYNOPSIS#include <stdio.h>

void flockfile(FILE *stream);

int ftrylockfile(FILE *stream);

void funlockfile(FILE *stream);

DESCRIPTIONThe flockfile() , ftrylockfile() , and funlockfile() functions provide for explicitapplication-level locking of streams. These functions can be used by a thread to delineate a sequence ofI/O statements that are to be executed as a unit.

The flockfile() function is used by a thread to acquire ownership of a (FILE *) object.

The ftrylockfile() function is used by a thread to acquire ownership of a (FILE *) object if theobject is available; ftrylockfile() is a non-blocking version of flockfile() .

The funlockfile() function is used to relinquish the ownership granted to the thread. The behavioris undefined if a thread other than the current owner calls the funlockfile() function.

Logically, there is a count associated with each stream. This count is implicitly initialized to zero whenthe stream is created. The stream is unlocked when the count is zero. When the count is positive, a sin-gle thread owns the stream. When the flockfile() function is called, if the count is zero or if thecount is positive and the caller owns the stream, the count is incremented. Otherwise, the calling threadis suspended, waiting for the count to return to zero. Each call to funlockfile() decrements thecount. This allows matching calls to flockfile() (or successful calls to ftrylockfile() ) andfunlockfile() to be nested.

All POSIX.1 and C standard functions that reference (FILE *) objects behave as if they use flock-file() and funlockfile() internally to obtain ownership of these (FILE *) objects.

RETURN VALUENone for flockfile() and funlockfile() . The function ftrylockfile() returns zero for suc-cess and nonzero to indicate that the lock cannot be acquired.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−307

A fA

floor(3M) floor(3M)

NAMEfloor( ), floorf( ), floorl( ), floorw( ), floorq( ) - floor functions

SYNOPSIS#include <math.h>

double floor(double x);

Itanium(R)-based System Onlyfloat floorf(float x);

long double floorl(long double x);

extended floorw(extended x);

quad floorq(quad x);

DESCRIPTIONThe floor() returns the largest integer (represented as a double-precision number) not greater than x .

Itanium-based System Onlyfloorf() is a float version of floor() ; it takes a float argument and returns a float result.

floorl() is a long double version of floor() ; it takes a long double argument and returns along double result.

floorw() is an extended version of floor() ; it takes an extended argument and returns anextended result.

floorq() is equivalent to floorl() on HP-UX systems.

USAGETo use (for Itanium-based systems) floorf() , compile either with the default -Ae option or with the-Aa option.

To use (for Itanium-based systems) floorl() , floorw() , or floorq() , compile either with thedefault -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) floorw() or floorq() , compile also with the -fpwidetypesoption.

To use these functions, make sure your program includes <math.h> . Link in the math library by speci-fying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is ±INFINITY or ±zero, floor() returns x .

If x is NaN, floor() returns NaN.

floor() may raise the inexact exception if x is non integral and finite.

ERRORSNo errors are defined.

SEE ALSOceil(3M), fabs(3M), fmod(3M), rint(3M), math(5).

STANDARDS CONFORMANCEfloor() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

floorf() , floorl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−308 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

flushinp(3X) flushinp(3X)(CURSES)

NAMEflushinp — discard input

SYNOPSIS#include <curses.h>

int flushinp(void);

DESCRIPTIONThe flushinp() function discards (flushes) any characters in the input buffer associated with thecurrent screen.

RETURN VALUEThe flushinp() function always returns OK.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the flushinp() function is explicitly declaredas void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−309

A fA

fma(3M) fma(3M)(Itanium(R)-based System Only)

NAMEfma( ), fmaf( ), fmaw( ), fmal( ), fmaq( ) - floating multiply-add functions

SYNOPSIS#include <math.h>

double fma(double x, double y, double z);

float fmaf(float x, float y, float z);

long double fmal(long double x, long double y, long double z);

extended fmaw(extended x, extended y, extended z);

quad fmaq(quad x, quad y, quad z);

DESCRIPTIONfma() returns (x*y) + z, rounded as one ternary operation: it computes the value (as if) to infinite preci-sion and rounds once to the result format, according to the current rounding mode.

fmaf() is a float version of fma() ; it takes float arguments and returns a float result.

fmal() is a long double version of fma() ; it takes long double arguments and returns a longdouble result.

fmaw() is an extended version of fma() ; it takes extended arguments and returns an extendedresult.

fmaq() is equivalent to fmal() on HP-UX systems.

The FP_FAST_FMA, FP_FAST_FMAF, and FP_FAST_FMAWmacros are defined in <math.h> , indicat-ing that fma() , fmaf() , and fmaw() are each as fast as a multiply and add.

USAGEThese functions are available only for Itanium-based systems.

To use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use fmaw() or fmaq() , compile also with the -fpwidetypes option.

To use these functions, make sure your program includes <math.h> . Link in the math library by speci-fying -lm on the compiler or linker command line.

RETURN VALUEIf one of x and y is infinite, the other is zero, and z is a NaN, fma() returns NaN and optionally raisesthe invalid exception.

If one of x and y is infinite, the other is zero, and z is not a NaN, fma() returns NaN and raises theinvalid exception.

If x times y is an exact infinity and z is also an infinity but with the opposite sign, fma() returns NaNand raises the invalid exception.

fma() returns a properly signed infinity in lieu of a value whose magnitude is too large, and raise theoverflow and inexact exceptions.

fma() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

fma() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSNo errors are defined.

SEE ALSOmath(5).

STANDARDS CONFORMANCEfma() , fmaf() , fmal() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−310 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fmax(3M) fmax(3M)

NAMEfmax( ), fmaxf( ), fmaxl( ), fmaxw( ), fmaxq( ) - maximum value functions

SYNOPSIS#include <math.h>

double fmax(double x, double y);

Itanium(R)-based System Onlyfloat fmaxf(float x, float y);

long double fmaxl(long double x, long double y);

extended fmaxw(extended x, extended y);

quad fmaxq(quad x, quad y);

DESCRIPTIONThe fmax() function determines the maximum numeric value of its arguments.

Itanium-based System Onlyfmaxf() is a float version of fmax() ; it takes float arguments and returns a float result.

fmaxl() is a long double version of fmax() ; it takes long double arguments and returns along double result.

fmaxw() is an extended version of fmax() ; it takes extended arguments and returns anextended result.

fmaxq() is equivalent to fmaxl() on HP-UX systems.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. To use (for Itanium-based systems) fmaxw() or fmaxq() , compile with the -fpwidetypesoption. Make sure your program includes <math.h> . Link in the math library by specifying -lm on thecompiler or linker command line.

RETURN VALUEThe fmax() function returns the maximum numeric value of its arguments.

If one argument is a NaN and the other is numeric, fmax() returns the numeric argument.

If both arguments are NaNs, fmax() returns NaN.

ERRORSNo errors are defined.

SEE ALSOfdim(3M), fmin(3M), math(5).

STANDARDS CONFORMANCEfmax() , fmaxf() , fmaxl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−311

A fA

fmin(3M) fmin(3M)

NAMEfmin( ), fminf( ), fminl( ), fminw( ), fminq( ) - minimum value functions

SYNOPSIS#include <math.h>

double fmin(double x, double y);

Itanium(R)-based System Onlyfloat fminf(float x, float y);

long double fminl(long double x, long double y);

extended fminw(extended x, extended y);

quad fminq(quad x, quad y);

DESCRIPTIONThe fmin() function determines the minimum numeric value of its arguments.

Itanium-based System Onlyfminf() is a float version of fmin() ; it takes float arguments and returns a float result.

fminl() is a long double version of fmin() ; it takes long double arguments and returns along double result.

fminw() is an extended version of fmin() ; it takes extended arguments and returns anextended result.

fminq() is equivalent to fminl() on HP-UX systems.

USAGETo use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCEoptions. To use (for Itanium-based systems) fminw() or fminq() , compile with the -fpwidetypesoption. Make sure your program includes <math.h> . Link in the math library by specifying -lm on thecompiler or linker command line.

RETURN VALUEThe fmin() function returns the minimum numeric value of its arguments.

If one argument is a NaN and the other is numeric, fmin() returns the numeric argument.

If both arguments are NaNs, fmin() returns NaN.

ERRORSNo errors are defined.

SEE ALSOfdim(3M), fmax(3M), math(5).

STANDARDS CONFORMANCEfmin() , fminf() , fminl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−312 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fmod(3M) fmod(3M)

NAMEfmod( ), fmodf( ), fmodl( ), fmodw( ), fmodq( ) - remainder functions

SYNOPSIS#include <math.h>

double fmod(double x, double y);

float fmodf(float x, float y);

Itanium(R)-based System Onlylong double fmodl(long double x, long double y);

extended fmodw(extended x, extended y);

quad fmodq(quad x, quad y);

DESCRIPTIONThe fmod() function returns the floating-point remainder ( f ) of the division of x by y , where f has thesame sign as x , such that x = iy + f for some integer i , and |f| < |y|.

fmodf() is a float version of fmod() ; it takes float arguments and returns a float result.

Itanium-based System Onlyfmodl() is a long double version of fmod() ; it takes long double arguments and returns along double result.

fmodw() is an extended version of fmod() ; it takes extended arguments and returns anextended result.

fmodq() is equivalent to fmodl() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) fmodw() or fmodq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEIf y is ±INFINITY and x is not ±INFINITY, fmod() returns x .

If x is ±zero and y is a nonzero number, fmod() returns x .

If x or y is NaN, fmod() returns NaN.

If x is ±INFINITY or y is zero, fmod() returns NaN and raises the invalid exception.

ERRORSIf y is zero or x is infinite, fmod() sets errno to [EDOM].

Itanium-based SystemHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOceil(3M), fabs(3M), floor(3M), remainder(3M), remquo(3M), rint(3M), math(5).

STANDARDS CONFORMANCEfmod() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

fmodf() , fmodl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−313

A fA

fmtmsg(3C) fmtmsg(3C)

NAMEfmtmsg() - displays formatted message on standard error and console

SYNOPSIS#include <fmtmsg.h>

int fmtmsg(long class,const char *label,int severity,const char *text,const char *action,const char *tag

);

DESCRIPTIONThe fmtmsg() routine is intended as a language-independent error message service. Messages aredisplayed on the system console, standard error, or both, depending on the setting of the class parameter.The format of messages is under the control of the user, who may specify how much of the message is tobe displayed on standard error. However, the format of the message displayed to the system console isnot under user control.

All messages specify a class , which indicates the source and status of the error condition, and where themessage should be directed. The class may be functionally excluded by specifying MM_NULLMC. If this isdone, no message is produced. The class types are:

Display The display class has allowable values of MM_PRINT, which directs the mes-sage to standard error, MM_CONSOLE, which directs the message to the sys-tem console, or MM_PRINT | MM_CONSOLE, which directs the message toboth.

Error Type The error type class may be one of MM_HARD, indicating a hardware error,MM_SOFT, indicating a software failure, or MM_FIRM, which indicates afirmware error.

Error Source The error source class may be one of MM_APPL, indicating an application,MM_UTIL, indicating an OS utility, or MM_OPSYS, indicating a system error.

Recovery Status The recovery status class may be one of MM_RECOVER, indicating recoveryfrom the error is possible, or RMM_NRECOV, stating no recovery is possible.

The remaining parameters are functionally optional, in that the message produced may exclude any or allof them. Each is discussed in parameter order.

The label component states where the error originated. It has the form major:minor , where major is a 10character field specifying the major system producing the message and minor is a 14 character field speci-fying the subsystem in error. For example,

mail:send

This component can be excluded by setting it to MM_NULLLBLor NULL.

The severity component describes the degree of importance of the failure. The predefined severity levelsare:

MM_NOSEV No severity is specified and no print string is generated.

MM_INFO The message is informational only and the INFO string is generated.

MM_WARNING The situation might be in error, and should be checked. The WARNINGstringis generated.

MM_ERROR An error has been detected. The ERRORstring is generated.

MM_HALT An unrecoverable error has been detected. The HALTstring is generated.

The text component describes the nature of the failure in the most specific terms. It is expected to providea sufficiently detailed account of the error to remove all doubt about its cause. It may be excluded by set-ting text to MM_NULLTXTor MM_NULL.

The action component describes the options available for recovery from the error. As output, it is pre-faced with the string TO FIX: . It may be disabled by setting action to MM_NULLACTor NULL.

Section 3−−314 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fmtmsg(3C) fmtmsg(3C)

The tag component is intended to direct the user to the appropriate documentation to correct or avoid theerror. It may be disabled by setting tag to MM_NULLTXTor RMM_NULL.

EXTERNAL INFLUENCESThe user may control the appearance of the message produced on standard error through the use of twoenvironment variables: MSGVERBand SEV_LEVEL. These have no effect on the console message.

The MSGVERBenvironment variable describes the components the user is interested in seeing. The valueof MSGVERBis a list of one or more components, separated by colons if more than one is specified. Allcomponents with non-NULL values listed in MSGVERBare displayed when fmtmsg() is called; all othercomponents are excluded. Only the component names label , severity , text , action , and tag are valid listelements. Any others (or an empty list) are considered an error in MSGVERBformat. If MSGVERBiserroneous or unset, fmtmsg() produces the full message.

The SEV_LEVELenvironment variable gives users control over the text string displayed for the severitycomponent if the severity is other than those described above. The predefined severity levels (MM_NOSEVthrough MM_HALT) cannot be overridden.

The value of SEV_LEVELis a list of one or more level specifiers separated by colons. A level specifier is athree item comma list of the form identifier , level, message . The identifier is not used by fmtmsg() , andis only included for compatibility. It is not optional, however, as fmtmsg() expects it when examininglevel specifiers for the other two parts. The level is a number greater than four indicating the leveldefined. The message is a string to be displayed in the severity field, in the same manner as HALTand INFO are displayed for the MM_HALTand MM_INFOseverities. Level specifiers having more orfewer than three items are invalid, as are null level specifiers. Invalid or null valued SEV_LEVELlistshave no impact on the behavior of fmtmsg() .

RETURN VALUEThe fmtmsg() routine returns one of the following values on exit:

MM_OK Success.

MM_NOTOK Failure.

MM_NOMSG Failure to standard error, success to the system console.

MM_NOCON Success to standard error, failure to the system console.

AUTHORfmtmsg() was developed by OSF and HP.

SEE ALSOprintf(3S), thread_safety(5).

STANDARDS COMPLIANCEfmtmsg : SVID3

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−315

A fA

fnmatch(3C) fnmatch(3C)

NAMEfnmatch( ) - match filename patterns

SYNOPSIS#include <fnmatch.h>

int fnmatch(const char *pattern, const char *string, int flags);

DESCRIPTIONfnmatch() performs pattern matching as described in regexp (5) under PATTERN MATCHING NOTA-TION . By default, the rule qualifications for filename expansion do not apply; i.e., periods (dots) andslashes are matched as ordinary characters. This default behavior can be modified by using the flagsdescribed below.

The flag argument modifies the interpretation of pattern and string . If FNM_PATHNAME, which isdefined in <fnmatch.h >, is set in flag, a slash character in string must be explicitly matched by a slashin pattern; it cannot be matched by either the asterisk or question mark special characters or by abracket expression.

If FNM_PERIODis set in flag , a leading period (. ) must be explicitly matched. It will not be matched bya bracket expression, question mark or asterisk. By default, a period is leading if it is the first characterin string. If FNM_PATHNAMEis set in flag , a period is leading if it is the first character in string orimmediately follows a slash.

If FNM_NOESCAPEis not set in flag , a backslash character (\ ) in pattern followed by any other charac-ter matches that second character in string . In particular, \\ matches a backslash in string . IfFNM_NOESCAPEis set, a backslash character is treated as an ordinary character.

If flag is zero, the slash character and the period are treated as regular characters. If flag has any othervalue, the result is undefined.

RETURN VALUEIf string matches the pattern specified by pattern , fnmatch() returns zero. Otherwise, fnmatch()returns non-zero.

EXAMPLEThe following excerpt uses fnmatch() to check each file in a directory against the pattern *.c :

pattern = "*.c";

while(dp = readdir(dirp)){if((fnmatch(pattern, dp->d_name,0)) == 0){

/* do processing for match */...

}}

AUTHORfnmatch() was developed by OSF and HP.

SEE ALSOsh(1), glob(3C), thread_safety(5).

STANDARDS CONFORMANCEfnmatch() : XPG4, POSIX.2

Section 3−−316 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fopen(3S) fopen(3S)

NAMEfopen( ), freopen( ), fdopen( ) - open or re-open a stream file; convert file to stream

SYNOPSIS#include <stdio.h>

FILE *fopen(const char *pathname, const char *type);

FILE *freopen(const char *pathname, const char *type, FILE *stream);

FILE *fdopen(int fildes, const char *type);

DESCRIPTIONfopen() Opens the file named by pathname and associates a stream with it. fopen() returns a

pointer to the FILE structure associated with the stream .

freopen() substitutes the named file in place of the open stream . The original stream is closed,regardless of whether the open ultimately succeeds. freopen() returns a pointer tothe FILE structure associated with stream and makes an implicit call to clearerr()(see ferror (3S)). After a successful call to freopen() , the orientation of the stream iscleared (see orientation (5)).

freopen() is typically used to attach the preopened streams associated with stdin ,stdout , and stderr to other files.

fdopen() associates a stream with a file descriptor. File descriptors are obtained from open() ,dup() , creat() , or pipe() (see open (2), dup(2), creat (2), and pipe (2)), which openfiles but do not return pointers to a FILE structure stream. Streams are necessaryinput for many of the Section (3S) library routines. The type of stream must agree withthe mode of the open file. The meanings of type used in the fdopen() call are exactlyas specified above, except that w, w+, wb, and wb+ do not cause truncation of the file.

pathname Points to a character string containing the name of the file to be opened.

type Character string having one of the values listed below. The b in the following values hasno effect. It exists to distinguish binary files from text files; however, there is no distinc-tion between these types of files on UNIX systems (it is required for ISO C standard con-formance).

r or rb open file for reading

w or wb truncate to zero length or create file for writing

a or ab append; open file for writing at end of file, or create file or writing

r+, rb+, or r+b open file for update (reading and writing)

w+, wb+, or w+b truncate file to zero length or create file for update

a+, ab+, or a+b append; open or create file for update at end-of-file

When a file is opened for update, both input and output can be done on the resulting stream . However,output cannot be directly followed by input without an intervening call to fflush() or to a file position-ing function (fseek() , fsetpos() , or rewind() ), and input cannot be directly followed by outputwithout an intervening call to a file positioning function unless the input operation encounters end-of-file.

When a file is opened for append (i.e., when type is a, a+, ab+ , or a+b ), it is impossible to overwriteinformation already in the file. All output is written at the end of the file, regardless of intervening callsto fseek() . If two separate processes open the same file for append, each process can write freely to thefile without fear of destroying output being written by the other. Output from the two processes will beintermixed in the file in the order in which it is written.

NotesHP-UX binary file types are equivalent to their non-binary counterparts. For example, types r and rbare equivalent.

RETURN VALUEUpon successful completion, fopen() , fdopen() and freopen() return a FILE * pointer to thestream. Otherwise, a null pointer is returned and errno is set to indicate the error.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−317

A fA

fopen(3S) fopen(3S)

ERRORSfopen() , fdopen() , and freopen() fail if:

[EINVAL] The type argument is not a valid mode.

[ENOMEM] There is insufficient space to allocate a buffer.

fopen() and freopen() fail if:

[EACCES] Search permission is denied on a component of the path prefix, or the file exists andthe permissions specified by type are denied, or the file does not exist and write per-mission is denied for the parent directory of the file to be created.

[EINTR] A signal was caught during fopen() or freopen() . function.

[EISDIR] The named file is a directory and type requires write access.

[EMFILE] The calling process has attempted to exceed its open file limit.

[ENAMETOOLONG]The length of the pathname string exceeds PATH_MAXor a pathname component islonger than NAME_MAXwhile POSIX_NO_TRUNCis in effect.

[ENFILE] The system file table is full.

[ENOENT] The named file does not exist or the pathname argument points to an empty string.

[ENOSPC] The directory or file system that would contain the new file cannot be expanded, thefile does not exist, and it was to be created.

[ENOTDIR] A component of the path prefix is not a directory.

[ENXIO] The named file is a character special or block special file, and the device associatedwith the special file does not exist.

[EOVERFLOW] The named file is a regular file and the size of the file cannot be represented correctlyin an object of size off_t in this environment.

[EROFS] The named file resides on a read-only file system and type requires write access.

Additional errno values can be set by the underlying open() call made from the fopen() andfreopen() functions (see open (2)).

SEE ALSOcreat(2), dup(2), open(2), pipe(2), fclose(3S), fgetpos64(3S), fseek(3S), popen(3S), setbuf(3S), orienta-tion(5), thread_safety(5).

STANDARDS CONFORMANCEfopen() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

fdopen() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

freopen() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−318 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

fpclassify(3M) fpclassify(3M)

NAMEfpclassify( ) - floating-point value classification macro

SYNOPSIS#include <math.h>

int fpclassify( floating-type x);

DESCRIPTIONThe fpclassify() macro classifies its argument value as NaN, infinite, normalized, denormalized, orzero. The argument must be of floating type, and classification is based on the type of the argument. ForItanium(R)-based systems, the argument can be any floating type. For PA-RISC, the argument must beeither double or float .

The fpclassify() macro, used in conjunction with the signbit() macro, replaces the fpclas-sify() and fpclassifyf() functions, which are obsolete and are no longer supported.

USAGETo use the fpclassify() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe fpclassify() macro returns the value of the number classification macro appropriate to the typeand value of its argument.

The value returned is one of the following macros, which are defined in <math.h> :

FP_NORMAL NormalizedFP_ZERO ZeroFP_INFINITE InfinityFP_SUBNORMAL DenormalizedFP_NAN NaN

Every possible argument value falls into one of these categories, so this macro never results in an error.

The macro raises no exceptions.

ERRORSNo errors are defined.

EXAMPLESTake certain actions if x is either a denormalized float value or zero:

#include <math.h>/*...*/

int class;float x;/*...*/class = fpclassify(x);if ( (class == FP_SUBNORMAL) || (class == FP_ZERO) ) {

/*...*/}

SEE ALSOisfinite(3M), isinf(3M), isnan(3M), isnormal(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEfpclassify() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−319

A fA

fread(3S) fread(3S)

NAMEfread(), fwrite(), fread_unlocked(), fwrite_unlocked() - buffered binary input/output to a stream file

SYNOPSIS#include <stdio.h>

size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);

size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);

Obsolescent Interfacessize_t fread_unlocked(

void *ptr, size_t size, size_t nitems, FILE *stream);

size_t fwrite_unlocked(const void *ptr, size_t size, size_t nitems, FILE *stream);

DESCRIPTIONfread() copies, into an array pointed to by ptr , up to nitems items of data from the named inputstream , where an item of data is a sequence of bytes (not necessarily terminated by a null byte) of lengthsize . fread() stops appending bytes if an end-of-file or error condition is encountered while readingstream , or if nitems items have been read. fread() leaves the file pointer in stream , if defined, point-ing to the byte following the last byte read if there is one. fread() does not change the contents ofstream .

fwrite() appends at most nitems items of data from the array pointed to by ptr to the named outputstream . fwrite() stops appending when it has appended nitems items of data or if an error conditionis encountered on stream . fwrite() does not change the contents of the array pointed to by ptr .

The argument size is typically sizeof(* ptr ) where the pseudo-function sizeof specifies the length ofan item pointed to by ptr .

Obsolescent Interfacesfread_unlocked() and fwrite_unlocked() buffered binary input/output to a stream file.

APPLICATION USAGEAfter fread() or fwrite() is applied to a stream, the stream becomes byte-oriented (see orienta-tion (5)).

RETURN VALUEfread() , fwrite() , fread_unlocked() , and fwrite_unlocked() return the number of itemsread or written. If size or nitems is 0, no characters are read or written and 0 is returned.

The value returned will be less than nitems only if a read error or end-of-file is encountered. The fer-ror() or feof() functions must be used to distinguish between an error condition and an end-of-filecondition.

ERRORSRefer to getc (3S) for a description of errors.

WARNINGSfread_unlocked() and fwrite_unlocked() are obsolescent interfaces supported only for compa-tibility with existing DCE applications. New multithreaded applications should use fread() andfwrite() .

SEE ALSOread(2), write(2), fopen(3S), flockfile(3S), getc(3S), gets(3S), printf(3S), putc(3S), puts(3S), scanf(3S),orientation(5), thread_safety(5).

STANDARDS CONFORMANCEfread() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

fwrite() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−320 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

frexp(3M) frexp(3M)

NAMEfrexp( ), frexpf( ), frexpl( ), frexpw( ), frexpq( ) - extract mantissa and exponent from floating-point number

SYNOPSIS#include <math.h>

double frexp(double value, int *exp);

Itanium(R)-based System Onlyfloat frexpf(float value, int *exp);

long double frexpl(long double value, int *exp);

extended frexpw(extended value, int *exp);

quad frexpq(quad value, int *exp);

DESCRIPTIONThe frexp() function breaks a floating-point number into a normalized fraction and an integral powerof 2. It stores the integer exponent in the int object pointed to by exp .

Itanium-based System Onlyfrexpf() is a float version of frexp() ; it takes a float first argument and returns a floatresult.

frexpl() is a long double version of frexp() ; it takes a long double first argument andreturns a long double result.

frexpw() is an extended version of frexp() ; it takes an extended first argument and returns anextended result. frexpq() is equivalent to frexpl() on HP-UX systems.

USAGETo use (for Itanium-based systems) frexpf() , compile either with the default -Ae option or with the-Aa option.

To use (for Itanium-based systems) frexpl() , frexpw() , or frexpq() , compile either with thedefault -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) frexpw() or frexpq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line. For more information, see the HP-UXFloating-Point Guide .

RETURN VALUEThe frexp() function returns the value x , such that x is a double with magnitude in the interval [0.5,1] or zero, and value equals x times 2 raised to the power *exp .

If value is zero, returns value and stores zero in the object pointed to by exp .

If value is NaN, frexp() returns NaN, and the value of *exp is unspecified.

If value is ±INFINITY, frexp() returns value , and the value of *exp is unspecified.

These functions raise no exceptions.

ERRORSNo errors are defined.

SEE ALSOilogb(3M), ldexp(3M), logb(3M), modf(3M), scalb(3M), scalbln(3M), scalbn(3M), math(5).

STANDARDS CONFORMANCEfrexp() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

frexpf() , frexpl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−321

A fA

fseek(3S) fseek(3S)

NAMEfseek(), fseeko(), ftell(), ftello(), rewind(), fseek_unlocked(), ftell_unlocked(), rewind_unlocked() - reposi-tion a file pointer in a stream

SYNOPSIS#include <stdio.h>

int fseek(FILE *stream, long int offset, int whence);

int fseeko(FILE *stream, off_t offset, int whence);

void rewind(FILE *stream);

long int ftell(FILE *stream);

off_t ftello(FILE *stream);

Obsolescent Interfacesint fseek_unlocked(FILE *stream, long int offset, int whence);

void rewind_unlocked(FILE *stream);

long int ftell_unlocked(FILE *stream);

DESCRIPTIONfseek() sets the file-position indicator for stream . The new position, measured in bytes from the begin-ning of the file, is obtained by adding offset to the position specified by whence . The specified position isthe beginning of the file for SEEK_SET, the current position for SEEK_CUR, or end-of-file for SEEK_END.

fseeko() is a non-POSIX standard API provided by the _LARGEFILE_SOURCEcompile option. It isidentical to the fseek() except that the offset parameter is an off_t instead of a long int . Allother functional behaviors, returns, and errors are identical to the POSIX fseek() .

If the most recent operation, other than ftell() , on the stream is fflush() , the file offset in theunderlying open file description is adjusted to reflect the location specified by the fseek() .

rewind( stream ) is equivalent to fseek (stream, 0L, SEEK_SET) , except that no value isreturned.

fseek() and rewind() undo any effects of ungetc (3S).

After fseek() or rewind() , the next operation on a file opened for update can be either input or out-put. fseek() clears the EOF indicator for the stream . rewind() does an implicit clearerr() call(see ferror (3S)).

ftell() returns the offset of the current byte relative to the beginning of the file associated with thenamed stream .

ftello() is a non-POSIX standard API provided by the _LARGEFILE_SOURCEcompile option. It isidentical to the ftell() except that it returns an off_t instead of a long int . All other behaviors,returns, and errors are identical to the POSIX ftell() .

Obsolescent Interfacesfseek_unlocked() , rewind_unlocked() , and ftell_unlocked() reposition a file pointer in astream.

RETURN VALUEfseek() and fseek_unlocked() return zero if they succeed. Otherwise they return −1 and seterrno to indicate the error.

ftell() and ftell_unlocked() return the current value of the file position indicator for the streammeasured in bytes from the beginning of the file. Otherwise, ftell() and ftell_unlocked()return −1 and set errno to indicate the error.

rewind() and rewind_unlocked() do not return any value. Therefore, any application that needsto detect errors should clear errno before calling rewind() or rewind_unlocked() . Then, uponcompletion, if errno is non-zero, it should assume an error has occurred.

ERRORSfseek() , fseeko() , fseek_unlocked() , ftell() , ftello() , ftell_unlocked() ,rewind() and rewind_unlocked() fail if the stream is unbuffered or the buffered data needs to be

Section 3−−322 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fseek(3S) fseek(3S)

flushed, or if any of the following conditions are encountered:

[EAGAIN]The O_NONBLOCKflag is set for the file descriptor and the process would be delayed inthe write operation.

[EBADF] The stream is NULL.

[EBADF] The underlying file is not open for writing.

[EFBIG] An attempt was made to write a file that exceeds the process’s file size limit or the max-imum file size. See ulimit (2).

[EINVAL] The file offset cannot be represented correctly in an object of type long or size off_t inthis environment.

[EINTR] A signal was caught during the write operation.

[EIO] The process is in a background process group and is attempting to write to its controllingterminal, TOSTOPis set, the process is neither ignoring nor blocking the SIGTTOUsig-nal, and the process group of the process is orphaned.

[ENOSPC]There was no free space remaining on the device containing the file.

[EPIPE] An attempt was made to write to a pipe that is not open for reading by any process. ASIGPIPE signal is also sent to the process.

[ESPIPE] A seek operation was attempted and the file descriptor underlying stream is associatedwith a pipe.

fseek() and fseek_unlocked() also fail if:

[EINVAL] The whence argument is invalid, or the file-position indicator would be set to anegative value.

Additional errno values may be set by the underlying write() and lseek() functions (see write (2)and lseek (2)).

WARNINGSOn HP-UX systems, the offset returned by ftell() or ftell_unlocked() is measured in bytes andit is permissible to seek to positions relative to that offset. However, when porting to non-HP-UX sys-tems, fseek() should be used directly without relying on any offset obtained from ftell() becausearithmetic cannot meaningfully be performed on such an offset if it is not measured in bytes on a particu-lar operating system.

fseek() , fseek_unlocked() , rewind() , and rewind_unlocked() have no effect on streamsthat have been opened in append mode (see fopen (3S)).

fseek_unlocked() , ftell_unlocked() and rewind_unlocked() are obsolescent interfacessupported for compatibility with existing DCE applications. New multithreaded applications should usefseek() , ftell() and rewind() .

SEE ALSOlseek(2), write(2), ferror(3S), flockfile(3S), fopen(3S), fgetpos(3S), fgetpos64(3S), ungetc(3S),thread_safety(5).

STANDARDS CONFORMANCEfseek() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

ftell() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

rewind() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−323

A fA

ftok(3C) ftok(3C)

NAMEftok( ) - create interprocess communication identifier

SYNOPSIS#include <sys/ipc.h>

key_t ftok(const char *path, int id);

DESCRIPTIONAll interprocess communication facilities require the user to supply a key to be used by the msgget() ,semget() , and shmget() system calls to obtain interprocess communication identifiers (see msgget (2),semget (2), and shmget (2)).

ftok() returns a key based on path and id that is usable in subsequent msgget() , semget() , andshmget() system calls.

The parameters for the ftok() function are as follows:

path must be the path name of an existing file that is accessible to the process.

id is a character that uniquely identifies a project. This means that only the loworder 8-bits of id are significant. Note that ftok() returns the same key forlinked files when called with the same id and that it returns different keyswhen called with the same file name but different ids.

RETURN VALUEftok() returns (key_t )-1 if path does not exist or if it is not accessible to the process.

EXAMPLESThe following call to ftok () returns a key associated with the file myfile and id A:

key_t mykey;mykey = ftok ("myfile", ’A’);

WARNINGSIf the file whose path is passed to ftok() is removed when keys still refer to the file, future calls toftok() with the same path and id will return an error. If the same file is recreated, ftok() is likelyto return a different key than it did the original time it was called.

SEE ALSOintro(2), msgget(2), semget(2), shmget(2), thread_safety(5).

Section 3−−324 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

ftw(3C) ftw(3C)

NAMEftw(), nftw() - walk a file tree executing a function

SYNOPSIS#include <ftw.h>

int ftw (const char *path,int (*fn)(const char *obj_path,

const struct stat *obj_stat,int obj_flags),

int depth);

int nftw (const char *path,int (*fn)(const char *obj_path,

const struct stat *obj_stat,int obj_flags,struct FTW obj_FTW),

int depth,int flags);

UNIX95int nftw (const char *path,

int (*fn)(const char *obj_path,const struct stat *obj_stat,int obj_flags,struct *FTW obj_FTW),

int depth,int flags);

Obsolescent Interfacesint nftw2(const char *path,

int (*fn)(const char *obj_path,const struct stat *obj_stat,int obj_flags,struct FTW obj_FTW),

int depth,int flags);

DESCRIPTIONThe ftw() function recursively descends the directory hierarchy rooted in path . For each object in thehierarchy, ftw() calls fn , passing it a pointer to a null-terminated character string containing the nameof the object, a pointer to a stat structure containing information about the object (see lstat() instat (2)), and an integer, obj_flags . The possible values of obj_flags , defined in the <ftw.h> header file,are:

FTW_F The object is a file.

FTW_D The object is a directory.

FTW_SL The object is a symbolic link.

FTW_DNR The object is a directory without read permission. fn will not be called for any of itsdescendants.

FTW_NS lstat() failed on the object. The contents of the stat structure are undefined.If the failure was caused by a lack of permissions, the walk will continue. For allother errors ftw() will terminate the walk and return -1 .

Tree traversal continues until the tree is exhausted, an invocation of fn returns a nonzero value, or anerror is detected within ftw() , such as an I/O error. If the tree is exhausted, ftw() returns zero. If fnreturns a nonzero value, ftw() stops its tree traversal and returns the same value as returned by fn . Ifftw() detects an error, it returns -1 and sets the error type in errno (see errno (2)).

ftw() reports a directory before reporting any of its descendants.

ftw() and nftw() use one file descriptor for each level in the tree. The depth argument limits thenumber of file descriptors that can be used. If depth is 0 or negative, the effect is the same as if it were 1.depth must not be greater than the number of file descriptors currently available for use. For best

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−325

A fA

ftw(3C) ftw(3C)

performance, depth should be at least as large as the number of levels in the tree.

nftw() is similar to ftw() except that it takes the additional argument flags , and does not report orenter a directory which has already been visited during the walk. The flags field is the inclusive OR ofthe following values, as defined in the <ftw.h> header file:

FTW_PHYS If set, nftw() does a physical walk. It will not follow symbolic links, but will fol-low hard links.

If clear, nftw() follows both symbolic and hard links. In addition, if the UNIX95environment is defined, no object will be reported to fn more than once. Classic HPnftw() behavior will report a file as many times as it is referenced.

FTW_MOUNT If set, nftw() will only report files in the same file system as path . (See WARN-INGS for one exception involving loopback file systems (LOFS)).

If clear, nftw() will report all objects encountered in the walk.

FTW_DEPTH If set, nftw() performs a depth-first search. A directory’s contents will be reportedbefore the directory is reported to fn .

If clear, the directory will be reported before its descendants.

FTW_CHDIR If set, the walk does a chdir() (see chdir (2)) to each directory before reading itscontents. At the time a directory is reported to fn , the current working directorywill be the parent of the reported directory. A directory must have both read andexecute permissions, otherwise the directory is reported as a FTW_DNRobject, nochdir() will be done and it will not be entered.

If clear, nftw() will not alter the process’ current working directory, and the direc-tory only needs read permission to be reported as a FTW_Dor FTW_DPobject.

FTW_SERR If set and any lstat() or stat() failure occurs, fn is called with the FTW_NSobject flag and the walk continues.

If clear and lstat() or stat() fails due to lack of permissions, fn is called withthe FTW_NSobject type. If the UNIX95 environment is defined, the walk contin-ues. The HP classic behavior will terminate the walk and return -1 . For any errorother than permissions, or any error from other system calls such as opendir (3C) orreaddir (3C), nftw() does not call fn , terminates the walk and returns -1 .

nftw() calls fn with four arguments for each object reported. The first argument is the path name ofthe file, directory, or symbolic link. The second argument is a pointer to a stat structure (see lstat (2))containing information about the object. The third argument is an integer giving additional informationas follows:

FTW_F The object is a file.

FTW_D The object is a directory.

FTW_DP The object is a directory and subdirectories have been visited. This can be passed tofn only if FTW_DEPTHis specified.

FTW_SL The object is a symbolic link. This can be passed to fn only if FTW_PHYSisspecified.

FTW_SLN The object is a symbolic link that does not point to an existing object. This can bepassed to fn only if FTW_PHYSis not specified.

FTW_DNR The object is a directory that cannot be read, or does not have execute permissionswhen FTW_CHDIR is specified. The function fn is not called for any of thedirectory’s descendants.

FTW_NS lstat() or stat() failed on the object. The contents of the stat structurepassed to fn are undefined. If the failure occurred due to lack of permissions,errno is set to [EACCES]. If the UNIX95 environment is defined, the walk willalways continue after permissions errors. For classic HP behavior, the FTW_SERRflag must be set for the walk to continue.

Note that this behavior differs from ftw() .

The fourth argument is different for the default environment and the UNIX95 environment. For thedefault environment, the fourth argument is a structure FTW. For the UNIX95 environment, the fourth

Section 3−−326 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A fA

ftw(3C) ftw(3C)

argument is a pointer to a structure FTW(ie: *FTW). FTWcontains the following members:

int base;int level;

The value of base is the offset from the first character in the path name to where the base name of theobject starts; this path name is passed as the first argument to fn . The value of level indicates depth rela-tive to the start of the walk, where the start level has a value of zero.

APPLICATION USAGEftw() can execute concurrently in separate threads. nftw() and nftw2() are serialized if the pathargument is relative (i.e., does not start with ’/’), or the FTW_CHDIRflag is set. For best concurrency, callnftw() with an absolute starting path and do not set FTW_CHDIR.

To use the UNIX95 prototype, the UNIX95 environment must be defined. This is done by defining theUNIX95 environment variable, passing the _XOPEN_SOURCE_EXTENDEDflag as a compiler option, andadding /usr/xpg4/bin to your path. This can be done as follows:

1. export UNIX95=2. PATH=/usr/xpg4/bin:$PATH3. cc foo.c -D_XOPEN_SOURCE_EXTENDED

nftw2() is to be obsoleted at a future date.

ERRORSIf ftw() or nftw() fails, it sets errno (see errno (2)) to one of the following values:

[EACCES] If a component of the path prefix denies search permission, or if read permis-sion is denied for path , fn returns -1 and does not reset errno .

[EINVAL] The value of the depth argument is invalid.

[ENAMETOOLONG] The length of the specified path name exceeds PATH_MAXbytes, or thelength of a component of the path name exceeds NAME_MAXbytes while_POSIX_NO_TRUNCis in effect.

[ENOENT] path points to the name of a file that does not exist, or points to an emptystring.

[ENOTDIR] A component of path is not a directory.

[EOVERFLOW] One or more of the values in struct stat (st_size or st_blocks ) istoo large to store in the structure to be passed to the function pointed to byfn . Use ftw64() or nftw64() instead for 32-bit applications.

In addition, if the function pointed to by fn encounters system errors, errno may be set accordingly.

WARNINGSFor 32-bit applications, st_ino will be truncated to its least significant 32-bits for filesystems that use64-bit values. Note that this will even occur for ftw64() calls because st_ino is defined as anunsigned long.

For 32-bit applications accessing large file systems, use ftw64() or nftw64() instead in order to avoidoverflow of the stat structure.

nftw() contains some recursion and it is possible for it to terminate with a memory fault when appliedto file trees which contain a large number of directories, or a large number of files when FTW_PHYS isclear and the UNIX95 environment is defined.

nftw() uses malloc() to allocate dynamic storage during operation (see malloc (3C)). If it is forciblyterminated (such as if longjmp() is executed by fn or an interrupt routine), the calling function will nothave a chance to free that storage, causing it to remain allocated until the process terminates. A safe wayto handle interrupts is to store the fact that an interrupt has occurred, and arrange to have fn return anonzero value at its next invocation.

If the starting path is in a loopback file system (LOFS) and FTW_MOUNTis set (to stay within the LOFS),but FTW_PHYSis clear (symbolic and hard links are followed), nftw() cannot determine whether a linkreferencing a file on the same _device_ is really within the LOFS. It is possible with this specific combi-nation of factors to have some files reported to fn which should not be.

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−327

A fA

ftw(3C) ftw(3C)

Obsolescent Interfacesnftw2() is to be obsoleted at a future date.

AUTHORftw() , nftw() , and nftw2() were developed by AT&T and HP.

SEE ALSOstat(2), fgetpos64(3S), malloc(3C), thread_safety(5).

STANDARDS CONFORMANCEftw() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

Section 3−−328 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A fA

fwide(3C) fwide(3C)

NAMEfwide( ) - set stream orientation

SYNOPSIS#include <stdio.h>#include <wchar.h>

int fwide(FILE *stream, int mode);

DESCRIPTIONThe fwide() function determines the orientation of the stream pointed to by stream . If mode is greaterthan zero, the function first attempts to make the stream wide-oriented. If mode is less than zero, thefunction first attempts to make the stream byte-oriented. Otherwise, mode is zero and the function doesnot alter the orientation of the stream.

If the orientation of the stream has already been determined, fwide() does not change it. Because noreturn value is reserved to indicate an error, an application wishing to check for error situations shouldset errno to 0, then call fwide() , then check errno , and if it is non-zero, assume an error hasoccurred.

APPLICATION USAGEA call to fwide() with mode set to 0 can be used to determine the current orientation of a stream.

RETURN VALUEThe fwide() function returns a value greater than zero if, after the call, the stream has wide-orientation, a value less than zero if the stream has byte-orientation, or zero if the stream has no orienta-tion.

ERRORSThe fwide() function may fail if:

[EBADF] The stream argument is not a valid stream.

AUTHORfwide() was developed by HP and Mitsubishi Electric Corporation.

SEE ALSOorientation(5), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−329

A fA

fwprintf(3C) fwprintf(3C)

NAMEfwprintf( ), wprintf( ), swprintf( ) - print formatted wide-character output

SYNOPSIS#include <stdio.h>#include <wchar.h>

int fwprintf(FILE *stream, const wchar_t *format, ... );

int wprintf(const wchar_t *format, ... );

int swprintf(wchar_t *s, size_t n, const wchar_t *format, ... );

DESCRIPTIONThe fwprintf function places output on the named output stream .

The wprintf() function places output on the standard output stream stdout .

The swprintf() function places output followed by the null wide-character in consecutive wide-characters starting at * s; no more than n wide-characters are written, including a terminating null wide-character, which is always added (unless n is zero).

Each of these functions converts, formats and prints its arguments under control of the format wide-character string. The format is composed of zero or more directives: ordinary wide-characters, which aresimply copied to the output stream and conversion specifications, each of which results in the fetching ofzero or more arguments.

Conversions can be applied to the nth argument after the format in the argument list, rather than to thenext unused argument. In this case, the conversion wide-character % (see below) is replaced by thesequence %n$, where n is a decimal integer in the range 1 through {NL_ARGMAX}, giving the position ofthe argument in the argument list. This feature provides for the definition of format wide-characterstrings that select arguments in an order appropriate to specific languages (see the EXAMPLES section).

In format wide-character strings containing the %n$ form of conversion specifications, numbered argu-ments in the argument list can be referenced from the format wide-character string as many times asrequired.

In format wide-character strings containing the %form of conversion specifications, each argument in theargument list is used exactly once.

All forms of the fwprintf() functions allow for the insertion of a language-dependent radix characterin the output string, output as a wide-character value. The radix character is defined in the program’slocale (category LC_NUMERIC).

In the POSIX locale, or in a locale where the radix character is not defined, the radix character defaultsto a period (.).

Each conversion specification is introduced by the %wide-character or by the wide-character sequence%n$, after which the following appear in sequence:

1. Zero or more flags (in any order), which modify the meaning of the conversion specification.

2. An optional minimum field width . If the converted value has fewer wide-characters than thefield width , it will be padded with spaces by default on the left.

3. An optional precision that gives the minimum number of digits to appear for the d, i , o, u, xand X conversions.

4. An optional l (ell) specifying that a following c conversion wide-character applies to a wint_targument; an optional l specifying that a following s conversion wide-character applies to awchar_t argument; an optional h specifying that a following d, i , o, u, x or X conversionwide-character applies to a type short int or type unsigned short int argument (the argumentwill have been promoted according to the integral promotions, and its value will be convertedto type short int or unsigned short int before printing); an optional hL specifying that a follow-ing e, f , or g conversion wide-character applies to a type extended which is the 80-bitIEEE-754 double-extended type in the Itanium architecture; an optional h specifying that afollowing n conversion wide-character applies to a pointer to a type short int argument;

5. A conversion wide-character that indicates the type of conversion to be applied.

A field width, or precision, or both, may be indicated by an asterisk (*). In this case an argument of typeint supplies the field width or precision . Arguments specifying field width, or precision, or both must

Section 3−−330 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fwprintf(3C) fwprintf(3C)

appear in that order before the argument, if any, to be converted. A negative field width is taken as a -flag followed by a positive field width. A negative precision is taken as if the precision were omitted. Informat wide-character strings containing the %n$ form of a conversion specification, a field width or pre-cision may be indicated by the sequence %n$, where m is a decimal integer in the range [1,{NL_ARGMAX}] giving the position in the argument list (after the format argument) of an integer argu-ment containing the field width or precision , for example:

wprintf(L"%1$d:%2$. *3$d:%4$, *3$d\n", hour, min, precision, sec);

The format can contain either numbered argument specifications (that is, %n$ and *m$), or unnumberedargument specifications (that is, %and * ), but normally not both. The only exception to this is that %%can be mixed with the %n$ form. The results of mixing numbered and unnumbered argumentspecifications in a format wide-character string are undefined. When numbered argument specificationsare used, specifying the Nth argument requires that all the leading arguments, from the first to the (N-1)th, are specified in the format wide-character string.

The flag wide-characters and their meanings are:

’ The integer portion of the result of a decimal conversion (%i, %d, %u, %g, or %G ) will beformatted with thousands’ grouping wide-characters. For other conversions the behavioris undefined. The non-monetary grouping wide-character is used.

- The result of the conversion will be left-justified within the field. The conversion will beright-justified if this flag is not specified.

+ The result of a signed conversion will always begin with a sign (+ or -). The conversionwill begin with a sign only when a negative value is converted if this flag is not specified.

space If the first wide-character of a signed conversion is not a sign or if a signed conversionresults in no wide-characters, a space will be prefixed to the result. This means that ifthe space and + flags both appear, the space flag will be ignored.

# This flag specifies that the value is to be converted to an alternative form. For o conver-sion, it increases the precision (if necessary) to force the first digit of the result to be 0.For x or X conversions, a non-zero result will have 0x (or 0X) prefixed to it. For e, E, f ,g or Gconversions, the result will always contain a radix character, even if no digits fol-low it. Without this flag, a radix character appears in the result of these conversions onlyif a digit follows it. For g and Gconversions, trailing zeros will not be removed from theresult as they normally are. For other conversions, the behavior is undefined.

0 For d, i , o, u, x , X, e, E, f , g and G conversions, leading zeros (following any indicationof sign or base) are used to pad to the field width; no space padding is performed. If the0 and - flags both appear, the 0 flag will be ignored. For d, i , o, u, x and X conversions,if a precision is specified, the 0 flag will be ignored. If the 0 and i flags both appear, thegrouping wide-characters are inserted before zero padding. For other conversions, thebehavior is undefined.

The conversion wide-characters and their meanings are:

d,i The int argument is converted to a signed decimal in the style [-]dddd . The precisionspecifies the minimum number of digits to appear; if the value being converted can berepresented in fewer digits, it will be expanded with leading zeros. The default precisionis 1. The result of converting 0 with an explicit precision of 0 is no wide-characters.

o The unsigned int argument is converted to unsigned octal format in the style dddd . Theprecision specifies the minimum number of digits to appear; if the value being convertedcan be represented in fewer digits, it will be expanded with leading zeros. The defaultprecision is 1. The result of converting 0 with an explicit precision of 0 is no wide-characters.

u The unsigned int argument is converted to unsigned decimal format in the style dddd .The precision specifies the minimum number of digits to appear; if the value being con-verted can be represented in fewer digits, it will be expanded with leading zeros. Thedefault precision is 1. The result of converting 0 with an explicit precision of 0 is nowide-characters.

x The unsigned int argument is converted to unsigned hexadecimal format in the style IRdddd ; the letters abcdef are used. The precision specifies the minimum number of digitsto appear; if the value being converted can be represented in fewer digits, it will be

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−331

A fA

fwprintf(3C) fwprintf(3C)

expanded with leading zeros. The default precision is 1. The result of converting 0 withan explicit precision of 0 is no wide-characters.

X Behaves the same as the x conversion wide-character except that letters ABCDEF areused instead of abcdef.

f The double argument is converted to decimal notation in the style [-]ddd.ddd , where thenumber of digits after the radix character is equal to the precision specification. If theprecision is missing, it is taken as 6; if the precision is explicitly 0 and no # flag ispresent, no radix character appears. If a radix character appears, at least one digitappears before it. The value is rounded to the appropriate number of digits. Thefwprintf() family of functions may make available wide-character string representa-tions for infinity and NaN.

e,E The double argument is converted in the style [-]d.ddde_dd , where there is one digitbefore the radix character (which is non-zero if the argument is non-zero) and thenumber of digits after it is equal to the precision; if the precision is missing, it is taken as6; if the precision is 0 and no # flag is present, no radix character appears. The value isrounded to the appropriate number of digits. The E conversion wide-character will pro-duce a number with E instead of e introducing the exponent. The exponent always con-tains at least two digits. If the value is 0, the exponent is 0. The fwprintf() family offunctions may make available wide-character string representations for infinity andNaN.

g,G The double argument is converted in the style f or e (or in the style E in the case of a Gconversion wide-character), with the precision specifying the number of significant digits.If an explicit precision is 0, it is taken as 1. The style used depends on the value con-verted; style e (or E) will be used only if the exponent resulting from such a conversion isless than -4 or greater than or equal to the precision. Trailing zeros are removed fromthe fractional portion of the result; a radix character appears only if it is followed by adigit. The fwprintf() family of functions may make available wide-character stringrepresentations for infinity and NaN.

c If no l (ell) qualifier is present, the int argument is converted to a wide-character as ifby calling the btowc() function and the resulting wide-character is written. Otherwisethe wint_t argument is converted to wchar_t, and written.

s If no l (ell) qualifier is present, the argument must be a pointer to a character array con-taining a character sequence beginning in the initial shift state. Characters from thearray are converted as if by repeated calls to the mbrtowc() function, with the conver-sion state described by an mbstate_t object initialized to zero before the first character isconverted, and written up to (but not including) the terminating null wide-character. Ifthe precision is specified, no more than that many wide-characters are written. If theprecision is not specified or is greater than the size of the array, the array must contain anull wide-character. If an l (ell) qualifier is present, the argument must be a pointer toan array of type wchar_t. Wide characters from the array are written up to (but notincluding) a terminating null wide-character. If no precision is specified or is greaterthan the size of the array, the array must contain a null wide-character. If a precision isspecified, no more than that many wide-characters are written.

p The argument must be a pointer to void. The value of the pointer is converted to asequence of printable wide-characters, in an implementation-dependent manner.

n The argument must be a pointer to an integer into which is written the number of wide-characters written to the output so far by this call to one of the fwprintf() functions.No argument is converted.

C Same as lc .

S Same as ls .

% Output a % wide-character; no argument is converted. The entire conversionspecification must be %%.

APPLICATION USAGEAfter fwprintf() or wprintf() is applied to a stream, the stream becomes wide-oriented (see orien-tation (5)).

Section 3−−332 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A fA

fwprintf(3C) fwprintf(3C)

RETURN VALUEUpon successful completion, these functions return the number of wide-characters transmitted excludingthe terminating null wide-character in the case of swprintf() or a negative value if an output errorwas encountered.

ERRORSFor the conditions under which fwprintf() and wprintf() will fail and may fail, refer tofputwc() ; see putwc (3C). In addition, all forms of fwprintf() may fail if:

[EILSEQ] A wide-character code that does not correspond to a valid character has beendetected.

[EINVAL] There are insufficient arguments.

[ENOMEM] Insufficient storage space is available.

In addition, wprintf() may fail if:

[EILSEQ] stdout is byte-oriented.

fwprintf() may fail if:

[EILSEQ] The stream pointed to by stream is byte-oriented.

EXAMPLESTo print the language-independent date and time format, the following statement could be used:

wprintf(format, weekday, month, day, hour, min);

For American usage, format could be a pointer to the wide-character string:

L"%s, %s %d %d:%.2d"

producing the message:

Sunday, July 3, 10:02

whereas for German usage, format could be a pointer to the wide-character string:

L"%1$s, %3$d. %2$s, %4$d:%5$.2d"

producing the message:

Sonntag, 3. Juli, 10:02

AUTHORfwprintf() , wprintf() , swprintf() were developed by HP and Mitsubishi Electric Corporation.

SEE ALSObtowc(3C), fputwc(3C), fwscanf(3C), putwc(3C), setlocale(3C), mbrtowc(3C), orientation(5),thread_safety(5).

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−333

A fA

fwscanf(3C) fwscanf(3C)

NAMEfwscanf( ), wscanf( ), swscanf( ) - convert formatted wide-character input

SYNOPSIS#include <stdio.h>#include <wchar.h>

int fwscanf(FILE *stream, const wchar_t *format, ... );

int wscanf(const wchar_t *format, ... );

int swscanf(const wchar_t *s, const wchar_t *format, ... );

DESCRIPTIONThe fwscanf() function reads from the named input stream.

The wscanf() function reads from the standard input stream stdin . The swscanf() reads from thewide-character string s .

Each function reads wide-characters, interprets them according to a format , and stores the results in itsarguments. Each expects, as arguments, a control wide-character string format described below, and aset of pointer arguments indicating where the converted input should be stored. The result is undefinedif there are insufficient arguments for the format. If the format is exhausted while arguments remain,the excess arguments are evaluated but are otherwise ignored.

Conversions can be applied to the nth argument after the format in the argument list, rather than to thenext unused argument. In this case, the conversion wide-character % (see below) is replaced by thesequence %n$, where n is a decimal integer in the range [1,{NL_ARGMAX}] . This feature provides forthe definition of format wide-character strings that select arguments in an order appropriate to specificlanguages. In format wide-character strings containing the %n$ form of conversion specifications, it isunspecified whether numbered arguments in the argument list can be referenced from the format wide-character string more than once.

The format can contain either form of a conversion specification, that is, %or %n$, but the two formscannot normally be mixed within a single format wide-character string. The only exception to this is that%%or %* can be mixed with the %n$ form.

The fwscanf() function in all its forms allows for detection of a language-dependent radix character inthe input string, encoded as a wide-character value. The radix character is defined in the program’slocale (category LC_NUMERIC). In the POSIX locale, or in a locale where the radix character is notdefined, the radix character defaults to a period (. ).

The format is a wide-character string composed of zero or more directives. Each directive is composed ofone of the following:

• One or more white-space wide-characters (space, tab, newline, vertical-tab or form-feed charac-ters);

• An ordinary wide-character (neither %nor a white-space character); or• A conversion specification.

Each conversion specification is introduced by a %or the sequence %n$ after which the following appearin sequence:

• An optional assignment-suppressing character * .

• An optional non-zero decimal integer that specifies the maximum field width .

• An optional size modifier h, l (ell) or L indicating the size of the receiving object.

The conversion wide-characters c , s and [ must be precede by l (ell) if the correspondingargument is a pointer to wchar_t rather than a pointer to a character type.

The conversion wide-characters d, i and n must be preceded by h if the corresponding argu-ment is a pointer to short int rather than a pointer to int, or by l (ell) if it is a pointer to longint.

Similarly, the conversion wide-characters o, u and x must be preceded by h if the correspond-ing argument is a pointer to unsigned short int rather than a pointer to unsigned int or by l(ell) if it is a pointer to unsigned long int.

The conversion wide-characters e, f and g must be preceded by l (ell) if the correspondingargument is a pointer to double rather than a pointer to float, or by L if it is a pointer to long

Section 3−−334 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A fA

fwscanf(3C) fwscanf(3C)

double. If an h, l (ell) or L appears with any other conversion wide-character, the behavior isundefined.

• A conversion wide-character that specifies the type of conversion to be applied. The valid conver-sion wide-characters are described below.

The fwscanf() functions execute each directive of the format in turn. If a directive fails, as detailedbelow, the function returns. Failures are described as input failures (due to the unavailability of inputbytes) or matching failures (due to inappropriate input).

A directive composed of one or more white-space wide-characters is executed by reading input until nomore valid input can be read, or up to the first wide-character which is not a white-space wide-character,which remains unread.

A directive that is an ordinary wide-character is executed as follows. The next wide-character is readfrom the input and compared with the wide-character that comprises the directive; if the comparisonshows that they are not equivalent, the directive fails, and the differing and subsequent wide-charactersremain unread.

A directive that is a conversion specification defines a set of matching input sequences, as described belowfor each conversion wide-character. A conversion specification is executed in the following steps:

Input white-space wide-characters (as specified by iswspace() ) are skipped, unless the conversionspecification includes a [ , c or n conversion character.

An item is read from the input, unless the conversion specification includes an n conversion wide-character. An input item is defined as the longest sequence of input wide-characters, not exceeding anyspecified field width , which is an initial subsequence of a matching sequence. The first wide-character, ifany, after the input item remains unread. If the length of the input item is 0, the execution of the conver-sion specification fails; this condition is a matching failure, unless end-of-file, an encoding error, or a readerror prevented input from the stream , in which case it is an input failure. Except in the case of a %conversion wide-character, the input item (or, in the case of a %n conversion specification, the count ofinput wide-characters) is converted to a type appropriate to the conversion wide-character. If the inputitem is not a matching sequence, the execution of the conversion specification fails; this condition is amatching failure. Unless assignment suppression was indicated by a * , the result of the conversion isplaced in the object pointed to by the first argument following the format argument that has not alreadyreceived a conversion result if the conversion specification is introduced by %, or in the nth argument ifintroduced by the wide-character sequence %n$. If this object does not have an appropriate type, or if theresult of the conversion cannot be represented in the space provided, the behavior is undefined.

The following conversion wide-characters are valid:

d Matches an optionally signed decimal integer, whose format is the same as expected forthe subject sequence of wcstol() with the value 10 for the base argument. In theabsence of a size modifier, the corresponding argument must be a pointer to int.

i Matches an optionally signed integer, whose format is the same as expected for the sub-ject sequence of wcstol() with 0 for the base argument. In the absence of a sizemodifier, the corresponding argument must be a pointer to int.

o Matches an optionally signed octal integer, whose format is the same as expected for thesubject sequence of wcstoul() with the value 8 for the base argument. In the absenceof a size modifier, the corresponding argument must be a pointer to unsigned int.

u Matches an optionally signed decimal integer, whose format is the same as expected forthe subject sequence of wcstoul() with the value 10 for the base argument. In theabsence of a size modifier, the corresponding argument must be a pointer to unsigned int.

x Matches an optionally signed hexadecimal integer, whose format is the same as expectedfor the subject sequence of wcstoul() with the value 16 for the base argument. In theabsence of a size modifier, the corresponding argument must be a pointer to unsigned int.

e,f ,g Matches an optionally signed floating-point number, whose format is the same asexpected for the subject sequence of wcstod() . In the absence of a size modifier, thecorresponding argument must be a pointer to float.

If the fwprintf() family of functions generates character string representations for infinity and NaN(a 7858 symbolic entity encoded in floating-point format) to support the ANSI/IEEE Std 754:1985 stan-dard, the fwscanf() family of functions will recognize them as input.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−335

A fA

fwscanf(3C) fwscanf(3C)

s Matches a sequence of non white-space wide-characters. If no l (ell) qualifier is present,characters from the input field are converted as if by repeated calls to the wcrtomb()function, with the conversion state described by an mbstate_t object initialized to zerobefore the first wide-character is converted. The corresponding argument must be apointer to a character array large enough to accept the sequence and the terminating nullcharacter, which will be added automatically.

Otherwise, the corresponding argument must be a pointer to an array of wchar_t large enough to acceptthe sequence and the terminating null wide-character, which will be added automatically.

[ Matches a non-empty sequence of wide-characters from a set of expected wide-characters(the scanset). If no l (ell) qualifier is present, wide-characters from the input field areconverted as if by repeated calls to the wcrtomb() function, with the conversion statedescribed by an mbstate_t object initialized to zero before the first wide-character is con-verted. The corresponding argument must be a pointer to a character array large enoughto accept the sequence and the terminating null character, which will be added automati-cally.

If an l (ell) qualifier is present, the corresponding argument must be a pointer to an array of wchar_tlarge enough to accept the sequence and the terminating null wide-character, which will be addedautomatically.

The conversion specification includes all subsequent wide characters in the format string up to andincluding the matching right square bracket ( ] ). The wide-characters between the square brackets (thescanlist) comprise the scanset, unless the wide-character after the left square bracket is a circumflex ( ˆ ),in which case the scanset contains all wide-characters that do not appear in the scanlist between thecircumflex and the right square bracket. If the conversion specification begins with [] or [ˆ] , the rightsquare bracket is included in the scanlist and the next right square bracket is the matching right squarebracket that ends the conversion specification; otherwise the first right square bracket is the one thatends the conversion specification. If a - is in the scanlist and is not the first wide-character, nor thesecond where the first wide-character is a ˆ , nor the last wide-character, the behavior is implementation-dependent.

c Matches a sequence of wide-characters of the number specified by the field width (1 if nofield width is present in the conversion specification). If no l (ell) qualifier is present,wide-characters from the input field are converted as if by repeated calls to thewcrtomb() function, with the conversion state described by an mbstate_t object initial-ized to zero before the first wide-character is converted. The corresponding argumentmust be a pointer to a character array large enough to accept the sequence. No nullcharacter is added. Otherwise, the corresponding argument must be a pointer to anarray of wchar_t large enough to accept the sequence. No null wide-character is added.

p Matches an implementation-dependent set of sequences, which must be the same as theset of sequences that is produced by the %p conversion of the correspondingfwprintf() functions. The corresponding argument must be a pointer to a pointer tovoid. If the input item is a value converted earlier during the same program execution,the pointer that results will compare equal to that value; otherwise the behavior of the%pconversion is undefined.

n No input is consumed. The corresponding argument must be a pointer to the integer intowhich is to be written the number of wide-characters read from the input so far by thiscall to the fwscanf() functions. Execution of a %n conversion specification does notincrement the assignment count returned at the completion of execution of the function.

C Same as lc .

S Same as ls .

% Matches a sigle %; no conversion or assignment occurs. The complete conversionspecification must be %%.

If a conversion specification is invalid, the behavior is undefined.

The conversion characters E, Gand X are also valid and behave the same as, respectively, e, g and x .

If end-of-file is encountered during input, conversion is terminated. If end-of-file occurs before any wide-characters matching the current conversion specification (except for %n) have been read (other than lead-ing white-space, where permitted), execution of the current conversion specification terminates with aninput failure. Otherwise, unless execution of the current conversion specification is terminated with a

Section 3−−336 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A fA

fwscanf(3C) fwscanf(3C)

matching failure, execution of the following conversion specification (if any) is terminated with an inputfailure.

Reaching the end of the string in swscanf() is equivalent to encountering end-of-file for fwscanf() .

If conversion terminates on a conflicting input, the offending input is left unread in the input. Any trail-ing white space (including newline) is left unread unless matched by a conversion specification. The suc-cess of literal matches and suppressed assignments is only directly determinable via the %n conversionspecification.

The fwscanf() and wscanf() functions may mark the st_atime field of the file associated with streamfor update. The st_atime field will be marked for update by the first successful execution of fgetc() ,fgetwc() , fgets() , fgetws() , fread() , getc() , getwc() , getchar() , getwchar() ,gets() , fscanf() or fwscanf() using stream that returns data not supplied by a prior call toungetc() .

APPLICATION USAGEAfter fwscanf() or wscanf() is applied to a stream, the stream becomes wide-oriented (see orienta-tion (5)).

In format strings containing the %form of conversion specifications, each argument in the argument list isused exactly once.

RETURN VALUEUpon successful completion, these functions return the number of successfully matched and assignedinput items; this number can be 0 in the event of an early matching failure. If the input ends before thefirst matching failure or conversion, EOFis returned. If a read error occurs the error indicator for thestream is set, EOFis returned, and errno is set to indicate the error.

ERRORSFor the conditions under which the fwscanf() functions will fail and may fail, refer to fgetwc() . Inaddition, fwscanf() may fail if:

[EILSEQ] Input byte sequence does not form a valid character.

[EINVAL] There are insufficient arguments.

[ENOMEM] Insufficient storage space is available.

In addition, fwscanf() may fail if:

[EILSEQ] The stream pointed to by stream is byte-oriented.

In addition, wscanf() may fail if:

[EILSEQ] stdin is byte-oriented.

EXAMPLESThe call:

int i, n; float x; char name[50];n = wscanf(L"%d%f%s", &i, &x, name);

with the input line:

25 54.32E-1 Hamster

will assign to n the value 3, to i the value 25, x the value 5.432, and name will contain the string Ham-ster .

The call:

int i; float x; char name[50];(void)wscanf(L"%2d%f%*d %[0123456789]", &i, &x, name);

with input:

56789 0123 56a72

will assign 56 to i , 789.0 to x , skip 0123, and place the string 56 in name . The next call to getchar()will return the character a.

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−337

A fA

fwscanf(3C) fwscanf(3C)

AUTHORfwscanf() , wscanf() , swscanf() were developed by HP and Mitsubishi Electric Corporation.

SEE ALSOgetwc(3C), fwprintf(3C), setlocale(3C), wcstod(3C), wcstol(3C), wcstoul(3C), wcrtomb(3C), langinfo(5),orientation(5), thread_safety(5).

Section 3−−338 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: August 2003

A gA

getaddrinfo(3N) getaddrinfo(3N)

NAMEgetaddrinfo(), getnameinfo(), freeaddrinfo(), gai_strerror() - get hostname and address entry

SYNOPSIS#include <sys/socket.h>#include <netdb.h>

int getaddrinfo(const char *hostname, const char *servname,const struct addrinfo *hints, struct addrinfo **res);

int getnameinfo(const struct sockaddr *sa, size_t salen,char *host, size_t hostlen,char *serv, size_t servlen, int flags);

void freeaddrinfo(struct addrinfo *ai);

char *gai_strerror(int encode);

DESCRIPTIONgetaddrinfo()

Hostname-to-address translation is done in a protocol-independent fashion using the getaddrinfo()function.

The getaddrinfo() function returns an integer. The input arguments hostname and servname arepointers to null-terminated strings or NULL. One or both of these two arguments must be a non-NULLpointer.

In the normal client scenario, both hostname and servname are specified. The non-NULL hostnamestring can be either a hostname or a numeric host address string (i.e., a dotted-decimal IPv4 address or ahexadecimal IPv6 address). The non-NULL servname string can be either a service name or a decimalport number. However, in the server scenario, only servname is specified.

The third input argument is a pointer to the structure of type addrinfo defined as follows in<netdb.h> :

struct addrinfo {int ai_flags;int ai_family;int ai_socktype;int ai_protocol;size_t ai_addrlen;char *ai_canonname;struct sockaddr *ai_addr;struct addrinfo *ai_next;};

The members of this structure are:

ai_flags The flag used to set the socket address structure for an IPv4 address or an IPv6address.

If the AI_PASSIVE bit is set , then the returned socket address structure fromthe getaddrinfo() function will be used as an argument to the bind()function call. When this bit is set and the hostname argument to the getad-drinfo() function is a NULLpointer, then the IP address portion of the socketaddress structure will be set to INADDR_ANY for an IPv4 address orIN6ADDR_ANY_INIT for an IPv6 address.

If the AI_PASSIVE is not set, then the returned socket address structure willbe used as an argument to the connect() , sendto() , or sendmsg() func-tions. In this case, if the hostname argument is a NULL pointer, then the IPaddress portion of the socket address will be set to loopback address.

If the AI_CANONNAMEbit is set, then upon successful return, getad-drinfo() will return the ai_canonname member of the first addrinfostructure, which is a NULL terminated string containing the canonical name ofthe specified host.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−339

A gA

getaddrinfo(3N) getaddrinfo(3N)

If an AI_V4MAPPEDflag is specified with an ai_family value of AF_INET6 ,getaddrinfo() returns IPv4-mapped IPv6 addresses when it does not findany matching IPv6 addresses. getaddrinfo() ignores an AI_V4MAPPEDflag if the ai_family is not equal to AF_INET6 .

If an AI_ALL flag is used with an AI_V4MAPPED flag, getaddrinfo()returns all the matching IPv6 and IPv4 addresses. getaddrinfo() ignoresan AI_ALL flag without an AI_V4MAPPEDflag.

If an AI_ADDRCONFIGflag is specified, then IPv4 addresses are returned onlyif an IPv4 address is configured in the local system, and IPv6 addresses arereturned only if an IPv6 address is configured in the local system. In this case,the loopback address is not considered as a valid configured address.

ai_family The protocol family the caller will accept. If this member is set to PF_UNSPEC,then the caller will accept any protocol family. If the caller handles only IPv4stack and not IPv6 stack, then the ai_family must be set to PF_INET .

ai_protocol The protocol the caller supports. If ai_protocol is set to 0, then the callerwill accept any protocol.

ai_socktype The socket type the caller supports. If ai_socktype is set to 0, then the callerwill accept any socket type. However, if the caller handles only TCP and notUDP, then the ai_socktype must be set to SOCK_STREAM.

ai_addrlen The length, in bytes, of the IPv4 or IPv6 address.

ai_canonname The canonical name of the host.

ai_addr The binary address of the host.

ai_next The next addrinfo structure in the linked list.

The above argument is optional. If the caller wants to provide information regarding the type of socket,protocol family, etc. that the caller supports, the caller can specify them using the addrinfo structure.When this information is passed to getaddrinfo() , all the fields other then ai_flags , ai_family ,ai_socktype , and ai_protocol must be set to zero or a NULLpointer.

When it returns successfully, **res holds a pointer to a linked list of one or more addrinfo structures.The caller can process each addrinfo structure in this list by following the ai_next pointer, until aNULL pointer is encountered. In each of the returned addrinfo structures, the three membersai_family , ai_socktype , and ai_protocol are used as arguments to the socket() functioncall. The ai_addr member points to a socket address structure whose length is specified by theai_addrlen member.

The return value from the getaddrinfo() function is 0 upon success , or a nonzero error code.The following are the nonzero error codes given by getaddrinfo() . These are defined in <netdb.h> :

EAI_ADDRFAMILY Address family for hostname not supported.

EAI_AGAIN Temporary failure in name resolution.

EAI_BADFLAGS Invalid value for ai_flags .

EAI_FAIL Non-recoverable failure in name resolution.

EAI_FAMILY ai_family not supported.

EAI_MEMORY Memory allocation failure.

EAI_NODATA No address associated with hostname .

EAI_NONAME No hostname nor servname provided, or not known.

EAI_SERVICE The servname is not supported for ai_socktype .

EAI_SOCKTYPE ai_socktype not supported.

EAI_SYSTEM System error returned in errno.

freeaddrinfo()All the information returned by getaddrinfo() is dynamically allocated: the addrinfo structures,the socket address structures, and canonical host name strings pointed to by the addrinfo structures.To return this information to the system, the function freeaddrinfo() is called:

Section 3−−340 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getaddrinfo(3N) getaddrinfo(3N)

#include <sys/socket.h>#include <netdb.h>

void freeaddrinfo(struct addrinfo *ai);

The addrinfo structure pointed to by the ai argument is freed, along with any dynamic storagepointed to by the structure. This operation is repeated until a NULL ai_next pointer is encountered.

gai_strerror()To aid applications in printing error messages based on the EAI_ xxx codes returned by getad-drinfo() , the gai_strerror function is defined.

#include <sys/socket.h>#include <netdb.h>

char *gai_strerror(int ecode);

The argument is one of the EAI_ xxx values defined earlier, and the return value points to a stringdescribing the error. If the argument is not one of the EAI_ xxx values, the function still returns apointer to a string whose contents indicate an unknown error.

getnameinfo()The getnameinfo() function is used to look up a hostname and service name, given the binaryaddress and port. The function is defined as follows:

#include <sys/socket.h>#include <netdb.h>

int getnameinfo(const struct sockaddr *sa, size_t salen,char *host, size_t hostlen, char *serv,size_t servlen, int flags);

This function looks up an IP address and port number provided by the caller in the DNS and system-specific database, and returns text strings for both in buffers provided by the caller.

The function indicates successful completion by a zero return value; a non-zero return value indicatesfailure.

The first argument, sa , points to either a sockaddr_in structure (for IPv4) or a sockaddr_in6structure (for IPv6) that holds the IP address and port number. The salen argument gives the length ofthe sockaddr_in or sockaddr_in6 structure.

The function returns the hostname associated with the IP address in the buffer pointed to by the hostargument. The caller provides the size of this buffer via the hostlen argument. The service name asso-ciated with the port number is returned in the buffer pointed to by serv , and the servlen argumentgives the length of this buffer. The caller specifies not to return either string by providing zero values forthe hostlen or servlen arguments. Otherwise, the caller must provide buffers large enough to holdthe hostname and the service name, including the terminating null characters.

Unfortunately, most systems do not provide constants that specify the maximum size of either a fully-qualified domain name or a service name. Therefore, to aid the application in allocating buffers for thesetwo returned strings, the following constants are defined in <netdb.h> :

#define NI_MAXHOST 1025#define NI_MAXSERV 32

In recent versions of DNS/BIND, the first value NI_MAXHOSTis actually defined as the constantMAXDNAMEin the header file <arpa/nameser.h> . (Older versions of BIND define this constant to be256.)

The final argument to the getnameinfo() function is a flag that changes the default actions of thisfunction. By default, the fully-qualified domain name (FQDN) for the host is looked up in the DNS andreturned. If the flag bit NI_NOFQDNis set , only the hostname portion of the FQDN is returned for localhosts.

If the flag bit NI_NUMERICHOSTis set , or if the host’s name cannot be located in the DNS, the numericform of the host’s address is returned instead of its name (e.g., by calling inet_ntop() instead ofgethostbyaddr() ).

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−341

A gA

getaddrinfo(3N) getaddrinfo(3N)

If the flag bit NI_NAMEREQDis set , an error is returned if the host’s name cannot be located in theDNS.

If the flag bit NI_NUMERICSERVis set , the numeric form of the service address is returned (e.g., itsport number) instead of its name. The two NI_NUMERICxxx flags are required to support the -n flagthat many commands provide.

A fifth flag bit, NI_DGRAM, specifies that the service is a datagram service, and causes get-servbyport() to be called with a second argument of "udp" instead of its default of "tcp". This isrequired for the few ports (512-514) that have different services for UDP and TCP.

These NI_ xxx flags are defined in <netdb.h> along with the AI_ xxx flags already defined for getad-drinfo() .

Name Service Switch-Based OperationThe getnameinfo() and getaddrinfo() library routines internally call the name service switch toaccess the ipnodes database lookup policy configured in the /etc/nsswitch.conf file (seensswitch.conf(4)) for the name/address resolution, and services database lookup policy for theservice/port resolution. The lookup policy defines the order and criteria of the supported name servicesthat can be used for resolution. If addresses are not gathered after contacting all the ipnodes direc-tives, and if the caller has set the ai_family to AF_INET or set ai_flags to AI_V4MAPPEDwith anai_family of AF_INET6 , getaddrinfo() /getnameinfo() uses the hosts directive in the/etc/nsswitch.conf file to resolve the hostname/address. In this case, when the hosts directivehostname/address resolution fails, the error number returned will be that of the error returned by thehosts directive lookup. The operations of these name services, Domain Name Server and NonserverModes, are described below:

Domain Name Server OperationIf the local system is configured to use the BIND name server, named (see named(1M) and resolver (4))for name/address resolution, the function getnameinfo() /getaddrinfo() retrieves the host infor-mation from the name server. The host names are matched irrespective of upper or lower case alphatets.For example, the domain names berkeley.edu , Berkeley.EDU , and BERKELEY.EDUmatch thesame entry berkeley.edu in the name server database. When hosts directive is used forhostname/address resolution, a delay may be observed due to an additional lookup using the sourcesspecified for hosts directive.

Nonserver OperationDuring a name/address resolution, if the database is configured for files resolution, getnameinfo()and getaddrinfo() use the /etc/hosts file for resolution. Similarly, if the services database isconfigured for files resolution, the /etc/services file is used for resolution. If the /etc/hosts fileis used for name/address resolution, the method used by the functions getnameinfo() and getad-drinfo() to search an address is listed below:

getnameinfo() Sequentially searches the /etc/hosts file until an address matching the srcparameter is found or till the end of file is encountered.

getaddrinfo() Sequentially searches the /etc/hosts file until a host name (official nameor an alias name) matching the name parameter is found or until the end offile is encountered. The host names are matched irrespective of upper or lowercase alphabets.

WARNINGSObsolescent Interfaces

The following interfaces are included to support existing applications and may be removed in futurereleases.

struct hostent *getipnodebyname(const char *name,int af,int flags,int *error_num);

int getipnodebyaddr(const void *src,size_t len,int af,int *error_num);

Section 3−−342 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A gA

getaddrinfo(3N) getaddrinfo(3N)

New applications must use the APIs getaddrinfo() and getnameinfo() for name/address resolu-tion.

AUTHORgetaddrinfo() was developed by HP.

FILES/etc/hosts/etc/services

SEE ALSOgethostent(3N), resolver(3N), nsswitch.conf(4).

HP-UX 11i Version 2: August 2003 − 5 − Hewlett-Packard Company Section 3−−343

A gA

getbegyx(3X) getbegyx(3X)(ENHANCED CURSES)

NAMEgetbegyx, getmaxyx, getparyx — get additional cursor and window coordinates

SYNOPSIS#include <curses.h>

void getbegyx(WINDOW * win, int y, int x);

void getmaxyx(WINDOW * win, int y, int x);

void getparyx(WINDOW * win, int y, int x);

DESCRIPTIONThe getbegyx() macro stores the absolute screen coordinates of the specified window’s origin in y andx.

The getmaxyx() macro stores the number of rows of the specified window in y and stores the window’snumber of columns in x.

The getparyx() macro, if the specified window is a subwindow, stores in y and x the coordinates of thewindow’s origin relative to its parent window. Otherwise, −1 is stored in y and x.

RETURN VALUENo return values are defined.

ERRORSNo errors are defined.

APPLICATION USAGEThese interfaces are macros and ‘&’ cannot be used before the y and x arguments.

SEE ALSOgetyx(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−344 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getbootpent(3X) getbootpent(3X)

NAMEgetbootpent(), putbootpent(), setbootpent(), endbootpent(), parse_bp_htype(), parse_bp_haddr(),parse_bp_iaddr() - get or put bootptab entry

SYNOPSIS#include <bootpent.h>

int getbootpent (struct bootpent **bootpent);

int setbootpent (const char *path);

int endbootpent (void);

int putbootpent (struct bootpent *bootpent,int numfields,FILE * bootpfile

);

int parse_bp_htype (const char *source);

int parse_bp_haddr (char **source,int htype,unsigned char *result,unsigned int *bytes

);

int parse_bp_iaddr (char **source,unsigned long *result

);

RemarksThese functions reside in libdc.a, and are linked using the -ldc option to the ld or cc command.

DESCRIPTIONThese functions help a program read or modify a bootptab (bootpd control) file one entry at a time.getbootpent() locates an entry in the /etc/bootptab file, or an alternate file specified to set-bootpent() , and returns a pointer to an array of objects of type struct bootpent that breaks theentry into separate data fields with preceding, or embedded, comment (text) lines.

The bootpent structure is defined in <bootpent.h> and includes the following members:

int bp_type; /* BP_DATA, BP_COMMENT, BP_BLANK */char *bp_text; /* one field or one comment line */

The file also defines the following data type and constants:

typedef struct bootpent *bpp_t;

#define BP_NULLP ((bpp_t) 0)#define BP_SIZE (sizeof (struct bootpent))

#define MAXHADDRLEN 6

#define HTYPE_UNKNOWN 0 /* 0 bytes */#define HTYPE_ETHERNET 1 /* 6 bytes */#define HTYPE_EXP_ETHERNET 2 /* 1 byte */#define HTYPE_AX25 3 /* 0 bytes */#define HTYPE_PRONET 4 /* 1 byte */#define HTYPE_CHAOS 5 /* 0 bytes */#define HTYPE_IEEE802 6 /* 6 bytes */#define HTYPE_ARCNET 7 /* 0 bytes */

#define MAXHTYPES 7

The fields are described in the Field Definitions section below. The purpose of each function is as follows.

getbootpent() When first called, getbootpent() returns a pointer to, and the number ofelements in, an array of bootpent structures. The array holds the first

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−345

A gA

getbootpent(3X) getbootpent(3X)

entry in the /etc/bootptab file (or from an alternate file specified by acall to setbootpent() ), including leading, or embedded, comment lines.Each subsequent call returns a pointer to the next entry in the file so that suc-cessive calls can be used to search the entire file.

If no file is currently in memory, getbootpent() reads the/etc/bootptab file prior to doing its work.

The returned array exists in static space (malloc’d memory) overwritten by thenext call (so previously returned pointers become invalid). However, eacharray element’s bp_text pointer points to text in an in-memory copy of thefile. This text is not altered by the next call (nor by changes to the file itself).Hence, it is possible to copy an entry’s array in order to save it, as illustratedin EXAMPLES below. The data remains valid until the next call of set-bootpent() or endbootpent() .

If there are comments after the last entry, they are returned as a separateentry with no data parts.

setbootpent() Opens the specified file for reading by getbootpent() , reads a copy intomemory, and closes the file (which as a side-effect releases any locks on thefile; see lockf (2)). If the given path is a null pointer or a null string, set-bootpent() opens and reads /etc/bootptab .

If the last file opened by setbootpent() (or implicitly by getboot-pent() ) was /etc/bootptab , a subsequent call to setbootpent() forthe same file rewinds the file to the beginning, making visible any recentchanges to the file, without first requiring a call to endbootpent() .

endbootpent() Frees the in-memory copy of the last file opened by setbootpent() , orgetbootpent() .

putbootpent() Writes (to the current location in the stream specified by bootpfile ) the ASCIIequivalent of the specified array of bootpent structures containing one fileentry, and its leading, or embedded, comments (a total of numfields array ele-ments). Entries are written in canonical form, meaning the entry name andeach data field are on separate lines, data fields are preceded by one tab each,and each line except the last ends with ‘‘:\’’. If numfields is less than or equalto zero, nothing is written.

parse_bp_htype() Converts a host address type from string to numeric format (HTYPE_*) in thesame manner as bootpd .

parse_bp_haddr() Converts a host (hardware, link level) address from string to binary format inthe same manner as bootpd given a host address type (HTYPE_*). The cal-ling program’s result , which must be an array containing at least MAXHAD-DRLEN elements, is modified to hold the host address binary value, andbytes is modified to indicate the length in bytes of the resulting address.This can be used to compare two host addresses, independent of stringrepresentations. source is modified to point to the first char after the parsedaddress.

parse_bp_iaddr() Converts an internet address from string to binary format in the same manneras bootpd . This can be used to compare two internet addresses, independentof string representations. The calling program’s result is modified to hold theinternet address binary value. source is modified to point to the first charafter the parsed address.

Field DefinitionsIf bootpent.bp_type is BP_DATA, the associated text is one field from the current entry, either thename field or one of the tag fields. Null tag fields (two colons in a row) are ignored, not returned.

If bootpent.bp_type is BP_COMMENTor BP_BLANK, the associated text is one comment line orblank line from the file, either preceding the current entry or embedded in it following a data line thatwas continued with a backslash. The text is exactly as it appears in the file, including any whitespaceappearing on a blank line, and there is no trailing newline.

Section 3−−346 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getbootpent(3X) getbootpent(3X)

The returned array elements are in the same order as data fields and comment lines appear in the file.

Entry field strings are of the form:

tag [@] [=" value" ]

with surrounding whitespace, if any, removed (see bootpd (1M) for the full description). Double quotes,and backslashes, can appear anywhere in the field strings.

Template entries (those referred to by other entries using tc fields) are not special. They can bemanaged like other entries. It is the calling program’s responsibility to correctly manage the order offields, tc fields, and ‘‘@’’ fields that override earlier field values.

RETURN VALUEgetbootpent() returns the number of valid array elements (one or more) upon successful completion.At the end of the input file it returns zero. If it cannot open or close the file it returns -1. If it encountersa memory allocation or map error, or a read error, it returns -2.

setbootpent() returns zero if successful opening and reading the specified or default file. If it cannotopen or close the file it returns -1. If it encounters a memory allocation or map error or a read error itreturns -2.

endbootpent() returns zero if successful freeing the memory for the current open file. If there is nocurrent file it returns -1. If it cannot free the memory for the current file it returns -2.

putbootpent() returns zero if successful writing an entry to the specified file, with the ferror()indication clear (see ferror (3S)). Otherwise it returns non-zero with ferror() set.

In all cases above, if a failure is due to a failed system call, the errno value from the system is valid onreturn from the called function.

parse_bp_htype() returns HTYPE_UNKNOWNif the hardware type string is unrecognized.

parse_bp_haddr() returns zero if successful, otherwise non-zero in case of parsing error, invalidhtype , or a host address type for which the address length is unknown; source is modified to point to thefirst illegal char (a NUL if the string is too short). The caller’s bytes value is unmodified, but result mightbe changed.

parse_bp_iaddr() returns zero if successful, otherwise non-zero, and source is modified to point tothe first illegal char (a NUL if the string is null).

EXAMPLESThe following code fragment copies all data and comments from /etc/bootptab to a temporary copyof the file. It converts data entries to canonical form as a side effect, and prints to standard output thefirst field of each entry copied (should be the field name, assuming the entry doesn’t start with a continua-tion line).

#include <bootpent.h>

FILE *newfilep; /* to write temp file */bpp_t bp; /* read from file */int field; /* current field number */int fields; /* total in array for one entry */

if ((newfilep = fopen ("/tmp/bootptab", "w")) == (FILE *) NULL){

(handle error)}

while ((fields = getbootpent (&bp)) > 0){

for (field = 0; field < fields; ++field){

if ((bp[field].bp_type) == BP_DATA){

(void) puts (bp[field].bp_text);break;

}}

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−347

A gA

getbootpent(3X) getbootpent(3X)

if (putbootpent (bp, fields, newfilep)){

(handle error)}

}

if (fields < 0) /* error reading file */{

(handle error)}

if (endbootpent()){

(handle error)}

if (fclose (newfilep)){

(handle error)}

The following code fragment saves a copy of a bootptab entry returned by getbootpent() .

#include <malloc.h>#include <string.h>#include <bootpent.h>

bpp_t bpnew;unsigned size;

size = fields *BP_SIZE;

if ((bpnew = (bpp_t) malloc (size)) == BP_NULLP){

(handle error)}

(void) memcpy ((void *)bpnew, (void *)bp, size);

WARNINGSThese functions are unsafe in multi-thread applications.

Calling setbootpent() releases any locks on the file it opens.

AUTHORThese functions were developed by HP.

FILES/etc/bootptab control file for bootpd

SEE ALSObootpd(1M), errno(2), lockf(2), ferror(3S), fopen(3S), malloc(3C).

Section 3−−348 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A gA

getc(3S) getc(3S)

NAMEgetc(), getc_unlocked(), getchar(), getchar_unlocked(), fgetc(), getw(), getw_unlocked() - get character orword from a stream file

SYNOPSIS#include <stdio.h>

int getc(FILE *stream);

int getc_unlocked(FILE *stream);

int getchar(void);

int getchar_unlocked(void);

int fgetc(FILE *stream);

int getw(FILE *stream);

Obsolescent Interfaceint getw_unlocked(FILE *stream);

DESCRIPTIONgetc() Returns the next character (i.e., byte) from the named input stream , as an unsigned

character converted to an integer. It also moves the file pointer, if defined, ahead onecharacter in stream . getchar() is defined as getc(stdin) . getc() andgetchar() are defined both as macros and as functions.

fgetc() Same as getc() , but is a function rather than a macro. fgetc() is slower thangetc() , but it takes less space per invocation and its name can be passed as an argu-ment to a function.

getw() returns the next word (i.e., int in C) from the named input stream . getw() incrementsthe associated file pointer, if defined, to point to the next word. The size of a word is thesize of an integer and varies from machine to machine. getw() assumes no specialalignment in the file.

getc_unlocked() and getchar_unlocked() are identical to getc() and getchar() respec-tively except they do not perform any internal locking of the stream for multithreaded applications.

Obsolescent Interfacegetw_unlocked() gets character or word from a stream file.

APPLICATION USAGEgetc_unlocked() and getchar_unlocked() interfaces should be used by multithread applica-tions which have already used flockfile() to acquire a mutual exclusion lock for the stream (seeflockfile (3S)).

After getc() , getc_unlocked() , getchar() , getchar_unlocked() , fgetc() , or getw() isapplied to a stream, the stream becomes byte-oriented (see orientation (5)).

RETURN VALUEUpon successful completion, getc() , getc_unlocked() , getchar() , getchar_unlocked() ,and fgetc() return the next byte from the input stream pointed to by stream (stdin for getchar()and getchar_unlocked() ). If the stream is at end-of-file, the end-of-file indicator for the stream isset and EOF is returned. If a read error occurs, the error indicator for the stream is set, errno is set toindicate the error, and EOF is returned.

Upon successful completion, getw() and getw_unlocked() return the next word from the inputstream pointed to by stream . If the stream is at end-of-file, the end-of-file indicator for the stream is setand getw() and getw_unlocked() return EOF. If a read error occurs, the error indicator for thestream is set, and getw() and getw_unlocked() return EOF and set errno to indicate the error.

ferror() and feof() can be used to distinguish between an error condition and an end-of-file condi-tion.

ERRORSgetc() , getc_unlocked() , getchar() , getchar_unlocked() , getw() , getw_unlocked() ,and fgetc() fail if data needs to be read into the stream ’s buffer, and:

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−349

A gA

getc(3S) getc(3S)

[EAGAIN] The O_NONBLOCKflag is set for the file descriptor underlying stream and the pro-cess would be delayed in the read operation.

[EBADF] The file descriptor underlying stream is not a valid file descriptor open for reading.

[EINTR] The read operation was terminated due to the receipt of a signal, and either no datawas transferred or the implementation does not report partial transfer for this file.

[EIO] A physical I/O error has occurred, or the process is a member of a background pro-cess and is attempting to read from its controlling terminal, and either the processis ignoring or blocking the SIGTTIN signal or the process group of the process isorphaned.

Additional errno values may be set by the underlying read() function (see read (2)).

WARNINGSgetc() and getchar() are implemented both as library functions and macros. The macro versions,which are used by default, are defined in <stdio.h> . To obtain the library function either use a#undef to remove the macro definition or, if compiling in ANSI-C mode, enclose the function name inparenthesis or use the function address. The following example illustrates each of these methods :

#include <stdio.h>#undef getc

...main(){

int (*get_char()) ();...return_val=getc(c,fd);...return_val=(getc)(c,fd1);...get_char = getchar;

};

If the integer value returned by getc() , getc_unlocked() , getchar() , getchar_unlocked() ,or fgetc() is stored into a character variable then compared against the integer constant EOF, the com-parison may never succeed because sign-extension of a character on widening to integer is machine-dependent.

The macro version of getc() incorrectly treats a stream argument with side effects. In particular,getc(*f++) does not work sensibly. The function version of getc() or fgetc() should be usedinstead.

Because of possible differences in word length and byte ordering, files written using putw() aremachine-dependent, and may be unreadable by getw() on a different processor.

Reentrant InterfacesIf _REENTRANTis defined before including <stdio.h> , the locked versions of the library functions forgetc() and getchar() are used by default.

getw_unlocked() is an obsolescent interface supported only for compatibility with existing DCEapplications. New multithreaded applications should use getw() .

SEE ALSOread(2), fclose(3S), ferror(3S), flockfile(3S), fopen(3S), fread(3S), gets(3S), putc(3S), scanf(3S), orienta-tion(5), thread_safety(5).

STANDARDS CONFORMANCEgetc() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

getc_unlocked() : POSIX.1C

fgetc() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, XPG4.2, FIPS 151-2, POSIX.1, ANSI C

getchar() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

getchar_unlocked() : POSIX.1C

Section 3−−350 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getc(3S) getc(3S)

getw() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−351

A gA

getcchar(3X) getcchar(3X)(ENHANCED CURSES)

NAMEgetcchar — get a wide character string and rendition from a cchar_t

SYNOPSIS#include <curses.h>

int getcchar(const cchar_t * wcval, wchar_t * wch, attr_t * attrs,short * color_pair, void * opts);

DESCRIPTIONWhen wch is not a null pointer, the getcchar() function extracts information from a cchar_t definedby wcval, stores the character attributes in the object pointed to by attrs, stores the colour pair in theobject pointed to by color_pair , and stores the wide character string referenced by wcval into the arraypointed to by wch.

When wch is a null pointer, getcchar() obtains the number of wide characters in the object pointed toby wcval and does not change the objects pointed to by attrs or color_pair .

The opts argument is reserved for definition in a future edition of this document. Currently, the applica-tion must provide a null pointer as opts.

RETURN VALUEWhen wch is a null pointer, getcchar() returns the number of wide characters referenced by wcval,including the null terminator.

When wch is not a null pointer, getcchar() returns OK upon successful completion, and ERR other-wise.

ERRORSNo errors are defined.

APPLICATION USAGEThe wcval argument may be a value generated by a call to setcchar() or by a function that has acchar_t output argument. If wcval is constructed by any other means, the effect is unspecified.

SEE ALSOattroff(3X), can_change_color(3X), setcchar(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−352 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getch(3X) getch(3X)(CURSES)

NAMEgetch, wgetch, mvgetch, mvwgetch — get a single-byte character from the terminal

SYNOPSIS#include <curses.h>

int getch(void);

int mvgetch(int y, int x);

int mvwgetch(WINDOW * win, int y, int x);

int wgetch(WINDOW * win);

DESCRIPTIONThese functions read a single-byte character from the terminal associated with the current or specifiedwindow. The results are unspecified if the input is not a single-byte character. If keypad() is enabled,these functions respond to the pressing of a function key by returning the corresponding KEY_ valuedefined in <curses.h> .

Processing of terminal input is subject to the general rules described in Input Processing incurses_intro (3X).

If echoing is enabled, then the character is echoed as though it were provided as an input argument toinsch() , except for the following characters:

<backspace>, <left-arrow> andthe current erase character:

The input is interpreted as specified in special-chars and then the character at the resulting cur-sor position is deleted as though delch() werecalled, except that if the cursor was originally inthe first column of the line, then the user is alertedas though beep() were called.

The user is alerted as though beep() were called.Information concerning the function keys is notreturned to the caller.

Function keys

If the current or specified window is not a pad, and it has been moved or modified since the last refreshoperation, then it will be refreshed before another character is read.

RETURN VALUEUpon successful completion, these functions return the single-byte character, KEY_ value, or ERR.

If in nodelay mode and no data is available, ERR is returned.

ERRORSNo errors are defined.

APPLICATION USAGEApplications should not define the escape key by itself as a single-character function.

When using these functions, nocbreak mode (nocbreak() ) and echo mode (echo() ) should not be usedat the same time. Depending on the state of the terminal when each character is typed, the program mayproduce undesirable results.

SEE ALSOcbreak(3X), doupdate(3X), insch(3X), curses_intro(3X), see Input Processing, <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the getch() function is explicitly declared asvoid.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−353

A gA

getclock(3C) getclock(3C)

NAMEgetclock - get current value of system-wide clock

SYNOPSIS#include <sys/timers.h>

int getclock(int clock_type, struct timespec *tp);

DESCRIPTIONThe getclock() function gets the current value tp of the specified system-wide clock, clock_type .

getclock() supports a clock_type of TIMEOFDAY, defined in <sys/timers.h >, whichrepresents the time-of-day clock for the system. For this clock, the values returned by getclock()represent the amount of time since the Epoch.

RETURN VALUEUpon successful completion, getclock() returns a value of zero; otherwise it returns a value of −1 andsets errno to indicate the error.

ERRORSgetclock() fails if any of the following conditions are encountered:

[EINVAL] clock_type does not specify a known system-wide clock.

[EIO] An error occurred while accessing the clock device.

FILES/usr/include/sys/timers.h

SEE ALSOclocks(2), clock_gettime(2), gettimer(3C), setclock(3C), thread_safety(5).

STANDARDS CONFORMANCEgetclock() : AES

Section 3−−354 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getcwd(3C) getcwd(3C)

NAMEgetcwd( ) - get pathname of current working directory

SYNOPSIS#include <unistd.h>

char *getcwd(char *buf, size_t size);

DESCRIPTIONThe getcwd() function places the absolute pathname of the current working directory in the arraypointed to by buf , and returns buf . The value of size must be at least one greater than the length of thepathname to be returned.

If buf is a NULL pointer, getcwd() obtains size bytes of space using malloc() (see malloc (3C)). Inthis case, the pointer returned by getcwd() can be used as the argument in a subsequent call tofree() (see malloc (3C)). Invoking getcwd() with buf as a null pointer is not recommended becausethis functionality may be removed from the HP-UX operating system in a future release.

RETURN VALUEUpon successful completion, getcwd() returns a pointer to the current directory pathname. Otherwise,it returns NULL with errno set if size is not large enough, or if an error occurs in a lower-level function.

ERRORSgetcwd() fails if any of the following conditions are encountered:

[EINVAL] The size argument is zero.

[ERANGE] The size argument is greater than zero, but is smaller than the length of thepathname.

[ENAMETOOLONG] The length of the specified pathname exceeds PATH_MAX+1bytes, or thelength of a component of the pathname exceeds NAME_MAXbytes while_POSIX_NO_TRUNCis in effect.

getcwd() may fail if any of the following conditions are encountered:

[EACCES] Read or search permission is denied for a component of pathname.

[EFAULT] buf points outside the allocated address space of the process. getcwd() maynot always detect this error.

[ENOMEM] malloc() failed to provide size bytes of memory.

EXAMPLES#include <unistd.h>#include <limits.h>

char *cwd;char buf[PATH_MA X + 1 ];

. . .if ((cwd = getcwd(buf, PATH_MAX+1)) == NULL) {

perror("pwd");exit(1);

}puts(cwd);

AUTHORgetcwd() was developed by AT&T.

SEE ALSOpwd(1), malloc(3C), thread_safety(5).

STANDARDS CONFORMANCEgetcwd() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−355

A gA

getdate(3C) getdate(3C)

NAMEgetdate() - convert user format date and time

SYNOPSIS#include <time.h>

struct tm *getdate(const char *string);

Obsolescent Interfaceint getdate_r(const char *string, struct tm *result, int *errnum);

DESCRIPTIONThe getdate() function converts user definable date and/or time specifications pointed to by string intoa struct tm . The structure declaration is in the <time.h> header file (see ctime (3C)).

User-supplied templates are used to parse and interpret the input string. The templates are text filescreated by the user and identified via the environment variable DATEMSK. DATEMSKshould be set toindicate the full path name of the template file. The first line in the template that matches the inputspecification is used for interpretation and conversion into the internal time format. Upon successfulcompletion, getdate() returns a pointer to a struct tm ; otherwise, it returns NULL and the symbolgetdate_err is set to indicate the error.

The following field descriptors are supported:

%% same as %%a abbreviated weekday name%A full weekday name%b abbreviated month name%B full month name%c locale’s appropriate date and time representation%d day of the month (01 through 31; the leading 0 is optional)%e same as %d%D date as %m/%d/%y%h abbreviated month name%H hour (00 through 23)%I hour (01 through 12)%m month number (01 through 12)%M minute (00 through 59)%n same as \n%p locale’s equivalent of either AM or PM%r time as %I:%M:%S %p%R time as %H:%M%S seconds (00 through 61)%t insert a tab%T time as %H:%M:%S%w weekday number (Sunday = 0 through Saturday = 6)%x locale’s appropriate date representation%X locale’s appropriate time representation%y year without century (00 through 99). For inputs 69-99, the 20th century (1900s) is

assumed, and for inputs 00-68, the 21st century (2000s) is assumed.%Y year as ccyy (e.g., 1986)%Z time zone name or no characters if no time zone exists. If the time zone supplied by %Zis

not the same as the time zone getdate() expects, an invalid specification error isreturned. getdate() calculates the expected time zone from the TZ environment vari-able.

Month and weekday names may consist of any combination of uppercase and lowercase letters. The usercan request that the input date or time specification be in a specific language by setting the LC_TIMEcategory (see setlocale (3C)).

For descriptors that allow leading zeros, leading zeros are optional. However, the number of digits usedfor those descriptors must not exceed two, including leading zeros. Extra whitespace in either the tem-plate file or in string is ignored.

The field descriptors %c, %x, and %Xare not supported if they include unsupported field descriptors.

Section 3−−356 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getdate(3C) getdate(3C)

The following example shows the possible contents of a template:

%m%A %B %d, %Y, %H:%M:%S%A%B%m/%d/%y %I %p%d,%m,%Y %H:%Mat %A the %dst of %B in %Yrun job at %I %p, %B %dnd%A den %d. %B %Y %H.%M Uhr

The following are examples of valid input specifications for the above template:

getdate("10/1/87 4 PM");getdate("Friday");getdate("Friday September 18, 1987, 10:30:30");getdate("24,9,1986 10:30");getdate("at monday the 1st of december in 1986");getdate("run job at 3 PM, december 2nd");

If the LC_TIME category is set to a German locale that includes freitag as a weekday name andoktober as a month name, the following would be valid:

getdate("freitag den 10. oktober 1986 10.30 Uhr");

This example shows how local date and time specification can be defined in the template:

Invocation Line in Templategetdate("11/27/86") %m/%d/%ygetdate("27.11.86") %d.%m.%ygetdate("86-11-27") %y-%m-%dgetdate("Friday 12:00:00") %A %H:%M:%S

The following rules apply when converting the input specification into the internal format:

• If only the weekday is given, today is assumed if the given day is equal to the current day, andnext week if it is less.

• If only the month is given, the current month is assumed if the given month is equal to thecurrent month, and next year if it is less and no year is given (the first day of the month isassumed if no day is given).

• If no hour, minute and second are given, the current hour, minute and second are assumed.

• If no date is given, today is assumed if the given hour is greater than the current hour andtomorrow is assumed if it is less.

The following examples help to illustrate the above rules assuming that the current date is Mon Sep 2212:19:47 EDT 1986 , and the LC_TIME category is set to the default C locale.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−357

A gA

getdate(3C) getdate(3C)

Line inInput Template Date

Mon %a Mon Sep 22 12:19:47 EDT 1986Sun %a Sun Sep 28 12:19:47 EDT 1986Fri %a Fri Sep 26 12:19:47 EDT 1986September %B Mon Sep 1 12:19:47 EDT 1986January %B Thu Jan 1 12:19:47 EST 1987December %B Mon Dec 1 12:19:47 EST 1986Sep Mon %b %a Mon Sep 1 12:19:47 EDT 1986Jan Fri %b %a Fri Jan 2 12:19:47 EST 1987Dec Mon %b %a Mon Dec 1 12:19:47 EST 1986Jan Wed 1989 %b %a %Y Wed Jan 4 12:19:47 EST 1989Fri 9 %a %H Fri Sep 26 09:00:00 EDT 1986Feb 10:30 %b %H:%S Sun Feb 1 10:30:00 EST 198710:30 %H:%M Tue Sep 23 10:30:00 EDT 198613:30 %H:%M Mon Sep 22 13:30:00 EDT 1986

Obsolescent Interfacegetdate_r() converts user format date and time.

ERRORSUpon failure, getdate() returns NULL and the symbol getdate_err is set to indicate the error.

The following is a complete list of the getdate_err settings and their interpretation:

1 the DATEMSKenvironment variable is null or undefined,

2 the template file cannot be opened for reading,

3 failed to get file status information,

4 the template file is not a regular file,

5 an error is encountered while reading the template file,

6 memory allocation failed (not enough memory available),

7 there is no line in the template that matches the input,

8 invalid input specification. For example, February 31; or the time specified cannot berepresented in the time_t data type in 32-bit HP-UX (which represents Tuesday January 1903:14:07 UTC, 2038) or exceeds the maximum date supported in 64-bit HP-UX (which is FridayDecember 31 23:59:59 UTC, 9999).

WARNINGSThe return value for getdate() points to data whose content is overwritten by each call by the samethread.

getdate_r() is an obsolescent interface supported only for compatibility with existing DCE applica-tions. New multi-threaded applications should use getdate() .

SEE ALSOctime(3C), ctype(3C), setlocale(3C), strftime(3C), thread_safety(5).

Section 3−−358 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

getdiskbyname(3C) getdiskbyname(3C)

NAMEgetdiskbyname( ) - get disk description by its name

SYNOPSIS#include <disktab.h>

struct disktab *getdiskbyname(const char *name);

Obsolescent Interfaceint getdiskbyname_r(

const char *name,struct disktab *result,char *buffer,int buflen);

DESCRIPTIONgetdiskbyname() takes a disk name (such as hp7959B) and returns a pointer to a structure thatdescribes its geometry information and the standard disk partition tables. All information is obtainedfrom the disktab database file (see disktab (4)).

The contents of the structure disktab include the following members. Note that there is not neces-sarily any correlation between the placement in this list and the order in the structure.

char *d_name; /* drive name */char *d_type; /* drive type */int d_secsize; /* sector size in bytes */int d_ntracks; /* # tracks/cylinder */int d_nsectors; /* # sectors/track */int d_ncylinders; /* # cylinders */int d_rpm; /* revolutions/minute */struct partition {

int p_size; /* #sectors in partition */short p_bsize; /* block size in bytes */short p_fsize; /* frag size in bytes */

} d_partitions[NSECTIONS];

The constant NSECTIONSis defined in <disktab.h >.

Obsolescent Interfacegetdiskbyname_r() gets disk description by its name.

DIAGNOSTICSA NULL pointer is returned in case of an error, or if name is not found in the disktab database file.

WARNINGSThe return value for getdiskbyname() points to data whose content is overwritten by each call.getdiskbyname_r() is an obsolescent interface supported only for compatibility with existing DCEapplications. New multithreaded applications should use getdiskbyname() .

AUTHORgetdiskbyname() was developed by HP and the University of California, Berkeley.

SEE ALSOdisktab(4), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−359

A gA

getdvagent(3) getdvagent(3)

NAMEgetdvagent, getdvagnam, setdvagent, enddvagent, putdvagnam, copydvagent - manipulate device assign-ment database entry for a trusted system

SYNOPSIS#include <sys/types.h>#include <hpsecurity.h>#include <prot.h>

struct dev_asg ∗getdvagent( );

struct dev_asg ∗getdvagnam(const char ∗name);

void setdvagent( );

void enddvagent( );

int putdvagnam(const char ∗name, struct dev_asg ∗dv);

struct dev_asg ∗copydvagent(struct dev_asg ∗dv);

DESCRIPTIONgetdvagent , getdvagnam , and copydvagent each return a pointer to an object with the followingstructure containing the broken-out fields of an entry in the Device Assignment database. Each databaseentry is returned as a dev_asg structure, declared in the <prot.h> header file:

struct dev_field {char *fd_name; /* external name */char **fd_devs; /* device list */mask_t fd_type[1]; /* tape, printer, terminal */char **fd_users; /* authorized user list */

};

/* Device Assignment Database entry */

#define AUTH_DEV_TYPE "device type"#define AUTH_DEV_PRINTER 0#define AUTH_DEV_TERMINAL 1#define AUTH_DEV_TAPE 2#define AUTH_DEV_REMOTE 3#define AUTH_MAX_DEV_TYPE 3#define AUTH_DEV_TYPE_SIZE (WORD_OF_BIT (AUTH_MAX_DEV_TYPE) + 1)

/* this structure tells which of the corresponding fields* in dev_field are valid (filled).*/

struct dev_flag {unsigned short

fg_name : 1,fg_devs : 1,fg_type : 1,fg_users : 1,

;};

struct dev_asg {struct dev_field ufld;struct dev_flag uflg;struct dev_field sfld;struct dev_flag sflg;

};

The Device Assignment database stores device characteristics that are related to user authorizations andsynonyms. On systems supporting network connections, the Device Assignment database stores informa-tion about hosts initiating connections.

Each entry contains a name , which is a cross reference to the terminal control database, and a list of dev-ices , each of which is a pathname corresponding to that device. This list allows the device assignmentsoftware of the trusted system to invalidate all references to a device when re-assigning it. The list is a

Section 3−−360 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getdvagent(3) getdvagent(3)

table of character string pointers, whose last entry is a NULLpointer.

fd_users is a pointer to a null-terminated table of character string pointers referring to user allowedaccess.

For trusted system versions supporting network connections, the device name can be a 12 character hostname, where the first 8 characters are the ASCII hex address of the device, and the last 4 characters areASCII zeroes. For example, a host with Internet address 129.75.0.3 has device name 814b00030000. Thetrailing four zeroes are for compatibility with ports on terminal concentrators. The SAM API’s supportsconversion of host name to device name. Thus, sensitivity level ranges and user authorization lists can beenforced on hosts as well as on directly connected terminals.

When getdvagent is first called, it returns a pointer to the first device assignment entry. Thereafter, itreturns a pointer to the next entry, so successive calls can be used to search the database. getdvagnamsearches from the beginning of the database until an entry with a device name matching name is found,and returns a pointer to that entry. If an end of file or an error is encountered on reading, these func-tions return a NULL pointer. copydvagent copies a device assignment structure and the fields towhich it refers to a newly-allocated data area. Since getdvagent , getdvagnam , and putdvagentre-use a static structure when accessing the database, the values of any entry must be saved if these rou-tines are used again. The dev_asg structure returned by copydvagent can be freed using free (seemalloc (3C)).

A call to setdvagent has the effect of setting the device assignment database back to the first entry toallow repeated searches of the database. enddvagent frees all memory and closes all files used to sup-port these routines.

putdvagnam rewrites or adds an entry to the database. If there is an entry whose fd_name fieldmatches the name argument, that entry is replaced with the contents of the dv structure. Otherwise, thatentry is added to the database.

APPLICATION USAGEIn a multithreaded application, these routines are safe to be called only from one dedicated thread.These routines are not POSIX.1c async-cancel safe nor async-signal safe.

RETURN VALUEgetdvagent and getdvagnam return a pointer to a static structure on success, or a NULL pointer onfailure. This static structure is overwritten by getdvagent , getdvagnam , and putdvagnam .

putdvagnam returns 1 on success, or 0 on failure.

copydvagent returns a pointer to the newly-allocated structure on success, or a NULL pointer if therewas a memory allocation error.

WARNINGSThe structure returned by this routine contains pointers to character strings and lists rather than beingself-contained. copydvagent must be used instead of structure assignments to save a returned struc-ture.

The value returned by getdvagent and getdvagnam refers to a structure that is overwritten by callsto these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry usingcopydvagent and supply the modified buffer to putdvagent .

NOTESPrograms using this routine must be compiled with -lsec .

FILES/tcb/files/devassign Device assignment database

SEE ALSOauthcap(4).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−361

A gA

getenv(3C) getenv(3C)

NAMEgetenv( ) - return value for environment name

SYNOPSIS#include <stdlib.h>

char *getenv(const char *name);

DESCRIPTIONgetenv() searches the environment list (see environ (5)) for a string of the form name=value, andreturns a pointer to the value in the current environment if such a string is present, otherwise a NULLpointer. name can be either the desired name, null-terminated, or of the form name=value, in which casegetenv() uses the portion to the left of the = as the search key.

WARNINGSgetenv() returns a pointer to static data which can be overwritten by subsequent calls.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the interpretation of characters in name as single- and/or multi-byte characters.

International Code Set SupportSingle- and multi-byte character code sets are supported.

SEE ALSOexec(2), putenv(3C), environ(5), thread_safety(5).

STANDARDS CONFORMANCEgetenv() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, POSIX.2, ANSI C

Section 3−−362 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getfsent(3X) getfsent(3X)(TO BE OBSOLETED)

NAMEgetfsent( ), getfsspec( ), getfsfile( ), getfstype( ), setfsent( ), endfsent( ) - get file system descriptor file entry

SYNOPSIS#include <checklist.h>

struct checklist *getfsent(void);

struct checklist *getfsspec(const char *spec);

struct checklist *getfsfile(const char *file);

struct checklist *getfstype(const char *type);

int setfsent(void);

int endfsent(void);

Remarks:These routines are included only for compatibility with 4.2 BSD. For maximum portability andimproved functionality, new applications should use the getmntent (3X) library routines.

DESCRIPTIONgetfsent() , getfsspec() , getfsfile() , and getfstype() each returns a pointer to an objectwith the following structure containing the broken-out fields of a line in the /etc/fstab file. Thestructure is declared in the <checklist.h > header file:

struct checklist {char *fs_spec; /* special file name */char *fs_bspec; /* block special file name */char *fs_dir; /* file sys directory name */char *fs_type; /* type: ro, rw, sw, xx */int fs_passno; /* fsck pass number */int fs_freq; /* backup frequency */

};

The fields have meanings described in fstab (4). If the block special file name, the file system directoryname, and the type are not all defined on the associated line in /etc/fstab , these routines returnpointers to NULL in the fs_bspec , fs_dir , and fs_type fields. If the pass number or the backupfrequency field are not present on the line, these routines return −1 in the corresponding structuremember. fs_freq is reserved for future use.

getfsent() Reads the next line of the file, opening the file if necessary.

setfsent() Opens and rewinds the file.

endfsent() Closes the file.

getfsspec() Sequentially searches from beginning of file until a matching special file name isfound, or until EOF is encountered.

getfsfile() Sequentially searches from the beginning of the file until a matching file system filename is found, or until EOF is encountered. getfstype() Sequentially searchesfrom the beginning of the file until a matching file system type field is found, oruntil EOF is encountered.

DIAGNOSTICSA null pointer is returned on EOF, invalid entry, or error.

WARNINGSSince all information is contained in a static area, it must be copied to be saved.

Obsolescent Interfacesgetfsent() , getfsspec() , getfsfile() , getfstype() , setfsent() , and endfsent() areto be obsoleted at a future date.

AUTHORgetfsent() was developed by HP and the University of California, Berkeley.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−363

A gA

getfsent(3X) getfsent(3X)(TO BE OBSOLETED)

FILES/etc/fstab

SEE ALSOfstab(4).

Section 3−−364 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getgrent(3C) getgrent(3C)

NAMEgetgrent( ), getgrgid( ), getgrgid_r( ), getgrnam( ), getgrnam_r( ), setgrent( ), endgrent( ), fgetgrent( ) - getgroup file entry

SYNOPSIS#include <grp.h>

struct group *getgrent(void);

struct group *getgrgid(gid_t gid);

int getgrgid_r(gid_t gid, struct group *grp, char *buffer,size_t buflen, struct group ** result);

struct group *getgrnam(const char *name);

int getgrnam_r(const char *name, struct group *grp, char *buffer,size_t buflen, struct group ** result);

void setgrent(void);

void endgrent(void);

struct group *fgetgrent(FILE *stream);

Obsolescent Interfaces#include <grp.h>

int getgrent_r(struct group *result, char *buffer, int buflen,FILE **grfp);

void setgrent_r(FILE **grfp);

void endgrent_r(FILE **grfp);

int fgetgrent_r(FILE *stream, struct group *result, char *buffer,int buflen);

DESCRIPTIONgetgrent() , getgrgid() , and getgrnam() are used to obtain group entries, and return a pointerto an object of group structure. An entry may come from any of the sources for group specified in the/etc/nsswitch.conf file. See nsswitch.conf(4).

The group structure is defined in <grp.h > and includes the following members:

char *gr_name; /* the name of the group */char *gr_passwd; /* the encrypted group password */gid_t gr_gid; /* the numerical group ID */char **gr_mem; /* null-terminated array of pointers

to member names */

getgrent() When first called, getgrent() returns a pointer to the first group structure inthe group database; thereafter, it returns a pointer to the next group structure inthe database. In this way, successive calls can be used to search the entire database;

setgrent() Has the effect of rewinding the group database to allow repeated searches;

endgrent() Can be called to indicate that group database processing is complete;

getgrgid() Searches from the beginning of the group database until a numeric group ID match-ing gid is found, and returns a pointer to the particular structure in which it wasfound;

getgrnam() Searches from the beginning of the group database until a group name matchingname is found, and returns a pointer to the particular structure in which it wasfound;

fgetgrent() Returns a pointer to the next group structure in the standard I/O stream stream ,which should be open for reading, and its contents should match the format of/etc/group .

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−365

A gA

getgrent(3C) getgrent(3C)

Obsolescent Interfacesgetgrent_r() , setgrent_r() , endgrent_r() , fgetgrent_r() get group file entry.

Reentrant Interfacesgetgrgid_r () and getgrnam_r() both update the struct group pointed to by grp and store apointer to that structure at the location pointed to by result . The structure shall contain an entry fromthe group database with a matching gid or name. Storage referenced by the group structure pointed toby grp shall be allocated from the memory provided with the buffer parameter, which is buflen insize. The maximum size needed for this buffer can be determined with the _SC_GETGR_R_SIZE_MAXsysconf() parameter. A NULL pointer is returned at the location pointed to by result on error or ifthe requested entry is not found.

A buffer length of 1024 is recommended.

RETURN VALUEgetgrent() , getgrgid() , getgrnam() , and fgetgrent() return a NULL pointer if an end-of-file or error is encountered on reading. Otherwise, the return value points to an internal static area con-taining a valid group structure.

getgrgid_r() and getgrnam_r() return zero upon success. Otherwise, an error number is returnedto indicate the error.

ERRORSgetgrent() , getgrgid() , getgrnam() and fgetgrent() fail if any of the following are true:

[EIO] An I/O error has occurred.

[EMFILE] OPEN_MAX file descriptors are currently open in the calling process.

[ENFILE] The maximum allowable number of files is currently open in the system.

WARNINGSThe value returned by getgrent() , getgrgid() , getgrnam() , and fgetgrent() points to anarea that is overwritten by each call to any of the functions. It must be copied if it is to be saved.

Users of getgrgid_r() and getgrnam_r() should note that these interfaces now conform withPOSIX.1c. getgrent_r() , setgrent_r() , endgrent_r() and fgetgrent_r() are obsolescentinterfaces. These interfaces and the old prototypes of getgrgid_r() and getgrnam_r() are sup-ported for compatibility with existing DCE applications only.

The interfaces setgrent() , getgrent() , endgrent() , getgrgid() , getgrnam() ,getgrgid_r() and getgrgnam_r() use the Dynamic Name Service Switch. (See nsswitch.conf(4).)An application that uses these interfaces cannot be fully archive bound.

DEPENDENCIESNFS

Files/var/yp/ domainname /group.byname/var/yp/ domainname /group.bygid

See Alsoniscat (1), ypcat (1).

FILES/etc/group

SEE ALSOniscat(1), ypcat(1), getgroups(2), getpwent(3C), stdio(3S), group(4), thread_safety(5).

STANDARDS CONFORMANCEgetgrent() : SVID2, SVID3, XPG2

endgrent() : SVID2, SVID3, XPG2

fgetgrent() : SVID2, SVID3, XPG2

getgrgid() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Section 3−−366 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getgrent(3C) getgrent(3C)

getgrnam() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

setgrent() : SVID2, SVID3, XPG2

getgrnam_r(), getgrgid_r() : POSIX.1c

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−367

A gA

gethostent(3N) gethostent(3N)

NAMEgethostent(), gethostbyaddr(), gethostbyname(), sethostent(), endhostent() - get network host entry

SYNOPSIS#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>

struct hostent *gethostent(void);

struct hostent *gethostbyname(const char *name);

struct hostent *gethostbyaddr(const char *addr,int len,int type);

_XOPEN_SOURCE_EXTENDED onlystruct hostent *gethostbyaddr(const void *addr,

size_t len,int type);

int sethostent(int stayopen);

int endhostent(void);

_XOPEN_SOURCE_EXTENDED onlyvoid sethostent(int stayopen);void endhostent(void);

DESCRIPTIONThe gethostent() , gethostbyname() , and gethostbyaddr() functions each return a pointer toa structure of type hostent , defined as follows in <netdb.h> :

struct hostent {char *h_name;char **h_aliases;int h_addrtype;int h_length;char **h_addr_list;

};

#define h_addr h_addr_list[0]

The members of this structure are:

h_name The official name of the host.

h_aliases A null-terminated array of alternate names for the host.

h_addrtype The type of address being returned; always AF_INET .

h_length The length, in bytes, of the address.

h_addr_list A null-terminated array of network addresses for the host.

h_addr The first address in h_addr_list ; this is for compatibility with previousHP-UX implementations where a struct hostent contains only one net-work address per host.

Name Service Switch-Based OperationThese host entry library routines internally call the name service switch to access the "hosts" databaselookup policy configured in the /etc/nsswitch.conf file (see nsswitch.conf(4)). The lookup policydefines the order and the criteria of the supported name services used to resolve host names and Internetaddresses. The operations of these name services: Domain Name Server, NIS, NIS+, and nonservermode (e.g., files) are listed below.

Domain Name Server OperationIf the local system is configured to use the named name server (see named(1M) and resolver (4)) for nameor address resolution, then the function:

Section 3−−368 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gethostent(3N) gethostent(3N)

gethostent() Always returns a NULL pointer.

sethostent() Requests the use of a connected stream socket for queries to the nameserver if the stayopen flag is non-zero. The connection is retained aftereach call to gethostbyname() or gethostbyaddr() .

endhostent() Closes the stream socket connection.

gethostbyname()gethostbyaddr() Each retrieves host information from the name server. Names are matched

without respect to uppercase or lowercase. For example, berkeley.edu ,Berkeley.EDU , and BERKELEY.EDU all match the entry forberkeley.edu .

NIS Server OperationIf ypserv , the server for the Network Information Service (see ypserv (1M)), is used for name or addressresolution, then the function:

gethostent() Returns the next entry in the NIS database.

sethostent() Initializes an internal key for the NIS database. If the stayopen flag isnon-zero, the internal key is not cleared after calls to endhostent() .

endhostent() Clears the internal NIS database key.

gethostbyname()gethostbyaddr() Each retrieves host information from the NIS database. Names are

matched without respect to uppercase or lowercase. For example,berkeley.edu , Berkeley.EDU , and BERKELEY.EDUall match theentry for berkeley.edu .

NIS Plus Server OperationIf rpc.nisd , the server for the Network Information Service Plus (see nis+ (1)), is used for name oraddress resolution, then the function:

gethostent() Returns the next entry in the NIS+ database.

sethostent() Initializes an internal key for the NIS+ database. If the stayopen flag isnon-zero, the internal key is not cleared after calls to endhostent() .

endhostent() Clears the internal NIS+ database key.

gethostbyname()gethostbyaddr() Each retrieves host information from the NIS+ database. Names are

matched without respect to uppercase or lowercase. For example,berkeley.edu , Berkeley.EDU , and BERKELEY.EDUall match theentry for berkeley.edu .

Nonserver OperationIf the /etc/hosts file is used for name or address resolution, then the function:

gethostent() Reads the next line of /etc/hosts , opening the file if necessary.

sethostent() Opens and rewinds the file. If the stayopen flag is non-zero, the host database is not closed after each call to gethostent() (either directly orindirectly through one of the other gethost calls).

endhostent() Closes the file.

gethostbyname() Sequentially searches from the beginning of the file until a host name(among either the official names or the aliases) matching its name parame-ter is found, or until EOF is encountered. Names are matched withoutrespect to uppercase or lowercase, as described above in the name servercase.

gethostbyaddr() Sequentially searches from the beginning of the file until an Internetaddress matching its addr parameter is found, or until EOF is encoun-tered.

The return value, struct hostent , must be saved before a subsequent call to the functionsgethost*() , getaddrinfo() , and getnameinfo() .

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−369

A gA

gethostent(3N) gethostent(3N)

In a multithreaded application, gethostent() , gethostbyaddr() , and gethostbyname() usethread-specific storage that is re-used in each call. The return value, struct hostent , should beunique for each thread and should be saved, if desired, before the thread makes the next gethost*()call. The return value must be saved before a subsequent call to the function getaddrinfo() or get-nameinfo() , because these functions may internally call the gethost*() function which mayoverwrite their return value.

For enumeration in multithreaded applications, the position within the enumeration is a process-wideproperty shared by all threads. sethostent() may be used in a multithreaded application, but resetsthe enumeration position for all threads. If multiple threads interleave calls to gethostent() , thethreads will enumerate disjoint subsets of the host database.

ArgumentsCurrently, only the Internet address format is understood. In calls to gethostbyaddr() , the parame-ter addr must be a pointer to an in_addr structure, an Internet address in network order (seebyteorder (3N)) and the header file <netinet/in.h> ). The parameter len must be the number of bytesin an Internet address; that is, sizeof (struct in_addr) . The parameter type must be the con-stant AF_INET .

RETURN VALUEIf successful, gethostbyname() , gethostbyaddr() , and gethostent() return a pointer to therequested hostent structure.

gethostbyname() and gethostbyaddr() return NULL if their host or addr parameters, respec-tively, cannot be found in the database. If /etc/hosts is being used, they also return NULL if they areunable to open /etc/hosts .

gethostbyaddr() also returns NULL if either its addr or len parameter is invalid.

gethostent() always returns NULL if the name server is being used.

ERRORSIf the name server is being used and gethostbyname() or gethostbyaddr() returns a NULLpointer, the external integer h_errno contains one of the following values:

HOST_NOT_FOUND No such host is known.

TRY_AGAIN This is usually a temporary error. The local server did not receive aresponse from an authoritative server. A retry at some later time maysucceed.

NO_RECOVERY This is a non-recoverable error.

NO_ADDRESS The requested name is valid but does not have an IP address; this is not atemporary error. This means another type of request to the name serverwill result in an answer.

If the name server is not being used, the value of h_errno may not be meaningful.

EXAMPLESThe following code excerpt counts the number of host entries:

int count = 0;

(void) sethostent(0);while (gethostent() != NULL)

count++;(void) endhostent();

The following sample program prints the canonical name, aliases, and "." separated Internet IP addressesfor a given "." separated IP address.

#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <netdb.h>#include <netinet/in.h>

Section 3−−370 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

gethostent(3N) gethostent(3N)

main(int argc, const char **argv){

u_int addr;struct hostent *hp;char **p;

if (argc != 2) {(void) printf("usage: %s IP-address\n",argv[0]);exit (1);

}if ((int) (addr = inet_addr (argv[1])) == -1) {

(void) printf("IP-address must be of the form a.b.c.d\n");exit (2);

}

hp=gethostbyaddr((char *) &addr, sizeof (addr), AF_INET);if (hp == NULL) {

(void) printf("host information for %s no found \n", argv[1]);exit (3);

}

for (p = hp->h_addr_list; *p!=0;p++){struct in_addr in;char **q;

(void)memcpy(&in.s_addr, *p, sizeof(in.s_addr));(void)printf("%s\t%s",inet_ntoa(in), hp->h_name);for (q=hp->h_aliases;*q != 0; q++)

(void) printf("%s", *q);(void)putchar(’\n’);

}exit (0);

}

WARNINGSPrograms that use the interfaces described in this manpage cannot be linked statically because the imple-mentations of these functions employ dynamic loading and linking of shared objects at run time.

h_errno is referenced as an extern int for single thread applications and is defined as function callmacro for multithreaded applications in file /usr/include/netdb.h . Applications that referenceh_errno need to include /usr/include/netdb.h .

OBSOLESCENT INTERFACESint gethostent_r(struct hostent *result,

struct hostent_data *buffer);

int gethostbyname_r(const char *name,struct hostent *result,struct hostent_data *buffer);

int gethostbyaddr_r(const char *addr,int len,int type,struct hostent *result,struct hostent_data *buffer);

int sethostent_r(int stayopen, struct hostent_data *buffer);

int endhostent_r(struct hostent_data *buffer);

The above reentrant interfaces have been moved from libc to libd4r . They are included to supportexisting applications and may be removed in the future release. New multithreaded applications shoulduse the regular APIs (those without the -r suffix).

The reentrant interfaces function the same as the regular interfaces without the -r suffix. However,gethostent_r() , gethostbyname_r() , and gethostbyaddr_r() expect to be passed theaddress of a struct hostent and will store the address of the result at the supplied parameter. Thepassed in address of struct hostent_data in the reentrant interfaces cannot be a NULL pointer.

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−371

A gA

gethostent(3N) gethostent(3N)

The reentrant routines return -1 if the operation is unsuccessful, or, in the case of gethostent_r() , ifthe end of the hosts list has been reached. 0 is returned otherwise.

AUTHORgethostent() was developed by Sun Microsystems Inc.

FILES/etc/hosts

SEE ALSOnamed(1M), ypserv(1M), resolver(3N), ypclnt(3C), hosts(4), nsswitch.conf(4), ypfiles(4), nis+(1),thread_safety(5).

STANDARDS CONFORMANCEgethostent() : XPG4

Section 3−−372 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: August 2003

A gA

gethrtime(3C) gethrtime(3C)

NAMEgethrtime( ) - get high resolution time

SYNOPSIS#include <time.h>

hrtime_t gethrtime(void);

DESCRIPTIONThe gethrtime() function returns the current high-resolution real time. Time is expressed asnanoseconds since a certain time in the past. This API uses a fast light weight system call to get thenanoseconds from a certain time. It is not correlated in any way to the time of day. This API is used forperformance measurement tasks and is used for cheap and accurate interval timing.

hrtime_t is a signed 64-bit number.

RETURN VALUEUpon successful completion, gethrtime() returns a number of nanoseconds. Otherwise, a value of -1is returned.

WARNINGSThis API will only be available if the application is being compiled in -Ae mode (extended ANSI) because64-bit integer numbers are not available in -Aa (ANSI) mode. Please refer to cc(1).

EXAMPLESThe following code fragment measures the average cost of getgid() :

hrtime_t begin, end;

int i, count = 1000;

begin = gethrtime();

for (i = 0; i < count; i++)

getgid();

end = gethrtime();

printf("Avg getgid() time = %lld nsec", (end - begin)/count );

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−373

A gA

getlogin(3C) getlogin(3C)

NAMEgetlogin( ), getlogin_r( ) - get name of user logged in on this terminal

SYNOPSIS#include <unistd.h>

char *getlogin(void);

int getlogin_r(char *buf, size_t buflen);

DESCRIPTIONThe getlogin() function retrieves the name of the user currently logged in on a terminal associatedwith the calling process, as found in user-accounting database maintained by utmpd (1M).

At least one of the standard input, standard output, or standard error must be a terminal. For the first ofthese found that is a terminal, a user must have logged in on that terminal, and that terminal must bethe controlling terminal of the session leader process of the calling process’s session.

The getlogin() function can be used in conjunction with getpwnam() to locate the correct passwordfile entry when the same user ID is shared by several login names.

The recommended procedure to obtain the user name associated with the real user ID of the calling pro-cess is to call getlogin() , and if that fails, to call getpwuid(getuid()) .

To get the user name associated with the effective user ID, call getpwuid(geteuid()) .

getlogin_r() performs the same operations as getlogin() , but returns the login name in thebuffer to which buf points, whose size in bytes should be passed in buflen . buf should have space for thename and the terminating null character. The maximum size of the login name is LOGIN_NAME_MAX.

APPLICATION USAGEThe return value from getlogin() points to static data whose content is overwritten by each call.

RETURN VALUEUpon successfully finding and validating the login name of the user logged in on the terminal, getlo-gin() returns a pointer to the name. Otherwise, it returns a null pointer, and sets errno to indicatethe error.

Upon successfully finding, validating, and copying to the buffer the login name of the user logged in onthe terminal, getlogin_r() returns 0 upon success and returns an error number upon failure.

ERRORSgetlogin() and getlogin_r() fail if any of the following is true:

[EACCES] Access permission to get the status of the terminal device file, was denied.

[EMFILE] Too many file descriptors are in use by this process.

[ENFILE] Too many file descriptors are in use on the system.

[ENOENT] The terminal device file cannot be found.

[ENOTTY] None of the standard input, standard output, or standard error is a terminal, or forthe first of these that is a terminal, no current login is registered on that terminal,or the session leader process of the calling process has no controlling terminal.

[EPERM] One of the standard input, standard output, or standard error is a terminal, and acurrent login was found on that terminal, but that terminal is not the same as thecontrolling terminal of the session of the calling process.

[ESRCH] The session leader process of the calling process is no longer running.

The error condition associated with [EPERM] prevents processes that have access to some other user’sterminal from believing that they are related to that other user’s login session.

getlogin_r() also fails if the following is true:

[ERANGE] The length of the name to be returned, including the terminating null byte, exceedsbuflen .

Section 3−−374 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getlogin(3C) getlogin(3C)

WARNINGSUsers of getlogin_r() should note getlogin_r() now conforms with the POSIX.1c Threads stan-dard. The old prototype of getlogin_r() is supported for compatibility with existing DCE applica-tions only.

SEE ALSOgetuid(2), getgrent(3C), getpwent(3C), utmpd(1M), thread_safety(5).

STANDARDS CONFORMANCEgetlogin() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

getlogin_r() : POSIX.1c

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−375

A gA

getmntent(3X) getmntent(3X)

NAMEgetmntent( ), getmntent_r( ), setmntent( ), addmntent( ), delmntent( ), endmntent( ), hasmntopt( ) - get filesystem descriptor file entry

SYNOPSIS#include <mntent.h>

FILE *setmntent(const char *path, char *type);

struct mntent *getmntent(FILE *stream);

int getmntent_r(FILE *stream,struct mntent *result,char *buffer,int buflen);

int addmntent(FILE *stream, struct mntent *mnt);

int delmntent(FILE *stream, struct mntent *mnt);

char *hasmntopt(struct mntent *mnt, const char *opt);

int endmntent(FILE *stream);

DESCRIPTIONThese routines replace the obsolete getfsent() routines (see getfsent (3X)) for accessing the file systemdescription file /etc/fstab . They are also used to access the mounted file system description file/etc/mnttab .

setmntent() Opens a file system description file and returns a file pointer which can then beused with getmntent() , addmntent() , delmntent() , or endmntent() .The type argument is the same as in fopen (3S).

getmntent() Reads the next line from stream and returns a pointer to an object with the follow-ing structure containing the broken-out fields of a line in the file-system descriptionfile, <mntent.h> . The fields have meanings described in fstab (4).

struct mntent {char *mnt_fsname; /* file system name */char *mnt_dir; /* file system path prefix */char *mnt_type; /* hfs, nfs, swap, or xx */char *mnt_opts; /* ro, suid, etc. */int mnt_freq; /* dump frequency, in days */int mnt_passno; /* pass number on parallel fsck */long mnt_time; /* When file system was mounted;*/

/* see mnttab(4). *//* (0 for NFS) */

};

getmntent_r() Uses three extra parameters to provide results equivalent to those produced bygetmntent() . The extra parameters are:1. The address of a struct mntent where the result will be stored.2. A buffer to store character strings to which fields in the struct mntent will

point.3. The length of the user-supplied buffer. A buffer length of 1025 is recommended.

addmntent() Adds the mntent structure mnt to the end of the open file stream . Note thatstream must be opened for writing. Upon return from the call to addmntent , thefile position indicator for the stream will point to EOF.

delmntent() Deletes all entries from the file stream opened with setmntent that match bothmnt_fsname and mnt_dir in mntent structure mnt . If mnt_fsname is a nullpointer, all entries that match mnt_dir will be deleted. If mnt_dir is a null pointer,all entries that match mnt_fsname will be deleted. It is an error if both mnt_fsnameand mnt_dir are null pointers. Note that stream must be opened via setmntentfor reading and writing (r+ or a+). Upon return from the call to delmntent , thefile position indicator for the stream will point to EOF.

Section 3−−376 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getmntent(3X) getmntent(3X)

hasmntopt() Scans the mnt_opts field of the mntent structure mnt for a substring thatmatches opt . It returns the address of the substring if a match is found. Otherwise,the return value takes one of the following default behaviors :

Option String Corresponding Default Behavior

MNTOPT_RW If the mnt_opts does not have the MNTOPT_ROoption,MNTOPT_RWis returned. Otherwise, NULL is returned.

MNTOPT_SUID If the mnt_opts does not have the MNTOPT_NOSUIDoption, MNTOPT_SUIDis returned. Otherwise, NULL isreturned.

MNTOPT_NOQUOTA If the mnt_opts does not have the MNTOPT_QUOTAoption, MNTOPT_NOQUTOAis returned. Otherwise, NULLis returned.

MNTOPT_FG If the mnt_opts does not have the MNTOPT_BGoption andmnt_type is MNTTYPE_NFS, MNTOPT_FGis returned.Otherwise, NULL is returned.

MNTOPT_HARD If the mnt_opts does not have the MNTOPT_SOFToptionand mnt_type is MNTTYPE_NFS, MNTOPT_HARDisreturned. Otherwise, NULL is returned.

MNTOPT_INTR If the mnt_opts does not have the MNTOPT_NOINTRoption and mnt_type is MNTTYPE_NFS, MNTOPT_INTRis returned. Otherwise, NULL is returned.

MNTOPT_DEVS If the mnt_opts does not have the MNTOPT_NODEVSoption and mnt_type is MNTTYPE_NFS, MNTOPT_DEVSis returned. Otherwise, NULL is returned.

If none of the default behaviors occur, NULL is returned.

Note: When the return value is the result of one of the default behaviors , it is apseudo option string, and not a pointer in the mnt_ops field.

endmntent() Closes the file.

The following definitions are provided in <mntent.h> :

#define MNT_CHECKLIST "/etc/fstab"#define MNT_MNTTAB "/etc/mnttab"

#define MNTMAXSTR 128 /* Max size string in mntent */

#define MNTTYPE_HFS "hfs" /* HFS file system */#define MNTTYPE_CDFS "cdfs" /* CD-ROM file system */#define MNTTYPE_NFS "nfs" /* Network file system */#define MNTTYPE_SWAP "swap" /* Swap device */#define MNTTYPE_SWAPFS "swapfs" /* File system swap */#define MNTTYPE_IGNORE "ignore" /* Ignore this entry */

#define MNTOPT_DEFAULTS "defaults" /* Use all default options */#define MNTOPT_RO "ro" /* Read only */#define MNTOPT_RW "rw" /* Read/write */#define MNTOPT_SUID "suid" /* Set uid allowed */#define MNTOPT_NOSUID "nosuid" /* No set uid allowed */#define MNTOPT_QUOTA "quota" /* Enable disk quotas */#define MNTOPT_NOQUOTA "noquota" /* Disable disk quotas */#define MNTOPT_DEV "dev" /* Device ID of the filesystem mounted */

The following definition is provided for device swap in <mntent.h> :

#define MNTOPT_END "end" /* swap after end of file system,Series 300/400/700 only */

The following definitions are provided for file system swap in <mntent.h> :

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−377

A gA

getmntent(3X) getmntent(3X)

#define MNTOPT_MIN "min" /* minimum file system swap */#define MNTOPT_LIM "lim" /* maximum file system swap */#define MNTOPT_RES "res" /* reserve space for file system */#define MNTOPT_PRI "pri" /* file system swap priority */

NETWORKING FEATURESNFS

The following definitions are provided in <mntent.h> :

#define MNTOPT_BG "bg" /* Retry mount in background */#define MNTOPT_FG "fg" /* Retry mount in foreground */#define MNTOPT_RETRY "retry" /* Number of retries allowed */#define MNTOPT_RSIZE "rsize" /* Read buffer size in bytes */#define MNTOPT_WSIZE "wsize" /* Write buffer size in bytes*/#define MNTOPT_TIMEO "timeo" /* Timeout in 1/10 seconds */#define MNTOPT_RETRANS "retrans" /* Number of retransmissions */#define MNTOPT_PORT "port" /* Server’s IP NFS port */#define MNTOPT_SOFT "soft" /* Soft mount */#define MNTOPT_HARD "hard" /* Hard mount */#define MNTOPT_INTR "intr" /* Interruptible hard mounts */#define MNTOPT_NOINTR "nointr" /* Uninterruptible hard mounts*/#define MNTOPT_DEVS "devs" /* Device file access allowed */#define MNTOPT_NODEVS "nodevs" /* No device file access allowed*/

RETURN VALUEsetmntent() Returns a null pointer on error. setmntent() attempts to establish an

exclusive write lock on the file it is opening, ie: when one of the following types ispassed to setmntent() to open the file for write/update: "w", "a", "r+", "w+", or"a+". If setmntent() cannot get the lock, it returns a null pointer and sets errnoto either [EACCES] or [EAGAIN]. See APPLICATION USAGE below for moreinformation about setmntent() .

getmntent() Returns a null pointer on error or EOF. Otherwise, getmntent() returns apointer to a mntent structure. Some of the fields comprising a mntent structure areoptional in /etc/fstab and /etc/mnttab . In the supplied structure, suchmissing character pointer fields are set to NULL and missing integer fields are setto −1 for mnt_freq and mnt_passno . If the integer field for mnt_time ismissing, it is set to 0.

getmntent_r() Returns a -1 on error or EOF, or if the supplied buffer is of insufficient length. Ifthe operation is successful, 0 is returned.

addmntent() Returns 1 on error.

delmntent() Returns -1 on error. Sets errno to [EINVAL] if stream or mnt are null pointers, orif both mnt_fsname and mnt_dir in mntent structure mnt are null pointers. Setserrno to [EBADF] if stream has been opened for read (r), append (a) or write (w). Ifthe operation is successful, returns the number of entries deleted from the file.When no entries are matched, delmntent returns 0 and does not set errno.

endmntent() Returns 1, and unlocks the file if it was locked by setmntent() .

EXAMPLESThe following code deletes an entry:

struct mntent mnt_entry;FILE *fp;int retval = NOT_DELETED;

mnt_entry.mnt_fsname = "/dev/vg00/lvol7";mnt_entry.mnt_dir = "/disk7";

if ((fp = setmntent(MNT_MNTTAB, "r+")) != NULL) {if (delmntent(fp, &mnt_entry) > 0)

retval = DELETED;(void)endmntent(fp);

Section 3−−378 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

getmntent(3X) getmntent(3X)

}return(retval);

APPLICATION USAGEData integrity is not guaranteed when reading the mntent data because setmntent() does not lockthe file when opening it with read-only permission. To overcome this, as one approach, programs mayneed to loop until the last modification time and file size before and after reading the file are the same.

The following code achieves the data integrity.

struct stat statbuf;FILE *fp;time_t orig_mtime;off_t orig_size;int read_status = FALSE;int retry;

for (retry = 0; retry < NO_OF_RETRIES; retry++){

/** If file is empty, do not bother reading it.* Sleep and then retry the stat().*/

if (stat(MNT_MNTTAB, &statbuf) != 0){return (STAT_FAILED);

}

if (statbuf.st_size == 0){sleep(1);if (stat(MNT_MNTTAB, &statbuf) != 0){

return(STAT_FAILED);}else{

if (statbuf.st_size == 0){continue;

}}

}

if ((fp = setmntent(MNT_MNTTAB, "r")) == NULL){return (SETMNTENT_FAILED);

}

/** operation on MNT_MNTTAB goes here...*/

orig_mtime = statbuf.st_mtime;orig_size = statbuf.st_size;

if (stat(MNT_MNTTAB, &statbuf) != 0){return (STAT_FAILED);

}if ((statbuf.st_mtime == orig_mtime) && (statbuf.st_size == orig_size)){

read_status = TRUE;break;

}}

Programs should expect that the file accessed by these APIs may be write locked by another processbecause setmntent() attempts to establish an exclusive write lock when opening it for write/update.

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−379

A gA

getmntent(3X) getmntent(3X)

Use of a text editor to manipulate the file accessed by these APIs is not supported. setmntent() andendmntent() are safe for per process locking. setmntent() , getmntent() , addmntent() ,delmntent() , hasmntent() , and endmntent() are not safe to be called by a child process afterfork() but before exec() .

AUTHORaddmntent() , endmntent() , getmntent() , hasmntopt() , and setmntent() were developedby The University of California, Berkeley, Sun Microsystems, Inc., and HP. delmntent() wasdeveloped by HP.

FILES/etc/fstab/etc/mnttab

SEE ALSOgetfsent(3X), fstab(4), mnttab(4), thread_safety(5).

Section 3−−380 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: August 2003

A gA

getnetconfig(3N) getnetconfig(3N)

NAMEgetnetconfig(), setnetconfig(), endnetconfig(), getnetconfigent(), freenetconfigent(), nc_perror(),nc_sperror() - get network configuration database entry

SYNOPSIS#include <netconfig.h>

struct netconfig *getnetconfig(void *handlep );

void *setnetconfig(void);

int endnetconfig(void *handlep );

struct netconfig *getnetconfigent(const char *netid );

void freenetconfigent(struct netconfig *netconfigp );

void nc_perror(const char *msg );

char *nc_sperror(void);

MULTITHREAD USAGEThread Safe: YesCancel Safe: YesFork Safe: NoAsync-cancel Safe: NoAsync-signal Safe: No

These functions can be called safely in a multithreaded environment. They may be cancellation points inthat they call functions that are cancel points.

In a multithreaded environment, these functions are not safe to be called by a child process after fork()and before exec() . These functions should not be called by a multithreaded application that supportasynchronous cancellation or asynchronous signals.

DESCRIPTIONThe library routines described on this page are part of the Network Selection component. They providethe application access to the system network configuration database, /etc/netconfig . In addition tothe routines for accessing the netconfig database, Network Selection includes the environment vari-able NETPATH (see environ (5)) and the NETPATH access routines described in getnetpath (3N).

getnetconfig() returns a pointer to the current entry in the netconfig database, formatted as astruct netconfig . Successive calls will return successive netconfig entries in the netconfigdatabase. getnetconfig() can be used to search the entire netconfig file. getnetconfig()returns NULL at the end of the file. handlep is the handle obtained through setnetconfig() .

A call to setnetconfig() has the effect of ‘‘binding’’ to or ‘‘rewinding’’ the netconfig database.setnetconfig() must be called before the first call to getnetconfig() and may be called at anyother time. setnetconfig() need not be called before a call to getnetconfigent() .

setnetconfig() returns a unique handle to be used by getnetconfig() .

endnetconfig() should be called when processing is complete to release resources for reuse. handlepis the handle obtained through setnetconfig() . Programmers should be aware, however, that thelast call to endnetconfig() frees all memory allocated by getnetconfig() for the structnetconfig data structure. endnetconfig() may not be called before setnetconfig() .

getnetconfigent() returns a pointer to the struct netconfig structure corresponding to netid . Itreturns NULL if netid is invalid (that is, does not name an entry in the netconfig database).

freenetconfigent() frees the netconfig structure pointed to by netconfigp (previously returnedby getnetconfigent() ).

nc_perror() prints a message to the standard error indicating why any of the above routines failed.The message is prepended with the string msg and a colon. A NEWLINE is appended at the end of themessage.

nc_sperror() is similar to nc_perror() but instead of sending the message to the standard error,will return a pointer to a string that contains the error message.

nc_perror() and nc_sperror() can also be used with the NETPATH access routines defined ingetnetpath (3N).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−381

A gA

getnetconfig(3N) getnetconfig(3N)

RETURN VALUESsetnetconfig() returns a unique handle to be used by getnetconfig() . In the case of an error,setnetconfig() returns NULL and nc_perror() or nc_sperror() can be used to print the rea-son for failure.

getnetconfig() returns a pointer to the current entry in the netconfig() database, formatted asa struct netconfig . getnetconfig() returns NULL at the end of the file, or upon failure.

endnetconfig() returns 40 on success and -1 on failure, for example, if setnetconfig() was notcalled previously.

On success, getnetconfigent() returns a pointer to the struct netconfig structurecorresponding to netid ; otherwise it returns NULL.

nc_sperror() returns a pointer to a buffer which contains the error message string. This buffer isoverwritten on each call. In multithreaded applications, this buffer is implemented as thread-specificdata.

SEE ALSOgetnetpath(3N), netconfig(4), environ(5).

Section 3−−382 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getnetent(3N) getnetent(3N)

NAMEgetnetent(), getnetbyaddr(), getnetbyname(), setnetent(), endnetent() - get network entry

SYNOPSIS#include <sys/socket.h>#include <netdb.h>

struct netent *getnetent(void);

struct netent *getnetbyname(const char *name);

struct netent *getnetbyaddr(int net, int type);

_XOPEN_SOURCE_EXTENDED onlystruct netent *getnetbyaddr(in_addr_t net, int type);

int setnetent(int stayopen);

int endnetent(void);

_XOPEN_SOURCE_EXTENDED onlyvoid setnetent(int stayopen);void endnetent(void);

DESCRIPTIONgetnetent() , getnetbyname() , and getnetbyaddr() each return a pointer to a structure oftype netent containing the broken-out fields of a line in the network data base, /etc/networks .

The members of this structure are:

n_name The official name of the network.

n_aliases A null-terminated list of alternate names for the network.

n_addrtype The type of the network number returned; always AF_INET .

n_net The network number.

Functions behave as follows:

getnetent() Reads the next line of the file, opening the file if necessary.

setnetent() Opens and rewinds the file. If the stayopen flag is non-zero, the networkdata base is not closed after each call to getnetent() (either directly orindirectly through one of the other getnet* calls).

endnetent() Closes the file.

getnetbyname() Sequentially searches from the beginning of the file until a network name(among either the official names or the aliases) matching its parametername is found, or until EOF is encountered.

getnetbyaddr() Sequentially searches from the beginning of the file until a network numbermatching its parameter net is found, or until EOF is encountered. Theparameter net must be in network order. The parameter type must be theconstant AF_INET . Network numbers are supplied in host order (seebyteorder (3N)).

If the system is running Network Information Service (NFS), getnetbyname() and getnetbyaddr()obtain their network information from the NIS server (see ypserv (1M) and ypfiles (4)) or NIS+ server (seenis+ (1)) ,respectively.

In a multithreaded application, getnetent() , getentbyaddr() , and getentbyname() usethread-specific storage that is re-used in each call. The return value, struct netent , should be uniquefor each thread and should be saved, if desired, before the thread makes the next getnet*() call.

For enumeration in multithreaded applications, the position within the enumeration is a process-wideproperty shared by all threads. setnetent() may be used in a multithreaded application, but resetsthe enumeration position for all threads. If multiple threads interleave calls to getnetent() , thethreads will enumerate disjoint subsets of the network database.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−383

A gA

getnetent(3N) getnetent(3N)

Name Service Switch-Based OperationThe library routines getnetbyname() , getnetbyaddr() , and getnetent() internally call thename service switch to access the "networks" database lookup policy configured in the/etc/nsswitch.conf file (see nsswitch.conf(4)). The lookup policy defines the order and the criteriaof the supported name services used to resolve network names and addresses.

RETURN VALUEgetnetent() , getnetbyname() , and getnetbyaddr() return a null pointer (0) on EOF or whenthey are unable to open /etc/networks . getnetbyaddr() also returns a null pointer if its typeparameter is invalid.

EXAMPLEThe following code excerpt counts the number of network entries:

int count = 0;

(void) setnetent(0);while (netbuf=getnetent() != NULL)

count++;(void) endnetent();

OBSOLESCENT INTERFACESint getnetent_r(struct netent *result, struct netent_data *buffer);

int getnetbyname_r(const char *name,struct netent *result,struct netent_data *buffer);

int getnetbyaddr_r(int net,int type,struct netent *result,struct netent_data *buffer);

int setnetent_r(int stayopen, struct netent_data *buffer);

int endnetent_r(struct netent_data *buffer);

The above reentrant interfaces have been moved from libc to libd4r . They are included to supportexisting applications and may be removed in the future release. New multithreaded applications shouldnot use these APIs.

The reentrant interfaces function the same as the regular interfaces (those without the -r suffix.) How-ever, getnetent_r() , getnetbyname_r() , and getnetbyaddr_r() expect to be passed theaddress of a struct netent and will store the address of the result at the supplied parameter. An addi-tional parameter, the address of struct netent_data , which is defined in the file <netdb.h> , cannot be aNULL pointer.

getnetent_r() , getnetbyname_r() , getnetbyaddr_r() , setnetent_r() , andendnetent_t() return a −1 if the operation is unsuccessful. A 0 is returned otherwise.

WARNINGSPrograms that use the interfaces described in this manpage cannot be linked statically because the imple-mentations of these functions employ dynamic loading and linking of shared objects at run time.

AUTHORgetnetent() was developed by Sun Microsystems Inc.

FILES/etc/networks

SEE ALSOypserv(1M), networks(4), ypfiles(4), nsswitch.conf(4), nis+(1), thread_safety(5).

STANDARDS CONFORMANCEgetnetent() : XPG4

Section 3−−384 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getnetgrent(3C) getnetgrent(3C)

NAMEgetnetgrent(), setnetgrent(), endnetgrent(), innetgr() - get network group entry

SYNOPSISint innetgr(

char *netgroup,char *machine,char *user,char *domain

);

int setnetgrent(char *netgroup);

int endnetgrent();

int getnetgrent(char **machinep,char **userp,char **domainp

);

DESCRIPTIONThese functions are used to test membership in and enumerate members of "netgroup" network groupsdefined in a system database. Netgroups are sets of (machine,user,domain) triples (see netgroup (4)).

These functions consult the source specified for netgroup in the /etc/nsswitch.conf file (seensswitch.conf(4)).

The function innetgr() returns 1 if there is a netgroup netgroup that contains the specified machine ,user , domain triple as a member; otherwise it returns 0. Any of the supplied pointers machine , user , anddomain may be NULL, signifying a "wild card" that matches all values in that position of the triple.

The innetgr() function is safe for use in multithreaded applications.

The functions setnetgrent() , getnetgrent() , and endnetgrent() are used to enumerate themembers of a given network group.

The function setnetgrent() establishes the network group specified in the parameter netgroup as thecurrent group whose members are to be enumerated.

Successive calls to the function getnetgrent() will enumerate the members of the group establishedby calling setnetgrent() ; each call returns 1 if it succeeds in obtaining another member of the net-work group, or 0 if there are no further members of the group.

When calling getnetgrent() addresses of the three character pointers are used as arguments; i.e.:

char * mp, * up , * dp;

getnetgrent(& mp, & up , & dp);

Upon successful return from getnetgrent() , the pointer mp points to a thread specific storage areacontaining the name of the machine part of the member triple, up points to a thread specific storage areacontaining the user name and dp points to a thread specific storage area containing the domain name. Ifthe pointer returned for mp , up , or dp is NULL, it signifies that the element of the netgroup contains wildcard specifier in that position of the triple.

The storage allocated by setnetgrent() is released when an endnetgrent() call is made, andshould not be released by the caller.

The function endnetgrent() frees the space allocated by the previous setnetgrent() call. Theequivalent of an endnetgrent() implicitly performed whenever a setnetgrent() call is made to anew network group.

Note that while setnetgrent() and endnetgrent() are safe for use in multithreaded applications,the effect of each is process-wide. Calling setnetgrent() resets the enumeration position for allthreads. If multiple threads interleave calls to getnetgrent_r() each will enumerate a disjoint sub-set of the netgroup. Thus the effective use of these functions in multithreaded applications may requirecoordination by the caller.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−385

A gA

getnetgrent(3C) getnetgrent(3C)

MULTITHREAD USAGEThread Safe: YesCancel Safe: YesFork Safe: NoAsync-cancel Safe: NoAsync-signal Safe: No

These functions can be called safely in a multithreaded environment. They may be cancellation points inthat they call functions that are cancel points.

In a multithreaded environment, these functions are not safe to be called by a child process after fork()and before exec() . These functions should not be called by a multithreaded application that supportasynchronous cancellation or asynchronous signals.

WARNINGSPrograms that use the interfaces described in this manpage cannot be linked statically since the imple-mentations of these functions employ dynamic loading and linking of shared objects at run time.

FILES/etc/netgroup/etc/nsswitch.conf

SEE ALSOnetgroup(4), nsswitch.conf(4).

Section 3−−386 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getnetpath(3N) getnetpath(3N)

NAMEgetnetpath(), setnetpath(), endnetpath() - get /etc/netconfig entry corresponding to NETPATH component

SYNOPSIS#include <netconfig.h>

struct netconfig *getnetpath(void *handlep );

void *setnetpath(void);

int endnetpath(void *handlep );

MULTITHREAD USAGEThread Safe: YesCancel Safe: YesFork Safe: NoAsync-cancel Safe: NoAsync-signal Safe: No

These functions can be called safely in a multithreaded environment. They may be cancellation points inthat they call functions that are cancel points.

In a multithreaded environment, these functions are not safe to be called by a child process after fork()and before exec() . These functions should not be called by a multithreaded application that supportsasynchronous cancellation or asynchronous signals.

DESCRIPTIONThe routines described on this page are part of the Network Selection component. They provide theapplication access to the system network configuration database, /etc/netconfig , as it is ‘‘filtered’’ bythe NETPATH environment variable (see environ (5)). See getnetconfig(3N) for other routines that alsoaccess the network configuration database directly. The NETPATH variable is a list of colon-separatednetwork identifiers.

getnetpath() returns a pointer to the netconfig database entry corresponding to the first validNETPATH component. The netconfig entry is formatted as a struct netconfig. On each subsequentcall, getnetpath() returns a pointer to the netconfig entry that corresponds to the next validNETPATH component. getnetpath() can thus be used to search the netconfig database for allnetworks included in the NETPATH variable. When NETPATH has been exhausted, getnetpath()returns NULL.

A call to setnetpath() ‘‘binds’’ to or ‘‘rewinds’’ NETPATH must be called before the first call to get-netpath() and may be called at any other time. It returns a handle that is used by getnetpath() .

getnetpath() silently ignores invalid NETPATH components. A NETPATH component is invalid ifthere is no corresponding entry in the netconfig database.

If the NETPATH variable is unset , getnetpath() behaves as if NETPATH were set to the sequence of‘‘default’’ or ‘‘visible’’ networks in the netconfig database, in the order in which they are listed.

endnetpath() may be called to ‘‘unbind’’ from NETPATH when processing is complete, releasingresources for reuse. Programmers should be aware, however, that endnetpath() frees all memoryallocated by getnetpath() for the struct netconfig data structure. endnetpath() returns 40on success and -1 on failure, for example, if setnetpath() was not called previously.

RETURN VALUESsetnetpath() returns a handle that is used by getnetpath() . In case of an error, setnet-path() returns NULL. nc_perror() or nc_sperror() can be used to print out the reason forfailure. See getnetconfig(3N).

When first called, getnetpath() returns a pointer to the netconfig database entry corresponding tothe first valid NETPATH component. When NETPATH has been exhausted, getnetpath() returnsNULL.

endnetpath() returns 40 on success and -1 on failure, for example, if setnetpath() was not calledpreviously.

SEE ALSOgetnetconfig(3N), netconfig(4), environ(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−387

A gA

getnstr(3X) getnstr(3X)(ENHANCED CURSES)

NAMEgetnstr, mvgetnstr, mvwgetnstr, wgetnstr, — get a multi-byte character length limited string from theterminal

SYNOPSIS#include <curses.h>

int getnstr(char * str, int n);

int mvgetnstr(int y, int x, char * str, int n);

int mvwgetnstr(WINDOW * win, int y, int x, char * str, int n);

int wgetnstr(WINDOW * win, char * str, int n);

DESCRIPTIONThe effect of getnstr() and wgetnstr() is as though a series of calls to getch() were made, until anewline or carriage return is received. The resulting value is placed in the area pointed to by str. Thegetnstr() and wgetnstr() functions read at most n bytes, thus preventing a possible overflow of theinput buffer. The user’s erase and kill characters are interpreted, as well as any special keys (such asfunction keys, home key, clear key, and so on).

The mvgetnstr() function is identical to getnstr() except that it is as though it is a call to move()and then a series of calls to getch() . The mvwgetnstr() function is identical to getnstr() exceptit is as though a call to wmove() is made and then a series of calls to wgetch() .

The getnstr() , wgetnstr() , mvgetnstr() and mvwgetnstr() functions will only return theentire multi-byte sequence associated with a character. If the array is large enough to contain at leastone character, the functions fill the array with complete characters. If the array is not large enough tocontain any complete characters, the function fails.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGETraditional implementations often limited the number of bytes returned to 256.

SEE ALSObeep(3X), getch(3X), curses_intro(3X), see Input Processing, <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−388 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getn_wstr(3X) getn_wstr(3X)(ENHANCED CURSES)

NAMEgetn_wstr, get_wstr, mvgetn_wstr, mvget_wstr, mvwgetn_wstr, mvwget_wstr, wgetn_wstr, wget_wstr —get an array of wide characters and function key codes from a terminal

SYNOPSIS#include <curses.h>

int getn_wstr(wchar_t * wstr, int n);

int get_wstr(wchar_t * wstr);

int mvgetn_wstr(int y, int x, wchar_t * wstr, int n);

int mvget_wstr(int y, int x, wchar_t * wstr);

int mvwgetn_wstr(WINDOW * win, int y, int x, wchar_t * wstr, int n);

int mvwget_wstr(WINDOW * win, int y, int x, wchar_t * wstr);

int wgetn_wstr(WINDOW * win, wchar_t * wstr, int n);

int wget_wstr(WINDOW * win, wchar_t * wstr);

DESCRIPTIONThe effect of get_wstr() is as though a series of calls to get_wch() were made, until a newline char-acter, end-of-line character, or end-of-file character is processed. An end-of-file character is representedby WEOF, as defined in <wchar.h> . A newline or end-of-line is represented as its wchar_t value. Inall instances, the end of the string is terminated by a null wchar_t . The resulting values are placed inthe area pointed to by wstr.

The user’s erase and kill characters are interpreted and affect the sequence of characters returned.

The effect of wget_wstr() is as though a series of calls to wget_wch() were made.

The effect of mvget_wstr() is as though a call to move() and then a series of calls to get_wch()were made. The effect of mvwget_wstr() is as though a call to wmove() and then a series of calls towget_wch() were made. The effect of mvget_nwstr() is as though a call to move() and then aseries of calls to get_wch() were made. The effect of mvwget_nwstr() is as though a call towmove() and then a series of calls to wget_wch() were made.

The getn_wstr() , mvgetn_wstr() , mvwgetn_wstr() and wgetn_wstr() functions read atmost n characters, letting the application prevent overflow of the input buffer.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEReading a line that overflows the array pointed to by wstr with get_wstr() , mvget_wstr() ,mvwget_wstr() or wget_wstr() causes undefined results. The use of getn_wstr() ,mvgetn_wstr() , mvwgetn_wstr() or wgetn_wstr() , respectively, is recommended.

These functions cannot return KEY_ values as there is no way to distinguish a KEY_ value from a validwchar_t value.

SEE ALSOget_wch(3X), getstr(3X), <curses.h>, <wchar.h> (in the X/Open System Interfaces and Headers, Issue 4,Version 2 specification), X/Open System Interface Definitions, Issue 4, Version 2 specification, Chapter 9,General Terminal Interface .

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−389

A gA

getopt(3C) getopt(3C)

NAMEgetopt( ), optarg, optind, opterr - get option letter from argument vector

SYNOPSIS#include <unistd.h>

int getopt(int argc, char * const argv[], const char *optstring);

extern char *optarg;

extern int optind, opterr, optopt;

DESCRIPTIONgetopt() returns the next option letter in argv (starting from argv [ 1 ]) that matches a letter in opt-string . argc and argv are the argument count and argument array as passed to main() . optstring is astring of recognized option characters; if a character is followed by a colon, the option takes an argumentwhich may or may not be separated from it by white space.

optind is the index of the next element of the argv [ ] vector to be processed. It is initialized to 1 by thesystem, and getopt() updates it when it finishes with each element of argv [].

getopt() returns the next option character from argv that matches a character in optstring , if there isone that matches. If the option takes an argument, getopt() sets the variable optarg to point to theoption-argument as follows:

• If the option was the last character in the string pointed to by an element of argv , then optargcontains the next element of argv , and optind is incremented by 2. If the resulting value ofoptind is greater than or equal to argc , this indicates a missing option argument, andgetopt() returns an error indication.

• Otherwise, optarg points to the string following the option character in that element of argv ,and optind is incremented by 1.

If, when getopt() is called, argv [ optind ] is NULL, or the string pointed to by argv [ optind ] either doesnot begin with the character - or consists only of the character - , getopt() returns −1 without chang-ing optind . If argv [ optind ] points to the string - - , getopt() returns −1 after incrementing optind .

If getopt() encounters an option character that is not contained in optstring , it returns the question-mark (?) character. If it detects a missing option argument, it returns the colon character (: ) if the firstcharacter of optstring was a colon, or a question-mark character otherwise. In either case, getopt()sets the variable optopt to the option character that caused the error. If the application has not set thevariable opterr to zero and the first character of optstring is not a colon, getopt() also prints adiagnostic message to standard error.

The special option - - can be used to delimit the end of the options; −1 is returned, and - - is skipped.

RETURN VALUEgetopt() returns the next option character specified on the command line. A colon (: ) is returned ifgetopt() detects a missing argument and the first character of optstring was a colon (: ).

A question-mark (?) is returned if getopt() encounters an option character not in optstring or detectsa missing argument and the first character of optstring was not a colon (: ).

Otherwise, getopt() returns −1 when all command line options have been parsed.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the interpretation of option letters as single and/or multi-byte char-acters.

International Code Set SupportSingle- and multibyte character code sets are supported.

ERRORSgetopt() fails under the following conditions:

[EILSEQ] An invalid multibyte character sequence was encountered during option processing.

Section 3−−390 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getopt(3C) getopt(3C)

EXAMPLESThe following code fragment shows to process arguments for a command that can take the mutuallyexclusive options a and b, and the options f and o, both of which require arguments:

#include <stdio.h>#include <unistd.h>main (int argc, char *argv[]){

int c;int bflg, aflg, errflg;extern char *optarg;extern int optind, optopt;...while ((c = getopt(argc, argv, ":abf:o:")) != -1)

switch (c) {case ’a’:

if (bflg)errflg++;

elseaflg++;

break;case ’b’:

if (aflg)errflg++;

else {bflg++;bproc( );

}break;

case ’f’:ifile = optarg;break;

case ’o’:ofile = optarg;break;

case ’:’: /* -f or -o without arguments */fprintf(stderr, "Option -%c requires an argument\n",

optopt);errflg++;break;

case ’?’:fprintf(stderr, "Unrecognized option: - %c\n",

optopt);errflg++;

}if (errflg) {

fprintf(stderr, "usage : . . . ");exit (2);

}for ( ; optind < argc; optind++) {

if (access(argv[optind], 4)) {...

}

WARNINGSOptions can be any ASCII characters except colon (: ), question mark (?), or null (\0 ).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−391

A gA

getopt(3C) getopt(3C)

SEE ALSOgetopt(1), thread_safety(5).

STANDARDS CONFORMANCEgetopt() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

optarg : AES, SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

opterr : AES, SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

optind : AES, SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

optopt : AES, SVID3, XPG4, POSIX.2

Section 3−−392 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

getpass(3C) getpass(3C)(TO BE OBSOLETED)

NAMEgetpass( ) - read a password

SYNOPSIS#include <unistd.h>

char *getpass(const char *prompt);

DESCRIPTIONgetpass() reads up to a newline or EOF from the file /dev/tty , after prompting on the standarderror output with the null-terminated string prompt and disabling echoing. A pointer is returned to anull-terminated string of at most 8 characters. If /dev/tty cannot be opened, a NULL pointer isreturned. An interrupt terminates input and sends an interrupt signal to the calling program beforereturning.

WARNINGSThe return value points to static data whose content is overwritten by each call.

Obsolescent Interfacesgetpass() is to be obsoleted at a future date.

FILES/dev/tty

SEE ALSOcrypt(3C), thread_safety(5).

STANDARDS CONFORMANCEgetpass() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−393

A gA

getprdfent(3) getprdfent(3)

NAMEgetprdfent, getprdfnam, setprdfent, endprdfent, putprdfnam - manipulate system default database entryfor a trusted system

SYNOPSIS#include <sys/types.h>#include <hpsecurity.h>#include <prot.h>

struct pr_default *getprdfent(void);

struct pr_default *getprdfnam(const char *name);

void setprdfent(void);

void endprdfent(void);

int putprdfnam(const char *name, struct pr_default *pr);

DESCRIPTIONgetprdfent and getprdfnam each returns a pointer to an object with the following structure contain-ing the broken-out fields of a line in the system default database. Each line in the database contains apr_default structure, declared in the <prot.h> header file:

struct system_default_fields {time_t fd_inactivity_timeout ;char fd_boot_authenticate ;

} ;

struct system_default_flags {unsigned short

fg_inactivity_timeout:1,fg_boot_authenticate:1,

} ;struct pr_default {

char dd_name[20] ;char dg_name ;struct pr_field prd ;struct pr_flag prg ;struct t_field tcd ;struct t_flag tcg ;struct dev_field devd ;struct dev_flag devg ;struct system_default_fields sfld ;struct system_default_flags sflg ;

} ;

Currently there is only one entry in the system default database referenced by name default .

The System Default database contains default values for all parameters in the Protected Password, Ter-minal Control, and Device Assignment databases, as well as configurable system-wide parameters. Thefields from the other databases are described in the corresponding manual entries. fd_inactivity_timeoutis the number of seconds until a session is terminated on trusted systems.

fd_boot_authenticate is a Boolean flag that indicates whether an authorized user must authenticatebefore the system begins operation.

getprdfent returns a pointer to the first pr_default structure in the database when first called.Thereafter, it returns a pointer to the next pr_default structure in the database so that successive callscan be used to search the database (only one entry is supported).

getprdfnam searches from the beginning of the file until a default entry matching name is found, andreturns a pointer to the particular structure in which it was found. If an end-of-file or an error is encoun-tered on reading, these functions return a NULLpointer. Currently, all programs access the default data-base by calling getprdfnam (the entry name is default ).

Section 3−−394 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getprdfent(3) getprdfent(3)

A call to setprdfent has the effect of rewinding the default control file to allow repeated searches.endprdfent can be called to close the database when processing is complete.

putprdfnam puts a new or replaced default control entry pr with key name into the database. If theprg.fd_name field is 0, the requested entry is deleted from the system default database. putprdfnamlocks the database for all update operations and performs an endprdfent after the update or failedattempt.

APPLICATION USAGEIn a multithreaded application, these routines are safe to be called only from one dedicated thread.These routines are not POSIX.1c async-cancel safe nor async-signal safe.

RETURN VALUEgetprdfent and getprdfnam return NULL pointers on EOFor error. putprdfnam returns 0 if itcannot add or update the entry.

WARNINGSDo not delete the system default entry.

NOTESThe value returned by getprdfent and getprdfnam refers to a structure that is overwritten by callsto these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry usingstructure assignment and supply the modified buffer to putprdfnam .

Programs using these routines must be compiled with -lsec .

FILES/tcb/files/auth/system/default System Defaults database

SEE ALSOauthcap(4), default(4), getprpwent(3), getprtcent(3), getdvagent(3).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−395

A gA

getprotoent(3N) getprotoent(3N)

NAMEgetprotoent(), getprotobynumber(), getprotobyname(), setprotoent(), endprotoent() - get protocol entry

SYNOPSIS#include <netdb.h>

struct protoent *getprotoent(void);

struct protoent *getprotobyname(const char *name);

struct protoent *getprotobynumber(int proto);

int setprotoent(int stayopen);

int endprotoent(void);

_XOPEN_SOURCE_EXTENDED onlyvoid setprotoent(int stayopen);void endprotoent(void);

DESCRIPTIONThe getprotoent() , getprotobyname() , and getprotobynumber() functions each return apointer to a structure of type protoent containing the broken-out fields of a line in the network protocoldata base, /etc/protocols .

The members of this structure are:

p_name The official name of the protocol.

p_aliases A null-terminated list of alternate names for the protocol.

p_proto The protocol number.

Functions behave as follows:

getprotoent() Reads the next line of the file, opening the file if necessary.

setprotoent() Opens and rewinds the file. If the stayopen flag is non-zero, theprotocol data base is not closed after each call to getprotoent()(either directly or indirectly through one of the other getproto*calls).

endprotoent() Closes the file.

getprotobyname() ,getprotobynumber() Each sequentially searches from the beginning of the file until a

matching protocol name (among either the official names or thealiases) or protocol number is found, or until EOF is encountered.

In a multithreaded application, getprotoent() , getprotobyaddr() , and getprotobyname()use thread-specific storage that is re-used in each call. The return value struct protoent should beunique for each thread and should be saved, if desired, before the thread makes the next getproto*()call.

For enumeration in multithreaded applications, the position within the enumeration is a process-wideproperty shared by all threads. setprotoent() may be used in a multithreaded application, butresets the enumeration position for all threads. getprotoent() enumerates protocol entries: succes-sive calls to getprotoent() will return either successive protocol entries or NULL. If multiple threadsinterleave calls to getprotoent() , the threads will enumerate disjoint subsets of the protocol data-base.

If the system is running the Network Information Service (NIS) services or Network Information ServicePlus (NIS+) services, getprotobyname() and getprotobynumber() get the protocol informationfrom the NIS server (see ypserv (1M) and ypfiles (4)) or NIS+ server (see nis+ (1)), respectively.

Name Service Switch-Based OperationThe library routines getprotobyname() , getprotobynumber() , getprotoent() , and theirreentrant counterparts, internally call the name service switch to access the "protocols" database lookuppolicy configured in the /etc/nsswitch.conf file (see nsswitch.conf(4)). The lookup policy definesthe order and the criteria of the supported name services used to resolve protocol names and numbers.

Section 3−−396 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getprotoent(3N) getprotoent(3N)

RETURN VALUEgetprotoent() , getprotobyname() , and getprotobynumber() return a null pointer (0) onEOF or when they are unable to open /etc/protocols .

OBSOLESCENT INTERFACESint getprotoent_r(struct protoent *result,

struct protoent_data *buffer);

int getprotobyname_r(const char *name,struct protoent *result,struct protoent_data *buffer);

int getprotobynumber_r(int proto,struct protoent *result,struct protoent_data *buffer);

int setprotoent_r(int stayopen, struct protoent_data *buffer);

int endprotoent_r(struct protoent_data *buffer);

The above reentrant interfaces have been moved from libc to libd4r . They are included to supportexisting applications and may be removed in a future release. New multithreaded applications shoulduse the regular APIs without _r .

The reentrant interfaces performs the same operation as their regular counterpart (those without the _rsuffix.) However, getprotoent_r() , getprotobyname_r() , and getprotobyport_r() expectto be passed the address of a struct protoent parameter and will store the address of the result atthis supplied parameter. An additional parameter, an address to struct protoent_data , which is definedin the file <netdb.h> cannot be a NULL pointer.

The reentrant routines return -1 if the operation is unsuccessful, or, in the case of getprotoent_r() ,if the end of the services list has been reached. 0 is returned otherwise.

EXAMPLESThe following code excerpt counts the number of protocols entries:

int count = 0;

(void) setprotoent(0);while (getprotoent() != NULL)

count++;(void) endprotoent();

WARNINGSPrograms that use the interfaces described in this manpage cannot be linked statically because the imple-mentations of these functions employ dynamic loading and linking of shared objects at run time.

AUTHORgetprotoent() was developed by Sun Microsystems Inc.

FILES/etc/protocols

SEE ALSOypserv(1M), protocols(4), nis+(1), nsswitch.conf(4), ypfiles(4), thread_safety(5).

STANDARDS CONFORMANCEgetprotoent() : XPG4

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−397

A gA

getprpwent(3) getprpwent(3)

NAMEgetprpwent, getprpwuid, getprpwnam, getprpwaid, setprpwent, endprpwent, putprpwnam - manipulateprotected password database entries (for trusted systems only).

SYNOPSIS#include <sys/types.h>#include <hpsecurity.h>#include <prot.h>

struct pr_passwd *getprpwent(void);

struct pr_passwd *getprpwuid(uid_t uid);

struct pr_passwd *getprpwnam(const char *name);

struct pr_passwd *getprpwaid(aid_t aid)

void setprpwent(void);

void endprpwent(void);

int putprpwnam(const char *name, struct pr_passwd *pr);

DESCRIPTIONgetprpwent , getprpwuid , getprpwaid , and getprpwnam each returns a pointer to a pr_passwdstructure containing the broken-out fields of a line in the protected password database. Each line in thedatabase contains a pr_passwd structure, declared in the <prot.h > header file:

struct pr_field {/* Identity: */char fd_name[9]; /* uses 8 character maximum(and NULL) from utmp */uid_t fd_uid; /* uid associated with name above */char fd_encrypt[xxx]; /* encrypted password */char fd_owner[9]; /* if a pseudo-user, the user accountable */char fd_boot_auth; /* boot authorization */mask_t fd_auditcntl; /* reserved */mask_t audit_reserve1; /* reserved */mask_t fd_auditdisp; /* reserved */mask_t audit_reserve2; /* reserved */aid_t fd_pw_audid; /* audit ID */int fd_pw_audflg; /* audit flag */

/* Password maintenance parameters: */time_t fd_min; /* minimum time between password changes */int fd_maxlen; /* maximum length of password */time_t fd_expire; /* expiration time duration in secs */time_t fd_lifetime; /* account death duration in seconds */time_t fd_schange; /* last successful change in secs past 1/1/70 */time_t fd_uchange; /* last unsuccessful change */time_t fd_acct_expire; /* absolute account lifetime in seconds */time_t fd_max_llogin; /* max time allowed between logins */time_t fd_pw_expire_warning; /* password expiration warning */uid_t fd_pswduser; /* who can change this user’s password */char fd_pick_pwd; /* can user pick his own passwords? */char fd_gen_pwd; /* can user get passwords generated for him? */char fd_restrict; /* should generated passwords be restricted? */char fd_nullpw; /* is user allowed to have a NULL password? */uid_t fd_pwchanger; /* who last changed user’s password */long fd_pw_admin_num; /* password generation verifier */char fd_gen_chars; /* can have password of random ASCII? */char fd_gen_letters; /* can have password of random letters? */char fd_tod[AUTH_TOD_SIZE]; /* times when user may login */

/* Login parameters: */time_t fd_slogin; /* last successful login */time_t fd_ulogin; /* last unsuccessful login */char fd_suctty[14]; /* tty of last successful login */

Section 3−−398 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getprpwent(3) getprpwent(3)

int fd_nlogins; /* consecutive unsuccessful logins */char fd_unsuctty[14]; /* tty of last unsuccessful login */int fd_max_tries; /* maximum unsuc login tries allowed */char fd_lock; /* Unconditionally lock account? */

};

struct pr_flag {unsigned short

/* Identity: */fg_name:1, /* Is fd_name set? */fg_uid:1, /* Is fd_uid set? */fg_encrypt:1, /* Is fd_encrypt set? */fg_owner:1, /* Is fd_owner set? */fg_boot_auth:1, /* Is fd_boot_auth set? */fg_pw_audid:1, /* Is fd_auditcntl set? */fg_pw_audflg:1, /* Is fd_auditdisp set? */

/* Password maintenance parameters: */fg_min:1, /* Is fd_min set? */fg_maxlen:1, /* Is fd_maxlen set? */fg_expire:1, /* Is fd_expire set? */fg_lifetime:1, /* Is fd_lifetime set? */fg_schange:1, /* Is fd_schange set? */fg_uchange:1, /* Is fd_fchange set? */fg_acct_expire:1, /* Is fd_acct_expire set? */fg_max_llogin:1, /* Is fd_max_llogin set? */fg_pw_expire_warning:1, /* Is fd_pw_expire_warning set? */fg_pswduser:1, /* Is fd_pswduser set? */fg_pick_pwd:1, /* Is fd_pick_pwd set? */fg_gen_pwd:1, /* Is fd_gen_pwd set? */fg_restrict:1, /* Is fd_restrict set? */fg_nullpw:1, /* Is fd_nullpw set? */fg_pwchanger:1, /* Is fd_pwchanger set? */fg_pw_admin_num:1, /* Is fd_pw_admin_num set? */fg_gen_chars:1, /* Is fd_gen_chars set? */fg_gen_letters:1, /* Is fd_gen_letters set? */fg_tod:1, /* Is fd_tod set? */

/* Login parameters: */fg_slogin:1, /* Is fd_slogin set? */fg_suctty: 1, /* is fd_suctty set ? */fg_unsuctty: 1, /* is fd_unsuctty set ? */fg_ulogin:1, /* Is fd_ulogin set? */fg_nlogins:1, /* Is fd_nlogins set? */fg_max_tries:1, /* Is fd_max_tries set? */fg_lock:1; /* Is fd_lock set? */

};

struct pr_passwd {struct pr_field ufld; /* user specific fields */struct pr_flag uflg; /* user specific flags */struct pr_field sfld; /* system wide fields */struct pr_flag sflg; /* system wide flags */

};

The protected password database stores user authentication profiles. The pr_passwd structure in theuser-specific entry refers to parameters specific to a user. The pr_passwd structure in the system defaultdatabase sets parameters that are used when there is no user-specific override.

The user-specific entry is keyed on the fd_name field, which is a cross reference to the /etc/passwd orthe Network Information Service Plus (NIS+) passwd table entry for the user. The fd_uid field mustmatch the UID in that file or the NIS+ passwd table as well. The fd_encrypt field is the encrypted pass-word. The password is encrypted in eight character segments, so the size of this field is a multiple of thenumber of characters in an encrypted segment (AUTH_CIPHERTEXT_SIZEmacro).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−399

A gA

getprpwent(3) getprpwent(3)

fd_owner is the user name accountable for the account. The fd_boot_auth field is used when the systemdefault file specifies boot authorization is required. init (1M) prompts for a user name and password. Ifthe authentication succeeds, a value in this field allows the user to continue the system boot process.

fd_min is the time, in seconds, that must elapse before the user can change passwords. fd_maxlen is themaximum password length (in characters) for the user. fd_expire is the time, in seconds, until the user’spassword expires. fd_lifetime is the number of seconds that must elapse before the password dies. Theaccount is considered locked if the password is dead.

fd_schange and fd_uchange record the last successful and unsuccessful password change times.

The fd_acct_expire field specifies the absolute period of time in seconds that the account can be used. Anabsolute expiration date may be specified, which is then converted into seconds stored in this field. Thisis different from fd_expire in that fd_acct_expire specifies an absolute expiration date, while fd_expire isreset with each password change.

fd_max_llogin specifies the maximum time in seconds allowed since the last login before the accountbecomes locked. fd_pw_expire_warning is the time in seconds before the end of fd_expire that the systemwarns the user the password is about to expire. fd_pswduser stores the user ID of the user allowed tochange passwords for the account. Typically, this is the account owner.

The next flag fields control password generation. fd_pick_pwd , if set, allows the user to pick his or herown password. fd_nullpw , if set, allows the account to be used without a password. fd_gen_pwd enablesthe use of the random pronounceable password generator for passwords for this account. fd_gen_charsand fd_gen_letters allow the password generator to generate passwords composed of random printablecharacters and random letters, neither of which is easy to remember. The password change softwareallows the user to pick from whichever options are available for his or her account. One of these threefields (fd_gen_pwd , fd_gen_chars , or fd_gen_letters) must be set.

fd_pwchanger is the user ID of the user who last changed the password on the user’s account, if it was notthe account owner. fd_restrict , if set, causes triviality checks to be made after the account password hasbeen chosen to avoid palindromes, user name and machine name permutations, and words appearing inthe dictionary.

The fd_tod specifier is a string, formatted like the UUCP Systems file, which specifies time intervals dur-ing which the user can log in.

The next fields are used to protect against login spoofing, listing the time and location of last login.fd_slogin and fd_ulogin are time stamps of the last successful and unsuccessful login attempts. fd_sucttyand fd_unsuctty are the terminal device or (if supported) host names of the terminal or host from whichthe last login attempt occurred.

fd_nlogins is the number of unsuccessful login attempts since the last successful login. It is reset to zeroafter a successful login. fd_max_tries is the number of unsuccessful attempts until the account is con-sidered locked.

fd_lock indicates whether the administrative lock on the account is set. Note that an account may be con-sidered disabled (locked) for reasons not indicated by fd_lock . The account is considered disabled(locked) if one or more of these activities has occurred:

1. if the password is dead,2. if the maximum number of unsuccessful attempts has been exceeded,3. if the administrative lock is set,4. if the account expiration is reached, or5. if the time since last login is exceeded.

When getprpwent is first called, it returns a pointer to the first user pr_passwd structure in the data-base; thereafter, it returns a pointer to the next pr_passwd structure in the database so that successivecalls can be used to search the database. Note that entries without a corresponding entry in/etc/passwd are skipped. However, if NIS+ is configured, the entries are not skipped for users thathave an entry in the NIS+ passwd table and the local protected database. A local protected databaseentry is created at login time for each NIS+ user that does not have an entry in the local protected data-base. The entries are scanned in the order they appear in /etc/passwd or in the NIS+ passwd tableif NIS+ is configured and if the nsswitch.conf file refers to NIS+ first (for example, an entry innsswitch.conf would contain passwd: nisplus files ).

getprpwuid searches from the beginning of the database until a numerical user ID matching uid isfound and returns a pointer to the particular structure in which it was found. getprpwaid functionslike getprpwuid only it uses the audit ID instead of the UID.

Section 3−−400 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

getprpwent(3) getprpwent(3)

getprpwnam searches from the beginning of the database until a login name matching name is found,and returns a pointer to the particular structure in which it was found. If an end-of-file or an error isencountered on reading, these functions return a NULL pointer.

A call to setprpwent has the effect of rewinding the protected password database to allow repeatedsearches. endprpwent can be called to close the protected password database when processing is com-plete.

putprpwnam puts a new or replaces a protected password entry pr with key name into the database. Ifthe uflg.fg_name field is 0, the requested entry is deleted from the protected password database.putprpwnam locks the database for all update operations, and performs a endprpwent after theupdate or failed attempt. For NIS+, this function will add or remove protected password informationfrom the passwd table and/or trusted table and/or the local protected database.

NOTESThe value returned by getprpwent and getprpwnam refers to a structure that is overwritten by callsto these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry usingstructure assignment and supply the modified buffer to putprpwnam .

On systems supporting network connections, the fd_suctty and fd_unsuctty fields can be the ASCIIrepresentation of the network address of the host from which the last successful or unsuccessful remotelogin to the account occurred. Use getdvagnam (see getdvagent (3)) to investigate the type of device todetermine whether a host or a terminal was used for the last successful or unsuccessful login.

Programs using these routines must be compiled with -lsec .

If you link your application with the archive version of libsec (libsec.a ), these routines workindependent of NIS+ or the Name Service Switch. The protected password database exists only in thelocal system; for example, /tcb only and not the NIS+ passwd or trusted table.

getprpwent assumes one name per UID and one UID per name. The sequential scan loops betweenthe first two instances of a multiple UID.

getprpwent uses getpwent (3C) routines to sequentially scan databases. User program references topassword entries obtained using getpwent (3C) routines will not be valid after using any routinesdescribed here (that is, the * prp * routines).

If NIS+ is configured in your system, the protected password information can be stored in three differentrepositories:

1. The NIS+ passwd Table for the local domain.

2. The NIS+ Trusted Table for the local domain.

3. The Local Protected Database file.

Additionally, all of these routines depend on the configuration of the Name Service Switch file,/etc/nsswitch.conf . These routines use the switch for the passwd database.

APPLICATION USAGEIn a multithreaded application, these routines are safe to be called only from one dedicated thread.These routines are not POSIX.1c async-cancel safe nor async-signal safe. In an NIS+ namespace, theuser should be aware of the configuration of the /etc/nsswitch.conf file because protected pass-word information is stored in three different repositories: passwd table, trusted table, and local data-base. The Name Service Switch database used for the protected database API is passwd (for example,an entry in /etc/nsswitch.conf would contain passwd: nisplus files ).

RETURN VALUEgetprpwent , getprpwuid , getprpwaid , and getprpwnam return NULL pointers on EOF or error.putprpwnam returns 0 if it cannot add or update the entry.

FILES/etc/passwd System Password file/tcb/files/auth/*/* Protected Password database/tcb/files/auth/system/default System Defaults database

NIS+ TABLESpasswd, trusted

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−401

A gA

getprpwent(3) getprpwent(3)

SEE ALSOauthcap(4), getpwent(3C), getprdfent(3), prpwd(4), ttsyncd(1M), nis+(1).

Section 3−−402 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: August 2003

A gA

getprtcent(3) getprtcent(3)

NAMEgetprtcent, getprtcnam, setprtcent, endprtcent, putprtcnam - manipulate terminal control database entryfor a trusted system

SYNOPSIS#include <sys/types.h>#include <hpsecurity.h>#include <prot.h>

struct pr_term ∗getprtcent(void);

struct pr_term ∗getprtcnam(const char ∗name);

void setprtcent(void);

void endprtcent(void);

int putprtcnam(const char ∗name, struct pr_term ∗pr);

DESCRIPTIONgetprtcent and getprtcnam each returns a pointer to an object with the following structure contain-ing the broken-out fields of an entry in the terminal control database. Each entry in the database con-tains a pr_term structure, declared in the <prot.h> header file:

struct t_field {char fd_devname[14]; /* Terminal (or host) name */uid_t fd_uid; /* uid of last successful login */time_t fd_slogin; /* time stamp of successful login */uid_t fd_uuid; /* uid of last unsuccessful login */time_t fd_ulogin; /* time stamp of unsuccessful login */int fd_nlogins; /* consecutive failed attempts */int fd_max_tries; /* maximum unsuc login tries allowed */time_t fd_logdelay; /* delay between login tries */char fd_lock; /* terminal locked? */int fd_login_timeout; /* login timeout in seconds */

};

struct t_flag {unsigned short

fg_devname:1, /* Is fd_devname set? */fg_uid:1, /* Is fd_uid set? */fg_slogin:1, /* Is fd_stime set? */fg_uuid:1, /* Is fd_uuid set? */fg_ulogin:1, /* Is fd_ftime set? */fg_nlogins:1, /* Is fd_nlogins set? */fg_max_tries:1, /* Is fd_max_tries set? */fg_logdelay:1, /* Is fd_logdelay set? */fg_lock:1, /* Is fd_lock set? */fg_login_timeout:1 /* is fd_login_timeout valid? */;

};

struct pr_term {struct t_field ufld;struct t_flag uflg;struct t_field sfld;struct t_flag sflg;

};

The system stores the user ID and time of the last successful login ( fd_uid and fd_slogin ) and unsuccess-ful login ( fd_uuid and fd_ulogin ) in the appropriate Terminal Control database entry. The system incre-ments fd_nlogins with each unsuccessful login, and resets the field to 0 on a successful login. Thefd_max_tries field is a limit on the number of unsuccessful logins until the account is locked. An adminis-trative lock can also be applied, indicated by a non-zero fd_lock field. fd_logdelay stores the amount oftime (in seconds) that the system waits between unsuccessful login attempts, and fd_login_timeout storesthe number of seconds from the beginning of an authentication attempt until the login attempt is ter-minated.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−403

A gA

getprtcent(3) getprtcent(3)

Note that ufld and uflg refer to user-specific entries, and sfld and sflg refer to the system default values(see authcap (4)).

The value returned by getprtcent or getprtcnam refers to a structure that is overwritten by calls tothese routines. To retrieve an entry, modify it, and replace it in the database, copy the entry using struc-ture assignment and supply the modified buffer to putprtcnam .

getprtcent returns a pointer to the first terminal pr_term structure in the database when first called.Thereafter, it returns a pointer to the next pr_term structure in the database, so successive calls can beused to search the database. getprtcnam searches from the beginning of the database until a terminalname matching name is found, and returns a pointer to the particular structure in which it was found. Ifan end-of-file or an error is encountered on reading, these functions return a NULLpointer.

A call to setprtcent has the effect of rewinding the Terminal Control database to allow repeatedsearches. endprtcent can be called to close the Terminal Control database when processing is com-plete.

putprtcnam puts a new or replaced terminal control entry pr with key name into the database. If thefg_devname field is 0, the requested entry is deleted from the Terminal Control database. putprtcnamlocks the database for all update operations, and performs an endprtcent after the update or failedattempt.

APPLICATION USAGEIn a multithreaded application, these routines are safe to be called only from one dedicated thread.These routines are not POSIX.1c async-cancel safe nor async-signal safe.

RETURN VALUEgetprtcent and getprtcnam return NULL pointers on EOFor error. putprtcnam returns 0 if itcannot add or update the entry.

NOTESThe fd_devname field, on systems supporting connections, may refer to the ASCII representation of a hostname. This can be determined by using getdvagnam (see getdvagent (3)) to interrogate the DeviceAssignment database as to the type of the device, passing in the fd_devname field of the Terminal Controlstructure as an argument. This allows lockout by machine, instead of the device (typically pseudo tty) onwhich the session originated.

Programs using these routines must be compiled with -lsec .

The sfld and sflg structures are filled from corresponding fields in the system default database. Thus, aprogram can easily extract the user-specific or system-wide parameters for each database field (see get-prpwent and getdvagent ).

FILES/tcb/files/ttys Terminal Control database/tcb/files/auth/system/default System Defaults database

SEE ALSOgetprdfent(3), authcap(4), ttys(4).

Section 3−−404 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getpublickey(3N) getpublickey(3N)

NAMEgetpublickey(), getsecretkey(), publickey() - retrieve public or secret key

SYNOPSIS#include <rpc/rpc.h>#include <rpc/key_prot.h>

int getpublickey(const char netname [ MAXNETNAMELEN],char publickey[ HEXKEYBYTES]);

int getsecretkey(const char netname [ MAXNETNAMELEN],char secretkey[ HEXKEYBYTES],const char *passwd );

MULTITHREAD USAGEThread Safe: YesCancel Safe: YesFork Safe: NoAsync-cancel Safe: NoAsync-signal Safe: No

These functions can be called safely in a multithreaded environment. They may be cancellation points inthat they call functions that are cancel points.

In a multithreaded environment, these functions are not safe to be called by a child process after fork()and before exec() . These functions should not be called by a multithreaded application that supportasynchronous cancellation or asynchronous signals.

DESCRIPTIONgetpublickey() and getsecretkey() get public and secret keys for netname . The key may comefrom one of the following sources: the /etc/publickey file (see publickey (4)) or the NIS map‘‘publickey.byname’’ or the NIS table ‘‘cred.org_dir’’. The sources and their lookup order are specified inthe /etc/nsswitch.conf file (see nsswitch.conf(4)).

getsecretkey() has an extra argument, passwd , used to decrypt the encrypted secret key stored inthe database.

RETURN VALUESBoth routines return 1 if they are successful in finding the key, 0 (zero) otherwise. The keys are returnedas NULL-terminated, hexadecimal strings. If the password supplied to getsecretkey() fails todecrypt the secret key, the routine will return 1 but the secretkey [0] will be set to NULL.

WARNINGSIf getpublickey() gets the public key from any source other than NIS+, all authenticated NIS+operations may fail. To ensure that this does not happen, edit the nsswitch.conf() file to make surethat the public key is obtained from NIS+.

SEE ALSOsecure_rpc(3N), nsswitch.conf(4), publickey(4).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−405

A gA

getpw(3C) getpw(3C)(TO BE OBSOLETED)

NAMEgetpw( ) - get name from UID

SYNOPSIS#include <pwd.h>

int getpw(uid_t uid, char *buf);

DESCRIPTIONgetpw() searches the password file for a user ID number that equals uid , copies the line of the pass-word file in which uid was found into the array pointed to by buf , and returns 0. getpw() returnsnon-zero if uid cannot be found. The line is null-terminated.

This routine is included only for compatibility with prior systems, and should not be used; seegetpwent (3C) for routines to use instead.

NETWORKING FEATURESNFS

This routine is implemented using getpwuid() (see getpwent (3C)) and therefore uses the NetworkInformation Service network database as described in passwd (4).

RETURN VALUEgetpw() returns non-zero on error.

WARNINGSThe above routine uses <stdio.h >, which causes it to increase, more than might be expected, the size ofprograms not otherwise using standard I/O.

Obsolescent Interfacesgetpw() is to be obsoleted at a future date.

AUTHORgetpw() was developed by AT&T and HP.

FILES/etc/passwd

SEE ALSOgetpwent(3C), passwd(4), thread_safety(5).

STANDARDS CONFORMANCEgetpw() : XPG2

Section 3−−406 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getpwent(3C) getpwent(3C)

NAMEgetpwent(), getpwuid(), getpwuid_r(), getpwnam(), getpwnam_r(), setpwent(), endpwent(), fgetpwent() -get password file entry

SYNOPSIS#include <pwd.h>

struct passwd *getpwent(void);

struct passwd *getpwuid(uid_t uid);

int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,size_t buflen, struct passwd **result);

struct passwd *getpwnam(const char *name);

int getpwnam_r(char *name, struct passwd *pwd, char *buffer,size_t buflen, struct passwd **result);

void setpwent(void);

void endpwent(void);

struct passwd *fgetpwent(FILE *stream);

Obsolescent Interfaces#include <pwd.h>

int getpwent_r(struct passwd *result, char *buffer, int buflen,FILE **pwfp);

void setpwent_r(FILE **pwfp);

void endpwent_r(FILE **pwfp);

int fgetpwent_r(FILE *f, struct passwd *result, char *buffer,int buflen);

DESCRIPTIONgetpwent() , getpwuid() , and getpwnam() are used to obtain password entries, and return apointer to an object of passwd structure. An entry may come from any of the sources for passwdspecified in the /etc/nsswitch.conf file. See nsswitch.conf(4).

The passwd structure is defined in <pwd.h> and includes the following members:

char *pw_name; /* user name */char *pw_passwd; /* encrypted password */uid_t pw_uid; /* user id */gid_t pw_gid; /* group id */char *pw_age; /* password aging */char *pw_comment; /* unused */char *pw_gecos; /* user fullname, office, extension, homephone*/char *pw_dir; /* initial directory */char *pw_shell; /* initial shell */aid_t pw_audid; /* numerical audit id */int pw_audflg; /* numerical audit flag */

The pw_comment field is unused. For more information on the other fields, see the passwd (4) manpage.

getpwent() When first called, getpwent() returns a pointer to the first passwd structure inthe password database. Thereafter, it returns a pointer to the next passwd struc-ture in the database.

setpwent() Has the effect of rewinding the password database to allow repeated searches.

endpwent() Can be called to indicate that password database processing is complete.

getpwuid() Searches from the beginning of the password database until a numeric user IDmatching uid is found, and returns a pointer to the particular structure in which itwas found.

getpwnam() Searches from the beginning of the password database until a login name matchingname is found, and returns a pointer to the particular structure in which it was

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−407

A gA

getpwent(3C) getpwent(3C)

found.

fgetpwent() Unlike the other functions above, does not use nsswitch.conf , nor access NIS orNIS+. It returns a pointer to the next passwd structure in the standard I/O streamstream , which should be open for reading, and its contents should match the formatof /etc/passwd .

Obsolescent Interfacesgetpwent_r() , setpwent_r() , endpwent_r() , fgetpwent_r() get password file entry.

Reentrant Interfacesgetpwuid_r() , and getpwnam_r() both update the struct passwd pointed to by pwd and store apointer to that structure at the location pointed to by result . The structure must contain an entry fromthe user database with a matching uid or name. Storage referenced by the passwd structure pointed toby pwd is allocated from the memory provided with the buffer parameter, which is defined as buflenin size. The maximum size needed for this buffer can be determined with the_SC_GETPW_R_SIZE_MAX sysconf() parameter. A NULLpointer is returned at the location pointedto by result on error or if the requested entry is not found.

A buffer length of 1024 is recommended.

NotesWhen the repository is set to files in the /etc/nsswitch.conf file, then the getpwent() ,getpwuid() , getpwuid_r() , getpwnam() , and getpwnam_r() calls return the passwd struc-ture exactly as it appears in the /etc/passwd file. In shadowed standard mode, the calls normallyreturn "x" (instead of the encrypted password and aging information) in the pw_passwd field. The sameapplies for calls to fgetpwent() when the argument stream is set to /etc/passwd .

SECURITY FEATURESIf the system has been converted to a trusted system, the password, audit ID, and audit flag are notreturned. The password will be the default * that is in /etc/passwd and the audit ID and audit flagwill be set to −1. On trusted systems, if it is not necessary to obtain information from the regular pass-word file, /etc/passwd , users should use getprpwent() to access the protected password database.See getprpwent (3) and getspwent (3X).

putpwent() affects only /etc/passwd , and the audit ID and audit flag in the password structure areignored. putprpwnam() must be used to modify the protected password database entries. See get-prpwent (3).

RETURN VALUEgetpwent() , getpwuid() , getpwnam() , and fgetpwent() return a NULL pointer if an end-of-file or error is encountered on reading. fgetpwent() returns a NULL pointer on encountering aninvalid entry. An invalid entry is one which does not follow the /etc/passwd structure. Otherwise,the return value points to an internal static area containing a valid passwd structure.

getpwuid_r() and getpwnam_r() return zero upon success. Otherwise, an error number isreturned to indicate the error.

ERRORSgetpwent() , getpwuid() , getpwnam() , and fgetpwent() fail if any of the following are true:

[EIO] An I/O error has occurred.

[EMFILE] OPEN_MAX descriptors are currently open in the calling process.

[ENFILE] The maximum allowable number of files is currently open in the system.

WARNINGSThe value returned by getpwent() , getpwuid() , getpwnam() , and fgetpwent() points to a sin-gle static area that is overwritten by each call to any of the functions, so it must be copied if it is to besaved.

The following fields have numerical limitations as noted:

• The user ID is an integer value between -2 and UID_MAXinclusive.

• The group ID is an integer value between 0 and UID_MAXinclusive.

Section 3−−408 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getpwent(3C) getpwent(3C)

Users of getpwuid_r() and getpwnam_r() should note that these interfaces now conform withPOSIX.1c. getpwent_r() , setpwent_r() , endpwent_r() and fgetpwent_r() are obsolescentinterfaces. These interfaces and the old prototypes of getpwuid_r() and getpwnam_r() are sup-ported for compatibility with existing DCE applications only.

The interfaces getpwuid() , getpwnam() , getpwent() , setpwent() , endpwent() ,fgetpwent() , getpwuid_r() and getpwnam_r() use the Dynamic Name Service Switch. Seensswitch.conf(4). An application that uses these interfaces cannot be fully archive bound.

EXAMPLEThe following code excerpt prints name and uid of a user logged in on this terminal:

struct passwd pwd;struct passwd *result;char logBuffer [1024];char pwdBuffer [1024];

if (getlogin_r (loginBuffer, 1024) == 0)if (getpwnam_r (logBuffer, &pwd, pwdBuffer, 1024, &result) == 0)

printf ("Name = %s; uid = %d\n", pwd.pw_name, pwd.pw_uid);

DEPENDENCIESNFS

Files/var/yp/ domainname /passwd.byname/var/yp/ domainname /passwd.byuid/var/nis/ hostname /passwd.org_dir

AUTHORgetpwent() , getpwuid() , getpwnam() , setpwent() , endpwent() , and fgetpwent() weredeveloped by Sun and HP.

FILES/etc/passwd System Password file

SEE ALSOniscat(1), ypcat(1), cuserid(3S), getgrent(3C), getlogin(3C), getprpwent(3), getspwent(3X), stdio(3S),putpwent(3C), nsswitch.conf(4), passwd(4), limits(5), thread_safety(5).

STANDARDS CONFORMANCEgetpwent() : SVID2, SVID3, XPG2

endpwent() : SVID2, SVID3, XPG2

fgetpwent() : SVID2, SVID3, XPG2

getpwnam() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

getpwuid() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

setpwent() : SVID2, SVID3, XPG2

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−409

A gA

getresuid(3) getresuid(3)

NAMEgetresuid, getresgid - get real, effective and saved user or group IDs

SYNOPSISint getresuid (uid_t *ruid, uid_t *euid, uid_t *suid);int getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid);

DESCRIPTIONgetresuid and getresgid return the real, effective, and saved user or group ID’s of the current pro-cess.

RETURN VALUEOn error, the return is -1, and errno is set appropriately. On success the return is 0.

ERRORS[EFAULT] One of the arguments specified an address outside the calling programs address space.

Section 3−−410 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getrpcent(3C) getrpcent(3C)

NAMEgetrpcent( ), getrpcbyname( ), getrpcbynumber( ), - get rpc entry

SYNOPSIScc [ flag . . . ] file . . . -lnsl [ library . . . ]

#include <netdb.h>

struct rpcent *getrpcent();

struct rpcent *getrpcbyname(char *name);

struct rpcent *getrpcbynumber(int number);

int setrpcent(int stayopen);

int endrpcent();

DESCRIPTIONThese functions are used to obtain entries for RPC (Remote Procedure Call) services. An entry may comefrom any of the sources for rpc specified in the /etc/nsswitch.conf file (see nsswitch.conf(4)).

getrpcbyname() searches for an entry with the RPC service name specified by the parameter name .

getrpcbynumber() searches for an entry with the RPC program number number .

The functions setrpcent() , getrpcent() , and endrpcent() are used to enumerate RPC entriesfrom the database.

setrpcent() sets (or resets) the enumeration to the beginning of the set of RPC entries. This functionshould be called before the first call to getrpcent() . Calls to getrpcbyname() andgetrpcbynumber() leave the enumeration position in an indeterminate state. If the stayopen flag isnon-zero, the system may keep allocated resources such as open file descriptors until a subsequent call toendrpcent() .

Successive calls to getrpcent() return either successive entries or NULL, indicating the end of theenumeration.

endrpcent() may be called to indicate that the caller expects to do no further RPC entry retrievaloperations; the system may then deallocate resources it was using. It is still allowed, but possibly lessefficient, for the process to call more RPC entry retrieval functions after calling endrpcent() .

MULTITHREAD USAGEThread Safe: YesCancel Safe: YesFork Safe: NoAsync-cancel Safe: NoAsync-signal Safe: No

These functions can be called safely in a multithreaded environment. They may be cancellation points inthat they call functions that are cancel points.

In a multithreaded environment, these functions are not safe to be called by a child process after fork()and before exec() . These functions should not be called by a multithreaded application that supportasynchronous cancellation or asynchronous signals.

getrpcbyname() , getrpcbynumber() and getrpcent() use thread specific storage that is re-used in each call. The return value, struct rpcent , should be unique for each thread and should besaved, if desired, before the thread makes the next getrpc*() call.

For enumeration in multithreaded applications, the position within the enumeration is a process-wideproperty shared by all threads. setrpcent() may be used in a multithreaded application but resetsthe enumeration position for all threads. If multiple threads interleave calls to getrpcent() , thethreads will enumerate disjoint subsets of the RPC entry database.

RETURN VALUERPC entries are represented by the struct rpcent structure defined in <netdb.h> :

struct rpcent {char *r_name; /* name of this rpc service */char **r_aliases; /* zero-terminated list of alternate names */

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−411

A gA

getrpcent(3C) getrpcent(3C)

long r_number; /* rpc program number */};

The functions getrpcbyname() , and getrpcbynumber() each return a pointer to a structrpcent if they successfully locate the requested entry; otherwise they return NULL.

The function getrpcent() returns a pointer to a struct rpcent if it successfully enumerates anentry; otherwise it returns NULL, indicating the end of the enumeration.

WARNINGSPrograms that use the interfaces described in this manual page cannot be linked statically since theimplementations of these functions employ dynamic loading and linking of shared objects at run time.

AUTHORgetrpcent() was developed by Sun Microsystems, Inc.

FILES/etc/rpc /etc/nsswitch.conf

SEE ALSOrpcinfo(1M), rpc(4), nsswitch.conf(4).

Section 3−−412 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getrpcport(3N) getrpcport(3N)

NAMEgetrpcport( ) - get RPC port number

SYNOPSISint getrpcport(

char *host,int prognum,int versnum,int proto

);

DESCRIPTIONgetrpcport() returns the port number for version versnum of the RPC program prognum running onhost and using protocol proto . It returns 0 if it cannot contact portmap or if prognum is not registered. Ifprognum is registered but not with version versnum , it returns the port number of the last registered(prognum , proto ) pair.

WARNINGSUser applications that call this routine must be linked with /usr/lib/librpcsvc.a . For example,

cc my_source.c -lrpcsvc

AUTHORgetrpcport() was developed by Sun Microsystems, Inc.

SEE ALSOportmap(1M).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−413

A gA

gets(3S) gets(3S)

NAMEgets(), fgets(), fgets_unlocked() - get a string from a stream

SYNOPSIS#include <stdio.h>

char *gets(char *s);

char *fgets(char *s, int n, FILE *stream);

Obsolescent Interfacechar *fgets_unlocked(char *s, int n, FILE *stream);

DESCRIPTIONgets() Reads characters from the standard input stream, stdin , into the array pointed to by s ,

until a new-line character is read or an end-of-file condition is encountered. The new-line character is discarded and the string is terminated with a null character.

fgets() Reads characters from the stream into the array pointed to by s , until n−1 characters areread, a new-line character is read and transferred to s , or an end-of-file condition isencountered. The string is then terminated with a null character.

Obsolescent Interfacefgets_unlocked() gets a string from a stream.

APPLICATION USAGEAfter gets() or fgets() is applied to a stream, the stream becomes byte-oriented (see orientation (5)).

RETURN VALUEUpon successful completion, fgets() , fgets_unlocked() , and gets() return s . If the stream is atend-of-file, the end-of-file indicator for the stream is set and a null pointer is returned. If a read erroroccurs, the error indicator for the stream is set, errno is set to indicate the error, and a null pointer isreturned.

ferror() and feof() can be used to distinguish between an error condition and an end-of-file condi-tion.

ERRORSfgets() , fgets_unlocked() , and gets() fail if data needs to be read into the stream ’s buffer, and:

[EAGAIN] The O_NONBLOCKflag is set for the file descriptor underlying stream and the pro-cess would be delayed in the read operation.

[EBADF] The file descriptor underlying stream is not a valid file descriptor open for reading.

[EINTR] The read operation was terminated due to the receipt of a signal, and either no datawas transferred or the implementation does not report partial transfer for this file.

[EIO] The process is a member of a background process and is attempting to read from itscontrolling terminal, and either the process is ignoring or blocking the SIGTTINsignal or the process group of the process is orphaned.

Additional errno values can be set by the underlying read() function (see read (2)).

WARNINGSfgets_unlocked() is an obsolescent interface supported only for compatibility with existing DCEapplications. New multithreaded applications should use fgets() .

SEE ALSOferror(3S), flockfile(3S), fopen(3S), fread(3S), getc(3S), puts(3S), scanf(3S), orientation(5),thread_safety(5).

STANDARDS CONFORMANCEgets() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

fgets() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−414 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getservent(3N) getservent(3N)

NAMEgetservent(), getservbyport(), getservbyname(), setservent(), endservent() - get service entry

SYNOPSIS#include <netdb.h>

struct servent *getservent(void);

struct servent *getservbyname(const char *name,const char *proto);

struct servent *getservbyport(int port, const char *proto);

int setservent(int stayopen);

int endservent(void);

_XOPEN_SOURCE_EXTENDED onlyvoid setservent(int stayopen);void endservent(void);

DESCRIPTIONThe getservent() , getservbyname() , and getservbyport() functions each return a pointer toa structure of type servent containing the broken-out fields of a line in the network services data base,/etc/services .

The members of this structure are:

s_name The official name of the service.

s_aliases A null-terminated list of alternate names for the service.

s_port The port number at which the service resides.

s_proto The name of the protocol to use when contacting the service.

Functions behave as follows:

getservent() Reads the next line of the file, opening the file if necessary.

setservent() Opens and rewinds the file. If the stayopen flag is non-zero, the servicesdata base is not closed after each call to getservent() (either directlyor indirectly through one of the other getserv* calls).

endservent() Closes the file.

getservbyname()getservbyport() Each sequentially searches from the beginning of the file until a match-

ing service name (among either the official names or the aliases) or portnumber is found, or until EOF is encountered. If a non-NULL protocolname is also supplied (such as tcp or udp ), searches must also matchthe protocol.

If the system is running the Network Information Service (NIS) or Network Information Service Plus(NIS+), getservbyname() gets the service information from the NIS server (see ypserv (1M) andypfiles (4)) or from the NIS+ server (see nis+ (1)), respectively.

In a multithreaded application, getservent() , getservbyaddr() , and getservbyname() usethread-specific storage that is re-used in each call. The return value struct servent should beunique for each thread and should be saved, if desired, before the thread makes the next getserv*()call.

For enumeration in multithreaded applications, the position within the enumeration is a process-wideproperty shared by all threads. setservent() may be used in a multithreaded application, but resetsthe enumeration position for all threads. If multiple threads interleave calls to getservent() , thethreads will enumerate disjoint subsets of the service database.

Name Service Switch-Based OperationThe library routines getservbyname() , getservbyport() , getservent() , and their reentrantcounterparts, internally call the name service switch to access the "services" database lookup policyconfigured in the /etc/nsswitch.conf file (see nsswitch.conf(4)). The lookup policy defines the

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−415

A gA

getservent(3N) getservent(3N)

order and the criteria of the supported name services used to resolve service names and ports.

OBSOLESCENT INTERFACESint getservent_r(struct servent *result,

struct servent_data *buffer);

int getservbyname_r(const char *name,const char *proto,struct servent *result,struct servent_data *buffer);

int getservbyport_r(int port,const char *proto,struct servent *result,struct servent_data *buffer);

int setservent_r(int stayopen, struct servent_data *buffer);

int endservent_r(struct servent_data *buffer);

The above reentrant interfaces have been moved from libc to libd4r . They are included to supportexisting applications and may be removed in a future release. New multithreaded applications shoulduse the regular APIs without the _r suffix.

The reentrant interfaces performs the same operations as their regular counterpart (those without the _rsuffix.) However, getservent_r() , getservbyname_r() , and getservbyport_r() expect to bepassed the address of a struct servent and will store the address of the result at this suppliedparameter. An additional parameter, an address to a struct servent_data , which is defined in the file<netdb.h> cannot be a NULL pointer.

The reentrant routines return −1 if the operation is unsuccessful, or, in the case of getservent_r() , ifthe end of the services list has been reached. 0 is returned otherwise.

RETURN VALUEgetservent() , getservbyname() , and getservbyport() return a null pointer (0) on EOF orwhen they are unable to open /etc/services .

EXAMPLESThe following code excerpt counts the number of service entries:

int count = 0;

(void) setservent(0);while (getservent() != NULL)

count++;(void) endservent();

WARNINGSPrograms that use the interfaces described in this manpage cannot be linked statically because the imple-mentations of these functions employ dynamic loading and linking of shared objects at run time.

AUTHORgetservent() was developed by Sun Microsystems Inc.

FILES/etc/services

SEE ALSOypserv(1M), services(4), ypfiles(4), nsswitch.conf(4), nis+(1), thread_safety(5).

STANDARDS CONFORMANCEgetservent() : XPG4

Section 3−−416 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getspent(3C) getspent(3C)

NAMEgetspnam(), getspnam_r(), getspent(), setspent(), endspent(), fgetspent() - access shadow password entries

SYNOPSIS#include <shadow.h>

struct spwd *getspnam (const char *name);

struct spwd *getspnam_r (const char *name, struct spwd *result, char*buffer, size_t bufsiz);

struct spwd *getspent (void);

void setspent (void);

void endspent (void);

struct spwd *fgetspent (FILE *stream);

DESCRIPTIONThe routines getspnam() , getspnam_r() , getspent() and fgetspent() return a pointer to ashadow password entry. Each shadow password entry is an spwd structure, declared in the<shadow.h> header file, with the following members:

char *sp_namp; /* the user’s login name */char *sp_pwdp; /* the encrypted password for the user */long sp_lstchg; /* # of days from 1/1/70 when passwd was last modified */long sp_min; /* min # of days allowed between password changes */long sp_max; /* max # of days allowed between password changes */long sp_warn; /* # of days before password expires and warning issued*/long sp_inact; /* # of days between account inactive and disabled */long sp_expire; /* # of days from 1/1/70 when account is locked */unsigned long sp_flag; /* currently unused */

The getspnam() routine returns a pointer to a structure containing an entry from the shadow passworddatabase with a matching name.

The getspnam_r() routine is similar to getspnam() , except that it does not work on systems whichhave been converted to trusted mode, and it has three extra parameters. getspnam_r() updates thespwd structure pointed to by result and returns a pointer to that structure. Storage referenced by thespwd structure pointed to by result is allocated from the memory provided with the buffer parame-ter, which is buflen in size. A buffer length of 1024 is recommended.

The initial call to getspent() returns a pointer to the first spwd structure. Subsequent calls returnpointers to successive spwd structures. Repeated calls to getspent() can be used to search all entriesin the password database. The getspnam() routine searches password entries from beginning to end,until a login name matching name is found, and returns a pointer to that entry.

The setspent() routine is used to reset access to the shadow password entries. After setspent() iscalled, the subsequent call to getspent() returns the first shadow password entry. This mechanism isused to allow repeated searches of the shadow password entries. The endspent() routine is used toindicate that processing of password entries is complete.

fgetspent() , unlike the other functions above, does not use /etc/nsswitch.conf , and does notaccess NIS or NIS+. It returns a pointer to the next spwd structure in the standard I/O stream. The I/Ostream should be open for reading and its contents should match the format of /etc/shadow .

NotesShadow password entries normally reside in /etc/shadow . However, there are two exceptions to this.On a standard system with no /etc/shadow file, the password and aging information is obtained from/etc/passwd and translated into an spwd structure. If the system has been converted to a trustedsystem, the password and aging information is obtained from the Protected Password Database(/tcb/files/auth/*/* ) and translated into an spwd structure.

If the fields corresponding to sp_min , sp_max , sp_lstchg , sp_warn , sp_inact , sp_expire , orsp_flag are not specified in the entry, they default to -1 . If the returned value of sp_min , sp_max ,or sp_warn is -1 , then the feature associated with that field is considered to be disabled.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−417

A gA

getspent(3C) getspent(3C)

The routines getspent() , getspnam() and getspnam_r() depend on the configuration of the/etc/nsswitch.conf file. See nsswitch.conf(4). Entries may reside in any repository specified in/etc/nsswitch.conf . These routines use the switch for the passwd database; for example, an entryin /etc/nsswitch.conf would contain "passwd: nis files" .

Programs using these routines must be compiled with -lsec .

APPLICATION USAGEIn a multithreaded application, on systems not converted to trusted mode, getspnam , getspnam_r() ,getspent() , setspent() , endspent() and fgetspent() are thread-safe, but not async-cancel-safe. A cancellation point may occur when a thread is executing any of these interfaces. On systemswhich have been converted to trusted mode, only fgetspent() is thread-safe.

RETURN VALUEIf an EOF or error is encountered while reading, getspnam() , getspnam_r() , getspent() , andfgetspent() return a NULLpointer. Otherwise, the return value points to a valid spwd structure. Inthe case of getspnam() , getspent() , and fgetspent() , the spwd structure resides in an internalarea. In the case of getspnam_r() , the spwd structure resides in the spwd structure pointed to by theresult argument.

FILES/etc/passwd system password file./etc/shadow shadow password file./tcb/files/auth/*/* protected password database, for trusted systems.

SEE ALSOgetpwent(3C), getprpwent(3), nsswitch.conf(4), passwd(4), shadow(4).

STANDARDS CONFORMANCEgetspent : SVID3

Section 3−−418 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getspwent(3X) getspwent(3X)

NAMEgetspwent(), getspwuid(), getspwaid(), getspwnam(), setspwent(), endspwent(), fgetspwent(),getspwent_r(), getspwuid_r(), getspwaid_r(), getspwnam_r(), setspwent_r(), endspwent_r(), fgetspwent_r()- get secure password file entry on trusted systems

SYNOPSIS#include <pwd.h>

struct s_passwd *getspwent(void);

struct s_passwd *getspwuid(uid_t uid);

struct s_passwd *getspwaid(aid_t aid);

struct s_passwd *getspwnam(const char *name);

void setspwent(void);

void endspwent(void);

struct s_passwd *fgetspwent(FILE *stream);

Obsolescent InterfacesThe following re-entrant interfaces are to be obsoleted: getspwent_r() , getspwuid_r() ,getspwaid_r() , getspwnam_r() , setspwent_r() , endspwent_r() , fgetspwent_r() .

#include <pwd.h>

int getspwent_r(struct s_passwd *result, char *buffer, int buflen,FILE **pwfp);

int getspwuid_r(uid_t uid, struct s_passwd *result,char *buffer, int buflen);

int getspwaid_r(aid_t aid, struct s_passwd *result,char *buffer, int buflen);

int getspwnam_r(char *name, struct s_passwd *result,char *buffer, int buflen);

void setspwent_r(FILE **pwfp);

void endspwent_r(FILE **pwfp);

int fgetspwent_r(FILE *f, struct s_passwd *result,char *buffer, int buflen);

DESCRIPTIONThese privileged routines provide access to the protected password database in a manner similar to theway getpwent (3C) routines handle the regular password file, /etc/passwd .

These routines are particularly useful in situations where it is not necessary to get information from theregular password file. getspwent (3X) can be used on a trusted system to return the password, audit ID,and audit flag information. Programs using these routines must be linked with the security library, lib-sec .

Note that getspwent() routines are no longer supported. They are temporarily available for backwardcompatibility. New applications accessing the protected password database on trusted systems shoulduse the getprpwent() routines. See getprpwent (3).

getspwent() , getspwuid() , getspwaid() , and getspwnam() each returns a pointer to an objectof s_passwd structure. The s_passwd structure is maintained for compatibility with existing software andconsists of five fields as follows:

struct s_passwd {char *pw_name; /* login name */char *pw_passwd; /* encrypted password */char *pw_age; /* password age */int pw_audid; /* audit ID */int pw_audflg; /* audit flag 1=on, 0=off */

};

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−419

A gA

getspwent(3X) getspwent(3X)

Since the s_passwd structure is declared in the <pwd.h> header file, it is unnecessary to redeclare it.

To access other fields in the protected password database that are not included in the s_passwd structure,use getprpwent() . See getprpwent (3) for more information.

getspwent() When first called, getspwent() returns a pointer to each s_passwd structureobtained from the protected password database for each user in sequence. Subse-quent calls can be used to search the entire database.

getspwuid() Searches for an entry that matches the specified uid . It then returns a pointer tothe particular structure in which uid is found.

getspwaid() Similarly searches for a numerical audit ID matching aid and returns a pointer tothe particular structure in which aid is found (see passwd (4) for details on thisfield).

getspwnam() Searches for an entry that matches the specified name . Returns a pointer to theparticular structure in which name is found.

setspwent() Resets the protected password database pointer to the beginning of the file to allowrepeated searches.

endspwent() Should be called to close the protected password database file when processing iscomplete.

fgetspwent() Is no longer supported. It is provided for those applications that did not use/.secure/etc/passwd .

Reentrant Interfacesgetspwuid_r() , getspwaid_r() , getspwnam_r() , and fgetspwent_r() expect to be passedthree extra parameters:

1. The address of an s_passwd structure where the result will be stored;

2. A buffer to store character strings (such as the password) to which fields in the s_passwd structurewill point;

3. The length of the user-supplied buffer. A buffer length of 1024 is recommended.

In addition to the above three parameters, getspwent_r() requires a pointer to a (FILE * ) variable.setspwent_r() and endspwent_r() are to be used only in conjunction with getspwent_r() andtake the same pointer to a (FILE * ) variable as a parameter. setspwent_r() can be used to rewindor open the protected password database. endspwent_r() should be called when done to close the file.

Note that the (FILE * ) variable must be initialized to NULL before it is passed to getspwent_r() orsetspwent_r() for the first time. Thereafter it should not be modified in any way.

fgetspwent_r() and setspwent_r() are to be obsoleted at a future date.

APPLICATION USAGEIn a multithreaded application, these routines are safe to be called only from one dedicated thread.These routines are not POSIX.1c async-cancel safe nor async-signal safe.

RETURN VALUEgetspwent() returns a NULL pointer if any of its routines encounters an end-of-file or error whilesearching, or if the effective user ID of the calling process is not zero.

getspwent_r() returns a −1 if any of its routines encounters an end-of-file or error, or if the suppliedbuffer has insufficient length. If the operation is successful, 0 is returned.

WARNINGSThe above routines use <stdio.h> , which causes them to increase the size of programs by more thanmight otherwise be expected.

Since all information for getspwent() , getspwuid() , getspwaid() , getspwnam() ,setspwent() , endspwent() , and fgetspwent() is contained in a static area, it must be copied tobe saved.

Network Information Service is not supported on trusted systems.

The routines described in this manpage are no longer supported. They are temporarily available forbackward compatibility and are to be obsoleted in a future release.

Section 3−−420 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getspwent(3X) getspwent(3X)

Obsolescent InterfacesThe following interfaces are to be obsoleted: getspwent_r() , getspwuid_r() , getspwaid_r() ,getspwnam_r() , setspwent_r() , endspwent_r() , and fgetspwent_r() .

EXAMPLESThe following code excerpt counts the number of entries in the protected password database:

int count = 0;struct s_passwd *pwbuf;

setspwent();while (pwbuf=getspwent())

count++;endspwent();

AUTHORgetspwent() was developed by HP.

FILES/tcb/files/auth/*/* Protected Password database

SEE ALSOypcat(1), getgrent(3C), getlogin(3C), getpwent(3C), getprpwent(3), passwd(4).

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−421

A gA

getstr(3X) getstr(3X)(CURSES)

NAMEgetstr, mvgetstr, mvwgetstr, wgetstr — get a multi-byte character string from the terminal

SYNOPSIS#include <curses.h>

int getstr(char * str);

int mvgetstr(int y, int x, char * str);

int mvwgetstr(WINDOW * win, int y, int x, char * str);

int wgetstr(WINDOW * win, char * str);

DESCRIPTIONThe effect of getstr() is as though a series of calls to getch() were made, until a newline or carriagereturn is received. The resulting value is placed in the area pointed to by str. The user’s erase and killcharacters are interpreted, as well as any special keys (such as function keys, home key, clear key, and soon).

The mvgetstr() function is identical to getstr() except that it is as though it is a call to move()and then a series of calls to getch() . The mvwgetstr() function is identical to getstr() except itis as though a call to wmove() is made and then a series of calls to wgetch() .

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEReading a line that overflows the array pointed to by str with getstr() , mvgetstr() , mvwgetstr()or wgetstr() causes undefined results.

Traditional implementations often limited the number of bytes returned to 256.

SEE ALSObeep(3X), getch(3X), getnstr(3X), curses_intro(3X), see Input Processing, <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

Issue 3In X/Open Curses, Issue 3, the getstr() , mvgetstr() , mvwgetstr() and wgetstr() functionswere described in the addstr() entry. In X/Open Curses, Issue 4, the DESCRIPTION of these func-tions is rewritten for clarity and is updated to indicate that they will handle multi-byte sequencescorrectly.

Section 3−−422 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getsubopt(3C) getsubopt(3C)

NAMEgetsubopt( ) - parse suboptions from a string.

SYNOPSIS#include <stdlib.h>

int getsubopt(char **optionp, char * const *tokens, char **valuep);

DESCRIPTIONgetsubopt() parses suboptions in a flag argument that were initially parsed by getopt() (seegetopt (3C)). These suboptions are separated by commas, and may consist of either a single token, or atoken-value pair separated by an equal sign. Because commas delimit suboptions in the option string,they are not allowed to be part of the suboption or the value of a suboption. Similarly, because the equalsign separates a token from its value, a token must not contain an equals sign. An example commandthat uses this syntax is mount . mount allows parameters to be specified with the - switch as follows:

mount -o rw,hard,bg,wsize=1024 speed:/usr /usr

In this example there are four suboptions: rw , hard , bg , and wsize , the last of which has an associatedvalue of 1024.

getsubopt() takes the address of a pointer to the option string, a vector of possible tokens, and theaddress of a value string pointer. It returns the index of the token that matched the suboption in theinput string or −1 if there was no match. If the option string at * optionp contains only one suboption,getsubopt() updates * optionp to point to the null at the end of the string, otherwise it isolates thesuboption by replacing the comma separator with a null, and updates * optionp to point to the start of thenext suboption. If the suboption has an associated value, getsubopt() updates * valuep to point to thevalue of the first character. Otherwise it sets * valuep to NULL.

The token vector is organized as a series of pointers to NULL-terminated strings. The end of the tokenvector is identified by NULL.

When getsubopt() returns, if * valuep is not NULL then the suboption processed included a value.The calling program can use this information to determine if the presence or lack of a value for thissuboption is an error.

Additionally, when getsubopt() fails to match the suboption with the tokens in the tokens array, thecalling program should decide if this is an error, or if the unrecognized option should be passed on toanother program.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the interpretation of option letters as single and/or multi-byte char-acters.

International Code Set SupportSingle- and multi-byte character code sets are supported with the exception of multi-byte-character filenames.

EXAMPLESThe following code fragment shows how options can be processed to the mount command by using get-subopt() .

char *myopts[] = {#define READONLY 0

"ro",#define READWRITE 1

"rw",#define WRITESIZE 2

"wsize",#define READSIZE 3

"rsize",NULL};

main (int argc, char **argv){

int sc, c, errflag;

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−423

A gA

getsubopt(3C) getsubopt(3C)

char *options, *value;extern char *optarg;extern int optind;...while ((c = getopt(argc, argv, "abf:o:")) != EOF)

switch (c) {case ’a’: /* process ’a’ option */

break;case ’b’: /* process ’b’ option */

break;case ’f’:

ofile = optarg;break;

case ’?’:errflag++;break;

case ’o’:options = optarg;while (*options != ’\0’) {

switch(getsubopt(&options, myopts, &value)) {case READONLY: /* process ro option */

break;case READWRITE: /* process rw option */

break;case WRITESIZE: /* process wsize option */

if (value == NULL) {error_no_arg();errflag++;

}else

write_size = atoi(value);break;

case READSIZE: /* process rsize option */if (value == NULL) {

error_no_arg();errflag++;

}else

read_size = atoi(value);break;

default:/* process unknown token */error_bad_token(value);errflag++;break;

}}break;

}}if (errflg) {

fprintf(stderr, "usage : . . . ");exit (2);

}for ( ; optind < argc; optind++) {

/* process remaining arguments */...

}

Section 3−−424 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getsubopt(3C) getsubopt(3C)

SEE ALSOgetopt(3C), thread_safety(5).

STANDARDS CONFORMANCEgetsubopt() : SVID3

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−425

A gA

gettimer(3C) gettimer(3C)

NAMEgettimer - get value of a per-process timer

SYNOPSIS#include <sys/timers.h>

int gettimer(timer_t timerid, struct itimerspec *value);

DESCRIPTIONThe gettimer() function returns an itimerspec structure value to the value argument. Theit_value member of the structure represents the amount of time in the current interval before thetimer expires for the timer specified in timerid , or zero if the timer is disabled. The it_intervalmember has the value last set by reltimer() (see reltimer (3C)). The members of value are subject tothe resolution of the timer (see mktimer (3C)).

The behavior of this function is undefined if value is NULL.

RETURN VALUEUpon successful completion, gettimer() returns zero; otherwise, it returns −1 and sets errno to indi-cate the error.

ERRORSgettimer() fails if any of the following conditions are encountered:

[EINVAL] timerid does not correspond to an ID returned by mktimer() .

[EIO] An error occurred while accessing the clock device.

FILES/usr/include/sys/timers.h

SEE ALSOtimers(2), timer_gettime(2), mktimer(3C), reltimer(3C), thread_safety(5).

STANDARDS CONFORMANCEgettimer() : AES

Section 3−−426 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gettxt(3C) gettxt(3C)(TO BE OBSOLETED)

NAMEgettxt() - read text string from message file

SYNOPSIS#include <unistd.h>

char *gettxt(char *msg_id, char *def_str);

DESCRIPTIONThe gettxt() routine retrieves a text string from a message file for the current locale.

msg_id has the following syntax:

msgfilename : msgnumber

where msgfilename is the name of the message file generated by mkmsgs(1). If msgfilename is NULL,gettxt() uses the message file specified in the last call to setcat (3C). msgnumber is the sequencenumber of the text string in the message file (the sequence begins at 1).

gettxt() returns the message

Message not found!!

under any of the following conditions:

• msgfilename is an invalid message catalog name.

• No catalog is specified in msg_id or through setcat (3C).

• msgnumber is not a positive number.

• No message could be retrieved and def_str is NULL.

EXTERNAL INFLUENCESEnvironment Variables

gettxt() uses the environment variable LC_MESSAGESto determine the locale to use to search for themsgfilename message file. If LC_MESSAGESis not set, the environment variable LANGis used. If LANGis not set, the "C" locale will be used. The user can also change the locale via the setlocale (3C) routine.

If the msgfilename message file is not found in the specified locale or if the msgnumber is out of bounds,gettxt() attempts to retrieve the text string from the "C" locale. def_str is the string returned if a textstring cannot be retrieved even from the "C" locale.

EXAMPLESThe following code fragments are equivalent:

gettxt("mytest:1", "my default message");

setcat("mytest");gettxt(":1", "my default message");

WARNINGSObsolescent Interfaces

gettxt() is to be obsoleted at a future date.

SEE ALSOmkmsgs(1), setcat(3C), setlocale(3C), environ(5), thread_safety(5).

STANDARDS COMPLIANCEgettxt() : SVID3

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−427

A gA

getusershell(3C) getusershell(3C)

NAMEgetusershell( ), setusershell( ), endusershell( ) - get legal user shells

SYNOPSIS#include <unistd.h>

char *getusershell(void);

void setusershell(void);

void endusershell(void);

Obsolescent Interfaceschar *getusershell_r(char **shell_datap);

void setusershell_r(char **shell_datap);

void endusershell_r(char **shell_datap);

DESCRIPTIONgetusershell() Returns a pointer to the first legal user shell as defined in the file

/etc/shells (see shells (4)). If /etc/shells does not exist or is not read-able, getusershell() returns the following standard system shells:

/sbin/sh/usr/bin/sh/usr/bin/rsh/usr/bin/ksh/usr/bin/rksh/usr/bin/csh/usr/bin/keysh

as if they were contained in /etc/shells . The file is left open so that thenext call returns the next shell. A null pointer (0) is returned on EOF or error.

setusershell() Rewinds the file.

endusershell() Closes the file.

Obsolescent Interfacesgetusershell_r() , setusershell_r() , endusershell_r() get legal user shells.

WARNINGSgetusershell_r() , setusershell_r() and endusershell_r() are obsolescent interfacessupported only for compatibility with existing DCE applications. New multithreaded applications shoulduse getusershell() , setusershell() and endusershell() .

AUTHORgetusershell() was developed by HP and the University of California, Berkeley.

FILES/etc/shells

SEE ALSOshells(4), thread_safety(5).

Section 3−−428 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getut(3C) getut(3C)(TO BE OBSOLETED)

NAMEgetutent( ), getutid( ), getutline( ), pututline( ), _pututline( ), setutent( ), endutent( ), utmpname( ) - accessutmp file entry

SYNOPSIS#include <utmp.h>

struct utmp *getutent(void);

struct utmp *getutid(const struct utmp *id);

struct utmp *getutline(const struct utmp *line);

struct utmp *_pututline(const struct utmp *utmp);

void pututline(const struct utmp *utmp);

void setutent(void);

void endutent(void);

int utmpname(const char *file);

Obsolescent Interfacesint getutent_r(struct utmp **utmp, struct utmp_data *ud);

int getutid_r(struct utmp *id,struct utmp **utmp,struct utmp_data *ud);

int getutline_r(struct utmp *line,struct utmp **utmp,struct utmp_data *ud);

int pututline_r(const struct utmp *utmp, struct utmp_data *ud);

void setutent_r(struct utmp_data *ud);

void endutent_r(struct utmp_data *ud);

int utmpname_r(const char *file);

DESCRIPTIONgetutent() , getutid() , and getutline() each return a pointer to a structure of the followingtype:

struct utmp {char ut_user[8]; /* User login name */char ut_id[4]; /* /etc/inittab id (usually line #) */char ut_line[12]; /* device name (console, lnxx) */pid_t ut_pid; /* process id */short ut_type; /* type of entry */struct exit_status {

short e_termination; /* Process termination status */short e_exit; /* Process exit status */} ut_exit; /* The exit status of a process */

/* marked as DEAD_PROCESS. */unsigned short ut_reserved1; /* Reserved for future use */time_t ut_time; /* time entry was made */char ut_host[16]; /* host name, if remote;NOTSUPPORTED*/unsigned long ut_addr; /* Internet addr of host, if remote */

};

getutent() Reads in the next entry from a utmp -like file. If the file is not already open,getutent() opens it. If it reaches the end of the file, getutent() fails.

getutid() Searches forward from the current point in the utmp file until it finds an entry witha ut_type matching id−>ut_type if the type specified is RUN_LVL, BOOT_TIME,OLD_TIME, or NEW_TIME. If the type specified in id is INIT_PROCESS,

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−429

A gA

getut(3C) getut(3C)(TO BE OBSOLETED)

LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS, getutid() returns apointer to the first entry whose type is one of these four, and whose ut_id fieldmatches id−>ut_id . If end-of-file is reached without a match, getutid() fails.

getutline() Searches forward from the current point in the utmp file until it finds an entry oftype LOGIN_PROCESSor USER_PROCESSthat also has a ut_line stringmatching the line−>ut_line string. If end-of-file is reached without a match,getutline() fails.

pututline() Writes out the supplied utmp structure into the utmp file, translates the suppliedutmp structure int a utmpx structure and writes it to a utmpx file. putut-line() uses getutid() to search forward for the proper location if it is notalready there. It is normally expected that the application program has alreadysearched for the proper entry by using one of the getut() routines before callingpututline() . If the search as already been made, pututline() does notrepeat it. If pututline() does not find a matching slot for the new entry, it addsa new entry to the end of the file.

_pututline() Performs the same actions as pututline() , except that it returns a value usefulfor error checking.

setutent() Resets the input stream to the beginning of the file. This should be done beforeeach search for a new entry if it is desired that the entire file be examined.

endutent() Closes the currently open file.

utmpname() Allows the user to change the name of the file being examined from /etc/utmpand /etc/utmpx to any other file(s). In this case, the name provided to utmp-name will be used for the utmp functions. An "x" will be appended to this name, andwill be used by the getutx functions. The one exception to this are the putut(x) func-tions as they access both files in an attempt to keep the utmp and utmpx files insync. The other file(s) are usually /var/adm/wtmp and /var/adm/wtmpx . Ifthe file(s) do not exist, its absence is not discovered until the first subsequentattempt to reference the file. utmpname() does not open the file — it merelycloses the old file if it is currently open, and saves the new file name.

The most current entry is saved in a static structure. Multiple accesses require that the structure becopied before further accesses are made. During each call to either getutid() or getutline() , thestatic structure is examined before performing more I/O. If the contents of the static structure matchwhat the routine is searching for, no additional searching is done. Therefore, if using getutline() tosearch for multiple occurrences, it is necessary to zero out the static structure after each success; other-wise getutline() simply returns the same pointer over and over again. There is one exception to therule about removing the structure before a new read: The implicit read done by pututline() (if itfinds that it is not already at the correct place in the file) does not alter the contents of the static structurereturned by getutent() , getutid() , or getutline() if the user has just modified those contentsand passed the pointer back to pututline() .

Obsolescent Interfacesgetutent_r() , getutid_r() , getutline_r() , pututline_r() , setutent_r() ,endutent_r() , utmpname_r() access utmp file entry.

RETURN VALUEThese functions return a NULL pointer upon failure to read (whether for permissions or having reachedend-of-file), or upon failure to write. They also return a NULL pointer if the size of the file is not anintegral multiple of sizeof(struct utmp) .

_pututline() behaves the same as pututline() , except that it returns a pointer to a static locationcontaining the most current utmp entry if the _pututline() call succeeds. The contents of this struc-ture is identical to the contents of the supplied utmp structure if successful. If _pututline() failsupon writing to utmp , it returns a NULL pointer. If _putuline() is successful in writing to theutmp file and fails in writing to the utmpx file, then _pututline will behave as if it succeeded. Pleasenote that the utmp file and the utmpx file may not be in sync due to the above behavior. putut-line() and _pututline() are only guaranteed to have written to the utmp file upon successfulcompletion.

Section 3−−430 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getut(3C) getut(3C)(TO BE OBSOLETED)

Reentrant InterfacesUpon successful completion, getutent_r() , getutid_r() , getutline_r() andpututline_r() return 0. Otherwise, they all return -1 and set errno .

ERRORSReentrant Interfaces

[EINVAL] utmp or ud parameter is equal to NULL .

WARNINGSgetutent_r() , getutid_r() , getutline_r() , pututline_r() , setutent_r() ,endutent_r() , and utmpname_r() are obsolescent interfaces supported only for compatibility withexisting DCE applications. New multithreaded applications should use use the getutx functions that pro-vide equivalent functionality.

Some vendors’ versions of getutent() erase the utmp file if the file exists but is not an integral multi-ple of sizeof(struct utmp) . Given the possibility of user error in providing a name to utmpname(such as giving improper arguments to who(1)), HP-UX does not do this, but instead returns an errorindication.

For portability, getutx functions are preferred over these functions.

FILES/etc/utmp/etc/utmpx/var/adm/wtmp

SEE ALSOutmpd(1M), getutx(3C), getuts(3C), pututxline(3C), ttyslot(3C), utmp(4), thread_safety(5).

STANDARDS CONFORMANCEendutent() : SVID2, SVID3, XPG2

getutent() : SVID2, SVID3, XPG2

getutid() : SVID2, SVID3, XPG2

getutline() : SVID2, SVID3, XPG2

pututline() : SVID2, SVID3, XPG2

setutent() : SVID2, SVID3, XPG2

utmpname() : SVID2, SVID3, XPG2

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−431

A gA

getuts(3C) getuts(3C)

NAMEgetuts: getutsent(), getutsid(), getutsline(), pututsline(), setutsent(), endutsent() - access/update routinesfor user-accounting database maintained by utmpd(1M)

SYNOPSIS#include <utmps.h>

struct utmps * getutsent(size_t utmps_size):

struct utmps * getutsid(const struct utmps *id, size_t utmps_size):

struct utmps * getutsline(const struct utmps *line, size_t utmps_size):

struct utmps * pututsline(const struct utmps *utmps, size_t utmps_size):

struct utmps * getutspid( pid_t pid, size_t utmps_size):

void setutsent(void):

void endutsent(void):

RemarksThe size of the utmps structure (for example sizeof(struct utmps) ) is passed as utmps_sizeparameter in the above calls.

A macro equivalent exists for each of the above function calls. These macros provide a shorthand way ofcalling getuts (3C) functions, by implicitly passing the utmps_size parameter to the correspondinggetuts (3C) function.

struct utmps * GETUTSENT():

struct utmps * GETUTSID(const struct utmps *id):

struct utmps * GETUTSLINE(const struct utmps *line):

struct utmps * PUTUTSLINE(const struct utmps * utmps):

struct utmps * GETUTSPID( pid_t pid):

void SETUTSENT(void):

void ENDUTSENT(void):

DESCRIPTIONgetutsent() , getutsid() , and getutsline() each return a pointer to a utmps structure, thekey elements of the utmps structure are

char ut_user[] User login namechar ut_id[] Unique Id to distinguish an entrychar ut_line[] Device namepid_t ut_pid Process Idshort ut_type Type of Entrystruct ut_exit The exit status of a processstruct timeval ut_tv Time entry was madechar ut_host[] Host name, if remoteuint8_t ut_addr[] Internet Address of the Host,

if remoteshort ut_addr_type Flag to identify type of address

in ut_addr

Routinesgetutsent() This call returns the next record from the in-memory user accounting database

maintained by utmpd (1M). When the end of the utmpd ’s database is reachedgetutsent() fails and returns NULL. The macro GETUTSENT() is awrapper around getutsent() and implicitly passes the utmps_size parame-ter.

getutsid() For entries of ut_type matching INIT_PROCESS, LOGIN_PROCESS,USER_PROCESSand DEAD_PROCESS, getutsid() searches the utmpd ’sdatabase for an entry matching id->ut_id field. The record is fetched irrespec-tive of the current position in the internal ordering and does not alter the

Section 3−−432 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getuts(3C) getuts(3C)

current position in the internal ordering for the getutsent() API.

If ut_type specified is RUN_LVL, BOOT_TIME, OLD_TIME, or NEW_TIME,getutsid() fetches an entry with a ut_type matching id->ut_type . If nomatching entry is found getutsid() fails and returns NULL. The macroGETUTSID() is a wrapper around getutsid() and implicitly passes theutmps_size parameter to getutsid() .

getutsline() This is similar to getutsid() . It searches the utmpd (1M)’s database for anentry of type LOGIN_PROCESSor USER_PROCESSthat also has the ut_linefield matching the line->ut_line string. If the entry is not found in theutmpd() ’s database, getutsline() fails and returns NULL. The record isfetched irrespective of the current position in the internal ordering and does notalter the internal ordering for the getutsent() API. The macro GETUTS-LINE() is a wrapper around getutsline() and implicitly passes theutmps_size parameter to getutsline() .

pututsline() Writes out the supplied utmps structure into the in-memory user accountingdatabase maintained by utmpd (1M). For entries of ut_type matchingINIT_PROCESS, LOGIN_PROCESS, USER_PROCESSand DEAD_PROCESS,pututsline() searches the utmpd (1M)’s database for an entry matchingutmps->ut_id field. If the entry already exists in the utmpd (1M)’s database, thisAPI updates the entry already present. Otherwise, pututsline() adds a newentry into the utmpd (1M)’s database.

If ut_type specified is RUN_LVL, BOOT_TIME, OLD_TIME, or NEW_TIME,pututsline() updates the entry with ut_type matching utmps->ut_type . Themacro PUTUTSLINE() is a wrapper around pututsline() and implicitlypasses the utmps_size parameter to pututsline() .

getutspid() This API searches the utmpd (1M)’s database for an entry with ut_pid matchingthe pid argument. Since pid has significance only for currently ACTIVEprocesses, matching is done only for entries of type INIT_PROCESS,LOGIN_PROCESS, or USER_PROCESS. On finding a matching entry,getutspid() returns the corresponding entry; otherwise, getutspid()fails and returns NULL. The macro GETUTSPID() is a wrapper aroundgetutspid() and implicitly passes the utmps_size parameter togetutspid() .

setutsent() Resets the requests for getutsent() to begin from the start of theutmpd (1M)’s database. It also clears out the static structure. The macroSETUTSENT() is a wrapper around setutsent() .

endutsent() It closes any open file descriptors and clears out the static structure. The macroENDUTSENT() is a wrapper around endutsent() .

The specific calling convention of passing the expected data structure size is used in order to allow forfuture expansion of the interface, and the utmps structure while preserving backward compatibility forprograms written using the getuts (3C) interfaces.

The interfaces encode the version information of the utmps structure in the utmps_size parameter.Should the utmps structure change in a future release, utmpd (1M) and libc interfaces detect the versionof the utmps structure the application was compiled with based on the utmps_size parameter and returnthe appropriate utmps structure.

The getuts (3C) interfaces use /etc/utmps file only when the utmpd (1M) is not running. This featuremay be discontinued in a future release.

The ut_addr field in the utmps structure can hold a 16 byte IPv6 address. In case applications want towrite a four byte IPv4 address into this field, they must initialize the ut_addr_type field toIPV4_ADDRESSand use the last four bytes of the ut_addr field. Applications which write an IPv6address into the ut_addr field must initialize the ut_addr_type to IPV6_ADDRESS.

IPV4_ADDRESSand IPV6_ADDRESSare macros defined in utmps.h header file.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−433

A gA

getuts(3C) getuts(3C)

RETURN VALUEgetutsent() , getutsid() , getutsline() , pututsline() , and getutspid() return apointer to static utmps structure on success. On failure they return NULL.

ERRORS[EINVAL] The size parameter passed to the getuts functions does not match any of the struc-

ture sizes supported by the server.

WARNINGSIf the size of a member of the utmps structure changes in a future release, applications compiled witholder version of the utmps structure will get truncated information for the structure fields that haveexpanded. To get the complete information the applications have to be re-compiled.

The value returned by getutsent() , getutsid() , getutsline() , pututsline() , andgetutspid() points to a single static area that is overwritten by each call to any of the functions, so itmust be copied if it is to be saved.

AUTHORThe getuts() routines were developed by Hewlett-Packard Company.

FILES/etc/utmps

SEE ALSOutmpd(1M), bwtmps(3C), thread_safety(5).

Section 3−−434 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

getutx(3C) getutx(3C)

NAMEgetutxent( ), getutxid( ), getutxline( ), pututxline( ), setutxent( ), endutxent( ) - access utmpx file entry

SYNOPSIS#include <utmpx.h>

struct utmpx *getutxent(void);

struct utmpx *getutxid(const struct utmpx *id);

struct utmpx *getutxline(const struct utmpx *line);

struct utmpx *pututxline(const struct utmpx *utmpx);

void setutxent(void);

void endutxent(void);

DESCRIPTIONgetutxent() , getutxid() , and getutxline() each return a pointer to a structure of the follow-ing type:

struct utmpx {char ut_user[24]; /* User login name */char ut_id[4]; /* /etc/inittab id (usually line #) */char ut_line[12]; /* device name (console, lnxx) */pid_t ut_pid; /* process id */short ut_type; /* type of entry */struct __exit_status {

short __e_termination; /* Process termination status */short __e_exit; /* Process exit status */} ut_exit; /* The exit status of a process */

/* marked as DEAD_PROCESS. */unsigned short ut_reserved1; /* Reserved for future use */struct timeval {

time_t tv_sec; /* seconds */long tv_usec; /* and microseconds */} ut_tv; /* time entry was made */

char ut_host[64]; /* host name, if remote; NOT SUPPORTED */unsigned long ut_addr; /* Internet addr of host, if remote */char ut_reserved2[12] ; /* Reserved for future use */

};

getutxent() Reads in the next entry from a utmpx -like file. If the file is not already open,getutxent() opens it. If it reaches the end of the file, getutxent() fails.

getutxid() Searches forward from the current point in the utmpx file until it finds an entrywith a ut_type matching id−>ut_type if the type specified is RUN_LVL,BOOT_TIME, OLD_TIME, or NEW_TIME. If the type specified in id isINIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS,getutxid() returns a pointer to the first entry whose type is one of these four,and whose ut_id field matches id−>ut_id . If end-of-file is reached without amatch, getutxid() fails.

getutxline() Searches forward from the current point in the utmpx file until it finds an entry oftype LOGIN_PROCESSor USER_PROCESSthat also has a ut_line stringmatching the line−>ut_line string. If end-of-file is reached without a match,getutxline() fails.

pututxline() Writes out the supplied utmpx structure into the utmpx file, translates the sup-plied utmpx structure into a utmp structure and writes it to a utmp file.pututxline() uses getutxid() to search forward for the proper location if itis not already there. It is normally expected that the application program hasalready searched for the proper entry by using one of the getutx() routinesbefore calling pututxline() . If the search has already been made, pututx-line() does not repeat it. If pututxline() does not find a matching slot forthe new entry, it adds a new entry to the end of the file.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−435

A gA

getutx(3C) getutx(3C)

setutxent() Resets the input stream to the beginning of the file. This should be done beforeeach search for a new entry if it is desired that the entire file be examined.

endutxent() Closes the currently open file.

The most current entry is saved in a static structure. Multiple accesses require that the structure becopied before further accesses are made. During each call to either getutxid() or getutxline() ,the static structure is examined before performing more I/O. If the contents of the static structure matchwhat the routine is searching for, no additional searching is done. Therefore, if using getutxline()to search for multiple occurrences, it is necessary to zero out the static structure after each success; other-wise getutxline() simply returns the same pointer over and over again. There is one exception tothe rule about removing the structure before a new read: The implicit read done by pututxline() (ifit finds that it is not already at the correct place in the file) does not alter the contents of the static struc-ture returned by getutxent() , getutxid() , or getutxline() if the user has just modified thosecontents and passed the pointer back to pututxline() .

RETURN VALUEThese functions return a NULL pointer upon failure to read (whether for permissions or having reachedend-of-file), or upon failure to write. They also return a NULL pointer if the size of the file is not anintegral multiple of sizeof(struct utmpx) .

If pututxline() is successful, it returns a pointer to a static location containing the most currentutmpx entry. The contents of this structure are identical to the contents of the supplied utmpx struc-ture if successful. If pututline() fails upon writing to utmpx , it returns a NULL pointer. If putu-line() is successful in writing to the utmpx file but fails in writing to the utmp file, then putut-line() will behave as if it succeeded. Note that the utmpx file and the utmp file may not be in syncdue to the above behavior. pututxline() is only guaranteed to have written to the utmpx file uponsuccessful completion.

FILES/etc/utmp/etc/utmpx/var/adm/wtmp

SEE ALSOgetut(3C), getutent(3C), ttyslot(3C), utmp(4), thread_safety(5).

STANDARDS CONFORMANCEendutxent() : XPG4.2

getutxent() : XPG4.2

getutxid() : XPG4.2

getutxline() : XPG4.2

pututxline() : XPG4.2

setutxent() : XPG4.2

Section 3−−436 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getwc(3C) getwc(3C)

NAMEgetwc(), getwchar(), fgetwc(), getwc_unlocked(), getwchar_unlocked(), fgetwc_unlocked() - get a wide char-acter from a stream file

SYNOPSIS#include <wchar.h>

wint_t getwc(FILE *stream);

wint_t getwchar(void);

wint_t fgetwc(FILE *stream);

Obsolescent Interfaceswint_t getwc_unlocked(FILE *stream);

wint_t getwchar_unlocked(void);

wint_t fgetwc_unlocked(FILE *stream);

RemarksThese functions are compliant with the XPG4 Worldwide Portability Interface wide-character I/O func-tions. They parallel the 8-bit character I/O functions defined in getc (3S).

DESCRIPTIONgetwc() Returns the next character from the named input stream , converts that to the

corresponding wide character and moves the file pointer ahead one character in stream .getwchar() is defined as getwc(stdin) . getwc() and getwchar() are definedboth as macros and as functions.

fgetwc() Behaves like getwc() , but is a function rather than a macro.

Definitions for these functions, the types wint_t , wchar_t and the value WEOFare provided in headerfile <wchar.h> .

Obsolescent Interfacesgetwc_unlocked() , getwchar_unlocked() , fgetwc_unlocked() get a wide character from astream file.

APPLICATION USAGEAfter getwc() , getwchar() , or fgetwc() is applied to a stream, the stream becomes wide-oriented(see orientation (5)).

RETURN VALUEUpon successful completion, getwc() , getwc_unlocked() , getwchar() ,getwchar_unlocked() , fgetwc() , and fgetwc_unlocked() return the next wide-characterread from stream (stdin for getwchar() ) converted to a type wint_t . If the stream is at end-of-file,the end-of-file indicator for the stream is set and WEOFis returned. If a read error occurs, the error indi-cator for the stream is set, errno is set to indicate the error, and WEOFis returned.

ferror() and feof() can be used to distinguish between an error condition and an end-of-file condi-tion.

ERRORSgetwc() , getwc_unlocked() , getwchar() , getwchar_unlocked() , fgetwc() , andfgetwc_unlocked() fail if data needs to be read into the stream ’s buffer, and:

[EAGAIN] The O_NONBLOCKflag is set for the file descriptor underlying stream and the pro-cess would be delayed in the read operation.

[EBADF] The file descriptor underlying stream is not a valid file descriptor open for reading.

[EINTR] The read operation was terminated due to the receipt of a signal, and either no datawas transferred or the implementation does not report partial transfer for this file.

[EIO] A physical I/O error has occurred, or the process is a member of a background pro-cess and is attempting to read from its controlling terminal, and either the processis ignoring or blocking the SIGTTIN signal or the process group of the process isorphaned.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−437

A gA

getwc(3C) getwc(3C)

[EILSEQ] The data obtained from the input stream does not form a valid wide character.

Additional errno values may be set by the underlying read() function (see read (2)).

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines how wide-character conversions are done.

International Code Set SupportSingle- and multibyte character code sets are supported.

WARNINGSIf the value returned by getwc() , getwchar() , fgetwc() , or fgetwc_unlocked() is stored intoa type wchar_t variable then compared against the constant WEOF, the comparison may never succeedbecause extension of a wchar_t to a wint_t is machine-dependent.

getwc_unlocked() , getwchar_unlocked() and fgetwc_unlocked() are obsolescent inter-faces supported only for compatibility with existing DCE applications. New multithreaded applicationsshould use getwc() , getwchar() and fgetwc() .

AUTHORgetwc() was developed by OSF and HP.

SEE ALSOfclose(3S), ferror(3S), flockfile(3S), fopen(3S), fread(3S), fgetws(3C), orientation(5), putwc(3C), read(2),scanf(3S), orientation(5), thread_safety(5).

STANDARDS CONFORMANCEgetwc() : XPG4

fgetwc() : XPG4

getwchar() : XPG4

Section 3−−438 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

getwd(3C) getwd(3C)

NAMEgetwd( ) - get pathname of current working directory

SYNOPSIS#include <unistd.h>

char *getwd(char *buf);

DESCRIPTIONgetwd() places the absolute pathname of the current working directory in the array pointed to by buf ,and returns buf .

If the length of the pathname of the current working directory is greater than PATH_MAX+1 bytes,getwd() fails and returns a null pointer.

RETURN VALUEUpon successful completion, getwd() returns a pointer to the current directory pathname. Otherwise,it returns NULL with errno set.

ERRORSgetwd() fails if the following condition is encountered:

[ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX+1bytes, or thelength of a component of the path name exceeds NAME_MAXbytes while_POSIX_NO_TRUNCis in effect.

getwd() may fail if any of the following conditions are encountered:

[EACCES] Read or search permission is denied for a component of pathname.

[EFAULT] buf points outside the allocated address space of the process. getwd() maynot always detect this error.

EXAMPLES#include <stdio.h>#include <unistd.h>char *cwd;char buf[PATH_MA X + 1 ];

. . .if ((cwd = getwd(buf)) == NULL) {

perror("getwd");exit(1);

}puts(cwd);

WARNINGSFor portability, getcwd() is preferred over this function.

AUTHORgetwd() was developed by HP and the University of California, Berkeley.

SEE ALSOgetcwd(3C), thread_safety(5).

STANDARDS CONFORMANCEgetwd() : XPG4.2

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−439

A gA

getwin(3X) getwin(3X)(ENHANCED CURSES)

NAMEgetwin, putwin — dump window to, and reload window from, a file

SYNOPSIS#include <curses.h>

WINDOW *getwin(FILE * filep);

int putwin(WINDOW * win, FILE * filep);

DESCRIPTIONThe getwin() function reads window-related data stored in the file by putwin() . The function thencreates and initialises a new window using that data.

The putwin() function writes all data associated with win into the stdio stream to which filep points,using an unspecified format. This information can be retrieved later using getwin() .

RETURN VALUEUpon successful completion, getwin() returns a pointer to the window it created. Otherwise, it returnsa null pointer.

Upon successful completion, putwin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOscr_dump(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−440 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

getyx(3X) getyx(3X)(CURSES)

NAMEgetyx — get cursor and window coordinates

SYNOPSIS#include <curses.h>

void getyx(WINDOW * win, int y, int x);

DESCRIPTIONThe getyx() macro stores the cursor position of the specified window in y and x.

RETURN VALUENo return values are defined.

ERRORSNo errors are defined.

APPLICATION USAGEThese interfaces are macros and ‘&’ cannot be used before the y and x arguments.

SEE ALSOgetbegyx(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−441

A gA

get_expiration_time(3T) get_expiration_time(3T)

NAMEget_expiration_time() - add a specific time interval to the current absolute system time

SYNOPSIS#include <time.h>

int get_expiration_time(struct timespec *delta,struct timespec *abstime

);

DESCRIPTIONThe get_expiration_time() function adds a specific time interval to the current absolute systemtime and returns the new absolute time. This new absolute time is used as the expiration time in a call topthread_cond_timedwait (3T).

The delta argument represents the number of seconds and nanoseconds to add to the current systemtime. On return from this function, the abstime argument contains the absolute system time that will beused in a call to pthread_cond_timedwait (3T).

Parametersdelta Number of seconds and nanoseconds to add to the current system time.

abstime Output parameter for the absolute system time after adding delta to the current absolutesystem time.

RETURN VALUEUpon successful completion, get_expiration_time() returns zero. Otherwise, an error number isreturned to indicate the error (the errno variable is not set).

ERRORSIf any of the following occur, the get_expiration_time() function returns the corresponding errornumber:

[EINVAL] The value specified by delta or abstime is invalid.

AUTHORget_expiration_time() was developed by X/Open.

SEE ALSOpthread_cond_timedwait(3T).

STANDARDS CONFORMANCEget_expiration_time() : X/Open.

Section 3−−442 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

get_wch(3X) get_wch(3X)(ENHANCED CURSES)

NAMEget_wch, mvget_wch, mvwget_wch, wget_wch — get a wide character from a terminal

SYNOPSIS#include <curses.h>

int get_wch(wint_t * ch);

int mvget_wch(int y, int x, wint_t * ch);

int mvwget_wch(WINDOW * win, int y, int x, wint_t * ch);

int wget_wch(WINDOW * win, wint_t * ch);

DESCRIPTIONThese functions read a character from the terminal associated with the current or specified window. Ifkeypad() is enabled, these functions respond to the pressing of a function key by setting the objectpointed to by ch to the corresponding KEY_ value defined in <curses.h> and returningKEY_CODE_YES.

Processing of terminal input is subject to the general rules described in Input Processing incurses_intro (3X).

If echoing is enabled, then the character is echoed as though it were provided as an input argument toins_wch() , except for the following characters:

<backspace>, <left-arrow> andthe current erase character:

The input is interpreted as specified in special-chars and then the character at the resulting cur-sor position is deleted as though delch() werecalled, except that if the cursor was originally inthe first column of the line, then the user is alertedas though beep() were called.

The user is alerted as though beep() were called.Information concerning the function keys is notreturned to the caller.Function keys

If the current or specified window is not a pad, and it has been moved or modified since the last refreshoperation, then it will be refreshed before another character is read.

RETURN VALUEWhen these functions successfully report the pressing of a function key, they return KEY_CODE_YES.When they successfully report a wide character, they return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEApplications should not define the escape key by itself as a single-character function.

When using these functions, nocbreak() mode and echo() mode should not be used at the same time.Depending on the state of the terminal when each character is typed, the application may produceundesirable results.

SEE ALSObeep(3X), cbreak(3X), ins_wch(3X), keypad(3X), move(3X), curses_intro(3X), see Input Processing,<curses.h>, <wchar.h> (in the X/Open System Interfaces and Headers, Issue 4, Version 2 specification).

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−443

A gA

glob(3C) glob(3C)

NAMEglob(), globfree() - file name generation function

SYNOPSIS#include <glob.h>

int glob(const char *pattern,int flags,int (*errfunc)(const char *, int),glob_t *pglob

);

void globfree(glob_t *pglob);

DESCRIPTIONglob() is a path name generator. pattern is a pointer to a path name pattern to be expanded. If pat-tern contains any of the special characters * , ?, or [ , pattern is matched against all accessible pathnames. In order to have access to a path name, glob() requires:

• Search permission on every component of a path except the last.

• Read permission on each directory of any file name component of pattern that contains any of theabove special characters.

glob() stores the number of matched path names in pglob −> gl_pathc and a pointer to a sorted list ofpath names in pglob − >gl_pathv . The first pointer after the last path name is a NULL pointer.

It is the caller’s responsibility to allocate space for the structure pointed to by pglob . glob() allocatesother space as needed, including the memory pointed to by gl_pathv . globfree() frees any space asso-ciated with pglob from a previous call to glob() .

The flags argument is used to control the behavior of glob() . The value of flags is the bit-wise inclusiveOR of the following constants defined in <glob.h> :

GLOB_NOESCAPE Disable backslash escaping.

GLOB_ERR Causes glob() to return when it first encounters a directory that it cannotopen or read. Ordinarily, glob() continues to find matches.

GLOB_MARK Each path name that matches pattern and is a directory, has a / appended.

GLOB_NOSORT Ordinarily, glob() sorts the matching path names according to the currentlyactive collation sequence as defined by the LC_COLLATEcategory. When thisflag is used, the order of path names returned is unspecified.

GLOB_NOCHECK If pattern does not match any path name, glob() returns a list consisting ofonly pattern , and the number of matched path names is 1.

GLOB_DOOFFS Make use of pglob −> gl_offs . If this flag is set, pglob −> gl_offs is used tospecify how many NULL pointers to add to the beginning of pglob −> gl_pathv .In other words, pglob −> gl_pathv points to pglob −> gl_offs NULL pointers, fol-lowed by pglob −> gl_pathc path name pointers, followed by a NULL pointer.

GLOB_APPEND Append path names generated to the ones from a previous call to glob() .

The GLOB_APPENDflag can be used to append a new set of path names to those found in a previouscall to glob() . The following rules apply when two or more calls to glob() are made with thesame value of pglob and without intervening calls to globfree() :

• The first call must not set GLOB_APPEND. All subsequent calls must set it.

• All of the calls must set GLOB_DOOFFS, or all must not set it.

• After the second call, pglob −> gl_pathv points to a list containing the following:

• Zero or more NULL pointers, as specified by GOB_DOOFFSand pglob −> gl_offs .

• Pointers to the path names that were in the pglob −> gl_pathv list before the call,in the same order as before.

• Pointers to the new path names generated by the second call, in the specifiedorder.

Section 3−−444 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

glob(3C) glob(3C)

• The count returned in pglob −> gl_pathc will be the total number of path names from thetwo calls.

• The application can change any of the fields after a call to glob() . If it does, it must resetthem to the original value before a subsequent call, using the same pglob value, to glob-free() or glob() with the GLOB_APPENDflag.

If, during the search, a directory is encountered that cannot be opened or read and errfunc is not NULL,glob() calls (∗errfunc )( ) with two arguments:

• A pointer to the path that failed.

• The value of errno from the failure.

If errfunc is called and returns nonzero, or if the GLOB_ERRflag is set in flags , glob() stops the scanand returns GLOB_ABORTEDafter setting gl_pathc and gl_pathv in pglob to reflect the pathsalready scanned. If GLOB_ERRis not set and either errfunc is NULL or (∗errfunc )( ) returns zero, theerror is ignored.

Pattern Matching NotationThe form of the patterns is the Pattern Matching Notation as qualified for Filename Expansion (seeregexp (5)) with the following exceptions:

• Tilde (˜ ) expansion is not performed.

• Variable expansion is not performed.

EXTERNAL INFLUENCESLocale

The LC_COLLATEcategory determines the collating sequence used in compiling and executing regularexpressions, and also the order of the returned paths if GLOB_NOSORTis not selected.

The LC_CTYPEcategory determines the interpretation of text as single byte and/or multibyte characters,and determines which characters are matched by character class expressions in regular expressions.

International Code Set SupportSingle byte and multibyte character code sets are supported.

RETURN VALUEIf glob() terminates due to an error, it returns one of the following constants (defined in <glob.h> );otherwise, it returns zero.

GLOB_NOSPACE An attempt to allocate memory failed.

GLOB_ABORTED The scan was stopped because GLOB_ERRwas set or (∗errfunc )( ) returnednonzero.

GLOB_NOMATCH The pattern does not match any existing path name, and GLOB_NOCHECKwasnot set in flags .

In any case, the argument pglob −> gl_pathc returns the number of matched path names and the argu-ment pglob −> gl_pathv contains a pointer to a null-terminated list of matched and sorted path names.

However, if pglob −> gl_pathc is zero, the content of pglob −> gl_pathv is undefined.

If the pattern argument passed to glob() is badly constructed, glob() returns zero and setsgl_pathc to zero unless GLOB_NOCHECKwas set, in which case pattern is returned and gl_pathc isset to 1.

WARNINGSGLOB_APPENDmust not be set in an initial call to glob() .

AUTHORglob() and globfree() were developed by OSF and HP.

SEE ALSOsh(1), fnmatch(3C), regexp(5), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−445

A gA

glob(3C) glob(3C)

STANDARDS CONFORMANCEglob() : XPG4, POSIX.2

globfree() : XPG4, POSIX.2

Section 3−−446 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

grantpt(3C) grantpt(3C)

NAMEgrantpt - grant access to the STREAMS slave pty

SYNOPSISint grantpt (int fildes);

DESCRIPTIONThe passed parameter, fildes , is a file descriptor that is returned from a successful open of a STREAMSmaster pty (pseudo-terminal) device. The grantpt() function modifies the ownership and mode of theslave pty device special file associated with its master pty counterpart.

A setuid() root program is spawned to change ownership and mode of the pty slave device file in thefollowing way: The group ID is set to a reserved group named "tty". The slave user ID is set to theeffective owner of the calling process. The permissions of the slave device are set so that the owner isallowed read and write access and the group is allowed write access.

RETURN VALUEUpon successful completion, the grantpt() function returns a value of 0 (zero). Otherwise, it returnsa value of -1.

Failure may result under the following conditions:

• The file descriptor specified by the fildes parameter is not an open file descriptor.

• The file descriptor specified by the fildes parameter is not associated with a STREAMS masterpty device.

• The corresponding slave pty device cannot be accessed.

WARNINGSThe grantpt() function may also fail if the application has installed a signal handler to catch theSIGCHLD (death of a child) signal.

EXAMPLESThe following example shows how grantpt() is typically used.

int fd_master, fd_slave;char *slave;

. . .fd_master = open("/dev/ptmx", O_RDWR);grantpt(fd_master);unlockpt(fd_master);slave = ptsname(fd_master);fd_slave = open(slave, O_RDWR);ioctl(fd_slave, I_PUSH, "ptem");ioctl(fd_slave, I_PUSH, "ldterm");

AUTHORgrantpt() was developed by HP and OSF.

SEE ALSOopen(2), unlockpt(3C), ptsname(3C), ptm(7), pts(7), ptem(7), ldterm(7).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−447

A gA

gss_accept_sec_context(3) gss_accept_sec_context(3)

NAMEgss_accept_sec_context( ) - establish a security context between the application and a context acceptor

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_accept_sec_context (OM_uint32 *minor_status,gss_ctx_id_t *context_handle,const gss_cred_id_t acceptor_cred_handle,const gss_buffer_t input_token_buffer,const gss_channel_bindings_t input_chan_bindings,const gss_name_t *src_name,gss_OID *actual_mech_type,gss_buffer_t output_token,int *ret_flags,OM_uint32 *time_recgss_cred_id_t *delegated_cred_handle)

DESCRIPTIONThe gss_accept_sec_context() routine is the second step in establishing a security contextbetween the context initiator and a context acceptor. In the first step, the context initiator calls thegss_init_sec_context() routine. The gss_init_sec_context() routine generates a tokenfor the security context and passes it to the context initiator. The context initiator sends the token to thecontext acceptor.

In the second step, the context acceptor accepts the call from the context initiator and calls thegss_accept_sec_context() routine. The gss_accept_sec_context() routine expects avalue for the input_token parameter. The value for the input_token parameter is generated by thegss_init_sec_context() routine and passed by the initiator to the acceptor.

The gss_accept_sec_context() routine can also return a value for the output_token parameter.The context acceptor presents the token to the gss_init_sec_context() routine. If the acceptordoes not need to send a token to the initiator, gss_accept_sec_context() sets the length field ofthe output_token parameter to 0 (zero).

To complete establishing the context, the context initiator can require one or more reply tokens from thecontext acceptor. If the application requires reply tokens, the gss_accept_sec_context() routinereturns a status value containing GSS_S_CONTINUE_NEEDED. The application calls the routine againwhen the reply token is received from the context acceptor. The application passes the token to thegss_accept_sec_context() routine via the output_token parameters.

The values returned using the src_name , ret_flags , time_rec , and delegated_cred_handle parameters arenot defined unless the routine returns the status, GSS_S_COMPLETE.

Input Parametersacceptor_cred_handle Specifies the credential handle (the identity) claimed by the context acceptor.

This is optional information. The credential must be either an ACCEPT typecredential or a BOTH type credential. Specify GSS_C_NO_CREDENTIAL, toaccept the context as default principal

input_token_buffer Specifies the token received from the context acceptor.

input_chan_bindings Specifies bindings supplied by the context initiator. Allows the context initiator tobind the channel identification information securely to the security context. If nochannel bindings are used, specify GSS_C_NO_CHANNEL_BINDINGS.

Input/Output Parameterscontext_handle Specifies a context handle for a new context. The first time the context initiator

uses the routine, specify GSS_C_NO_CONTEXTto set up a specific context. Insubsequent calls, use the value returned by this parameter.

Output Parameterssrc_name Returns the authenticated name of the context initiator. This information is

optional. If the authenticated name is not required, specify NULL. To deallocatethe authenticated name, pass it to the gss_release_name() routine.

Section 3−−448 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_accept_sec_context(3) gss_accept_sec_context(3)

actual_mech_type Actual mechanism used. Specify NULL if not required.

output_token Returns a token to pass to the context acceptor. If no token is to be passed to thecontext acceptor, the routine sets the length field of the returned token buffer to 0(zero).

ret_flags Returns a bitmask containing six independent flags, each of which requests thatthe context support a service option. The following symbolic names are providedto correspond to each flag. The symbolic names should be logically ANDed withthe value of ret_flags to test whether the context supports the service option.

GSS_C_DELEG_FLAG. The True/False values are:

True Delegated credentials are available from the delegated_cred_handleparameter.

False No credentials were delegated.

GSS_C_MUTUAL_FLAG. The True/False values are:

True The context acceptor requested mutual authentication.

False The context acceptor did not request mutual authentication.

GSS_C_REPLAY_FLAG. The True/False values are:

True Replayed signed or sealed messages will be detected.

False Replayed messages will not be detected.

GSS_C_SEQUENCE_FLAG. The True/False values are:

True Out-of-sequence signed or sealed messages will be detected.

False Out-of-sequence signed or sealed messages will not be detected.

GSS_C_CONF_FLAG. The True/False values are:

True Confidentiality services are available by calling the gss_seal()routine.

False Confidentiality services are not available. However, the applicationcan call the gss_seal() routine to provide message encapsula-tion, data-origin authentication, and integrity services.

GSS_C_INTEG_FLAG. The True/False values are:

True Integrity services can be invoked by calling either thegss_sign() or gss_seal() routine.

False Integrity services for individual messages are not available.

GSS_C_ANON_FLAG. The True/False values are:

True The initiator’s identity has not been revealed, and will not berevealed if any emitted token is passed to the acceptor.

False The initiator’s identity has been or will be authenticated normally.

GSS_C_PROT_READY_FLAG. The True/False values are:

True Protection services (as specified by the states of theGSS_C_CONF_FLAGand GSS_C_INTEG_FLAG) are available foruse if the accompanying major status return value is eitherGSS_S_COMPLETEor GSS_S_CONTINUE_NEEDED.

False Protection services (as specified by the states of theGSS_C_CONF_FLAGand GSS_C_INTEG_FLAG) are availableonly if the accompanying major status return value isGSS_S_COMPLETE.

GSS_C_TRANS_FLAG. The True/False values are:

True The resultant security context may be transferred to otherprocesses via a call to gss_export_sec_context() .

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−449

A gA

gss_accept_sec_context(3) gss_accept_sec_context(3)

False The security context is not transferable.

time_rec Returns the number of seconds for which the context remains valid. This isoptional information. If the time is not required, specify NULL.

delegated_cred_handle Returns the credential handle for credentials received from the context initiator.The credential handle is valid only if delegated credentials are available. If theret_flags parameter is true, the flag GSS_C_DELEG_FLAGs set, indicating thatdelegated credentials are available.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_BINDINGSThe input_token parameter contains different channel bindings from thosespecified with the input_chan_bindings parameter.

GSS_S_BAD_SIG The input_token parameter contains an invalid signature.

GSS_S_CONTINUE_NEEDEDTo complete the context, the gss_accept_sec_context() routine mustbe called again with a token required from the context acceptor.

GSS_S_CREDENTIALS_EXPIREDThe referenced credentials have expired.

GSS_S_DEFECTIVE_CREDENTIALConsistency checks performed on the credential failed.

GSS_S_DEFECTIVE_TOKENConsistency checks performed on the input_token parameter failed.

GSS_S_DUPLICATE_TOKENThe input_token parameter was already processed. This is a fatal error thatoccurs during context establishment.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

GSS_S_NO_CRED Indicates either the supplied credentials were not valid for context acceptanceor the credential handle did not reference any credentials.

GSS_S_OLD_TOKEN The input_token parameter was too old. This is a fatal error that occurs dur-ing context establishment.

GSS_S_BAD_MECH The received token specified a mechanism that is not supported

AUTHORgss_accept_sec_context() was developed by Sun Microsystems, Inc.

SEE ALSOgss_acquire_cred(3), gss_delete_sec_context(3), gss_init_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−450 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A gA

gss_acquire_cred(3) gss_acquire_cred(3)

NAMEgss_acquire_cred( ) - allow an application to acquire a handle for an existing, named credential

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_acquire_cred (OM_uint32 *minor_status,const gss_name_t desired_name,OM_uint32 time_req,const gss_OID_set desired_mechs,int cred_usage,gss_cred_id_t *output_cred_handle,gss_OID_set *actual_mechs,OM_int32 *time_rec );

DESCRIPTIONThe gss_acquire_cred() routine allows an application to obtain a handle for a pre-existing creden-tial by name. The credentials could be either an ACCEPT, INITIATE, or BOTH. The application thenpasses the credential handle to either the gss_init_sec_context() or thegss_accept_sec_context() routine. If desired_name is GSS_C_NO_NAME, the call is interpretedas a request for a credential handle that will invoke default behavior.

Input Parametersdesired_name Specifies the principal name to use for the credential.

time_req Number of seconds that credentials remain valid. Specify GSS_C_INDEFINITEto request that the credentials have the maximum permitted lifetime.

desired_mechs Specifies the OID set for the security mechanism to use with the credential. Tohelp ensure portability of your application, request the default security mechan-ism by specifying GSS_C_NULL_OID_SET.

cred_usage Specify one of the following:

GSS_C_BOTH Specifies credentials that the context initiator can use toeither initiate or accept security contexts.

GSS_C_INITIATE Specifies credentials that the context initiator can useonly to initiate security contexts.

GSS_C_ACCEPT Specifies credentials that the context initiator can useonly to accept security contexts.

Output Parametersoutput_cred_handle Returns the handle for the return credential.

actual_mechs Returns a set of mechanisms for which the credential is valid. This information isoptional. If you do not want a set of mechanisms returned, specify NULL.

time_rec Returns the actual number of seconds for which the return credential remainsvalid. This information is optional. If the actual number of seconds is notrequired, specify NULL.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following list explains the GSS status codes that can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_MECH The requested security mechanism is unsupported or unavailable.

GSS_S_BAD_NAMETYPEThe name passed by the desired_name parameter is unsupported.

GSS_S_BAD_NAME An invalid name was passed by the desired_name parameter.

GSS_S_CREDENTIALS_EXPIREDThe credentials could not be acquired, because they have expired.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−451

A gA

gss_acquire_cred(3) gss_acquire_cred(3)

GSS_S_NO_CRED No credentials were found for the specified name.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

AUTHORgss_acquire_cred() was developed by Sun Microsystems, Inc.

SEE ALSOgss_init_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−452 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

gss_add_cred(3) gss_add_cred(3)

NAMEgss_add_cred( ) - adds a credential-element to a credential

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_add_cred (OM_uint32 *minor_status,const gss_cred_id_t input_cred_handle,const gss_name_t desired_name,const gss_OID desired_mech,gss_cred_usage_t cred_usage,OM_uint32 initiator_time_req,OM_uint32 acceptor_time_req,gss_cred_id_t *output_cred_handle,gss_OID_set *actual_mechs,OM_uint32 *initiator_time_rec,OM_uint32 *acceptor_time_rec);

DESCRIPTIONThe gss_add_cred() routine adds a credential-element to a credential. The credential-element isidentified by the name of the principal to which it refers.

If desired_name is GSS_C_NO_NAME, the call is interpreted as a request to add a credential element thatwill invoke default behavior when passed to gss_init_sec_context() orgss_accept_sec_context() . This routine can be used to either compose a new credential contain-ing all credential-elements of the original in addition to the newly-acquire credential-element, or to addthe new credential- element to an existing credential. If NULL is specified for the output_cred_handlearameter argument, the new credential-element will be added to the credential identified byinput_cred_handle ; if a valid pointer is specified for the output_cred_handle parameter, a new credentialhandle will be created.

If GSS_C_NO_CREDENTIALis specified as the input_cred_handle , gss_add_cred() will compose acredential based on default behavior.

Input Parametersinput_cred_handle Specifies the handle to credential structure to which a credential-element will be

added. If GSS_C_NO_CREDENTIALis specified, the routine will compose thenew credential based on default behavior

desired_name Specifies the principal name whose credential should be acquired.

desired_mechs Specifies the OID set for the security mechanism for which the new credentialmay be used.

initiator_time_req Specifies the number of seconds that credentials remain valid. for initiating secu-rity contexts. This argument is ignored if the composed credentials are of typeGSS_C_ACCEPT. Specify GSS_C_INDEFINITE to request that the credentialshave the maximum permitted initiator lifetime.

acceptor_time_req Specifies the number of seconds that credentials remain valid. for accepting secu-rity contexts. This argument is ignored if the composed credentials are of typeGSS_C_INITIATE . Specify GSS_C_INDEFINITE to request that the creden-tials have the maximum permitted acceptor lifetime.

cred_usage Specify one of the following:

GSS_C_BOTH Specifies credentials that the context initiator can use toeither initiate or accept security contexts.

GSS_C_INITIATE Specifies credentials that the context initiator can useonly to initiate security contexts.

GSS_C_ACCEPT Specifies credentials that the context initiator can useonly to accept security contexts.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−453

A gA

gss_add_cred(3) gss_add_cred(3)

Output Parametersoutput_cred_handle The returned credential handle, containing the new credential-element and all

the credential-elements from input_cred_handle. If NULL is specified for thisparameter, the newly acquired credential-element will be added to the credentialidentified by input_cred_handle.

actual_mechs Returns a set of mechanisms for which the credential is valid. This information isoptional. If you do not want a set of mechanisms returned, specify NULL.

initiator_time_rec Specifies the actual number of seconds that credentials remain valid for initiatingsecurity contexts using the specified mechanism. If the implementation ormechanism does not support expiration of credentials, the valueGSS_C_INDEFINITE will be returned.

acceptor_time_rec Specifies the actual number of seconds that credentials remain valid for acceptingsecurity contexts using the specified mechanism. If the implementation ormechanism does not support expiration of credentials, the valueGSS_C_INDEFINITE will be returned.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following list explains the GSS status codes that can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_MECH The requested security mechanism is unsupported or unavailable.

GSS_S_BAD_NAMETYPEThe name passed by the desired_name parameter is unsupported.

GSS_S_BAD_NAME An invalid name was passed by the desired_name parameter.

GSS_S_DUPLICATE_ELEMENTThe credential already contains an element for the requested mechanism withoverlapping usage and validity period.

GSS_S_CREDENTIALS_EXPIREDThe required credentials could not be added because they have expired.

GSS_S_NO_CRED No credentials were found for the specified name.

AUTHORgss_add_cred() was developed by Sun Microsystems, Inc.

SEE ALSOgss_init_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−454 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

gss_add_oid_set_member(3) gss_add_oid_set_member(3)

NAMEgss_add_oid_set_member( ) - add an Object Identifier (OID) to an OID set

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_add_oid_set_member (OM_uint32* minor_status,gss_OID* member_OID,gss_OID_set* OID_set)

DESCRIPTIONThe gss_add_oid_set_member() routine adds a new Object Identifier to an Object Identifier set. Ifan OID set does not exist, you can create a new, empty OID set with thegss_create_empty_oid_set() routine.

Input Parametersmember_OID Specifies the OID you want to add to the OID set.

OID_set Specifies an OID set.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_add_oid_set_member() was developed by Sun Microsystems, Inc.

SEE ALSOgss_create_empty_oid_set(3), gss_acquire_cred(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−455

A gA

gss_canonicalize_name(3) gss_canonicalize_name(3)

NAMEgss_canonicalize_name( ) - convert an internal name to an internal mechanism name (MN) representationof an opaque internal name

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_canonicalize_name (OM_uint32 *minor_status,const gss_name_t input_name,const gss_OID *mech_type,gss_name_t *output_name)

DESCRIPTIONThe gss_canonicalize_name() routine generate a canonical mechanism name (MN) from an arbi-trary internal name. The mechanism name is the name that would be returned to a context acceptor onsuccessful authentication of a context where the initiator used the input_name in a successful call togss_acquire_cred() , specifying an Object Identifier (OID) set containing mech_type as its onlymember, followed by a call to gss_init_sec_context() , specifying mech_type as the authenticationmechanism.

Input Parametersinput_name Specifies the name for which a canonical form is desired.

mech_type The authentication mechanism for which the canonical form of the name isdesired. The desired mechanism must be specified explicitly; no default is pro-vided.

Output Parametersoutput_name The resultant canonical name.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_MECH The identified mechanism is not supported.

GSS_S_BAD_NAMETYPEThe provided internal name contains no elements that could be processed bythe specified mechanism.

GSS_S_BAD_NAME The provided internal name was ill-formed.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_canonicalize_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_compare_name(3), gss_import_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−456 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_compare_name(3) gss_compare_name(3)

NAMEgss_compare_name( ) - allow an application to compare two internal names to determine whether they areequivalent

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_compare_name (OM_uint32 *minor_status,const gss_name_t name1,const gss_name_t name2,int *name_equal)

DESCRIPTIONThe gss_compare_name() routine lets an application compare two internal names to determinewhether they are the same. This routine does not resolve the names to see if they refer to the sameobject. It simply compares the input names for equivalence. If either name presented togss_compare_name() denotes an anonymous principal, the routines should indicate that the twonames do not refer to the same identity.

Input Parametersname1 Specifies the first internal name.

name2 Specifies the second internal name.

Output Parametersname_equal Returns one of the following values:

True The names are the same.

False The names are not the same.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAMETYPEThe name passed by the name1 or name2 parameter is unsupported.

GSS_S_BAD_NAME An invalid name was passed by the name1 or name2 parameter.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_compare_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_import_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−457

A gA

gss_context_time(3) gss_context_time(3)

NAMEgss_context_time( ) - check the number of seconds the context will remain valid

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_context_time (OM_uint32 *minor_status,const gss_ctx_id_t context_handle,OM_int32 *time_rec)

DESCRIPTIONThe gss_context_time() routine checks the number of seconds for which the context will remainvalid.

Input Parameterscontext_handle Specifies the context to be checked.

Output Parameterstime_rec Returns the number of seconds that the context will remain valid. Returns a 0

(zero) if the context has already expired.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

AUTHORgss_context_time() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−458 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_create_empty_oid_set(3) gss_create_empty_oid_set(3)

NAMEgss_create_empty_oid_set( ) - create a new, empty OID set, to which members can be added

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_create_empty_oid_set (OM_uint32 *minor_status,gss_OID_set *OID_set);

DESCRIPTIONThe gss_create_empty_oid_set( ) routine creates a new, empty OID set to which the context ini-tiator can add members. Use the gss_add_oid_set_member( ) routine to add members to the OIDset. These routines are intended to be used to construct sets of mechanism object identifiers, for input togss_acquire_cred( ) routine.

Input ParametersOID_set Specifies the OID set you want to create.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_create_empty_oid_set() was developed by Sun Microsystems, Inc.

SEE ALSOgss_add_oid_set_member(3), gss_acquire_cred(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−459

A gA

gss_delete_sec_context(3) gss_delete_sec_context(3)

NAMEgss_delete_sec_context( ) - delete a security context

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_delete_sec_context (OM_uint32 *minor_status,gss_ctx_id_t *context_handle,gss_buffer_t output_token_buffer)

DESCRIPTIONThe gss_delete_sec_context( ) routine deletes a security context. It also deletes the local datastructures associated with the security context. When it deletes the context, the routine can generate atoken. The application passes the token to the context acceptor. The context acceptor then passes thetoken to the gss_process_context_token( ) routine, telling it to delete the context and all associ-ated local data structures.

When the context is deleted, the applications cannot use the context_handle parameter for additionalsecurity services.

Input Parameterscontext_handle Specifies the context handle for the context to delete.

Output Parametersminor_status Returns a status code from the security mechanism.

output_token_buffer Returns a token to pass to the context acceptor.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

AUTHORgss_delete_sec_context() was developed by Sun Microsystems, Inc.

SEE ALSOgss_accept_sec_context(3), gss_init_sec_context(3), gss_process_context_token(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−460 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_display_name(3) gss_display_name(3)

NAMEgss_display_name( ) - provide textual representation of an opaque internal name to an application

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_display_name (OM_uint32 *minor_status,const gss_name_t input_name,gss_buffer_t output_name_buffer,gss_OID *output_name_type)

DESCRIPTIONThe gss_display_name( ) routine provides an application with the text form of an opaque internalname. The application can use the text to display the name but not to print it.

Input Parametersinput_name Specifies the name to convert to text.

Output Parametersoutput_name_buffer Returns the name as a character string.

output_name_type Returns the type of name to display as a pointer to static storage. The applicationshould treat this as read-only.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAMETYPEThe name passed by the input_name parameter is not recognized.

GSS_S_BAD_NAME An invalid name was passed by the input_name parameter.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_display_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_compare_name(3), gss_import_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−461

A gA

gss_display_status(3) gss_display_status(3)

NAMEgss_display_status( ) - provide an application with the textual representation of a GSSAPI status codethat can be displayed to a user or used for logging

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_display_status (OM_uint32 *minor_status,int status_value,int status_type,const gss_OID mech_type,int *message_context,gss_buffer_t status_string)

DESCRIPTIONThe gss_display_status( ) routine provides the context initiator with a textual representation of astatus code so that the application can display the message to a user or log the message. Because somestatus values can indicate more than one error, the routine enables the calling application to processstatus codes with multiple messages.

The message_context parameter indicates which error message the application should extract from thestatus_value parameter. The first time an application calls the routine, it should initialize themessage_context parameter to 0 (zero) and return the first message. If there are additional messages toread, the gss_display_status( ) routine returns a nonzero value. The application can callgss_display_status( ) repeatedly to generate a single text string for each call.

Input Parametersstatus_value Specifies the status value to convert.

status_type Specifies one of the following status types:

GSS_C_GSS_CODE Major status - GSS status code

GSS_C_MECH_CODEMinor status - mechanism status code eg. Kerberos

mech_type Specifies the underlying security mechanism. Supply GSS_C_NULL_OID toobtain the system default.

Input/Outputmessage_context Indicates whether the status code has multiple messages to read. The first time

an application calls the routine, you initialize the parameter to 0 (zero). The rou-tine returns the first message. If there are more messages, the routine sets theparameter to a nonzero value. The application calls the routine repeatedly to getthe next message, until the message_context parameter is zero again.

Outputstatus_string Returns the status value as a text message.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_MECH The translation requires a mechanism that is unsupported or unavailable.

GSS_S_BAD_STATUS Indicates either the status value was not recognized or the status type wassomething other than GSS_C_GSS_CODEor GSS_C_MECH_CODE.

GSS_S_FAILURE The routine failed. Check the minor_status for details.

AUTHORgss_display_status() was developed by Sun Microsystems, Inc.

Section 3−−462 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_display_status(3) gss_display_status(3)

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−463

A gA

gss_duplicate_name(3) gss_duplicate_name(3)

NAMEgss_duplicate_name( ) - allow an application to create an exact duplicate of the existing internal name

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_duplicate_name (OM_uint32 *minor_status,const gss_name_t src_name,gss_name_t *dest_name)

DESCRIPTIONThe gss_duplicate_name( ) routine create an exact duplicate of the existing internal namesrc_name . The new dest_name will be independent of src_name .

Input Parameterssrc_name The internal name to be duplicated.

Output Parametersdest_name The resultant copy of src_name .

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAME The src_name parameter was ill-formed.

AUTHORgss_duplicate_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_display_name(3), gss_import_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−464 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_export_name(3) gss_export_name(3)

NAMEgss_export_name() - convert a mechanism name (MN) to a form suitable for direct comparison

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_export_name (OM_uint32 *minor_status,const gss_name_t input_name,gss_buffer_t exported_name)

DESCRIPTIONThe gss_export_name() converts a mechanism name (MN) to export form.

Input Parametersinput_name Specifies the mechanism name (MN) to be exported.

Output Parametersexported_name The canonical contiguous string form of input_name .

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAMETYPEThe name passed by the input_name parameter is not recognized.

GSS_S_BAD_NAME The routine could not interpret the input_name parameter as a name of thetype specified.

GSS_S_NAME_NOT_MNThe provided internal name was not a mechanism name.

AUTHORgss_export_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_compare_name(3), gss_display_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−465

A gA

gss_export_sec_context(3) gss_export_sec_context(3)

NAMEgss_export_sec_context() - transfer a security context to another process on a single machine

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_export_sec_context (OM_uint32 *minor_status,gss_ctx_id_t *context_handle,gss_buffer_t interprocess_token)

DESCRIPTIONThe gss_export_sec_context( ) deactivates the security context for the calling process and createsan interprocess token which, when passed to gss_import_sec_context( ) in another process, willre-activate the context in the second process.

Only a single instantiation of a given context may be active at any one time; a subsequent attempt by acontext exporter to access the exported security context will fail. gss_ctx_id_t is created such that itis functionally identical to the original context.

If creation of the interprocess token is successful, the implementation shall deallocate all process-wideresources associated with the security context, and set the context_handle to GSS_C_NO_CONTEXT. Theability to transfer a security context is indicated when the context is created, bygss_init_sec_context() or gss_accept_sec_context() setting the GSS_C_TRANS_FLAGbit in their ret_flags parameter.

Input Parameterscontext_handle Specifies the context handle identifying the context to transfer.

interprocess_token Specifies the token to be transferred to target process.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CONTEXT_EXPIREDThe context has expired

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

GSS_S_UNAVAILABLE The operation is not supported.

AUTHORgss_export_sec_context() was developed by Sun Microsystems, Inc.

SEE ALSOgss_import_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−466 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_get_mic(3) gss_get_mic(3)

NAMEgss_get_mic( ) - calculate a cryptographic message integrity code (MIC) for a message and return in atoken

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_get_mic (OM_uint32 *minor_status,const gss_ctx_id_t context_handle,gss_qop_t qop_req,const gss_buffer_t message_buffer,gss_buffer_t msg_token)

DESCRIPTIONThe gss_get_mic( ) routine generates a cryptographic message integrity code (MIC) for the suppliedmessage and places the MIC in a token for transfer to the peer application. The qop_req parameterallows a choice between several cryptographic algorithms, if supported by the chosen mechanism.

Input Parameterscontext_handle Specifies the context on which the message is sent.

qop_req Specifies the cryptographic algorithm, or quality of protection. To accept thedefault quality of protection offered by the chosen mechanism specifyGSS_C_QOP_DEFAULT.

message_buffer Specifies the message to be protected.

Output Parametersmsg_token Buffer to receive the sealed message.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_CREDENTIALS_EXPIREDThe context is recognized but the associated credentials have expired.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

GSS_S_BAD_QOP The specified QOP is not supported by the mechanism.

AUTHORgss_get_mic() was developed by Sun Microsystems, Inc.

SEE ALSOgss_verify_mic(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−467

A gA

gss_import_name(3) gss_import_name(3)

NAMEgss_import_name( ) - convert a printable name to an internal form

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_import_name (OM_uint32 *minor_status,const gss_buffer_t input_buffer_name,const gss_OID input_name_type,gss_name_t *output_name)

DESCRIPTIONThe gss_import_name( ) routine converts a printable name to an internal form.

Input Parametersinput_name_buffer Specifies the buffer containing the printable name to convert.

input_name_type Specifies the object identifier for the type of printable name. Applications mayspecify either GSS_C_NULL_OIDto use local system-specific printable syntax, oran OID registered by the GSSAPI implementation to name a particularnamespace.

Output Parametersoutput_name Returns the name in an internal form.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAMETYPEThe name passed by the input_name parameter is not recognized.

GSS_S_BAD_NAME The routine could not interpret the input_name parameter as a name of thetype specified.

GSS_S_BAD_MECH The input nametype was GSS_C_NT_EXPORT_NAME, but the mechanismcontained within the input_name is not supported.

GSS_S_FAILURE Check the minor_status parameter for details.

AUTHORgss_import_name( ) was developed by Sun Microsystems, Inc.

SEE ALSOgss_compare_name(3), gss_display_name(3), gss_export_name(3), gss_release_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−468 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_import_sec_context(3) gss_import_sec_context(3)

NAMEgss_import_sec_context( ) - transfer a security context to another process on a single machine

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_import_sec_context (OM_uint32 *minor_status,const gss_buffer_t interprocess_token)gss_ctx_id_t *context_handle)

DESCRIPTIONThe gss_import_sec_context( ) routine lets a process to import a security context established byanother process. A given interprocess token may be imported only once.

Input Parametersinterprocess_token Specifies the token to be transferred to target process.

Output Parameterscontext_handle Specifies the context handle of newly reactivated context.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

GSS_S_DEFECTIVE_TOKENThe token was invalid.

GSS_S_UNAVAILABLE The operation is not supported.

GSS_S_UNAUTHORIZEDLocal policy prevents the import of this context by the current process.

AUTHORgss_import_sec_context( ) was developed by Sun Microsystems, Inc.

SEE ALSOgss_export_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−469

A gA

gss_indicate_mechs(3) gss_indicate_mechs(3)

NAMEgss_indicate_mechs() - allow an application to determine which underlying security mechanisms areavailable

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_indicate_mechs (OM_uint32 *minor_status,gss_OID_set *mech_set)

DESCRIPTIONThe gss_indicate_mechs( ) routine enables an application to determine which underlying securitymechanisms are available.

Output Parametersmech_set Returns the set of supported security mechanisms. The value of gss_OID_set is a

pointer to a static storage and should be treated as read-only by the context ini-tiator.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_indicate_mechs( ) was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−470 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_init_sec_context(3) gss_init_sec_context(3)

NAMEgss_init_sec_context() - establish a security context between the context initiator and a context acceptor

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_init_sec_context (OM_uint32 *minor_status,const gss_cred_id_t claimant_cred_handle,gss_ctx_id_t *context_handle,gss_name_t target_name,const gss_OID mech_type,int req_flags,int time_req,const gss_channel_bindings_t input_channel_bindings,const gss_buffer_t input_token,gss_OID *actual_mech_types,gss_buffer_t output_token,int *ret_flags,OM_int32 *time_rec)

DESCRIPTIONThe gss_init_sec_context() routine is the first step in the establishment of a security contextbetween the context initiator and the context acceptor. To ensure the portability of the application, useits default credential by supplying GSS_C_NO_CREDENTIALto the claimant_cred_handle parameter.Specify an explicit credential when the application needs an additional credential; for example, to usedelegation.

The first time the application calls the gss_init_sec_context() routine, specify the input_tokenparameter as GSS_NO_BUFFER. Calls to the routine can return an output_token for transfer to the con-text acceptor. The context acceptor presents the token to the gss_accept_sec_context() routine.

If the context initiator does not require a token, gss_init_sec_context() sets the length field ofthe output_token argument to 0 (zero).

To complete establishing the context, the calling application can require one or more reply tokens fromthe context acceptor. If the application requires reply tokens, the gss_init_sec_context() routinereturns a status value of GSS_S_CONTINUE_NEEDED. The application calls the routine again when thereply token is received from the context acceptor and passes the token to thegss_init_sec_context() routine via the input_token parameter.

The values returned by the ret_flags and time_rec parameters are not defined unless the routine returnsthe status GSS_S_COMPLETE.

If the initial call of gss_init_sec_context() fails, the call should not create a context object, andshould leave the value of the context_handle parameter set to GSS_C_NO_CONTEXTto indicate this.

Input Parametersclaimant_cred_handle Specifies an optional handle for the credential. To use the default credential, sup-

ply GSS_C_NO_CREDENTIAL. The credential handle created refers to the DCEdefault login context. If no default initiator is defined, the function will returnGSS_S_NO_CRED.

target_name Specifies the name of the context acceptor.

mech_type Specifies the security mechanism. Supply GSS_C_NO_OIDto obtain an imple-mentation specific default.

req_flags Specifies independent flags, each of which requests that the context support a ser-vice option. The following symbolic names are provided to correspond to eachflag. The symbolic names should be logically ORed to form a bit-mask value.

GSS_C_DELEG_FLAG. The True/False values are:

True Credentials were delegated to the context acceptor.

False No credentials were delegated.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−471

A gA

gss_init_sec_context(3) gss_init_sec_context(3)

GSS_C_MUTUAL_FLAG. The True/False values are:

True The context acceptor has been asked to authenticate itself.

False The context initiator has not been asked to authenticates itself.

GSS_C_REPLAY_FLAG. The True/False values are:

True Replayed signed or sealed messages will be detected.

False Replayed messages will not be detected.

GSS_C_SEQUENCE_FLAG. The True/False values are:

True Out-of-sequence signed or sealed messages will be detected.

False Out-of-sequence signed or sealed messages will not be detected.

GSS_C_CONF_FLAG. The True/False values are:

True Request that confidentiality service be made available

False No per-message confidentiality service is required.

GSS_C_INTEG_FLAG. The True/False values are:

True Request that integrity service be be made available

False No per-message integrity service is required.

GSS_C_ANON_FLAG. The True/False values are:

True Do not reveal the initiator’s identity to the acceptor.

False Authenticate normally.

time_req Specifies the desired number of seconds for which the context should remainvalid. To specify the default validity period, use 0 (zero).

input_chan_bindings Specifies the bindings set by the context initiator. Allows the context initiator tobind the channel identification information securely to the security context. Ifchannel bindings are not used specify GSS_C_NO_CHANNEL_BINDINGS.

input_token Specifies the token received from the context acceptor.

The first time the application calls the routine, you specify GSS_NO_BUFFER.Subsequent calls require a token from the context acceptor.

Input/Output Parameterscontext_handle Specifies the context handle for the new context.

The first time the application calls the routine, you specifyGSS_C_NO_CONTEXT. Subsequent calls use the value returned by the first call.

Output Parametersactual_mech_type Returns the OID of the actual mechanism used. Specify NULL if not required.

output_token Returns the token to send to the context acceptor. If the length field of thereturned buffer is 0 (zero), no token is sent.

ret_flags Returns six independent flags, each of which indicates that the context supports aservice option. Specify NULL if not required. The following symbolic names areprovided to correspond to each flag:

GSS_C_DELEG_FLAG. The True/False values are:

True Credentials were delegated to the context acceptor.

False No credentials were delegated.

GSS_C_MUTUAL_FLAG. The True/False values are:

True The context acceptor has been asked to authenticate itself.

False The context acceptor has not been asked to authenticate itself.

GSS_C_REPLAY_FLAG. The True/False values are:

Section 3−−472 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

gss_init_sec_context(3) gss_init_sec_context(3)

True Replayed signed or sealed messages will be detected.

False Replayed messages will not be detected.

GSS_C_SEQUENCE_FLAG. The True/False values are:

True Out-of-sequence signed or sealed messages will be detected.

False Out-of-sequence signed or sealed messages will not be detected.

GSS_C_CONF_FLAG. The True/False values are:

True Confidentiality service can be invoked by calling the gss_seal()routine.

False No confidentiality service is available. (Confidentiality can be pro-vided using the gss_seal() routine, which provides only mes-sage encapsulation, data-origin authentication, and integrity ser-vices.)

GSS_C_INTEG_FLAG. The True/False values are:

True Integrity service can be invoked by calling either thegss_get_mic() or gss_wrap() routine.

False Integrity service for individual messages is unavailable.

GSS_C_ANON_FLAG. The True/False values are:

True Do not reveal the initiator’s identity to the acceptor.

False Authenticate normally.

GSS_C_PROT_READY_FLAG. The True/False values are:

True Protection services (as specified by the states of theGSS_C_CONF_FLAGand GSS_C_INTEG_FLAG) are available foruse if the accompanying major status is either GSS_S_COMPLETEor GSS_S_CONTINUE_NEEDED.

False Protection services(as specified by the states of theGSS_C_CONF_FLAGand GSS_C_INTEG_FLAG) are available foruse if the accompanying major status is either GSS_S_COMPLETE.

GSS_C_TRANS_FLAG. The True/False values are:

True The resultant security context may be transferred to otherprocesses

False The security context is not is not transferable

time_rec Returns the number of seconds for which the context will be valid. If the mechan-ism does not support credential expiration, the routine returns the valueGSS_C_INDEFINITE . If the credential expiration time is not required, specifyNULL.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_BINDINGSThe input_token parameter contains different channel bindings from thosespecified with the input_chan_bindings parameter.

GSS_S_BAD_NAMETYPEThe target_name parameter contains an invalid or unsupported name type.

GSS_S_BAD_NAME The target_name parameter was incorrectly formed.

GSS_S_BAD_SIG Indicates either that the input_token parameter contains an invalid signatureor that the input_token parameter contains a signature that could not beverified.

GSS_S_CONTINUE_NEEDEDTo complete the context, the gss_init_sec_context() routine must be

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−473

A gA

gss_init_sec_context(3) gss_init_sec_context(3)

called again with a token required from the context acceptor.

GSS_S_CREDENTIALS_EXPIREDThe referenced credentials have expired.

GSS_S_DEFECTIVE_CREDENTIALConsistency checks performed on the credential failed.

GSS_S_DEFECTIVE_TOKENConsistency checks performed on the input_token parameter failed.

GSS_S_DUPLICATE_TOKENThe input_token parameter was already processed. This is a fatal error thatoccurs during context establishment.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

GSS_S_OLD_TOKEN The input_token parameter was too old. This is a fatal error that occurs dur-ing context establishment.

GSS_S_NO_CRED The supplied credentials were not valid for context initiation, or the credentialhandle did not reference any credentials.

GSS_S_BAD_MECH The specified mechanism is not supported by the provided credential

AUTHORgss_init_sec_context() was developed by Sun Microsystems, Inc.

SEE ALSOgss_accept_sec_context(3), gss_delete_sec_context(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−474 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A gA

gss_inquire_context(3) gss_inquire_context(3)

NAMEgss_inquire_context() - obtain information about a security context

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_inquire_context (OM_uint32 *minor_status,const gss_ctx_id_t context_handle,gss_name_t *src_name,gss_name_t *target_name,OM_uint32 *lifetime_rec,gss_OID *mech_type)OM_uint32 *ctx_flags,int *locally_initiated,int *open)

DESCRIPTIONThe gss_inquire_context() routine provides information about the security context to the callingapplication. The calling application must first have called the gss_acquire_cred() routine for ahandle for the credential.

Input Parameterscontext_handle A handle that refers to the security context.

Output Parameterssrc_name The name of the context initiator. If the context was established using

anonymous authentication, and if the application invokinggss_inquire_context() is the context acceptor, an anonymous name will bereturned. Specify NULL if not required.

context_handle The name of the context acceptor. If the context acceptor did not authenticateitself, and if the initiator did not specify a target name in its call togss_init_sec_context() , the value GSS_C_NO_NAMEwill be returned.Specify NULL if not required.

lifetime_rec Returns the number of seconds for which the credential will remain valid. If thecredential expired, the parameter returns a 0 (zero). If there is no credentialexpiration, the parameter returns the value GSS_C_INDEFINITE . If an expira-tion time is not required, specify NULL.

targ_name The name of the context acceptor. Storage associated with this name must befreed by the application after use with a call to gss_release_name() .

mech_type The security mechanism providing the context. Specify NULL if not required

ctx_flags Specifies independent flags, each of which requests that the context support a ser-vice option. The following symbolic names are provided to correspond to eachflag. The symbolic names should be logically ORed to form a bit-mask value.

GSS_C_DELEG_FLAG. The True/False values are:

True Credentials were delegated to the context acceptor.

False No credentials were delegated.

GSS_C_MUTUAL_FLAG. The True/False values are:

True The context acceptor has been asked to authenticate itself.

False The context initiator has not been asked to authenticates itself.

GSS_C_REPLAY_FLAG. The True/False values are:

True Replayed signed or sealed messages will be detected.

False Replayed messages will not be detected.

GSS_C_SEQUENCE_FLAG. The True/False values are:

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−475

A gA

gss_inquire_context(3) gss_inquire_context(3)

True Out-of-sequence signed or sealed messages will be detected.

False Out-of-sequence signed or sealed messages will not be detected.

GSS_C_CONF_FLAG. The True/False values are:

True Request that confidentiality service be made available

False No per-message confidentiality service is required.

GSS_C_INTEG_FLAG. The True/False values are:

True Request that integrity service be be made available

False No per-message integrity service is required.

GSS_C_ANON_FLAG. The True/False values are:

True Do not reveal the initiator’s identity to the acceptor.

False Authenticate normally.

cred_usage Returns one of the following values describing how the application can use thecredential:

GSS_C_INITIATEGSS_C_ACCEPTGSS_C_BOTH

If no usage information is required, specify NULL.

mechs returns a set of security mechanisms supported by the credential. Specify NULLif not required.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_NO_CONTEXT The referenced context could not be accessed.

GSS_S_DEFECTIVE_CREDENTIALThe credentials were invalid.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

GSS_S_NO_CRED The routine could not access the credentials.

AUTHORgss_inquire_context() was developed by Sun Microsystems, Inc.

SEE ALSOgss_acquire_cred(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−476 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A gA

gss_inquire_cred(3) gss_inquire_cred(3)

NAMEgss_inquire_cred() - provide the calling application information about a credential

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_inquire_cred (OM_uint32 *minor_status,const gss_cred_id_t cred_handle,gss_name_t *name,OM_uint32 *lifetime,int *cred_usage,gss_OID_set *mechs)

DESCRIPTIONThe gss_inquire_cred() routine provides information about a credential to the calling application.The calling application must first have called the gss_acquire_cred() routine for a handle for thecredential.

Input Parameterscred_handle Specifies a handle for the target credential. To get information about the default

credential, specify GSS_C_NO_CREDENTIAL.

Output Parametersname Returns the principal name asserted by the credential. If the principal name is

not required, specify NULL.

lifetime Returns the number of seconds for which the credential will remain valid.

If the credential expired, the parameter returns a 0 (zero). If there is no creden-tial expiration, the parameter returns the value GSS_C_INDEFINITE . If anexpiration time is not required, specify NULL.

cred_usage Returns one of the following values describing how the application can use thecredential:

GSS_C_INITIATEGSS_C_ACCEPTGSS_C_BOTH

If no usage information is required, specify NULL.

mechs Returns a set of security mechanisms supported by the credential.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CREDENTIALS_EXPIREDThe credentials expired. If the lifetime parameter was passed as NULL, it isset to 0 (zero).

GSS_S_DEFECTIVE_CREDENTIALThe credentials were invalid.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

GSS_S_NO_CRED The routine could not access the credentials.

AUTHORgss_inquire_cred() was developed by Sun Microsystems, Inc.

SEE ALSOgss_acquire_cred(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−477

A gA

gss_inquire_cred_by_mech(3) gss_inquire_cred_by_mech(3)

NAMEgss_inquire_cred_by_mech() - provide the calling application per-mechanism information about a creden-tial

SYNOPSIS#include <gssapi.h>.C

OM_uint32 gss_inquire_cred_by_mech (OM_uint32 *minor_status ,const gss_cred_id_t cred_handle ,const gss_OID *mech_type )gss_name_t *name ,OM_uint32 *initiator_lifetime ,OM_uint32 *acceptor_lifetime,int *cred_usage)

DESCRIPTIONThe gss_inquire_cred_by_mech() routine provides per-mechanism information about a creden-tial.

Input Parameterscred_handle Specifies a handle for the target credential. To get information about the default

credential, specify GSS_C_NO_CREDENTIAL.

mech_type Set of security mechanisms for which information should be returned.

Output Parametersname Returns the principal name asserted by the credential. If the principal name is

not required, specify NULL.

initiator_lifetime Returns the number of seconds for which the credential will remain capable ofinitiating security contexts under the specified mechanism. If the credential canno longer be used to initiate contexts, or if the credential usage for this mechan-ism is GSS_C_ACCEPT, this parameter will be set to zero.

If the implementation does not support expiration of initiator credentials, theparameter returns the value GSS_C_INDEFINITE . If an expiration time is notrequired, specify NULL.

acceptor_lifetime Returns the number of seconds for which the credential will remain capable ofaccepting security contexts under the specified mechanism.

If the implementation does not support expiration of initiator credentials, theparameter returns the value GSS_C_INDEFINITE . If an expiration time is notrequired, specify NULL.

cred_usage Returns one of the following values describing how the application can use thecredential:

GSS_C_INITIATEGSS_C_ACCEPTGSS_C_BOTH

If no usage information is required, specify NULL.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CREDENTIALS_EXPIREDThe credentials expired. If the lifetime parameter was passed as NULL, it isset to 0 (zero).

GSS_S_DEFECTIVE_CREDENTIALThe credentials were invalid.

Section 3−−478 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_inquire_cred_by_mech(3) gss_inquire_cred_by_mech(3)

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

GSS_S_NO_CRED The routine could not access the credentials.

AUTHORgss_inquire_cred_by_mech() was developed by Sun Microsystems, Inc.

SEE ALSOgss_acquire_cred(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−479

A gA

gss_inquire_mechs_for_name(3) gss_inquire_mechs_for_name(3)

NAMEgss_inquire_mechs_for_name() - list the mechanisms that support the specified name-type

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_inquire_mechs_for_name (OM_uint32 *minor_status,const gss_name_t input_name,gss_OID_set *mech_types)

DESCRIPTIONThe gss_inquire_mechs_for_name() routine returns the set of mechanisms supported by theGSS-API implementation that may be able to process the specified name.

Input Parametersinput_name The name to which the inquiry relates.

Output Parametersmech_types Set of mechanisms that may support the specified name. The value of

gss_OID_set is a pointer to a static storage and should be treated as read-onlyby the context initiator.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAME The input_name parameter was ill-formed.

GSS_S_BAD_NAMETYPEThe input_name parameter contained an invalid or unsupported type of name.

AUTHORgss_inquire_mechs_for_name() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−480 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_inquire_names_for_mech(3) gss_inquire_names_for_mech(3)

NAMEgss_inquire_names_for_mech() - list the name-types supported by the specified mechanism

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_inquire_names_for_mech (OM_uint32 *minor_status,const gss_OID *mechanism,gss_OID_set *name_types)

DESCRIPTIONThe gss_inquire_names_for_mech() routine returns the set of nametypes supported by thespecified mechanism.

Input Parametersmechanism The mechanism to be interrogated.

Output Parametersname_types Set of name-types supported by specified mechanisms. The value of

gss_OID_set is a pointer to a static storage and should be treated as read-onlyby the context initiator.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status for details.

AUTHORgss_inquire_names_for_mech() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−481

A gA

gss_process_context_token(3) gss_process_context_token(3)

NAMEgss_process_context_token() - process a context to the security service

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_process_context_token (OM_uint32 *minor_status,const gss_ctx_id_t *context_handle,const gss_buffer_t input_token_buffer)

DESCRIPTIONThe gss_process_context_token() routine passes tokens generated by thegss_delete_security_context() routine to the security service.

Usually, tokens are associated with either the context establishment or with per-message security ser-vices. If the tokens are associated with the context establishment, they are passed to thegss_init_sec_context() or gss_accept_sec_context() routine. If the tokens are associ-ated with the per-message security service, they are passed to the gss_verify() or gss_unseal()routine.

Tokens generated by the gss_delete_security_context() routine are passed by thegss_process_context_token() routine to the security service for processing.

Input Parameterscontext_handle Specifies the context handle on which the security service processes the token.

input_token_buffer Specifies an opaque pointer to the first byte of the token to be processed.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_DEFECTIVE_TOKENConsistency checks performed on the input_token parameter failed.

GSS_S_FAILURE The routine failed. See the minor_status parameter return value for moreinformation.

GSS_S_NO_CONTEXT The supplied context handle did not refer to a valid context.

AUTHORgss_process_context_token() was developed by Sun Microsystems, Inc.

SEE ALSOgss_accept_sec_context(3), gss_delete_sec_context(3), gss_init_sec_context(3), gss_verify_mic(3),gss_unseal(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−482 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_release_buffer(3) gss_release_buffer(3)

NAMEgss_release_buffer() - free storage associated with a buffer

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_release_buffer (OM_uint32 *minor_status,gss_buffer_t buffer)

DESCRIPTIONThe gss_release_buffer() routine deletes the buffer by freeing the storage associated with it.

Input Parametersbuffer The buffer to delete.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. See the minor_status parameter for details.

AUTHORgss_release_buffer() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−483

A gA

gss_release_cred(3) gss_release_cred(3)

NAMEgss_release_cred() - mark a credential for deletion

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_release_cred (OM_uint32 *minor_status,gss_cred_id_t *cred_handle)

DESCRIPTIONThe gss_release_cred() routine informs the GSSAPI that a credential is no longer required andmarks it for deletion.

Input Parameterscred_handle Specifies the buffer containing the opaque credential handle to be released. To

release the default credential, specify GSS_C_NO_CREDENTIAL.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_NO_CRED The credentials could not be accessed.

AUTHORgss_release_cred() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−484 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_release_name(3) gss_release_name(3)

NAMEgss_release_name() - free storage associated with an internal name allocated by a GSSAPI routine

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_release_name (OM_uint32 *minor_status,gss_name_t *name)

DESCRIPTIONThe gss_release_name() routine deletes the internal name by freeing the storage associated withthat internal name.

Input Parametersname The name to delete.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_NAME The name parameter did not contain a valid name.

GSS_S_FAILURE The routine failed. Check the minor_status for details.

AUTHORgss_release_name() was developed by Sun Microsystems, Inc.

SEE ALSOgss_compare_name(3), gss_display_name(3), gss_import_name(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−485

A gA

gss_release_oid_set(3) gss_release_oid_set(3)

NAMEgss_release_oid_set() - free storage associated with a gss_OID_set object

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_release_oid_set (OM_uint32 *minor_status,gss_OID_set *set)

DESCRIPTIONThe gss_release_oid_set() routine frees storage that is associated with the gss_OID_set parame-ter and was allocated by a GSSAPI routine.

Input Parametersset The storage associated with the gss_OID_set will be deleted.

Output Parametersminor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_release_oid_set() was developed by Sun Microsystems, Inc.

SEE ALSOThe manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−486 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_test_oid_set_member(3) gss_test_oid_set_member(3)

NAMEgss_test_oid_set_member() - check an OID set for a specified OID

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_test_oid_set_member (OM_uint32 *minor_status,const gss_OID member_OID,const gss_OID_set set,int* is_present / * 1 = present , 0 = absent */ );

DESCRIPTIONThe gss_test_oid_set_member() routine checks an OID set to see if the specified OID is a memberof the set. To add a member to an OID set, use the gss_add_oid_set_member() routine.

The gss_test_oid_set_member() routine uses the value of the actual_mechs output parameterfrom the gss_acquire_cred() routine to get the list of OIDs. It checks this list to see if any of theOIDs are members of the OID set. This routine is intended to be used with OID sets returned bygss_indicate_mechs() , gss_acquire_cred() , and gss_inquire_cred() .

Input Parametersmember_OID Specifies the OID to search for in the OID set.

set Specifies the OID set to check.

Output Parametersis_present Returns one of the following values to indicate whether the OID is a member of

the OID set:

1 If the OID is present as a member of the OID set.

0 If the OID is absent, not a member of the OID set.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

AUTHORgss_test_oid_set_member() was developed by Sun Microsystems, Inc.

SEE ALSOgss_add_oid_set_member(3), gss_acquire_cred(3), gss_indicate_mechs(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−487

A gA

gss_unwrap(3) gss_unwrap(3)

NAMEgss_unwrap - verify a message with attached message integrity code (MIC) and decrypt message contentif necessary

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_unwrap (OM_uint32 *minor_status,gss_ctx_id_t context_handle,gss_buffer_t input_message_buffer,gss_buffer_t output_message_buffer,int *conf_state,gss_qop_t *qop_state)

DESCRIPTIONThe gss_unwrap() routine converts a protected message to a usable form and verifies the embeddedmessage integrity code (MIC). The conf_state parameter indicates whether the message was encrypted.The qop_state parameter indicates the quality of protection that was used to provide the confidentialityand integrity services.

Input Parameterscontext_handle Specifies the context on which the message arrived.

input_message_buffer Specifies the protected message.

output_message_buffer Specifies the buffer to receive the unwrapped message.

Output Parametersconf_state Returns the requested level of confidentiality and integrity services, as follows:

Non-zero Both confidentiality and integrity services were used.

zero Only integrity services was used.

qop_state Returns the cryptographic algorithm, or quality of protection.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_BAD_SIG The signature was incorrect.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_CREDENTIALS_EXPIREDThe context is recognized but the associated credentials have expired.

GSS_S_DEFECTIVE_TOKENThe token failed consistency checks.

GSS_S_DUPLICATE_TOKENThe token was valid and contained the correct signature but it had alreadybeen processed.

GSS_S_FAILURE The routine failed. The context specified in the context_handle parameter wasnot valid.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

GSS_S_OLD_TOKEN The token was valid and contained the correct signature but it is too old.

GSS_S_UNSEQ_TOKENThe token was valid, and contained a correct MIC for the message, but hasbeen verified out of sequence; a later token has already been received.

GSS_S_GAP_TOKEN The token was valid, and contained a correct MIC for the message, but hasbeen verified out of sequence; an earlier expected token has not yet beenreceived.

Section 3−−488 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_unwrap(3) gss_unwrap(3)

AUTHORgss_unwrap() was developed by Sun Microsystems, Inc.

SEE ALSOgss_get_mic(3), gss_wrap(3).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−489

A gA

gss_verify_mic(3) gss_verify_mic(3)

NAMEgss_verify_mic() - check a cryptographic message integrity code (MIC) against a message to verify itsintegrity

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_verify_mic(OM_uint32 *minor_status,const gss_ctx_id_t context_handle,const gss_buffer_t message_buffer,const gss_buffer_t token_buffer)gss_qop_t *qop_state)

DESCRIPTIONThe gss_verify_mic() routine verifies that a cryptographic MIC, contained in the token_bufferparameter, fits the supplied message. The application receiving the message can use the qop_stateparameter to check the strength of protection.

Input Parameterscontext_handle Specifies the context on which the message arrived.

message_buffer Specifies the message to be verified.

token_buffer Specifies the token to be associated with the message.

Output Parametersqop_state Returns the quality of protection gained from message integrity code (MIC).

Specify NULL if not required.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_DEFECTIVE_TOKENThe token failed consistency checks.

GSS_S_BAD_SIG The MIC was incorrect.

GSS_S_DUPLICATE_TOKENThe token was valid, and contained a correct MIC for the message, but it hadalready been processed.

GSS_S_OLD_TOKEN The token was valid, and contained a correct MIC for the message, but it is tooold.

GSS_S_UNSEQ_TOKENThe token was valid, and contained a correct MIC for the message, but hasbeen verified out of sequence. A later token has already been received.

GSS_S_GAP_TOKEN The token was valid, and contained a correct MIC for the message, but hasbeen verified out of sequence. An earlier expected token has not yet beenreceived.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

AUTHORgss_verify_mic() was developed by Sun Microsystems, Inc.

SEE ALSOgss_get_mic(3), gss_wrap(3).

Section 3−−490 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_verify_mic(3) gss_verify_mic(3)

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−491

A gA

gss_wrap(3) gss_wrap(3)

NAMEgss_wrap() - attach a message integrity code (MIC) to a message, and optionally encrypt the message con-tent

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_wrap (OM_uint32 *minor_status,const gss_ctx_id_t context_handle,int conf_req_flag,gss_qop_t qop_req,const gss_buffer_t input_message_buffer,int *conf_state,gss_buffer_t output_message_buffer)

DESCRIPTIONThe gss_wrap() routine attaches a cryptographic message integrity code (MIC) and optionally encryptsthe input_message . The output_message contains both the MIC and the message.

Although the qop_req parameter enables a choice between several qualities of protection, if you specify anunsupported protection, the gss_wrap() routine returns a status of GSS_S_FAILURE.

Input Parameterscontext_handle Specifies the context on which the message is sent.

conf_req_flag Specifies the requested level of confidentiality and integrity services, as follows:

Non-zero Both confidentiality and integrity services are requested.

Zero Only integrity services are requested.

qop_req Specifies the cryptographic algorithm, or quality of protection. A mechanism-specific default may be requested by setting qop_req to GSS_C_QOP_DEFAULT.

input_message_buffer Specifies the message to be protected.

Output Parametersconf_state Returns the requested level of confidentiality and integrity services, as follows:

Non-zero Confidentiality, data origin, authentication, and integrity serviceshave been applied.

Zero Only integrity and data origin services have been applied.

output_message_buffer Returns the buffer to receive the protected message.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_CREDENTIALS_EXPIREDThe context is recognized but the associated credentials have expired.

GSS_S_FAILURE The routine failed. Check the minor_status parameter for details.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

GSS_S_BAD_QOP The specified QOP is not supported by the mechanism.

AUTHORgss_wrap() was developed by Sun Microsystems, Inc.

Section 3−−492 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A gA

gss_wrap(3) gss_wrap(3)

SEE ALSOgss_unwrap(3), gss_wrap_size_limit(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−493

A gA

gss_wrap_size_limit(3) gss_wrap_size_limit(3)

NAMEgss_wrap_size_limit() - determine a token-size limit for gss_wrap on a context

SYNOPSIS#include <gssapi.h>

OM_uint32 gss_wrap_size_limit (OM_uint32 *minor_status,const gss_ctx_id_t context_handle,int conf_req_flag,gss_qop_t qop_req,OM_uint32 req_output_size,OM_uint32 max_input_size)

DESCRIPTIONThe gss_wrap_size_limit() routine allows an application to determine the maximum message sizethat, if presented to gss_wrap() with the same conf_req_flag and qop_req parameters, will result in anoutput token containing no more than the req_output_size bytes.

This call is intended for use by applications that communicate over protocols that impose a maximummessage size. It enables the application to fragment messages prior to applying protection.

Input Parameterscontext_handle Specifies the context on which the message is sent.

conf_req_flag Specifies the requested level of confidentiality and integrity services, as follows:

Non-zero Both confidentiality and integrity services are requested.

Zero Only integrity services are requested.

qop_req Specifies the cryptographic algorithm, or quality of protection. A mechanism-specific default may be requested by setting qop_req to GSS_C_QOP_DEFAULT.

req_output_size The desired maximum size for tokens emitted by gss_wrap() .

Output Parametersmax_input_size The maximum input message size that may be presented to gss_wrap() in

order to guarantee that the emitted token shall be no larger than req_output_sizebytes.

minor_status Returns a status code from the security mechanism.

STATUS CODESThe following status codes can be returned:

GSS_S_COMPLETE The routine was completed successfully.

GSS_S_NO_CONTEXT The context identified in the context_handle parameter was not valid.

GSS_S_CONTEXT_EXPIREDThe context has already expired.

GSS_S_BAD_QOP The specified QOP is not supported by the mechanism.

AUTHORgss_wrap_size_limit() was developed by Sun Microsystems, Inc.

SEE ALSOgss_wrap(3).

The manpages for DCE-GSSAPI are included with the DCE-CoreTools product. To see those manpagesadd /opt/dce/share/man to MANPATH.

Section 3−−494 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A hA

halfdelay(3X) halfdelay(3X)(ENHANCED CURSES)

NAMEhalfdelay — control input character delay mode

SYNOPSIS#include <curses.h>

int halfdelay(int tenths);

DESCRIPTIONThe halfdelay() function sets the input mode for the current window to Half-Delay Mode andspecifies tenths tenths of seconds as the half-delay interval. The tenths argument must be in a rangefrom 1 up to and including 255.

RETURN VALUEUpon successful completion, halfdelay() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe application can call nocbreak() to leave Half-Delay mode.

SEE ALSOcbreak(3X), curses_intro(3X), see Input Mode , <curses.h>, X/Open System Interface Definitions, Issue 4,Version 2 specification, Chapter 9, General Terminal Interface .

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−495

A hA

has_ic(3X) has_ic(3X)(CURSES)

NAMEhas_ic, has_il — query functions for terminal insert and delete capability

SYNOPSIS#include <curses.h>

bool has_ic(void);

bool has_il(void);

DESCRIPTIONThe has_ic() function indicates whether the terminal has insert- and delete-character capabilities.

The has_il() function indicates whether the terminal has insert- and delete-line capabilities, or cansimulate them using scrolling regions.

RETURN VALUEThe has_ic() function returns TRUE if the terminal has insert- and delete-character capabilities. Oth-erwise, it returns FALSE.

The has_il() function returns TRUE if the terminal has insert- and delete-line capabilities. Other-wise, it returns FALSE.

ERRORSNo errors are defined.

APPLICATION USAGEThe has_il() function may be used to determine if it would be appropriate to turn on physical scrollingusing scrollok() .

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The has_il() function is merged with this entry. In previous issues, it appeared in an entry of its own.

The entry is rewritten for clarity. The argument list for the has_ic() and has_il() functions isexplicitly declared as void.

Section 3−−496 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A hA

hline(3X) hline(3X)(ENHANCED CURSES)

NAMEhline, mvhline, mvvline, mvwhline, mvwvline, vline, whline, wvline — draw lines from single-byte char-acters and renditions

SYNOPSIS#include <curses.h>

int hline(chtype ch, int n);

int mvhline(int y, int x, chtype ch, int n);

int mvvline(int y, int x, chtype ch, int n);

int mvwhline(WINDOW * win, int y, int x, chtype ch, int n);

int mvwvline(WINDOW * win, int y, int x, chtype ch, int n);

int vline(chtype ch, int n);

int whline(WINDOW * win, chtype ch, int n);

int wvline(WINDOW * win, chtype ch, int n);

DESCRIPTIONThese functions draw a line in the current or specified window starting at the current or specified posi-tion, using ch. The line is at most n positions long, or as many as fit into the window.

These functions do not advance the cursor position. These functions do not perform special character pro-cessing. These functions do not perform wrapping.

The hline() , mvhline() , mvwhline() and whline() functions draw a line proceeding toward thelast column of the same line.

The vline() , mvvline() , mvwvline() and wvline() functions draw a line proceeding toward thelast line of the window.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOborder(3X), box(3X), hline_set(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−497

A hA

hline_set(3X) hline_set(3X)(ENHANCED CURSES)

NAMEhline_set, mvhline_set, mvvline_set, mvwhline_set, mvwvline_set, vline_set, whline_set, wvline_set —draw lines from complex characters and renditions

SYNOPSIS#include <curses.h>

int hline_set(const cchar_t * wch, int n);

int mvhline_set(int y, int x, const cchar_t * wch, int n);

int mvvline_set(int y, int x, const cchar_t * wch, int n);

int mvwhline_set(WINDOW * win, int y, int x, const cchar_t * wch, int n);

int mvwvline_set(WINDOW * win, int y, int x, const cchar_t * wch, int n);

int vline_set(const cchar_t * wch, int n);

int whline_set(WINDOW * win, const cchar_t * wch, int n);

int wvline_set(WINDOW * win, const cchar_t * wch, int n);

DESCRIPTIONThese functions draw a line in the current or specified window starting at the current or specified posi-tion, using ch. The line is at most n positions long, or as many as fit into the window.

These functions do not advance the cursor position. These functions do not perform special character pro-cessing. These functions do not perform wrapping.

The hline_set() , mvhline_set() , mvwhline_set() and whline_set() functions draw a lineproceeding toward the last column of the same line.

The vline_set() , mvvline_set() , mvwvline_set() and wvline_set() functions draw a lineproceeding toward the last line of the window.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOborder_set(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−498 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A hA

hosts_access(3) hosts_access(3)

NAMEhosts_access(), hosts_ctl(), request_init(), request_set() - access control library

SYNOPSIS#include <tcpd.h>

extern int allow_severity;extern int deny_severity;extern int rfc931_timeout;

struct request_info *request_init(request, key, value, ..., 0)struct request_info *request;

struct request_info *request_set(request, key, value, ..., 0)struct request_info *request;

int hosts_access(request)struct request_info *request;

int hosts_ctl(daemon, client_name, client_addr, client_user)char *daemon;char *client_name;char *client_addr;char *client_user;

DESCRIPTIONThe routines described here are a part of the libwrap.a library. They implement a rule-based accesscontrol language with optional shell commands that are executed when a rule fires.

request_init() initializes a structure with information about a client request. request_set()updates an already initialized request structure. Both functions take a variable-length list of key-valuepairs and return their first argument. The argument lists are terminated with a zero key value. Allstring-valued arguments are copied. The expected keys (and corresponding value types) are:

RQ_FILE (int)The file descriptor associated with the request.

RQ_CLIENT_NAME (char *)The client host name.

RQ_CLIENT_ADDR (char *)A printable representation of the client network address.

RQ_CLIENT_SIN (struct sockaddr_in *)An internal representation of the client network address and port. The contents of the structure arenot copied.

RQ_SERVER_NAME (char *)The hostname associated with the server endpoint address.

RQ_SERVER_ADDR (char *)A printable representation of the server endpoint address.

RQ_SERVER_SIN (struct sockaddr_in *)An internal representation of the server endpoint address and port. The contents of the structureare not copied.

RQ_DAEMON (char *)The name of the daemon process running on the server host.

RQ_USER (char *)The name of the user on whose behalf the client host makes the request.

hosts_access() consults the access control tables described in the hosts_access (5) manual page.When internal endpoint information is available, host names and client user names are looked up ondemand, using the request structure as a cache. hosts_access() returns zero if access should bedenied.

hosts_ctl() is a wrapper around the request_init() and hosts_access() routines with aperhaps more convenient interface (though it does not pass on enough information to support automatedclient username lookups). The client host address, client host name and username arguments should

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−499

A hA

hosts_access(3) hosts_access(3)

contain valid data or STRING_UNKNOWN. hosts_ctl() returns zero if access should be denied.

The allow_severity and deny_severity variables determine how accepted and rejected requests may belogged. They must be provided by the caller and may be modified by rules in the access control tables.

The rfc931_timeout variable determines the timeout value for the client’s username lookup. It must beset with a positive value and a value of 0 disables the username lookup.

RETURN VALUEThe request_init() and request_set() functions return a pointer to the request_info struc-ture. The members of the returned structure are initialized and updated with the values passed to therespective functions, request_init() and request_set() .

The hosts_access() and hosts_ctl() functions return 1 if the access is granted and 0 if theaccess is denied, for the requested service.

DIAGNOSTICSProblems are reported via syslogd , the syslog daemon, at info , notice , warning and err lev-els.

WARNINGShosts_access() uses the strtok() library function. This may interfere with other code that relieson strtok() .

AUTHORThese routines were developed by

Wietse Venema ([email protected])Department of Mathematics and Computing ScienceEindhoven University of TechnologyDen Dolech 2, P.O. Box 513,5600 MB Eindhoven, The Netherlands

FILES/etc/hosts.allow access control tables.

/etc/hosts.deny access control tables.

SEE ALSOhosts_access (5) format of the access control tables.

hosts_options(5) optional extensions to the base language.

Section 3−−500 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A hA

hppac(3X) hppac(3X)

NAMEhppac: HPPACADDD(), HPPACCMPD(), HPPACCVAD(), HPPACCVBD(), HPPACCVDA(),HPPACCVDB(), HPPACDIVD(), HPPACLONGDIVD(), HPPACMPYD(), HPPACNSLD(), HPPACSLD(),HPPACSRD(), HPPACSUBD() - HP 3000-mode packed-decimal library

SYNOPSIS#include <hppac.h>

void HPPACADDD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACCMPD(unsigned char ∗operand1,int op1digs,unsigned char ∗operand2,int op2digs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACCVAD(unsigned char ∗target,int targetdigs,unsigned char ∗source,int sourcedigs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACCVBD(unsigned char ∗target,int targetdigs,unsigned short ∗source,int sourcewords,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACCVDA(unsigned char ∗target,int targetdigs,unsigned char ∗source,int sign_control,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACCVDB(unsigned short ∗target,unsigned char ∗source,int sourcedigs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACDIVD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−501

A hA

hppac(3X) hppac(3X)

enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACLONGDIVD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACMPYD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACNSLD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,int ∗shift_amt,enum HPPAC_CC∗compcode,int ∗pacstatus,int ∗carry

);

void HPPACSLD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,int shift_amt,enum HPPAC_CC∗compcode,int ∗pacstatus,int ∗carry

);

void HPPACSRD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,int shift_amt,enum HPPAC_CC∗compcode,int ∗pacstatus

);

void HPPACSUBD(unsigned char ∗operand2,int op2digs,unsigned char ∗operand1,int op1digs,enum HPPAC_CC∗compcode,int ∗pacstatus

);

Section 3−−502 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A hA

hppac(3X) hppac(3X)

DESCRIPTIONThis set of calls invokes the library functions for emulating 3000-mode (MPE V/E) packed-decimal opera-tions. These functions are in library libcl which is searched when the option -lcl is used with cc orld(1).

HPPACADDD() Performs packed-decimal addition.

HPPACCMPD() Compares two packed-decimal numbers.

HPPACCVAD() Converts an ASCII representation to packed-decimal.

HPPACCVBD() Converts a binary representation to packed-decimal.

HPPACCVDA() Converts a packed-decimal number to ASCII.

HPPACCVDB() Converts a packed-decimal number to binary.

HPPACDIVD() Performs packed-decimal division.

HPPACLONGDIVD() Performs packed-decimal division (alternate routine).

HPPACMPYD() Performs packed-decimal multiplication.

HPPACNSLD() Performs a packed-decimal normalizing left shift.

HPPACSLD() Performs a packed-decimal left shift.

HPPACSRD() Performs a packed-decimal right shift.

HPPACSUBD() Performs packed-decimal subtraction.

For all operations, the value returned in the variable to which the compcode argument points is one of thefollowing values of type enum HPPAC_CC:

HPPAC_CCG Result > 0 or operand1 > operand2

HPPAC_CCL Result < 0 or operand1 < operand2

HPPAC_CCE Result == 0 or operand1 == operand2

For all operations, the value returned in the variable to which the pacstatus argument points is one of thefollowing values of type enum HPPAC_STATUS. Their meanings are intended to be obvious:

HPPAC_NO_ERROR

HPPAC_DECIMAL_OVERFLOW

HPPAC_INVALID_ASCII_DIGIT

HPPAC_INVALID_PACKED_DECIMAL_DIGIT

HPPAC_INVALID_SOURCE_WORD_COUNT

HPPAC_INVALID_DECIMAL_OPERAND_LENGTH

HPPAC_DECIMAL_DIVIDE_BY_ZERO

AUTHORThe HPPAC library was developed by HP.

SEE ALSOCompiler Library/XL Reference Manual

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−503

A hA

hsearch(3C) hsearch(3C)

NAMEhsearch( ), hcreate( ), hdestroy( ) - manage hash search tables

SYNOPSIS#include <search.h>

ENTRY *hsearch(ENTRY item, ACTION action);

int hcreate(size_t nel);

void hdestroy(void);

DESCRIPTIONhsearch() is a hash-table search routine generalized from Knuth (6.4) Algorithm D. It returns apointer into a hash table indicating the location at which an entry can be found. Only pointers arecopied, so the calling routine must store the data (the value of the "key" must be unique). item is a struc-ture of type ENTRY(defined in the <search.h > header file) containing two pointers: item.keypoints to the comparison key, and item.data points to any other data to be associated with that key.(Pointers to types other than character should be cast to pointer-to-character.) action is a member of anenumeration type ACTION indicating the disposition of the entry if it cannot be found in the table.ENTERindicates that the item should be inserted in the table at an appropriate point. FIND indicatesthat no entry should be made. Unsuccessful resolution is indicated by the return of a NULL pointer.

hcreate() allocates sufficient space for the table, and must be called before hsearch() is used. nelis an estimate of the maximum number of entries that the table will contain. This number can beadjusted upward by the algorithm in order to obtain certain mathematically favorable circumstances.

hdestroy() destroys the search table, and can be followed by another call to hcreate() .

EXAMPLEThe following example reads in strings followed by two numbers and stores them in a hash table, discard-ing duplicates. It then reads in strings and finds the matching entry in the hash table and prints it out.

#include <stdio.h>#include <search.h>

struct info { /* this is the info stored in the table */int age, room; /* other than the key. */

};#define NUM_EMPL 5000 /* # of elements in search table */

main( ){

/* space to store strings */char string_space[NUM_EMPL*20];

/* space to store employee info */struct info info_space[NUM_EMPL];

/* next avail space in string_space */char *str_ptr = string_space;

/* next avail space in info_space */struct info *info_ptr = info_space;ENTRY item, *found_item, *hsearch( );/* name to look for in table */

char name_to_find[30];int i = 0;

/* create table */(void) hcreate(NUM_EMPL);while (scanf("%s%d%d", str_ptr, &info_ptr->age,

&info_ptr->room) != EOF && i++ < NUM_EMPL) {

Section 3−−504 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A hA

hsearch(3C) hsearch(3C)

/* put info in structure, and structure in item */item.key = str_ptr;item.data = (char *)info_ptr;str_ptr += strlen(str_ptr) + 1;info_ptr++;

/* put item into table */(void) hsearch(item, ENTER);

}

/* access table */item.key = name_to_find;while (scanf("%s", item.key) != EOF) {

if ((found_item = hsearch(item, FIND)) != NULL) {

/* if item is in the table */(void)printf("found %s, age = %d, room = %d\n",

found_item->key,((struct info *)found_item->data)->age,((struct info *)found_item->data)->room);

} else {(void)printf("no such employee %s\n",

name_to_find);}

}}

RETURN VALUEhsearch() returns a NULL pointer if either the action is FIND and the item could not be found or theaction is ENTERand the table is full.

hcreate() returns zero if it cannot allocate sufficient space for the table.

WARNINGShsearch() and hcreate() use malloc() to allocate space (see malloc (3C)).

Only one hash search table can be active at any given time.

SEE ALSObsearch(3C), lsearch(3C), malloc(3C), string(3C), tsearch(3C), thread_safety(5).

STANDARDS CONFORMANCEhsearch() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

hcreate() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

hdestroy() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−505

A hA

hypot(3M) hypot(3M)

NAMEhypotf( ), hypotl( ), hypotw( ), hypotq( ) - Euclidean distance functions

SYNOPSIS#include <math.h>

double hypot(double x, double y);

Itanium(R)-based System Onlyfloat hypotf(float x, float y);

long double hypotl(long double x, long double y);

extended hypotw(extended x, extended y);

quad hypotq(quad x, quad y);

DESCRIPTIONhypot() computes the square root of the sum of the squares of x and y , without undue overflow orunderflow.

Itanium-based System Onlyhypotf() is a float version of hypot() ; it takes float arguments and returns a float result.

hypotl() is a long double version of hypot() ; it takes long double arguments and returns along double result.

hypotw() is an extended version of hypot() ; it takes extended arguments and returns anextended result.

hypotq() is equivalent to hypotl() on HP-UX systems.

USAGETo use any of these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) hypotw() or hypotq() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

RETURN VALUEhypot( x,y) , hypot( y,x) , and hypot( x,-y) are equivalent.

hypot( x,±0) is equivalent to fabs( x) .

hypot( ±Inf,y) returns +Inf, even if y is a NaN.

If both arguments are NaNs, then hypot() returns a NaN.

hypot() returns infinity in lieu of a value whose magnitude is too large, and raises the overflow andinexact exceptions.

hypot() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

hypot() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSNo errors are defined.

SEE ALSOcabs(3M), fabs(3M), sqrt(3M), math(5).

STANDARDS CONFORMANCEhypot() : SVID3, XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

hypotf() , hypotl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−506 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

iconv(3C) iconv(3C)

NAMEiconv, iconv_open, iconv_close - codeset conversion routines

SYNOPSIS#include <iconv.h>

iconv_t iconv_open(const char * tocode , const char * fromcode );

size_t iconv(iconv_t cd,const char ** inbuf ,size_t * inbytesleft ,char ** outbuf ,size_t * outbytesleft

);

int iconv_close(iconv_t cd);

RemarksThese interfaces conform to the XPG4 standard, and should be used instead of the the 9.0 iconv inter-faces, such as, iconvopen() , iconvclose() , iconvsize() , iconvlock() , ICONV() ,ICONV1() , and ICONV2() .

Refer to the white paper entitled, HP-UX 9.0-11i Version 1.6 Internationalization Features White Paperfor an understanding of the conversion process. The white paper explains how iconv uses tables andmethods to do the conversions. This white paper also shows you how to customize your own conversions.The white paper is in www.docs.hp.com .

DESCRIPTIONThe entries in the config.iconv file are the set of conversions that are supported by iconv (3C). Thefirst two columns correspond to the fromcode and tocode names. These names may be directly used ortheir corresponding aliases may be used as parameters to iconv_open() .

iconv_open() Returns a conversion descriptor that describes a conversion from the codesetspecified by the string pointed to by the fromcode argument to the codeset specifiedby the tocode argument.

A conversion descriptor remains valid in a process until that process closes it.

The fromcode and tocode arguments must have a corresponding entry in theconfiguration file /usr/lib/nls/iconv/config.iconv . (See FILES section.)

iconv() Converts a sequence of characters from one codeset that is contained in the arrayspecified by inbuf , into a sequence of corresponding characters in another codeset,contained in the array specified by outbuf . The codesets are those specified in theiconv_open() call that returned the conversion descriptor cd . The inbuf argu-ment points to a variable that points to the first character in the input buffer andinbytesleft indicates the number of remaining bytes in the buffer being converted.The outbuf argument points to a variable that points to the first available byte inthe output buffer and outbytesleft indicates the number of the available remainingbytes in the buffer.

If a sequence of input bytes does not form a valid character in the specified codeset,conversion stops after the previous successfully converted character. If the inputbuffer ends with an incomplete character or shift sequence (see section on SpecialUsage), conversion stops after the previous successfully converted character. If theoutput buffer is not large enough to hold the entire converted output, conversionstops just prior to the character that would cause the output buffer to overflow. Thevariable pointed to by inbuf is updated to point to the byte following the last bytesuccessfully used in the conversion. The value pointed to by inbyesleft is reduced toreflect the number of bytes still not converted in the input buffer. The variablepointed to by outbuf is updated to point to the byte following the last byte of con-verted output data. The value pointed to by outbytesleft is reduced to reflect thenumber of bytes still available in the output buffer.

If iconv() encounters a character in the input buffer that is legal but for which anidentical character does not exist in the target codeset, iconv() maps this charac-ter to a pre-defined character, called the "galley character" that is defined at the

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−507

A iA

iconv(3C) iconv(3C)

time of table generation. (See genxlt (1)).

iconv_close() Deallocates the conversion descriptor cd and all other associated resources allocatedby iconv_open() .

APPLICATION USAGEPortable applications must assume that conversion descriptors are not valid after calls to any of theexec functions.

Special UsageIn state-dependent encodings, the characters are interpreted depending on "state" of the input. Stateshifts occur when a specific sequence of bytes are seen in the input. These sequences will change the waysubsequent characters are interpreted (that is, initially the characters may be single-byte characters,after a state shift, subsequent characters may be interpreted as two-byte characters). For state-dependent encodings, the conversion descriptor after iconv_open() is in a codeset-dependent initialshift state, ready for immediate use with iconv() .

For state-dependent encodings, the conversion descriptor cd is placed into its initial shift state by a call toiconv() for which the inbuf is a null pointer, or for which inbuf points to a null pointer. Wheniconv() is called in this way, and outbuf is not a null pointer or a pointer to a null pointer, and out-bytesleft points to a positive value, iconv() places the byte sequence to change the output buffer to itsinitial shift state. If the output buffer is not large enough to hold the entire reset sequence, iconv()fails and sets errno to [[E2BIG]]. Subsequent calls with inbuf set to other than a null pointer or apointer to a null pointer cause the conversion to take place from the current state of the conversiondescriptor.

For state-dependent encodings, the conversion descriptor is updated to reflect the shift state in effect atthe end of the last successfully converted byte sequence.

RETURN VALUEiconv_open() Upon successful completion, iconv_open() returns a conversion descriptor for

use on subsequent calls to iconv() . Otherwise iconv_open() returns(iconv_t )−1 and sets errno to indicate the error.

iconv() iconv() updates the variables pointed to by the arguments to reflect the extent ofconversion, and returns the the number of non-identical conversions performed. Ifthe entire string in the input buffer is converted, the value pointed to by inbytesleftis zero. If an error occurs, iconv() returns (size_t )−1 and sets errno to indi-cate the error.

iconv_close() Upon successful completion, iconv_close() returns a value of zero. Otherwiseit returns −1 and sets errno to indicate the error.

ERRORSiconv_open() fails if any of the following conditions are encountered:

[ENOMEM] Insufficient storage space is available.

[EINVAL] The conversion specified by the fromcode and tocode is not supported, or the table ormethod specified in the configuration file could not be read or loaded correctly. Thiserror will also occur if the configuration file itself is faulty.

iconv() fails if any of the following conditions are encountered:

[EILSEQ] Input conversion stopped due to an input character that does not belong to the inputcodeset, or if the conversion table does not contain an entry corresponding to thisinput character and a galley character was not defined for that particular table.

[E2BIG] Input conversion stopped due to lack of space in the output buffer.

[EINVAL] Input conversion stopped due to an incomplete character or shift sequence at theend of the input buffer.

[EBADF] The cd argument is not a valid open conversion descriptor.

iconv_close() fails if any of the following conditions are encountered:

[EBADF] The conversion descriptor is invalid.

Section 3−−508 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A iA

iconv(3C) iconv(3C)

EXAMPLESThe following example shows how the iconv (3C) interfaces maybe used for conversions.

#include <iconv.h>#include <errno.h>

main(){

...convert("roman8", "iso88591", fd);...

}

intconvert(tocode, fromcode, Input)char *tocode; /* tocode name */char *fromcode /* fromcode name */int Input; /* input file descriptor */{

extern void error(); /* local error message */

iconv_t cd; /* conversion descriptor */unsigned char *table; /* ptr to translation table */int bytesread; /* num bytes read into input buffer */unsigned char inbuf[BUFSIZ]; /* input buffer */unsigned char *inchar; /* ptr to input character */int inbytesleft; /* num bytes left in input buffer */unsigned char outbuf[BUFSIZ]; /* output buffer */unsigned char *outchar; /* ptr to output character */int outbytesleft; /* num bytes left in output buffer */size_t ret_val; /* number of conversions */

/* Initiate conversion -- get conversion descriptor */if ((cd = iconv_open(tocode, fromcode)) == (iconv_t)-1) {

error(FATAL, BAD_OPEN);}

inbytesleft = 0; /* no. of bytes converted *//* translate the characters */for ( ;; ) {

/** if any bytes are leftover, they will be in the* beginning of the buffer on the next read().*/

inchar = inbuf; /* points to input buffer */outchar = outbuf; /* points to output buffer */outbytesleft = BUFSIZ; /* no of bytes to be converted */if ((bytesread = read(Input, inbuf+inbytesleft,

(size_t)BUFSIZ-inbytesleft)) < 0) {perror("prog");return BAD;

}if (!(inbytesleft += bytesread)) {

break; /* end of conversions */}

ret_val = iconv(cd, &inchar, &inbytesleft,&outchar, &outbytesleft);

if (write(1, outbuf, (size_t)BUFSIZ-outbytesleft) < 0) {perror("prog");return BAD;

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−509

A iA

iconv(3C) iconv(3C)

}

/* iconv() returns the number of non-identical conversions* performed. If the entire string in the input buffer is* converted, the value pointed to by inbytesleft will be* zero. If the conversion stopped due to any reason, the* value pointed to by inbytesleft will be non-zero and* errno is set to indicate the condition.*/

if ((ret_val == -1) && (errno == EINVAL)) {/* Input conversion stopped due to an incomplete

* character or shift sequence at the end of the* input buffer.*/

/* Copy data left, to the start of buffer */memcpy((char *)inbuf, (char *)inchar,

(size_t)inbytesleft);} else if ((ret_val == -1) && (errno == EILSEQ)) {

/* Input conversion stopped due to an input byte* that does not belong to the input codeset.*/

error(FATAL, BAD_CONVERSION);} else if ((ret_val == -1) && (errno == E2BIG)) {

/* Input conversion stopped due to lack of space* in the output buffer. inbytesleft has the* number of bytes to be converted.*/

memcpy((char *)inbuf, (char *)inchar,(size_t)inbytesleft);

}/* Go back and read from the input file. */

}

/* end conversion & get rid of the conversion table */if (iconv_close(cd) == BAD) {

error(FATAL, BAD_CLOSE);}return GOOD;

}

WARNINGSIf you use iconv (3C) and compile/link your application archive, please note that iconv (3C) has a depen-dency on libdld.sl that will require a change to the compile/link command:

Compile :

cc -Wl,-a,archive -Wl,-E -Wl,+n -l:libdld.sl -o outfile source

Or compile with CCOPTSand LDOPTS:

export CCOPTS="-Wl,-a,archive options -Wl,-E -l:libdld.sl"

export LDOPTS=" options -E +n -l:libdld.sl"

cc -o outfile source

The option -Wl,-a,archive is positionally dependent and should occur at the beginning of the com-pile line. For optimum compatibility in future releases, you should avoid using archive libc with othershared libraries except for libdld.sl as needed above.

There is a corner-case situation for multi-byte characters that is not correctly handled by iconv (3C). Ifthe last character in the file being converted is an invalid multi-byte character, iconv (3C) returns [EIN-VAL] instead of [EILSEQ]. The application can get around this by checking whether EOF is reached or ifthis is the last buffer being converted. In this case, [EINVAL] should be treated as [EILSEQ].

Section 3−−510 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A iA

iconv(3C) iconv(3C)

AUTHORiconv was developed by HP.

FILES/usr/lib/nls/iconv/tables Directory containing tables used for conversion.

/usr/lib/nls/iconv/methods Directory containing methods used for conversion.

/usr/lib/nls/iconv/config.iconv Configuration file is used by iconv_open() to checkif the requested conversion is supported, and if so, todetermine which table and/or method is used for theconversion.

SEE ALSOiconv(1), genxlt(1), thread_safety(5).

STANDARDS CONFORMANCEiconv_open() : XPG4

iconv() : XPG4

iconv_close() : XPG4

HP-UX 11i Version 2: August 2003 − 5 − Hewlett-Packard Company Section 3−−511

A iA

idcok(3X) idcok(3X)(ENHANCED CURSES)

NAMEidcok — enable or disable use of hardware insert- and delete-character features

SYNOPSIS#include <curses.h>

void idcok(WINDOW * win, bool bf);

DESCRIPTIONThe idcok() function specifies whether the implementation may use hardware insert- and delete-character features in win if the terminal is so equipped. If bf is TRUE, use of these features in win isenabled. If bf is FALSE, use of these features in win is disabled. The initial state is TRUE.

RETURN VALUEThe idcok() function does not return a value.

ERRORSNo errors are defined.

SEE ALSOclearok(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−512 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

if_nameindex(3N) if_nameindex(3N)

NAMEif_nameindex(), if_nametoindex(), if_indextoname(), if_freenameindex() - functions that map between aninterface name and index

SYNOPSIS#include <net/if.h>

unsigned int if_nametoindex(const char *ifname);

char *if_indextoname(unsigned int ifindex, char *ifname);

struct if_nameindex *if_nameindex(void);

void if_freenameindex(struct if_nameindex *ptr);

DESCRIPTIONInterfaces are normally known by names such as "lan0", "vlan200" etc., and index is an unique positiveinteger value assigned to an interface. Index values start at 1, and 0 is not a valid index.

if_nametoindex()This function maps an interface name into its corresponding index. If the specified interface namedoes not exist, the return value is set to 0 and errno is set to [ENXIO]. If there is a system error, thereturn value is 0, and errno is set to the appropriate value. For example, if the system is runningout of memory, errno will be set to [ENOMEM].

if_indextoname()This function maps an interface index into its corresponding name. The ifname argument mustpoint to a buffer of at least IF_NAMESIZE bytes into which the interface name corresponding to thespecified index is returned. This pointer is also the return value of the function. IF_NAMESIZE isdefined in <net/if6.h> and its value includes a terminating null byte at the end of the interfacename. If there is no interface corresponding to the specified index, NULL is returned and errno isset to [ENXIO]. If there is a system error, the return value is 0, and errno is set to the appropriatevalue.

if_nameindex()This function returns all interface names and indexes as an array of if_nameindex structures,one structure per interface. The if_nameindex structure is defined in <net/if6.h> .

struct if_nameindex {unsigned int if_index; /* 1, 2, ... */char *if_name; /* null terminated name: "lan0" */

};

The end of the array of structures is indicated by a structure with an if_index of 0, and an if_nameof NULL. The function returns a NULL pointer upon an error, and would set errno to the appropri-ate value.

The memory used for this array of structures along with the interface names pointed to by theif_name members is obtained dynamically. This memory is freed by the nextif_freenameindex() function.

if_freenameindex()This function frees the dynamic memory allocated by if_nameindex() . The argument to thisfunction must be a pointer that was returned by if_nameindex() .

The function prototypes and struct if_nameindex are defined in <net/if6.h> . Applications arenot required to include this header file explicitly; it is automatically included by <net/if.h> .

Applications using these functions should link with -lipv6 .

ERRORSWhen if_nametoindex() or if_indextoname() fails, the following error message is set in errno.

[ENXIO] The specified interface or index does not exist.

AUTHORThese functions were developed by Hewlett-Packard.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−513

A iA

if_nameindex(3N) if_nameindex(3N)

SEE ALSOndp(1M), inet6_opt_init(3N), inet6_rth_space(3N), ip6(7P), ndp(7P).

Section 3−−514 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A iA

ilogb(3M) ilogb(3M)

NAMEilogb( ), ilogbf( ), ilogbl( ), ilogbw( ), ilogbq( ) - radix-independent exponent functions

SYNOPSIS#include <math.h>

int ilogb(double x);

Itanium(R)-based System Onlyint ilogbf(float x);

int ilogbl(long double x);

int ilogbw(extended x);

int ilogbq(quad x);

DESCRIPTIONThe ilogb() function computes the exponent of the floating point value x . Formally, the return value isthe integral part of log base r of |x| as a signed integral value, for nonzero x , where r is the radix of themachine’s floating-point arithmetic. The radix r is 2 on HP-UX systems.

If x is denormal it is treated as though it were normalized before the exponent is determined.

Note: ilogb( x) is equivalent to (int)logb( x) for all values of x except NaN, ±INFINITY, and zero.

Itanium-based System Onlyilogbf() is a float version of ilogb() ; it takes a float argument.

ilogbl() is a long double version of ilogb() ; it takes a long double argument.

ilogbw() is an extended version of ilogb() ; it takes an extended argument.

ilogbq() is equivalent to ilogbl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) ilogbw() or ilogbq() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is NaN, ilogb() returns FP_ILOGBNAN.

If x is ±INFINITY, ilogb() returns INT_MAX.

If x is zero, ilogb() returns FP_ILOGB0.

The macros FP_ILOGBNANand FP_ILOGB0 are defined in <math.h> .

ERRORSNo errors are defined.

SEE ALSOfrexp(3M), logb(3M), scalb(3M), scalbn(3M), scalbln(3M), math(5).

STANDARDS CONFORMANCEilogb() : XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

ilogbf() , ilogbl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−515

A iA

immedok(3X) immedok(3X)(ENHANCED CURSES)

NAMEimmedok — enable or disable immediate terminal refresh

SYNOPSIS#include <curses.h>

void immedok(WINDOW * win, bool bf);

DESCRIPTIONThe immedok() function specifies whether the screen is refreshed whenever the window pointed to bywin is changed. If bf is TRUE, the window is implicitly refreshed on each such change. If bf is FALSE,the window is not implicitly refreshed. The initial state is FALSE.

RETURN VALUEThe immedok() function does not return a value.

ERRORSNo errors are defined.

APPLICATION USAGEThe immedok() function is useful for windows that are used as terminal emulators.

SEE ALSOclearok(3X), doupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−516 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

inch(3X) inch(3X)(CURSES)

NAMEinch, mvinch, mvwinch, winch — input a single-byte character and rendition from a window

SYNOPSIS#include <curses.h>

chtype inch(void);

chtype mvinch(int y, int x);

chtype mvwinch(WINDOW * win, int y, int x);

chtype winch(WINDOW * win);

DESCRIPTIONThese functions return the character and rendition, of type chtype, at the current or specified position inthe current or specified window.

RETURN VALUEUpon successful completion, the functions return the specified character and rendition. Otherwise, theyreturn (chtype)ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the inch() function is explicitly declared asvoid.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−517

A iA

inchnstr(3X) inchnstr(3X)(ENHANCED CURSES)

NAMEinchnstr, inchstr, mvinchnstr, mvinchstr, mvwinchnstr, mvwinchstr, winchnstr, winchstr — input anarray of single-byte characters and renditions from a window

SYNOPSIS#include <curses.h>

int inchnstr(chtype * chstr, int n);

int inchstr(chtype * chstr);

int mvinchnstr(int y, int x, chtype * chstr, int n);

int mvinchstr(int y, int x, chtype * chstr);

int mvwinchnstr(WINDOW * win, int y, int x, chtype * chstr, int n);

int mvwinchstr(WINDOW * win, int y, int x, chtype * chstr);

int winchnstr(WINDOW * win, chtype * chstr, int n);

int winchstr(WINDOW * win, chtype * chstr);

DESCRIPTIONThese functions place characters and renditions from the current or specified window into the arraypointed to by chstr, starting at the current or specified position and ending at the end of the line.

The inchnstr() , mvinchnstr() , mvwinchnstr() and winchnstr() functions store at most nelements from the current or specified window into the array pointed to by chstr.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEReading a line that overflows the array pointed to by chstr with inchstr() , mvinchstr() ,mvwinchstr() or winchstr() causes undefined results. The use of inchnstr() , mvinchnstr() ,mvwinchnstr() or winchnstr() , respectively, is recommended.

SEE ALSOinch(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−518 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

inet(3N) inet(3N)

NAMEinet: inet_addr(), inet_lnaof(), inet_makeaddr(), inet_netof(), inet_network(), inet_ntoa(), inet_ntoa_r() -Internet address manipulation routines

SYNOPSIS#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>

in_addr_t inet_addr(const char *cp);

in_addr_t inet_network(const char *cp);

char *inet_ntoa(struct in_addr in);

struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna);

in_addr_t inet_lnaof(struct in_addr in);

in_addr_t inet_netof(struct in_addr in);

DESCRIPTIONinet_addr()inet_network()

Interpret character strings representing numbers expressed in the Internet stan-dard "dot" notation.

inet_addr() returns numbers suitable for use as Internet addresses.

inet_network() returns numbers suitable for use as Internet networknumbers.

Return values can be assigned to a struct in_addr (defined in/usr/include/netinet/in.h ) by using a technique similar to the following:

struct in_addr addr;char *cp;

addr.s_addr = inet_addr(cp);

inet_ntoa() Take an Internet address and return an ASCII string representing the address indot (. ) notation.

inet_makeaddr() Take an Internet network number and a local network address and construct anInternet address from it.

inet_netof() Break apart Internet host addresses, returning the network number part.

inet_lnaof() Break apart Internet host addresses, returning the local network address part.

All Internet addresses are returned in network order (bytes ordered from left to right). All networknumbers and local address parts are returned as machine-format integer values. Bytes in HP-UX sys-tems are ordered from left to right.

Internet AddressesValues specified using dot notation take one of the following forms:

a . b. c.a . b. ca . ba

When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to thefour bytes of an Internet address.

When a three-part address is specified, the last part is interpreted as a 16-bit quantity and placed in theright-most two bytes of the network address. This makes the three-part address format convenient forspecifying Class B network addresses, as in 128.net.host .

When a two-part address is supplied, the last part is interpreted as a 24-bit quantity and placed in theright-most three bytes of the network address. This makes the two-part address format convenient forspecifying Class A network addresses as in net.host .

When only one part is given, the value is stored directly in the network address without any byte rear-rangement.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−519

A iA

inet(3N) inet(3N)

All numbers supplied as parts in dot notation can be decimal, octal, or hexadecimal, as specified in the Clanguage (i.e., a leading 0x or 0X implies hexadecimal; a leading 0 implies octal; otherwise, the number isinterpreted as decimal).

In a multithreaded application, inet_ntoa() uses thread-specific storage that is re-used in each call.The return value, the character string, should be unique for each thread and should be saved, if desired,before the thread makes the next inet_ntoa() call.

OBSOLESCENT INTERFACESint inet_ntoa_r(struct in_addr in, char *buffer, int buflen);

The above reentrant interface has been moved from libc to libd4r . It is included to support existingapplications and may be removed in a future release. New multithreaded applications should use theregular API (those without the _r suffix.)

The reentrant interface functions the same as the regular interface without the _r suffix. However,inet_ntoa_r() expects to be passed the address of a character buffer and will store the result at thesupplied location. If the buffer is of insufficient length, −1 is returned. If the operation is successful, thelength of the result string (not including the terminating null character) is returned.

RETURN VALUEinet_addr() and inet_network() return −1 for malformed requests.

AUTHORinet routines were developed by the University of California, Berkeley.

SEE ALSOgethostent(3N), getnetent(3N), hosts(4), networks(4), thread_safety(5).

Section 3−−520 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A iA

inet6(3N) inet6(3N)

NAMEinet_pton(), inet_ntop() - Internet address manipulation routines for IP Version 4 and later

SYNOPSIS#include <sys/socket.h>#include <arpa/inet.h>

int inet_pton(int af, const char *src, void *dst);

const char *inet_ntop(int af, const void *src,char *dst, size_t size);

DESCRIPTIONThe functions inet_pton() and inet_ntop() are new with IP Version 6 (IPv6) and work with bothIP Version 4 (IPv4) and IPv6 addresses. The letters "p" and "n" stand for presentation and numeric .The presentation format for an address is often an ASCII string and the numeric format is the binaryvalue that goes into a socket address structure.

The ASCII string is either the IPv4 address in dot notation or an IPv6 address in colon notation. Anexample of an ASCII string is 15.10.43.255 or 1080::2538:400:25:800:200C:417A .

The binary value is the hex representation of the IPv4/IPv6 address. This binary value resides in thein_addr structure for IPv4 address and in the in6_addr structure for IPv6 address. (Refer to theinet (3N) manpage for more details.)

The functions inet_pton() and inet_ntop() are opposite of each other. The functioninet_pton() converts an ASCII address string to binary address, and the function inet_ntop()converts a binary address into ASCII address string. Also, these are equivalent to inet_addr() andinet_ntoa() , respectively.

The inet_pton() FunctionThe inet_pton() function converts an address in its standard text presentation form into its numericbinary form.

The af argument specifies the family of the address. Currently, the AF_INET and AF_INET6 addressfamilies are supported.

The src argument points to the IPv6/IPv4 address string being passed in.

The dst argument points to a buffer in which the function stores the numeric address. The address isreturned in network byte order.

inet_pton() returns 1 if the conversion succeeds, 0 if the input is not a valid IPv4 dotted-decimalstring or a valid IPv6 address string, or -1 with errno set to [EAFNOSUPPORT] if the af argument isunknown.

The calling application must ensure that the buffer referred to by dst is large enough to hold the numericaddress (e.g., 4 bytes for AF_INET or 16 bytes for AF_INET6 ).

If the af argument is AF_INET , the function accepts a string in the standard IPv4 dotted-decimal form:

ddd.ddd.ddd.ddd

where ddd is a one to three digit decimal number between 0 and 255. Note that many implementations ofthe existing inet_addr() and inet_aton() functions accept nonstandard input: octal numbers,hexadecimal numbers, and fewer than four numbers. inet_pton() does not accept these formats.

If the af argument is AF_INET6 , then the function accepts a string in one of the standard IPv6 textforms. (Refer to the IPv6 address notation below for more details).

The inet_ntop() FunctionThe inet_ntop() function converts a numeric address into a text string suitable for presentation.

The af argument specifies the family of the address. This can be AF_INET or AF_INET6 .

The src argument points to a buffer holding an IPv4 address if the af argument is AF_INET , or an IPv6address if the af argument is AF_INET6 .

The dst argument points to a buffer where the function will store the resulting text string.

The size argument specifies the size of this buffer. The application must specify a non-NULL dst argu-ment. For IPv6 addresses, the buffer must be at least 46-octets. For IPv4 addresses, the buffer must be atleast 16-octets. In order to allow applications to easily declare buffers of the proper size to store IPv4 and

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−521

A iA

inet6(3N) inet6(3N)

IPv6 addresses in string form, the following two constants are defined in <netinet/in.h> :

#define INET_ADDRSTRLEN 16#define INET6_ADDRSTRLEN 46

The inet_ntop() function returns a pointer to the buffer containing the text string if the conversionsucceeds, and NULL otherwise. Upon failure, errno is set to [EAFNOSUPPORT] if the af argument isinvalid, or [ENOSPC] if the size of the result buffer is inadequate.

IPv6 Address NotationThe IPv6 address is 128 bytes long. Example of an IPv6 address is as shown below:

FEDC:BA98:7654:3210:FEDC:BA98:7654:3210

The 128 bits are written as eight 16-bit integers separated by colons. Each integer is represented by fourhexadecimal digits.

In the initial stages all the 128 bits will not be used, hence, it is very likely that there will be many zeros.Hence the IP address in such a scenario will look like this:

1080:0:0:0:0:800:200C:417A

The above address can be represented in a compact fashion, by replacing a set of consecutive null 16-bitnumbers by two colons. The above address can now be re-written as follows:

1080::800:200C:417A

Expanding the abbreviation is very simple. Align whatever is at the left of the double colon to the left ofthe address: these are the leading 16-bit words. Then align whatever is at the right of the colons to theright of the address and fill up with zeros.

The double-colon convention can be used only once inside an address.

To support the transition from IPv4, two special IPv6 addresses are supported. They are IPv4-compatible addresses and IPv4-mapped addresses.

IPv4-Compatible Addresses Description and ExampleIPv4-compatible addresses can be converted to and from the older IPv4 network address format. They areused when IPv6 systems need to communicate with each other, but are separated by an IPv4 network.

IPv4-compatible addresses are formed by prepending 96 bits of zero, to a valid, 32-bit IPv4 address. Forexample, the IPv4 address of

1.2.3.4

can be converted to the IPv6 address by first converting each decimal number separated by dots (".") to a2-digit hexadecimal value, and concatenate into 4-digit hex values between colons (":") as listed below.

::0102:0304

In addition, leading zeros may be omitted for each hex number between the colons. Therefore, this may bewritten as the following IPv6 address:

::102:304

We can retain the dot-decimal format and re-write the above address as

::1.2.3.4

The above address is also a valid IPv4-compatible IPv6 address.

IPv4-Mapped Addresses Description and ExampleIPv4-mapped addresses indicate systems that do not support IPv6. They are limited to IPv4. An IPv6 hostcan communicate with an IPv4-only host using the IPv4-mapped IPv6 address.

IPv4-mapped addresses are formed by prepending 80 bits of zero, and 16 bits of one’s, to a valid 32 bitIPv4 address. An IPv4 address of

1.2.3.5

when mapped to IPv6, it becomes:

::FFFF:1.2.3.5

Section 3−−522 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A iA

inet6(3N) inet6(3N)

or

::FFFF:102:305

AUTHORThese inet routines were developed by the University of California, Berkeley.

SEE ALSOgethostent(3N), getnetent(3N), inet(3N), hosts(4), networks(4).

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−523

A iA

inet6_opt_init(3N) inet6_opt_init(3N)

NAMEinet6_opt_init(), inet6_opt_append(), inet6_opt_find(), inet6_opt_finish(), inet6_opt_get_val(),inet6_opt_next(), inet6_opt_set_val() - IPv6 Hop-by-Hop and Destination options manipulation functions.

SYNOPSIS#include <netinet/in.h>

int inet6_opt_append(void *extbuf, size_t extlen, int prevlen,uint8_t type, size_t len, uint_t align,void **databufp);

int inet6_opt_find(void *extbuf, size_t extlen, int prevlen,uint8_t type, size_t *lenp,void **databufp);

int inet6_opt_finish(void *extbuf, size_t extlen, int prevlen);

int inet6_opt_get_val(void *databuf, size_t offset, void *val,int vallen);

int inet6_opt_init(void *extbuf, size_t extlen);

int inet6_opt_next(void *extbuf, size_t extlen, int prevlen,uint8_t *typep, size_t *lenp,void **databufp);

int inet6_opt_set_val(void *databuf, size_t offset, void *val,int vallen);

DESCRIPTIONThese functions can be used by applications to build and parse the IPv6 Hop-by-Hop and Destinationoptions header. The Hop-by-Hop option header is used to carry optional information that must be exam-ined by every node along a packet’s delivery path and the Destination option header is used to carryoptional information that needs to be examined only by a packet’s destination node(s).

To receive Hop-by-Hop options the application must enable the IPV6_RECVHOPOPTSsocket option:

int on = 1;setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &on, sizeof(on));

To send a Hop-by-Hop options header, the application specifies the header either as ancillary data in acall to sendmsg() or using setsockopt() .

The application can remove any sticky Hop-by-Hop extension header by calling setsockopt() forIPV6_HOPOPTSwith a zero option length.

To receive Destination options appearing after a Routing header (or in a packet without a Routingheader) the application must enable the IPV6_RECVDSTOPTSsocket option:

int on = 1;setsockopt(fd, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &on, sizeof(on));

To receive Destination options appearing before a Routing header the application must enable theIPV6_RECVRTHDRDSTOPTSsocket option:

int on = 1;setsockopt(fd, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &on, sizeof(on));

To send a Destination options header, the application specifies it either as ancillary data in a call tosendmsg() or using setsockopt() .

The application can remove any sticky Destination extension header by calling setsockopt() forIPV6_RTHDRDSTOPTS/IPV6_DSTOPTSwith a zero option length.

inet6_opt_init()This function returns the number of bytes needed for the empty extension header without anyoptions. If extbuf is not NULL, it also initializes the extension header to have the correct lengthfield. If the extlen value is not a positive multiple of 8, the function fails and returns -1.

inet6_opt_append()This function returns the updated total length required to add an option with length len and align-ment align . If extbuf is not NULL, then in addition to returning the length, this function also

Section 3−−524 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

inet6_opt_init(3N) inet6_opt_init(3N)

inserts any needed pad option, initializes the option (sets the type and length fields), and returns apointer to the location for the option content in databufp . If the option specified by the type does notfit in the extension header buffer then the function returns -1.

The third parameter prevlen should be the length returned by inet6_opt_init() or by a previ-ous inet6_opt_append() .

The parameter type is the 8-bit option type and it must be a value from 2 to 255, inclusive. 0 and 1are reserved for the Pad1 and PadN options, respectively.

The parameter len is the length of the option data excluding the option type and option length fields.It must have a value between 0 and 255, inclusive, and it specifies the length of the option data thatfollows the option header.

The align parameter must have a value of 1, 2, 4, or 8. The align value can not exceed the value oflen .

Once inet6_opt_append() has been called, the application can use databuf directly, or useinet6_opt_set_val() to specify (set) the contents of the option.

inet6_opt_finish()This function returns the updated total length including the final padding of the extension header tomake the header a multiple of 8 bytes.

If extbuf is not NULL, the function also initializes the option by inserting a Pad1 or PadN option ofthe proper length. If the necessary pad does not fit in the extension header buffer, the functionreturns -1.

The parameter prevlen should be the length returned by inet6_opt_init() orinet6_opt_append() .

inet6_opt_set_val()This function inserts data items of various sizes (1, 2, 4, or 8 bytes) in the data portion of the option.After inserting, the function returns the offset for the next field (offset + vallen ) which can be usedwhen composing option content with multiple fields. The parameter val points to the data to beinserted and the parameter offset specifies where in the data portion of the option the value shouldbe inserted. The first byte after the option type and length is accessed by specifying an offset of zero.

The parameter databuf should be a pointer returned by inet6_opt_append() .

inet6_opt_next()This function parses extension header options received by the application and it returns the offset ofthe next option.

The parameters extbuf and extlen specify the extension header.

The parameter prevlen is either zero (for the first option) or the length returned by a previous call toinet6_opt_next() or inet6_opt_find() . prevlen specifies the position where to continuescanning the extension buffer. The next option is returned by updating the parameters databufptypep , and lenp . This function returns the updated "previous" length computed by advancing pastthe option that was returned. This returned "previous" length can then be passed to subsequentcalls to inet6_opt_next() .

This function does not return any Pad1 or PadN options. When there are no more options or if theoption extension header is malformed, the return value is -1.

inet6_opt_find()This function is similar to the inet6_opt_next() function but this function lets the callerspecify the option type to be searched for instead of always returning the next option in the exten-sion header.

If an option of the specified type is located, the function returns the updated "previous" total length.This "previous" total length is computed by advancing past the option that was returned and pastany options that did not match the type. This returned previous length can then be passed to subse-quent calls to inet6_opt_find() for finding the next occurrence of the same option type.

If an option of the specified type is not located or the option extension header is malformed, thereturn value is -1.

inet6_opt_get_val()This function extracts data items of various sizes (1, 2, 4, or 8 bytes) in the data portion of theoption. The function returns the offset for the next field (offset + vallen ) which can be used when

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−525

A iA

inet6_opt_init(3N) inet6_opt_init(3N)

extracting option content with multiple fields.

The first parameter databuf should be a pointer returned by inet6_opt_next() orinet6_opt_find() containing the data portion of the option.

offset parameter specifies from where in the data portion of the option the value should be extracted.The first byte after the option type and length is accessed by specifying an offset of zero.

val points to the destination for the extracted data.

To use these functions, the application must be compiled with:

-D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -lxnet -lipv6

These APIs are implemented based on internet-draft Advanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> . The APIs may be updated, replaced, or obsoleted based on future changes to the docu-ment.

RETURN VALUEinet6_opt_init() , inet6_opt_append() , inet6_opt_finish() , inet6_opt_next() , andinet6_opt_find() return -1 on an error.

EXAMPLESThe Advanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> document gives a comprehensiveexample in Appendix C.

AUTHORThe APIs were developed by HP.

SEE ALSOip6(7P).

Advanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> .

Section 3−−526 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A iA

inet6_rth_space(3N) inet6_rth_space(3N)

NAMEinet6_rth_add(), inet6_rth_getaddr(), inet6_rth_init(), inet6_rth_reverse(), inet6_rth_segments(),inet6_rth_space() - IPv6 Routing header options manipulation functions.

SYNOPSIS#include <netinet/in.h>

size_t inet6_rth_space(int type, int segments);

void *inet6_rth_init(void *bp, int bp_len, int type, int segments);

int inet6_rth_add(void *bp, const struct in6_addr *addr);

int inet6_rth_reverse(const void *in, void *out);

int inet6_rth_segments(const void *bp);

struct in6_addr *inet6_rth_getaddr(const void *bp, int index);

DESCRIPTIONThese functions can be used by an application to build and examine an IPv6 Routing header. The Rout-ing header can be used by an IPv6 source to list one or more intermediate nodes to be visited on the wayto a packet’s destination.

These three functions build a Routing header:

inet6_rth_space() returns the number of bytes required for a Routing header.

inet6_rth_init() initializes the buffer data for a Routing header.

inet6_rth_add() adds one IPv6 address to the Routing header.

Three functions deal with a returned Routing header:

inet6_rth_reverse() reverses a Routing header.

inet6_rth_segments() returns the number of segments in a Routing header.

inet6_rth_getaddr() fetches one address from a Routing header.

To receive a Routing header the application must enable the IPV6_RECVRTHDRsocket option:

int on = 1;setsockopt(fd, IPPROTO_IPV6, IPV6_RECVRTHDR, &on, sizeof(on));

To send a Routing header the application specifies it either as ancillary data in a call to sendmsg() orusing setsockopt() (see send (2) and getsockopt (2), respectively).

inet6_rth_space()This function returns the number of bytes required to hold a routing header of the specified typecontaining the specified number of segments (addresses). For an IPv6 Type 0 Routing header, thenumber of segments must be between 0 and 127, inclusive. The return value is just the space forthe Routing header. When the application uses ancillary data, it must pass the returned length toCMSG_LEN()to determine how much memory is needed for the ancillary data object (including thecmsghdr structure).

If the return value is 0, then either the type of the Routing header is not supported by this imple-mentation or the number of segments is invalid for this type of Routing header.

This function returns the size but does not allocate the space required for the ancillary data.

inet6_rth_init()This function initializes the buffer pointed to by bp to contain a Routing header of the specified type .bp_len is only used to verify if the buffer is large enough.

The caller must allocate the buffer, and its size can be determined by callinginet6_rth_space() .

Upon success, the return value is the pointer to the buffer (bp), and the pointer is then used as thefirst argument to the inet6_rth_add() function. Upon an error, the return value is NULL.

inet6_rth_add()This function adds the IPv6 address pointed to by addr to the end of the Routing header being con-structed.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−527

A iA

inet6_rth_space(3N) inet6_rth_space(3N)

If successful, the segleft member of the Routing header is updated to account for the new address inthe Routing header and the return value of the function is 0. Upon an error the return value of thefunction is -1.

inet6_rth_reverse()This function takes a Routing header extension header pointed to by the first argument in andwrites a new Routing header. The new Routing header sends datagrams along the reverse of thatroute. The function reverses the order of the addresses and sets the segleft member in the new rout-ing header to the number of segments. Both arguments are allowed to point to the same buffer (thatis, the reversal can occur in place).

The return value of the function is 0 on success, or -1 upon an error.

inet6_rth_segments()This function returns the number of segments (addresses) contained in the Routing headerdescribed by bp which can be 0 or greater.

The return value of the function is -1 upon an error.

inet6_rth_getaddr()This function returns a pointer to the IPv6 address specified by index (which must be a valuebetween 0 and one less than the value returned by inet6_rth_segments()) in the Routingheader described by bp .

An application should first call inet6_rth_segments() to obtain the number of segments in theRouting header.

Upon an error, the return value of the function is NULL.

To use these functions, the application must be compiled with:

-D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -lxnet -lipv6

The APIs are implemented based on internet-draft Advanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> . The APIs may be updated, replaced, or obsoleted based on future changes to the docu-ment.

EXAMPLESAdvanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> gives a comprehensive example inAppendix B.

AUTHORThe APIs were developed by HP.

SEE ALSOsend(2), getsockopt(2), ip6(7P).

Advanced Sockets API for IPv6 <draft-ietf-ipngwg-2292bis-02.txt> .

Section 3−−528 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A iA

initgroups(3C) initgroups(3C)

NAMEinitgroups( ) - initialize group access list

SYNOPSIS#include <unistd.h>

int initgroups(const char *name, gid_t basegid);

DESCRIPTIONinitgroups() reads the login group file, /etc/logingroup , and sets up the group access list forthe user specified by name , using the setgroups (2) system call. If the value of basegid is zero or positive,it is automatically included in the groups list. Typically this value is given as the group number from thepassword file. If the login group file is empty, basegid is the only member of the list.

RETURN VALUEinitgroups() returns -1 if it was not invoked by a user with appropriate privileges.

WARNINGSinitgroups() uses the routines based on getgrent (3C). If the invoking program uses any of these rou-tines, the group structure is overwritten by the call to initgroups() . Subsequent calls to init-groups() with the same name parameter override the actions of previous calls.

On many systems, no one seems to keep /etc/logingroup up to date.

initgroups() uses the Dynamic Name Service Switch. (See nsswitch.conf(4).) An application thatuses this interface cannot be fully archive bound.

NETWORKING FEATURESNFS

If /etc/logingroup is linked to /etc/group , initgroups() tries to use the Network Informa-tion Service (NIS) for entries beginning with a plus sign (+). If group membership for name is managed byNIS, and no NIS server is able to respond, a call to initgroups() does not return until a server doesrespond. This causes commands such as login (1) and su(1) to wait indefinitely.

See group (4) for proper syntax and operation.

AUTHORinitgroups() was developed by the University of California, Berkeley.

FILES/etc/logingroup login group file

SEE ALSOlogin(1), su(1), getgroups(2), setgroups(2), group(4), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−529

A iA

initscr(3X) initscr(3X)(CURSES)

NAMEinitscr, newterm — screen initialisation functions

SYNOPSIS#include <curses.h>

WINDOW *initscr(void);

SCREEN *newterm(char * type, FILE * outfile, FILE * infile);

DESCRIPTIONThe initscr() function determines the terminal type and initialises all implementation data struc-tures. The TERMenvironment variable specifies the terminal type. The initscr() function alsocauses the first refresh operation to clear the screen. If errors occur, initscr() writes an appropriateerror message to standard error and exits. The only functions that can be called before initscr() ornewterm() are filter() , ripoffline() , slk_init() , use_env() and the functions whoseprototypes are defined in <term.h> . Portable applications must not call initscr() twice.

The newterm() function can be called as many times as desired to attach a terminal device. The typeargument points to a string specifying the terminal type, except that if type is a null pointer, the TERMenvironment variable is used. The outfile and infile arguments are file pointers for output to the terminaland input from the terminal, respectively. It is unspecified whether Curses modifies the buffering modeof these file pointers. The newterm() function should be called once for each terminal.

The initscr() function is equivalent to:

newterm(getenv("TERM"), stdout, stdin);return stdscr;

If the current disposition for the signals SIGINT, SIGQUIT or SIGTSTP is SIGDFL, then initscr()may also install a handler for the signal, which may remain in effect for the life of the process or until theprocess changes the disposition of the signal.

The initscr() and newterm() functions initialise the cur_term external variable.

RETURN VALUEUpon successful completion, initscr() returns a pointer to stdscr . Otherwise, it does not return.

Upon successful completion, newterm() returns a pointer to the specified terminal. Otherwise, itreturns a null pointer.

ERRORSNo errors are defined.

APPLICATION USAGEA program that outputs to more than one terminal should use newterm() for each terminal instead ofinitscr() . A program that needs an indication of error conditions, so it can continue to run in a line-oriented mode if the terminal cannot support a screen-oriented program, would also use this function.

Applications should perform any required handling of the SIGINT, SIGQUIT or SIGTSTP signals beforecalling initscr() .

SEE ALSOdelscreen(3X), doupdate(3X), del_curterm(3X), filter(3X), slk_attroff(3X), use_env(3X), terminfo(4), seeSelecting a Terminal , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The newterm() function is merged with this entry. In previous issues, it appeared in an entry of itsown.

The entry is rewritten for clarity. The argument list for the initscr() function is explicitly declared asvoid.

Section 3−−530 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

innstr(3X) innstr(3X)(ENHANCED CURSES)

NAMEinnstr, instr, mvinnstr, mvinstr, mvwinnstr, mvwinstr, winnstr, winstr — input a multi-byte characterstring from a window

SYNOPSIS#include <curses.h>

int innstr(char * str, int n);

int instr(char * str);

int mvinnstr(int y, int x, char * str, int n);

int mvinstr(int y, int x, char * str);

int mvwinnstr(WINDOW * win, int y, int x, char * str, int n);

int mvwinstr(WINDOW * win, int y, int x, char * str);

int winnstr(WINDOW * win, char * str, int n);

int winstr(WINDOW * win, char * str);

DESCRIPTIONThese functions place a string of characters from the current or specified window into the array pointed toby str, starting at the current or specified position and ending at the end of the line.

The innstr() , mvinnstr() , mvwinnstr() and winnstr() functions store at most n bytes in thestring pointed to by str.

The innstr() , mvinnstr() , mvwinnstr() and winnstr() functions will only store the entiremulti-byte sequence associated with a character. If the array is large enough to contain at least one char-acter the array is filled with complete characters. If the array is not large enough to contain any completecharacters, the function fails.

RETURN VALUEUpon successful completion, instr() , mvinstr() , mvwinstr() and winstr() return OK.

Upon successful completion, innstr() , mvinnstr() , mvwinnstr() and winnstr() return thenumber of characters actually read into the string.

Otherwise, all these functions return ERR.

ERRORSNo errors are defined.

APPLICATION USAGESince multi-byte characters may be processed, there might not be a one-to-one correspondence betweenthe number of column positions on the screen and the number of bytes returned.

These functions do not return rendition information.

Reading a line that overflows the array pointed to by str with instr() , mvinstr() , mvwinstr() orwinstr() causes undefined results. The use of innstr() , mvinnstr() , mvwinnstr() orwinnstr() , respectively, is recommended.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−531

A iA

innwstr(3X) innwstr(3X)(ENHANCED CURSES)

NAMEinnwstr, inwstr, mvinnwstr, mvinwstr, mvwinnwstr, mvwinwstr, winnwstr, winwstr — input a string ofwide characters from a window

SYNOPSIS#include <curses.h>

int innwstr(wchar_t * wstr, int n);

int inwstr(wchar_t * wstr);

int mvinnwstr(int y, int x, wchar_t * wstr, int n);

int mvinwstr(int y, int x, wchar_t * wstr);

int mvwinnwstr(WINDOW * win, int y, int x, wchar_t * wstr, int n);

int mvwinwstr(WINDOW * win, int y, int x, wchar_t * wstr);

int winnwstr(WINDOW * win, wchar_t * wstr, int n);

int winwstr(WINDOW * win, wchar_t * wstr);

DESCRIPTIONThese functions place a string of wchar_t characters from the current or specified window into the arraypointed to by wstr starting at the current or specified cursor position and ending at the end of the line.

These functions will only store the entire wide character sequence associated with a spacing complexcharacter. If the array is large enough to contain at least one complete spacing complex character, thearray is filled with complete characters. If the array is not large enough to contain any complete charac-ters this is an error.

The innwstr() , mvinnwstr() , mvwinnwstr() and winnwstr() functions store at most n charac-ters in the array pointed to by wstr.

RETURN VALUEUpon successful completion, inwstr() , mvinwstr() , mvwinwstr() and winwstr() return OK.

Upon successful completion, innwstr() , mvinnwstr() , mvwinnwstr() and winnwstr() returnthe number of characters actually read into the string.

Otherwise, all these functions return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEReading a line that overflows the array pointed to by wstr with inwstr() , mvinwstr() ,mvwinwstr() or winwstr() causes undefined results. The use of innwstr() , mvinnwstr() ,mvwinnwstr() or winnwstr() , respectively, is recommended.

These functions do not return rendition information.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−532 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

insch(3X) insch(3X)(CURSES)

NAMEinsch, mvinsch, mvwinsch, winsch — insert a single-byte character and rendition into a window

SYNOPSIS#include <curses.h>

int insch(chtype ch);

int mvinsch(int y, int x, chtype ch);

int mvwinsch(WINDOW * win, int y, int x, chtype ch);

int winsch(WINDOW * win, chtype ch);

DESCRIPTIONThese functions insert the character and rendition from ch into the current or specified window at thecurrent or specified position.

These functions do not perform wrapping. These functions do not advance the cursor position. Thesefunctions perform special-character processing, with the exception that if a newline is inserted into thelast line of a window and scrolling is not enabled, the behaviour is unspecified.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThese functions are only guaranteed to operate reliably on character sets in which each character fits intoa single byte, whose attributes can be expressed using only constants with the A_ prefix.

SEE ALSOins_wch(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−533

A iA

insdelln(3X) insdelln(3X)(ENHANCED CURSES)

NAMEinsdelln, winsdelln — delete or insert lines into a window

SYNOPSIS#include <curses.h>

int insdelln(int n);

int winsdelln(WINDOW * win, int n);

DESCRIPTIONThe insdelln() and winsdelln() functions perform the following actions:

• If n is positive, these functions insert n lines into the current or specified window before thecurrent line. The n last lines are no longer displayed.

• If n is negative, these functions delete n lines from the current or specified window starting withthe current line, and move the remaining lines toward the cursor. The last n lines are cleared.

The current cursor position remains the same.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOdeleteln(3X), insertln(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−534 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

insertln(3X) insertln(3X)(CURSES)

NAMEinsertln, winsertln — insert lines into a window

SYNOPSIS#include <curses.h>

int insertln(void);

int winsertln(WINDOW * win);

DESCRIPTIONThe insertln() and winsertln() functions insert a blank line before the current line in the currentor specified window. The bottom line is no longer displayed. The cursor position does not change.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOinsdelln(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the insertln() function is explicitly declaredas void.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−535

A iA

insnstr(3X) insnstr(3X)(ENHANCED CURSES)

NAMEinsnstr, insstr, mvinsnstr, mvinsstr, mvwinsnstr, mvwinsstr, winsnstr, winsstr — insert a multi-bytecharacter string into a window

SYNOPSIS#include <curses.h>

int insnstr(const char * str, int n);

int insstr(const char * str);

int mvinsnstr(int y, int x, const char * str, int n);

int mvinsstr(int y, int x, const char * str);

int mvwinsnstr(WINDOW * win, int y, int x, const char * str, int n);

int mvwinsstr(WINDOW * win, int y, int x, const char * str);

int winsnstr(WINDOW * win, const char * str, int n);

int winsstr(WINDOW * win, const char * str);

DESCRIPTIONThese functions insert a character string (as many characters as will fit on the line) before the current orspecified position in the current or specified window.

These functions do not advance the cursor position. These functions perform special-character process-ing. The innstr() and innwstr() functions perform wrapping. The instr() and inswstr()functions do not perform wrapping.

The insnstr() , mvinsnstr() , mvwinsnstr() and winsnstr() functions insert at most n bytes.If n is less than 1, the entire string is inserted.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGESince the string may contain multi-byte characters, there might not be a one-to-one correspondencebetween the number of column positions occupied by the characters and the number of bytes in the string.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−536 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

insque(3C) insque(3C)

NAMEinsque(), remque() - insert or remove an element in a queue

SYNOPSIS#include <search.h>

void insque(void *element, void *pred);

void remque(void *element);

DESCRIPTIONThe insque() and remque() functions manipulate queues built from doubly-linked lists. An applica-tion using these functions must define a structure in which the first two members of the structure arepointers to the same type of structure. Any additional members of the structure are application specific.The first two members of the structure are used for forward and backward pointers. The names of thestructure and of the pointers are not subject to any restrictions.

The insque() function inserts the object pointed to by the element argument into a queue immediatelyafter the object pointed to by the pred argument.

The remque() function removes the object pointed to by the element argument from a queue.

AUTHORinsque() and remque() were developed by HP and the University of California, Berkeley.

SEE ALSOthread_safety(5).

STANDARDS COMPLIANCEinsque() : XPG4.2

remque() : XPG4.2

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−537

A iA

ins_nwstr(3X) ins_nwstr(3X)(ENHANCED CURSES)

NAMEins_nwstr, ins_wstr, mvins_nwstr, mvins_wstr, mvwins_nwstr, mvwins_wstr, wins_nwstr, wins_wstr —insert a wide-character string into a window

SYNOPSIS#include <curses.h>

int ins_nwstr(const wchar_t * wstr, int n);

int ins_wstr(const wchar_t * wstr);

int mvins_nwstr(int y, int x, const wchar_t * wstr, int n);

int mvins_wstr(int y, int x, const wchar_t * wstr);

int mvwins_nwstr(WINDOW * win, int y, int x, const wchar_t * wstr, int n);

int mvwins_wstr(WINDOW * win, int y, int x, const wchar_t * wstr);

int wins_nwstr(WINDOW * win, const wchar_t * wstr, int n);

int wins_wstr(WINDOW * win, const wchar_t * wstr);

DESCRIPTIONThese functions insert a wchar_t character string (as many wchar_t characters as will fit on the line) inthe current or specified window immediately before the current or specified position.

Any non-spacing characters in the string are associated with the first spacing character in the string thatprecedes the non-spacing characters. If the first character in the string is a non-spacing character, thesefunctions will fail.

These functions do not perform wrapping. These functions do not advance the cursor position. Thesefunctions perform special-character processing.

The ins_nwstr() , mvins_nwstr() , mvwins_nwstr() and wins_nwstr() functions insert atmost n wchar_t characters. If n is less than 1, then the entire string is inserted.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−538 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

ins_wch(3X) ins_wch(3X)(ENHANCED CURSES)

NAMEins_wch, mvins_wch, mvwins_wch, wins_wch — insert a complex character and rendition into a window

SYNOPSIS#include <curses.h>

int ins_wch(const cchar_t * wch);

int wins_wch(WINDOW * win, const cchar_t * wch);

int mvins_wch(int y, int x, const cchar_t * wch);

int mvwins_wch(WINDOW * win, int y, int x, const cchar_t * wch);

DESCRIPTIONThese functions insert the complex character wch with its rendition in the current or specified window atthe current or specified cursor position.

These functions do not perform wrapping. These functions do not advance the cursor position. Thesefunctions perform special-character processing, with the exception that if a newline is inserted into thelast line of a window and scrolling is not enabled, the behaviour is unspecified.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEFor non-spacing characters, add_wch() can be used to add the non-spacing characters to a spacing com-plex character already in the window.

SEE ALSOadd_wch(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−539

A iA

intrflush(3X) intrflush(3X)(CURSES)

NAMEintrflush — enable or disable flush on interrupt

SYNOPSIS#include <curses.h>

int intrflush(WINDOW * win, bool bf);

DESCRIPTIONThe intrflush() function specifies whether pressing an interrupt key (interrupt, suspend or quit) willflush the input buffer associated with the current screen. If bf is TRUE, pressing an interrupt key willflush this input buffer. If bf is FALSE, pressing an interrupt key will not flush this input buffer. Thedefault for the option is inherited from the display driver settings. The win argument must refer to awindow associated with the current screen.

RETURN VALUEUpon successful completion, intrflush() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe same effect is achieved outside Curses using the NOFLSH local mode flag specified in the X/OpenSystem Interface Definitions, Issue 4, Version 2 specification (General Terminal Interface ).

SEE ALSOcurses_intro(3X), see subsection Input Processing, <curses.h>, X/Open System Interface Definitions, Issue4, Version 2 specification, Section 9.2, Parameters That Can Be Set .

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

Section 3−−540 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

in_wch(3X) in_wch(3X)(ENHANCED CURSES)

NAMEin_wch, mvin_wch, mvwin_wch, win_wch — input a complex character and rendition from a window

SYNOPSIS#include <curses.h>

int in_wch(cchar_t * wcval);

int mvin_wch(int y, int x, cchar_t * wcval);

int mvwin_wch(WINDOW * win, int y, int x, cchar_t * wcval);

int win_wch(WINDOW * win, cchar_t * wcval);

DESCRIPTIONThese functions extract the complex character and rendition from the current or specified position in thecurrent or specified window into the object pointed to by wcval.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSO<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−541

A iA

in_wchnstr(3X) in_wchnstr(3X)(ENHANCED CURSES)

NAMEin_wchnstr, in_wchstr, mvin_wchnstr, mvin_wchstr, mvwin_wchnstr, mvwin_wchstr, win_wchnstr,win_wchstr — input an array of complex characters and renditions from a window

SYNOPSIS#include <curses.h>

int in_wchnstr(cchar_t * wchstr, int n);

int in_wchstr(cchar_t * wchstr);

int mvin_wchnstr(int y, int x, cchar_t * wchstr, int n);

int mvin_wchstr(int y, int x, cchar_t * wchstr);

int mvwin_wchnstr(WINDOW * win, int y, int x, cchar_t * wchstr, int n);

int mvwin_wchstr(WINDOW * win, int y, int x, cchar_t * wchstr);

int win_wchnstr(WINDOW * win, cchar_t * wchstr, int n);

int win_wchstr(WINDOW * win, cchar_t * wchstr);

DESCRIPTIONThese functions extract characters from the current or specified window, starting at the current orspecified position and ending at the end of the line, and place them in the array pointed to by wchstr .

The in_wchnstr() , mvin_wchnstr() , mvwin_wchnstr() and win_wchnstr() fill the arraywith at most n cchar_t elements.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

APPLICATION USAGEReading a line that overflows the array pointed to by wchstr with in_wchstr() , mvin_wchstr() ,mvwin_wchstr() or win_wchstr() causes undefined results. The use of in_wchnstr() ,mvin_wchnstr() , mvwin_wchnstr() or win_wchnstr() , respectively, is recommended.

SEE ALSOin_wch(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−542 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

isastream(3C) isastream(3C)

NAMEisastream( ) - determine if a file descriptor refers to a STREAMS device or STREAMS-based pipe

SYNOPSIS#include <stropts.h>

int isastream(int fd);

DESCRIPTIONThe isastream() function tests whether an open file descriptor (fd) corresponds to a STREAMS deviceor STREAMS-based pipe.

RETURN VALUEUpon successful completion, the isastream() function returns a value of 1 when the file descriptor ofthe open file specified by fd is a STREAMS device or STREAMS-based pipe, and 0 (zero) if it is not astream, but is a valid open file descriptor. Otherwise, a value of -1 is returned, and errno is set to indi-cate the error.

ERRORSIf any of the following conditions occur, the isastream() function sets errno to the correspondingvalue:

[EBADF] The specified file descriptor does not refer to a valid open file.

SEE ALSOfattach(3C), fdetach(3C), streamio(7).

STANDARDS COMPLIANCEisastream() : SVID3

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−543

A iA

isendwin(3X) isendwin(3X)(ENHANCED CURSES)

NAMEisendwin — determine whether a screen has been refreshed

SYNOPSIS#include <curses.h>

bool isendwin(void);

DESCRIPTIONThe isendwin() function indicates whether the screen has been refreshed since the last call toendwin() .

RETURN VALUEThe isendwin() function returns TRUE if endwin() has been called without any subsequent refresh.Otherwise, it returns FALSE.

ERRORSNo errors are defined.

SEE ALSOendwin(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−544 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

isfinite(3M) isfinite(3M)

NAMEisfinite( ) - floating-point finiteness macro

SYNOPSIS#include <math.h>

int isfinite( floating-type x);

DESCRIPTIONThe isfinite() macro determines whether its argument has a finite value (zero, denormalized, or nor-malized, and not infinite or NaN). The argument must be of floating type, and classification is based onthe type of the argument. For Itanium(R)-based systems, the argument can be any floating type. ForPA-RISC, the argument must be either double or float .

The isfinite() macro implements the finite() functionality recommended by the IEEE-754 stan-dard for floating-point arithmetic.

USAGETo use the isfinite() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isfinite() macro returns a nonzero value if and only if its argument has a finite value. Themacro raises no floating-point exceptions.

ERRORSNo errors are defined.

EXAMPLESMake sure a value is finite before continuing operations on it:

#include <math.h>/*...*/

float x;/*...*/if (isfinite(x))

/*...*/

SEE ALSOfpclassify(3M), isinf(3M), isnan(3M), isnormal(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEisfinite() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−545

A iA

isgreater(3M) isgreater(3M)

NAMEisgreater( ) - floating-point quiet comparison macro (>)

SYNOPSIS#include <math.h>

int isgreater( floating-expr x, floating-expr y);

DESCRIPTIONThe isgreater() macro determines whether its first argument is greater than its second argument.The value of isgreater( x, y) is always equal to ( x) > ( y) ; however, unlike ( x) > ( y) ,isgreater( x, y) does not raise the invalid exception when x and y are unordered.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the isgreater() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isgreater() macro returns the value of ( x) > ( y) . The macro raises no floating-point excep-tions.

ERRORSNo errors are defined.

SEE ALSOisgreaterequal(3M), isless(3M), islessequal(3M), islessgreater(3M), isunordered(3M), math(5).

STANDARDS CONFORMANCEisgreater() : ISO/IEC C99

Section 3−−546 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

isgreaterequal(3M) isgreaterequal(3M)

NAMEisgreaterequal( ) - floating-point quiet comparison macro (>=)

SYNOPSIS#include <math.h>

int isgreaterequal( floating-expr x, floating-expr y);

DESCRIPTIONThe isgreaterequal() macro determines whether its first argument is greater than or equal to itssecond argument. The value of isgreaterequal( x, y) is always equal to ( x) >= ( y) ; however,unlike ( x) >= ( y) , isgreaterequal( x, y) does not raise the invalid exception when x and y areunordered.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the isgreaterequal() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isgreaterequal() macro returns the value of ( x) >= ( y) . The macro raises no floating-pointexceptions.

ERRORSNo errors are defined.

SEE ALSOisgreater(3M), isless(3M), islessequal(3M), islessgreater(3M), isunordered(3M), math(5).

STANDARDS CONFORMANCEisgreaterequal() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−547

A iA

isinf(3M) isinf(3M)

NAMEisinf( ) - floating-point test for infinity

SYNOPSIS#include <math.h>

int isinf(floating-type x);

DESCRIPTIONThe isinf() macro determines whether its argument is an infinity. The argument must be of floatingtype, and classification is based on the type of the argument. For Itanium(R)-based systems, the argu-ment can be any floating type. For PA-RISC, the argument must be either double or float .

The isinf() macro replaces the isinf() and isinff() functions, which are obsolete and are nolonger supported.

USAGETo use the isinf() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isinf() macro returns a nonzero value if x is ±INFINITY. Otherwise, it returns zero. The macroraises no floating-point exceptions.

ERRORSNo errors are defined.

EXAMPLESTake certain actions if x is infinity:

#include <math.h>/*...*/

float x;/*...*/if (isinf(x))

/*...*/

SEE ALSOfpclassify(3M), isfinite(3M), isnan(3M), isnormal(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEisinf() : ISO/IEC C99

Section 3−−548 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

isless(3M) isless(3M)

NAMEisless( ) - floating-point quiet comparison macro (<)

SYNOPSIS#include <math.h>

int isless( floating-expr x, floating-expr y);

DESCRIPTIONThe isless() macro determines whether its first argument is less than its second argument.

The value of isless( x, y) is always equal to ( x) < ( y) ; however, unlike ( x) < ( y) ,isless( x, y) does not raise the invalid exception when x and y are unordered.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the isless() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isless() macro returns the value of ( x) < ( y) . The macro raises no floating-point exceptions.

ERRORSNo errors are defined.

SEE ALSOisgreater(3M), isgreaterequal(3M), islessequal(3M), islessgreater(3M), isunordered(3M), math(5).

STANDARDS CONFORMANCEisless() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−549

A iA

islessequal(3M) islessequal(3M)

NAMEislessequal( ) - floating-point quiet comparison macro (<=)

SYNOPSIS#include <math.h>

int islessequal( floating-expr x, floating-expr y);

DESCRIPTIONThe islessequal() macro determines whether its first argument is less than or equal to its secondargument. The value of islessequal( x, y) is always equal to ( x) <= ( y) ; however, unlike ( x) <=( y) , islessequal( x, y) does not raise the invalid exception when x and y are unordered.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the islessequal() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe islessequal() macro returns the value of ( x) <= ( y) . The macro raises no floating-pointexceptions.

ERRORSNo errors are defined.

SEE ALSOisgreater(3M), isgreaterequal(3M), isless(3M), islessgreater(3M), isunordered(3M), math(5).

STANDARDS CONFORMANCEislessequal() : ISO/IEC C99

Section 3−−550 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

islessgreater(3M) islessgreater(3M)

NAMEislessgreater( ) - floating-point quiet comparison macro (<>)

SYNOPSIS#include <math.h>

int islessgreater( floating-expr x, floating-expr y);

DESCRIPTIONThe islessgreater() macro determines whether its first argument is less than or greater than itssecond argument, without raising the invalid exception when x and y are unordered.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the islessgreater() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe islessgreater() macro returns the value 1 if ( x) < ( y) or (( x) > ( y) , and returns zerootherwise. The macro raises no floating-point exceptions.

ERRORSNo errors are defined.

SEE ALSOisgreater(3M), isgreaterequal(3M), isless(3M), islessequal(3M), isunordered(3M), math(5).

STANDARDS CONFORMANCEislessgreater() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−551

A iA

isnan(3M) isnan(3M)

NAMEisnan( ) - floating-point test for NaN

SYNOPSIS#include <math.h>

int isnan( floating-type x);

DESCRIPTIONThe isnan() macro determines whether its argument is a NaN. The argument must be of floating type.For Itanium(R)-based systems, the argument can be any floating type. For PA-RISC, the argument mustbe either double or float .

The isnan() macro implements the isnan() functionality recommended by the IEEE-754 standardfor floating-point arithmetic.

The isnan() macro replaces the isnan() and isnanf() functions, which are obsolete and are nolonger supported.

USAGETo use the isnan() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isnan() macro returns a nonzero value if and only if its argument has a NaN value. The macroraises no floating-point exceptions.

ERRORSNo errors are defined.

EXAMPLESTake certain actions if x is not a NaN:

#include <math.h>/*...*/

double x;/*...*/if (!isnan(x))

/*...*/

SEE ALSOfpclassify(3M), isfinite(3M), isinf(3M), isnormal(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEisnan() : ISO/IEC C99

Section 3−−552 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

isnormal(3M) isnormal(3M)

NAMEisnormal( ) - floating-point test for normalized value

SYNOPSIS#include <math.h>

int isnormal( floating-type x);

DESCRIPTIONThe isnormal() macro determines whether its argument is a normalized value (neither zero, denor-malized, infinite, nor NaN). The argument must be of floating type, and classification is based on thetype of the argument. For Itanium(R)-based systems, the argument can be any floating type. For PA-RISC, the argument must be either double or float .

USAGETo use the isnormal() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isnormal() macro returns a nonzero value if and only if its argument has a normalized value. Themacro raises no floating-point exceptions.

ERRORSNo errors are defined.

EXAMPLESMake sure a value is normalized before continuing operations on it:

#include <math.h>/*...*/

float x;/*...*/if (isnormal(x))

/*...*/

SEE ALSOfpclassify(3M), isfinite(3M), isinf(3M), isnan(3M), signbit(3M), math(5).

STANDARDS CONFORMANCEisnormal() : ISO/IEC C99

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−553

A iA

isunordered(3M) isunordered(3M)

NAMEisunordered( ) - floating-point comparison macro (unordered)

SYNOPSIS#include <math.h>

int isunordered( floating-expr x, floating-expr y);

DESCRIPTIONThe isunordered() macro determines whether its arguments are unordered. The arguments areunordered if at least one argument is a NaN.

The arguments must be of floating type. For Itanium(R)-based systems, the arguments can be any float-ing type. For PA-RISC, each argument must be either double or float .

USAGETo use the isunordered() macro, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h> . Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEThe isunordered() macro returns 1 if its arguments are unordered (that is, if either argument is aNaN) and 0 otherwise. The macro raises no floating-point exceptions.

ERRORSNo errors are defined.

SEE ALSOisgreater(3M), isgreaterequal(3M), isless(3M), islessequal(3M), islessgreater(3M), math(5).

STANDARDS CONFORMANCEisunordered() : ISO/IEC C99

Section 3−−554 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A iA

is_linetouched(3X) is_linetouched(3X)(ENHANCED CURSES)

NAMEis_linetouched, is_wintouched, touchline, untouchwin, wtouchln — window refresh control functions

SYNOPSIS#include <curses.h>

bool is_linetouched(WINDOW * win, int line);

bool is_wintouched(WINDOW * win);

int touchline(WINDOW * win, int start, int count);

int untouchwin(WINDOW * win);

int wtouchln(WINDOW * win, int y, int n, int changed);

DESCRIPTIONThe touchline() function only touches count lines, beginning with line start.

The untouchwin() function marks all lines in the window as unchanged since the last refresh opera-tion.

Calling wtouchln() , if changed is 1, touches n lines in the specified window, starting at line y. Ifchanged is 0, wtouchln() marks such lines as unchanged since the last refresh operation.

The is_wintouched() function determines whether the specified window is touched. Theis_linetouched() function determines whether line line of the specified window is touched.

RETURN VALUEThe is_linetouched() and is_wintouched() functions return TRUE if any of the specified lines,or the specified window, respectively, has been touched since the last refresh operation. Otherwise, theyreturn FALSE.

Upon successful completion, the other functions return OK. Otherwise, they return ERR. Exceptions tothis are noted in the preceding function descriptions.

ERRORSNo errors are defined.

APPLICATION USAGECalling touchwin() or touchline() is sometimes necessary when using overlapping windows, sincea change to one window affects the other window, but the records of which lines have been changed in theother window do not reflect the change.

SEE ALSOdoupdate(3X), touchwin(3X), curses_intro(3X), see Screens, Windows and Terminals , <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−555

A jA

j0(3M) j0(3M)

NAMEj0( ), j1( ), jn( ) - Bessel functions of the first kind

SYNOPSIS#include <math.h>

double j0(double x);

double j1(double x);

double jn(int n, double x);

DESCRIPTIONj0() and j1() return Bessel functions of x of the first kind of orders 0 and 1 respectively. jn()returns the Bessel function of x of the first kind of order n.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions. Make sure your program includes <math.h >. Link in the math library byspecifying -lm on the compiler or linker command line.

RETURN VALUEIf x is NaN, j0() , j1() , and jn() return NaN.

ERRORSNo errors are defined.

SEE ALSOy0(3M), math(5).

M. Abramowitz and I. Stegun, Handbook of Mathematical Functions (New York: Dover Publi-cations, 1972).

STANDARDS CONFORMANCEj0() : SVID3, XPG4.2

j1() : SVID3, XPG4.2

jn() : SVID3, XPG4.2

Section 3−−556 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A kA

keyname(3X) keyname(3X)(ENHANCED CURSES)

NAMEkeyname, key_name — get name of key

SYNOPSIS#include <curses.h>

char *keyname(int c);

char *key_name(wchar_t c);

DESCRIPTIONThe keyname() and key_name() functions generate a character string whose value describes the keyc. The c argument of keyname() can be an 8-bit character or a key code. The c argument ofkey_name() must be a wide character.

The string has a format according to the first applicable row in the following table:

Input Format of Returned StringVisible character The same characterControl character ^ XMeta-character (keyname( ) only) M-XKey value in <curses.h> (keyname( ) only) KEY_nameNone of the above UNKNOWN KEY

The meta-character notation shown above is used only if meta-characters are enabled.

RETURN VALUEUpon successful completion, keyname() returns a pointer to a string as described above. Otherwise, itreturns a null pointer.

ERRORSNo errors are defined.

APPLICATION USAGEThe return value of keyname() and key_name() may point to a static area which is overwritten by asubsequent call to either of these functions.

Applications normally process meta-characters without storing them into a window. If an applicationstores meta-characters in a window and tries to retrieve them as wide characters, keyname() cannotdetect meta-characters, since wide characters do not support meta-characters.

SEE ALSOmeta(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−557

A kA

keypad(3X) keypad(3X)(CURSES)

NAMEkeypad — enable/disable abbreviation of function keys

SYNOPSIS#include <curses.h>

int keypad(WINDOW * win, bool bf);

DESCRIPTIONThe keypad() function controls keypad translation. If bf is TRUE, keypad translation is turned on. Ifbf is FALSE, keypad translation is turned off. The initial state is FALSE.

This function affects the behaviour of any function that provides keyboard input.

If the terminal in use requires a command to enable it to transmit distinctive codes when a function keyis pressed, then after keypad translation is first enabled, the implementation transmits this command tothe terminal before an affected input function tries to read any characters from that terminal.

RETURN VALUEUpon successful completion, keypad() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOcurses_intro(3X), see subsection Keypad Processing, <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

Section 3−−558 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

lckpwdf(3C) lckpwdf(3C)

NAMElckpwdf(), ulckpwdf() - control access to the /etc/passwd and /etc/shadow files

SYNOPSIS#include <shadow.h>

int lckpwdf (void)

int ulckpwdf (void)

DESCRIPTIONThe lckpwdf() and ulckpwdf() routines are used to coordinate modification access to the passwordfile /etc/passwd and to the shadow password file /etc/shadow . The lock file used by these two rou-tines is /etc/.pwd.lock . A process first calls lckpwdf() to gain exclusive access rights formodification. When modifications are complete, ulckpwdf() is called to release the lock on/etc/.pwd.lock . This mechanism prevents simultaneous modification of the files.

RETURN VALUEThe lckpwdf() routine returns zero upon successful completion. If the lock could not be obtained, itreturns −1 and sets errno to indicate the error.

The ulckpwdf() routine returns zero upon successful completion. If the lock has already beenreleased, ulckpwdf() returns −1 and sets errno to indicate the error.

FILES/etc/passwd/etc/shadow/etc/.pwd.lock

SEE ALSOgetpwent(3C), passwd(4), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−559

A lA

ldcvt(3C) ldcvt(3C)

NAME_ldecvt( ), _ldfcvt( ), _ldgcvt( ) - convert long-double floating-point number to string

SYNOPSIS#include <stdlib.h>

char *_ldecvt(long_double value, int ndigit, int *decpt, int *sign);

char *_ldgcvt(long_double value, int ndigit, char *buf);

char *_ldfcvt(long_double value, int ndigit, int *decpt, int *sign);

Obsolescent Interfacesint _ldecvt_r(

long_double value,int ndigit,int *decpt,int *sign,char *buffer,int buflen);

int _ldfcvt_r(long_double value,int ndigit,int *decpt,int *sign,char *buffer,int buflen);

DESCRIPTION_ldecvt() converts value to a null-terminated string of ndigit digits and returns a pointer to the

string. The high-order digit is non-zero, unless the value is zero. The low-order digit isrounded. The position of the radix character relative to the beginning of the string isstored indirectly through decpt (negative means to the left of the returned digits). Theradix character is not included in the returned string. If the sign of the result is nega-tive, the word pointed to by sign is non-zero; otherwise it is zero.

_ldfcvt() is identical to _ldecvt() , except that the correct digit has been rounded for printf %Lf(FORTRAN F-format) output of the number of digits specified by ndigit .

_ldgcvt() Convert the value to a null-terminated string in the array pointed to by buf and returnbuf . It produces ndigit significant digits in FORTRAN F-format if possible, or E-formatotherwise. A minus sign, if required, and a radix character are included in the returnedstring. Trailing zeros are suppressed. The radix character is determined by thecurrently loaded NLS environment (see setlocale (3C)). If setlocale() has not beencalled successfully, the default NLS environment, "C" is used (see lang (5)). The defaultenvironment specifies a period (. ) as the radix character.

Obsolescent Interfaces_ldecvt_r() , _ldfcvt_r() convert long-double floating-point number to string.

RETURN VALUENaNis returned for Not-a-Number, and ±INFINITY is returned for Infinity.

WARNINGSThe values returned by _ldecvt() and _ldfcvt() point to data whose content is overwritten by sub-sequent calls to these interfaces by the same thread.

_ldecvt_r() and _ldfcvt_r() are obsolescent interfaces supported only for compatibility withexisting DCE applications. New multithreaded applications should use _ldecvt() and _ldfcvt() .

EXTERNAL INFLUENCESLocale

The LC_NUMERICcategory determines the radix character.

Section 3−−560 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

ldcvt(3C) ldcvt(3C)

International Code Set SupportSingle-byte character code sets are supported.

AUTHOR_ldecvt() , _ldfcvt() , and _ldgcvt() were developed by HP.

SEE ALSOsetlocale(3C), printf(3S), lang(5), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−561

A lA

ldexp(3M) ldexp(3M)

NAMEldexp( ), ldexpf( ), ldexpl( ), ldexpw( ), ldexpq( ) - scale exponent of a floating-point number

SYNOPSIS#include <math.h>

double ldexp(double x, int exp);

Itanium(R)-based System Onlyfloat ldexpf(float x, int exp);

long double ldexpl(long double y, int exp);

extended ldexpw(extended x, int exp);

quad ldexpq(quad x, int exp);

DESCRIPTIONThe ldexp() function computes the quantity x * 2exp .

ldexp() computes the same value as scalbn() .

Itanium-based System Onlyldexpf() is a float version of ldexp() ; it takes a float first argument and returns a floatresult.

ldexpl() is a long double version of ldexp() ; it takes a long double first argument andreturns a long double result.

ldexpw() is an extended version of ldexp() ; it takes a extended first argument and returns anextended result.

ldexpq() is equivalent to ldexpl() on HP-UX systems.

USAGETo use (for Itanium-based systems) ldexpf() , compile either with the default -Ae option or with the-Aa option.

To use (for Itanium-based systems) ldexpl() , ldexpw() , or ldexpq() , compile either with thedefault -Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) ldexpw() or ldexpq() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEUpon successful completion, the ldexp() function returns x * 2exp .

If x is ±INFINITY, zero, or a NaN, ldexp() returns x .

ldexp() returns a properly signed infinity (equal to ±HUGE_VAL) in lieu of a value whose magnitude istoo large, and raises the overflow and inexact exceptions.

ldexp() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal orzero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

ERRORSIf the correct value would overflow, ldexp() sets errno to [ERANGE].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOfrexp(3M), ilogb(3M), logb(3M), scalb(3M), scalbln(3M), scalbn(3M), math(5).

Section 3−−562 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

ldexp(3M) ldexp(3M)

STANDARDS CONFORMANCEldexp() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

ldexpf() , ldexpl() ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−563

A lA

lgamma(3M) lgamma(3M)

NAMElgamma( ), lgammaf( ), lgammal( ), lgammaw( ), lgammaq( ), lgamma_r( ), lgammaf_r( ), lgammal_r( ),lgammaw_r( ), lgammaq_r( ), gamma( ), gammaf( ), gammal( ), gammaw( ), gammaq( ), signgam - loggamma functions

SYNOPSIS#include <math.h>

double lgamma(double x);

double lgamma_r(double x, int *sign);

double gamma(double x);

extern int signgam;

Itanium(R)-based System Onlyfloat lgammaf(float x);

long double lgammal(long double x);

extended lgammaw(extended x);

quad lgammaq(quad x);

float lgammaf_r(float x, int *sign);

long double lgammal_r(long double x, int *sign);

extended lgammaw_r(extended x, int *sign);

quad lgammaq_r(quad x, int *sign);

float gammaf(float x);

long double gammal(long double x);

extended gammaw(extended x);

quad gammaq(quad x);

DESCRIPTIONlgamma() and gamma() return ln(| Γ( x)|) , where Γ(x) is defined as the integral, as t goes from zeroto infinity, of exp( −t) times t to the power (x−1).

The sign of Γ(x) is returned in the external integer signgam .

The tgamma() function, available on Itanium-based systems, can be used to calculate Γ(x). Or, the fol-lowing C program fragment can be used to calculate Γ(x):

if ((y = lgamma(x)) > LN_MAXDOUBLE)error( );

y = signgam * exp(y);

where if y is greater than LN_MAXDOUBLE, as defined in the <values.h> header file, exp() returns arange error. (See exp (3M).)

The log gamma function lgamma() is not reentrant because it uses the global variable signgam . Thefunction lgamma_r() is a reentrant version of lgamma() that can be used in multi-threaded applica-tions. The function lgamma_r() stores the sign of Γ(x) in the object pointed to by the second argumentsign . The value pointed to by sign is +1 if Γ(x) is positive, -1 if it is negative.

The gamma() function is functionally equivalent to lgamma() .

lgammaf() , gammaf() , and lgammaf_r() are float versions of lgamma() , gamma() , andlgamma_r respectively; they take a float (first) argument and return a float result.

lgammal() , gammal() , and lgammal_r() are long double versions of lgamma() , gamma() ,and lgamma_r respectively; they take a long double (first) argument and return a long doubleresult.

lgammaw() , gammaw() , and lgammaw_r() are extended versions of lgamma() , gamma() , andlgamma_r() respectively; they take an extended (first) argument and return an extended result.

Section 3−−564 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

lgamma(3M) lgamma(3M)

lgammaq() , gammaq() , and lgammaq_r are equivalent to lgammal() , gammal() , andlgammal_r() respectively on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) lgammaw() , lgammaw_r() , gammaw() , lgammaq() ,lgammaq_r() , or gammaq() , compile also with the -fpwidetypes option.

Make sure your program includes <math.h> , and link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUElgamma( 1) returns +0.

lgamma( 2) returns +0.

lgamma( x) returns +Inf and raises the divide-by- zero floating-point exception for x a negative integeror zero.

lgamma( -Inf) returns +Inf.

lgamma( +Inf) returns +Inf.

If x is NaN, lgamma() and gamma() return NaN.

lgamma() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, andraises the overflow and inexact exceptions.

When it raises no other exception, whether lgamma() raises the inexact exception is unspecified.

WARNINGSlgamma() and gamma() are unsafe in multi-thread applications. lgamma_r() is MT-Safe and shouldbe used instead.

SEE ALSOexp(3M), log(3M), tgamma(3M), math(5).

STANDARDS CONFORMANCElgamma() : SVID3, XPG4.2, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

gamma() : SVID3, XPG4.2

lgammaf() , lgammal() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−565

A lA

libkrb5(3) libkrb5(3)

NAMElibkrb5 - Kerberos client libraries (libkrb5, libk5crypto, libcom_err)

SYNOPSIS32-Bit Itanium(R)-based Libraries

/usr/lib/hpux32/libkrb5.so

/usr/lib/hpux32/libcom_err.so

/usr/lib/hpux32/libk5crypto.so

64-Bit Itanium-based Libraries/usr/lib/hpux64/libkrb5.so

/usr/lib/hpux64/libcom_err.so

/usr/lib/hpux64/libk5crypto.so

32-Bit PA-RISC Libraries/usr/lib/libkrb5.sl

/usr/lib/libcom_err.sl

/usr/lib/libk5crypto.sl

64-Bit PA-RISC Libraries/usr/lib/pa20_64/libkrb5.sl

/usr/lib/pa20_64/libcom_err.sl

/usr/lib/pa20_64/libk5crypto.sl

DESCRIPTIONKerberos is a network authentication protocol developed at MIT. This is now an IETF standard RFC1510, the Kerberos Network Authentication Service (V5). The shared libraries,libkrb5.so/libkrb5.sl , libcom_err.so/libcom_err.sl andlibk5crypto.so/libk5crypto.sl support authentication, integrity and confidentiality services asper the Kerberos V5 specification.

Kerberos performs authentication as a trusted third-party authentication service by using conventional(shared secret key) cryptography mechanism. It provides a means of verifying the identities of principals,without relying on authentication by the host operating system and without basing trust on hostaddresses. This protocol works without requiring the physical security of all the hosts on the networkunder the assumption that packets transmitting over the network can be read, modified and inserted atwill.

libkrb5.so/libkrb5.sl is the main Kerberos library, which provides APIs for authentication, veri-fying tickets, creating authenticator, context management, cache and replay cache management, keytabfile management, memory management, principal name style mapping and operating system specificcalls. The <krb5.h> header file should be included in the application that uses APIs fromlibkrb5.so/libkrb5.sl library.

libk5crypto.so/libk5crypto.sl , which is linked to libkrb5.so/libkrb5.sl , will providethe encryption and decryption APIs. A user should not link this library directly with an application. Inorder to add authentication, an application may need to call one or more APIs of the Kerberos library,which results in the transmission of the necessary messages to achieve authentication.

libcom_err.so/libcom_err.sl implements Kerberos library error code tables. There areseparate error code tables for database, magic numbers and ASN.1 APIs. Based on the failure in the API,the user may get an error from these tables using the appropriate com_err() API. The <com_err.h>header file should be included in the application that uses routines from thelibcom_err.so/libcom_err.sl library. Executable files must be linked with -lcom_err inorder to cause the com_err library to be included.

The functionalities of the APIs implemented in Kerberos client libraries are given below.

krb5_context Management APIsThe context is designed to represent per process state. The Global parameters which are "context" specificare stored in this structure. The structure contains default realm, default encryption type, defaultconfiguration files and the like. APIs will provide full access to the data structure stored in the contextand should not be accessed directly by developers. Some of the common APIs are

Section 3−−566 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

libkrb5(3) libkrb5(3)

krb5_init_context() , krb5_init6_context() , krb5_free_context() , andkrb5_set_default_in_tkt_etypes() .

The encryption types which are retrieved from the context and stored in the etypes should be freedby the caller.

Note: krb5_init6_context() is only available on Itanium-based platform.

krb5_auth_context Management APIsThe auth_context is a per-connection context and is used by the various APIs involved directly inclient/server authentication. Some of the data stored in this context include keyblocks, addresses,sequence numbers, authenticator, checksum type and replay cache pointer. Some of the common APIsare krb5_auth_con_init() , krb5_auth_con_free() , krb5_auth_con_setaddrs() ,krb5_auth_con_setports , krb5_auth_con_setflags ,krb5_auth_con_getlocalsubkey() , and krb5_auth_con_genaddrs() .

The auth_context structure should be freed using krb5_auth_con_free() . It is the responsibil-ity of the application developer to free the memory allocated to the authenticator by usingkrb5_free_authenticator() . The application developer must also free the memory that was allo-cated to store the local sub keyblocks using krb5_free_keyblock() .

Principal Access APIsA Principal is a uniquely named client or server instance that participates in a network communication.The APIs allow one to create, modify and access portions of the Krb5_principal. Some of the commonAPIs are krb5_parse_name() , krb5_unparse_name() , krb5_free_principal() ,krb5_princ_realm() , krb5_copy_principal() , etc.

Some of the APIs are internal functions, not intended for use by the application programs, interface maychange at any time. Even though it is possible to directly access the data elements in the structure, it isrecommended that these APIs should be used. The returned principal should be freed withkrb5_free_principal() .

Credential Cache Management APIsThese APIs deal with storing credentials (tickets, session keys and other identifying information) in asemi-permanent store for later use by different programs. The credential storage can be a hard disk or amemory storage. Some of the common APIs are krb5_cc_resolve() , krb5_cc_default() ,krb5_cc_initialize() , krb5_cc_destroy() , krb5_cc_store_cred() ,krb5_cc_retrieve_cred() , krb5_cc_remove_cred() , and krb5_cc_set_flags() .

The retrieved credentials should be freed using krb5_free_credentials() .

Replay Cache Management APIsThese APIs deal with verifying that AP_REQ’s do not contain duplicate authenticators. The storage mustbe non-volatile for the site-determined validity period of authenticators. Some of the common APIs arekrb5_auth_to_rep() , krb5_rc_register_type() , krb5_rc_default() ,krb5_rc_initialize() , krb5_rc_close() , krb5_rc_store() , and krb5_rc_resolve() .

krb5_rc_resolve() initializes the private data for a replay cache. This API must be called beforethe other replay cache APIs. The allocated memory should be freed using krb5_rc_close() .

These APIs are not generally used by the applications.

KeyTab Management APIsThese APIs deal with storing and retrieving service keys for use by unattended services which participatein authentication exchanges. Keytab routines are all atomic. All keytab types support multiple con-current sequential scans. Some of the common APIs are krb5_kt_register() ,krb5_kt_resolve() , krb5_kt_default() , krb5_kt_add_entry() , krb5_kt_close() ,krb5_kt_free_entry() , and krb5_kt_next_entry() .

To free the resources, the user should use krb5_kt_free_entry() .

Memory Management APIsThese APIs deal with deallocation of memory that has been allocated by various routines. It is recom-mended that the developer must use these routines in order to free the data structures. All the APIs startwith krb5_free prefix. Some of the common APIs are krb5_free_principal() ,krb5_free_data() , krb5_free_authenticator() , krb5_free_ticket() ,krb5_free_cred() , krb5_free_pa_data() , and krb5_free_tgt_creds() .

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−567

A lA

libkrb5(3) libkrb5(3)

Operating System-Specific APIsThese APIs provide an interface between the other parts of the libkrb5 libraries and the operating sys-tem. These include APIs to allow access to configuration specific information, disk based I/O operations,network based operations and operating system specific access APIs. Some of the common APIs arekrb5_set_config_file() , krb5_get_default_realm() , krb5_get_krbhst() ,krb5_gen_portaddr() , krb5_read_message() , krb5_kuserok() , krb5_timeofday() , andkrb5_read_passwd() .

Application-Specific and Miscellaneous APIsThese APIs deal with sending and receiving KRB5 protocol messages to the Kerberos server, ticketmanagement and miscellaneous calls. Some of the common APIs are krb5_get_cred_from_kdc() ,krb5_get_credentials() , krb5_get_in_tkt_with_password() , krb5_rd_rep() ,krb5_mk_error() , krb5_sendauth() , and krb5_recvauth() .

Itanium-based SystemsThe Kerberos APIs have support for IPv6-enablement of application in Kerberos mode. For an applica-tion to be v6-enabled in Kerberos mode, the application needs to obtain the v6-context by callingkrb5_init6_context() , and send that v6-context as an argument to other Kerberos APIs. The APIkrb5_init6_context() will initialize a v6-context on an IPv6-enabled system. If the local host isnot IPv6-enabled, it returns the error code KRB5KRB_INIT_ERR_V6 but initializes a v4-context, whichmeans the application will perform all the Kerberos operations in v4-mode only. During compilation ofan application that includes <krb5.h> , the preprocessor macro, _HAVE_KRB5_IPV6_ needs to bedefined for the IPv6 enablement. The address type to be used for IPv6 is ADDRTYPE_INET6, which isdefined in <krb5.h> .

WARNINGSIt is strongly recommended to use GSS-API instead of Kerberos calls. The Kerberos libraries are notthread safe.

AUTHORKerberos client libraries were developed at Massachusetts Institute of Technology. This version of thelibraries are compatible with MIT1.0, MIT1.1 and MIT1.1.1.

SEE ALSOkdestroy(1), kinit(1), klist(1), kpasswd(1), ktutil(1), kvno(1), krb5.conf(4), gssapi(5), kerberos(5).

Section 3−−568 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A lA

libslp(3N) libslp(3N)

NAMElibslp: SLPOpen(), SLPClose(), SLPReg(), SLPDereg(), SLPDelAttrs(), SLPFindSrvs(),SLPFindSrvTypes(), SLPFindAttrs(), SLPParseSrvURL(), SLPEscape(), SLPUnescape(), SLPFree(),SLPGetRefreshInterval(), SLPFindScopes(), SLPGetProperty(), SLPSetProperty() - SLP (Service LocationProtocol) library routines

SYNOPSIS#include <slp.h>cc [ flag... ] file... -lslp [ library... ]

SLPError SLPOpen(cnst char *lang,SLPBoolean isasync,SLPHandle *hslp,

);

void SLPClose(SLPHandle *hslp

);

SLPError SLPReg(SLPHandle hslp,const char* srvurl,unsigned short lifetime,const char* srvtype,const char* attrs,SLPBoolean fresh,SLPRegReport callback,void* cookie

);

SLPError SLPDereg(SLPHandle hslp,const char* srvurl,SLPRegReport callback,void* cookie

);

SLPError SLPDelAttrs(SLPHandle hslp,const char* srvurl,const char* attrs,SLPRegReport callback,void* cookie

);

SLPError SLPFindSrvs(SLPHandle hslp,const char* srvtype,const char* scopelist,const char* filter,SLPSrvURLCallback callback,void* cookie

);

SLPError SLPFindSrvTypes(SLPHandle hslp,const char* namingauthority,const char* scopelist,SLPSrvURLCallback callback,void* cookie

);

SLPError SLPFindAttrs(:SLPHandle hslp,const char* srvurlorsrvtype,

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−569

A lA

libslp(3N) libslp(3N)

const char* scopelist,const char* attrids,SLPSrvURLCallback callback,void* cookie

);

DESCRIPTIONThe SLP (Service Location Protocol) library routines provide a standard interface for writing applicationprograms that are SLP enabled. The SLP API is an interface that allows programmers to write client andserver applications to provide dynamic service discovery and selection.

The C language binding presents a minimal overhead implementation that maps directly into the proto-col. There is one C language function per protocol request, with the exception of the SLPDereg() andSLPDelAttrs() functions, which map into different uses of the SLP deregister request. Parametersare for the most part character buffers. Memory management is kept simple by having the client allocatemost memory and requiring that client callback functions copy incoming parameters into memory allo-cated by the client code. Any memory returned directly from the API functions is deallocated using theSLPFree() function.

To conform with standard C practice, all character strings passed to and returned through the API arenull terminated, even though the SLP protocol does not use null terminated strings. Strings passed asparameters are UTF-8 but they may still be passed as a C string (a null terminated sequence of bytes.)Escaped characters must be encoded by the API client as UTF-8. In the common case of US-ASCII, theusual one byte per character C strings work. API functions are provided that assist in escaping and unes-caping strings.

Unless otherwise noted, parameters to API functions and callbacks are non-NULL. Some parameters mayhave other restrictions. If any parameter fails to satisfy the restrictions on its value, the operationreturns a PARAMETER_BADerror.

Argumentslang points to the language tag to be used.

isasync denotes whether the required operation is to be done asynchronously or synchronously.Currently only synchronous operation is supported.

srvurl is the URL to be registered/deregistered.

lifetime is the lifetime of the Service URL to be registered in seconds less than or equal toSLP_LIFETIME_MAXIMUMand greater than zero.

srvtype is the service type name in the service : scheme format.

attrs is the list of attributes of the service type.

fresh is used with SLP service registration and denotes whether the registration request is a newone or if it is a request for update of existing registration. Currently updating an existingregistration is not supported.

Note: Currently asynchronous operations and incremental registrations are not supported.Hence isasync has be set to SLP_FALSEalways, and fresh has to be set to SLP_TRUE. Oth-erwise an SLP_NOT_IMPLEMENTEDerror is returned.

callback is a pointer to a callback function of appropriate type that will be called for processing thereply.

cookie is the pointer to memory passed from the application to the SLP library for the callback tofill the return values.

scopelist is the comma-separated list of scopes.

filter is a pattern matching expression formed of attributes in LDAPv3 search filter syntax, whichwill be used by the server to filter the results.

namingauthorityis the naming authority to search for.

CallbacksThe callback function allows the application developer to control the processing of the results of thelibrary calls. With asynchronous programming calls, it allows the program code, which passes the

Section 3−−570 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A lA

libslp(3N) libslp(3N)

callback function as one of the paramaters to the library function, to continue to perform its job, while theresult of that operation is being evaluated by the callback function.

The callback function is called whenever the API library has results to report. The callback code isrequired to check the error code parameter before looking at the other parameters. If the error code isnot SLP_OK, the other parameters may be NULL or otherwise invalid. The API library can terminateany outstanding operation on which an error occurs. The callback code can similarly indicate that theoperation should be terminated by passing back SLP_FALSE to indicate that it is not interested inreceiving more results. Callback functions are not permitted to recursively call into the API on the sameSLPHandle .

If an attempt is made to call the API, the API function returns SLP_HANDLE_IN_USE. Prohibitingrecursive callbacks on the same handle simplifies implementation of thread safe code, since locks held onthe handle will not be in place during a second outcall on the handle.

The total number of results received can be controlled by setting the net.slp.maxResults parameter.

On the last call to a callback, whether asynchronous or synchronous, the status code passed to the call-back has the value, SLP_LAST_CALL.

Primary RoutinesSLPOpen()

Returns an SLPHandle handle in the hslp parameter for the language locale passed in as the langparameter. The handle encapsulates the language locale for SLP requests issued through the han-dle, and any other resources required by the implementation. The return value of the function is anSLPError code indicating the status of the operation. Upon failure, the hslp parameter is set toNULL.

An SLPHandle can only be used for one SLP API operation at a time. If the original operation wasstarted asynchronously, any attempt to start an additional operation on the handle while the origi-nal operation is pending results in the return of an SLP_HANDLE_IN_USEerror from the APIfunction.

Currently asynchronous operation is not supported. If the isasync parameter is set to SLP_TRUE,SLP_NOT_IMPLEMENTEDis returned.

lang is a pointer to a null terminated array of characters containing the RFC 1766 Language Tag.Pass in NULL or the empty string, "" , to use the locale the machine is configured to use.

Currently English is the only supported language tag. Any other value passed to langtag will causeSLP_NOT_IMPLEMENTEDto be returned.

Return values are:

SLP_OKSLP_PARAMETER_BADSLP_NOT_IMPLEMENTEDSLP_MEMORY_ALLOC_FAILED

SLPClose()Frees all resources associated with the handle hslp . If the handle was invalid, the functions returnssilently. Any outstanding synchronous or asynchronous operations are cancelled so their callbackfunctions will not be called any longer.

SLPReg()Registers the URL in srvurl having the lifetime, lifetime , and the attribute list in attrs . The attrslist is a comma separated list of attribute assignments in the wire format (including escaping ofreserved characters). The lifetime parameter must be nonzero and less than or equal toSLP_LIFETIME_MAXIMUM. If the fresh argument is SLP_TRUE, then the registration is new (theSLP protocol FRESHflag is set), and the registration replaces any existing registrations. Thesrvtype parameter is a service type name and can be included for service URLs that are not in theservice : scheme.

If the URL is in the service : scheme, the srvtype parameter is ignored. If the fresh argument isSLP_FALSE, then an existing registration is updated.

The service URL to be registered must conform to the SLP Service URL syntax, and it may not bethe empty string or NULL. SLP_INVALID_REGISTRATION will be returned if srvurl is not aSLP Service URL.

HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−571

A lA

libslp(3N) libslp(3N)

If lifetime is set to SLP_LIFETIME_MAXIMUM, it will remain registered for the lifetime of the cal-ling process.

The srvtype parameter is always ignored because the Service URL syntax required for the srvurlparameter encapsulates the service-type.

Attributes list consists of comma separated attribute assignment expressions for the registered ser-vice. If no attributes are to be provided, use an empty string "" when registering services.

Example: ( attr1=val1),( attr2=val2),( attr3=val3)

SLPDereg()Deregisters the advertisement for URL srvurl in all scopes where the service is registered in alllanguage locales. The deregistration is not just confined to the locale of the SLPHandle ; it is in alllocales. The API library is required to perform the operation in all scopes obtained throughconfiguration.

SLPFindSrvs()Issue a query for services.

SLPFindSrvTypes()The SLPFindSrvTypes() function issues an SLP service type request for service types in thescopes indicated by the scopelist . The results are returned through the callback parameter. Theservice types are independent of language locale, but only for services registered in one of scopesand for the indicated naming authority.

If the naming authority is "* ", then results are returned for all naming authorities. If the namingauthority is the empty string, i.e. "" , then the default naming authority, "IANA", is used. It isnot valid to specify "IANA" explicitly as a naming authority, and it will be taken by default. It willreturn SLP_PARAMETER_BADerror if it is included explicitly.

The service type names are returned with the naming authority intact. If the naming authority isthe default (i.e. empty string), then it is omitted, as is the separating ". ". Service type names fromURLs of the service : scheme are returned with the service : prefix intact.

SLPFindAttrs()This function returns service attributes matching the attrids for the indicated Service URL or ser-vice type. If srvurlorsrvtype is a service type name, then the attributes for all the registrations ofthat service type are returned.

Callback FunctionsCallback functions are required for all of the major SLP APIs that have been mentioned above. The call-back functions and their semantics are listed below.

The parameters include:

hslp is the SLP handle.

errcode is a variable that is used to pass the status of the operation to the callback function bythe library function.

cookie is a pointer to memory passed on by the application code to the SLP library call.

srvurl contains the SLP service URL of the requested service.

lifetime is the lifetime of the service in seconds.

attrlist is a pointer to a buffer containing a comma separated null terminated list of attributeid/value assignments in SLP wire format ( attr-id=attr-value-list) .

The functions are:

typedef void SLPRegReport(SLPHandle hslp, SLPError errcode,void* cookie)

The SLPRegReport callback type is used as the type for the callback function that is passed in to theSLPReg() , SLPDeReg() and SLPDelAttrs() functions. This callback function does not returnany value.

typedef SLPBoolean SLPSrvURLCallback(SLPHandle hslp,const char* srvurl,unsigned short lifetime,SLPError errcode,

Section 3−−572 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: August 2003

A lA

libslp(3N) libslp(3N)

void* cookie)The SLPSrvURLCallback type is the type of the callback function parameter to SLPFindSrvs()function. If the hslp handle parameter was opened asynchronously, the results returned throughthe callback MAY be uncollated. The callback should return SLP_TRUEif more data is desired.The callback may continue to return SLP_TRUE until it is called with an errcode ofSLP_LAST_CALL. If no more data is requested the callback should return SLP_FALSE.

typedef SLPBoolean SLPAttrCallback(SLPHandle hslp,const char* attrlist,SLPError errcode,void* cookie)

The SLPAttrCallback type is the type of callback function passed as a parameter to the SLPFin-dAttrs() function. The behavior of the library differs depending on whether the attribute requestwas by Service URL or by service type.

If the SLPFindAttrs() function was called with a Service URL, then the callback is called onceregardless of whether the handle was opened asynchronously or synchronously. The attrlist param-eter will contain a comma separated list of attributes.

If the SLPFindAttrs() function was called with a service type, then the callback is called untilno more results are available. The attrlist parameter will contain a comma separated list of attri-butes. Replies from SA’s and DA’s will be collated to remove duplicates if SLPFindAttrs() wascalled synchronously. But when called asynchronously the attrlist may return duplicates.

The callback should return SLP_TRUEif more data is desired. The callback may continue to returnSLP_TRUEuntil it is called with an errcode of SLP_LAST_CALL. If no more data is requested thecallback should return SLP_FALSE.

Miscellaneous routinesThe following are the routines for parsing the service URL.

SLPParseSrvURL(const char* srvurl, SLPSrvURL** parsedurl)Parses a Service URL passed in as a null terminated character string and returns the results in apointer to a dynamically allocated SLPSrvURL structure. The pointer returned in parsedurl shouldbe freed by SLPFree().

SLPSrvURL structure is defined in <slp.h> as follows:typedef struct srvurl{

char *s_pcSrvType;char *s_pcHost;int s_iPort;char *s_pcNetFamily;char *s_pcSrvPart;

} SLPSrvURL;

SLPError SLPEscape(const char* unescaped,char** escaped, SLPBoolean istag)

Processes the input string to escape any SLP reserved characters and returns the escaped string indynamically allocated memory. If the istag parameter is SLP_TRUE, then SLPEscape() will lookfor bad tag characters.

SLPError SLPUnescape(const char* escaped, char** unescaped,SLPBoolean istag)

Process the input escaped string to unescape any SLP reserved characters. The unescaped stringis returned in dynamically allocated memory the pointer to which is returned in unescaped . Thememory should be freed by calling SLPFree() when no longer needed. If the istag parameter isSLP_TRUE, then SLPUnEscape() will look for bad tag characters.

void SLPFree (void* mem)Frees memory that was returned from SLPParseSrvURL() , SLPFindScopes() , SLPEs-cape() , and SLPUnescape() .

The following routines may be used to determine the configuration of SLP on the local machine and onthe network.

unsigned short SLPGetRefreshInterval(void)

HP-UX 11i Version 2: August 2003 − 5 − Hewlett-Packard Company Section 3−−573

A lA

libslp(3N) libslp(3N)

Returns the minimum refresh interval that will be accepted by all SLP SA and DA agents on thenetwork.

This call is not implemented and always returns SLP_NOT_IMPLEMENTED.

SLPError SLPFindScopes(SLPHandle hslp,char** scopelist)

Sets the scopelist parameter to a pointer to a comma separated list of all available scope values.The most desirable values are always placed first in the list. There is always one value,"DEFAULT", in the list.

The memory for the scopelist is dynamically allocated. The memory should be freed by a call toSLPFree() when no longer needed.

const char* SLPGetProperty(const char* name)Returns the value of the corresponding SLP property name. The returned string is owned by thelibrary and MUST NOT be freed. The returned pointer to string is a pointer to static memory.

void SLPSetProperty(const char* name, const char* value):This function is supposed to allow the caller to set SLP properties, but it is impossible to implementthis function along with SLPGetProperty() in a way that is even remotely thread safe. There-fore, SLP implementation completely ignores all calls made to SLPSetProperty() so thatSLPGetProperty() can be used in threaded applications. Note:

1. If SLP_NETWORK_INIT_FAILEDis returned, then probably slpd is not running. For flexibil-ity, OpenSLP() does not require slpd to be running on all hosts, but it does require it to berunning on those hosts that will be registering and deregistering services.

2. Currently SLPDelAttrs() function is not implemented. Instead of calling SLPDelAttrs() ,developers writing SLP enabled code should use simply SLPDeReg() to de-register the entireservice then call SLPReg() to re-register the service without the undesired attributes.

RETURN VALUEIf successful, returns SLP_OK, else it returns one of the SLPError codes. See SLPError (3N) for errorreturn values.

AUTHORSLP was developed by Caldera Systems, Inc.

SEE ALSOslpd(1M), SLPError(3N), slp.conf(4), slp.reg(4), slp_syntax(7).

STANDARDS CONFORMANCERFC 2614, RFC2608

Section 3−−574 Hewlett-Packard Company − 6 − HP-UX 11i Version 2: August 2003

A lA

LINES(3X) LINES(3X)(ENHANCED CURSES)

NAMELINES — number of lines on terminal screen

SYNOPSIS#include <curses.h>

extern int LINES;

DESCRIPTIONThe external variable LINES indicates the number of lines on the terminal screen.

SEE ALSOinitscr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−575

A lA

llrint(3M) llrint(3M)

NAMEllrint( ), llrintf( ), llrintl( ), llrintw( ), llrintq( ) - round to nearest long long functions

SYNOPSIS#include <math.h>

long long llrint(double x);

Itanium(R)-based System Onlylong long llrintf(float x);

long long llrintl(long double x);

long long llrintw(extended x);

long long llrintq(quad x);

DESCRIPTIONllrint() rounds its argument to the nearest integral value, rounding according to the current round-ing direction.

llrint() is equivalent to lrint() , except that it rounds to long long instead of long int .

Itanium-based System Onlyllrintf() is a float version of llrint() ; it takes a float argument.

llrintl() is a long double version of llrint() ; it takes a long double argument.

llrintw() is an extended version of llrint() ; it takes an extended argument.

llrintq() is equivalent to llrintl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) llrintw() or llrintq() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf the rounded value is outside the range of long long , the numeric result is the maximum orminimum long long value and the invalid floating-point exception is raised. On Itanium-based sys-tems, if the rounded value is outside the range of long long , the numeric result is the minimum longlong value.

When llrint() raises no other floating-point exception and the result differs from the argument, thefunction raises the inexact floating-point exception.

ERRORSNo errors are defined.

SEE ALSOceil(3M), floor(3M), fabs(3M), fmod(3M), fegetround(3M), fesetround(3M), llround(3M), lrint(3M),lround(3M), rint(3M), round(3M), trunc(3M), math(5), fenv(5).

STANDARDS CONFORMANCEllrint() , llrintf() , llrintl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-pointarithmetic’’)

Section 3−−576 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

llround(3M) llround(3M)

NAMEllround( ), llroundf( ), llroundl( ), llroundw( ), llroundq( ) - round to long long functions

SYNOPSIS#include <math.h>

long long llround(double x);

Itanium(R)-based System Onlylong long llroundf(float x);

long long llroundl(long double x);

long long llroundw(extended x);

long long llroundq(quad x);

DESCRIPTIONllround() rounds its argument to the nearest integral value. An argument exactly halfway betweentwo integers is rounded away from zero, regardless of the current rounding direction. Rounding awayfrom zero also applies to the functions, round and lround .

llround() is equivalent to lround() , except that it rounds to long long instead of long int .

Itanium-based System Onlyllroundf() is a float version of llround() ; it takes a float argument.

llroundl() is a long double version of llround() ; it takes a long double argument.

llroundw() is an extended version of llround() ; it takes an extended argument.

llroundq() is equivalent to llroundl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) llroundw() or llroundq() , compile also with the -fpwide-types option.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf the rounded value is outside the range of long long , the numeric result is the maximum orminimum long long value and the invalid floating-point exception is raised. On Itanium-based sys-tems, if the rounded value is outside the range of long long , the numeric result is the minimum longlong value.

When llround() raises no other floating-point exception and the result differs from the argument, thefunction may raise the inexact floating-point exception.

ERRORSNo errors are defined.

SEE ALSOceil(3M), floor(3M), fabs(3M), fmod(3M), fegetround(3M), fesetround(3M), lrint(3M), llrint(3M),lround(3M), rint(3M), round(3M), trunc(3M), math(5), fenv(5).

STANDARDS CONFORMANCEllround() , llroundf() , llroundl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-pointarithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−577

A lA

localeconv(3C) localeconv(3C)

NAMElocaleconv() - query the numeric formatting conventions of the current locale

SYNOPSIS#include <locale.h>

struct lconv *localeconv(void);

DESCRIPTIONThe localeconv() function sets the components of an object of type struct lconv (defined in<locale.h> ) with values appropriate for the formatting of numeric quantities (monetary and other-wise) according to the rules of the program’s current locale (see setlocale (3C)).

The members of the structure with type char * are strings, any of which (except decimal_point ) canpoint to "" (the empty string) to indicate that the value is not available in the current locale or is of zerolength. The members with type char are nonnegative numbers, any of which can be CHAR_MAX(definedin <limits.h> ) to indicate that the value is not available in the current locale. The members includethe following:

char *decimal_pointThe decimal point character used to format nonmonetary quantities. This is the samevalue as that returned by a call to nl_langinfo() with RADIXCHARas its argument(see nl_langinfo (3C)).

char *thousands_sepThe character used to separate groups of digits to the left of the decimal point characterin formatted nonmonetary quantities. This is the same value as that returned by a call tonl_langinfo() with THOUSEPas its argument (see nl_langinfo (3C)).

char *groupingA string where the numeric value of each byte indicates the size of each group of digits informatted nonmonetary quantities.

char *int_curr_symbolThe international currency symbol applicable to the current locale. The first three char-acters contain the alphabetic international currency symbol in accordance with thosespecified in ISO 4217 Codes for the Representation of Currency and Funds . The fourthcharacter (immediately preceding the null character) is the character used to separatethe international currency symbol from the monetary quantity.

char *currency_symbolThe local currency symbol applicable to the current locale. This value along with posi-tioning information is returned by a call to nl_langinfo() with CRNCYSTRas itsargument (see nl_langinfo (3C)).

char *mon_decimal_pointThe decimal point used to format monetary quantities.

char *mon_thousands_sepThe separator for groups of digits to the left of the decimal point in formatted monetaryquantities.

char *mon_groupingA string where the numeric value of each byte indicates the size of each group of digits informatted monetary quantities.

char *positive_signThe string used to indicate a nonnegative valued formatted monetary quantity.

char *negative_signThe string used to indicate a negative valued formatted monetary quantity.

char int_frac_digitsThe number of fractional digits (those to the right of the decimal point) to be displayed inan internationally formatted monetary quantity.

char frac_digitsThe number of fractional digits (those to the right of the decimal point) to be displayed ina locally formatted monetary quantity.

Section 3−−578 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

localeconv(3C) localeconv(3C)

char p_cs_precedesSet to 1 or 0 if the currency_symbol or int_curr_symbol respectively precedes orsucceeds the value for a nonnegative formatted monetary quantity.

char p_sep_by_spaceSet to 1 or 0 if the currency_symbol or int_curr_symbol respectively is or is notseparated by a space from the value for a nonnegative formatted monetary quantity; andset to 2 if a space separates the symbol and the sign string, if adjacent.

char n_cs_precedesSet to 1 or 0 if the currency_symbol or int_curr_symbol respectively precedes orsucceeds the value for a negative formatted monetary quantity.

char n_sep_by_spaceSet to 1 or 0 if the currency_symbol or int_curr_symbol respectively is or is notseparated by a space from the value for a negative formatted monetary quantity; and setto 2 if a space separates the symbol and the sign string, if adjacent.

char p_sign_posnSet to a value indicating the positioning of the positive_sign for a nonnegative for-matted monetary quantity.

char n_sign_posnSet to a value indicating the positioning of the negative_sign for a negative format-ted monetary quantity.

The numeric value of each byte of grouping and mon_grouping is interpreted according to the fol-lowing:

CHAR_MAXNo further grouping is to be performed.

0 The previous byte is to be repeatedly used for the remainder of the digits.

other The value is the number of digits that comprise the current group. The next byte isexamined to determine the size of the next group of digits to the left of the current group.

The values of p_sign_posn and n_sign_posn are interpreted according to the following:

0 Parentheses surround the quantity and currency_symbol or int_curr_symbol .

1 The sign string precedes the quantity and currency_symbol or int_curr_symbol .

2 The sign string succeeds the quantity and currency_symbol or int_curr_symbol .

3 The sign string immediately precedes the currency_symbol or int_curr_symbol .

4 The sign string immediately succeeds the currency_symbol or int_curr_symbol .

localeconv() behaves as if no library function calls localeconv() .

EXTERNAL INFLUENCESLocale

The LC_NUMERIC category influences the decimal_point , thousands_sep , and groupingmembers of the structure referenced by the pointer returned from a call to localeconv() .

The LC_MONETARYcategory influences all of the other members of this structure.

International Code Set SupportSingle- and multibyte character code sets are supported.

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−579

A lA

localeconv(3C) localeconv(3C)

RETURN VALUElocaleconv() returns a pointer to the filled-in struct lconv .

EXAMPLESThe following table illustrates the formatting used in five languages for monetary quantities.

Country Positive format Negative format International formaten_US.iso88591 $1,234.56 -$1,234.56 USD 1,234.56

it_IT.iso88591 L.1.234 -L.1.234 ITL.1.234

nl_NL.iso88591 F 1.234,56 F -1.234,56 NLG 1.234,56

no_NO.iso88591 kr1.234,56 kr1.234,56- NOK 1.234,56

pt_PT.iso88591 1,234$56 -1,234$56 PTE 1,234$56

For these five languages, the respective values for the monetary members of the structure returned bylocaleconv() are:

en_US. it_IT. nl_NL. no_NO. pt_PT.iso88591 iso88591 .iso88591 iso88591 iso88591

int_curr_symbol USD ITL. NLG NOK PTE

currency_symbol $ L. F kr $

mon_decimal_point . "" , , $

mon_thousands_sep , . . . ,

mon_grouping \3 \3 \3 \3 \3

positive_sign "" "" "" "" ""

negative_sign - - - - -

int_frac_digits 2 0 2 2 2

frac_digits 2 0 2 2 2

p_cs_precedes 1 1 1 1 0

p_sep_by_space 0 0 1 0 0

n_cs_precedes 1 1 1 1 0

n_sep_by_space 0 0 1 0 0

p_sign_posn 1 1 1 1 1

n_sign_posn 4 1 4 2 1

WARNINGSThe structure returned by localeconv() should not be modified by the calling program. Calls to set-locale() with categories LC_ALL, LC_MONETARY, or LC_NUMERICcan overwrite the contents of thestructure that localeconv() points to when it returns (see setlocale (3C)).

AUTHORlocaleconv() was developed by OSF and HP.

SEE ALSOnl_langinfo(3C), setlocale(3C), localedef(4), langinfo(5), thread_safety(5).

STANDARDS CONFORMANCElocaleconv() : AES, SVID3, XPG4, ANSI C

Section 3−−580 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A lA

log(3M) log(3M)

NAMElog( ), logf( ), logl( ), logw( ), logq( ) - natural logarithm functions

SYNOPSIS#include <math.h>

double log(double x);

float logf(float x);

Itanium(R)-based System Onlylong double logl(long double x);

extended logw(extended x);

quad logq(quad x);

DESCRIPTIONlog() returns the natural logarithm of x .

logf() is a float version of log() ; it takes a float argument and returns a float result.

Itanium-based System Onlylogl() is a long double version of log() ; it takes a long double argument and returns along double result.

logw() is an extended version of log() ; it takes an extended argument and returns anextended result.

logq() is equivalent to logl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) logw() or logq() , compile also with the -fpwidetypes option.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the log() and logf() functions are available. Millicode versions of math libraryfunctions are usually faster than their counterparts in the standard library. To use these versions, com-pile your program with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the value described in the RETURN VALUE section, butdo not set errno .

RETURN VALUEIf x is +INFINITY, log() returns +INFINITY.

If x is zero, log() returns −HUGE_VAL(equal to −INFINITY) and raises the divide-by-zero exception.

If x is less than zero, log() returns NaN and raises the invalid exception.

If x is NaN, log() returns NaN.

When it raises no other exception, whether log() raises the inexact exception is unspecified.

ERRORSIf x is less than zero, log() sets errno to [EDOM].

Itanium-bsed System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOclog(3M), exp(3M), log10(3M), log2(3M), log1p(3M), pow(3M), math(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−581

A lA

log(3M) log(3M)

STANDARDS CONFORMANCElog() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

logf() , logl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−582 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A lA

log10(3M) log10(3M)

NAMElog10( ), log10f( ), log10l( ), log10w( ), log10q( ) - common logarithm functions

SYNOPSIS#include <math.h>

double log10(double x);

float log10f(float x);

Itanium(R)-based System Onlylong double log10l(long double x);

extended log10w(extended x);

quad log10q(quad x);

DESCRIPTIONlog10() returns the logarithm base ten of x .

log10f() is a float version of log10() ; it takes a float argument and returns a float result.

Itanium-based System Onlylog10l() is a long double version of log10() ; it takes a long double argument and returns along double result.

log10w() is an extended version of log10() ; it takes an extended argument and returns anextended result.

log10q() is equivalent to log10l() on HP-UX systems.

USAGETo use these functions compile either with the default -Ae option or with the -Aa and the-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) log10w() or log10q() , compile also with the -fpwidetypesoption.

To use any of these functions, make sure your program includes <math.h> , and link in the math libraryby specifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

PA-RISC OnlyMillicode versions of the log10() function are available. Millicode versions of math library functionsare usually faster than their counterparts in the standard library. To use these versions, compile yourprogram with the +Olibcalls or the +Oaggressive optimization option.

For special cases, the millicode versions return the value described in the RETURN VALUE section, butdo not set errno .

RETURN VALUEIf x is +INFINITY, log10() returns +INFINITY.

If x is zero, log10() returns −HUGE_VAL(equal to −INFINITY) and raises the divide-by-zero exception.

If x is less than zero, log10() returns NaN and raises the invalid exception.

If x is NaN, log10() returns NaN.

log10() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSIf x is less than zero, log10() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−583

A lA

log10(3M) log10(3M)

SEE ALSOexp(3M), exp10(3M), log(3M), log1p(3M), log2(3M), pow(3M), math(5).

STANDARDS CONFORMANCElog10() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

log10f() , log10l() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−584 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A lA

log1p(3M) log1p(3M)

NAMElog1p( ), log1pf( ), log1pl( ), log1pw( ), log1pq( ) - natural logarithm of one-plus-argument functions

SYNOPSIS#include <math.h>

double log1p(double x);

Itanium(R)-based System Onlyfloat log1pf(float x);

long double log1pl(long double x);

extended log1pw(extended x);

quad log1pq(quad x);

DESCRIPTIONThe log1p() function computes the logarithmic function log(1 + x) , but may be more accurate forvery small values of x .

The expm1() and log1p() functions are useful to guarantee that financial calculations of(((1+x)**n)-1)/x, are accurate when x is very small, namely:

expm1(n * log1p (x))/x

The preceding example would be applicable when calculating small daily interest rates. See also com-pound() and annuity() .

Itanium-based System Onlylog1pf() is a float version of log1p() ; it takes a float argument and returns a float result.

log1pl() is a long double version of log1p() ; it takes a long double argument and returns along double result.

log1pw() is an extended version of log1p() ; it takes an extended argument and returns anextended result.

log1pq() is equivalent to log1pl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) expw() or expq() , compile also with the -fpwidetypes option.

Make sure your program includes <math.h> , and link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is +INFINITY, log1p() returns +INFINITY.

If x = -1.0, log1p() returns −HUGE_VAL(equal to −INFINITY) and raises the divide-by-zero exception.

If x < -1.0, log1p() returns NaN and raises the invalid exception.

If x is NaN, log1p() returns NaN.

When it raises no other exception, whether log1p() raises the inexact exception is unspecified.

ERRORSIf x < -1.0, log1p() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOannuity(3M), compound(3M), expm1(3M), log(3M), math(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−585

A lA

log1p(3M) log1p(3M)

STANDARDS CONFORMANCElog1p() : XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

log1pf() , log1pl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−586 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A lA

log2(3M) log2(3M)

NAMElog2( ), log2f( ), log2l( ), log2w( ), log2q( ) - logarithm base two functions

SYNOPSIS#include <math.h>

double log2(double x);

float log2f(float x);

Itanium(R)-based System Onlylong double log2l(long double x);

extended log2w(extended x);

quad log2q(quad x);

DESCRIPTIONlog2() returns the logarithm base two of x .

log2f() is a float version of log2() ; it takes a float argument and returns a float result.

Itanium-based System Onlylog2l() is a long double version of log2() ; it takes a long double argument and returns along double result.

log2w() is an extended version of log2() ; it takes an extended argument and returns anextended result.

log2q() is equivalent to log2l() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) log2w() or log2q() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> , and link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf x is +INFINITY, log2() returns +INFINITY.

If x is zero, log2() returns −HUGE_VAL(equal to −INFINITY) and raises the divide-by-zero exception.

If x is less than zero, log2() returns NaN and raises the invalid exception.

If x is NaN, log2() returns NaN.

log2() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORSIf x is less than zero, log2() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOexp(3M), exp10(3M), log(3M), log1p(3M), log2(3M), pow(3M), math(5).

STANDARDS CONFORMANCElog2() , log2f() , log2l() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−587

A lA

logb(3M) logb(3M)

NAMElogb( ), logbf( ), logbl( ), logbw( ), logbq( ) - radix-independent exponent functions

SYNOPSIS#include <math.h>

double logb(double x);

Itanium(R)-based System Onlyfloat logbf(float x);

long double logbl(long double x);

extended logbw(extended x);

quad logbq(quad x);

DESCRIPTIONThe logb() function computes the exponent of the floating point value x . Formally, the return value isthe integral part of log base r of |x| as a signed floating point value, for nonzero x , where r is the radix ofthe machine’s floating-point arithmetic. The radix r is 2 on HP-UX systems.

If x is denormal, it is treated as though it were normalized, before the exponent is determined.

Itanium-based System Onlylogbf() is a float version of logb() ; it takes a float argument and returns a float result.

logbl() is a long double version of logb() ; it takes a long double argument and returns along double result.

logbw() is an extended version of logb() ; it takes an extended argument and returns anextended result.

logbq() is equivalent to logbl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) logbw() or logbq() , compile also with -fpwidetypes .

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line. For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEUpon successful completion, logb() returns the exponent of x .

If x is NaN, logb() returns NaN.

If x is ±INFINITY, logb() returns +INFINITY.

If x is zero, logb() returns −HUGE_VAL(equal to −INFINITY) and raises the divide-by-zero floating-point exception.

ERRORSIf x is zero, logb() sets errno to [EDOM].

Itanium-based System OnlyHP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-pile with the +Olibmerrno option.

SEE ALSOfrexp(3M), ilogb(3M), scalb(3M), scalbn(3M), scalbln(3M), math(5).

STANDARDS CONFORMANCElogb() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

logbf() , logbl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

Section 3−−588 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

logname(3C) logname(3C)

NAMElogname( ) - return login name of user

SYNOPSIS#include <unistd.h>

char *logname(void);

DESCRIPTIONlogname() returns a pointer to the null-terminated login name; it extracts the $LOGNAMEvariablefrom the user’s environment.

WARNINGSlogname() returns a pointer to static data that is overwritten by each subsequent call.

This method of determining a login name is subject to forgery.

FILES/etc/profile

SEE ALSOenv(1), login(1), profile(4), environ(5), thread_safety(5).

STANDARDS CONFORMANCElogname() : SVID2, XPG2

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−589

A lA

longname(3X) longname(3X)(CURSES)

NAMElongname — get verbose description of current terminal

SYNOPSIS#include <curses.h>

char *longname(void);

DESCRIPTIONThe longname() function generates a verbose description of the current terminal. The maximumlength of a verbose description is 128 bytes. It is defined only after the call to initscr() ornewterm() .

RETURN VALUEUpon successful completion, longname() returns a pointer to the description specified above. Other-wise, it returns a null pointer on error.

ERRORSNo errors are defined.

APPLICATION USAGEThe return value of longname() may point to a static area which is overwritten by a subsequent call tonewterm() .

SEE ALSOinitscr(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity. The argument list for the longname() function is explicitly declaredas void.

Section 3−−590 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

lrint(3M) lrint(3M)

NAMElrint( ), lrintf( ), lrintl( ), lrintw( ), lrintq( ) - round to nearest long int functions

SYNOPSIS#include <math.h>

long int lrint(double x);

Itanium(R)-based System Onlylong int lrintf(float x);

long int lrintl(long double x);

long int lrintw(extended x);

long int lrintq(quad x);

DESCRIPTIONlrint() rounds its argument to the nearest integral value, rounding according to the current roundingdirection.

lrint() is equivalent to llrint() , except that it rounds to long int instead of long long .

Itanium-based System Onlylrintf() is a float version of lrint() ; it takes a float argument.

lrintl() is a long double version of lrint() ; it takes a long double argument.

lrintw() is an extended version of lrint() ; it takes an extended argument.

lrintq() is equivalent to lrintl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) lrintw() or lrintq() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf the rounded value is outside the range of long int , the numeric result is the maximum or minimumlong int value and the invalid floating-point exception is raised. On Itanium-based systems, if therounded value is outside the range of long int , the numeric result is the minimum long int value.

When lrint() raises no other floating-point exception and the result differs from the argument, thefunction raises the inexact floating-point exception.

ERRORSNo errors are defined.

SEE ALSOceil(3M), floor(3M), fabs(3M), fmod(3M), fegetround(3M), fesetround(3M), llrint(3M), llround(3M),lround(3M), rint(3M), round(3M), trunc(3M), math(5), fenv(5).

STANDARDS CONFORMANCElrint() , lrintf() , lrintl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−591

A lA

lround(3M) lround(3M)

NAMElround( ), lroundf( ), lroundl( ), lroundw( ), lroundq( ) - round to long int functions

SYNOPSIS#include <math.h>

long int lround(double x);

Itanium(R)-based System Onlylong int lroundf(float x);

long int lroundl(long double x);

long int lroundw(extended x);

long int lroundq(quad x);

DESCRIPTIONlround() rounds its argument to the nearest integral value. An argument exactly halfway between twointegers is rounded away from zero, regardless of the current rounding direction. Rounding away fromzero also applies to the functions, round and llround .

lround() is equivalent to llround() , except that it rounds to long int instead of long long .

Itanium-based System Onlylroundf() is a float version of lround() ; it takes a float argument.

lroundl() is a long double version of lround() ; it takes a long double argument.

lroundw() is an extended version of lround() ; it takes an extended argument.

lroundq() is equivalent to lroundl() on HP-UX systems.

USAGETo use these functions, compile either with the default -Ae option or with the -Aa and-D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) lroundw() or lroundq() , compile also with the -fpwidetypesoption.

Make sure your program includes <math.h> . Link in the math library by specifying -lm on the com-piler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEIf the rounded value is outside the range of long int , the numeric result is the maximum or minimumlong int value and the invalid floating-point exception is raised. On Itanium-based systems, if therounded value is outside the range of long int , the numeric result is the minimum long int value.

When lround() raises no other floating-point exception and the result differs from the argument, thefunction may raise the inexact floating-point exception.

ERRORSNo errors are defined.

SEE ALSOceil(3M), floor(3M), fabs(3M), fmod(3M), fegetround(3M), fesetround(3M), lrint(3M), llrint(3M),llround(3M), rint(3M), round(3M), trunc(3M), math(5), fenv(5).

STANDARDS CONFORMANCElround() , lroundf() , lroundl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-pointarithmetic’’)

Section 3−−592 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A lA

lsearch(3C) lsearch(3C)

NAMElsearch( ), lfind( ) - linear search and update

SYNOPSIS#include <search.h>

void *lsearch(const void *key,void *base,size_t *nelp,size_t width,int (*compar)(const void *, const void *)

);

void *lfind(const void *key,const void *base,size_t *nelp,size_t width,int (*compar)(const void *, const void *)

);

DESCRIPTIONlsearch() is a linear search routine generalized from Knuth (6.1) Algorithm S. It returns a pointer

into a table indicating where a datum may be found. If the datum does not occur, it isadded at the end of the table.

key Points to the datum to be sought in the table.

base Points to the first element in the table.

nelp Points to an integer containing the current number of elements inthe table. The integer is incremented if the datum is added to thetable.

compar Name of the comparison function which the user must supply(strcmp() , for example). It is called with two arguments thatpoint to the elements being compared. The function must returnzero if the elements are equal and non-zero otherwise.

lfind() Same as lsearch() except that if the datum is not found, it is not added to the table.Instead, a NULL pointer is returned.

NotesThe pointers to the key and the element at the base of the table should be of type pointer-to-element, andcast to type pointer-to-character.

The comparison function need not compare every byte, so arbitrary data may be contained in the ele-ments in addition to the values being compared.

Although declared as type pointer-to-character, the value returned should be cast into type pointer-to-element.

EXAMPLESThis code fragment reads in ≤ TABSIZE strings of length ≤ ELSIZE and stores them in a table, elim-inating duplicates.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−593

A lA

lsearch(3C) lsearch(3C)

#include <stdio.h>

#define TABSIZE 50#define ELSIZE 120

char line[ELSIZE], tab[TABSIZE][ELSIZE], *lsearch( );size_t nel = 0;int strcmp( );

. . .while (fgets(line, ELSIZE, stdin) != NULL &&

nel < TABSIZE)(void) lsearch(line, (char *)tab, &nel,

ELSIZE, strcmp);. . .

RETURN VALUEIf the searched-for datum is found, both lsearch() and lfind() return a pointer to it. Otherwise,lfind() returns NULL and lsearch() returns a pointer to the newly added element.

WARNINGSUndefined results can occur if there is not enough room in the table to add a new item.

SEE ALSObsearch(3C), hsearch(3C), tsearch(3C), thread_safety(5).

STANDARDS CONFORMANCElsearch() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

lfind() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

Section 3−−594 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A lA

ltostr(3C) ltostr(3C)

NAMEltostr(), ultostr(), ltoa(), ultoa() - convert long integers to strings

SYNOPSIS#include <stdlib.h>

char *ltostr(long n, int base);

char *ultostr(unsigned long n, int base);

char *ltoa(long n);

char *ultoa(unsigned long n);

Obsolescent Interfacesint ltostr_r(long n, int base, char *buffer, int buflen);

int ultostr_r(unsigned long n, int base, char *buffer, int buflen);

int ltoa_r(long n, char *buffer, int buflen);

int ultoa_r(unsigned long n, char *buffer, int buflen);

DESCRIPTIONltostr() Convert a signed long integer to the corresponding string representation in the

specified base. The argument base must be between 2 and 36, inclusive.

ultostr() Convert an unsigned long integer to the corresponding string representation in thespecified base. The argument base must be between 2 and 36, inclusive.

ltoa() Convert a signed long integer to the corresponding base 10 string representation,returning a pointer to the result.

ultoa() Convert an unsigned long integer to the corresponding base 10 string representa-tion, returning a pointer to the result.

These functions are smaller and faster than using sprintf() for simple conversions (see printf (3S)).

Obsolescent Interfacesltostr_r() , ultostr_r() , ltoa_r() , ultoa_r() convert long integers to strings.

ERRORSIf the value of base is not between 2 and 36, ltostr() and ultostr() return NULL and set theexternal variable errno to ERANGE.

WARNINGSThe return values for ltostr() , ultostr() , ltoa() and ultoa() point to data whose content isoverwritten by subsequent calls to these functions by the same thread.

ltostr_r() , ultostr_r() , ltoa_r() and ultoa_r() are obsolescent interface supported only forcompatibility with existing DCE applications. New multi-threaded applications should use ltostr() ,ultostr() , ltoa() and ultoa() .

AUTHORltostr() , ultostr() , ltoa() , and ultoa() were developed by HP.

SEE ALSOstrtol(3C), printf(3S), thread_safety(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−595

A mA

malloc(3C) malloc(3C)

NAMEmalloc(), free(), realloc(), calloc(), valloc(), mallopt(), mallinfo(), memorymap(), alloca() - main memoryallocator

SYNOPSIS#include <stdlib.h>

void *malloc(size_t size);

void *calloc(size_t nelem, size_t elsize);

void *realloc(void *ptr, size_t size);

void *valloc(size_t size);

void free(void *ptr);

void memorymap(int show_stats); (Obsoleted )

alloca#include <alloca.h>

void *alloca(size_t size);

SYSTEM V SYNOPSIS#include <malloc.h>

char *malloc(unsigned size);

void free(char *ptr);

char *realloc(char *ptr, unsigned size);

char *calloc(unsigned nelem, unsigned elsize);

int mallopt(int cmd, int value);

struct mallinfo mallinfo(void);

RemarksThe functionality in the old malloc (3X) package has been incorporated into malloc (3C). The library(/usr/lib/libmalloc.a ) corresponding to the -lmalloc linker option is now an empty library.Makefiles that reference this library will continue to work.

Obsolescent Interfacesmemorymap() has been deprecated at HP-UX 11i Version 1 and is now obsolete.

DESCRIPTIONThe functions described in this manual entry provide a simple, general purpose memory allocation pack-age:

malloc() Allocates space for a block of at least size bytes, but does not initialize the space.

calloc() Allocates space for an array of nelem elements, each of size elsize bytes, and ini-tializes the space to zeros. Actual amount of space allocated will be at least nelem* elsize bytes.

realloc() Changes the size of the block pointed to by ptr to size bytes and returns a pointerto the (possibly moved) block. Existing contents are unchanged up to the lesser ofthe new and old sizes. If ptr is a NULL pointer, realloc() behaves like mal-loc() for the specified size. If size is zero and ptr is not a NULL pointer, theobject it points to is freed and NULL is returned. realloc() of blocks withspecial alignments, such as those created by valloc() , is not supported.

valloc() Allocates space for a block of at least size bytes starting on a boundary aligned toa multiple of the value returned by sysconf (__SC_PAGESIZE). This space isuninitialized.

free() Deallocates the space pointed to by ptr (a pointer to a block previously allocatedby malloc() , realloc() , calloc() , or valloc() ) and makes the spaceavailable for further allocation. If ptr is a NULL pointer, no action occurs.

Section 3−−596 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

malloc(3C) malloc(3C)

mallopt() Provides for control over the allocation algorithm and other options in themalloc (3C) package. The available values for cmd are:

M_MXFAST Set maxfast to value . The algorithm allocates all blocks belowthe size of maxfast in large groups, then doles them out veryquickly. The default value for maxfast is zero.

M_NLBLKS Set numlblks to value . The above mentioned ‘‘large groups’’ eachcontain numlblks blocks. numlblks must be greater than 1. Thedefault value for numlblks is 100 .

M_GRAIN Set grain to value . The sizes of all blocks smaller than maxfastare considered to be rounded up to the nearest multiple of grain .grain must be greater than zero. The default value of grain isthe smallest number of bytes that can accommodate alignment ofany data type. value is rounded up to a multiple of the defaultwhen grain is set.

M_BLOCK Block all blockable signals in malloc() , realloc() , cal-loc() , and free() . This option is provided for those who needto write signal handlers that allocate memory. When set, themalloc (3C) routines can be called from within signal handlers(they become re-entrant). Default action is not to block all block-able signals.

NOTE: performance of malloc() will be impacted consider-ably when the M_BLOCKoption is set.

M_UBLOCK Do not block all blockable signals in malloc() , realloc() ,calloc() , and free() . This option cancels signal blockinginitiated by the M_BLOCKoption.

M_REL_LAST_FBLKEnable the feature of release last free block to heap . This optionis provided for 32-bit applications with one arena. Release of lastblock happens only when size of the free block is greater than thethreshold.

The threshold value is defined as 2 * (arena expansionfactor) * 4096 bytes. The feature is disabled if theM_MXFASTvalue is greater than or equal to threshold value.Default action is not to release last block.

These values are defined in the <malloc.h> header file.

mallopt() can be called repeatedly; but once the first small block is allocated,it is not possible to change the M_MAXFAST, M_NLBLKS, and M_GRAINvalues.

mallinfo() Provides instrumentation describing space usage, but cannot be called until thefirst small block is allocated. It returns the structure mallinfo:

arena : total space in arenafsmblks : number of bytes in free small blocksfordblks : number of bytes in free ordinary blockshblks : number of holding blockshblkhd : number of bytes in holding block headerskeepcost : cost of enabling keep optionordblks : number of ordinary blockssmblks : number of small blocksuordblks : number of bytes in ordinary blocks in useusmblks : number of bytes in small blocks in use

The mallinfo structure is defined in the <malloc.h> header file.

Each of the allocation routines returns a pointer to space suitably aligned (after possible pointer coercion)for storage of any type of object.

memorymap() Displays the contents of the memory allocator for HP-UX 32-bit operating systemsonly. A list of addresses and block descriptions is written (using printf() ) tostandard output. If the value of the show_stats parameter is 1, statistics

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−597

A mA

malloc(3C) malloc(3C)

concerning number of blocks and sizes used will also be written. If the value iszero, only the memory map will be written.

The addresses and sizes displayed by memorymap() may not correspond tothose requested by an application. The size of a block (as viewed by the allocator)includes header information and padding to properly align the block. Theaddress is also offset by a certain amount to accommodate the header information.

memorymap() has been deprecated at HP-UX 11i Version 1 and is now obsolete.

alloca() Allocates space from the stack of the caller for a block of at least size bytes, butdoes not initialize the space. The space is automatically freed when the callingroutine exits.

Memory returned by alloca() is not related to memory allocated by othermemory allocation functions. Behavior of addresses returned by alloca() asparameters to other memory functions is undefined.

The implementation of this routine is system dependent and its use isdiscouraged.

RETURN VALUEUpon successful completion, malloc() , realloc() , calloc() , and valloc() return a pointer tospace suitably aligned (after possible pointer coercion) for storage of any type of object. Otherwise, theyreturn a NULL pointer. If realloc() returns a NULL pointer, the memory pointed to by the originalpointer is left intact.

mallopt() returns zero for success and nonzero for failure.

DIAGNOSTICSmalloc() , realloc() , calloc() , and valloc() return a NULL pointer if there is no availablememory, or if the memory managed by malloc() has been detectably corrupted. This memory maybecome corrupted if data is stored outside the bounds of a block, or if an invalid pointer (a pointer notgenerated by malloc() , realloc() , calloc() , or valloc() is passed as an argument to free()or realloc() .

If mallopt() is called after any allocation of a small block and cmd is not set to M_BLOCKorM_UBLOCK, or if cmd or value is invalid, nonzero is returned. Otherwise, it returns zero.

ERRORS[ENOMEM] malloc() , realloc() , calloc() , and valloc() set errno to ENOMEM

and return a NULL pointer when an out-of-memory condition arises.

[EINVAL] malloc() , realloc() , calloc() , and valloc() set errno to EINVALand return a NULL pointer when the memory being managed by malloc() hasbeen detectably corrupted.

EXTERNAL INFLUENCESThe performance of the malloc() family can be tuned via two environment variables,_M_ARENA_OPTSand _M_SBA_OPTS, and three new global variables, __hp_malloc_maxfast ,__hp_malloc_num_smallblocks and __hp_malloc_grain .

For threaded applications, malloc() uses multiple arenas. Memory requests from different threads arehandled by different arenas. _M_ARENA_OPTScan be used to adjust the number of arenas and howmany pages each time an arena expands itself (the expansion factor), assuming that the page size is 4096bytes. In general, the more threads in an application, the more arenas should be used for better perfor-mance. The number of arenas can be from 1 to 64 for threaded applications. For non-threaded applica-tions, only one arena is used. If the environment variable is not set, or the number of arenas is set to beout of the range, the default number of 8 will be used. The expansion factor is from 1 to 4096, defaultvalue is 32. Again, if the factor is out of the range, the default value will be used.

Here is an example of how to use _M_ARENA_OPTS,

$ export _M_ARENA_OPTS = 16:8

This means that the number of arenas is 16, and the expansion size is 8*4096 bytes. In general, the morearenas you use, the smaller the expansion factor should be, and vice versa.

Section 3−−598 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: August 2003

A mA

malloc(3C) malloc(3C)

_M_SBA_OPTSis used to turn on the small block allocator, and to set up parameters for the small blockallocator, namely, maxfast , grain , and numlblks . Applications with small block allocator turned on usu-ally run faster than with it turned off. Small block allocator can be turned on through mallopt() ; how-ever, it is not early enough for C++/Java applications. The environment variable turns it on before theapplication starts. The mallopt() call can still be used the same way. If the environment variable isset, and no small block allocator has been used, the subsequent mallopt() calls can still overwritewhatever is set through _M_SBA_OPTS. If the environment variable is set, and small block allocator hasbeen used, then mallopt() will have no effect.

To use this environment variable,

$ export _M_SBA_OPTS = 512:100:16

This means that the maxfast size is 512, the number of small blocks is 100, and the grain size is 16. Youhave to supply all 3 values, and in that order. If not, the default values will be used instead.

_M_ARENA_OPTShas no effects on non-threaded applications, while _M_SBA_OPTShas.

The three new global variables, __hp_malloc_maxfast , __hp_malloc_num_smallblocks , and__hp_malloc_grain , are introduced to over-ride the _M_SBA_OPTSenvironment option. When thesethree variables are initialized within an application, _M_SBA_OPTShas no effect. This way, a finelytuned application can lock in performance across different user environments. However, as_M_ARENA_OPTS, a subsequent call to mallopt() before any block of memory was allocated willchange the malloc() behavior. By default, these three variables will be initialized to zero at start up. Itis the same as setting them to

extern int __hp_malloc_maxfast=512;extern int __hp_malloc_num_smallblocks=100;extern int __hp_malloc_grain=16;

By default, SBA (Small Block Allocation) is turned on. This may contribute to better application perfor-mance. A user can set

extern int __hp_malloc_maxfast=-1;

This will turn off SBA.

For all other possible values, please refer to mallopt() .

NOTE: Modifying these variables increases the chances of surfacing existing user memory defects such asbuffer overrun.

WARNINGSmalloc() functions use brk() and sbrk() (see brk(2)) to increase the address space of a process.Therefore, an application program that uses brk() or sbrk() must not use them to decrease theaddress space, because this confuses the malloc() functions.

free() and realloc() do not check their pointer argument for validity.

The following actions are considered bad programming practices and should not be done. The results areunpredictable, probably undesirable and not supported. Examples of undesirable results are loss of data,memory fault, bus error or infinite loop.

• Attempting to free() or realloc() a pointer not generated as the result of a call to mal-loc() , realloc() , calloc() , or valloc() .

• Reading or writing data outside the boundaries of an allocated block.

• Attempting to realloc() an aligned block such as the result of valloc() .

The following actions are strongly discouraged and may be unsupported in a future version of mal-loc() :

• Attempting to free() the same block twice.

• Depending on unmodified contents of a block after it has been freed.

• Attempting to realloc() a block after it is freed.

Undocumented features of earlier memory allocators have not been duplicated. Applications which usedany of the above bad programming practices or discouraged practices are not guaranteed to continuefunctioning at future releases.

HP-UX 11i Version 2: August 2003 − 4 − Hewlett-Packard Company Section 3−−599

A mA

malloc(3C) malloc(3C)

Obsolescent Interfacesmemorymap() has been deprecated at HP-UX 11i Version 1 and is now obsolete. The mallinfo()function is more useful for malloc statistics.

COMPATIBILITYThe only external difference between the old malloc (3X) allocator and the malloc (3C) allocator is that theold allocator would return a NULL pointer for a request of zero bytes. The malloc (3C) allocator returns avalid memory address. This is not a concern for most applications.

By default, SBA (Small Block Allocation) is turned on for Itanium(R)-based systems and is turned off forPA-RISC systems. This was due to performance concerns. Please refer to the EXTERNAL INFLUENCESsection of this man page for details.

SEE ALSObrk(2), errno(2), thread_safety(5).

STANDARDS CONFORMANCEmalloc() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

calloc() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

free() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

mallinfo() : SVID2, XPG2

mallopt() : SVID2, SVID3, XPG2

realloc() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C

Section 3−−600 Hewlett-Packard Company − 5 − HP-UX 11i Version 2: August 2003

A mA

mbrlen(3C) mbrlen(3C)

NAMEmbrlen( ) - get number of bytes in a character (restartable)

SYNOPSIS#include <wchar.h>

size_t mbrlen(const char *s, size_t n, mbstate_t *ps);

DESCRIPTIONIf s is not a null pointer, mbrlen() determines the number of bytes constituting the character pointed toby s . It is equivalent to:

mbstate_t internal;mbrtowc(NULL, s, n, ps != NULL ? ps : &internal);

If ps is a null pointer, the mbrlen() function uses its own internal mbstate_t object, which is initial-ized at program startup to the initial conversion state. Otherwise, the mbstate_t object pointed to byps is used to completely describe the current conversion state of the associated character sequence.

EXTERNAL INFLUENCESlocale

The behavior of this function is affected by the LC_CTYPEcategory of the current locale.

RETURN VALUEThe mbrlen() function returns the first of the following that applies:

0 If the next n or fewer bytes complete the character that corresponds to the nullwide-character.

positive If the next n or fewer bytes complete a valid character; the value returned is thenumber of bytes that complete the character.

(size_t )-2 If the next n bytes contribute to an incomplete but potentially valid character, andall n bytes have been processed. When n has at least the value of the MB_CUR_MAXmacro, this case can only occur if s points at a sequence of redundant shiftsequences (for implementations with state-dependent encodings).

(size_t )-1 If an encoding error occurs, in which case the next n or fewer bytes do not contri-bute to a complete and valid character. In this case, EILSEQ is stored in errnoand the conversion state is undefined.

ERRORSThe mbrlen() function may fail if:

[EINVAL] ps points to an object that contains an invalid conversion state.

[EILSEQ] Invalid character sequence is detected.

AUTHORmbrlen() was developed by HP and Mitsubishi Electric Corporation.

SEE ALSOmbsinit(3C), mbrtowc(3C).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−601

A mA

mbrtowc(3C) mbrtowc(3C)

NAMEmbrtowc( ) - convert a character to a wide-character code (restartable)

SYNOPSIS#include <wchar.h>

size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);

DESCRIPTIONIf s is a null pointer, the mbrtowc() function is equivalent to the call:

mbrtowc(NULL, "", 1, ps)

In this case, the values of the arguments pwc and n are ignored.

If s is not a null pointer, the mbrtowc() function inspects at most n bytes beginning at the byte pointedto by s to determine the number of bytes needed to complete the next character (including any shiftsequences). If the function determines that the next character is completed, it determines the value ofthe corresponding wide-character and then, if pwc is not a null pointer, stores that value in the objectpointed to by pwc . If the corresponding wide-character is the null wide-character, the resulting statedescribed is the initial conversion state.

If ps is a null pointer, the mbrtowc() function uses its own internal mbstate_t object, which is initial-ized at program startup to the initial conversion state. Otherwise, the mbstate_t object pointed to by ps isused to completely describe the current conversion state of the associated character sequence.

EXTERNAL INFLUENCESlocale

The behavior of this function is affected by the LC_CTYPEcategory of the current locale.

RETURN VALUEThe mbrtowc() function returns the first of the following that applies:

0 If the next n or fewer bytes complete the character that corresponds to the nullwide-character (which is the value stored).

Positive If the next n or fewer bytes complete a valid character (which is the value stored);the value returned is the number of bytes that complete the character.

(size_t )-2 If the next n bytes contribute to an incomplete but potentially valid character, andall n bytes have been processed (no value is stored). When n has at least the valueof the MB_CUR_MAXmacro, this case can only occur if s points at a sequence ofredundant shift sequences (for implementations with state-dependent encodings).

(size_t )-1 If an encoding error occurs, in which case the next n or fewer bytes do not contri-bute to a complete and valid character (no value is stored). In this case, EILSEQ isstored in errno and the conversion state is undefined.

ERRORSThe mbrtowc() function may fail if:

[EINVAL] ps points to an object that contains an invalid conversion state.

[EILSEQ] Invalid character sequence is detected.

WARNINGSWith the exception of ASCII characters, the code values of wide characters (type of wchar_t ) are specificto the effective locale specified by the LC_CTYPEenvironment variable. These values may not be compa-tible with values obtained by specifying other locales that are supported now, or which may be supportedin the future. It is recommended that wide character constants and wide string literals (see the C Refer-ence Manual ) not be used, and that wide character code values not be stored in files or devices becausefuture standards may dictate changes in the code value assignments of the wide characters. However,wide character constants and wide string literals corresponding to the characters of the ASCII code set canbe safely used since their values are guaranteed to be the same as their ASCII code set values.

AUTHORmbrtowc() was developed by HP and Mitsubishi Electric Corporation.

Section 3−−602 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mbrtowc(3C) mbrtowc(3C)

SEE ALSOmbsinit(3C). ˜

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−603

A mA

mbsinit(3C) mbsinit(3C)

NAMEmbsinit( ) - determine conversion object status

SYNOPSIS#include <wchar.h>

int mbsinit(const mbstate_t *ps);

DESCRIPTIONIf ps is not a null pointer, the mbsinit() function determines whether the object pointed to by psdescribes an initial conversion state.

APPLICATION USAGEThe mbstate_t object is used to describe the current conversion state from a particular character sequenceto a wide-character sequence (or vice versa) under the rules of a particular setting of the LC_CTYPEcategory of the current locale.

The initial conversion state corresponds, for a conversion in either direction, to the beginning of a newcharacter sequence in the initial shift state. A zero valued mbstate_t object is at least one way to describean initial conversion state. A zero valued mbstate_t object can be used to initiate conversion involvingany character sequence.

EXTERNAL INFLUENCESlocale

The behavior of this function is affected by the LC_CTYPEcategory of the current locale.

RETURN VALUEThe mbsinit() function returns non-zero if ps is a null pointer, or if the pointed-to object describes aninitial conversion state; otherwise, it returns zero.

The behavior is undefined if an mbstate_t object is altered by any of the functions described as "restart-able", and is then used with a different character sequence, or in the other conversion direction, or with adifferent LC_CTYPEcategory setting than on earlier function calls.

ERRORSNo errors are defined.

AUTHORmbsinit() was developed by HP and Mitsubishi Electric Corporation.

SEE ALSOmbrlen(3C), mbrtowc(3C), wcrtomb(3C), mbsrtowcs(3C), wcsrtombs(3C).

Section 3−−604 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mbsrtowcs(3C) mbsrtowcs(3C)

NAMEmbsrtowcs( ) - convert a character string to a wide-character string (restartable)

SYNOPSIS#include <wchar.h>

size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len,mbstate_t *ps);

DESCRIPTIONThe mbsrtowcs() function converts a sequence of characters, beginning in the conversion statedescribed by the object pointed to by ps , from the array indirectly pointed to by src into a sequence ofcorresponding wide-characters. If dst is not a null pointer, the converted characters are stored into thearray pointed to by dst . Conversion continues up to and including a terminating null character, which isalso stored. Conversion stops early in either of the following cases:

• When a sequence of bytes is encountered that does not from a valid character.

• When len codes have been stored into the array pointed to by dst (and dst is not a null pointer).

Each conversion takes place as if by a call to the mbrtowc() function.

If dst is not a null pointer, the pointer object pointed to by src is assigned either a null pointer (if conver-sion stopped due to reaching a terminating null character) or the address just past the last character con-verted (if any). If conversion stopped due to reaching a terminating null character, and if dst is not a nullpointer, the resulting state described is the initial conversion state.

If ps is a null pointer, the mbsrtowcs() function uses its own internal mbstate_t object, which is initial-ized at program startup to the initial conversion state. Otherwise, the mbstate_t object pointed to by ps isused to completely describe the current conversion state of the associated character sequence. The imple-mentation will behave as if no function defined in this specification calls mbsrtowcs() .

EXTERNAL INFLUENCESlocale

The behavior of this function is affected by the LC_CTYPEcategory of the current locale.

RETURN VALUEIf the input conversion encounters a sequence of bytes that do not form a valid character, an encodingerror occurs. In this case, the mbsrtowcs() function stores the value of the macro EILSEQ in errnoand returns (size_t )-1; the conversion state is undefined. Otherwise, it returns the number of characterssuccessfully converted, not including the terminating null (if any).

ERRORSThe mbsrtowcs() function may fail if:

[EINVAL] ps points to an object that contains an invalid conversion state.

[EILSEQ] Invalid character sequence is detected.

WARNINGSWith the exception of ASCII characters, the code values of wide characters (type of wchar_t ) are specificto the effective locale specified by the LC_CTYPEenvironment variable. These values may not be compa-tible with values obtained by specifying other locales that are supported now, or which may be supportedin the future. It is recommended that wide character constants and wide string literals (see the C Refer-ence Manual ) not be used, and that wide character code values not be stored in files or devices becausefuture standards may dictate changes in the code value assignments of the wide characters. However,wide character constants and wide string literals corresponding to the characters of the ASCII code setcan be safely used since their values are guaranteed to be the same as their ASCII code set values.

AUTHORmbsrtowcs() was developed by HP and Mitsubishi Electric Corporation.

SEE ALSOmbsinit(3C), mbrtowc(3C).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−605

A mA

memalign(3C) memalign(3C)

NAMEmemalign() - allocate aligned memory

SYNOPSIS#include <stdlib.h>

void *memalign(size_t boundary, size_t size);

DESCRIPTIONmemalign() allocates space for a block of size bytes, whose address is a multiple of boundary . Thespace is not initialized. The boundary must be a power of 2.

RETURN VALUEUpon successful completion, memalign() returns a pointer to space aligned to a multiple of boundary .Otherwise, it returns a NULL pointer.

DIAGNOSTICSmemalign() returns a NULL pointer if there is no available memory, or if the value of boundary is nota power of 2.

ERRORS[ENOMEM] memalign() sets errno to [ENOMEM] and returns a NULL pointer when an

out-of-memory condition arises.

[EINVAL] memalign() sets errno to [EINVAL] and returns a NULL pointer when thevalue of boundary is not a power of 2.

[EINVAL] memalign() sets errno to EINVAL and returns a NULL pointer when thememory being managed by malloc() has been detectably corrupted.

EXTERNAL INFLUENCESmemalign() employs the malloc (3C) allocator. For tuning information, see the malloc (3C) man page.

WARNINGSFor warnings, see the malloc (3C) man page.

COMPATIBILITYmemalign() has not previously been available on HP-UX.

SEE ALSOthread_safety(5).

STANDARDS CONFORMANCEThere appear to be no standards applicable to memalign() . Some implementations do not check thatboundary is a power of 2. The HP-UX implementation is not derived from any predecessor.

Section 3−−606 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

memory(3C) memory(3C)

NAMEmemccpy( ), memchr( ), memcmp( ), memcpy( ), memmove( ), memset( ), bcopy( ), bcmp( ), bzero( ), ffs( ) -memory operations

SYNOPSIS#include <string.h>

void *memccpy(void *s1, const void *s2, int c, size_t n);

void *memchr(const void *s, int c, size_t n);

int memcmp(const void *s1, const void *s2, size_t n);

void *memcpy(void *s1, const void *s2, size_t n);

void *memmove(void *s1, const void *s2, size_t n);

void *memset(void *s, int c, size_t n);

#include <strings.h>

int bcmp(const void *s1, const void *s2, size_t n);

void bcopy(const void *s1, void *s2, size_t n);

void bzero(void *s, size_t n);

int ffs(int i);

Remarks:bcmp() , bcopy() , bzero() , ffs() , and <strings.h > are provided solely for portability ofBSD applications, and are not recommended for new applications where portability is important.For portable applications, use memcmp(), memmove(), and memset() , respectively. ffs() hasno portable equivalent.

DESCRIPTIONThese functions operate as efficiently as possible on memory areas (arrays of bytes bounded by a count,not terminated by a null byte). They do not check for the overflow of any receiving memory area.

Definitions for all these functions, the type size_t , and the constant NULL are provided in the<string.h > header file.

memccpy() Copy bytes from the object pointed to by s2 into the object pointed to by s1 , stopping afterthe first occurrence of byte c has been copied, or after n bytes have been copied, which-ever comes first. If copying takes place between objects that overlap, the behavior isundefined. memccpy() returns a pointer to the byte after the copy of c in s1 , or aNULL pointer if c was not found in the first n bytes of s2 .

memchr() Locate the first occurrence of c (converted to an unsigned char ) in the initial n bytes(each interpreted as unsigned char ) of the object pointed to by s . memchr()returns a pointer to the located byte, or a NULL pointer if the byte does not occur in theobject.

memcmp() Compare the first n bytes of the object pointed to by s1 to the first n bytes of the objectpointed to by s2 . memcmp() returns an integer greater than, equal to, or less thanzero, according to whether the object pointed to by s1 is greater than, equal to, or lessthan the object pointed to by s2 . The sign of a non-zero return value is determined by thesign of the difference between the values of the first pair of bytes (both interpreted asunsigned char ) that differ in the objects being compared.

memcpy() Copy n bytes from the object pointed to by s2 into the object pointed to by s1 . If copyingtakes place between objects that overlap, the behavior is undefined. memcpy() returnsthe value of s1 .

memmove() Copy n bytes from the object pointed to by s2 into the object pointed to by s1 . Copyingtakes place as if the n bytes from the object pointed to by s2 are first copied into a tem-porary array of n bytes that does not overlap the objects pointed to by s1 and s2 , andthen the n bytes from the temporary array are copied into the object pointed to by s1 .memmove() returns the value of s1 .

memset() Copy the value of c (converted to an unsigned char ) into each of the first n bytes ofthe object pointed to by s . memset() returns the value of s .

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−607

A mA

memory(3C) memory(3C)

bcopy() copies n bytes from the area pointed to by s1 to the area pointed to by s2 .

bcmp() Compare the first n bytes of the area pointed to by s1 with the area pointed to by s2 .bcmp() returns zero if they are identical; non-zero otherwise. Both areas are assumedto be n bytes in length.

bzero() Clear n bytes in the area pointed to by s by setting them to zero.

ffs() Find the first bit set (beginning with the least significant bit) and return the index of thatbit. Bits are numbered starting at one. A return value of 0 indicates that i is zero.

International Code Set SupportThese functions support only single-byte byte code sets.

WARNINGSThe functions defined in <string.h > were previously defined in <memory.h >.

FILES/usr/include/string.h

SEE ALSOstring(3C), thread_safety(5).

STANDARDS CONFORMANCEmemccpy() : AES, SVID2, SVID3, XPG2, XPG3, XPG4

memchr() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

memcmp(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

memcpy() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

memmove(): AES, SVID3, XPG4, ANSI C

memset() : AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

Section 3−−608 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A mA

meta(3X) meta(3X)(ENHANCED CURSES)

NAMEmeta — enable/disable meta-keys

SYNOPSIS#include <curses.h>

int meta(WINDOW * win, bool bf);

DESCRIPTIONInitially, whether the terminal returns 7 or 8 significant bits on input depends on the control mode of thedisplay driver (see the X/Open System Interface Definitions, Issue 4, Version 2 specification, General Ter-minal Interface ). To force 8 bits to be returned, invoke meta(win, TRUE). To force 7 bits to be returned,invoke meta(win, FALSE). The win argument is always ignored. If the terminfo capabilities smm(meta_on) and rmm (meta_off) are defined for the terminal, smm is sent to the terminal when meta(win,TRUE) is called and rmm is sent when meta(win, FALSE) is called.

RETURN VALUEUpon successful completion, meta() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe same effect is achieved outside Curses using the CS7 or CS8 control mode flag specified in theX/Open System Interface Definitions, Issue 4, Version 2 specification (General Terminal Interface ).

The meta() function was designed for use with terminals with 7-bit character sets and a ‘‘meta’’ key thatcould be used to set the eighth bit.

SEE ALSOgetch(3X), curses_intro(3X), see subsection Input Processing, <curses.h>, X/Open System InterfaceDefinitions, Issue 4, Version 2 specification, Section 9.2, Parameters That Can Be Set (ISTRIP flag).

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−609

A mA

mkdirp(3G) mkdirp(3G)

NAMEmkdirp(), rmdirp() - create, remove directories in a path

SYNOPSIS#include <libgen.h>

int mkdirp (const char * path , mode_t mode);

int rmdirp (char * d, char * d1);

DESCRIPTIONmkdirp creates all the missing directories in the given path with the given mode . [See chmod(2) for thevalues of mode .] The protection part of the mode argument is modified by the process’s file creation mask(see umask(2)).

rmdirp removes directories in path d. This removal starts at the end of the path and moves back towardthe root as far as possible. If an error occurs, the remaining path is stored in d1 . rmdirp returns a 0only if it is able to remove every directory in the path.

RETURN VALUEIf a needed directory cannot be created, mkdirp returns -1 and sets errno to one of the mkdir errornumbers. If all the directories are created, or existed to begin with, it returns zero.

EXAMPLES/ ∗ create scratch directories ∗/if(mkdirp("/tmp/sub1/sub2/sub3", 0755) == -1) {

fprintf(stderr, "cannot create directory");exit(1);

}chdir("/tmp/sub1/sub2/sub3");.../ ∗ cleanup ∗/chdir( /tmp");"rmdirp("sub1/sub2/sub3");

WARNINGSmkdirp uses malloc to allocate temporary space for the string.

rmdirp returns -2 if a ‘‘ . ’’ or ‘‘ .. ’’ is in the path and -3 if an attempt is made to remove the currentdirectory. If an error occurs other than one of the above, -1 is returned.

SEE ALSOmkdir(2), rmdir(2), umask(2), thread_safety(5).

Section 3−−610 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mkfifo(3C) mkfifo(3C)

NAMEmkfifo( ) - make a FIFO file

SYNOPSIS#include <sys/stat.h>

int mkfifo(char *path, mode_t mode);

DESCRIPTIONmkfifo() creates a new FIFO (first-in-first-out) file, at the path name to which path points. The file per-mission bits of the new file are initialized from the mode argument, as modified by the process’s file crea-tion mask: for each bit set in the process’s file mode creation mask, the corresponding bit in the new file’smode is cleared (see umask(2)). Bits in mode other than the file permission bits are ignored.

The FIFO owner ID is set to the process’s effective-user-ID. The FIFO group ID is set to the group ID of theparent directory if the set-group-ID bit is set on that directory. Otherwise the FIFO group ID is set to theprocess’s effective group ID.

For details of the I/O behavior of pipes see read (2) and write (2).

The following symbolic constants are defined in the <sys/stat.h > header, and should be used to con-struct the value of the mode argument. The value passed should be the bitwise inclusive OR of thedesired permissions:

S_IRUSR Read by owner.S_IWUSR Write by owner.S_IRGRP Read by group.S_IWGRP Write by group.S_IROTH Read by other users.S_IWOTH Write by other users.

RETURN VALUEmkfifo() returns 0 upon successful completion. Otherwise, it returns -1, no FIFO is created, anderrno is set to indicate the error.

ERRORSmkfifo() fails and the new file is not created if any of the following conditions are encountered:

[EACCES] A component of the path prefix denies search permission.

[EEXIST] The named file already exists.

[EFAULT] The path argument points outside the process’s allocated address space. The reli-able detection of this error is implementation dependent.

[ELOOP] Too many symbolic links encountered in translating the path name.

[ENAMETOOLONG]The length of the specified path name exceeds PATH_MAXbytes, or the length of acomponent of the path name exceeds NAME_MAXbytes while _POSIX_NO_TRUNCis in effect.

[ENOENT] A component of the path prefix does not exist.

[ENOENT] The path argument is null.

[ENOSPC] Not enough space on the file system.

[ENOTDIR] A component of the path prefix is not a directory.

[EROFS] The directory in which the file is being created is located in a read-only file system.

AUTHORmkfifo() was developed by HP.

SEE ALSOchmod(2), mknod(2), pipe(2), stat(2), umask(2), mknod(5), stat(5), thread_safety(5), types(5).

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−611

A mA

mkfifo(3C) mkfifo(3C)

STANDARDS CONFORMANCEmkfifo() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1

Section 3−−612 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A mA

mktemp(3C) mktemp(3C)

NAMEmktemp( ), mkstemp( ) - make a unique file name

SYNOPSIS#include <stdlib.h>

char *mktemp(char *template);

int mkstemp(char *template);

Remarks:These functions are provided solely for backward compatibility and importability of applications,and are not recommended for new applications where portability is important. For portable appli-cations, use tmpfile() instead (see tmpfile (3S)).

DESCRIPTIONmktemp() replaces the contents of the string pointed to by template by a unique file name, and returnsthe address of template . The string in template should look like a file name with six trailing Xs;mktemp() replaces the Xs with a letter and the current process ID. The letter is chosen such that theresulting name does not duplicate the name of an existing file. If there are fewer than six Xs, the letter isdropped first, followed by dropping the high-order digits of the process ID.

mkstemp() makes the same replacement to the template, but also returns a file descriptor for the tem-plate file after opening the file for reading and writing. mkstemp() thus prevents any possible racecondition between testing whether the file exists and opening it for use.

RETURN VALUEmktemp() returns its argument except when it runs out of letters, in which case the result is a pointer tothe empty string "" .

mkstemp() returns an open file descriptor upon successful completion, or -1 if no suitable file could becreated.

WARNINGSIt is possible to run out of letters.

mktemp() and mkstemp() do not check to determine whether the file name part of template exceedsthe maximum allowable file name length.

SEE ALSOgetpid(2), open(2), tmpfile(3S), tmpnam(3S), thread_safety(5).

STANDARDS CONFORMANCEmktemp() : SVID2, SVID3, XPG2

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−613

A mA

mktimer(3C) mktimer(3C)

NAMEmktimer - allocate a per-process timer

SYNOPSIS#include <sys/timers.h>

timer_t mktimer(int clock_type, int notify_type, void *itimercbp);

DESCRIPTIONThe mktimer() function is used to allocate a per-process timer using the specified system-wide clock asthe timing base. mktimer() returns an unique timer ID of type timer_t used to identify the timer intimer requests (see gettimer (3C)). clock_type specifies the system-wide clock to be used as the timingbase for the new timer. notify_type specifies the mechanism by which the process is to be notifiedwhen the timer expires.

mktimer() supports one per-process timer with a clock_type of TIMEOFDAYand notify_type ofDELIVERY_SIGNALS.

If notify_type is DELIVERY_SIGNALS, the system causes a SIGALRMsignal to be sent to the pro-cess whenever the timer expires.

For clock_type TIMEOFDAY , the machine-dependent clock resolution and maximum value are 1/HZand MAX_ALARMseconds, respectively. These constants are defined in <sys/param.h >.

RETURN VALUEUpon successful completion, mktimer() returns a timer_t , which can be passed to the per_processtimer calls. If unsuccessful, mktimer() returns a value of (timer_t ) −1 and sets errno to indicatethe error.

ERRORSmktimer() fails if any of the following conditions are encountered:

[EAGAIN] The calling process has already allocated all of the timers it is allowed.

[EINVAL] clock_type is not defined, or does not allow the specified notification mechanism.

FILES/usr/include/sys/timers.h

/usr/include/sys/param.h

SEE ALSOtimers(2), getclock(3C), gettimer(3C), reltimer(3C), rmtimer(3C), setclock(3C), thread_safety(5).

STANDARDS CONFORMANCEmktimer() : AES

Section 3−−614 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

modf(3M) modf(3M)

NAMEmodf( ), modff( ), modfl( ), modfw( ), modfq( ) - decompose floating-point number

SYNOPSIS#include <math.h>

double modf(double x, double *iptr);

Itanium(R)-based System Onlyfloat modff(float x, float *iptr);

long double modfl(long double x, long double *iptr);

extended modfw(extended x, extended *iptr);

quad modfq(quad x, quad *iptr);

DESCRIPTIONThe modf() function breaks the argument x into integral and fractional parts, each of which has thesame sign as the argument. It stores the integral part as a double in the object pointed to by iptr .

Itanium-based System Onlymodff() is a float version of modf() ; it takes float and float * arguments and returns afloat result.

modfl() is a long double version of modf() ; it takes long double and long double *arguments and returns a long double result.

modfw() is an extended version of modf() ; it takes extended and extended * arguments andreturns an extended result.

modfq() is equivalent to modfl() on HP-UX systems.

USAGETo use (for Itanium-based systems) modff() , compile either with the default -Ae option or with the -Aaoption.

To use (for Itanium-based systems) modfl() , modfw() , or modfq() , compile either with the default-Ae option or with the -Aa and -D_HPUX_SOURCEoptions.

To use (for Itanium-based systems) modfw() or modfq() , compile also with the -fpwidetypesoption.

To use these functions, make sure your program includes <math.h> , and link in the math library byspecifying -lm on the compiler or linker command line.

For more information, see the HP-UX Floating-Point Guide .

RETURN VALUEmodf( ±x,iptr) returns a result with the same sign as x .

modf( ±Inf,iptr) returns ±0 and stores ±Inf in the object pointed to by iptr .

modf( NaN,iptr) stores a NaN in the object pointed to by iptr and returns a NaN.

ERRORSNo errors are defined.

SEE ALSOfrexp(3M), ldexp(3M), rint(3M), trunc(3M), scalb(3M), scalbln(3M), scalbn(3M), math(5).

STANDARDS CONFORMANCEmodf() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-metic’’)

modff() , modfl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−615

A mA

monitor(3C) monitor(3C)

NAMEmonitor( ) - prepare execution profile

SYNOPSIS#include <mon.h>

void monitor(void (*lowpc)(),void (*highpc)(),WORD *buffer,int bufsize,int nfunc

);

DESCRIPTIONAn executable program created by cc -p automatically includes calls for monitor() with defaultparameters; monitor() need not be called explicitly except to gain fine control over profiling.

monitor() is an interface to profil(2). lowpc and highpc are the addresses of two functions; buffer isthe address of a (user-supplied) array of bufsize WORDs (defined in the <mon.h > header file). Theaddress should have proper alignment to be cast to type struct hdr and struct cnt in <mon.h> .

monitor() arranges to record in the buffer a histogram of periodically sampled values of the programcounter, and of counts of calls of certain functions. The lowest address sampled is that of lowpc and thehighest is just below highpc . lowpc must not equal 0 for this use of monitor . Not more than nfunc callcounts can be kept; only calls of functions compiled with the profiling option -p of cc are recorded. (TheC Library and Math Library supplied when cc -p is used also have call counts recorded.)

For results to be significant, especially where there are small, heavily used routines, it is suggested thatthe buffer be no more than a few times smaller than the range of locations sampled.

To profile the entire program, it is sufficient to use

extern etext;...

monitor ((int (*)())2, ((int(*)())& etext, buf, bufsize, nfunc);

etext lies just above all the program text (see end(3C)).

To stop execution monitoring and write the results on file mon.out , use

monitor ((int (*)())0, (int(*)())0, 0, 0, 0);

prof (1) can then be used to examine the results.

FILES/usr/lib/libc.a/usr/lib/libm.amon.out

SEE ALSOcc_bundled(1), prof(1), profil(2), end(3C).

STANDARDS CONFORMANCEmonitor() : SVID2, SVID3, XPG2

Section 3−−616 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mount(3N) mount(3N)

NAMEmount - keep track of remotely mounted file systems

SYNOPSIS#include <rpcsvc/mount.h>

DESCRIPTIONProgram number

MOUNTPROG

The following are the xdr routines provided:

xdr_exportbody(xdrs, ex)XDR *xdrs;struct exports *ex;

xdr_exports(xdrs, ex);XDR *xdrs;struct exports **ex;

xdr_fhandle(xdrs, fh);XDR *xdrs;fhandle_t *fp;

xdr_fhstatus(xdrs, fhs);XDR *xdrs;struct fhstatus *fhs;

xdr_groups(xdrs, gr);XDR *xdrs;struct groups *gr;

xdr_mountbody(xdrs, ml)XDR *xdrs;struct mountlist *ml;

xdr_mountlist(xdrs, ml);XDR *xdrs;struct mountlist **ml;

xdr_path(xdrs, path);XDR *xdrs;char **path;

ProcsMOUNTPROC_MNTArgument of xdr_path ; returns fhstatus . Requires UNIX authentication.

MOUNTPROC_DUMPNo arguments; returns struct mountlist

MOUNTPROC_UMNTArgument of xdr_path ; no results. Requires UNIX authentication.

MOUNTPROC_UMNTALLNo arguments; no results. Requires UNIX authentication. Unmounts all remotemounts of sender.

MOUNTPROC_EXPORTNo arguments; returns struct exports

MOUNTPROC_EXPORTALLNo arguments; returns struct exports

VersionsMOUNTVERS_ORIG

Structuresstruct mountlist { /* what is mounted */

char *ml_name;char *ml_path;struct mountlist *ml_nxt;};

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−617

A mA

mount(3N) mount(3N)

struct fhstatus {int fhs_status;fhandle_t fhs_fh;};

/** List of exported directories* An export entry with ex_groups* NULL indicates an entry which is exported to the world.*/

struct exports {dev_t ex_dev; /* dev of directory */char *ex_name; /* name of directory */struct groups *ex_groups; /* groups allowed to */

/* mount this entry */struct exports *ex_next;};

struct groups {char *g_name;struct groups *g_next;};

AUTHORmount (3N) was developed by Sun Microsystems, Inc.

SEE ALSOmount(1M), mountd(1M), showmount(1M).

Section 3−−618 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: August 2003

A mA

move(3X) move(3X)(CURSES)

NAMEmove, wmove — window cursor location functions

SYNOPSIS#include <curses.h>

int move(int y, int x);

int wmove(WINDOW * win, int y, int x);

DESCRIPTIONThe move() and wmove() functions move the cursor associated with the current or specified window to(y, x) relative to the window’s origin. This function does not move the terminal’s cursor until the nextrefresh operation.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOdoupdate(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−619

A mA

multibyte(3C) multibyte(3C)

NAMEmblen( ), mbtowc( ), mbstowcs( ), wctomb( ), wcstombs( ) - multibyte characters and strings conversions

SYNOPSIS#include <stdlib.h>

int mblen(const char *s, size_t n);

int mbtowc(wchar_t *pwc, const char *s, size_t n);

int wctomb(char *s, wchar_t wchar);

size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);

size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);

DESCRIPTIONA multibyte character is composed of one or more bytes that represent a "whole" character in a characterencoding. A wide character (type of wchar_t ) is composed of a fixed number of bytes whose code valuecan represent any character in a character encoding.

mblen() Determine the number of bytes in the multibyte character pointed to by s . Equivalent to:

mbtowc((wchar_t *)0, s, n);

If s is a null pointer, mblen returns a nonzero or zero value, depending on whether the mul-tibyte character encodings do or do not have state-dependent encodings, respectively. Sinceno character encodings currently supported by HP-UX are state-dependent, zero is alwaysreturned in this case. However, for maximum portability to other systems, application pro-grams should not depend on this.

If s is not a null pointer, mblen returns the number of bytes in the multibyte character if thenext n or fewer bytes form a valid multibyte character, or return -1 if they do not form avalid multibyte character. If s points to the null character, mblen returns 0.

mbtowc() Determine the number of bytes in the multibyte character pointed to by s , determine thecode for the value of type wchar_t corresponding to that multibyte character, then storethe code in the object pointed to by pwc . The value of the code corresponding to the nullcharacter is zero. At most n characters are examined, starting at the character pointed to bys .

If s is a null pointer, mbtowc() returns a non-zero or zero value, depending on whetherthe multibyte character encodings do or do not have state-dependent encodings, respectively.Since no character encodings currently supported by HP-UX are state-dependent, zero isalways returned in this case. However, for maximum portability to other systems, applica-tion programs should not depend on this.

If s is not a null pointer, mbtowc() returns the number of bytes in the converted multibytecharacter if the next n or fewer bytes form a valid multibyte character, or -1 if they do notform a valid multibyte character. If s points to the null character, mbtowc() returns 0.The value returned is never greater than n or the value of the MB_CUR_MAXmacro.

wctomb() Determine the number of bytes needed to represent the multibyte character corresponding tothe code whose value is wchar and store the multibyte character representation in the arrayobject pointed to by s . At most MB_CUR_MAXcharacters are stored.

If s is a null pointer, wctomb() returns a nonzero or zero value, depending on whether themultibyte character encodings do or do not have state-dependent encodings, respectively.Since no character encodings currently supported by HP-UX are state-dependent, zero isalways returned in this case. However, for maximum portability to other systems, applica-tion programs should not depend on this.

If s is not a null pointer, wctomb() returns the number of bytes in the multibyte charactercorresponding to the value of wchar , or -1 if the value of wchar does not correspond to avalid multibyte character. The value returned is never greater than the value of theMB_CUR_MAXmacro.

mbstowcs()Convert a sequence of multibyte characters from the array pointed to by s into a sequence ofcorresponding codes and store these codes into the array pointed to by pwcs , stopping aftereither n codes or a code with value zero (a converted null character) is stored. Each

Section 3−−620 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

multibyte(3C) multibyte(3C)

multibyte character is converted as if by a call to mbtowc() . No more than n elements aremodified in the array pointed to by pwcs .

If an invalid multibyte character is encountered, mbstowcs() returns (size_t) − 1. Other-wise, mbstowcs() returns the number of array elements modified, not including a ter-minating zero code, if any. The array is not null- or zero-terminated if the value returned isn. If pwcs is a null pointer, mbstowcs() returns the number of elements required for thewide-character-code array.

wcstombs()Convert a sequence of codes corresponding to multibyte characters from the array pointed toby pwcs into a sequence of multibyte characters and store them into the array pointed to bys , stopping if a multibyte character exceeds the limit of n total bytes or if a null character isstored. Each code is converted as if by a call to wctomb() . No more than n bytes aremodified in the array pointed to by s .

If a code is encountered that does not correspond to a valid multibyte character,wcstombs() returns (size_t) − 1. Otherwise, wcstombs() returns the number of bytesmodified, not including a terminating null character, if any. The array is not null- or zero-terminated if the value returned is n. If s is a null pointer, wcstombs() returns thenumber of bytes required for the character array.

EXTERNAL INFLUENCESLocale

The LC_CTYPEcategory determines the behavior of the multibyte character and string functions.

ERRORSmblen() , mbstowcs() , mbtowc() , wcstombs() and wctomb() may fail and errno is set if thefollowing condition is encountered:

[EILSEQ] An invalid multibyte sequence or wide character code was found.

WARNINGSWith the exception of ASCII characters, the code values of wide characters (type of wchar_t ) are specificto the effective locale specified by the LC_CTYPEenvironment variable. These values may not be compa-tible with values obtained by specifying other locales that are supported now, or which may be supportedin the future. It is recommended that wide character constants and wide string literals (see the C Refer-ence Manual ) not be used, and that wide character code values not be stored in files or devices becausefuture standards may dictate changes in the code value assignments of the wide characters. However,wide character constants and wide string literals corresponding to the characters of the ASCII code set canbe safely used since their values are guaranteed to be the same as their ASCII code set values.

AUTHORThe multibyte functions in this entry were developed by OSF and HP.

SEE ALSOsetlocale(3C), wctype(3C), thread_safety(5).

STANDARDS CONFORMANCEmblen() : AES, SVID3, XPG4, ANSI C

mbstowcs() : AES, SVID3, XPG4, ANSI C

mbtowc() : AES, SVID3, XPG4, ANSI C

wcstombs() : AES, SVID3, XPG4, ANSI C

wctomb() : AES, SVID3, XPG4, ANSI C

HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 3−−621

A mA

mvcur(3X) mvcur(3X)(ENHANCED CURSES)

NAMEmvcur — output cursor movement commands to the terminal

SYNOPSIS#include <curses.h>

int mvcur(int oldrow, int oldcol, int newrow, int newcol);

DESCRIPTIONThe mvcur() function outputs one or more commands to the terminal that move the terminal’s cursor to(newrow, newcol), an absolute position on the terminal screen. The (oldrow, oldcol) arguments specifythe former cursor position. Specifying the former position is necessary on terminals that do not providecoordinate-based movement commands. On terminals that provide these commands, Curses may select amore efficient way to move the cursor based on the former position. If (newrow, newcol) is not a validaddress for the terminal in use, mvcur() fails. If (oldrow, oldcol) is the same as (newrow, newcol), thenmvcur() succeeds without taking any action. If mvcur() outputs a cursor movement command, itupdates its information concerning the location of the cursor on the terminal.

RETURN VALUEUpon successful completion, mvcur() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEAfter use of mvcur() , the model Curses maintains of the state of the terminal might not match theactual state of the terminal. The application should touch and refresh the window before resuming con-ventional use of Curses.

SEE ALSOdoupdate(3X), is_linetouched(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

Section 3−−622 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mvderwin(3X) mvderwin(3X)(ENHANCED CURSES)

NAMEmvderwin — define window coordinate transformation

SYNOPSIS#include <curses.h>

int mvderwin(WINDOW * win, int par_y, int par_x);

DESCRIPTIONThe mvderwin() function specifies a mapping of characters. The function identifies a mapped area ofthe parent of the specified window, whose size is the same as the size of the specified window and whoseorigin is at (par_y, par_x) of the parent window.

• During any refresh of the specified window, the characters displayed in that window’s displayarea of the terminal are taken from the mapped area.

• Any references to characters in the specified window obtain or modify characters in the mappedarea.

That is, mvderwin() defines a coordinate transformation from each position in the mapped area to acorresponding position (same y, x offset from the origin) in the specified window.

RETURN VALUEUpon successful completion, mvderwin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

SEE ALSOderwin(3X), doupdate(3X), dupwin(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 4.

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−623

A mA

mvprintw(3X) mvprintw(3X)(CURSES)

NAMEmvprintw, mvwprintw, printw, wprintw — print formatted output in window

SYNOPSIS#include <curses.h>

int mvprintw(int y, int x, char * fmt, ...);

int mvwprintw(WINDOW * win, int y, int x, char * fmt, ...);

int printw(char * fmt, ...);

int wprintw(WINDOW * win, char * fmt, ...);

DESCRIPTIONThe mvprintw() , mvwprintw() , printw() and wprintw() functions are analogous to printf() .The effect of these functions is as though sprintf() were used to format the string, and thenwaddstr() were used to add that multi-byte string to the current or specified window at the current orspecified cursor position.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOaddnstr(3X), fprintf() (in the X/Open System Interfaces and Headers, Issue 4, Version 2 specification),<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity and its name is changed from printw() to mvprintw() .

Section 3−−624 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003

A mA

mvscanw(3X) mvscanw(3X)(CURSES)

NAMEmvscanw, mvwscanw, scanw, wscanw — convert formatted input from a window

SYNOPSIS#include <curses.h>

int mvscanw(int y, int x, char * fmt, ...);

int mvwscanw(WINDOW * win, int y, int x, char * fmt, ...);

int scanw(char * fmt, ...);

int wscanw(WINDOW * win, char * fmt, ...);

DESCRIPTIONThese functions are similar to scanf() . Their effect is as though mvwgetstr() were called to get amulti-byte character string from the current or specified window at the current or specified cursor posi-tion, and then sscanf() were used to interpret and convert that string.

RETURN VALUEUpon successful completion, these functions return OK. Otherwise, they return ERR.

ERRORSNo errors are defined.

SEE ALSOgetnstr(3X), printw(3X), fscanf() (in the X/Open System Interfaces and Headers, Issue 4, Version 2specification), wcstombs() (in the X/Open System Interfaces and Headers, Issue 4, Version 2 specification),<curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity and its name is changed from scanw() to mvscanw() .

HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−625

A mA

mvwin(3X) mvwin(3X)(CURSES)

NAMEmvwin — move window

SYNOPSIS#include <curses.h>

int mvwin(WINDOW * win, int y, int x);

DESCRIPTIONThe mvwin() function moves the specified window so that its origin is at position (y, x). If the movewould cause any portion of the window to extend past any edge of the screen, the function fails and thewindow is not moved.

RETURN VALUEUpon successful completion, mvwin() returns OK. Otherwise, it returns ERR.

ERRORSNo errors are defined.

APPLICATION USAGEThe application should not move subwindows by calling mvwin() .

SEE ALSOderwin(3X), doupdate(3X), is_linetouched(3X), <curses.h>.

CHANGE HISTORYFirst released in X/Open Curses, Issue 2.

X/Open Curses, Issue 4The entry is rewritten for clarity.

Section 3−−626 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: August 2003