CONTENTS Title Page Copyright Page Preface 1 Introduction 1.1 Using the DEC C Run-Time Library 1.2 RTL Linking Options on Alpha Systems (Alpha only) 1.2.1 Linking with the Shareable Image 1.2.2 Linking with the Object Libraries 1.2.3 Examples 1.3 RTL Linking Options on VAX Systems (VAX only) 1.3.1 Linking with the DEC C RTL 1.3.1.1 Linking with the DEC C RTL Shareable Images 1.3.1.2 Linking with or Providing Your Own Shareable Images 1.3.1.3 Linking with the DEC C RTL Object Libraries 1.3.1.4 Linking with the DEC C RTL Object Libraries /NOSYSSHR 1.3.2 Resolving Link-Time Conflicts with Multiple C RTLs 1.3.2.1 Using VAXC$LCL.OPT 1.3.2.2 Using VAXC$EMPTY.EXE 1.3.2.3 Using DECC$EMPTY.EXE 1.3.3 Linking Examples for DEC C or DEC C++ Code Only 1.3.4 Linking Examples for VAX C and DEC C Code Combined 1.3.5 Linking with the VAX C RTL /NOSYSSHR 1.4 DEC C RTL Function Prototypes and Syntax 1.4.1 Function Prototypes 1.4.2 Syntax Conventions for Function Prototypes 1.4.3 UNIX Style File Specifications 1.5 Feature-Test Macros for Header-File Control 1.5.1 Standards Macros 1.5.2 Selecting a Standard 1.5.3 Interactions with the /STANDARD Qualifier 1.5.4 Multiple-Version-Support Macro 1.5.5 Compatibility Modes 1.5.6 Curses and Socket Compatibility Macros 1.6 Input and Output on OpenVMS Systems 1.6.1 RMS Record and File Formats 1.6.2 Access to RMS Files 1.6.2.1 Accessing RMS Files in Stream Mode 1.6.2.2 Accessing RMS Record Files in Record Mode 1.6.2.2.1 Accessing Variable-Length or VFC Record Files in Record Mode 1.6.2.2.2 Accessing Fixed-Length Record Files in Record Mode 1.6.2.3 Example-Difference Between Stream Mode and Record Mode 1.7 Specific Portability Concerns 1.7.1 Reentrancy 1.7.2 Multithread Restrictions 1.8 64-bit Pointer Support (Alpha only) 1.8.1 Using the DEC C Run-Time Library 1.8.2 Obtaining 64-bit Pointers to Memory 1.8.3 DEC C Header Files 1.8.4 Functions Affected 1.8.4.1 No Pointer-Size Impact 1.8.4.2 Functions Accepting Both Pointer Sizes 1.8.4.3 Functions with Two Implementations 1.8.4.4 Restricted to 32-Bit Pointers 1.8.5 Reading Header Files 2 Understanding Input and Output 2.1 Using RMS from RTL Routines 2.2 UNIX I/O and Standard I/O 2.3 Wide-Character Versus Byte I/O Functions 2.4 Conversion Specifications 2.4.1 Converting Input Information 2.4.2 Converting Output Information 2.5 Terminal I/O 2.6 Program Examples 3 Character, String, and Argument-List Functions 3.1 Character-Classification Functions 3.2 Character-Conversion Functions 3.3 String and Argument-List Functions 3.4 Program Examples 4 Error and Signal Handling 4.1 Error Handling 4.2 Signal Handling 4.2.1 OpenVMS Versus UNIX Terminology 4.2.2 UNIX Signals and the DEC C RTL 4.2.3 Signal-Handling Concepts 4.2.4 Signal Actions 4.2.5 Signal Handling and OpenVMS Exception Handling 4.3 Program Example 5 Subprocess Functions 5.1 Implementing Child Processes in DEC C 5.2 The exec Functions 5.2.1 Exec Processing 5.2.2 Exec Error Conditions 5.3 Synchronizing Processes 5.4 Interprocess Communication 5.5 Program Examples 6 Curses Screen Management Functions and Macros 6.1 Using the BSD-Based Curses Package (Alpha only) 6.2 Curses Overview 6.3 Curses Terminology 6.3.1 Predefined Windows (stdscr and curscr) 6.3.2 User-Defined Windows 6.4 Getting Started with Curses 6.5 Predefined Variables and Constants 6.6 Cursor Movement 6.7 Program Example 7 Math Functions 7.1 Math Function Variants-float, double, long double 7.2 Error Detection 7.3 The <fp.h> Header File 7.4 Example 8 Memory Allocation Functions 8.1 Program Example 9 System Functions 10 Developing International Software 10.1 Features of International Software 10.2 Developing International Software Using DEC C 10.3 Locales 10.4 Using the setlocale Function to Set Up an International Environment 10.5 Using Message Catalogs 10.6 Handling Different Character Sets 10.6.1 Charmap File 10.6.2 Converter Functions 10.6.3 Using Codeset Converter Files 10.7 Handling Culture-Specific Information 10.7.1 Extracting Cultural Information From a Locale 10.7.2 Date and Time Formatting Functions 10.7.3 Monetary Formatting Function 10.7.4 Numeric Formatting 10.8 Functions for Handling Wide Characters 10.8.1 Character Classification Functions 10.8.2 Case Conversion Functions 10.8.3 Functions for Input and Output of Wide Characters 10.8.4 Functions for Converting Multibyte and Wide Characters 10.8.5 Functions for Manipulating Wide-Character Strings and Arrays 10.9 Collating Functions 11 Date/Time Functions 11.1 Date/Time Support Models 11.2 Overview of Date/Time Functions 11.3 DEC C RTL Date/Time Computations-UTC and Local Time 11.4 Time-Zone Conversion Rule Files 11.5 Sample Date/Time Scenario Reference Section abort abs access acos [w]addch [w]addstr alarm asctime asin assert atan atan2 atexit atof atoi, atol atoq, atoll (Alpha only) basename bcmp bcopy box brk bsearch btowc bzero cabs calloc catclose catgets catopen ceil cfree chdir chmod chown [w]clear clearerr clearok clock close closedir [w]clrattr [w]clrtobot [w]clrtoeol confstr cos cosh creat [no]crmode ctermid ctime cuserid DECC$CRTL_INIT decc$fix_time decc$from_vms decc$match_wild decc$record_read decc$record_write decc$set_reentrancy decc$to_vms decc$translate_vms [w]delch delete [w]deleteln delwin difftime dirname div drand48 dup, dup2 [no]echo ecvt endwin erand48 [w]erase execl execle execlp execv execve execvp exit, _exit exp fabs fclose fcvt fdopen feof ferror fflush ffs fgetc fgetname fgetpos fgets fgetwc fgetws fileno floor fmod fopen fp_class, fp_classf, fp_classl (Alpha only) fpathconf fprintf fputc fputs fputwc fputws fread free freopen frexp fscanf fseek fsetpos fstat fsync ftell ftime ftruncate ftw fwait fwide fwrite fwprintf fwscanf gcvt getc [w]getch getchar getclock getcwd getdtablesize getegid getenv geteuid getgid getitimer getlogin getname getopt getpagesize getpid getppid getpwnam getpwuid gets [w]getstr gettimeofday getuid getw getwc getwchar getyx gmtime gsignal hypot iconv iconv_close iconv_open [w]inch index initscr initstate [w]insch [w]insertln [w]insstr isalnum isalpha isapipe isascii isatty iscntrl isdigit isgraph islower isprint ispunct isspace isupper iswalnum iswalpha iswcntrl iswctype iswdigit iswgraph iswlower iswprint iswpunct iswspace iswupper iswxdigit isxdigit jrand48 kill labs lcong48 ldexp ldiv leaveok localeconv localtime log, log10 longjmp longname lrand48 lseek lwait malloc mblen mbrlen mbrtowc mbstowcs mbtowc mbsinit mbsrtowcs memccpy memchr memcmp memcpy memmove memset mkdir mkstemp mktemp mktime mmap modf [w]move mprotect mrand48 msync munmap mv[w]addch mv[w]addstr mvcur mv[w]delch mv[w]getch mv[w]getstr mv[w]inch mv[w]insch mv[w]insstr mvwin newwin nice [no]nl nl_langinfo nrand48 open opendir overlay overwrite pause pathconf pclose perror pipe popen pow printf [w]printw putc putchar putenv puts putw putwc putwchar qabs, llabs (Alpha only) qdiv, lldiv (Alpha only) qsort raise rand random [no]raw read readdir realloc [w]refresh remove rename rewind rewinddir rindex rmdir sbrk scanf [w]scanw scroll scrollok seed48 seekdir [w]setattr setbuf setenv setgid setitimer setjmp setlocale setstate setuid setvbuf sigaction sigaddset sigblock sigdelset sigemptyset sigfillset sigismember siglongjmp sigmask signal sigpause sigpending sigprocmask sigsetjmp sigsetmask sigstack (VAX only) sigsuspend sigvec sin sinh sleep sprintf sqrt srand srand48 srandom sscanf ssignal [w]standend [w]standout stat strcasecmp strcat strchr strcmp strcoll strcpy strcspn strdup strerror strfmon strftime strlen strncasecmp strncat strncmp strncpy strnlen strpbrk strptime strrchr strsep strspn strstr strtod strtok strtol strtoq, strtoll (Alpha only) strtoul strtouq, strtoull (Alpha only) strxfrm subwin swab swprintf swscanf sysconf system tan tanh telldir tempnam time times tmpfile tmpnam toascii tolower _tolower touchwin toupper _toupper towctrans towlower towupper truncate ttyname tzset ualarm umask uname ungetc ungetwc unsetenv usleep VAXC$CRTL_INIT VAXC$ESTABLISH va_arg va_count va_end va_start_1, va_start vfork vfprintf vfwprintf vprintf vswprintf vwprintf vsprintf wait wait3 wait4 waitpid wcrtomb wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcslen wcsncat wcsncmp wcsncpy wcspbrk wcsrchr wcsrtombs wcsspn wcsstr wcstod wcstok wcstol wcstombs wcstoul wcswcs wcswidth wcsxfrm wctob wctomb wctrans wctype wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wrapok write wscanf A DEC C Socket Routine Reference A.1 Porting Considerations A.1.1 Calling an IPC Routine from an AST State A.1.2 Calling from KERNEL or EXEC Modes A.1.3 Event Flags A.1.4 Suppressing DEC C Compilation Warnings A.1.5 Header Files A.2 DEC C Structures A.3 Internet Protocols A.3.1 Transmission Control Protocol A.3.2 User Datagram Protocol A.4 errno Values A.5 h_errno Values A.6 Relationship Between errno and h_errno A.7 TCP/IP Interface Enhancements A.8 Summary of Socket Routines A.8.1 Basic Communication Routines A.8.2 Auxiliary Communication Routines A.8.3 h_errno Support Routines A.8.4 Communication Support Routines accept bind close connect decc$get_sdc endhostent endnetent endprotoent endservent gethostaddr gethostbyaddr gethostbyname gethostent gethostname getnetbyaddr getnetbyname getnetent getpeername getprotobyname getprotobynumber getprotoent getservbyname getservbyport getservent getsockname getsockopt herror hstrerror hostalias htonl htons inet_addr inet_lnaof inet_makeaddr inet_netof inet_network inet_ntoa ioctl listen ntohl ntohs read recv recvfrom recvmsg select send sendmsg sendto sethostent setnetent setprotoent setservent setsockopt shutdown socket socket_fd vaxc$get_sdc write A.9 Programming Examples B Version-Dependency Tables C Prototypes Duplicated to Non-Standard Headers