Digital PDFs
Documents
Guest
Register
Log In
AA-P788B-TE
April 2000
228 pages
Original
14MB
view
download
Document:
VAX C Language Summary
Order Number:
AA-P788B-TE
Revision:
0
Pages:
228
Original Filename:
VAX%20C%20Language%20Summary.pdf
OCR Text
I s , \ Language Summary t r . > 1 ^ W mUi!; ! , SOTTi4/( V'/ -●J I I I I I I I 1 I I I 1 VAX CLanguage Summary Order Number: AA-P788B-TE April 1985 This document contains asyntax summary of the VAX Clanguage constructs, the VAX CRun-Time Library functions and macros, and the VAX/VMS commands used to compile and link aVAX Cprogram. Revision/Update Information: T h i s r e v i s e d d o c u m e n t s u p e r s e d e s t h e VA X - 11 C L a n g u a g e Summary (Order No. AA-P788A—TE). O p e r a t i n g S y s t e m a n d Ve r s i o n : VAX/VMS Version 4.0 or later. Software Version: VA X C Ve r s i o n 2 . 0 . digital equipment corporation maynard, massachusetts I Revised, April 1985 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under alicense and may be used or copied only in accordance with the terms of such license. No responsibility is assumed for the use or reliability of software on equipment that is not supplied by Digital Equipment Corporation or its affiliated companies. Copyright ©1983, 1985 by Digital Equipment Corporation All Rights Reserved. Printed in U.S.A. I I I I I I I I I 1 I I I I I I I I I I I I I I I I The postpaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DEC D E C U S P D F VA X c l u s t e r DEC/CMS DECwriter P D T V M S DEC/MMS DIBOL RSTS V T DECnet EduSystem RSX DECsystem-10 IAS UNIBUS DECSYSTEM-20 MASSBUS V A X ZK-2755 This document was prepared using an in-house documentation production system. All page composition and make-up was performed by TgX, the typesetting system developed by Donald E. Knuth at Stanford University. TfX is aregistered trademark of the American Mathematical Society. Contents P R E FA C E CHAPTER I 1THE I V DCL COMMAND LINE 1-1 C H A P T E R 2 VA X C L A N G U A G E C O N S T R U C T S 2-1 C H A P T E R 3 VA X C R U N - T I M E L I B R A R Y F U N C T I O N S A N D M A C R O S 3-1 I I I I I I I I I I 1 I Preface Conventions Used in This Document Convention Meaning char Language keywords, and VAX CRun-Time Library functions and macros are represented in bold type. file—spec, sfdio Arguments to functions or macros, and .H library module names are represented in italics. $RUN CPROG IRETURNI In interactive examples, the user's response to aprompt is printed in red; system prompts are printed in black. I 1 I I I I I I I I I I 1 ) I I I I I I I I I I I I globaldef VAX Cspecific constructs are represented in blue. float x; Avertical ellipsis indicates that not all of the text of aprogram or program output is illustrated. Only relevant material is shown in the example. X=5; option, ... Ahorizontal ellipsis indicates that additional parameters, options, or values can be entered. Acomma that precedes the ellipsis indicates that successive items must be separated by c o m m a s . I V Convention Meaning sc-specifier In syntax definitions, items appearing on separate lines are are mutually exclusive alternatives. auto static extern register [alb] I Braces surrounding two or more items separated by avertical bar (1) indicate achoice; you must choose one of the two syntactic elements. I I I I I I I I I I I 1 I I I I I I I I I I 1 I Associated Documents ●Programming in VAX C—For acomplete guide to program development on VAX/VMS using the VAX Cprogramming language ●Installing VAX C—For aguide to installing the VAX Csoftware ●VAX/VMS Master Index—For aguide to working with the VAX machine architecture or the VAX/VMS system services This index lists manuals which cover the individual topics concerning access to VAX/VMS. Chapter 1 The DCL Command Line This chapter describes the CC and LINK commands of the DIGITAL Command Language (DCL) and the qualifiers used with both commands. 1.1 The CC Command The DIGITAL Command Language (DCL) command, CC, compiles one or more VAX Csource files into one or more object files. The source file or files compiled into an object module is called the compilation unit. Syntax: CC[/qualifier ... I1IIIII1I1 ] ] fi l e - s p e c - l i s t I I r I I I I I I I I I I I I File Specification Syntax: file-spec[/qualifier ... ] file-spec-list, file-spec[/qualifier ... 3 file-spec-list +file-spec[/qualifier ... ] C o m m a n d Q u a l i fi e r s Defaults /[NO]CROSS_REFERENCE /[NO)DEBUG[=option] /[NO]DEFlNE[=(definition list)] /NOCROSS_REFERENCE /DEBUG=TRACEBACK /DIAGNOSTICS / G _ F L O AT /LIBRARY /[NOjLlST /NODEFINE /NODIAGNOSTICS / N O G - F L O AT /NOLIST {interactive mode) /LIST (batch mode) The DCL Command Line 1 - 1 C o m m a n d Q u a l i fi e r s Defaults /[NO]MACHINE_CODE[=option] /[NO]OBJECT /[NO]OPT}MtZE(=NODISJOINT] /SHOW(=(option, ...)] /NOMACHINE_CODE /OBJECT /OPTIMIZE /SHOW=(NOBR!EF, NODICTIONARY, N O E X PA N S I O N . NOINCLUDE, NOINTERMEDIATE, NOSTATISTICS, NOSYMBOLS, N O T R A N S L AT I O N . SOURCE. TERMINAL) /STANDARD=NOPORTABLE /NOUNDEFINE / WA R N I N G S /STANDARD=[NO]PORTABLE /(NO]UNDEFINE{=(undefine list)] /[NO]WARNINGS[=(option-list)] I I I I I I 1 I I I I I I I I I I I I I I I I I I I N O T E The only qualifier that must be used with afile specification is the /LIBRARY qualifier. You cannot place this qualifier on the CC command. 1.2 The LINK Command The DCL LINK command combines one or more object modules into one image file. If your program contains references to the VAX CRun-Time Library (RTL) functions, read “Specifying Libraries to the Linker" in this section before you link your programs. Syntax: LINK[/qualifier ... ] file-spec[/qualifier ... ]. ... The DCL Command Line 1 - 2 C o m m a n d Q u a l i fi e r s Defaults /BRIEF /[NO]CONTIGUOUS None /NOCONTIGUOUS /NOCROSS-REFERENCE /NODEBUG /EXECUTABLE /(NOICROSS-REFERENCE /[NO]DEBUG[=file_spec] /[NO]EXECUTABLE(=file_spec) /FULL /HEADER None /[NOjMAP[=file_spec] /NOMAP /POIMAGE /PROTECT None None None /[NO]SHAREABLE[=ftie_spec] /NOSHAREABLE /[NO]SYMBOL_TABLE(=file_spec] /NOSYMBOl—TABLE /(NOjSYSLIB /SYSLIB /(NOjSYSSHR /SYSSHR /[NO]SYSTEM[=base_address] /NOSYSTEM /TRACEBACK /[NO]TRACEBACK /[NO)USERLIBRARY(=tabie[, ...]] None I I I I I I I I I I I I I I I I I I I /INCLUDE=(module_name[, ...]) None /LIBRARY /OPTIONS None /SELECTIVE-SEARCH None I I I I I I None NOTE The only qualifiers that must be used with afile specification are the /INCLUDE, /LIBRARY, /OPTIONS, and /SELECTIVE-SEARCH qualifiers. You cannot place these qualifiers on the LINK command. The DCL Command Line 1—3 I Specifying Libraries to the Linker: If you use any of the VAX CRun-Time Library functions, you must specify libraries for the linker to search in order to resolve references to the functions. You can specify these libraries using the /LIBRARY qualifier on the LINK command line, or you can define the logical name LNK$LIBRARY_n to be the name of an object library. You must define the logicals LNK$LIBRARY_n as the libraries SYS$LIBRARY:VAXCCURSE,OLB, SYS$LIBRARY:VAXCRTLG.OLB, and SYS$LlBRARY;VAXCRTL.OLB. Depending on the needs of your program, you may have to access one, two, or all three libraries. In any case, you must adhere to the following rules for defining libraries for the linker to search: 1. If you do not need to use the Curses Screen Management package of VAX CRTL functions and macros, and you do not use the /G—FLOAT qualifier on the CC command line, you must define the logical as follows: $DEFINE LNKSLIBRARY SYS$LIBRARY:VAXCRTL.OLB IRETURN I 2. If you plan to use the /G—FLOAT qualifier with the CC command line, but do not plan on using Curses, you must define the logicals as follows: 1I1 1 IIIIII1II I I I I I I I I I I I i I $DEFINE LNK$LIBRARY SYS$LIBRARY:VAXCRTLG.OLB IRETURN I $DEFINE LNK$LIBRARY_1 SYS$LIBRARY;VAXCRTL.OLB IRETURNI 3. If you plan to use the Curses Screen Management package, but do not plan to use the /G—FLOAT qualifier, you must define the logicals as follows: $DEFINE LNKSLIBRARY SYS$LIBRARY:VAXCCURSE.OLB IRETURNI $DEFINE LNK$LIBRARY_1 SYS$LIBRARY:VAXCRTL.OLB IRETURNI 4. Finally, if you plan to use both Curses and the /G—FLOAT qualifier, you must define the three logicals in the following order: $DEFINE LNKSLIBRARY SYS$LIBRARY:VAXCCURSE.OLB IRETURNI $DEFINE LNK$LIBRARY_1 SYSSLIBRARY:VAXCRTLG.OLB IRETURNI $DEFINE LNK$LIBRARY_2 SYSSLIBRARY :VAXCRTL. OLB IRETU^ The DCL Command Line 1-4 The order of the specified libraries determines which versions of the VAX CRTL functions are found by the linker first. If the linker does not find the function code, or if LNK$LIBRARY_n is undefined, it assumes that the function is not aVAX CRTL function, and checks other default libraries before it assumes that the program is in error. Instead of using the object code of the VAX CRTL functions, you can, as an option, use the VAX CRTL as ashareable image. To use the VAX CRTL as ashareable image, check with your system manager to make sure that the VAX Ccompiler and software were installed so as to allow access to the shared images. Specifically, check to make sure that the system manager answered YES to step 4listed in Installing VAX C. If that has been done, you can create an options file. If you do not use the /G—FLOAT qualifier on the CC command, create an options file, OPTIONS— FILE.OPT, containing the following line: SYSSSHARE:VAXCRTL.EXE/SHARE I I I I I I I I I I I I I I I I I I I I I I I I I I If you do use the /G—FLOAT qualifier on the CC command, create an options file containing the following line: SYSSSHARE;VAXCRTLG.EXE/SHARE Yo u m u s t n o t i n c l u d e t h e l i b r a r i e s S Y S $ S H A R E : VA X C R T L . E X E a n d 5 Y S $ 5 H A R E : VA X C R T L G . E X E i n t h e same options file. Once you have created the appropriate options file, OPTIONS—FILE.OPT, you can compile and link your program with the following commands: $CC PROGRAM.C IRETUI^ $LINK PROGRAM.OBJ. 0PTI0NS_FILE/0PT IRETURN I The DCL Command Line 1 - 5 Chapter 2 VAX CLanguage Constructs This chapter describes the language keywords and other constructs needed for programming in VAX C. 2.1 Data Type Keywords Ty p e S p e c i fi e r s : 32-bit signed or unsigned: i n t long long Int II1 ] IIIIIIII I IIII1 1 I1IIII1 unsigned lot unsigned long unsigned long int 16-bit signed or unsigned: short short int unsigned short unsigned short int 8-bit signed or unsigned: char unsigned char VA X C L a n g u a g e C o n s t r u c t s 2 — 1 F_floating formal: fl o a t D_floating or G_floating format: double long fl o a t Aggregate types: s t r u c t union Enumerated type: e n u f fi Type of function return value: void I I I I I 1 I I I I I I I I I I I I I I I I I I I I Type declaration: typedef Storage class specifiers: a u t o register s t a t i c e x t e r n globaldef globalref global?alue VA X C L a n g u a g e C o n s t r u c t s 2 — 2 Storage class modifiers: readonly noshare 2.2 Precedence of Operators The operators are listed from highest precedence to lowest. In the binary operator category, operators appearing on higher lines within the category have ahigher precedence than the other binary operators. Category Association Operator Primary Left to right () Unary Right to left I Binary Left to right ● [1 ->● (fm) / ● & s i z e o f % + « i I I I 1 » I I I I I I I I I I I I 1 I < I <5= I > - I i I I I > & & & Conditional Right to left Assignment Right to left C o m m a Left to right ?; ●= /= %= >>= < <= & = VA X C L a n g u a g e C o n s t r u c t s 2 — 3 2.3 Statements Syntax; [expression] ; identifier : statement {[declaration-list] [statement-list] case [ccmstant-ea^rression Idefault] } statement-list if (expression) statement [else statement] while (ea:pression) statement do statement while (expression) for ([expression] ;[expression] ;[ea^^ression]) s t a t e m e n t switch (eapressicm) statement I I [ I I ( I [ I I I I I I I break I I I I I I I I I I I : continue ; return [expression^ ; goto i d e n t i fi e r : entry' Kcserveti for future VA X C L a n g u a g e C o n s t r u c t s 2 - 4 2.4 Conversion Rules Arithmetic I Conversion Any operand of type: Is converted to: char int short int unsigned char unsigned short unsigned int fl o a t double If operand type is: The result and the other operands are: double double unsigned unsigned ( I unsigned int I I I I I I I I I I I I I I I I I I Otherwise, both operands are: And the result is: int int I I I I I Function Argument Conversion Any argument of type: Is converted to type: fl o a t double char int short int unsigned char unsigned short unsigned int array pointer to array function pointer to function unsigned int VAX CLanguage Constructs 2-5 2.5 VAX CEscape Sequences Character Mnemonic Escape Sequence newline N L \n horizontal tab H T \t vertical tab V T \v backspace BS \ b carriage return C R \r form feed FF \ f backslash \ W \' apostrophe \‘ quotes bit pattern I( 1 d d d \ddd IIIIIIIIII I I I I I I I I I I I I I In the previous list, the characters, ddd, signify from one to three octal digits that give the value of an ASCII character. For example, \0 signifies the ASCII NUL character. VA X C L a n g u a g e C o n s t r u c t s 2 - 6 2.6 Preprocessor Control Lines Syntax: # d e fi n e i d e n t i fi e r i i i p a r a m l , . . . p a r o m S ] ) ] t o k e n - s t r i n g # u n d e f i d e n t i fi e r #dictionary cdd-path # i n c l u d e < fi l e - s p e c > # i n c l u d e " fi l e - s p e c " #include module-name #if constant-expression # i f d e f i d e n t i fi e r # l i n d o f i d e n t i fi e r I I I I I I I I [ I I I I I I I I I #[llne] constant string #[llne] constant i d e n t i fi e r I I I I I I i I #else #eiidlf ^module identxfxer xdentxfxer # m o d u l « i d e n t x fi e r s t r x n g VA X C L a n g u a g e C o n s t r u c t s 2 - 7 2.7 Record Management Services (RMS) The RMS functions can be expressed in terms of the following general descriptions. Syntax: t fi a c l u d e i n t rms-module $naiue(po^ntc> , [success^fiA’i struct rms.structure ‘poiiicej , i n t (‘error.function)(). (*success_function)(); rms-module The name of one of the modules in the following list: I I I I I I I I I r I I I I I M o d u l e rab I I I I I I I I Description Structure Tag File access block FAB I I Record access block Name block N A M Allocation XAB XABAl.L Xilbdat Date and time X/ -; XABDAT \ubfiii. File header characteristics '● \13 .ABFHC xab:.:" Indexed file key ●B XABKhV \B XABrRO Revision date and time XAB XABRDT Protection xabriil I VA X C L a n g u a g e C o n s t r u c t s 2 - 8 Description Structure Tag Summary XAB XABSUM X i i l ’ l r r. Te r m i n a l C o n t r o l X A B XABTRM rniiiii" Completion status codes r?/tb All RMS modules M o d u l e All tags sys$name The name of the RMS function being called. pointer Apointer to an RMS structure which (optionally) has been initialized by the following prototypes: Prototype Description v.‘$rm!- fab Initializes the file access block (FAB) ● ( Initializes the record access block (RAB) '‘w...rab I ( I I I I I I I I [ I I ( I I I I I I [ I 1 c\$rn\s_nam Initializes the name block (NAM) cc$rms_xahall Initializes the allocation XAB (XABALL) cc$rms__xabdat Initializes the date and time XAB (XABDAT) I'cSrms—xabfhc Initializes the file header characteristics XAB (XABI HC) cc$rms_xabkey Initializes the indexed file key XAB (XABKEY) cc$rms_xabpro Initializes the protection XAB (XABl’RO) u'$rms_\abrdt Initializes the revision date and time XAB (XABRDT) cc$rms_xabsum Initializes the summary XAB (XABSUM) cc$rms_xabtrm Initializes the terminal control XAB (XABTRM) I 1 VAX CLanguage Constructs 2-9 error—function The name of asignal handling function to be called if an error occurs (optional). success—function The name of afunction to be called if the M*- function is successful (optional). rms—structure The type of structure being pointed to by pointer. The I I functions return an integer status value. I I I I I I I I I I I I I I I I I I I I I 1 I I VAX CLanguage Constructs 2-10 Chapter 3 VAX CRun-Time Library Functions and Macros This chapter describes the syntax of the VAX CRun-Time Library functions and macros, 3.1 Function and Macro Syntax Listing abort Function abort() Return Va l u e s : None. I I I I I I I I I I I I I I I abs I I I I I I I I I I I Function #include math int abs(integer) double fabs(x) int integer: double x; Return Va l u e s : Absolute value of x. VAX CRun-Time Library Functions and Macros 3-1 access Function #include int access if iLe_specifzcation, mode) c h a r * fi l e . s p e c i fi c a t i o n ; int mode; R e t u r n Va l u e s : 0, if the access (privilege) is allowed; -1, if not. Notes: mode Argument I I 0 Checks to see if the file exists 1 Execute access I I I I I I I I I I I I I acos I I I 1 I 2 Write access (implies delete access) 4 Read access I I I I I I Function #include maLi double acos(x) double x; Return Va l u e s : Arc cosine of xin the range 0to pi . VAX CRun-Time Library Functions and Macros 3 - 2 addch Macro and waddch Function #include curses addch (ch.) waddchCwin, ch) WINDOW *win; char Return ch; Va l u e s : OK on success; ERR, if illegal scrolling occurs. addstr Macro and waddstr Function #include cursei; addstr(str) waddstrCwin, str) I I III1II1 1 III I I I I I I I I I I I I I WINDOW *win; char *8tr; R e t u r n Va l u e s : OK on success; ERR, if illegal scrolling occurs. alarm Function int alarm(seconds) unsigned seconds: R e t u r n Va l u e s ; The number of seconds remaining from aprevious alarm request. VAX CRun-Time Library Functions and Macros 3 - 3 asin Function #include v. a t h double asinCi) double x; Return Va l u e s : Arc sine of xin the range -pi/2 to pi/2 .When lxl> I,this function returns 0and sets the variable, ermo, to EDOM. atan Function #include ath double atan(x) double I I x; I I I I I I I I I I I I I Return I I I I I I I I I I I Va l u e s : Arc tangent of xin the range -p»/2 to pi/2 . atan2 Function #include math double atein2(x, y) double X. y; Return Va l u e s : Arc tangent of x/y in the range -pi to pi . VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 4 atof, atoi, and atol Functions #include math double atof(nptr) int atoi(nptr) long atol(»^tr) char *nptr; Return Va l u e s : Numeric value of the string as adouble (atof), as an int (atoi), and as along int (atol). Notes: In VAX C, atol is functionally equivalent to atoi. t I I I I I I I I I I I I I I atoi I I I I I I I I I I Function See atof. atol Function See atof. box Function #lnclude curses boxCwin, vert, hor) WINDOW *win; char vert, Return hor; Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3 - 5 brk and sbrk Functions char *brk(addr) char *sbrk(incr) u n s i g n e d i n c r, a d d r ; Return Va l u e s : Lowest virtual address not used by the program (brk) and the old break address if the new break address is successfully set (sbrk). If the program requests too much memory, both return -1. cabs and hypot Functions #include math double cabsfz) double hypot(x, y) I I I I I I I I I I I I I I I I I I I I I I I I I I double X, y; s t r u c t { double X, y: > z ; Return Va l u e s : Square root of the sum of their two squared arguments fsqrtf.r^r +yy)) . VAX CRun-Time Library Functions and Macros 3-6 cailoc and malloc Functions c h a r * c a l l o c ( T « i m b e r. s i z e ) char *malloc(si2e) unsigned number, size; R e t u r n Va l u e s : Pointer to the first byte of the allocated space; 0, if the memory cannot be allocated. ceil Function #include double ceiK®) I double x; I I I I I I I 1 I I I I I I I Return Va l u e s : I I I I I I I I I I Smallest integer that is greater than or equal to x. cfree and free Functions int cfree(pointer) int free(pointcr) char *pointer; Return Va l u e s : 0if the area previously allocated by calloc, malloc, or realloc is successfully freed; -1 if not. Notes: If porting programs across systems, use free with malloc and use cfree with calloc. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 7 chdir Function int chdir(name) char *name; Return Va l u e s : 0, if the directory is successfully changed; -1 if not. chmod Function int chmodCname, mode) c h a r ♦name; unsigned mode; Return Va l u e s : 0, if the change is successful; -1, if not. I I I I I I ( I I I I I [ I I I I I I I I I I I I I Notes: tnode Argument Privilege 0400 OWNER:READ 0200 OWNER: WRITE 0100 OWNER:EXECUTE 0040 GROUP:READ 0020 GROUPiWRITE 0010 GROUPiEXECUTE 0004 WORLD:READ 0002 WORLD:WRITE 0001 WORLD:EXECUTE VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 chown Function int chown(noflje, ovmer. group) char ♦name; unsigned owner, group; Return Va l u e s : 0if the owner UIC of the file is changed; -1 if not. clear Macro and wclear Function ^include clear() wclear(win) WINDOW *win; 1 1 1 ( 1 1 1 1 1 1 1 1 1 I I I Return Va l u e s : I I I I I I I I I I OK on success; ERR on failure. clearerr Macro #include stdio clearerr(/ile.ptr) F I L E * fi l e _ p t r ; Return Va l u e s : None. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 9 clearok Macro #include curses clearok(win. boolf) WINDOW bool boolf; Return Va l u e s : OK on success; ERR on failure. close Function int closeC/ile.desc) int I I fi l e . d e s c ; I I I I ( I I I I I I I I I Return Va l u e s : I I I I I I I I I ( 0, if the file is successfully closed; -1, if the file descriptor is undefined or if an error occurs while the file is being closed. clrattr Macro and wcirattr Function #include curses clrattr(attr) wclrattr(u)in. ottr) WINDOW *win, int Return attr; Va l u e s : OK on success; ERR on failure. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 1 0 Notes: atfr Argument _B1.INK Clear blinking attributi- - B O L D Clear bold fare attribute -RI-VLRSL' Clear reverse vidci’ attribute - U N D E R L I N E Clear underline attribute This function and macro are V'AX Cspecific. cirtobot Macro and wcirtobot Function #include curses clrtobot() wclrtobot(mn) WINDOW 1 1 ♦win; II1III1IIII I I I I I I I i I I I I I R e t u r n Va l u e s : OK on success; ERR on failure. clrtoeol Macro and wcirtoeol Function #include curses clrtoeoK) wcirtoeol(win) WINDOW twin; Return Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3 - 11 cos Function #include math double cos (a:) double x; Return Va l u e s : Cosine of x. cosh Function t fi n c l u d e math double cosh(x) double I I x; I I I I I I I I I I I I I I I I I I I int creat(/ile_spec, mode [,/-iLe_atts. . ] ) I I I I I R e t u r n Va l u e s : Hyperbolic cosine of x. Great Function char * fi l e _ s p e c , * fi l e _ a t t s ; unsigned mode; Return Va l u e s : Integer file descriptor, if the file is successfully created; -1, if an error occurs. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 1 2 Notes: See chmod for adescription of the mode Argument. file—alts Argument "ak] n" Decimal allocation quanlitv "bk---n" Decimal block size "clx^ bin" \o translation of "deq= n" Decimal default extension quantity "dna=file-spec" Default filename string ■'fop=val,vak -● I I I n' to terminal bile processing options, where val is one of the following; I I ctg Contiguous cht ContigiH)us-be'-t-trv tef T r u n c a t e a t e n d - o f - fi l c I I I I I I I I I I I I I I I I I I 1 cif Create if nonexistent sup Supersede scf Submit as command (i!e on dose spl t m d Spool to svslem printer on close Temporars' delete imp Temporary (no file directory) nef N o t c n d - o f - fi ! e ''fsz--^n'' Decimal fixed header size "mbc--iT' Decimal multihlock count "mbf--n" Decimal multibuffer count I I VAX CRun-Time Library Functions and Macros 3-13 ‘'mrs=n" Decimal maximum record size "rat=vaUvaI, ...' Record attributes where val is one of the following; Carriage-return control c r "rfm=val I I bik Records to span block boundaries ftn FORTRAN print control prn P r i n t fi l e f o r m a t Record format, where val is one of the following: fi x Fixed-length record format I I [ s t m RMS stream record format stmlf Stream format, line-feed terminator s t m c r Stream, carriage-return terminator v a r Variable-length record format vfc Variable-length with fixed control I I I I I [ I I I I I I I I udf "rop-=var I I I I I I I U n d e fi n e d Record processing, where val is one of the following; asy Asynchronous I/O i m o Timeout I/O VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 1 4 Fill* sharing, where ra/ is one of the following: shr val" del A l l i n v. u s e r s t o J e l e t e g e t Allu'.. .users (o i\-ad t i i - Alloivs mainstream acc:. ;.s n i Prohihils file sharing put A!lu..'< users to wri'.;- upd Aiio u p i Allows one or more writers susers to update Deeimal I/O timeout value [nojcrmode Macros ttinclude rursc: crmodeC) nocrmodeC) I I 1 I [ I I I I I I I I I I Return I I I I I I I I I I I Va l u e s : None. Notes: VAX Cprovides these macros only for portability; they have no functionality. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 1 5 ctermid Function #include stdio char *ctermid([string]) char *string; Return Va l u e s : Name of the controlling terminal is returned to siring. If no argument is given, the function returns the address of an internal storage area containing the string. ctime Function #include time char *ctime(bintim) int ( I *bintim I I I I I I 1 I I I I I I I Return I I I I I I I I I I Va l u e s : Pointer to the time in the format: wkd mmm dd hh:mm:ss 19yi/\n\0. cusertd Function ^include stdio char *cuserid(string) char *string; R e t u r n Va l u e s : The name of the user who initiated the current process is returned to string. If no argument is given, the function returns the address of the name. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 1 6 delch Macro and #include wdelch Function ur delch() wdelch(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. delete Function # i n c l u d e int delete(/tle.spec) c h a r + fi l e _ s p e c ; I I I I I I I I I I I I I I I I I Return Va l u e s : I I I I I I I I I 0, if the file is deleted; -1, if not. deletein Macro and wdeletein Function #include curses deletelnC) w d e l e t e l n ( t i fi n ) WINDOW *win; R e t u r n Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3 - 1 7 deiwin Function #include ‘urses deiwin(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. dup and dup2 Functions int dup(/i le_desc_l) int dup2(.file_desc_ 1, file_desc_S) I int fi l e _ d e s c _ l , I I fi l e _ d e s c _ 2 ; I I [ I I I I I I I I I I I I I I I I I R e t u r n Va l u e s : Anew file descriptor (dup) and anew descriptor pointing to the same file as file—desc—1 (dup2); -1, if file—desc—1 does not point to an open file or if the new file descriptor cannot be allocated. dup2 Function See dup. [nojecho Macros #lnclude curses echo() noecho() Return Va l u e s : None. VAX CRun-Time Library Functions and Macros 3—18 ecvt, fcvt, and gcvt Functions char *ecvt(value, nd-igit, decpt. sign) char *fcvt(value, ndigit, decpt. sign) char *gcvt(value, ndigit. buffer) double value; i n t ndigit, *decpt, *sign; char ♦buffer; Return Va l u e s : ecvt and fcvt The position of the decimal point relative to the first character in the string is returned by the decpt argument. Anonzero integer is returned to the sign argument if the input value is negative; otherwise, 0is returned, gcvt The converted string is placed in the buf argument and the address of buf is returned. I I I I I I I I I I I I I I I endwin I I I I I I I I i I I Function ttinclude curses endwin() Return Va l u e s : OK on success; ERR on failure, VAX CRun-Time Library Functions and Macros 3 - 1 9 erase Macro and #include werase Function o s erase() werase(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. e x e c i , e x e c l e , e x e c v, a n d e x e c v e F u n c t i o n s int execKnome, argO, ... char ♦name. ♦argO, ... , . argn, *argn; 0) int execv(nome, argv) char *name. *argv[]; I I I I I I I I I I I I I I I I I I I I I int execle(name, argO argn, 0, entip) char *name. *argO. ... . *argn, *envp[]; I I I I I int execve(ncune. argv, envp) char *nanie, *argv[], *envp[]; R e t u r n Va l u e s : -1 on failure. Notes: See getenv for alist of the strings in the envp environment array. VAX CRun-Time Library Functions and Macros 3-20 execle Function See execl. execv Function See execl. execve Function See execl. exit, and —exit Functions exit([status]) _exit([status]) int status; Return Va l u e s : The process status is returned to the parent process, if any, or to the command language interpreter. I I I I I I I I I I I I I 1 1 1 ( 1 1 1 1 1 1 1 1 1 exp Function #include math double exp (a:) double Return x: Va l u e s : Base eraised to the power of the argument. If an overflow occurs, the function returns the largest possible floating-point value and sets the variable, ermo, to ERANGE. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 2 1 fabs Function See abs. fclose Function #include stdio int fclose(/ile_ptr) F I L E * fi l e _ p t r ; Return Va l u e s : 0, if the file is successfully closed; -1, if not. fcvt Function See ecvl. I I I I I I I I I I I I I I I I I I I I I I I I I I fdopen Function #include stdio #include fi l t FILE *fdopen(/ile_desc, a^mode) int fi l e . d e s c ; char *a_mode; VAX CRun-Time Library Functions and Macros 3 - 2 2 feof Macro ^include I stdio i int feof(/ile.ptr) FILE * fi l e _ p t r : Return Va l u e s : Nonzero integer on end-of-file; 0, otherwise. terror Macro #include I stdio int f error(/i le.ptr) FILE * fi l e _ p t r ; Return Va l u e s : I I I I I ( I I I I I I I i I I I I I I I I I I I Anonzero integer if an error occurs. Subsequent calls to ferror continue to return this value until the file is closed or until clearerr is called. f fl u s h Function #include stdio i n t f fl u s h ( / i l e . p t r ) FILE * fi l e . p t r ; R e t u r n Va l u e s : 0, if the file is successfully flushed; EOF, if not. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 2 3 fgetc and getw Functions, and getc Macro #include ●●d: int fgetc(/-ile.ptr) int getw(/ile_ptr) int getc(/ile_ptr) F I L E * fi l e _ p t r ; Return Va l u e s ; The next character in the file (fgetc and getc) and the next four characters from the file (getw); EOF on error. Notes: Since EOF is defined in the stdio module to be an integer, use feof and terror to check the success of getw. III[IIIII1I1 [ [ I I I I I L L I I I I I fgetname Function #include stdlo c h a r * f g e t n a j n e ( / i l e _ p t r, b u ff e r [ . s t y l e ] ) FILE * fi l e _ p t r , char *buffer; int style: Return Va l u e s : Address of the buffer containing the file specification on success; 0on error. VAX CRun-Time Library Functions and Macros 3 - 2 4 Notes: The third argument, style, can be either one of the integers 1or 0. If you specify 0, the function fgetname returns the file specification in VAX/VMS format. If you specify 1, the function fgetname returns the file specification in DEC/Shell format. If you do not specify this argument, this function returns the file name according to your current command language interpretor. fgets Function #include stdio c h a r * f g e t s ( s t r , m a x c h a r , fi l e . p t r ) char *8tr; int maxchar; FILE * fi l e _ p t r ; Return Va l u e s : NULL on end-of-file; otherwise, the address of the first character in string. I I I I I I I I I I I I I I I I I I I I I I I I I I fi l e n o M a c r o #include i n t stdio fi l e n o ( / i l e _ p t r ) F I L E * fi l e _ p t r ; Return Va l u e s : Integer file descriptor that identifies the file. VAX CRun-Time Library Functions and Macros 3-25 fl o o r F u n c t i o n #include math d o u b l e fl o o r ( i ) double x; Return Va l u e s : Largest integer that is less than or equal to x. fopen Function #include F I L E *fopen(/ile_spec, a_mode i, fi,le_atts, ... ] ) c h a r * fi l e _ s p e c , * a _ m o d e ; 1IIII1IIII1 1 I I I Return I I I I I I I I I I I Va l u e s : Afile pointer for the named file, if the file was successfully opened; NULL on error. Notes: fl _ m o d c Va l u e r Read access w Write access a" Append access Read update access r + w + “a+" Write update access Append update access VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 2 6 Notes: For adescription of file—alts, see creat. fprintf and sprintf Functions #include stdio int fprintf(/ilc.ptr, format_spec [.output^src, ... int sprintfCstr, format_speci,output_src, ... ] FILE ] ) ) * fi l e _ p t r ; c h a r * 8 t r, * f o r m a t _ s p e c ; Return Va l u e s : The number of characters written to the file (fprintf) or to the string (sprintf); -1 on error. I I I I I I I I I I I I I I I I I I I I I I I I I I Notes: format—spec Meaning d Expect adecimal integer in the input. The corresponding argument must point to an int. Expect an octal integer in the input (with or without aleading zero). The corresponding argument must point to an int. Expect ahexadecimal integer in the input (without aleading Ox). The corre¬ sponding argument must point to an int. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 2 7 format-spec Meaning Expect acharacter in the input. The corresponding argument must point to achar. The usual skipping of white-space characters can be disabled in this case, so that nwhite-space characters can be read with %nc. If afield width is given with c, the given number of characters is read and the corresponding argument should point to an array of char, Expect astring in the input. The corresponding argument must point to an array of characters that is large enough to contain the string plus the terminating NUL character (\0). The input field is terminated by aspace, tab, or newline. e, f I I Expect afloating-point number in the input. The corresponding argument must point to afloat. The input format for floating-point numbers is [+l-]nnn(.ddd]][{Ele}[+l-]nn], where the n's and the d's are decimal digits (as many as indicated by the field width minus the signs and the letter E). I I I [ I I I I I I I I I I Id, lo, lx I I I I I I I I I I Same as d, o, and x, except that along integer of the specified radix is expected. (Retained for portability only, since long and int are the same in VAX C.) le. If Same as e, and f, except that the corresponding argument is adouble instead of afloat. The same effect can be achieved by using an uppercase Eor F. hd, ho, hx Same as d, o, and x, except that ashort integer of the specified radix is expected. Expect astring that is not delimited by white-space characters. The brackets enclose aset of characters (not astring). Ordinarily, this set (or "character class") is made up of the characters that comprise the string field. Any character not in the set will terminate the field. However, if the first (leftmost) character is an up-arrow, then the set shows the characters that terminate the field. The corresponding argument must point to an array of characters. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 2 8 fputc and putw Functions, and putc Macro #include stdio i n t f p u t c ( c h a r a c t e r , fi l e _ p t r ) i n t p \ i t v ( . i n t e g e r , fi l e _ p t r ) i n t p u t c C c h a r a c t e r , fi l e j p t r ) ch character; int integer; FILE * fi l e _ p t r ; Return Va l u e s : The argument, character in the file (fputc and pule) the four characters in integer (gelw); EOF on e r r o r . I I I I I I I I I I I I I I I I I I I I I I I I I I Notes: Since EOF is defined in the stdio module to be an integer, use feof and ferror to check the success of putw. fputs Function #include i n t 'dio f p u t s ( s t r , fi l e ^ p t r ) char *str; FILE * fi l e _ p t r ; Return Va l u e s : Last character written; EOF on error. VAX CRun-Time Library Functions and Macros 3—29 fread Function #include stdio int freadCpointer, 3ize_of_item, mmber_items, file_ptr) i n t n u m b e r. i t e m s . s i z e _ o f _ i t e m ; FILE * fi l e _ p t r ; Return Va l u e s : T h e n u m b e r o f i t e m s r e a d ; 0 o n e n d - o f - fi l e o r e r r o r. free Function See efree. freopen Function #include stdi' F I L E * f r e o p e n s p e c , a _ m o d e , fi l e _ p t r [ , fi l e _ a t t s , . . . ] ) I I I I I I I I I I I I I I I I I I I I I I I I I i c h a r * fi l e _ s p e c , * a _ m o d e ; F I L E * fi l e _ p t r ; Return Va l u e s : File pointer that points to the newly opened file; NULL on error. Notes: See also, (open. VAX CRun-Time Library Functions and Macros 3—30 frexp Function #include m? double frexp(value, eptr) double value; i n t *eptr; Return Va l u e s : The mantissa of value with amagnitude less than 1. The exponent is returned to *eptr. fscanf and sscanf Functions # i n c l u d e fscanf(/ile.ptr, format_spec [,input_ptr. ... sscanf(str, format_spec [,input_ptr ... ] I I I I I ] ) ) I I I I I I I I I I I I I F I L E * fi l e _ p t r ; c h a r * s t r, * f o r m a t _ s p e c ; Return I t I I I I I I Va l u e s : The number of successfully matched and assigned input items; EOF on error or end-of*file. Notes: format—spec Meaning d Convert to decimal format. o Convert to octal format. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 1 Meaning format-spec Convert to unsigned hexadecimal format (without leading Ox). An uppercase Xcauses the hexadecimal digits A-F to be printed in uppercase. Alowercase x causes those digits to be printed in lowercase. X Convert to unsigned decimal format (giving anumber in the range zero to u 4,294,967,295). Output single character (NUL characters are ignored.) Write characters until NUL is encountered or until number of characters indi¬ s cated by the precision specification is exhausted. If the precision specification is zero or omitted, all characters up to aNUL are output. Convert float or double to the format [-]m.nnnnnnE[+l-]xx, where the number e of n's is specified by the precision (default =6) If the precision is explicitly zero, the decimal point appears but no n's appear. An Eis printed if the conversion character is an uppercase E. An eis printed if the conversion character is alowercase e. I I I I I I I I I I I I I I I f 8 % I I I I I I I I I I 1 Convert float or double to the format [-]m..m.nnnnnn, ^vhere the number of n's is specified by the precision (default -6). Note that the precision does not determine the number of significant digits printed. If the precision is explicitly zero, no decimal point appears and no n's appear. Convert float or double to d, e, or fformat, whichever is shorter (suppress insignificant zeros). Write out the percent symbol. No conversion is performed. VAX CRun-Time Library Functions and Macros 3—32 The following characters can be used between the percent sign (%) and the conversion character. They are optional, but if specified, they must occur in the order listed. Character Meaning Left-justify the converted output source in its field. width Use this integer constant as the minimum field width. If the converted output source is wider than this minimum, write it out anyway. If the converted output source is narrower than the minimum width, pad it to make up the field width. Padding is with spaces normally, and with zeros if the field width is specified with aleading zero; this does not mean that the width is an octal number. Padding is on the left normally and on the right if aminus sign is used. Separates field width from precision. Use this integer constant to designate the maximum number of characters to print with sformat, or the number of fractional digits with eor fformat. precision I I I I I I I I I I I I I I I 1 I 1 I I i I I I I I I Indicates that afollowing d, o, x, or uspecification corresponds to along output source. In VAX C, all int values are long by default. Can be used to replace the field width specification and/or the precision specification. The corresponding width or precision is given in the output s o u r c e . VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 3 fseek Function #include stdio i n t f s e e k ( / i l c _ p t r, o ff s e t , d i r e c t i o n ) F I L E i n t * fi l e _ p t r ; offset. direction; Return Va l u e s : 0for successful seeks; EOF on error. Notes: I direction Va l u e 0 From the beginning of the file 1 From the current position 2 F r o m t h e e n d - o f - fi l e I I I I I I I I I I I I i I [ I I I I I I I I I I fstat and stat Functions #include v;ta- f a t a . t i fi l e _ d e s c , b u f f e r ) s t a t i fi l e _ s p e c , b u f f e r ) fi l e . d e s c ; i n t char struct Return ile.spec; stat *buffer; Va l u e s : 0 o n s u c c e s s ; - 1 o n e r r o r. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 4 ftell Function #include stdio int ftell(/i le_ptr) F I L E * fi l e _ p t r ; Return Va l u e s : Byte offset from the beginning of the file to the current location within the file; -1 on error. ftime Function #include timeb ftime itime_pointer) struct timeb *time_pointer; I I I i I I I I I I I I I I I I Return Va l u e s : I I I I I I I I I I The number of seconds that have elapsed on the system since 00:00:00 January 1, 1970 is returned to the structure, timeb. fwrite Function ttinclude .itdj int fwrite(ptr, size^of_item, minber^items, file_ptr) i n t number.items. FILE * fi l e _ p t r : Return size.of.item; Va l u e s : T h e n u m b e r o f i t e m s w r i t t e n ; 0 o n e r r o r. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 5 gcvt Function See cvt. getc Macro See fgetc. getch Macro and wgetch Function #include curses getch() wgetch(win) WINDOW *win; Return Va l u e s : The character from the window; ERR, if the screen scrolls illegally. I ( I I I I [ I I I I I I I I I I I I I I I I I I I getchar Function int getchar() Return Va l u e s : The next character from the standard input device (stdin, the terminal); EOF on error. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 6 getegid, geteuid, getgid, and getuid Functions unsigned unsigned unsigned unsigned Return getegid() geteuid() getgidO getuidO Va l u e s : The group number from the UIC (getgid and getegid) or the member number from the UIC (getuid and geteuid). Notes; The functions getuid and geteuid are functionalh- *';:”\i!cnt in \\ I 1 I I I I I I I I I I [ I I I I I I I I I I I I I getenv Function char *getenv(ntune) char *name; Return Va l u e s : The function returns one of the following values depending on the value of the argument, name, specified in the function call; Argument R e t u r n Va l u e H O M E The user's login directory T E R M The terminal type P A T H The default device and directory USER The name of the user initiating the process VAX CRun-Time Library Functions and Macros 3 - 3 7 geteuid Function See getegid. getgid Function See getegid. getname Function char *getname(/'ile_desc. buffer [.style]) int fi l e . d e s c , char ^buffer; Return style; Va l u e s ; The address of the buffer lontaining the file specification; -1 on error. I I I I I f I I I I I I [ I [ I I 1 I I I i I I I I Notes: The third argumoni. style, can be either one of the integers 1or 0. If vou specify (I, the function fgetname returns the file specification in VAX/VMS format. If you specify 1, the function fgetname returns the hie specification in DEC/Shell tormat. If you do not specify this argument, this function returns the Hie name acmrding ici vour current command language interpreter. getpid Function int getpid() Return Va l u e s : The current process ID. VAX CRun-Time Library Functions and Macros 3-38 gets Function #include char *gets(str) char *8tr; Return Va l u e s : Apointer to the character string containing the line; NULL, if end-of-file is reached before the n e w l i n e i s e n c o u n t e r e d o r o n e r r o r. getstr Macro and wgetstr Function #include -u:. getstr(str) wgetstr(mn, str) I I I I I I I I I I I I ( I I I I I I i I I I I I I WINDOW *win; char Return *str; Va l u e s : OK on success; ERR, if the screen scrolls illegally. getuid Function See getegid. getw Function See fgetc. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 3 9 getyx Macro #include curses getyxCmn, y, x) WINDOW *win; i n t y. Return x; Va l u e s : OK on success; ERR on failure. gsignal Function ^include signal int gsignaKsig [.code])) int I I sig; I I I I I I I I I I I [ I I Return Va l u e s : I i I I I I I I I I If gsignal specifics asig argument that is outside the range defined in the signal module, then gsignal returns zero, and the variable, errno, is set to EINVAL. If ssignal establishes SIG_DFL (default action) for the signal, then gsignal does not return. The image is exited with the VAX/VMS error code that corresponds to the signal. If ssignal establishes S1G_IGN (ignore signal) as the action for the signal, then gsignal returns its sig. Otherwise, ssignal must have established an action function for the signal. That function is called, and that function's return value is returned by gsignal. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 4 0 Notes: Signal Code Integer overflow SIGFPE FPE_INTOVF_TRAP Integer division by zero SIGFPE FPE_JNTDIV_TRAP Floating overflow trap Floating/dccimal division by zero SIGFPE FPE_FLTOVF_TRAP SIGFPE FPE_FLTDIV_TRAP Floating underflow trap SIGFPE FPE_FLTUND_TRAP Decimal overflow trap SIGFPE FPE_DECOVF_TRAP Subscript-range Floating overflow’ fault SIGFPE FPE_SUBRNG_TRAP SIGFPE FPE_FLTOVF_FAULT Floating divide by zero fault SIGFPE FPE_FLTDIV_FAULT Floating underflow fault SIGFPE FPE_FLTUND_FAULT Hardware I I I Condition I [ I I I I I I I I I i I I I I I t I I I I I Reserved instruction SIGILL ILl^PRIVIN_FAULT Reserved operand SIGILL ILI_RESOP_FAULT Reserved addressing SIGILL ILL_RESAD_FAULT Compatibility mode SIGILL Hardware supplied Length access control SIGSEGV Chme SIGSEGV C h m s SIGSEGV ChmiJ SIGSEGV Trace pending SIGTRAP VAX CRun-Time Library Functions and Macros 3—41 Hardware Condition Signal Code Bpt instruction SIGTRAP Protection violation SIGBUS Customer-rc-i-rvcd code SiGEMT hypot Function See cabs, inch Macro and winch Function #include curses inch( ) winch(tiiin) I WINDOW *win; I I I I t I I I I I I I I I I I Return Va l u e s : I I I I I I I I I OK on success; ERR on failure. initscr Function #include .urses initscrC) Return Va l u e s : OK on success; ERR on failure. VAX CRun*Time Library Functions and Macros 3 - 4 2 insch Macro and winsch Function #include curses insch(ch) winsch (win, ch) WINDOW *win; char Return ch; Va l u e s : OK on success; ERR, if the screen scrolls illegally. I I I I I I I I I I I I I I I I I I I I I I I I I I insertin Macro and winsertin Function #include curses insertin() winsertln(win) WINDOW *win: Return Va l u e s : OK on success; ERR, if the screen scrolls illegally. VAX CRun-Time Library Functions and Macros 3—43 insstr Macro and winsstr Function # i n c l u d e insstr(str) winsstrCurin, str) WINDOW *win; char Return *str; Va l u e s : OK on success; ERR, if the screen scrolls illegally. \'otes: O n I I I I I I I I I I I I I I I isalnum I I i I I I 1 I I I I Macro ttinclude type int isalnum(character) char character; Return Va l u e s : Anonzero integer, if the character is alphanumeric; 0, if it is not. VAX CRun-Time Library Functions and Macros 3—44 isalpha Macro #include ctype int isalpha(character) char character; Return Va l u e s : Anonzero integer, if the character is alphabetic; 0, if it is not. isapipe Function int isapipeC/ile.desc) int fi l e . d e s c ; Return Va l u e s : 1, if the specified file descriptor is associated with amailbox; 0, if it is not; -1 on error. I I I I I I I I I I I I I I I I isascti Macro I I I I I I I I I I #include ':type int isascii(c^racter) char character; Return Va l u e s : Anonzero integer, if the character is ASCII; 0, if it is not. VAX CRun-Time Library Functions and Macros 3—45 isatty Function int isatty(/'il6_desc) int fi l e . d e s c ; Return Va l u e s : 1, if the file is aterminal; 0, if the file is not. iscntrl Macro #include ctyp‘ int iscntrl(character) char character: Return Va l u e s : Anonzero integer, if the character is acontrol character; 0, if not. I I I I 1 I I I I I I I I I I I I I I I I I I I I I isdigit Macro #include type int isdigit(character) char character; R e t u r n Va l u e s : Anonzero integer, if the character is adigit; 0, if it is not. VAX CRun-Time Library Functions and Macros 3—46 isgraph Macro #include ctype int isgraph(character) char character; Return Va l u e s ; Anonzero integer, if the character i: an ASCII graphic character: U, if it is not. Notes: This macro is VAX Cspecific. islower Macro #include ctype int islower(character) I I I I I I ( I I I [ I I [ I I char character; Return I I I I I I I I I I Va l u e s : Anonzero integer, if the character is lowercase; 0, if it is not. isprint Macro #include ctype int isprint(character) char character; Return Va l u e s : Anonzero integer, if the character is an ASCII printing character; 0, if it is not. VAX CRun-Time Library Functions and Macros 3—47 ispunct Macro #include .'pe int ispunct(character) char character; Return Va l u e s : Anonzero integer, if the character is apunctuation character; 0, if it is not. isspace Macro #include ctype int isspace(character) char IIIII[( character; IIIIII I I I Return I I I I I I I I I I Va l u e s : Anonzero integer, if the character is one of the whitespace characters; 0, if it is not. isupper Macro #include ctyp' int isupperCcharocter) char character; Return Va l u e s : Anonzero integer, if the character is uppercase; 0, if it is not. VAX CRun-Time Library Functions and Macros 3 - 4 8 isxdigit Macro #include ctype int isxdigit(character) char character; Return Va l u e s : Anonzero integer, il the character Kahexadecimal digit; 0, if it is not. Notes: Ihis macro is VAX Cspecific. kill Function int kilKpid, sig) int I I pld, sig: I I I I I I I I I I I 1 1 Return 1 1 1 1 1 1 1 1 1 ( 1 Va l u e s : 0, if the signal is successfully queued; -1, if an error occurs. Notes: The receiving process always terminates. VAX CRun-Time Library Functions and Macros 3—49 Idexp Function #include m? double IdexpCx, c) double x; int e; Return Va l u e s : The first argument times 2to the power of its second argument (x(2 ^)) .If underflow occurs, this function returns 0. If overflow occurs, it returns the largest possible value of the appropriate sign. leaveok Macro f t i n c l u d e leaveok(win, bool/) I I I I I I I I I I I I I I I I I I I I I I I I I I WINDOW *win; bool Return boolf: Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3 - 5 0 localtime Function #include time s t r u c t t m * l o c a l t i m e ( b i n t - i f fl ) int *bintim; Return Va l u e s ; Apointer to the structure with the tag, tm, The members of the tm structure are integers represent¬ ing the following: I M e m b e r Description t m _ s e c time in seconds tm_min minutes tm_hour hours (24) I I I I I I I I I I I I I I I I I I I I tm_mday day of the month (1-31) t m _ m o n month (0-11) tin_year tm_wday year (last two digits) day of the week (0-6) tm_yday day of the year (0-365) tm_isdst daylight savings time (always 0) I I I I I VAX CRun-Time Library Functions and Macros 3-51 log and Iog10 Function #include math double log(x) double loglO(x) double x; Return Va l u e s ; The natural base-e (log) and the base-10 (loglO) logarithm of its argument. If the argument, x, is 0 or negative, the function returns 0and sets the variable, ermo, to EDOM. Iog10 Function See log. I I I I I I I I I I I I I I I I I I I I I I I I I I longjmp and setjmp Functions # l n c l u d e ap Betimp(enu) longjmpCem;, vat) jmp_buf env; i n t Return v a l : Va l u e s : The function longjmp returns val to the setjmp function with which it is associated. When the function setjmp is first called, it returns 0. After longjmp is called with the same env argument as the first setjmp call, setjmp returns the value of the longjmp call's val argument. VAX CRun-Time Library Functions and Macros 3 - 5 2 longname Function longnameC termini/, name) ♦termbuf. *name; c h a r Return Va l u e s : The full terminal name is placed in the argument, name. Notes; This function has limited functionality in VAX C. Iseek Function i n t I s e e k C / i l c . d e s c , o ff s e t , d i r e c t i o n ) I int fi l e . d e s c , I I offset, I direction; I I I I I I I I I I Return I I I I I I I I I I I Va l u e s : The new position in the file. If the file descriptor is undefined or if you try to seek before the beginning of the file, the function returns -1. Notes: direction Value 0 From the beginning of the file 1 From the current position 2 F r o m t h e e n d - o f - fi l e VAX CRun-Time Library Functions and Macros 3—53 mkdir Function int mkdir(dir_spec, mode [,uic. mao:_versions, r_v_nxwi]) c h a r *dir_spec; unsigned mode, uic, max.version, r_v_num; Return Va l u e s : 0 o n s u c c e s s ; - 1 o n e r r o r. malloc Function See calloc. mktemp Function #include stdio char *mlctemp( temp late) char *template; I I I I I I I I I I I I I I I I Return Va l u e s : I I I I I I I I I I Apointer to atemporary file name created from atemplate of the form "[oflmJXXXXXX". If aunique file name cannot be created, mktemp returns apointer to an empty string. VAX CRun-Time Library Functions and Macros 3 - 5 4 modf Function #include math double modf(iialue, iptr) double value, *iptr; Return Va l u e s ; The positive fractional part of value and the address of the integral part is assigned to iptr. move Macro and wmove Function #include cui move (3/. x) wmove(utn, y. x) [ I I I I I I I I I I I I I I I I I I I I I I I I 1 WINDOW *win; i n t Return y, x; Va l u e s : OK on success; ERR, if the screen scrolls illegally. VAX CRun-Time Library Functions and Macros 3 - 5 5 mv[w]addch Macros #include curses mvaddchCy, x, ch) mvwaddch (win, y. x. cK) WINDOW *win; char i n t Return ch; y, x; Va l u e s : OK on success; ERR, if the screen scrolls illegally. I I I I I I I I I I I I I I I I I I I I I I I I I I mv[w]addstr Macros #include curses mvaddstr(j/, x. str) m v w a d d s t r C m n , y, x , s t r ) WINDOW *win; char * 8 t r ; int y, Return x; Va l u e s : OK on success; ERR, if the screen scrolls illegally. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 5 6 mvcur Function # i n c l u d e m v c u r d a s t y, l a s t x , n e v r y, n e w x ) i n t l a s t y, l a s t x . n e w y, n e w x ; Return Va l u e s : OK on success; ERR on failure. mv[w]delch Macros #include m v d e l c h ( y, x ) mvwdelchCmn, y, x) WINDOW *win; i n t I I y. x; I I I I I I I I I I I I I Return I I I ! I I I I I I I Va l u e s : OK on success; ERR, if the screen scrolls illegally. mv[w]getch Macros #include cuISo^. mvgetchCy, x) mvwgetch(ti»in, y, x) WINDOW *win; i n t Return y. x; Va l u e s : OK on success; ERR on failure. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 5 7 mv[w]getstr Macros #include curses mvgetstr(^, x, str) mvwgetstr(win, y, x. str) WINDOW *win; char *str; i n t y. x; R e t u r n Va l u e s : OK on success; ERR on failure. I I I I I i I I I I I I I I I I I I I I I I I I I I mv[w]inch Macros #include curses mvinch(i/, x) mvwinchCmn. y. x) WINDOW ♦win; i n t y, x; R e t u r n Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3—58 mv[w]insch Macros #include urs^ m v i n s c h ( c / i . y, x ) mvwinschCwin, y, x, ch) WINDOW *win; c h a r i n t Return ch; y. x; Va l u e s : OK on success; ERR, if the screen scrolls illegally. I I I I I I I I I I I I I I I I I I I I I I I I I I mv[w]insstr Macros #include curses mvinsstr(^. x. str) m v w i n s s t r ( i u i n . y. x . s t r ) WINDOW *win char i n t Return *8tr y. X Va l u e s : OK on success; ERR, if the screen scrolls illegally. VAX CRun-Time Library Functions and Macros 3—59 mvwin Function #include curses mvwinCmn. y, x) WINDOW *win: i n t Return y. x; Va l u e s : OK on success; ERR, if moving the window puts all or part of the window off of the terminal screen. On error, this function does not attempt to move the window and the screen remains unaltered. ncwwin Function #include curses newwin(nuwil-ines, nxancols, begin_y, begin_x) i n t n u m l i n e s , n u m c o l s , b e g i n . y, b e g i n _ x ; I I I I I I I I I I I I I I i I Return I I I I I I I I I I Va l u e s : Apointer to anewly created window; ERR on failure. nice Function int nice(increment) int increment; Return Va l u e s : 0, if the process priority is successfully lowered; -1, if it is not. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 6 0 [no]nl Macros #include urp- n l O nonl() Return Va l u e s : None. Notes: These macros have no functionality in VAX C. I I I I I I I I I I I I I I I I I I I I I I I I I I open Function ^include int openspec, flags, mode [,file_attribute, ... ] ) c h a r * fi l e _ s p e c ; int fl a g s , Return mode; Va l u e s : An integer file descriptor, if the file is successfully opened; -1, if it is not. VAX CRun-Time Library Functions and Macros 3-61 Notes: The values for the second argument, flags: O - R D O N L Y I O - W R O N L Y Open for reading only Open for writing only 0 _ R D W R Open for reading and writing O - N D E L A Y Ignored; not supported by VAX C O ^ P P E N D Append on each write O - C R E A T Create afile if it does not exist O - T R U N C C r e a t e a n e w v e r s i o n o f t h i s fi l e O-EXECL Error if attempting to create existing file I I I I I I I I I I I I I I I I i I I I I i I i I overlay Function #include curses overlay(win!, winS) WINDOW *winl, *win2; Return Va l u e s : OK on success; ERR on failure. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 6 2 overwrite Function #include overwrite(ii»inJ, wirJS) WINDOW *winl, Return Va l u e s : *win2; OK on success; ERR on failure. pause Function pause() Return Va l u e s : None. I I I I I I I I I I I I I I I I I I I I I I I I I I perror Function #include perror(string) char *8tring; Return Va l u e s : Amessage to stdout (the terminal) of the form: string: message\n VAX CRun-Time Library Functions and Macros 3—63 pipe Function #include fi l e int pij>6{array_fdscpt [, flags, bufsize]) int array_fdscptr[2]; i n t fl a g s , b u f s i z e ; Return Va l u e s : 0, if the pipe is successfully created; -1, if not. Notes: If you do not specify an argument for bufsize, the default size of the created mailbox buffer is 512 bytes. For information on the argument, flags, see open, You only need to include the file module if you specify flags. I I I I I I I I I I I [ I I I I I I I I I I I I I I pow Function #include math double pow(i. y) double X, y; Return Va l u e s : The argument, x, to the power of y. If the result overflows, the function returns the largest possible floating-point value and sets the variable, errno, to ERANGE. If yis negative or nonintegral, or if both arguments are 0, the function returns 0. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 6 4 printf Function #include tdi int printf (/ormat_spec \.,oxit‘put_src ... ] ) char *format_spec; Return Va l u e s : T h e n u m b e r o f c h a r a c t e r s w r i t t e n ; - 1 o n e r r o r. Notes: For information on format—spec, see fprintf. [wjprintw Functions #include I [ I I I I I I I i I I I 1 1 1 1 1 1 1 printw(/ormat_spec [,output.src, ... ] wprintwCttfin, format_spec [,output.src, ... ] 1 ( 1 1 1 1 ) ) WINDOW *win; Return Va l u e s : OK on success; ERR, if the screen scrolls illegally. Notes: For information on format—spec, see fprintf. putc Macro See fputc. VAX CRun-Time Library Functions and Macros 3 - 6 5 putchar Function int put char(character) char character: Return Va l u e s : The character written; EOF on failure. puts Function #include stdlo int puts(str) char ♦8tr; Return Va l u e s : 0if the string was written to stdout (the terminal); EOF on failure. I I I I I I I I I I I I I I I I I I I I putw Function See fputc. rand and srand Functions int randO int srand(seed) int seed: Return Va l u e s : Pseudorandom numbers in the range 0to 2 31 -I . VAX CRun-Time Library Functions and Macros 3-66 [no]raw Macros #include curses raw() noraw() Return Va l u e s : None. read Function int read(/ile_desc, buffer, nbytes) i n t fi l e _ d e s c . n b y t e s ; char ^buffer; Return Va l u e s : The number of bytes read; 0, if end-of-file is reached; -1 on error. I I I I I I I I I I I I I I I realloc I I I I I I I I I I I Function c h a r * r e a l l o c ( p o i n t e r, s i . z e ) char ♦pointer; unsigned size; Return Va l u e s : The address of the area; 0on error. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 6 7 refresh Macro #include and wrefresh Function curses refresh() wrefresh (tt-in) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. rewind Function #include stdio i n t r e w i n d ( . fi l e _ p t r ) F I L E * fi l e _ p t r ; I I I I I I I [ I [ I i I I I I Return I I I I I I I I I I Va l u e s : 0, if the file is successfully rewound; -1, if an error occurs. sbrk Function See brk. VAX CRun-Time Library Functions and Macros 3—68 scanf Function #include stdio int scanf(/ormat.spec [,inp«t_ptr ... ] ) char *format_spec: Return Va l u e s : The number of successfully scanned items; EOF on end-of-file. Notes: For information concerning input—ptr, see fscanf. I I I I I I I I I I I I I I I I I I I I I I I I I I scanw Macro and wscanw Function #include curs.'- scanw(/mt_spec [,iT^t_ptr, ... ] ) wsczmwvf(u»in. fmt_spec i,input_ptr, .. 3) WINDOW *win; R e t u r n Va l u e s : OK on success; ERR, if the screen scrolls illegally. VAX CRun-Time Library Functions and Macros 3 - 6 9 scroll Function #include .rses scrolKmn) WINDOW *win; Return Va l u e s ; OK on success; ERR on failure. scroltok Macro #include scrollokCtein, boolf) WINDOW *win; I bool boolf: I I I I ( I I I I 1 I I I I Return I I I I I I I I I I I Va l u e s : OK on success; ERR on failure. setattr Macro and wsetattr Function #include curses setattr(attr) wsetattrfwin. attr) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. VAX CRun-Time Library Functions and Macros 3 - 7 0 Notes: fl/fr Argument - B U N K Clear blinking attribute _B01.D Clear bold face attribute -REVERSE Clear reverse video attribute - U N D E R L I N E Clear underline attribute This function and macro are VAX Cspecific. setbuf Function ftinclude stdio setbuf(.file_ptr, buffer) F I L E * fi l e _ p t r ; char II[( *buffer; II[IIIIII I I I Return Va l u e s : I I I i I I I I I I None. setgid and setuid Functions int setgidC group ^number) int setuid (.member_nvmber) unsigned member.number; unsigned group.number; R e t u r n Va l u e s : None. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 7 1 setjmp Function See longjmp. setuid Function See setgid. sigblock Function sigblockCmasA;) int mask; Return Va l u e s ; The previous set of masked signals; -1 on error. I I i I I I I I I I I I I I I I I I I I I I I I I i signal Function ttinclude int (*signal(sig, func))() int slg; int (*func)(): Return Va l u e s : The address of the function previously (or initially) established to handle the signal. If the argument, sig, is out of range, this function returns -1 and the variable, errno, is set to EINVAL. VAX CRun-Time Library Functions and Macros 3—72 Notes: Signal symbolic names: N a m e Description Generated by SIGHUP Hang up Data set hang up SIGINT Interrupt SIGQUIT Quit VAX/VMS CTRL/C interrupt CTRL/C if the action for SIGINT is SIG_DFL (default) SIGILL 1 Bad instruction Illegal instruction, reserved operand, or reserved address mode SIGTRAP I 1 Trace trap SIGIOT lOT instruction TBIT trace trap or breakpoint fault instruction Not implemented SIGEMT EMT instruction Compatibility mode trap or op code reserved to customer SIGFPE Floating-point Floating-point overflow 1 I I I I I I I I I I I I I 1 2 I I SIGKILL I Kill External signal only SIGBUS Bus error Access violation or change mode user SIGSEGV Segment violation Length violation or change mode supervisor SIGSYS Call error Bad argument to system call SIGPIPE Broken pipe Not implemented SIGALRM Alarm clock Timer SIGTERM Software External signal only I I I I I I I I I AST Sot rc^et when caught. Cannot he caught or ignored VAX CRun-Time Library Functions and Macros 3-73 sigpause Function sigpause(masfc) ant mask: Return Va l u e s : After restoring the previous set of masked signals, this function returns EINTR which causes an interrupt; -1 on error. sigsetmask Function sigsetmaskCmosfc) int mask: Return Va l u e s : The previous set of masked signals; -1 on error. 1 I I I I I ( I I I I I I I I I I I I I I I I I I sigstack Function #include signal sigstack(ss, oss) struct sigstack < c h a r *ss_sp; i n t ss.onstack; >; struct Return sigstack *ss. *oss; Va l u e s : 0on success; -1 on failure. VAX CRun-Time Library Functions and Macros 3 - 7 4 sigvec Function #include r:ignal sigvec(sigint, sv, osv) struct sigvec < i n t (♦handler)(); i n t mask; i n t onstack; } ; s t r u c t s i g v e c * s v, * o s v ; i n t sigint: handler(sigint, code, scp) i n t sigint, code; struct sigcontext *scp; I I I I I I I [ I I I I I I I I I I I I I I I I I I R e t u r n Va l u e s : 0if the call to the signal handler is successful; -1 on error. sin Function #include math double 8in(a;) double Return x; Va l u e s ; The sine of x. VAX CRun-Time Library Functions and Macros 3—75 sinh Function f fi n c l u d e math double sinhC®) double x; Return Va l u e s : The hyperbolic sine of its argument. Both xand its sine must be of type double. On overflow error, this function returns adouble value with the largest possible magnitude and appropriate sign. sleep Function int sleepCseconds) unsigned seconds: I I I I I ( I [ I I I I I I I Return Va l u e s : I I I I I I I I I I The number of seconds that the process slept; -1 on error. sprintf Function See fprintf. sqrt Function #include lath double sqrt(x) double x; Return Va l u e s : The square root of x; 0, if xis negative. VAX CRun-Time Library Functions and Macros 3 - 7 6 srand Function See rand, sscanf Function See fscanf. ssignal Function t fi n c l u d e . " ' . i g n a l int (=*'ssignal(sig, func))() int sig, (*func)(); Return Va l u e s : The address of the function previously (or initially) established as the action for the signal; 0, if the previous action was SIG—DFL. I I I I I I I I I I I I I I ( I I I I I I I I I I I Notes: See also, signal. standend Macro and wstandend Function # i n c l u d e standend() wstandend(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 7 7 standout Function #include curses standout() w8tandout(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. stat Function See fstat. strcat and strncat Function char *8trcat(str_l, str.S) char *8trncat(str_l, str_2, maxchar) III1IIIIII[[ I I I I char *str_l, int maxchar; Return I I I I I I I I I I *str_2; Va l u e s : The address of sfr_I. Notes: The argument, maxchar, specifies the maximum number of characters to concatenate from s/r_2 u n l e s s t h e N U L t e r m i n a t o r i s e n c o u n t e r e d fi r s t . VAX CRun-Time Library Functions and Macros 3 - 7 8 strchr and strrchr Functions char *8trchr(str, character) char *strrchr(str, character) char *8tr, Return character; Va l u e s : The address of the first occurrence (strchr) or the last occurrence (strrchr) of character in the string; 0, if the character was not found. strcmp and strncmp Functions int 8trcmp(str_J, str_2) int 8trncmp(str_J, str_2. maxchar) char i n t I I *8tr_l, *str_2; maix; [ I I I I [ I I I ( I I I Return I I I I I I I I I I I Va l u e s : Anegative, 0, or positive integer indicating whether str—1 is composed of more, equal, or less characters than sfr_2. Notes: The argument, maxchar, specifies amaximum number of characters to search in both s/r_J and str_2. T - / Jg > VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 7 9 strcpy and strncpy Functions char *strcpy(str_l, str_2) char *strncpy(str_J, str_£. maxchar) char *8tr_l, *str_2; int max; Return c/cj+ J Va l u e s : The address of str—1. / Notes: The argument, maxchar, specifies the maximum number of characters to copy from sfr_2 to sfr_3 up to but not including the NUL terminator. I I I I I I I I I I I I [ I I I I I I I I I I I I I strcspn Function i n t s t r c s p n ( s t r, c o r s e t ) char *str, Return *charset; Va l u e s : The number of characters preceding the first character in str that is also in charset. If no match is found, the function returns the length of str. This function returns 0if Sfr is null. strien Function int strlen(str) char *str; R e t u r n Va l u e s : The length of sfr. VAX CRun-Time Library Functions and Macros 3-80 strncat Function See strcat. strncmp Function See slrcmp. strncpy Function See slrcpy. strpbrk Function c h a r * s t r p b r k ( s t r, c h a r s e t ) char *str, *charset; R e t u r n Va l u e s : The address of the first character in str that is also in charset; NULL, if no match is found. [ I I I I I I I I I I I I I I strrchr I I I I I I I I I I I Function S e e s t r c h r. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 1 strspn Function i n t 8 t r s p n ( s t r. c h a r s e t ) char *8tr, *charset; R e t u r n Va l u e s : The number of characters that precede the first character in sir that is not also in charset. If charset is anull string, the function returns 0. If all the characters in sfr are also in charset, the function returns the length of str. subwin Function ^include curses subwinCuin, nvmli.nes, nvncols, begin_y, begin_x) WINDOW *win; int numlines, numcols, begin_y, begin_x; I [ I I I I I I I I I I I I I I Return Va l u e s ; I I I I I I I I I I Apointer to anewly created subwindow; ERR on failure, tan Function #include math double tan(x) double x; Return Va l u e s : The tangent of x. At its singular points (...,-3pi/2 ,-pi/2 ,pi/2 the return value is the largest possible double value, and the variable, ermo, is set to ERANGE VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 2 tanh Function #include it,h double tanh(a) double x; Return Va l u e s ; The hyperbolic tangent of x. time Function long time(time.Location) long *time_location; Return Va l u e s : The elapsed system time since 00:00:00 January 1, 1970. If the argument, time-location, is specified. it points to the location of the returned time. I I I I I I I I I I I ( I I I times I I I I I I I I I I I Function time8(bu//er) struct Return tbuffer *buffer; Va l u e s : The accumulated times of the current process and of its terminated child processed. The times are placed in the user-defined structure with the tag, tbuffer. The structure should have the following members of type int; proc—user—lime, proc—system—time, child—user—time, and child—system—time. All system times are returned as 0. Accumulated CPU times are returned in 10-millisecond units. VAX CRun-Time Library Functions and Macros 3-83 t m p fi l e F u n c t i o n #include stdio F I L E * t m p fi l e ( ) Return Va l u e s : Afile pointer to the temporary file; anull pointer on error. tmpnam Function #include stdio char *tmpnan(n<vne) char *name; Return Va l u e s : If name is specified, the function returns the file name string to name, or, if no argument is given, it returns the address of an internal storage area containing the string. I I I 1 I I I I I I 1 I 1 I i toascii 1 I 1 I I I I I I I I Function Sinclude ctype int toascii(character) char character; Return Va l u e s : The character converted to 7-bit ASCII. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 4 tolower Function and _tolower Macro #include ctype char tolower(character) char .tolower(charocter) char character; Return Va l u e s : The character converted to lowercase. Lowercase input characters are returned unchanged. Notes: —tolower is implemented as amacro. 1 I I I I I I I I I I I I I I I I I I I I I I I I I touchwin Function #include cur touchwin(win) WINDOW *win; Return Va l u e s : OK on success; ERR on failure. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 5 ttyname Function #include i n t curses ♦ttyname() Return Va l u e s : Apointer to the NUL-terminated pathname of the terminal device associated with the file descriptor 0, stdin (the terminal). Notes: This function has limited functionality in VAX C. I I I I I I I I I I I I I I I I I I II[I( [ Ii toupper Function and _toupper Macro #include ctype char toupper(character) char _toupper(choractcr) char character; R e t u r n Va l u e s : The character converted to uppercase. Uppercase input characters are returned unchanged. Notes: —toupper is implemented as amacro. VA X C R u n - Ti m e L i b r a r y F u n c t i o n s a n d M a c r o s 3 - 8 6 umask Function int umask(mode_cofflplement) unsigned mode_complement; Return Va l u e s : The chmod argument, mode, corresponds to the argument, mask, except that mask has the effect of denying the specified privileges. ungetc Function # i n c l u d e int ungetc(character. file_ptr) char character; F I L E * fi l e _ p t r ; ( I I I I I I I I I I I I I I Return I I I i I I I I I I I Va l u e s : The next character to be read (by gelc); EOF on error. va_arg Macro # i n c l u d e va_arg(list_incrementor. item_type) v a . l i s t Return list_incrementor; Va l u e s : The next argument in the argument list. VAX CRun-Time Library Functions and Macros 3-87 va_count Macro ^include varargs va.count(count) int count; Return Va l u e s : The number of longwords in the argument list, in the argument, count. Notes: This macro is VAX Cspecific. I ( I I I I I I I I I [ I I I va_end I I I I I I I I I I I Macro tfinclude varargs va._end(.list_incrementor) va.list list_incrementor; Return Va l u e s : None. VAX CRun-Time Library Functions and Macros 3 - 8 8 va_start and va_start_1 Macros #include arargs i n t * n t - va.start(list^incrementor) ●. a^ :.art_ 11. itst_ .ncrementi^. .offset) v a _ l i s t list_incrementor; o ff s e t , function_najne(t»a_alist) va_dcl { va_list I I list.incrementor; I I I I I I I I I I I I I I Return Va l u e s : I I 1 I ( I I I I I These macros initialize the argument, list_incrementor, to the first argument in the list. L'se vf start_l wln-n >.\.u need Uj a variable-length argument list, that is itself asingle argument m;larger list, and is preceded by aknc.vn number of defined arguments. For example, a VAX CRTl. function which contains avariable-length argument list offset from the beginning of the o n : ■gument list is printf. The macro vastart_l is VAX Cspecific. va_start_1 Function v a _ s t a r t VAX CRun-Time Library Functions and Macros 3 - 8 9 VA X C S E S TA B L I S H F u n c t i o n v o i d VAXCSESTABLISH (exception.handler) i n t (»exception_handler)(); R e t u r n Va l u e s : Hstablishos the t'Xicption^htWiiU’r alegitimate one. Only conJiiion handlers declared in this wav should be used in VAX Cprograms. In thi.s way VAXCSESTABLISH catches all RTL-related exceptions and j^asses on all others to the declared handler, vfork Function int vforkO Return Va l u e s : 0to the child process and the child process ID to the parent process. [ ( 1 ( 1 ( 1 1 1 ( 1 1 1 I I wait I I I I I I I 1 I I I Function int int wait([status]) *status; R e t u r n Va l u e s : The process ID of the terminated child process; -1, if there are no child processes. VAX CRun-Time Library Functions and Macros 3 - 9 0 wrapok Macro #inclucie :urso£: wrapok(uin. boolf) WINDOW *win; bool boolf; Return Va l u e s : None. Notes: This macro has no functionality in VAX C. I I I I ( I I I I ( I I I I I write I I I I I I I I I I I Function int write(/tlc_desc, buffer, nbytes) int fi l e . d e s c , char ^buffer: Return nbytes; Va l u e s : The number of bytes written; -1 on error. VAX CRun-Time Library Functions and Macros 3-91 —exit Function See exit. —tolower Macro S e e t o l o w e r. —toupper Macro See toupper. I I 1 r 1 I I I I I I [ i I I I i I I I 1 I I I I I VAX CRun-Time Library Functions and Macros 3-92 It( ( ( ( ( ( I(I( ( I ●^ 1 1
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies