home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / emxdev8f.zip / EMXDEV.DOC < prev    next >
Text File  |  1993-01-03  |  397KB  |  9,622 lines

  1. ===============================================================================
  2. emxdev.doc        emx 0.8f     APPLICATION DEVELOPER'S GUIDE        03-Jan-1993
  3. ===============================================================================
  4.                                      Copyright (c) 1990-1993 by Eberhard Mattes
  5.  
  6. Table of Contents
  7. =================
  8.  
  9. 1    Introduction
  10. 2    Managing bound .exe files with emxbind
  11. 2.1    Creating an .exe file
  12. 2.2    Changing the type of an .exe file
  13. 2.3    Extracting the a.out file from a bound .exe file
  14. 2.4    Displaying and changing the emx options of a bound .exe file
  15. 2.5    Updating emx.exe in a bound .exe file
  16. 2.6    Stripping the symbol table from a bound .exe file
  17. 2.7    Module definition files
  18. 3    Using emx options
  19. 4    More emx utilities
  20. 4.1    updt
  21. 4.2    emximp
  22. 4.3    emxomf
  23. 4.4    emxomfld
  24. 4.5    emxomfar
  25. 4.6    emxcat
  26. 4.7    emxrev
  27. 5    Library functions and system calls
  28. 5.1    Preliminary notes
  29. 5.2    Overview
  30. 5.3    Library reference: functions
  31. 5.4    Library reference: variables
  32. 5.5    termio
  33. 5.6    System calls
  34. 6    Hints for porting Unix programs to emx
  35. 7    Creating OS/2 programs
  36. 7.1    Calling OS/2 API functions
  37. 7.2    Importing from OS/2 DLLs
  38. 7.3    Creating Presentation Manager applications using ld and emxbind
  39. 7.4    Creating Presentation Manager applications using emxomf and LINK386
  40. 7.5    Creating dynamic link libraries
  41. 7.5.1    Creating dynamic link libraries that use emxlibc.dll
  42. 7.5.2    Creating dynamic link libraries that don't use emxlibc.dll
  43. 7.6    Using the DLL version of the C library
  44. 7.7    Creating multi-threaded programs
  45. 7.8    Calling 16-bit functions
  46. 8    Customizing
  47. 8.1    Increasing the heap size
  48. 8.2    Increasing the stack size
  49. 8.3    Increasing the number of files
  50. 9    Debugger (DOS)
  51. 10   Executable file format
  52. 11   Known problems
  53.  
  54.  
  55. 1 Introduction
  56. ==============
  57.  
  58. This document describes how to use emx utilities to create programs
  59. running under emx and how to create OS/2 programs with the emx
  60. utilities.
  61.  
  62. The GNU utilities are described in gnudev.doc.
  63.  
  64. There are three methods for creating executable files:
  65.  
  66. (E1)  using ld and emxbind
  67.  
  68. (E2)  using emxomf, emxomfld and LINK386, the program will use the
  69.       emx.dll dynamic link library for performing system calls
  70.  
  71. (E3)  using emxomf, emxomfld and LINK386, the program will be linked
  72.       with a system call library
  73.  
  74. The assembler creates a Unix-style a.out object file (.o file).  When
  75. using method (E1), .o files created by the assembler are linked by a
  76. Unix-style linker with Unix-style libraries (.a files) to create a
  77. Unix-style a.out file.  Then, emxbind is used to turn this file into
  78. an .exe file that can be executed under both OS/2 2.0 and DOS.  Using
  79. method (E1) enables core dumps and fork().  Moreover, programs created
  80. with method (E1) can be debugged using GDB, the GNU debugger.
  81. Programs created using method (E1) use emx (emx.dll under OS/2,
  82. emx.exe under DOS) for system calls.
  83.  
  84. When using method (E2), the .o files created by the assembler are
  85. converted to Object Module Formats files (.obj files).  These files
  86. are linked with the OS/2 linker LINK386.  The libraries are .LIB
  87. files.  emxomfld is a front end to LINK386 which converts the ld
  88. command line to a LINK386 command line.  Programs created with method
  89. (E2) cannot create core dumps, cannot call fork() and cannot be
  90. debugged with GDB.  Method (E2) works only under OS/2 2.0 and creates
  91. programs that work only under OS/2 2.0.  Files created with method
  92. (E2) are usually smaller.  The emx.dll dynamic link library is used
  93. for system calls.  The -Zomf option of GCC selects method (E2).
  94.  
  95. When using method (E3), the program won't call the emx.dll dynamic
  96. link library.  A system call library (emx emulator) is linked to the
  97. program.  The system call library maps system calls to OS/2 API calls.
  98. Only a subset of the emx system calls is available with method (E3).
  99. For instance, termio is not available.  Functions which are not
  100. available or are limited with method (E3) are marked [*] in the
  101. library reference.  Use a module definition file and the STACKSIZE
  102. statement to set the stack size.  The default stack size is 8192
  103. bytes, which is too small.  Note that the command line arguments and
  104. the complete environment are copied to the stack on startup.
  105.  
  106.   Method                         |  (E1)        |  (E2)       |  (E3)
  107.   -------------------------------+--------------+-------------+-------------
  108.   GCC options                    |              | -Zomf       | -Zomf -Zsys
  109.   Object file format             | a.out        | OMF         | OMF
  110.   Object file name extension     | .o           | .obj        | .obj
  111.   Library file name extension    | .a           | .lib        | .lib
  112.   Executable file format         | LX & a.out   | LX          | LX
  113.   Object files converted by      | N/A          | emxomf      | emxomf
  114.   Executable files converted by  | emxbind      | N/A         | N/A
  115.   Linker                         | ld           | LINK386     | LINK386
  116.   Librarian                      | ar           | LIB         | LIB
  117.   Minimal set of libraries       | libc libgcc  | libc libgcc | libc libgcc
  118.                                  |              | libemx1     | libsys libos2
  119.                                  |              | libemx2     |
  120.   Methods for importing          | (I1) (I2)    | (I3)        | (I3)
  121.   Can link with OMF libraries    | NO (note 1)  | NO (note 1) | YES
  122.   Debugger                       | GDB          | N/A         | N/A
  123.   emx.dll required at run time   | YES          | YES         | NO
  124.   Library support                | +++          | ++          | +
  125.   `collect' required for C++     | NO           | NO          | NO
  126.   Core dumps                     | YES          | NO          | NO
  127.   Size overhead                  | big          | none        | (note 2)
  128.   Programs run under DOS         | YES          | NO          | NO
  129.   Can create DLLs                | YES (note 3) | YES         | YES
  130.   EMXOPT environment variable    | YES          | YES         | NO
  131.   -Zmt supported                 | YES          | YES         | NO
  132.   Use -lemxio for port I/O       | NO (note 4)  | YES         | YES
  133.  
  134. Note 1: import libraries can be used after conversion with emximp
  135.  
  136. Note 2: depends on the set of syscalls used by the program
  137.  
  138. Note 3: not recommended
  139.  
  140. Note 4: -lemxio is required when using -Zmt.  Without -Zmt, libemxio
  141.         should not be used
  142.  
  143. Programs created with method (E1) or (E2) can use emxlibc.dll, a
  144. dynamic link library containing the C library.  Use the -Zmt option to
  145. make a program that uses emxlibc.dll.  Programs which use emxlibc.dll
  146. don't run under DOS.  Both emxlibc.dll and emx.dll are required.
  147. There are two advantages of using emxlibc.dll:
  148.  
  149. - thread-safe C library functions (well, ...)
  150.  
  151. - _beginthread() and _endthread() are available
  152.  
  153. - reduced executable size
  154.  
  155. - programs don't have to be re-linked when the C library is changed.
  156.  
  157. Use -Zomf -Zmt to minimize the size of the executable file.
  158.  
  159. Please note that you should change the name of emxlibc.dll if you want
  160. to distribute your program with a modified version of that dynamic
  161. link library.
  162.  
  163. For using floating point arithmetic, a coprocessor is required (80387
  164. or i486).  All exceptions are masked, that is, computation continues
  165. with +#INF, -#INF, +#NAN or -#NAN after an error.
  166.  
  167. A 387 coprocessor is not required for doing floating point arithmetic
  168. under OS/2 2.0.  Under DOS, a 387 coprocessor (or i486) is required
  169. for doing floating point arithmetic.
  170.  
  171. Under OS/2, a core dump file will be written if a protection violation
  172. (exception 0xc0000005) occurs.  You can later debug the program using
  173. the .exe file and the core dump file.  The name of the core dump file
  174. is `core', and it is put into the current working directory.  Use the
  175. -c emx option to suppress writing a core dump file.  When linking a
  176. program using method (E2) or (E3), core dump files are not written by
  177. that program.
  178.  
  179. OS/2 and DOS support both the forward slash and the backslash for
  180. separating directories.  Unix utilities usually treat backslash
  181. specially, therefore you should use forward slash.  This document uses
  182. forward slash unless an OS/2 or DOS command is shown (cmd.exe and
  183. command.com use backslashes).
  184.  
  185.  
  186. File name extensions (the list is incomplete):
  187.  
  188.     a                       Unix-style library (archive)
  189.     bat                     DOS batch file
  190.     c                       C source file
  191.     cc                      C++ source file
  192.     cmd                     OS/2 batch file
  193.     def                     Module definition file
  194.     doc                     Documentation file
  195.     dll                     Dynamic link library
  196.     dvi                     Device independent file, created by TeX
  197.     exe                     Executable file
  198.     h                       C include file (header file)
  199.     i<digits>               Split GNU info file
  200.     imp                     emx import list file
  201.     inf                     GNU info file (use `info' for reading)
  202.     lib                     OMF library
  203.     m                       Objective C source file
  204.     map                     Map file, created by LINK386
  205.     o                       Object file (Unix style, a.out)
  206.     obj                     Object file (OMF)
  207.     rc                      Resource script file
  208.     res                     Binary resource file
  209.     s                       Assembler source file
  210.     tex                     TeX (or texinfo) source file
  211.  
  212.  
  213. Directories:
  214.  
  215.     /emx                    Main directory, contains no files
  216.     /emx/bin                Executable files and batch files
  217.     /emx/dll                OS/2 DLL files
  218.     /emx/doc                Documentation
  219.     /emx/include            C header files
  220.     /emx/lib                Libraries
  221.     /emx/new                New .exe files created by the makebin batch file
  222.     /emx/test               Test programs
  223.     /emx/tmp                Temporary directory for building OMF libraries
  224.  
  225.  
  226. 2 Managing bound .exe files with emxbind
  227. ========================================
  228.  
  229. 2.1 Creating an .exe file
  230. -------------------------
  231.  
  232. emxbind binds emx.exe and an emx executable file into one executable
  233. file which runs both under OS/2 2.0 (6.167 or later) and DOS.
  234.  
  235. Usage:
  236.  
  237.     emxbind [-b] [<emxbind_options>] [-c[<core_file>]] [-d<def_file>]
  238.             [-r<res_file>] [-h<heap_size>] [-k<stack_size>
  239.             <emx>[.exe] <input_file> [<output_file>[.exe]] [<emx_options>]
  240.  
  241.     emxbind [-b] [<emxbind_options>] [-c[<core_file>]] [-d<def_file>]
  242.             [-r<res_file>] [-h<heap_size>] <-k<stack_size>
  243.             <input_file> [<emx_options>]
  244.  
  245. -b (optional):
  246.  
  247.     this emxbind command means `bind' and is the default.  If you want
  248.     to use the -s option (strip symbol table), -b cannot be omitted,
  249.     that is, you should type -bs (otherwise, emxbind would perform the
  250.     -s command described below)
  251.  
  252. -c[<core_file>]
  253.  
  254.     combine an a.out file and a core dump file created for that a.out
  255.     file into one program.  This can be used to create a a program
  256.     with preloaded data.  Note that the .exe file will waste lots of
  257.     disk space.  If you don't enter <core_file>, core is used
  258.  
  259. -d[<def_file>]
  260.  
  261.     read the module definition file <def_file>.  The default extension
  262.     is `def'.  If <def_file> is omitted, <input_file> with `def'
  263.     extension is used instead.  See below for details on module
  264.     definition files
  265.  
  266. -k<stack_size>
  267.  
  268.     set the size of the stack object of the executable file.  The
  269.     stack size set by this option is used under OS/2.  The stack size
  270.     is given in KB, the default is 8192 (8 MB).  The stack size must
  271.     be between 20 and 524288 (512 MB).  The stack size should not be
  272.     less than 32 KB.  To let emx.dll allocate and manage a stack
  273.     object, use -k0 (this is not recommended; stack probes are
  274.     required).  You should not use -k without -b, as a -k command is
  275.     planned for a future version of emxbind
  276.  
  277. -r<res_file>
  278.  
  279.     put resources from binary resource file <res_file> (no default
  280.     extension) into the .exe file.  Use `rc -r' to create the binary
  281.     resource file.  Do not use rc to put the resources into the .exe
  282.     file
  283.  
  284. -h<heap_size>
  285.  
  286.     set heap size.  This is the space available for allocation by
  287.     malloc().  The heap size is specified in megabytes (1 to 512).
  288.     The default value is 32
  289.  
  290. <emxbind_options>:
  291.  
  292.     -q  don't display title
  293.  
  294.     -v  display more information: list resources, display path name of
  295.         emxl.exe unless given on command line, display the statements
  296.         in the module definition file that are ignored
  297.  
  298.     -f  set application type to `full screen'.  See also -e command
  299.  
  300.     -p  set application type to `Presentation Manager'.  See also -e
  301.         command
  302.  
  303.     -s  strip symbols (requires -b).  You can also strip the symbol
  304.         table before creating the .exe file by calling strip.exe or
  305.         after creating the .exe file by using the -s emxbind command
  306.  
  307.     -w  set application type to `windowed' (default).  See also -e
  308.         command
  309.  
  310.     Only one of the options -f, -p and -w can be used.  If none of
  311.     these options is used, the application type is taken from the NAME
  312.     statement of the module definition file (-d option).  If no module
  313.     definition file is used, -w is the default.
  314.  
  315. <emx> (optional if no output file is given):
  316.  
  317.     path name of emx (default extension: `exe'), that is emx.exe,
  318.     emxd.exe or emxl.exe.  Using emxl is recommended.  If this
  319.     argument is omitted (in this case the <output_file> argument must
  320.     be omitted as well), the file name from the STUB statement of the
  321.     module definition file is used.  The file is sought in the
  322.     directories listed in the EMXPATH and PATH environment variables.
  323.     If no module definition file is used or if the STUB statement
  324.     isn't used, the file /emx/bin/emxl.exe will be used.  If that file
  325.     doesn't exist, emxl.exe will be sought in the directories listed
  326.     in the EMXPATH and PATH environment variables.  If that fails,
  327.     emxl.exe is sought in the current working directory.  If the -v
  328.     option is given, the path name of emxl.exe will be displayed
  329.     unless a STUB statement is present
  330.  
  331. <input_file>:
  332.  
  333.     path name of the a.out file to be read.  This name sans directory
  334.     part and extension is also used as module name for the .exe file
  335.  
  336. <output_file> (optional):
  337.  
  338.     path name of the bound executable file.  The default extension is
  339.     `exe' unless the LIBRARY statement is used in the module
  340.     definition file.  If LIBRARY is used in the module definition file
  341.     (that is, when you're creating a dynamic link library), the
  342.     default extension is `dll'.  If the <output_file> parameter is
  343.     omitted, the <input_file> parameter will be used instead (do not
  344.     specify an extension for the input file to avoid overwriting the
  345.     input file!)
  346.  
  347. <emx_options> (optional):
  348.  
  349.     emx options to be used when running the bound program.  These
  350.     options will be examined before those given in EMXOPT.  emxbind
  351.     does not completely check the validity of the options.  See `Using
  352.     emx options' for details.
  353.  
  354.     emx options for OS/2 and DOS:
  355.  
  356.     -c   Disable core dumps caused by signals
  357.  
  358.     -h#  Set file handle limit
  359.  
  360.     emx options for DOS:
  361.  
  362.     -a*  Enables dangerous features.
  363.  
  364.     -p   Don't use low memory (lower Megabyte)
  365.  
  366.     -s#  Set stack size (KB)
  367.  
  368.     -C#  Commit memory
  369.  
  370.     -L   Disable preloading of pages from the executable file.
  371.  
  372.     emx options for OS/2:
  373.  
  374.     -f#  Set maximum stack frame size (KB)
  375.  
  376. Example:
  377.  
  378.     emxbind \emx\emxl myprog -s16384 -p
  379.  
  380. This example will bind myprog and emxl.exe into myprog.exe.  The stack
  381. size will be set to 16384 KB (under DOS) if this value is not
  382. overridden by EMXOPT when myprog.exe is run.  The program will be able
  383. to run DOS programs.  This example can be abbreviated to
  384.  
  385.     emxbind myprog -s16384 -p
  386.  
  387. The bound program does not run under DOS versions prior to 3.0.  emx
  388. options cannot be put onto the command line; use EMXOPT instead.
  389.  
  390. Do not compress the bound executable with a program like TINYPROG,
  391. PKLITE, or LZEXE, which makes the program uncompresses itself when
  392. started.
  393.  
  394. emx can be used for running bound .exe files created using the same
  395. version of emx.  spawn() and exec() also work on bound .exe files.
  396.  
  397. The GNU programs GDB, nm, objdump and size (but not strip) have been
  398. modified to work with bound .exe files.
  399.  
  400. You can use the emx loader emxl.exe to save disk space.  When the
  401. bound executable is run, emxl.exe will load emx.exe to run the
  402. program.  There is a small speed penalty due to locating and loading
  403. emx.exe.  As the program name is passed on the command line to
  404. emx.exe, the available length of the command line is reduced if
  405. emxl.exe is used.  The maximum command line length can be used if
  406. emx.exe is bound to the executable.
  407.  
  408. If the EMX environment variable is set, emxl.exe first tries to load
  409. the file specified by that variable.  Use
  410.  
  411.     SET EMX=c:\emx\bin\emx.exe
  412.  
  413. to speed up locating emx.exe.  You can also use emxd.exe this way.
  414.  
  415. If the EMX environment variable is not set or the emx.exe file
  416. specified by EMX could not be loaded, emxl.exe will try emx.exe in the
  417. current working directory, then emx.exe in all directories listed in
  418. the PATH environment variable.
  419.  
  420.  
  421. 2.2 Changing the type of an .exe file
  422. -------------------------------------
  423.  
  424. You can change the application type after creating an .exe file with
  425. emxbind.  For instance, this can be used after creating an .exe file
  426. with GCC.  Exactly one of the options -f, -p and -w must be given.
  427. Note that you can set the application type while creating an .exe file
  428. with the -b command.
  429.  
  430. Usage:
  431.  
  432.     emxbind -e <emxbind_options> <program_file>[.exe]
  433.  
  434. <emxbind_options>:
  435.  
  436.     -q  don't display title
  437.  
  438.     -f  set application type to `full screen'
  439.  
  440.     -p  set application type to `Presentation Manager'
  441.  
  442.     -w  set application type to `windowed'
  443.  
  444.     Exactly one of the options -f, -p and -w must be given.
  445.  
  446. <program_file>:
  447.  
  448.     path name of the bound .exe file to be changed.  The default
  449.     extension is `exe'
  450.  
  451. Example:
  452.  
  453.     gcc -o myprog.exe myprog.c
  454.     emxbind -ep myprog
  455.  
  456. Alternatively, you can create a file named myprog.def containing
  457.  
  458.     NAME WINDOWAPI
  459.  
  460. and invoke gcc with the following command line:
  461.  
  462.     gcc -o myprog.exe myprog.def
  463.  
  464.  
  465. 2.3 Extracting the a.out file from a bound .exe file
  466. ----------------------------------------------------
  467.  
  468. Usage:
  469.  
  470.     emxbind -x [<emxbind_options>] <input_file>[.exe] <output_file>
  471.  
  472. <emxbind_options>:
  473.  
  474.     -q  don't display title
  475.  
  476. <input_file>:
  477.  
  478.     path name of a bound .exe file to be read.  The default extension
  479.     is `exe'
  480.  
  481. <output_file>:
  482.  
  483.     path name of the a.out file to be created
  484.  
  485. After extracting the a.out file from an .exe file which was created
  486. using a core dump file, you should not use that file for creating an
  487. .exe file.  Use the -u command if you want to replace emx.exe,
  488. emxl.exe or emxd.exe contained in a bound .exe file.
  489.  
  490. The relocation information is removed by emxbind while binding an .exe
  491. file.  Therefore, the a.out file extracted from a bound .exe file does
  492. not include relocation information.  This applies to dynamic link
  493. libraries and a.out files linked with the -R option of ld.
  494.  
  495.  
  496. 2.4 Displaying and changing the emx options of a bound .exe file
  497. ----------------------------------------------------------------
  498.  
  499. emxbind also can display or change the emx options of a bound .exe
  500. file.  Note that the -i option was called -s in previous versions of
  501. emxbind.
  502.  
  503. Usage (showing options):
  504.  
  505.     emxbind -i [<emxbind_options>] <program_file>[.exe]
  506.  
  507. Usage (altering options):
  508.  
  509.     emxbind -a [<emxbind_options>] <program_file>[.exe] [<emx_options>]
  510.  
  511. <emxbind_options>:
  512.  
  513.     -q  don't display title
  514.  
  515. <program_file>:
  516.  
  517.     path name of a bound .exe file to be read or changed,
  518.     respectively.  The default extension is `exe'
  519.  
  520. <emx_options>:
  521.  
  522.     remove the options if empty, otherwise put these options into the
  523.     .exe file (see also -b command)
  524.  
  525.  
  526. 2.5 Updating emx.exe in a bound .exe file
  527. -----------------------------------------
  528.  
  529. emxbind also can replace the DOS loader in an existing bound .exe
  530. file.  You should use this only if you can't rebuild the .exe file
  531. because you don't have the a.out file.  Note that you usually have to
  532. re-link your program when using a new release of emx due to
  533. differences in the system interface.
  534.  
  535. Usage:
  536.  
  537.     emxbind -u [<emxbind_options>] <emx>[.exe] <program_file>[.exe]
  538.  
  539. <emxbind_options>:
  540.  
  541.     -q  don't display title
  542.  
  543. <emx>:
  544.  
  545.     path name of emxd.exe, emx.exe or emxl.exe.  This DOS loader is
  546.     copied to the <program_file>.  The default extension is `exe'.
  547.  
  548. <program_file>:
  549.  
  550.     path name of the bound .exe file to be changed.  The default
  551.     extension is `exe'.  Better make a backup copy of the file before
  552.     using emxbind -u.
  553.  
  554.  
  555. 2.6 Stripping the symbol table from a bound .exe file
  556. -----------------------------------------------------
  557.  
  558. emxbind can also be used to remove the symbol table from a bound .exe
  559. file (strip.exe cannot be used on .exe files).  You can also strip the
  560. symbol table while creating the .exe file by using the -s option with
  561. the -b command.
  562.  
  563. Usage:
  564.  
  565.     emxbind -s [<emxbind_options>] <program_file>[.exe]
  566.  
  567. <emxbind_options>:
  568.  
  569.     -q  don't display title
  570.  
  571. <program_file>:
  572.  
  573.     path name of the bound .exe file to be changed.  The default
  574.     extension is `exe'.  Better make a backup copy of the file before
  575.     using emxbind -s.
  576.  
  577.  
  578.  
  579. 2.7 Module definition files
  580. ---------------------------
  581.  
  582. emxbind reads LINK386 compatible module definition files.  In the
  583. following list of available statements, optional parts are enclosed in
  584. brackets.  Case is ignored for keywords (though IBM says you should
  585. use upper case for keywords).  See below a list of keywords.  You
  586. cannot use keywords for function names, module names etc.  In case of
  587. a conflict, enclose the offending name in single or double quotes.
  588. Quotes are also required if a name contains a special character such
  589. as blank, tab, `@', `=', `.' or `;'.  Lines starting with a semicolon
  590. are treated as comment lines and are completely ignored.  Numbers can
  591. be given in decimal, octal or hexadecimal, using C syntax.
  592.  
  593.   CODE ...
  594.  
  595.     Ignored.
  596.  
  597.   DATA ...
  598.  
  599.     Ignored.
  600.  
  601.   DESCRIPTION 'text'
  602.  
  603.     Put a text into the .EXE or .DLL file.  The text must be enclosed
  604.     in single or double quotes.  To include a single quote in single
  605.     quotes or a double quote in double quotes, simply enter the quote
  606.     twice.  The text will be put at the start of the nonresident name
  607.     table, which is put at the end of the .EXE or .DLL file.
  608.     Typically, DESCRIPTION is used to insert a copyright message.
  609.  
  610.     Example:
  611.  
  612.       DESCRIPTION 'HAL9000 -- Copyright (c) 2001 by Space Odyssey Inc.'
  613.  
  614.   EXETYPE ...
  615.  
  616.     Ignored.
  617.  
  618.   EXPORTS entryname [=internalname] [@ordinal [RESIDENTNAME]]
  619.  
  620.     Make a function visible outside the .EXE or .DLL file.  All entry
  621.     points of a dynamic link library must be exported using EXPORTS.
  622.     Exporting entry points of .EXE files is less common.
  623.  
  624.     Following the EXPORTS keyword, you can enter any number of
  625.  
  626.       entryname [=internalname] [@ordinal [RESIDENTNAME]]
  627.  
  628.     lines, one for each entrypoint.  entryname is the name of the
  629.     function as made visible outside of the .EXE or .DLL file.
  630.     entryname is always converted to upper case.  internalname is the
  631.     name of the function as defined in your program.  If =internalname
  632.     is omitted, it is assumed to be identical to entryname.
  633.     internalname is case sensitive.  Exported functions not only have
  634.     a name (entryname), they also have an ordinal number, the position
  635.     within the name table.  Using ordinal numbers when importing saves
  636.     space and is supposed to be faster.  You can assign a specific
  637.     ordinal number to an exported function by entering @ordinal.
  638.     ordinal is the ordinal number to be used (1 to 65535).  If
  639.     @ordinal is not given, emxbind chooses an unused ordinal number,
  640.     but you won't know the ordinal number and therefore cannot use it
  641.     for importing.  If @ordinal is specified, entryname is by default
  642.     put into the nonresident name table, which is not kept in memory
  643.     while the .EXE or .DLL file is running or loaded, respectively.
  644.     This saves space.  To put entryname into the resident name table,
  645.     enter RESIDENTNAME.  Then, OS/2 will keep entryname in memory
  646.     while the .EXE or .DLL file is running or loaded, respectively.
  647.     This saves time.
  648.  
  649.     Example: EXPORTS my_qsort=qsort1 @1 RESIDENTNAME
  650.                      my_hsort
  651.  
  652.   HEAPSIZE number
  653.  
  654.     Ignored.  number can be MAXVAL as well.
  655.  
  656.   IMPORTS [internalname=]modulename.entry
  657.  
  658.     Ignored.  Use emximp instead.
  659.  
  660.   LIBRARY [libraryname] [initialization] [termination]
  661.  
  662.     Create dynamic link library (.DLL file).  If LIBRARY is used, it
  663.     must be the first statement of the module definition file.
  664.     libraryname is the name of the module.  The name is the first
  665.     entry of the resident name table and must match the base name of
  666.     the DLL file.  If libraryname is not specified, the name of the
  667.     a.out file sans directory and extension is used.  initialization
  668.     can be either INITGLOBAL or INITINSTANCE.  INITGLOBAL causes the
  669.     library initialization function to be called when the DLL is
  670.     initially loaded into memory.  INITINSTANCE causes the library
  671.     initialization function to be called each time a process loads the
  672.     DLL and each time a process referencing the DLL is started.
  673.     termination can be either TERMGLOBAL or TERMINSTANCE.  TERMGLOBAL
  674.     causes the library termination function to be called when the DLL
  675.     is no longer used by any process.  TERMINSTANCE causes the library
  676.     termination function to be called each time a process frees the
  677.     DLL and each time a process referencing the DLL terminates.
  678.  
  679.     Currently, TERMGLOBAL seems to cause the termination function to
  680.     be called not at all.
  681.  
  682.     See _DLL_InitTerm() for details about the library initialization
  683.     function and the library termination function.
  684.  
  685.     If initialization and termination are omitted, INITGLOBAL and
  686.     TERMGLOBAL are used.  If one of initialization and termination is
  687.     specified, the other one defaults to an appropriate value, as
  688.     shown by the following table:
  689.  
  690.                           | (no termination) | TERMGLOBAL   | TERMINSTANCE
  691.     ----------------------+------------------+--------------+-------------
  692.       (no initialization) | INITGLOBAL       | INITGLOBAL   | INITINSTANCE
  693.                           | TERMGLOBAL       | TERMGLOBAL   | TERMINSTANCE
  694.     ----------------------+------------------+--------------+-------------
  695.       INITGLOBAL          | INITGLOBAL       | INITGLOBAL   | INITGLOBAL
  696.                           | TERMGLOBAL       | TERMGLOBAL   | TERMINSTANCE
  697.     ----------------------+------------------+--------------+-------------
  698.       INITINSTANCE        | INITINSTANCE     | INITINSTANCE | INITINSTANCE
  699.                           | TERMINSTANCE     | TERMGLOBAL   | TERMINSTANCE
  700.  
  701.     Examples: LIBRARY
  702.               LIBRARY INITINSTANCE
  703.               LIBRARY mylib
  704.               LIBRARY mylib INITINSTANCE TERMGLOBAL
  705.  
  706.   NAME [appname] [apptype] [NEWFILES]
  707.  
  708.     Create a .EXE file.  If NAME is used, it must be the first
  709.     statement.  appname is the name of the module.  The name is the
  710.     first entry of the resident name table.  If appname is not
  711.     specified, the name of the a.out file sans directory and extension
  712.     is used.  apptype can be one of the following keywords:
  713.  
  714.       NOTWINDOWCOMPAT  the program will run full-screen
  715.  
  716.       WINDOWAPI        the program is a Presentation Manager application
  717.  
  718.       WINDOWCOMPAT     the program will run in a text window
  719.  
  720.     The default is WINDOWCOMPAT.  apptype can be overridden on the
  721.     emxbind command line with the -f, -p and -w options.
  722.  
  723.     The NEWFILES keyword (LONGNAMES is an alias) is ignored, emx
  724.     applications always use long file names.
  725.  
  726.     Examples: NAME WINDOWAPI
  727.               NAME myprog
  728.               NAME myprog NOTWINDOWCOMPAT
  729.  
  730.   OLD 'library'
  731.  
  732.     Ignored.
  733.  
  734.   PROTMODE
  735.  
  736.     Ignored.
  737.  
  738.   SEGMENTS ...
  739.  
  740.     Ignored.
  741.  
  742.   STACKSIZE number
  743.  
  744.     Set the stack size for OS/2 programs.  Always use this statement
  745.     as the default is too small.  The stack size should be 32768 or
  746.     more.  The stack size for DOS programs is controlled by the -s emx
  747.     option.
  748.  
  749.   STUB 'program'
  750.  
  751.     Use program as DOS executable file.  This program is run if the
  752.     .EXE or .DLL file is started under DOS.  program is sought in the
  753.     directories listed in the EMXPATH and PATH environment variables
  754.     unless the file name includes a directory.  If the <emx> argument
  755.     is given on the emxbind command line, the STUB statement is
  756.     ignored.  If <emx> is not given and the STUB statement is not
  757.     present, \emx\bin\emxl.exe is used.  If that file does not exist,
  758.     emxl.exe is sought in the directories listed in the EMXPATH and
  759.     PATH environment variables and in the current working directory.
  760.  
  761.     Example: STUB 'emx.exe'
  762.  
  763.  
  764. Reserved words
  765. --------------
  766.  
  767. The following words are reserved.  You cannot use them as function
  768. names, module names, etc. unless enclosed in quotes.
  769.  
  770.   ALIAS                    INVALID                  PHYSICAL
  771.   BASE                     IOPL                     PRELOAD
  772.   CLASS                    LIBRARY                  PRIVATE
  773.   CODE                     LOADONCALL               PRIVATELIB
  774.   CONFORMING               LONGNAMES                PROTECT
  775.   CONTIGUOUS               MAXVAL                   PROTMODE
  776.   DATA                     MIXED1632                PURE
  777.   DESCRIPTION              MOVABLE                  READONLY
  778.   DEV386                   MOVEABLE                 READWRITE
  779.   DEVICE                   MULTIPLE                 REALMODE
  780.   DISCARDABLE              NAME                     RESIDENT
  781.   DOS4                     NEWFILES                 RESIDENTNAME
  782.   DYNAMIC                  NODATA                   SEGMENTS
  783.   EXECUTEONLY              NOEXPANDDOWN             SHARED
  784.   EXECUTE-ONLY             NOIOPL                   SINGLE
  785.   EXECUTEREAD              NONAME                   STACKSIZE
  786.   EXETYPE                  NONCONFORMING            STUB
  787.   EXPANDDOWN               NONDISCARDABLE           SWAPPABLE
  788.   EXPORTS                  NONE                     TERMGLOBAL
  789.   FIXED                    NONPERMANENT             TERMINSTANCE
  790.   HEAPSIZE                 NONSHARED                UNKNOWN
  791.   HUGE                     NOTWINDOWCOMPAT          VIRTUAL
  792.   IMPORTS                  OBJECTS                  WINDOWAPI
  793.   IMPURE                   OLD                      WINDOWCOMPAT
  794.   INCLUDE                  ORDER                    WINDOWS
  795.   INITGLOBAL               OS2
  796.   INITINSTANCE             PERMANENT
  797.  
  798.  
  799. 3 Using emx options
  800. ===================
  801.  
  802. Under DOS, emx options can be given on the emx command line.  Under
  803. OS/2 and DOS, emx options can also be given in the EMXOPT environment
  804. variable.  Moreover, you can use emxbind to put emx options into the
  805. executable file.  Options given on the emx command line override
  806. options given in EMXOPT.  Options given in EMXOPT override options
  807. stored in the executable file.  The following options are available:
  808.  
  809. -a*  [DOS] Enable dangerous features: -ac makes data and the stack
  810.      executable, -am enables _memaccess(), -aw enables write access to
  811.      all memory areas, -ai enables _portaccess().  By default, only
  812.      the .text section is executable, _memaccess() and _portaccess()
  813.      are disabled.  You can combine letters: for instance, -aim
  814.      enables both _memaccess() and _portaccess(), -aciw enables all
  815.      dangerous features.  Note: -ac is automatically set in programs
  816.      run with P_DEBUG mode of spawn().
  817.  
  818. -c   Disable core dumps caused by signals.  Core dumps created by
  819.      _core() are not disabled.
  820.  
  821. -d   [DOS] Don't use extended memory.  Only low memory (below 1 MB)
  822.      will be used.
  823.  
  824. -e   [DOS] Don't check for 387 coprocessor.  Assume no coprocessor is
  825.      present.
  826.  
  827. -f#  [OS/2] Set maximum stack frame size (KB), minimum: -f4, maximum:
  828.      -f32768, default: -f512.
  829.  
  830. -h#  Set file handle limit.  Under DOS, the DOS file handle limit for
  831.      the emx process is set to #.  The number # must be between 10 and
  832.      255.  This option is ignored for DOS versions earlier than 3.30.
  833.      This option does not change the emx limit for the number of files
  834.      per process -- that limit is always 40.  Under OS/2, the file
  835.      handle limit for the current process is set to #.  The number #
  836.      must be between 10 and 255.
  837.  
  838. -m#  [DOS] Select machine.  -m1 selects Fujitsu FMR70 (not implemented
  839.      yet), -m2 selects NEC PC-98 (not implemented yet), -m3 selects
  840.      Inboard 386/PC.
  841.  
  842. -o   [DOS] Send the register dump of an exception to stdout.  Without
  843.      -o, the register dump is sent to the CON device.  You need -o for
  844.      redirecting the register dump to a file.
  845.  
  846. -p   [DOS] Don't use low memory (lower Megabyte); use this if the
  847.      program runs a DOS program; not required for emx programs (either
  848.      a.out and bound .exe).  If -p is not given, low memory will be
  849.      used and there won't be enough low memory for running other
  850.      programs.
  851.  
  852. -r*  Prepend drive letter * to absolute path names.  If a path name
  853.      starts with / but does not start with //, /dev/ or /pipe/, *
  854.      followed by a colon will be prepended.  If -rd has been given,
  855.      the file name \mydir\abc will be translated to d:\mydir\abc.
  856.      Note: this option can cause unexpected effects.
  857.  
  858. -s#  [DOS] Set stack size (KB), minimum: -s8, maximum: -s524288,
  859.      default: -s8192.  Note that under DOS, the heap and the stack
  860.      share the same memory area.  The pages not used by the stack are
  861.      available for the heap.  Therefore, you should use -s# if you
  862.      need more than 8 MB of heap and stack.
  863.  
  864. -t   Truncate file names to 8.3 format.
  865.  
  866. -C#  [DOS] Commit memory.  By default, memory is allocated as soon as
  867.      a page is accessed.  If there isn't enough memory (and swap
  868.      space), the process is terminated.  With -C#, memory is allocated
  869.      when creating the process and when enlarging the data segment
  870.      with brk() and sbrk().  If there isn't enough memory (and swap
  871.      space), the process brk(), sbrk(), malloc() etc. return an error.
  872.      The number # specifies how many KB should be allocated for the
  873.      stack.  If # is omitted, 0 is used.  The -C# option is not yet
  874.      completely implemented -- if an allocation request succeeds
  875.      partly, the allocated pages are not freed.
  876.  
  877. -E   [OS/2] Run debuggee in same session.
  878.  
  879. -F   [DOS] Use fast A20 switching.
  880.  
  881. -L   [DOS] Disable preloading of pages from the executable file.  By
  882.      default, the complete code and data areas are read into memory
  883.      before a program is started.  If there is not enough memory, no
  884.      pages are preloaded.  With -L (or if not enough memory is
  885.      available), pages are loaded as soon as they are accessed.
  886.  
  887. -O   [DOS] Override XMS version check.
  888.  
  889. -P   [DOS] Use patched code for A20 switching.
  890.  
  891. -S#  [DOS] Enable the emx kernel debugger.  Use the -S option to
  892.      operate the debugger through the keyboard and display.  If you
  893.      want to debug using a terminal, enter -S1 to use COM1, -S2 to use
  894.      COM2.
  895.  
  896. -V   Display emx version.
  897.  
  898. -Z   [DOS] Don't zero-fill pages.  This option is used for testing.
  899.  
  900.  
  901. 4 emx utilities
  902. ===============
  903.  
  904. 4.1 updt
  905. --------
  906.  
  907. - Copy file if contents have changed:
  908.  
  909.       updt [-v] <source_file> <target_file>
  910.  
  911.   updt copies the source file to the target file if the target file
  912.   does not exist or if the source and target files differ in contents.
  913.   This is used by the makefile for GCC.
  914.  
  915. - Copy file if source file is newer:
  916.  
  917.       updt [-v] -t <source_file> <target_file>
  918.  
  919.   updt copies the source file to the target file if the target file
  920.   does not exist or if the source file is newer than the target file.
  921.   This is used for configuring GCC.
  922.  
  923. The -v option turns on information messages.
  924.  
  925.  
  926. 4.2 emximp
  927. ----------
  928.  
  929. emximp manages files required for importing functions from dynamic
  930. link libraries.
  931.  
  932. Three different methods for importing are used for the two methods of
  933. creating executable files.  When using ld and emxbind, there are two
  934. methods for importing:
  935.  
  936. (I1)  The import library contains a small piece of code for each
  937.       function which loads the AL register with the number of argument
  938.       words and jumps to the imported function.  Information on
  939.       imported functions is stored in tables in the text segment of
  940.       the program.  emxbind reads these tables to creates appropriate
  941.       fixups in the .EXE file.  When an imported function is called
  942.       while running the resulting program under DOS, an error message
  943.       will be displayed and the program will be terminated.  Data
  944.       cannot be imported with method (I1).  You have to use the -R
  945.       option of ld.
  946.  
  947. (I2)  The import library does not contain code.  Instead, it contains
  948.       special symbol table entries, which are copied to the a.out
  949.       file.  One of these entries makes ld create a relocatable output
  950.       file.  emxbind reads the symbol table and creates appropriate
  951.       fixups in the .EXE file.  The AL register isn't loaded with the
  952.       number of argument words.  The program will be aborted
  953.       (protection violation) when an imported function is called under
  954.       DOS.  Importing by name is not supported, the ordinal number
  955.       will always be used.  The -R option of ld is automatically
  956.       turned on when referencing an import definition of type (I2).
  957.  
  958. When using emxomf and LINK386, the standard OS/2 method is used:
  959.  
  960. (I3)  LINK386 reads a .LIB import library or a module definition file
  961.       to create appropriate fixups.  The AL register isn't loaded with
  962.       the number of argument words.  The program won't run under DOS.
  963.  
  964. Methods (I2) and (I3) are recommended unless the dynamic link library
  965. requires the AL register to be loaded with the number of argument
  966. words.  libos2.a uses method (I2).
  967.  
  968. emximp is used to create appropriate files for all these methods.
  969. Information on functions exported by dynamic link libraries is
  970. provided in emx import list files.
  971.  
  972. The following table summarizes the features of the three methods:
  973.  
  974.   Method               |  (I1)  |   (I2)  |   (I3)
  975.   ---------------------+--------+---------+----------
  976.   Linker               |  ld    |   ld    | LINK386
  977.   Import by name       |  YES   |   NO    | YES
  978.   Load AL register     |  YES   |   NO    | NO
  979.   Code overhead        |  YES   |   NO    | NO
  980.   Catch call under DOS |  YES   |   NO    | NO
  981.   Import library type  | .o .a  |   .a    | .lib .def
  982.   Can import functions |  YES   |   YES   | YES
  983.   Can import data      |  NO    |   YES   | YES
  984.   Additive fixups      |  NO    |   YES   | YES
  985.   Linker options       |  -R    |         |
  986.  
  987.  
  988. What is an emx import list file?
  989. --------------------------------
  990.  
  991. An emx import list file defines how functions can be imported from
  992. dynamic link libraries.  For each function, the import list file
  993. defines the name of the function, the module name (that's the name of
  994. the dynamic link library exporting the function), either the ordinal
  995. number or the name of the function as exported by the dynamic link
  996. library, and the number of argument 32-bit words expected by the
  997. function (this is the number of arguments unless structures are passed
  998. by value).
  999.  
  1000. For method (I1), emximp is used to turn an import list file into an
  1001. `.a' import library which can be linked to a program using the ld
  1002. linker.  emximp either creates assembler source files (.s) or
  1003. automatically calls the assembler to create object files (.o).  The
  1004. object files can be packed into a library with the ar program.
  1005.  
  1006. For method (I2), emximp is used to turn an import list file or an OMF
  1007. import library (.lib file) directly into an `.a' import library which
  1008. can be linked to a program using the ld linker.
  1009.  
  1010. For method (I3), emximp can convert an import list file into a module
  1011. definition file or an OMF import library.
  1012.  
  1013. Comments in an import list file are started with a semicolon.  Empty
  1014. lines are ignored.
  1015.  
  1016. For each function you have to put one line into the import list file.
  1017. Here's an example of an import list file:
  1018.  
  1019.     ; myimport.imp
  1020.     DosStartTimer       doscalls 351 3
  1021.     DosStopTimer        doscalls 290 1
  1022.  
  1023. Such a line consists of four components which are separated by one or
  1024. more blanks.  The first word is the name of the function, as used in C
  1025. programs.  The second word is the name of the DLL.  The third word is
  1026. either the ordinal number of the DLL entry or the name of the DLL
  1027. entry.  You have to use ordinal numbers for OS/2 API functions.  The
  1028. fourth word is the number of 32-bit words of arguments expected by the
  1029. function.  This is the number of arguments unless structures are
  1030. passed by value.
  1031.  
  1032. A question mark used as forth word is equivalent to using the number
  1033. 0.  A question mark should be used if the number of arguments is
  1034. unknown or if the entry point is not a function (data can also be
  1035. exported).  Using a question mark causes a warning when creating files
  1036. for method (I1).
  1037.  
  1038. An `R' used as forth word causes the AL register not to be loaded with
  1039. method (I1) -- this is used for functions which expect an argument in
  1040. the EAX register.
  1041.  
  1042. An `F' used as forth word specifies a 16-bit function.  emximp appends
  1043. `_16_' in front of the function name to notify emxbind and emxomf of
  1044. the 16-bitness of the function.  References to symbols starting with
  1045. _16_ are fixed up by 16:16 far pointers.
  1046.  
  1047.  
  1048. Creating an emx import list file from an OMF import library (.lib file)
  1049. -----------------------------------------------------------------------
  1050.  
  1051. emximp -o <output_file>.imp <input_file>.lib ...
  1052.  
  1053. <output_file> is the name of the emx import list file to be created.
  1054. The name must end with `.imp'.  <input_file> is the name of an
  1055. existing import library file.  The name must end with `.lib'.  You can
  1056. give one or more input file names on the command line.
  1057.  
  1058. As the number of argument words of the functions cannot be derived
  1059. from the import library, a question mark instead of a number for the
  1060. number of argument words is written to the import list file.
  1061.  
  1062.  
  1063. Creating an emx import list file from a module definition file (.def file)
  1064. --------------------------------------------------------------------------
  1065.  
  1066. emximp -o <output_file>.imp <input_file>.def
  1067.  
  1068. <output_file> is the name of the emx import list file to be created.
  1069. The name must end with `.imp'.  <input_file> is the name of an
  1070. existing module definition file.  The name must end with `.def'.  You
  1071. can give only one input file name.
  1072.  
  1073. As the number of argument words of the functions cannot be derived
  1074. from the module definition file, a question mark instead of a number
  1075. for the number of argument words is written to the import list file.
  1076.  
  1077.  
  1078. Creating an emx import library for method (I1)
  1079. ----------------------------------------------
  1080.  
  1081. emximp [-a<assembler>] [-b<base_name>|<prefix_length>] [-p<module>]...
  1082.        [-s] <input_file>.imp ...
  1083.  
  1084. <input_file> is the name of the import list file.  The name must end
  1085. with `.imp'.  You can give one or more input file names on the command
  1086. line.
  1087.  
  1088. The names of the output files are either taken from the import list
  1089. file or automatically generated by emximp.  A line in starting with
  1090. `+' starts a new assembly language file or object file (module).  The
  1091. name of the output file is given after the `+':
  1092.  
  1093.     +os2mem1.s          ; start a new output file
  1094.  
  1095. This feature is used only for method (I1).  All the functions defined
  1096. in one module are linked if at least one of the functions is
  1097. referenced.
  1098.  
  1099. It's possible to let emximp automatically write one file per function.
  1100. The output file names are constructed by appending the ordinal number
  1101. or a sequential number to a fixed prefix or to a prefix of the DLL
  1102. name.  To let emximp automatically choose output file names, use the
  1103. -b command line option.  If -b is given, the import list file must not
  1104. contain lines starting with `+'.  The argument of the -b option is
  1105. either a number or a string.  If the argument is a string, that string
  1106. is used as base name of the output files If the argument is a number,
  1107. that many characters are taken from the start of each DLL name to
  1108. create the base name of the output file.  A number is appended to the
  1109. base name.  If -s is given, a sequential number is appended, starting
  1110. with the number 1.  The number is incremented for each output file.
  1111. If -s is not given, the ordinal number of the function is appended;
  1112. giving entry names instead of ordinal numbers in the import list file
  1113. is not allowed for that reason.  Note that appending ordinal numbers
  1114. to the names may cause problems (output for different functions
  1115. written to the same file) if multiple DLLs are used in the import list
  1116. file and the argument of the -b option is a string (or too small a
  1117. number to make the prefixes unique).  These problems also occur if the
  1118. import list file defines multiple functions to refer to the same entry
  1119. point.  The extension of the output files is `.o' if the -a option is
  1120. used, `.s' otherwise.
  1121.  
  1122. By default, emximp creates assembler source files.  emximp can
  1123. automatically call an assembler to assemble the output files.  This
  1124. feature is turned on by the -a command line option.  The argument of
  1125. the -a option is the name of the assembler (there must be no blanks
  1126. between -a and the argument).  If the argument is omitted, `as' is
  1127. used.  The default extension is .exe, the program will be sought in
  1128. the directories listed in the PATH environment variable.
  1129.  
  1130. The object files will have the same name as the assembler source
  1131. files, with the `.s' extension replaced by `.o'.
  1132.  
  1133. Under OS/2, the assembly language files are not actually written, a
  1134. pipe is used instead.  Under DOS, the assembly language files created
  1135. by emximp will be deleted automatically after running the assembler.
  1136.  
  1137. To save space in the executable file, DLL names which are often used
  1138. should be put into separate files, see above for an example.  Use the
  1139. -p option of emximp to use separate files for the DLL names.  The
  1140. argument of the -p option is the name of the DLL.  emximp prepends
  1141. `__os2_' to the DLL name for making the label used for referencing the
  1142. DLL name.  You can use multiple -p option.  Here's how to write a
  1143. separate file which defines a DLL name:
  1144.  
  1145.             .globl  __os2_pmgpi
  1146.             .text
  1147.     __os2_pmgpi:
  1148.             .asciz  "PMGPI"
  1149.  
  1150. This file declares the DLL name `PMGPI'.  Use the `-p pmgpi' option of
  1151. emximp to tell emximp to create code that references this file.
  1152.  
  1153.  
  1154. Technical details:
  1155.  
  1156. Let's examine the .s file created by emximp.exe for the
  1157. DosSelectSession function.
  1158.  
  1159. 1)        .globl    _DosSelectSession
  1160. 2)        .align    2, 144
  1161. 3)     _DosSelectSession:
  1162. 4)             movb    $1, %al
  1163. 5)      1:    jmp    __os2_bad
  1164. 6)      2:    .long    1, 1b+1, L1, 38
  1165. 7)      L1:    .asciz    "sesmgr"
  1166. 8)          .stabs  "__os2dll", 23, 0, 0, 2b
  1167.  
  1168. Line 1 is obvious: it exports _DosSelectSession from libos2.a so that
  1169. ld will link this module when _DosSelectSession is referenced.
  1170.  
  1171. Line 2 is a speed hack: the 386 performs much better when jumping to
  1172. an address which is an integral multiple of 4.
  1173.  
  1174. Line 3 declares _DosSelectSession.  Your program calls this code when
  1175. calling DosSelectSession.
  1176.  
  1177. Line 4 stores the number of arguments in the AL register (or rather,
  1178. the number of argument 32-bit words).
  1179.  
  1180. Line 5 jumps to __os2_bad which displays an error message and stops
  1181. execution.  This is what happens if you run the program on DOS.
  1182.  
  1183. Line 6 creates a small table which is read by emxbind: It consists of
  1184. four words:
  1185.  
  1186.  - a word of flag bits.  Currently, only bit 0 is defined: it's 0 for
  1187.    import by name, 1 for import by ordinal.
  1188.  
  1189.  - the address of the word to be fixed up for referencing the DLL.
  1190.    `1b+1' means `local label 1, looking backwards, add one to
  1191.    address'.  Therefore, the address used by the JMP instruction is
  1192.    used.
  1193.  
  1194.  - a pointer to the name of the module (null-terminated ASCII string).
  1195.    For often used names the pointer should point to a string in a
  1196.    separate, common module to save space, see the -p option.
  1197.  
  1198.  - the ordinal number or a pointer to the name of the entry point
  1199.    (null-terminated ASCII string), respectively, depending on bit 0 of
  1200.    the flags word.
  1201.  
  1202. Line 7 defines the module name pointed to by the table.
  1203.  
  1204. Line 8 is the tricky part: it contains a special symbol table entry to
  1205. make ld build a table named __os2dll which contains pointers to all
  1206. the small tables (2b is the address of the small table).  See also
  1207. crt0.s, where the table is initialized.  crt0 contains a pointer to
  1208. the table in a fixed location so that emxbind can find the table of
  1209. pointers, read all the small tables (as described above) and create
  1210. the necessary OS/2 fixups.
  1211.  
  1212.  
  1213. Creating an a.out import library for method (I2)
  1214. ------------------------------------------------
  1215.  
  1216. emximp -o <output_file>.a <input_file>.imp ...
  1217. emximp -o <output_file>.a <input_file>.lib ...
  1218.  
  1219. <output_file>.a is the name of the archive file to be created.  The
  1220. name must end with `.a'.
  1221.  
  1222. <input_file>.imp is the name of an emx import list file.  The name
  1223. must end with `.imp'.
  1224.  
  1225. <input_file>.lib is the name of an import library (OMF).  The name
  1226. must end with `.lib'.  Modules in the input files which are not import
  1227. definitions are ignored.
  1228.  
  1229. You can give one or more input file names on the command line; all
  1230. input file must be of the same type, either `.imp' or `.lib'.
  1231.  
  1232. All import records of the input files are converted to import modules
  1233. for method (I2).  After creating the output file, you should run `ar
  1234. s' on the output file to increase linking efficiency.
  1235.  
  1236. Technical details:
  1237.  
  1238. A member named `__.IMPORT' is added to the archive.  GNU ld (the one
  1239. ported to emx) has been patched to turn on relocatable output if it
  1240. finds a member named `__.IMPORT' in a library.  As only the __.SYMDEF
  1241. member is scanned if present, `__.IMPORT' defines the special symbol
  1242. `__IMPORT!'.  When patched GNU ld finds the definition of a symbol
  1243. named `__IMPORT!' in the __.SYMDEF member, relocatable output is
  1244. turned on.  (Relocatable output can also be turned on by using the -R
  1245. option of ld.)
  1246.  
  1247. For each function in the input files, emximp adds an a.out-type module
  1248. to the output file.  Such a module defines two symbols.  One symbol
  1249. defines the entry point, the other symbol gives information on the DLL
  1250. name and the ordinal number.  For instance, for
  1251.  
  1252.   LIBRARY doscalls
  1253.   EXPORTS DosBeep @286
  1254.  
  1255. the two symbols `_DosBeep' and `_DosBeep=doscalls.286' are defined.
  1256. The symbol types 0x69 and 0x6b are used, respectively.  GNU ld has
  1257. been patched to keep references to symbols of type 0x69 in the
  1258. relocation table.
  1259.  
  1260. emxbind scans the relocation table for references to symbols of type
  1261. 0x69 and scans the symbol table for a matching symbol of type 0x6b
  1262. which defines the entry point.
  1263.  
  1264.  
  1265. Creating an OMF import library for method (I3)
  1266. ----------------------------------------------
  1267.  
  1268. emximp -o <output_file>.lib <input_file>.imp ...
  1269.  
  1270. <output_file>.a is the name of the import library file to be created.
  1271. The name must end with `.lib'.
  1272.  
  1273. <input_file>.imp is the name of a module definition file.  You can
  1274. give one or more input file names on the command line.
  1275.  
  1276. All the import list files must define functions that are in the same
  1277. dynamic link library.  Lines start with `+' are ignored.
  1278.  
  1279. The number of argument words is lost after that conversion, that is,
  1280. you cannot recreated the import list file using emximp.
  1281.  
  1282.  
  1283. Creating a module definition file for method (I3)
  1284. -------------------------------------------------
  1285.  
  1286. emximp -o <output_file>.def <input_file>.imp ...
  1287.  
  1288. <output_file> is the name of the module definition file to be created.
  1289. The name must end with `.def'.
  1290.  
  1291. <input_file> is the name of an emx import list file.  The name must
  1292. end with `.imp'.  You can give one or more input file names on the
  1293. command line.
  1294.  
  1295. All the import list files must define functions that are in the same
  1296. dynamic link library.  Lines start with `+' are ignored.
  1297.  
  1298. The number of argument words is lost after that conversion, that is,
  1299. you cannot recreated the import list file using emximp.
  1300.  
  1301.  
  1302. 4.3 emxomf
  1303. ----------
  1304.  
  1305. The emxomf tool converts a.out object files (.o files) to Object
  1306. Module Formats (.obj files).  The converted files can be used with the
  1307. OS/2 linker link386.exe.
  1308.  
  1309. emxomf [-d] [-l] [-s] [-m<symbol>] -o <output_file> <input_file>
  1310.  
  1311.   Convert a single .o or .a file (INPUT_FILE) to an .obj or .lib file
  1312.   (OUTPUT_FILE).  There are no default extensions.  If -l is given,
  1313.   the module (all the modules of the archive when converting an
  1314.   archive) is supposed to be a library module.  A library module
  1315.   doesn't define a stack segment, doesn't have an entry point and
  1316.   doesn't request libraries.  If -m is given, the module is supposed
  1317.   to be the main module of a program.  A main module defines a default
  1318.   stack segment (0x2000 bytes) and has an entry point.  SYMBOL is the
  1319.   name of the entry point, that is, the function that should be called
  1320.   when the program is started.  -m is used for the startup code module
  1321.   crt0 and should not be used for user modules.  If -l and -m are
  1322.   missing, the module is supposed to be part of a program but not the
  1323.   main module.  Such a module doesn't define a stack segment, doesn't
  1324.   have an entry point.  If the -d option is given, the input file is
  1325.   deleted after successful conversion.  If the input file is an
  1326.   archive, it is not deleted.  If the -s option is given, debugging
  1327.   information is omitted.
  1328.  
  1329. emxomf [-d] [-l] [-s] [-x] [-m<symbol>] [-O <directory>] [-r|R<response_file>]
  1330.        <input_file>...
  1331.  
  1332.   Convert multiple .o and .a files to .obj and .lib files (more than
  1333.   one INPUT_FILE can be given on the command line).  The names of the
  1334.   output files are constructed by replacing the extension of the
  1335.   INPUT_FILES with `.obj' or `.lib', respectively.  If the -x option
  1336.   is given, all members (which must be a.out modules) of archives (.a
  1337.   files) are converted to .obj files.  The names of the output files
  1338.   are constructed by replacing the extension of the member names with
  1339.   `.obj'.  If the -x option is not given, archives (.a files) are
  1340.   converted to libraries (.lib files).  If the -O option is given, the
  1341.   output files are written to the directory DIRECTORY.  A LIB response
  1342.   file RESPONSE_FILE is created if you use the -r or -R option.  When
  1343.   using -r, the response file will contain commands to add the modules
  1344.   to a library file, when using -R, it will contain commands to
  1345.   replace the modules in a library file.  See above for a discussion
  1346.   of the -l and -m options.  If the -d option is given, all the input
  1347.   files except for archives are deleted after successful conversion.
  1348.   If the -s option is given, debugging information is omitted.
  1349.  
  1350.  
  1351. 4.4 emxomfld
  1352. ------------
  1353.  
  1354. emxomfld is a front end to LINK386, providing an ld-like command line
  1355. syntax for LINK386.  After parsing the command line, LINK386 is called
  1356. with equivalent command line arguments.
  1357.  
  1358. emxomfld -o file [-sS] [-l lib] [-L libdir] [-T base] file...
  1359.  
  1360. The name of the output file is specified by the argument of the -o
  1361. option.  The default extension (.EXE or .DLL) is provided by LINK386.
  1362. If -o is omitted, `$$$' will be used.
  1363.  
  1364. Libraries are specified by -l options.  The argument of an -l option
  1365. is prepended by `lib'.  For instance, -lc causes libc.lib to be used.
  1366.  
  1367. Libraries are sought in the directories given by -L options.  emxomfld
  1368. appends the directories to the LIB environment variable.
  1369.  
  1370. The -T option is translated to the /base option of LINK386.  Use
  1371.  
  1372.   -T 0x10000
  1373.  
  1374. to create non-relocatable .EXE files, which are slightly smaller and
  1375. load slightly faster.
  1376.  
  1377. The -s and -S options cause debugging information to be discarded.  If
  1378. -s and -S are not used, emxomfld passes the /debug option to link386.
  1379.  
  1380. The files given on the emxomfld command line are assumed to be OBJ
  1381. files to be linked unless the extension is .def, .lib, .map or .res.
  1382. A file having a .def extension is used as module definition file.
  1383. There may be at most one module definition file.  A file having a .lib
  1384. extension is used as library file.  A file having .map extension is
  1385. used as map file to be written by LINK386.  A file having a .res
  1386. extension is used as binary resource file; RC is called to attach the
  1387. resources to the output file.
  1388.  
  1389. Example:
  1390.  
  1391.   emxomfld -o test -lc -Lc:/mylibs test1 test2 test.def test.map test.res
  1392.  
  1393. Create file test.exe (or test.dll, depending on the contents of
  1394. test.def), by linking test1.obj and obj2.obj with libc.lib.  libc.lib
  1395. is sought in c:/mylibs.  Use the module definition file test.def,
  1396. create the map file test.map.  Call RC to copy the resources from
  1397. test.res to test.exe (or test.dll).
  1398.  
  1399. The following debugging option is available:
  1400.  
  1401. -i  pass the /information option to LINK386, causing file names to be
  1402.     displayed while linking
  1403.  
  1404. The following options are ignored:
  1405.  
  1406. -x  discard all local symbols
  1407.  
  1408. -X  discard local symbols starting with L
  1409.  
  1410.  
  1411. 4.5 emxomfar
  1412. ------------
  1413.  
  1414. emxomfar is a librarian for OMF LIB files with a command line
  1415. interface similar to `ar' to simplify makefiles.
  1416.  
  1417. emxomfar [-p#] <command> <library_file> [<module>]...
  1418.  
  1419. The default extension for <library_file> is .lib.  When modifying a
  1420. library file, a backup file with .bak extension is created.
  1421.  
  1422. The following commands are available:
  1423.  
  1424.   d     Delete modules from library.  The module name __.SYMDEF is
  1425.         ignored.
  1426.  
  1427.   q     Quick append.  This command is equivalent to the r command.
  1428.  
  1429.   r     Replace modules in library.  Modules which are not in the
  1430.         library are added to the library.  The default extension for
  1431.         modules is .obj.
  1432.  
  1433.   s     This command is ignored -- will do nothing.
  1434.  
  1435.   t     List table of contents.  Use the v option to also list public
  1436.         symbols.
  1437.  
  1438.   x     Extract modules from library.  The default extension for
  1439.         modules is .obj.
  1440.  
  1441. You can additionally use the following modifiers in the <command>
  1442. argument:
  1443.  
  1444.   c     Don't display warning when creating new library.
  1445.  
  1446.   v     Verbose output.
  1447.  
  1448. The following option must precede <command> if used:
  1449.  
  1450.   -p#   Set page size to # bytes (16, 32, 64, ..., 32768).  If -p is
  1451.         not given, a page size of 16 bytes will be used.  Increase the
  1452.         page size if emxomfar complains about too big a library.  If
  1453.         emxomfar doesn't complain, you shouldn't increase the page
  1454.         size to save disk space.
  1455.  
  1456. The following `ar' commands are not implemented:
  1457.  
  1458.   m     Move members to the end of the archive.
  1459.  
  1460.   p     Copy members to standard output.
  1461.  
  1462. The following `ar' modifiers in the <command> argument are ignored:
  1463.  
  1464.   l     Create temporary file in current directory.
  1465.  
  1466.   o     Preserve dates.
  1467.  
  1468.   u     Update.  Don't replace members with older files.
  1469.  
  1470. The following `ar' modifiers in the <command> argument are not
  1471. implemented:
  1472.  
  1473.   a     Position after specified member.
  1474.  
  1475.   b     Position before specified member.
  1476.  
  1477.   i     Position before specified member.
  1478.  
  1479. Example:
  1480.  
  1481.   emxomfar -p32 rc newlib *.obj
  1482.  
  1483.  
  1484. 4.6 emxcat
  1485. ----------
  1486.  
  1487. The emxcat tool concatenates assembler or C source files.  This is
  1488. used for building emxlibc.dll.
  1489.  
  1490. emxcat -o <output_file> <input_file>...
  1491.  
  1492. All the <input_file>s are concatenated and written to <output_file>.
  1493. If the output file is included in the input files, it is not copied;
  1494. emxcat simply compares the file names, therefore it's possible to fool
  1495. emxcat and make it copying until the disk is full.
  1496.  
  1497. An #include statement is omitted if it has already been copied to the
  1498. output file.  When the order of the include files is essential, the
  1499. first input file should contain #include statements in the correct
  1500. order.  (By using two passes, emxcat could be enhanced to put the
  1501. #include statements into the correct order.)
  1502.  
  1503. When concatenating .s files, lines starting with CONST_ are also
  1504. omitted if already copied.
  1505.  
  1506. All macros #defined by an input file are #undefined after copying the
  1507. input file.
  1508.  
  1509.  
  1510. 4.7 emxrev
  1511. ----------
  1512.  
  1513. emxrev displays the revision number of emx DLLs (emx.dll, emxio.dll
  1514. and emxlibc.dll).  The revision number is incremented every time a
  1515. changed version of a DLL is released.  By looking at the revision
  1516. numbers of the DLLs, you can tell which one is the newest one.
  1517.  
  1518. To display the revision number of the default emx DLLs, type
  1519.  
  1520.   emxrev
  1521.  
  1522. The default DLLs are those used by the operating system when starting
  1523. a program.
  1524.  
  1525. To display the revision number of a specific file, type
  1526.  
  1527.   emxrev -f file
  1528.  
  1529. If a directory is included in FILE, append .dll to the name.  If no
  1530. directory is included in FILE, don't append .dll to the name.
  1531.  
  1532. To display the revision numbers of the emx DLLs in directory DIR, type
  1533.  
  1534.   emxrev -d dir
  1535.  
  1536. To display the revision numbers of the emx DLLs in all directories of
  1537. drive D:, type
  1538.  
  1539.   emxrev -c d:
  1540.  
  1541. To display the revision numbers of the emx DLLs in all directories of
  1542. all hard disks, type
  1543.  
  1544.   emxrev -a
  1545.  
  1546. To display the revision numbers of the emx DLLs in the directories
  1547. listed in the LIBPATH statement of a config.sys file, type
  1548.  
  1549.   emxrev -p file
  1550.  
  1551. where FILE is the name of the config.sys file.
  1552.  
  1553.  
  1554. 5 Library functions and system calls
  1555. ====================================
  1556.  
  1557. 5.1 Overview
  1558. ------------
  1559.  
  1560. The following emx libraries are provided:
  1561.  
  1562. libc          The C library.  This library includes the standard C
  1563.               library functions, Unix extensions and emx extensions.
  1564.               This library is also provided as dynamic link library
  1565.               (emxlibc.dll)
  1566.  
  1567. libemx1       System call interface for emx.  For instance, this
  1568.               library translates the __open() system call to system
  1569.               call 0x2b of emx.  When using this library, emx.dll is
  1570.               required under OS/2.  This library is always required
  1571.               for DOS programs
  1572.  
  1573. libemx2       Import library for emx.dll.  This library is used by
  1574.               libemx1 and libos2 (unless libsys is used)
  1575.  
  1576. libemxio      Import library for emxio.dll.  When using hardware port
  1577.               I/O functions such as _outp8(), you may have to use this
  1578.               library.  libemxio must be used when linking with
  1579.               LINK386 (-Zomf) or when using emxlibc.dll (-Zmt).
  1580.               libemxio must not be used if the program should also run
  1581.               under DOS
  1582.  
  1583. libg          Dummy debugging library.  GCC uses -lg if -g is given on
  1584.               the command line
  1585.  
  1586. libgcc        Compiler helper functions for GCC.  The functions of
  1587.               libgcc are duplicated in emxlibc.dll.  As libgcc
  1588.               requires functions from libc and libc requires functions
  1589.               from libgcc, libgcc must be given twice on the command
  1590.               line of the Unix-style linker: -lgcc -lc -lgcc
  1591.  
  1592. libgraph      Graphics library.  For certain functions, this library
  1593.               requires access to hardware ports.  When using these
  1594.               functions, you have to use libemxio after libgraph
  1595.               unless the program should also run under DOS
  1596.  
  1597. libm          Dummy math library.  This library is provided for
  1598.               makefile compatibility; it isn't required as the math
  1599.               functions are contained in libc
  1600.  
  1601. libmt         Import library for emxlibc.dll.  This library is used
  1602.               instead of libc and libgcc when using the -Zmt option
  1603.  
  1604. libos2        Import library for OS/2 API.  This library is not a pure
  1605.               import library, it also contains static code for
  1606.               DosGetMessage and DosQueryMessageCP and for the 16-bit
  1607.               wrappers.  libemx2 or libsys is required by the 16-bit
  1608.               wrappers
  1609.  
  1610. libsys        System call emulation library.  This library is used
  1611.               instead of libemx1 when creating stand-alone OS/2
  1612.               applications (-Zsys).  libsys is provided in OMF style
  1613.               only (libsys.lib)
  1614.  
  1615. libvideo      Video library.  This library contains the functions
  1616.               declared in sys/video.h and sys/winmgr.h.
  1617.  
  1618.  
  1619. The following dynamic link libraries are provided:
  1620.  
  1621. emx.dll       This is the emx run-time support.  The import library
  1622.               for emx.dll is libemx2
  1623.  
  1624. emxio.dll     Access to hardware ports.  The import library for
  1625.               emxio.dll is libemxio
  1626.  
  1627. emxlibc.dll   emx C library.  Contains all functions of libc and
  1628.               libgcc, except for port I/O functions.  For
  1629.               compatibility with existing programs, emxlibc.dll
  1630.               contains dummy functions for port I/O, though these
  1631.               didn't work in emxlibc.dll of emx 0.8e.  The import
  1632.               library for emxlibc.dll is libmt
  1633.  
  1634.  
  1635. 5.2 Preliminary notes
  1636. ---------------------
  1637.  
  1638. - Day-light-saving time (summer time) is not implemented.  This
  1639.   affects only computation of GMT.  If there are problems with the
  1640.   interpretation of the TZ environment variable, use EMXTZ for emx
  1641.   programs.  See tzset() for details.
  1642.  
  1643. - Not all functions declared in the header files are implemented.
  1644.  
  1645. - Does anyone have a surplus copy of the ANSI C specs?  A donation of
  1646.   the ANSI C standard paper would be appreciated.
  1647.  
  1648. - By default, text mode is used for files.  See fread() and fwrite()
  1649.   for details.  The default can be globally changed to binary mode by
  1650.   linking with binmode.o or binmode.obj.
  1651.  
  1652. - See the description of g_mode() for general information about the
  1653.   graphics library.
  1654.  
  1655. - See the description of v_init() for general information about the
  1656.   video library.
  1657.  
  1658. - See the description of wm_init() for general information about the
  1659.   window manager functions.
  1660.  
  1661.  
  1662. 5.3 Library reference: functions
  1663. --------------------------------
  1664.  
  1665. The functions are listed almost alphabetically.  The origin of most of
  1666. the functions is shown in [brackets] at the end of the first line.
  1667. Functions which are not available or are limited with the system call
  1668. library (-Zsys, libsys.lib) are marked [*].
  1669.  
  1670. ------------------------------------------------------------------------------
  1671. #include <stdlib.h>                                                     [ANSI]
  1672.  
  1673. void volatile abort (void);
  1674.  
  1675.     abort() does some cleaning up and aborts program by raising
  1676.     SIGABRT.  The default action for SIGABRT is to display the message
  1677.     `Abnormal program termination' and exit with return code 3.
  1678.  
  1679.     See also: exit(), _exit(), raise(), signal()
  1680.  
  1681. ------------------------------------------------------------------------------
  1682. #include <stdlib.h>     /* use this */                                  [ANSI]
  1683. #include <math.h>       /* or this */
  1684.  
  1685. int abs (int n);
  1686.  
  1687.     Return the absolute value of N: If N is negative, -N is returned.
  1688.     Otherwise, N is returned.  In-line code is generated for this
  1689.     function.
  1690.  
  1691.     See also: fabs(), labs()
  1692.  
  1693. ------------------------------------------------------------------------------
  1694. #include <stdlib.h>                                                      [emx]
  1695.  
  1696. int _abspath (char *dst, const char *src, int size);
  1697.  
  1698.     Construct an absolute path name for the file name or directory
  1699.     name SRC.  The absolute path name is put to DST.  It is assumed
  1700.     that there are SIZE bytes available at DST, this includes the
  1701.     terminating 0 byte.  If there is an error, -1 is returned.  If
  1702.     _abspath() succeeds, 0 is returned.  If SIZE is too small, errno
  1703.     is set to ERANGE and -1 is returned.  DST can be identical to SRC.
  1704.     Backslashes are translated into forward slashes.  The absolute
  1705.     path name is not translated to lower case.  If SRC ends with a
  1706.     slash or backslash, DST will end with a slash.
  1707.  
  1708.     _abspath() works with non-existing paths, it accesses the appropriate
  1709.     drive only for finding out the current working directory, if necessary.
  1710.  
  1711.     See also: _fnisabs(), _fullpath()
  1712.  
  1713. ------------------------------------------------------------------------------
  1714. #include <io.h>                                                         [UNIX]
  1715.  
  1716. int access (const char *name, int mode);
  1717.  
  1718.     Returns 0 if the file or directory NAME is accessible in mode
  1719.     MODE.  Otherwise returns -1 and sets errno to ENOENT or EACCES.
  1720.     If MODE is 0, access() checks only for existence of the file or
  1721.     directory.  If MODE is 2, access() checks for write permission.
  1722.     If MODE is 4, access() checks for read permission (always granted
  1723.     under DOS and OS/2 if the file exists).  If MODE is 6, access()
  1724.     checks for read and write permission.
  1725.  
  1726.     Restrictions: access() does not work with devices (ENOENT).
  1727.  
  1728.     See also: open(), stat()
  1729.  
  1730. ------------------------------------------------------------------------------
  1731. #include <stdlib.h>                                                 [*] [UNIX]
  1732.  
  1733. unsigned alarm (unsigned SEC);
  1734.  
  1735.     Raises SIGALRM after SEC seconds have expired.  There is only one
  1736.     alarm clock, calling alarm() while the alarm clock is running, the
  1737.     time will be reset to the new value.  If SEC is zero, the alarm
  1738.     clock will be stopped.  alarm() returns the number of seconds
  1739.     remaining on the alarm clock before setting the new value.  Under
  1740.     DOS, SIGALRM is not raised until return from DOS if the timer
  1741.     expired during a DOS call.
  1742.  
  1743.     Restriction: When using the system call library libsys.lib
  1744.     (-Zsys), alarm() is not available.
  1745.  
  1746.     See also: raise(), signal(), sleep(), _sleep2()
  1747.  
  1748. ------------------------------------------------------------------------------
  1749. #include <alloca.h>
  1750.  
  1751. void *alloca (size_t n);
  1752.  
  1753.     Allocate N bytes from the current stack frame.  The memory space
  1754.     allocated by alloca() will be freed on exit from the current
  1755.     function.  Do not pass the pointer returned by alloca() to free().
  1756.  
  1757.     This note applies only if you need stack probes:
  1758.  
  1759.     If alloca() with constant argument occurs in the first statement
  1760.     of a function with less than 4096 bytes of local data or if two
  1761.     calls to alloca() with constant arguments occur twice in a row
  1762.     without accessing the memory pointed to by the return value of the
  1763.     first call, you have to change your code to make GCC generate
  1764.     correct stack probes.  This can be done by storing a dummy value
  1765.     to the return value of alloca().
  1766.  
  1767.     Example:
  1768.  
  1769.       p = alloca (0xf00);
  1770.       {char *fix=alloca (0); *fix = 0;}
  1771.       q = alloca (0xf00);
  1772.  
  1773.     Example:
  1774.  
  1775.       void test (void)
  1776.       {
  1777.         char local[0xf00], *p;
  1778.  
  1779.         {char *fix=alloca (0); *fix = 0;}
  1780.         p = alloca (0xf00);
  1781.         /*...*/
  1782.       }
  1783.  
  1784.     See also: GCC, malloc()
  1785.  
  1786. ------------------------------------------------------------------------------
  1787. #include <time.h>                                                       [ANSI]
  1788.  
  1789. char *asctime (const struct tm *t);
  1790.  
  1791.     Convert the time and date given by the structure pointed to by T
  1792.     to a string.  A pointer to the string is returned.  There is only
  1793.     one memory location for the ctime() and asctime() results, a call
  1794.     to ctime() or asctime() overwrites the result of a previous calls
  1795.     to ctime() or asctime().  As localtime() is called by ctime(), the
  1796.     memory location shared by localtime(), gmtime(), and mktime() is
  1797.     overwritten.  The string looks like
  1798.  
  1799.         "Sun Mar 22 22:59:18 1992\n"
  1800.  
  1801.     with a terminating 0.  All fields have fixed width.
  1802.  
  1803.     See also: ctime()
  1804.  
  1805. ------------------------------------------------------------------------------
  1806. #include <math.h>                                                       [ANSI]
  1807.  
  1808. double acos (double x);
  1809. double asin (double x);
  1810. double atan (double x);
  1811. double atan2 (double y, double x);
  1812.  
  1813.     Compute the arc sine, arc cosine and arc tangent of X,
  1814.     respectively.  atan2() computes the arctangent of Y/X, using the
  1815.     signs of Y and X to determine the quadrant.  If X is outside
  1816.     [-1,1], asin() and acos() return #NAN and set errno to EDOM.
  1817.  
  1818.     See also: cos(), sin(), tan()
  1819.  
  1820. ------------------------------------------------------------------------------
  1821. #include <assert.h>                                                     [ANSI]
  1822.  
  1823. void assert (int exp);
  1824.  
  1825.     If the preprocessor macro NDEBUG is defined, assert() does
  1826.     nothing.  Otherwise, if EXP is zero, the message
  1827.  
  1828.       Assertion failed: EXP, file FILE, line LINE
  1829.  
  1830.     is displayed and the program is aborted.  EXP, FILE and LINE are
  1831.     replaced with EXP (as text), the source file name and the source
  1832.     line number, respectively.  If EXP is non-zero, nothing is done.
  1833.  
  1834.     See also: abort()
  1835.  
  1836. ------------------------------------------------------------------------------
  1837. #include <stdlib.h>                                                     [ANSI]
  1838.  
  1839. int atexit (void (*func)(void));
  1840.  
  1841.     The function FUNC will be called when the process is terminated.
  1842.     The last function installed by calling atexit() will be called
  1843.     first.  Up to 32 functions can be installed.  0 is returned if
  1844.     successful, -1 otherwise.
  1845.  
  1846.     See also: abort(), exit(), _exit()
  1847.  
  1848. ------------------------------------------------------------------------------
  1849. #include <stdlib.h>                                                     [ANSI]
  1850. #include <math.h>  /* alternate include file for atof() */
  1851.  
  1852. double atof (const char *string);
  1853. int atoi (const char *string);
  1854. long atol (const char *string);
  1855.  
  1856.     Convert the textual representation of a number in STRING to a
  1857.     number.  Leading whitespace is ignored.  If the string cannot be
  1858.     converted, 0 is returned.
  1859.  
  1860.     See also: _atoll(), _itoa(), _ltoa(), scanf()
  1861.  
  1862. ------------------------------------------------------------------------------
  1863. #include <stdlib.h>                                                      [emx]
  1864.  
  1865. long long _atoll (const char *string);
  1866.  
  1867.     Convert the textual representation of a number in STRING to a
  1868.     number.  Leading whitespace is ignored.  If the string cannot be
  1869.     converted, 0 is returned.
  1870.  
  1871.     See also: atol()
  1872.  
  1873. ------------------------------------------------------------------------------
  1874. #include <strings.h>                                                     [BSD]
  1875.  
  1876. int bcmp (const void *buffer1, const void *buffer2, size_t n);
  1877.  
  1878.     Compare the first N bytes at BUFFER1 to the first N bytes at
  1879.     BUFFER2.  If the two buffers are identical (or if N is zero), 0 is
  1880.     returned.  Otherwise, a non-zero value is returned.
  1881.  
  1882.     See also: memcmp()
  1883.  
  1884. ------------------------------------------------------------------------------
  1885. #include <strings.h>                                                     [BSD]
  1886.  
  1887. void bcopy (const void *src, void *dst, size_t n);
  1888.  
  1889.     Copy memory.  Copy N bytes from SRC to DST.  The two regions may
  1890.     overlap.
  1891.  
  1892.     See also: memmove()
  1893.  
  1894. ------------------------------------------------------------------------------
  1895. #include <stdlib.h>                                                       [PC]
  1896.  
  1897. int _beginthread (void (*start)(void *arg), void *stack, unsigned stack_size,
  1898.                   void *arg_list);
  1899.  
  1900.     Start a thread.  START is the start address (a function).
  1901.     ARG_LIST will be passed in the ARG parameter of the START
  1902.     function.  STACK is ignored, using NULL is recommended.
  1903.     STACK_SIZE is the size of the stack for the new thread.  When the
  1904.     START function returns, the thread is terminated.  A thread can
  1905.     also terminate itself by calling _endthread().  If successful,
  1906.     _beginthread() returns the thread ID.  On error, _beginthread()
  1907.     sets errno and returns -1.  The stack allocated for the new thread
  1908.     is completely committed, that is, stack probes are not required.
  1909.  
  1910.     Do not start a thread with DosCreateThread unless it doesn't call
  1911.     C library functions.
  1912.  
  1913.     _beginthread() is available only when using emxlibc.dll (-Zmt).
  1914.  
  1915.     See also: _endthread()
  1916.  
  1917. ------------------------------------------------------------------------------
  1918. #include <stdlib.h>                                                     [UNIX]
  1919.  
  1920. void *brk (void *addr);
  1921.  
  1922.     Change end address of data segment to ADDR.  On success, brk()
  1923.     returns 0, cast as pointer.  Otherwise, -1 cast as pointer is
  1924.     returned and errno set to ENOMEM.  Please don't use brk() -- use
  1925.     malloc() instead for memory allocation.
  1926.  
  1927.     See also: malloc(), sbrk()
  1928.  
  1929. ------------------------------------------------------------------------------
  1930. #include <stdlib.h>                                                     [ANSI]
  1931.  
  1932. void *bsearch (const void *key, const void *base, size_t num, size_t width,
  1933.                int (*compare)(const void *key, const void *element));
  1934.  
  1935.     Perform a binary search on the sorted array BASE to find KEY.  The
  1936.     array has NUM elements of size WIDTH bytes each.  bsearch() calls
  1937.     COMPARE to compare an array element pointed to by ELEMENT with
  1938.     KEY.  COMPARE should return 0 if KEY and ELEMENT are equal; a
  1939.     negative value, if KEY is smaller than ELEMENT; a positive value
  1940.     if KEY is greater than ELEMENT with respect to the sorting order
  1941.     of ARRAY.  bsearch() returns a pointer to an occurrence of KEY in
  1942.     the array.  If KEY is not found, NULL is returned.  If there are
  1943.     multiple occurrences of KEY in ARRAY, bsearch() returns a pointer
  1944.     to any one of the entries.  If ARRAY is not sorted, bsearch() does
  1945.     not work.
  1946.  
  1947.     See also: qsort()
  1948.  
  1949. ------------------------------------------------------------------------------
  1950. #include <strings.h>                                                     [BSD]
  1951.  
  1952. void bzero (void *buffer, size_t n);
  1953.  
  1954.     Set N bytes at BUFFER to 0.
  1955.  
  1956.     See also: memset()
  1957.  
  1958. ------------------------------------------------------------------------------
  1959. #include <math.h>
  1960.  
  1961. double cbrt (double x);
  1962.  
  1963.     Compute and return the cube root of X.  This is done by calling
  1964.     pow() and adjusting the sign.
  1965.  
  1966.     See also: pow(), sqrt()
  1967.  
  1968. ------------------------------------------------------------------------------
  1969. #include <math.h>                                                       [ANSI]
  1970.  
  1971. double ceil (double x);
  1972.  
  1973.     Return as floating-point number the smallest integer that is
  1974.     greater than or equal to X (round up).
  1975.  
  1976.     See also: floor(), rint(), trunc()
  1977.  
  1978. ------------------------------------------------------------------------------
  1979. #include <stdlib.h>                                                     [UNIX]
  1980.  
  1981. int chdir (const char *name);
  1982.  
  1983.     Change to directory NAME.  If NAME contains a drive letter, the
  1984.     working directory on that drive is changed, but the selected drive
  1985.     does not change.  If successful, 0 is returned.  Otherwise, -1 is
  1986.     returned.
  1987.  
  1988.     Restriction: Under DOS, the current working directory is not a
  1989.     property of a process, it's a system-wide property.  That may
  1990.     change in a future release of emx.
  1991.  
  1992.     See also: _chdir2(), getcwd()
  1993.  
  1994. ------------------------------------------------------------------------------
  1995. #include <stdlib.h>                                                      [emx]
  1996.  
  1997. int _chdir2 (const char *name);
  1998.  
  1999.     Change to drive and directory NAME.  If NAME contains a drive
  2000.     letter, that drive is selected.  If successful, 0 is returned.
  2001.     Otherwise, -1 is returned.
  2002.  
  2003.     Restriction: Under DOS, the current working directory and the
  2004.     default drive is not a property of a process, it's a system-wide
  2005.     property.  That may change in a future release of emx.
  2006.  
  2007.     See also: chdir(), getcwd()
  2008.  
  2009. ------------------------------------------------------------------------------
  2010. #include <stdlib.h>                                                       [PC]
  2011.  
  2012. int _chdrive (char drive);
  2013.  
  2014.     Make the disk drive DRIVE the default drive.  DRIVE must be in 'A'
  2015.     through 'Z'.  _chdrive() always returns 0, even if the drive does
  2016.     not exist.
  2017.  
  2018.     See also: _chdir2(), _getdrive()
  2019.  
  2020. ------------------------------------------------------------------------------
  2021. #include <io.h>                                                         [UNIX]
  2022. #include <sys/stat.h>
  2023.  
  2024. int chmod (const char *name, int pmode);
  2025.  
  2026.     Change permission settings of the file named NAME to PMODE.
  2027.     There's only one permission bit under OS/2 and DOS, the read-only
  2028.     attribute.
  2029.  
  2030.     Return value:
  2031.  
  2032.       0    success
  2033.  
  2034.       -1   failure
  2035.  
  2036.     Restriction: Only the S_IWRITE bit of PMODE is used.
  2037.  
  2038.     See also: creat(), open(), stat(), umask()
  2039.  
  2040. ------------------------------------------------------------------------------
  2041. #include <io.h>                                                           [PC]
  2042.  
  2043. int chsize (int handle, long size);
  2044.  
  2045.     Change the length of the file associated with HANDLE to LENGTH
  2046.     bytes.  The position of the file pointer is undefined after
  2047.     calling this function.  If LENGTH is greater than the current
  2048.     length of the file, bytes of zeros are appended.  HANDLE must be
  2049.     open for writing.  If successful, 0 is returned.  Otherwise, -1 is
  2050.     returned.
  2051.  
  2052.     See also: ftruncate()
  2053.  
  2054. ------------------------------------------------------------------------------
  2055. #include <stdio.h>                                                      [ANSI]
  2056.  
  2057. void clearerr (FILE *stream);
  2058.  
  2059.     Clear the error and end-of-file indicators of STREAM.
  2060.  
  2061.     See also: ferror(), feof()
  2062.  
  2063. ------------------------------------------------------------------------------
  2064. #include <time.h>                                                       [ANSI]
  2065.  
  2066. clock_t clock (void);
  2067.  
  2068.     clock() returns the amount of processor time (timer ticks) used by
  2069.     the calling process since the process has been started.  There are
  2070.     CLOCKS_PER_SEC timer ticks per second.
  2071.  
  2072.     Restriction: clock() returns the time elapsed, not the CPU time.
  2073.  
  2074.     See also: time()
  2075.  
  2076. ------------------------------------------------------------------------------
  2077. #include <io.h>                                                         [UNIX]
  2078.  
  2079. int close (int handle);
  2080.  
  2081.     Close the file associated with the handle HANDLE.  If successful,
  2082.     0 is returned, -1 if not.
  2083.  
  2084.     See also: dup(), open()
  2085.  
  2086. ------------------------------------------------------------------------------
  2087. #include <stdlib.h>                                                  [*] [emx]
  2088.  
  2089. int _core (int handle);
  2090.  
  2091.     Write a core dump to the file HANDLE.  HANDLE must be open for
  2092.     writing.  The core dump file can be used later for debugging or
  2093.     for creating another .exe file which includes the data as saved
  2094.     when _core() was called.
  2095.  
  2096.     Restriction: _core() works only in programs linked with ld.  It
  2097.     does not work in programs linked with LINK386.  When using the
  2098.     system call library libsys.lib (-Zsys), _core() is not available.
  2099.  
  2100.     See also: raise()
  2101.  
  2102. ------------------------------------------------------------------------------
  2103. #include <math.h>                                                       [ANSI]
  2104.  
  2105. double cos (double x);
  2106. double sin (double x);
  2107. double tan (double x);
  2108.  
  2109.     Compute the sine, cosine and tangent of X, respectively.  If the
  2110.     absolute value of x is greater than or equal to 2^63, #NAN is
  2111.     returned and errno set to EDOM.
  2112.  
  2113.     See also: acos(), asin(), atan()
  2114.  
  2115. ------------------------------------------------------------------------------
  2116. #include <math.h>                                                       [ANSI]
  2117.  
  2118. double cosh (double x);
  2119. double sinh (double x);
  2120. double tanh (double x);
  2121.  
  2122.     Compute the hyperbolic sine, hyperbolic cosine and hyperbolic
  2123.     tangent of X, respectively.  On overflow, #INF is returned and
  2124.     errno set to ERANGE.
  2125.  
  2126.     See also: exp()
  2127.  
  2128. ------------------------------------------------------------------------------
  2129. #include <io.h>                                                         [UNIX]
  2130. #include <sys/stat.h>
  2131.  
  2132. int creat (const char *name, int pmode);
  2133.  
  2134.     Create a file named NAME with permission settings PMODE.  This is
  2135.     equivalent to
  2136.  
  2137.         open (name, O_WRONLY|O_TRUNC|O_CREAT, pmode)
  2138.  
  2139.     See also: open()
  2140.  
  2141. ------------------------------------------------------------------------------
  2142. #include <io.h>                                                          [emx]
  2143.  
  2144. int _crlf (char *buf, size_t size, size_t *new_size);
  2145.  
  2146.     Translate CR/LF pairs to LF characters.  The conversion is done
  2147.     in-place in the buffer BUF of size SIZE.  The new size is stored
  2148.     to *NEW_SIZE.  If the buffer ends with a CR, 1 is returned.
  2149.     Otherwise, 0 is returned.
  2150.  
  2151.     See also: fread(), _fsetmode(), read(), setmode()
  2152.  
  2153. ------------------------------------------------------------------------------
  2154.                                                                         [OS/2]
  2155. int _CRT_init (void);
  2156. void _CRT_term (void);
  2157.  
  2158.     These two functions are provided for being called from
  2159.     _DLL_InitTerm(), the DLL initialization and termination function.
  2160.  
  2161.     _CRT_init() initializes the C run-time library.  On success, 0 is
  2162.     returned.  On failure, -1 is returned.
  2163.  
  2164.     _CRT_term() terminates the C run-time library.
  2165.  
  2166.     Example: /emx/test/testdll1.c
  2167.  
  2168.     See also: _DLL_InitTerm()
  2169.  
  2170. ------------------------------------------------------------------------------
  2171. #include <time.h>                                                       [ANSI]
  2172.  
  2173. char *ctime (const time_t *t);
  2174.  
  2175.     Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970
  2176.     given by the variable pointed to by T to a string representing
  2177.     that moment for the local timezone.  A pointer to the string is
  2178.     returned.  There is only one memory location for the ctime() and
  2179.     asctime() results, a call to ctime() or asctime() overwrites the
  2180.     result of a previous calls to ctime() or asctime().  As
  2181.     localtime() is called by ctime(), the memory location shared by
  2182.     localtime(), gmtime(), and mktime() is overwritten.  The string
  2183.     looks like
  2184.  
  2185.         "Sun Mar 22 22:59:18 1992\n"
  2186.  
  2187.     with a terminating 0.  All fields have fixed width.
  2188.  
  2189.     See also: asctime()
  2190.  
  2191. ------------------------------------------------------------------------------
  2192. #include <stdlib.h>                                                      [emx]
  2193.  
  2194. void _defext (char *dst, const char *ext);
  2195.  
  2196.     Add the default extension EXT to the file name DST.  If the file
  2197.     name part of DST contains an extension (including the empty
  2198.     extension), nothing will be done.  Otherwise, a dot and EXT will
  2199.     be appended.
  2200.  
  2201.     See also: _getext(), _remext(), _splitpath()
  2202.  
  2203. ------------------------------------------------------------------------------
  2204. #include <time.h>                                                       [ANSI]
  2205.  
  2206. double difftime (time_t t1, time_t t0);
  2207.  
  2208.     Return the difference (in seconds) T1-T0 between T0 and T1.
  2209.  
  2210. ------------------------------------------------------------------------------
  2211. #include <stdlib.h>                                                     [ANSI]
  2212.  
  2213. div_t div (int num, int den);
  2214. ldiv_t ldiv (long num, long den);
  2215.  
  2216.     Perform an integer division, dividing NUM by DEN.  The quotient
  2217.     and the remainder are returned in the quot and rem fields,
  2218.     respectively.
  2219.  
  2220.     The following table shows the signs of quot and rem depending on
  2221.     the signs of NUM and DEN:
  2222.  
  2223.         NUM DEN | quot rem
  2224.         --------+---------
  2225.          +   +  |  +    +
  2226.          +   -  |  -    +
  2227.          -   +  |  -    -
  2228.          -   -  |  +    -
  2229.  
  2230.     See also: _lldiv(), _uldiv(), _ulldiv()
  2231.  
  2232. ------------------------------------------------------------------------------
  2233.                                                                         [OS/2]
  2234.  
  2235. unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag);
  2236.  
  2237.     _DLL_InitTerm is the library initialization and termination
  2238.     function for dynamic link libraries.  It is called by the
  2239.     operating system to initialize the library (if FLAG is zero) or to
  2240.     terminate the library (if FLAG is one).  MOD_HANDLE is the module
  2241.     handle of the dynamic link library.  _DLL_InitTerm() should return
  2242.     1 to indicate success.  On failure, 0 should be returned.  The
  2243.     default _DLL_InitTerm() function does nothing but returning 1.  To
  2244.     initialize the C library, you have to write an _DLL_InitTerm()
  2245.     function which calls _CRT_init().
  2246.  
  2247.     Example: /emx/test/testdll1.c
  2248.  
  2249.     See also: _CRT_init(), _CRT_term()
  2250.  
  2251. ------------------------------------------------------------------------------
  2252. #include <sys/dirtree.h>                                                 [emx]
  2253.  
  2254. void _dt_free (struct _dt_tree *dt);
  2255.  
  2256.     Deallocate the memory allocated by _dt_read() for the directory
  2257.     tree DT.
  2258.  
  2259.     See also: _dt_read()
  2260.  
  2261. ------------------------------------------------------------------------------
  2262. #include <sys/dirtree.h>                                                 [emx]
  2263.  
  2264. struct _dt_tree *_dt_read (const char *dir, const char *mask, unsigned flags);
  2265.  
  2266.     Create a directory tree in memory.  The tree consists of a linked
  2267.     list of _dt_node structures.  Subtrees are attached to the SUB
  2268.     field of _dt_node structures for directories.  Files matching MASK
  2269.     in the directory DIR are put into the tree.  If FLAGS includes
  2270.     _DT_TREE, all subdirectories of DIR are also scanned for files and
  2271.     directories matching MASK.  If _DT_TREE is not included, the
  2272.     subdirectories of DIR are not scanned.  If FLAGS includes
  2273.     _DT_NOCPDIR, the `.' and `..' entries are omitted.  If successful,
  2274.     _dt_read() returns a pointer to a _dt_tree structure.  The TREE
  2275.     field of that structure is the root of the tree.  On error, the
  2276.     errno variable is set and NULL is returned.
  2277.  
  2278.     _fnlwr() is used to convert file names to lower case on
  2279.     upper-case-only file systems.
  2280.  
  2281.  
  2282.     Example: /emx/test/dttest.c
  2283.  
  2284.     See also: _dt_free(), _dt_sort(), _dt_split(), _fnlwr(), _fnexplode()
  2285.  
  2286. ------------------------------------------------------------------------------
  2287. #include <sys/dirtree.h>                                                 [emx]
  2288.  
  2289. void _dt_sort (struct _dt_tree *dt, const char *spec);
  2290.  
  2291.     Sort the directory tree DT according to SPEC.  DT is a directory
  2292.     tree created by _dt_read().  SPEC is a string of characters which
  2293.     is read from left to right.  Each character tells _dt_sort() how
  2294.     to compare two tree nodes.  If the nodes compare equal, the next
  2295.     character is examined.  This is repeated until the two nodes are
  2296.     different according to the sorting criterion indicated by a
  2297.     character of SPEC or the end of the SPEC string is reached.  If
  2298.     the end of the SPEC string is reached, the two nodes are
  2299.     considered equal and the two nodes are put in an arbitrary order.
  2300.     The following characters of SPEC are defined:
  2301.  
  2302.       e  File name extensions are compared, ascending ASCII order
  2303.       E  File name extensions are compared, descending ASCII order
  2304.       f  Directories are placed before files
  2305.       F  Files are placed before directories
  2306.       n  File names are compared, ascending ASCII order
  2307.       N  File names are compared, descending ASCII order
  2308.       s  File size is compared, ascending
  2309.       S  File size is compared, descending
  2310.       t  Time stamps (last modification) are compared, ascending
  2311.       T  Time stamps (last modification) are compared, descending
  2312.  
  2313.     All other characters are ignored.  _fncmp() is used for comparing
  2314.     file names.  If _fncmp() returns 0, strcmp() is used in addition.
  2315.     strcmp() can return a non-zero value only if the current code page
  2316.     doesn't match the code page used when creating the directory
  2317.     entries.
  2318.  
  2319.     See also: _dt_read(), _fncmp()
  2320.  
  2321. ------------------------------------------------------------------------------
  2322. #include <sys/dirtree.h>                                                 [emx]
  2323.  
  2324. int _dt_split (const char *src, char *dir, char *mask);
  2325.  
  2326.     Split the path name SRC into a directory part and a name part for
  2327.     _dt_read().  The directory part is stored to DIR, the name part is
  2328.     stored to MASK.  If SRC is a directory, MASK is set to "*".
  2329.  
  2330.     See also: _dt_read()
  2331.  
  2332. ------------------------------------------------------------------------------
  2333. #include <io.h>                                                         [UNIX]
  2334.  
  2335. int dup (int handle);
  2336. int dup2 (int handle1, int handle2);
  2337.  
  2338.     Create a duplicate of the file handle HANDLE or HANDLE1,
  2339.     respectively, that is, another handle that refers to the same file
  2340.     or device or pipe as the handle given.  Both handles share the
  2341.     same file pointer.  dup() chooses the lowest numbered available
  2342.     handle.  dup2() uses HANDLE2 for the new file handle.  If HANDLE2
  2343.     is open when dup2() is called, it is closed by dup2().  If there
  2344.     is an error, -1 is returned.  Otherwise, the new file handle is
  2345.     returned.
  2346.  
  2347.     Restriction: dup2() currently doesn't work correctly under DOS.
  2348.  
  2349.     See also: close(), fcntl(), open()
  2350.  
  2351. ------------------------------------------------------------------------------
  2352. #include <sys/ea.h>                                                      [emx]
  2353.  
  2354. void _ea_free (struct _ea *ptr);
  2355.  
  2356.     Free the memory allocated for the value of an extended attribute
  2357.     stored in the structure pointed to by PTR.  If the VALUE field of
  2358.     the structure is non-NULL, free() is called for that pointer.
  2359.     Then, the VALUE field is set to NULL.
  2360.  
  2361.     See also: _ea_get()
  2362.  
  2363. ------------------------------------------------------------------------------
  2364. #include <sys/ea.h>                                                      [emx]
  2365.  
  2366. int _ea_get (struct _ea *dst, const char *path, int handle,
  2367.              const char *name);
  2368.  
  2369.     Retrieve the extended attribute NAME of a file or directory.  If
  2370.     PATH is non-NULL, an extended attribute of the file or directory
  2371.     named by PATH is retrieved.  Otherwise, an extended attribute of
  2372.     the file referred to by HANDLE is retrieved.  The letter case of
  2373.     NAME is ignored.  The flags, the value and the size of the value
  2374.     of the extended attribute is copied to DST.  If there is an error,
  2375.     errno is set and -1 is returned.  Otherwise, 0 is returned.  If
  2376.     the extended attribute NAME does not exist, 0 is returned, the
  2377.     SIZE field of DST is set to 0 and the VALUE field of DST is set to
  2378.     NULL.  _ea_get() allocates memory for the value of the extended
  2379.     attribute by calling malloc().  The structure declaration is:
  2380.  
  2381.         struct _ea
  2382.         {
  2383.           int flags;
  2384.           int size;
  2385.           void *value;
  2386.         };
  2387.  
  2388.     The FLAGS field contains the flags byte of the extended attribute
  2389.     (only bits 0 through 7 of FLAGS are used).  Currently, OS/2
  2390.     defines only bit 7: it's set for critical EAs.  SIZE is the length
  2391.     of the value in bytes.  The VALUE field points to the (binary)
  2392.     value of the extended attribute.
  2393.  
  2394.     Use _ead_read() to retrieve all the extended attributes of a file
  2395.     or directory.
  2396.  
  2397.     See also: _ea_free(), _ea_put(), _ead_read()
  2398.  
  2399. ------------------------------------------------------------------------------
  2400. #include <sys/ea.h>                                                      [emx]
  2401.  
  2402. int _ea_put (struct _ea *src, const char *path, int handle,
  2403.              const char *name);
  2404.  
  2405.     Add an extended attribute to a file or directory.  If PATH is
  2406.     non-NULL, the extended attribute is added to the file or directory
  2407.     named by PATH.  Otherwise, the extended attribute is added to the
  2408.     file referred to by HANDLE which must be open for writing.  NAME
  2409.     is the name of the extended attribute.  The letter case of NAME is
  2410.     ignored.  SRC points to an _ea structure which holds the flags,
  2411.     size and value of the extended attribute to be added.  If the SIZE
  2412.     field is 0, the extended attribute is removed.  Bits 0 though 7 of
  2413.     FLAGS contain the flags byte for the extended attribute.
  2414.     Currently, OS/2 defines only bit: it's the critical EA bit.  The
  2415.     FLAGS field should be zero unless you exactly know what you're
  2416.     doing.  If there is an error, errno is set and -1 is returned.
  2417.     Otherwise, 0 is returned.
  2418.  
  2419.     Use _ead_write() to replace or update multiple extended attributes
  2420.     at once.
  2421.  
  2422.     See also: _ea_get(), _ea_remove(), _ead_write()
  2423.  
  2424. ------------------------------------------------------------------------------
  2425. #include <sys/ea.h>                                                      [emx]
  2426.  
  2427. int _ea_remove (const char *path, int handle, const char *name);
  2428.  
  2429.     Remove the extended attribute named NAME from a file or directory.
  2430.     If PATH is non-NULL, the extended attribute is removed from the
  2431.     file or directory named by PATH.  Otherwise, the extended
  2432.     attribute is removed from the file referred to by HANDLE.  The
  2433.     letter case of NAME is ignored.  If there is an error, errno is
  2434.     set and -1 is returned.  Otherwise, 0 is returned.  Removing a
  2435.     non-existing extended attribute of an existing file or directory
  2436.     is not an error.
  2437.  
  2438.     See also: _ea_put(), _ead_write()
  2439.  
  2440. ------------------------------------------------------------------------------
  2441. #include <sys/ead.h>                                                     [emx]
  2442.  
  2443. int _ead_add (_ead ead, const char *name, int flags, const void *value,
  2444.               int size);
  2445.  
  2446.     Add the extended attribute NAME to the extended attributes
  2447.     descriptor EAD.  NAME should be a null-terminated string.  The
  2448.     value of the extended attribute is set to SIZE bytes of VALUE.
  2449.     The flags byte of the extended attribute is set to FLAGS.  Only
  2450.     bits 0 through 7 of FLAGS are used.  Currently, OS/2 defines only
  2451.     bit 7 of the flags byte: it's the critical EA bit.  FLAGS should
  2452.     be zero unless you exactly know what you're doing.  If an extended
  2453.     attribute named NAME already exists in EAD, it is updated with
  2454.     FLAGS, SIZE and VALUE.  If there is an error, errno is set and a
  2455.     negative value is returned.  On success, the index of the new (or
  2456.     updated) extended attribute is returned.  The extended attributes
  2457.     on disk are not affected.  After calling _ead_add(), the pointers
  2458.     returned by previous invocations of _ead_get_fea2list(),
  2459.     _ead_get_name() and _ead_get_value() will be invalid.  As
  2460.     _ead_add() does a case-sensitive search, you should pass an
  2461.     upper-case names in NAME.  If there are two extended attributes in
  2462.     an extended attributes descriptor whose names differ only in
  2463.     letter case, only one of both will be written to the disk by
  2464.     _ead_write().
  2465.  
  2466.     See also: _ead_delete(), _ead_replace(), _ead_write(), _nls_strupr()
  2467.  
  2468. ------------------------------------------------------------------------------
  2469. #include <sys/ead.h>                                                     [emx]
  2470.  
  2471. _ead _ead_clear (_ead ead);
  2472.  
  2473.     Discard the extended attributes of the extended attributes
  2474.     descriptor EAD.  After calling _ead_clear(), _ead_count() will
  2475.     return 0 for EAD.  The extended attributes on disk are not
  2476.     modified.  After calling _ead_clear(), do not use pointers
  2477.     returned by _ead_get_name(), _ead_get_value() and
  2478.     _ead_get_fea2list() for that descriptor.
  2479.  
  2480.  
  2481.     See also: _ead_create(), _ead_destroy(), _ead_read()
  2482.  
  2483. ------------------------------------------------------------------------------
  2484. #include <sys/ead.h>                                                     [emx]
  2485.  
  2486. int _ead_copy (_ead dst_ead, _ead src_ead, int src_index);
  2487.  
  2488.     Copy the extended attribute SRC_INDEX from the extended attributes
  2489.     descriptor SRC_EAD to the extended attributes descriptor DST_EAD.
  2490.     If SRC_INDEX is 0, all extended attributes of SRC_EAD are copied
  2491.     to DST_EAD.  Otherwise, SRC_INDEX must be a number between 1 and
  2492.     the number of extended attributes of SRC_EAD.  _ead_copy() uses
  2493.     _ead_add() to copy the extended attributes.  The extended
  2494.     attributes on disk are not affected.
  2495.  
  2496.     See also: _ead_add()
  2497.  
  2498. ------------------------------------------------------------------------------
  2499. #include <sys/ead.h>                                                     [emx]
  2500.  
  2501. int _ead_count (_ead ead);
  2502.  
  2503.     Return the number of extended attributes available from the
  2504.     extended attributes descriptor EAD.
  2505.  
  2506.     See also: _ead_create(), _ead_get_name(), _ead_get_value()
  2507.  
  2508. ------------------------------------------------------------------------------
  2509. #include <sys/ead.h>                                                     [emx]
  2510.  
  2511. _ead _ead_create (void)
  2512.  
  2513.     Create an extended attributes descriptor.  Such a descriptor is
  2514.     used for handling the extended attributes of files and
  2515.     directories.  If successful, _ead_create() returns a descriptor
  2516.     which can be used by the other functions for handling extended
  2517.     attributes.  Otherwise, errno is set and NULL is returned.  Use
  2518.     _ead_destroy() if you no longer need the descriptor.  To copy all
  2519.     the extended attributes of a file or a directory to an extended
  2520.     attributes descriptor, use _ead_read().  Initially, no extended
  2521.     attributes are held by an extended attributes descriptor.
  2522.  
  2523.     Example: /emx/test/eatool.c
  2524.  
  2525.     See also: _ead_destroy(), _ead_get_name(), _ead_get_value(), _ead_read()
  2526.  
  2527. ------------------------------------------------------------------------------
  2528. #include <sys/ead.h>                                                     [emx]
  2529.  
  2530. int _ead_delete (_ead ead, int index);
  2531.  
  2532.     Delete the extended attribute INDEX from the extended attributes
  2533.     descriptor EAD.  INDEX must be a number between 1 and the number
  2534.     of extended attributes of EAD.  If successful, this function
  2535.     returns 0.  Otherwise, errno is set and a negative number is
  2536.     returned.  After calling _ead_delete(), the pointers returned by
  2537.     previous invocations of _ead_get_fea2list(), _ead_get_name() and
  2538.     _ead_get_value() will be invalid.  Moreover, _ead_delete()
  2539.     invalidates index numbers.
  2540.  
  2541.     See also: _ead_add(), _ead_find()
  2542.  
  2543. ------------------------------------------------------------------------------
  2544. #include <sys/ead.h>                                                     [emx]
  2545.  
  2546. void _ead_destroy (_ead ead);
  2547.  
  2548.     Invalidate the extended attributes descriptor EAD which has been
  2549.     created by _ead_create().  All memory associated with EAD is
  2550.     released.  EAD must not be NULL.  After calling _ead_destroy(),
  2551.     EAD is invalid and can no longer be used.  After calling
  2552.     _ead_destroy(), do not use pointers returned by _ead_get_name(),
  2553.     _ead_get_value() and _ead_get_fea2list() for that descriptor.
  2554.  
  2555.     See also: _ead_clear(), _ead_create()
  2556.  
  2557. ------------------------------------------------------------------------------
  2558. #include <sys/ead.h>                                                     [emx]
  2559.  
  2560. int _ead_fea2list_size (_ead ead);
  2561.  
  2562.     Return the size of the FEA2LIST of the extended attributes
  2563.     descriptor EAD.  If EAD doesn't hold any extended attributes, 0 is
  2564.     returned.
  2565.  
  2566.     See also: _ead_get_fea2list()
  2567.  
  2568. ------------------------------------------------------------------------------
  2569. #include <sys/ead.h>                                                     [emx]
  2570.  
  2571. void *_ead_fea2list_to_fealist (const void *src);
  2572.  
  2573.     Convert the FEA2LIST SRC (OS/2 2.0 format) to a FEALIST (OS/2 1.2
  2574.     format).  SRC must not be NULL.  This function allocates memory
  2575.     with malloc() to hold the converted list.  A pointer to the
  2576.     converted list is returned.  If you no longer need the buffer
  2577.     allocated by this function, you should deallocate it with free().
  2578.     If there is an error, errno is set and NULL is returned.  SRC is
  2579.     of type PFEA2LIST, the return value is of type PFEALIST.  To avoid
  2580.     having to include os2.h when including ead.h, void pointers are
  2581.     used instead.
  2582.  
  2583.     See also: _ead_fealist_to_fea2list(), _ead_get_fea2list()
  2584.  
  2585. ------------------------------------------------------------------------------
  2586. #include <sys/ead.h>                                                     [emx]
  2587.  
  2588. void *_ead_fealist_to_fea2list (const void *src);
  2589.  
  2590.     Convert the FEALIST SRC (OS/2 1.2 format) to a FEA2LIST (OS/2 2.0
  2591.     format).  SRC must not be NULL.  This function allocates memory
  2592.     with malloc() to hold the converted list.  A pointer to the
  2593.     converted list is returned.  If you no longer need the buffer
  2594.     allocated by this function, you should deallocate it with free().
  2595.     If there is an error, errno is set and NULL is returned.  SRC is
  2596.     of type PFEALIST, the return value is of type PFEA2LIST.  To avoid
  2597.     having to include os2.h when including ead.h, void pointers are
  2598.     used instead.
  2599.  
  2600.     See also: _ead_fea2list_to_fea2list()
  2601.  
  2602. ------------------------------------------------------------------------------
  2603. #include <sys/ead.h>                                                     [emx]
  2604.  
  2605. int _ead_find (_ead ead, const char *name);
  2606.  
  2607.     Return the index of the extended attribute named NAME of the
  2608.     extended attributes descriptor EAD.  NAME should be a
  2609.     null-terminated string.  If there is no such extended attribute,
  2610.     errno is set to ENOENT and -1 is returned.  Otherwise, a number
  2611.     between 1 and the number of extended attributes of EAD is
  2612.     returned.  Note that OS/2 converts names of extended attributes to
  2613.     upper case when writing them to the disk.  As _ead_find() does a
  2614.     case-sensitive compare, lower-case names are not found.
  2615.  
  2616.     See also: _ead_count(), _ead_get_name(), _ead_get_value(), _nls_strupr()
  2617.  
  2618. ------------------------------------------------------------------------------
  2619. #include <sys/ead.h>                                                     [emx]
  2620.  
  2621. const void *_ead_get_fea2list (_ead ead);
  2622.  
  2623.     Return a pointer to the FEA2LIST of the extended attributes
  2624.     descriptor EAD.  You should cast the return value to PFEA2LIST.
  2625.     The return type of _ead_get_fea2list() is not PFEA2LIST to be able
  2626.     to include ead.h without having to include os2.h.  The pointer
  2627.     points to memory allocated by the extended attributes functions --
  2628.     do not use the pointer after calling _ead_add(), _ead_clear(),
  2629.     _ead_copy(), _ead_delete(), _ead_destroy() or _ead_replace() and
  2630.     do not write to the buffer.
  2631.  
  2632.     See also: _ead_fea2list_size(), _ead_fea2list_to_fealist()
  2633.  
  2634. ------------------------------------------------------------------------------
  2635. #include <sys/ead.h>                                                     [emx]
  2636.  
  2637. int _ead_get_flags (_ead ead, int index);
  2638.  
  2639.     Return the flags byte of the extended attribute INDEX of the
  2640.     extended attributes descriptor EAD.  INDEX must be a number
  2641.     between 1 and the number of extended attributes of EAD.  On error,
  2642.     errno is set and -1 is returned.
  2643.  
  2644.     See also: _ead_count(), _ead_get_value()
  2645.  
  2646. ------------------------------------------------------------------------------
  2647. #include <sys/ead.h>                                                     [emx]
  2648.  
  2649. const char *_ead_get_name (_ead ead, int index);
  2650.  
  2651.     Return a pointer to the name of the extended attribute INDEX of
  2652.     the extended attributes descriptor EAD.  INDEX must be a number
  2653.     between 1 and the number of extended attributes of EAD.  The
  2654.     pointer points to memory allocated by the extended attributes
  2655.     functions -- do not use the pointer after calling _ead_add(),
  2656.     _ead_clear(), _ead_copy(), _ead_delete(), _ead_destroy() or
  2657.     _ead_replace() and do not write to the buffer.  On error, errno is
  2658.     set and NULL is returned.
  2659.  
  2660.     See also: _ead_count(), _ead_name_len()
  2661.  
  2662. ------------------------------------------------------------------------------
  2663. #include <sys/ead.h>                                                     [emx]
  2664.  
  2665. const void *_ead_get_value (_ead ead, int index);
  2666.  
  2667.     Return a pointer to the value of the extended attribute INDEX of
  2668.     the extended attributes descriptor EAD.  INDEX must be a number
  2669.     between 1 and the number of extended attributes of EAD.  The
  2670.     pointer points to memory allocated by the extended attributes
  2671.     functions -- do not use the pointer after calling _ead_add(),
  2672.     _ead_clear(), _ead_copy(), _ead_delete(), _ead_destroy() or
  2673.     _ead_replace() and do not write to the buffer.  On error, errno is
  2674.     set and NULL is returned.
  2675.  
  2676.     See also: _ead_count(), _ead_find(), _ead_get_flags(), _ead_value_size()
  2677.  
  2678. ------------------------------------------------------------------------------
  2679. #include <sys/ead.h>                                                     [emx]
  2680.  
  2681. int _ead_name_len (_ead ead, int index);
  2682.  
  2683.     Return the length of the name of the extended attribute INDEX of
  2684.     the extended attributes descriptor EAD.  If INDEX is 0, the total
  2685.     length of all the names is returned, not including the terminating
  2686.     null characters.  Otherwise, INDEX must be a number between 1 and
  2687.     the number of extended attributes of EAD; the length of the name
  2688.     of the INDEXth extended attribute is returned.  The terminating
  2689.     null character is not included in the length.  On error, errno is
  2690.     set and -1 is returned.
  2691.  
  2692.     See also: _ead_count(), _ead_get_name()
  2693.  
  2694. ------------------------------------------------------------------------------
  2695. #include <sys/ead.h>                                                     [emx]
  2696.  
  2697. _ead _ead_read (_ead ead, const char *path, int handle, int flags);
  2698.  
  2699.     Copy the extended attributes of a file or directory to the
  2700.     extended attributes descriptor EAD.  The extended attributes held
  2701.     previously by EAD are discarded.  If PATH is not NULL, the
  2702.     extended attributes of that path name (file or directory) are
  2703.     copied to EAD.  If PATH is NULL, the extended attributes of the
  2704.     file referred to by the file handle HANDLE are copied to EAD.
  2705.     FLAGS is not yet used and must be 0.  If successful, _ead_read()
  2706.     returns zero.  Otherwise, errno is set and a negative number is
  2707.     returned.  _ead_read() calls _ead_clear(), reads all the extended
  2708.     attributes and stores them in memory.  Use _ead_destroy() to
  2709.     deallocate that memory and invalidate EAD.  When using a non-NULL
  2710.     PATH, _ead_read() does not lock the file while while reading the
  2711.     extended attributes.  You might want to open a handle in
  2712.     deny-write mode and pass it in HANDLE to avoid problems due to
  2713.     other threads or processes modifying the extended attributes while
  2714.     _ead_read() is reading.  This doesn't work with and isn't required
  2715.     for directories.  _ead_read() can also be used under DOS though no
  2716.     extended attributes will be copied.  Therefore, your program
  2717.     doesn't have to decide whether to use these functions or not.
  2718.  
  2719.     Use _ea_get() to retrieve extended attributes one by one.
  2720.  
  2721.     See also: _ea_get(), _ead_create(), _ead_destroy(), _ead_get_name(),
  2722.               _ead_get_value()
  2723.  
  2724. ------------------------------------------------------------------------------
  2725. #include <sys/ead.h>                                                     [emx]
  2726.  
  2727. int _ead_replace (_ead ead, int index, int flags, const void *value, int size);
  2728.  
  2729.     Update the extended attribute INDEX of the extended attributes
  2730.     descriptor EAD with FLAGS and SIZE bytes of VALUE.  INDEX must be
  2731.     a number between 1 and the number of extended attributes of EAD.
  2732.     On success, _ead_replace() returns 0.  On error, errno is set and
  2733.     a negative value is returned.  The extended attributes on disk are
  2734.     not affected.  After calling _ead_replace(), the pointers returned
  2735.     by previous invocations of _ead_get_fea2list(), _ead_get_name()
  2736.     and _ead_get_value() will be invalid.
  2737.  
  2738.     See also: _ead_add(), _ead_write()
  2739.  
  2740. ------------------------------------------------------------------------------
  2741. #include <sys/ead.h>                                                     [emx]
  2742.  
  2743. void _ead_sort (_ead ead);
  2744.  
  2745.     Sort by name the extended attributes of the extended attributes
  2746.     descriptor EAD.  Sorting is done in memory -- the extended
  2747.     attributes on disk are not affected.  After calling _ead_sort(),
  2748.     index 1 refers to the extended attribute with the lexically
  2749.     smallest name.  strcmp() is used for comparing names.  _ead_sort()
  2750.     sorts the index, not the extended attributes proper.  Therefore,
  2751.     all functions that modify the extended attributes of EAD undo the
  2752.     effect of _ead_sort().
  2753.  
  2754.     See also: _ead_create(), _ead_get_name(), _ead_read()
  2755.  
  2756. ------------------------------------------------------------------------------
  2757. #include <sys/ead.h>                                                     [emx]
  2758.  
  2759. int _ead_use_fea2list (_ead ead, const void *src);
  2760.  
  2761.     Copy all the extended attributes from the FEA2LIST SRC (OS/2 2.0
  2762.     format) to the extended attributes descriptor EAD.  All extended
  2763.     attributes previously held by EAD are discarded.  The extended
  2764.     attributes on the disk are not affected.  If successful,
  2765.     _ead_use_fea2list() returns 0.  Otherwise, errno is set and a
  2766.     negative value is returned.
  2767.  
  2768.     See also: _ead_write()
  2769.  
  2770. ------------------------------------------------------------------------------
  2771. #include <sys/ead.h>                                                     [emx]
  2772.  
  2773. int _ead_value_size (_ead ead, int index);
  2774.  
  2775.     Return the size of the extended attribute INDEX of the extended
  2776.     attributes descriptor EAD.  If INDEX is 0, the total size of all
  2777.     the values of EAD is returned.  Otherwise, INDEX must be a number
  2778.     between 1 and the number of extended attributes of EAD; the size
  2779.     of the INDEXth extended attribute is returned.  On error, errno is
  2780.     set and -1 is returned.
  2781.  
  2782.     See also: _ead_count(), _ead_get_value()
  2783.  
  2784. ------------------------------------------------------------------------------
  2785. #include <sys/ead.h>                                                     [emx]
  2786.  
  2787. int _ead_write (_ead ead, const char *path, int handle, int flags);
  2788.  
  2789.     Write all the extended attributes of the extended attributes
  2790.     descriptor EAD to the file or directory PATH or HANDLE.  The
  2791.     extended attributes previously attached to that file or directory
  2792.     are discarded and replaced by the extended attributes of EAD if
  2793.     FLAGS is 0.  This is done by deleting the extended attributes of
  2794.     the file or directory which are not in EAD.  If FLAGS is
  2795.     _EAD_MERGE, the extended attributes of the file or directory which
  2796.     are also present in EAD are replaced by those of EAD.  Extended
  2797.     attributes of EAD which are not attached to the file or directory
  2798.     are added to the extended attributes of the file or directory.  If
  2799.     PATH is non-NULL, the extended attributes are written to the file
  2800.     or directory specified by the path name PATH.  If PATH is NULL,
  2801.     the extended attributes are written to the file referred to by the
  2802.     file handle HANDLE.  The extended attributes of EAD are not
  2803.     modified.  If _ead_write() is successful, 0 is returned.
  2804.     Otherwise, errno is set and a negative value is returned.  Under
  2805.     DOS, _ead_write() does nothing and always returns 0.
  2806.  
  2807.     Use _ea_put() to add or update extended attributes one by one.
  2808.  
  2809.     See also: _ea_put(), _ead_clear(), _ead_read(), _ead_use_fea2list()
  2810.  
  2811. ------------------------------------------------------------------------------
  2812. #include <os2.h>                                                         [emx]
  2813.  
  2814. void *_emx_16to32 (_far16ptr ptr);
  2815. _far16ptr _emx_32to16 (void *ptr);
  2816.  
  2817.     _emx_16to32 converts a 16-bit far pointer (16:16 format) to a
  2818.     32-bit flat pointer.
  2819.  
  2820.     _emx_32to16 converts a 32-bit flat pointer to a 16-bit far pointer
  2821.     (16:16 format).
  2822.  
  2823.     The type _far16ptr is used for 16-bit far pointers.
  2824.  
  2825. ------------------------------------------------------------------------------
  2826. #include <stdlib.h>                                                       [PC]
  2827.  
  2828. void _endthread (void);
  2829.  
  2830.     A thread that has been created by _beginthread() can call
  2831.     _endthread() to end its execution.  A thread also ends when the
  2832.     function started with _beginthread() returns.  Terminating the
  2833.     main thread (thread 1) of a process terminates the process (return
  2834.     value will be 0).  Do not use DosExit to end a thread started by
  2835.     _beginthread().
  2836.  
  2837.     _endthread() is available only when using emxlibc.dll (-Zmt).
  2838.  
  2839.     See also: _beginthread ()
  2840.  
  2841. ------------------------------------------------------------------------------
  2842. #include <io.h>                                                           [PC]
  2843.  
  2844. int eof (int handle);
  2845.  
  2846.     Return 1 if the current position of HANDLE is at the end of the
  2847.     file, return 0 otherwise.  On failure, -1 is returned.
  2848.  
  2849. ------------------------------------------------------------------------------
  2850. #include <process.h>                                                    [UNIX]
  2851.  
  2852. /* exec () */
  2853.  
  2854. int execl (const char *name, const char *arg0, ...);
  2855. int execle (const char *name, const char *arg0, ...);
  2856. int execlp (const char *name, const char *arg0, ...);
  2857. int execlpe (const char *name, const char *arg0, ...);
  2858. int execv (const char *name, const char * const *argv);
  2859. int execve (const char *name, const char * const *argv,
  2860.             const char * const *envp);
  2861. int execvp (const char *name, const char * const *argv);
  2862. int execvpe(const char *name, const char * const *argv,
  2863.             const char * const *envp);
  2864.  
  2865.     Replace calling process with a new process.  The calling process
  2866.     terminates after starting the new process.  NAME is the name of
  2867.     the executable file to run.  Use execl(), execle(), execlp() or
  2868.     execlpe() for passing a fixed number of arguments.  ARG0 is the
  2869.     0th argument which is the program name, by convention.  Following
  2870.     ARG0, the arguments are given.  After the last argument, a NULL
  2871.     pointer must be following.  At least ARG0 must be specified.  Use
  2872.     execv(), execve(), execvp() or execvpe() for passing a variable
  2873.     number of arguments.  ARGV points to an array of strings.  The
  2874.     first entry is the program name, by convention.  The last argument
  2875.     must be followed by a NULL pointer.
  2876.  
  2877.     execl(), execlp(), execv() and execvp() pass the environment of
  2878.     the current process to the child process.  To pass a different
  2879.     environment to the child process pass a pointer to an array of
  2880.     strings after the NULL argument pointer of execle() and execlpe()
  2881.     or pass the pointer in the ENVP argument of execve() and
  2882.     execvpe().  The last environment string in the array must be
  2883.     followed by a NULL pointer.
  2884.  
  2885.     When the new process ends, the parent process is notified by
  2886.     SIGCLD and wait() will return the original process ID.
  2887.  
  2888.     Return value: the return value is -1 if an error occurs.  On
  2889.     success, these functions do not return.
  2890.  
  2891.     Restrictions: Native DOS programs cannot be run.  The new process
  2892.     gets a new process ID.  All signals are reset to SIG_DFL in the
  2893.     new process.
  2894.  
  2895.     See also: spawn()
  2896.  
  2897. ------------------------------------------------------------------------------
  2898. #include <stdlib.h>                                                     [ANSI]
  2899.  
  2900. void volatile exit (int ret);
  2901.  
  2902.     Flush streams, remove temporary files, call functions set by
  2903.     atexit() and terminate the current process.  The return code RET
  2904.     is passed to the parent process.  If RET is negative or greater
  2905.     than 255, 255 will be used instead to avoid returning 0 (success)
  2906.     for non-zero RET due to truncation to 8 bits.
  2907.  
  2908.     See also: abort(), atexit(), _exit()
  2909.  
  2910. ------------------------------------------------------------------------------
  2911. #include <stdlib.h>                                                     [UNIX]
  2912.  
  2913. void volatile _exit (int ret);
  2914.  
  2915.     Exit without flushing streams, removing temporary files or calling
  2916.     functions set by atexit().  The return code RET is passed to the
  2917.     parent process.  If RET is negative or greater than 255, 255 will
  2918.     be used instead to avoid returning 0 (success) for non-zero RET
  2919.     due to truncation to 8 bits.
  2920.  
  2921.     See also: abort(), atexit(), exit()
  2922.  
  2923. ------------------------------------------------------------------------------
  2924. #include <math.h>                                                       [ANSI]
  2925.  
  2926. double exp (double x);
  2927.  
  2928.     exp() computes the exponential function of X, e^X is returned.
  2929.  
  2930.     On overflow, +#INF is returned and errno set to ERANGE.
  2931.  
  2932.     See also: log(), pow()
  2933.  
  2934. ------------------------------------------------------------------------------
  2935. #include <stdlib.h>                                                       [PC]
  2936.  
  2937. void *_expand (void *mem, size_t new_size);
  2938.  
  2939.     Try to expand the memory block pointed to by MEM to the new size
  2940.     NEW_SIZE.  If the block cannot be expanded, NULL is returned.
  2941.     Otherwise, MEM is returned.  Please do not use this function --
  2942.     use realloc() instead.
  2943.  
  2944.     See also: realloc()
  2945.  
  2946. ------------------------------------------------------------------------------
  2947. #include <math.h>                                                       [ANSI]
  2948.  
  2949. double fabs (double x);
  2950.  
  2951.     Return the absolute value of X: If X is negative, -X is returned.
  2952.     Otherwise, X is returned.
  2953.  
  2954.     See also: abs(), labs()
  2955.  
  2956. ------------------------------------------------------------------------------
  2957. #include <stdio.h>                                                      [ANSI]
  2958.  
  2959. int fclose (FILE *stream);
  2960.  
  2961.     Close the open stream STREAM.  Return 0 if successful, EOF
  2962.     otherwise.
  2963.  
  2964.     See also: fcloseall(), fflush(), fopen()
  2965.  
  2966. ------------------------------------------------------------------------------
  2967. #include <stdio.h>                                                        [PC]
  2968.  
  2969. int fcloseall (void);
  2970.  
  2971.     Close all open streams.  Return the number streams closed or EOF
  2972.     if an error occurs.
  2973.  
  2974.     See also: fclose(), flushall(), fopen()
  2975.  
  2976. ------------------------------------------------------------------------------
  2977. #include <fcntl.h>                                                   [*] [BSD]
  2978.  
  2979. int fcntl (int handle, int request, int arg);
  2980.  
  2981.     File control.  The following two REQUEST codes are implemented
  2982.     (partially):
  2983.  
  2984.     F_GETFL     Return the file flags of the file specified by HANDLE.
  2985.                 Currently, only two file flags are supported by fcntl:
  2986.                 O_APPEND and O_NDELAY.
  2987.  
  2988.     F_SETFL     Set the file flags of the file specified by HANDLE.
  2989.                 Currently, only two file flags are supported by fcntl:
  2990.                 O_APPEND and O_NDELAY.  O_NDELAY has an effect only if
  2991.                 HANDLE is 0 and HANDLE refers to the keyboard and the
  2992.                 IDEFAULT and ICANON bits are not set.  O_NDELAY also
  2993.                 works for pipes created by emx programs and for named
  2994.                 pipes.  See `termio' and read().
  2995.  
  2996.     F_GETFD     Return close-on-exec flag in bit 0 of return value.
  2997.                 If the bit is set, HANDLE will not be inherited by
  2998.                 child processes.
  2999.  
  3000.     F_SETFD     Set close-on-exec flag from bit 0 of ARG.  If the bit
  3001.                 is set, HANDLE will not be inherited by child
  3002.                 processes.
  3003.  
  3004.     Restrictions: F_GETFD and F_SETFD are not implemented under DOS.
  3005.     When using the system call library libsys.lib (-Zsys), O_NDELAY
  3006.     is not supported.
  3007.  
  3008.     See also: dup(), ioctl(), open()
  3009.  
  3010. ------------------------------------------------------------------------------
  3011. #include <stdio.h>                                                      [UNIX]
  3012.  
  3013. FILE *fdopen (int handle, const char *mode);
  3014.  
  3015.     Create a stream for the low-level file handle HANDLE.  The MODE
  3016.     flags should match the mode used for opening the file handle
  3017.     HANDLE.  If `b' or `t' is used in MODE, the handle will be changed
  3018.     using setmode() to O_BINARY or O_TEXT mode, respectively.  If
  3019.     neither `b' nor `t' is used, the translation mode is not changed.
  3020.     You should not rely on this behaviour: always specify the desired
  3021.     translation mode.  A future release of the C library will have
  3022.     independent modes for low-level files and streams.  If fdopen()
  3023.     fails, NULL is returned.
  3024.  
  3025.     See also: fopen(), open()
  3026.  
  3027. ------------------------------------------------------------------------------
  3028. #include <stdio.h>                                                      [ANSI]
  3029.  
  3030. int ferror (FILE *stream);
  3031. int feof (FILE *stream);
  3032.  
  3033.     ferror() returns a non-zero value if the error indicator of STREAM
  3034.     is set.  feof() returns a non-zero value if the end-of-file
  3035.     indicator of STREAM is set.
  3036.  
  3037.     See also: clearerr()
  3038.  
  3039. ------------------------------------------------------------------------------
  3040. #include <stdio.h>                                                      [ANSI]
  3041.  
  3042. int fflush (FILE *stream);
  3043.  
  3044.     Write the buffer of STREAM to its file if STREAM is open for
  3045.     writing.  Clear the buffer of STREAM if STREAM is open for
  3046.     reading.  The effect of ungetc() is undone.
  3047.  
  3048.     Return value:
  3049.  
  3050.       0    success
  3051.  
  3052.       EOF  failure
  3053.  
  3054.     See also: fclose()
  3055.  
  3056. ------------------------------------------------------------------------------
  3057. #include <strings.h>                                                     [BSD]
  3058.  
  3059. int ffs (int i);
  3060.  
  3061.     Find the first bit set in I and return the index of that bit.  The
  3062.     least significant bit is numbered 1, the most significant bit is
  3063.     numbered 32.  The smallest number n is returned for which bit n is
  3064.     set in I.  If there are no bits set in I (that is, I is zero),
  3065.     zero is returned.
  3066.  
  3067. ------------------------------------------------------------------------------
  3068. #include <stdio.h>                                                      [ANSI]
  3069.  
  3070. int fgetc (FILE *stream);
  3071.  
  3072.     Read a character from STREAM.  The character is returned.  If an
  3073.     error occurs or if the end of the file is reached, EOF is
  3074.     returned.  fgetc() is a function.
  3075.  
  3076.     See also: fgetchar(), getc(), getchar()
  3077.  
  3078. ------------------------------------------------------------------------------
  3079. #include <stdio.h>                                                        [PC]
  3080.  
  3081. int fgetchar (void);
  3082.  
  3083.     Read a character from stdin, respectively.  The character is
  3084.     returned.  If an error occurs or if the end of the file is
  3085.     reached, EOF is returned.
  3086.  
  3087.         fgetchar ()
  3088.  
  3089.     is equivalent to
  3090.  
  3091.         fgetc (stdin).
  3092.  
  3093.     fgetchar() is a function.
  3094.  
  3095.     See also: fgetc(), getchar()
  3096.  
  3097. ------------------------------------------------------------------------------
  3098. #include <stdio.h>                                                      [ANSI]
  3099.  
  3100. int fgetpos (FILE *stream, fpos_t *pos);
  3101.  
  3102.     Store the current position of the file pointer of the file STREAM
  3103.     in the variable pointed to by POS.  fgetpos() currently does not
  3104.     work with text-mode files.
  3105.  
  3106.     See also: fsetpos(), ftell()
  3107.  
  3108. ------------------------------------------------------------------------------
  3109. #include <stdio.h>                                                      [ANSI]
  3110.  
  3111. char *fgets (char *buffer, int n, FILE *stream);
  3112.  
  3113.     Read a string from STREAM to BUFFER.  Stop after reading N-1
  3114.     characters or after a newline (LF) character has been read.  A
  3115.     null character is appended.  fgets() returns BUFFER.  If an error
  3116.     occurs or the end of the file is reached, fgets() returns NULL.
  3117.  
  3118.     See also: gets(), scanf()
  3119.  
  3120. ------------------------------------------------------------------------------
  3121. #include <io.h>                                                           [PC]
  3122.  
  3123. long filelength (int handle);
  3124.  
  3125.     Return the length in bytes of the file HANDLE.  If there is an
  3126.     error, -1 is returned.
  3127.  
  3128.     See also: chsize(), ftruncate(), lseek()
  3129.  
  3130. ------------------------------------------------------------------------------
  3131. #include <stdio.h>                                                      [UNIX]
  3132.  
  3133. int fileno (FILE *stream);
  3134.  
  3135.     fileno() returns the file handle associated with STREAM.
  3136.  
  3137.     See also: fdopen()
  3138.  
  3139. ------------------------------------------------------------------------------
  3140. #include <stdlib.h>                                                      [emx]
  3141.  
  3142. int _filesys (const char *drive, char *name, size_t size);
  3143.  
  3144.     Copy the file system type of DRIVE to the buffer NAME.  The size
  3145.     of the buffer is SIZE bytes.  DRIVE must point to a drive letter
  3146.     followed by a colon.  Examples for file system types are: FAT,
  3147.     LAN, HPFS, CDFS, NFS.
  3148.  
  3149.     Return value:
  3150.  
  3151.       0    success.  The file system type has been copied to NAME.
  3152.  
  3153.       -1   failure.  errno contains the error number.
  3154.  
  3155.     Example:
  3156.  
  3157.          char drive[3] = "C:";
  3158.          char fsys[16];
  3159.  
  3160.          if (_filesys (drive, fsys, sizeof (fsys)) != 0)
  3161.            perror ("_filesys");
  3162.          else
  3163.            printf ("File system: %s\n", fsys);
  3164.  
  3165.     Typical output of the example:
  3166.  
  3167.          File system: FAT
  3168.  
  3169.     See also: _fnlwr()
  3170.  
  3171. ------------------------------------------------------------------------------
  3172. #include <math.h>                                                       [ANSI]
  3173.  
  3174. double floor (double x);
  3175.  
  3176.     Return as floating-point number the largest integer that is less
  3177.     than or equal to X (round down).
  3178.  
  3179.     See also: ceil(), rint(), trunc()
  3180.  
  3181. ------------------------------------------------------------------------------
  3182. #include <stdio.h>                                                        [PC]
  3183.  
  3184. int flushall (void);
  3185.  
  3186.     Flush the buffers of all open streams.  Write the buffers of
  3187.     streams open for writing to their files, clear the buffers of
  3188.     streams open for reading.  The number of open streams is returned.
  3189.  
  3190.     See also: fflush()
  3191.  
  3192. ------------------------------------------------------------------------------
  3193. #include <math.h>                                                       [ANSI]
  3194.  
  3195. double fmod (double x, double y);
  3196.  
  3197.     Compute remainder of X/Y.  The return value z is calculated such
  3198.     that X = i * Y + z, where i is an integer, z has the same sign as
  3199.     X and |z| < |Y|.  fmod (x, 0.0) returns 0.0.
  3200.  
  3201. ------------------------------------------------------------------------------
  3202. #include <stdlib.h>                                                      [emx]
  3203.  
  3204. int _fncmp (const unsigned char *string1, const unsigned char *string2);
  3205.  
  3206.     _fncmp() compares the two file name strings STRING1 and STRING2
  3207.     and returns zero if the two strings are identical after conversion
  3208.     to upper case.  Otherwise, a non-zero value is returned which is
  3209.     negative if STRING1 is less than STRING2 and positive if STRING1
  3210.     is greater than STRING2 after conversion to upper case.
  3211.     Conversion to upper case includes accented characters etc.,
  3212.     depending on the current country code and code page.  If
  3213.     _nls_init() has not yet been called, it is called by _fncmp().
  3214.  
  3215.     See also: _nls_init(), _nls_strupr(), strcmp()
  3216.  
  3217. ------------------------------------------------------------------------------
  3218. #include <stdlib.h>                                                      [emx]
  3219.  
  3220. char **_fnexplode (const char *mask);
  3221. void _fnexplodefree (char **list);
  3222.  
  3223.     Wildcard expansion of MASK.  _fnexplode() returns a vector
  3224.     containing pointers to the file names.  The list includes
  3225.     directories.  Hidden and system files are omitted.  The end of the
  3226.     list is marked by a NULL pointer.  On error, NULL is returned.
  3227.     Memory is allocated with malloc().
  3228.  
  3229.     _fnlwr() is used to convert file names to lower case on
  3230.     upper-case-only file systems.
  3231.  
  3232.     Use _fnexplodefree() to free the memory allocated for a file name
  3233.     list.
  3234.  
  3235.     Example: /emx/test/eatool.c
  3236.  
  3237.     See also: _dt_read(), _fnlwr(), opendir(), _wildcard()
  3238.  
  3239. ------------------------------------------------------------------------------
  3240. #include <stdlib.h>                                                      [emx]
  3241.  
  3242. char _fngetdrive (const char *src);
  3243.  
  3244.     Return as upper-case letter the drive name given in the path name
  3245.     SRC.  If SRC does not contain a drive name, _fngetdrive() returns
  3246.     0.
  3247.  
  3248.     Example:
  3249.  
  3250.         char *fname, drive;
  3251.  
  3252.         drive = _fngetdrive (fname);
  3253.         if (drive == 0)
  3254.           drive = _getdrive ();
  3255.  
  3256. ------------------------------------------------------------------------------
  3257. #include <stdlib.h>                                                      [emx]
  3258.  
  3259. int _fnisabs (const char *name);
  3260.  
  3261.     Return a non-zero value if NAME is an absolute file name.
  3262.     Otherwise, return 0.  Absolute file names start with \ or /,
  3263.     optionally preceded by a drive name.
  3264.  
  3265.     See also: _abspath()
  3266.  
  3267. ------------------------------------------------------------------------------
  3268. #include <stdlib.h>                                                      [emx]
  3269.  
  3270. void _fnlwr (char *name);
  3271. void _rfnlwr (void);
  3272. void _sfnlwr (const char *name);
  3273.  
  3274.     _fnlwr() converts the file name NAME to lower case unless the file
  3275.     system is case preserving.  Accented characters etc. are converted
  3276.     as well.  If NAME does not contain a drive letter, it is assumed
  3277.     to refer to the drive set by _sfnlwr().  To save time, _fnlwr()
  3278.     caches information about file systems.  If the file system of a
  3279.     drive changes or if the current drive changes, you should call
  3280.     _rfnlwr() to reset the cache.  _sfnlwr() takes the drive name from
  3281.     NAME for future _fnlwr() calls.  If _sfnlwr() hasn't been called
  3282.     since the last call to _rfnlwr() or if NAME does not contain a
  3283.     drive letter, _fnlwr() uses the current drive.  If _nls_init() has
  3284.     not yet been called, it is called by _fnlwr().
  3285.  
  3286.     See also: _filesys(), _nls_init(), _nls_strlwr()
  3287.  
  3288. ------------------------------------------------------------------------------
  3289. #include <stdio.h>                                                      [ANSI]
  3290.  
  3291. FILE *fopen (const char *fname, const char *mode);
  3292.  
  3293.     Open a stream.  FNAME is the name of the file, MODE is a string
  3294.     which specifies the file mode.  The first character of MODE is `r'
  3295.     for reading, `w' for writing or `a' for appending.  If a `+'
  3296.     character follows `a' or `w', the file will be also opened for
  3297.     reading.  There are two additional MODE flags: `t' for text mode,
  3298.     `b' for binary mode.  Text mode, which is the default, skips CR
  3299.     characters on input and converts LF characters to CR/LF pairs on
  3300.     output.  Ctrl-Z on input indicates EOF.  Binary mode disables
  3301.     these transformations.
  3302.  
  3303.     The file is opened in the sharing mode SH_DENYNO, see sopen().  If
  3304.     you want to use a different sharing mode, use _fsopen().
  3305.  
  3306.     See also: fclose(), fdopen(), freopen(), _fsopen(), sopen()
  3307.  
  3308. ------------------------------------------------------------------------------
  3309. #include <process.h>                                                [*] [UNIX]
  3310.  
  3311. int fork (void);
  3312.  
  3313.     Duplicate current process.  A child process is created which is a
  3314.     copy of the calling process.  Both the parent process and the
  3315.     child process resume at the point where fork() was called.  The
  3316.     child process inherits the following attributes of the parent
  3317.     process:
  3318.  
  3319.     - environment
  3320.  
  3321.     - memory
  3322.  
  3323.     - signal settings (function address or SIG_DFL or SIG_IGN)
  3324.  
  3325.     - file handles (unless private, see fcntl())
  3326.  
  3327.     - current working directories
  3328.  
  3329.     - umask
  3330.  
  3331.     - break points.  This is an OS/2 bug.  When debugging a program
  3332.       containing fork(), set a breakpoint in the branch of execution
  3333.       that's executed only in the parent process
  3334.  
  3335.     The new process differs from the parent process in the following
  3336.     ways:
  3337.  
  3338.     - the child process has a unique process ID
  3339.  
  3340.     - the child process has a different parent process ID (the process
  3341.       ID of the parent process)
  3342.  
  3343.     - the child process has copies of the file descriptors of the
  3344.       parent process.  The file pointers are shared
  3345.  
  3346.     - termio is turned off in child process
  3347.  
  3348.     - all resources allocated using OS/2 calls are not inherited by
  3349.       the child process: semaphores, queues, threads, memory, file
  3350.       handles, etc.
  3351.  
  3352.     - the alarm clock is turned off
  3353.  
  3354.     - the CPU time (returned by clock()) is set to 0
  3355.  
  3356.     When the new process terminates, SIGCLD is raised in the process
  3357.     which forked that process.
  3358.  
  3359.     On error, -1 is returned.  On success, the process ID of the new
  3360.     process is returned to the calling process, 0 to the new process.
  3361.  
  3362.     Restrictions: fork() is not implemented for DOS.  fork() works
  3363.     only in programs linked by ld.  It does not work in programs
  3364.     linked by LINK386.  When using the system call library libsys.lib
  3365.     (-Zsys), fork() is not available.  fork() is very inefficient for
  3366.     OS/2.  To start a child process, use spawn() instead of fork() and
  3367.     exec().  Private file handles (see fcntl()) are not inherited by
  3368.     the child process.  If the parent process uses termio for the
  3369.     keyboard, the child process cannot read from the keyboard using
  3370.     _read_kbd(), termio or the Kbd OS/2 API functions.
  3371.  
  3372.     See also: alarm(), fcntl(), spawn()
  3373.  
  3374. ------------------------------------------------------------------------------
  3375. #include <stdio.h>                                                      [ANSI]
  3376.  
  3377. int fprintf (FILE *stream, const char *format, ...);
  3378.  
  3379.     Formatted output to the stream STREAM.  On success, the number of
  3380.     characters written to STREAM is returned.  Otherwise, EOF is
  3381.     returned.
  3382.  
  3383.     See also: fscanf(), printf()
  3384.  
  3385. ------------------------------------------------------------------------------
  3386. #include <stdio.h>                                                      [ANSI]
  3387.  
  3388. int fputc (int c, FILE *stream);
  3389.  
  3390.     Write the character C to STREAM.
  3391.  
  3392.     The character written is returned.  On failure, EOF is returned.
  3393.     fputc() is a functions.
  3394.  
  3395.     See also: fprintf(), fputchar(), fputs(), putc(), putchar()
  3396.  
  3397. ------------------------------------------------------------------------------
  3398. #include <stdio.h>                                                        [PC]
  3399.  
  3400. int fputchar (int c);
  3401.  
  3402.     Write the character C to stdout.
  3403.  
  3404.         fputchar (c)
  3405.  
  3406.     is equivalent to
  3407.  
  3408.         fputc (c, stdout).
  3409.  
  3410.     The character written is returned.  On failure, EOF is returned.
  3411.     fputchar() is a function.
  3412.  
  3413.     See also: fputc(), putchar()
  3414.  
  3415. ------------------------------------------------------------------------------
  3416. #include <stdio.h>                                                      [ANSI]
  3417.  
  3418. int fputs (const char *string, FILE *stream);
  3419.  
  3420.     Write the string STRING to STREAM.  On failure, EOF is returned.
  3421.     Otherwise, a non-negative value is returned.  In contrast to
  3422.     puts(), a LF character is not appended automatically.
  3423.  
  3424.     See also: fgets(), fputc(), printf(), puts()
  3425.  
  3426. ------------------------------------------------------------------------------
  3427. #include <stdio.h>                                                      [ANSI]
  3428.  
  3429. size_t fread (void *buffer, size_t size, size_t count, FILE *stream);
  3430.  
  3431.     Read COUNT objects of SIZE bytes each from STREAM to BUFFER.  The
  3432.     file pointer is incremented by the number of bytes read.  The
  3433.     number of complete objects read is returned which may be less than
  3434.     COUNT, for instance 0, if an error occurs or if the end of the
  3435.     file is reached.  Use ferror() and feof() to distinguish between
  3436.     these two conditions.  On failure, the position of the file
  3437.     pointer is undefined.
  3438.  
  3439.     If STREAM has been opened in text mode, CR/LF pairs are translated
  3440.     to LF characters.  This translation does not affect the return
  3441.     value -- SIZE and COUNT are applied after translation.
  3442.  
  3443.     See also: fgetc(), fgets(), fwrite()
  3444.  
  3445. ------------------------------------------------------------------------------
  3446. #include <stdlib.h>                                                     [ANSI]
  3447.  
  3448. void free (void *mem);
  3449.  
  3450.     Deallocate a block of memory allocated by malloc(), calloc() or
  3451.     realloc().  MEM points to the block of memory.  MEM must have been
  3452.     returned by malloc(), calloc() or realloc().  Do not use MEM after
  3453.     calling free().
  3454.  
  3455.     See also: calloc(), malloc(), realloc()
  3456.  
  3457. ------------------------------------------------------------------------------
  3458. #include <stdio.h>                                                      [ANSI]
  3459.  
  3460. FILE *freopen (const char *fname, const char *mode, FILE *stream);
  3461.  
  3462.     Close and reopen STREAM.  The file FNAME will be opened in mode
  3463.     MODE.  See fopen() for details.  If successful, a pointer to the
  3464.     new stream is returned.  Otherwise, NULL is returned.
  3465.  
  3466.     See also: fclose(), fopen()
  3467.  
  3468. ------------------------------------------------------------------------------
  3469. #include <math.h>                                                       [ANSI]
  3470.  
  3471. double frexp (double x, int *exp_ptr);
  3472.  
  3473.     Extract mantissa and exponent of X.  The mantissa is returned, the
  3474.     exponent, an integer, is stored to *EXP_PTR.  The following holds
  3475.     for the mantissa m: 0.5 <= |m| < 1.0.  If X is zero, both the
  3476.     mantissa and the exponent are 0.
  3477.  
  3478. ------------------------------------------------------------------------------
  3479. #include <stdio.h>                                                      [ANSI]
  3480.  
  3481. int fscanf (FILE *stream, const char *format, ...);
  3482.  
  3483.     The stream STREAM is read and input is parsed according to the
  3484.     format string FORMAT.  For each field in FORMAT there must be a
  3485.     pointer to the location receiving the value.  The pointers are
  3486.     passed after the FORMAT argument.  On success, the number of
  3487.     fields converted is returned.  Otherwise, EOF is returned.
  3488.  
  3489.     See also: fprintf(), scanf()
  3490.  
  3491. ------------------------------------------------------------------------------
  3492. #include <stdio.h>                                                      [ANSI]
  3493.  
  3494. int fseek (FILE *stream, long offset, int origin);
  3495.  
  3496.     fseek() moves the file pointer of STREAM.  The new position OFFSET
  3497.     is relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative
  3498.     to the beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is
  3499.     relative to the current position, if ORIGIN is SEEK_END, OFFSET is
  3500.     relative to the end of the file.  The file pointer cannot be moved
  3501.     before the beginning of the file.  fseek() does not work with
  3502.     text-mode files.  On success, 0 is returned.  On error, a non-zero
  3503.     value is returned.
  3504.  
  3505.     See also: fgetpos(), fsetpos(), ftell(), rewind()
  3506.  
  3507. ------------------------------------------------------------------------------
  3508. #include <stdio.h>                                                       [emx]
  3509.  
  3510. int _fseek_hdr (FILE *stream);
  3511.  
  3512.     Move the file pointer of STREAM to the a.out header of an
  3513.     executable file (a.out or bound .exe).  _fseek_hdr() assumes that
  3514.     the file pointer points to the beginning of the header (ie, the
  3515.     beginning of the file).  If there is an error, _fseek_hdr() sets
  3516.     errno and returns -1.  If no header is found, the file pointer
  3517.     will be repositioned to the original position.
  3518.  
  3519.     See also: _seek_hdr()
  3520.  
  3521. ------------------------------------------------------------------------------
  3522. #include <stdio.h>                                                       [emx]
  3523.  
  3524. int _fsetmode (FILE *stream, const char *mode);
  3525.  
  3526.     Change the text/binary mode of a stream.  MODE must be either "b"
  3527.     or "t".  _fsetmode() returns 0 if successful.  Otherwise, -1 is
  3528.     returned.  _fsetmode() is usually used to put stdin or stdout to
  3529.     binary mode.
  3530.  
  3531.     See also: fopen()
  3532.  
  3533. ------------------------------------------------------------------------------
  3534. #include <stdio.h>                                                      [ANSI]
  3535.  
  3536. int fsetpos (FILE *stream, const fpos_t *pos);
  3537.  
  3538.     Restore the position of the file pointer of the file STREAM to the
  3539.     position saved by fgetpos() in the variable pointed to by POS.
  3540.     fsetpos() currently does not work with text-mode files.
  3541.  
  3542.     See also: fgetpos(), fseek()
  3543.  
  3544. ------------------------------------------------------------------------------
  3545. #include <stdio.h>                                                        [PC]
  3546. #include <share.h>
  3547.  
  3548. FILE *_fsopen (const char *fname, const char *mode, int shflag);
  3549.  
  3550.     Open a stream.  FNAME is the name of the file, MODE is a string
  3551.     which specifies the file mode.  The first character of MODE is `r'
  3552.     for reading, `w' for writing or `a' for appending.  If a `+'
  3553.     character follows `a' or `w', the file will be also opened for
  3554.     reading.  There are two additional MODE flags: `t' for text mode,
  3555.     `b' for binary mode.  Text mode, which is the default, skips CR
  3556.     characters on input and converts LF characters to CR/LF pairs on
  3557.     output.  Ctrl-Z on input indicates EOF.  Binary mode disables
  3558.     these transformations.
  3559.  
  3560.     The sharing mode of the file is given by SHFLAG.  The following
  3561.     sharing modes are available:
  3562.  
  3563.       SH_DENYRW       Deny read and write access
  3564.       SH_DENYRD       Deny read access (permit write access)
  3565.       SH_DENYWR       Deny write access (permit read access)
  3566.       SH_DENYNO       Deny nothing (permit read and write access)
  3567.  
  3568.     See also: fopen(), sopen()
  3569.  
  3570. ------------------------------------------------------------------------------
  3571. #include <io.h>                                                         [UNIX]
  3572. #include <sys/types.h>
  3573. #include <sys/stat.h>
  3574.  
  3575. int fstat (int handle, struct stat *buffer);
  3576.  
  3577.     Retrieve information about the open file HANDLE.  fstat() will put
  3578.     the data into the structure pointed to by BUFFER.
  3579.  
  3580.     Restrictions: st_dev and st_rdev are set to zero.  Each call to
  3581.     fstat() returns a different value for st_ino.
  3582.  
  3583.     See also: ioctl(), stat()
  3584.  
  3585. ------------------------------------------------------------------------------
  3586. #include <io.h>                                                          [BSD]
  3587.  
  3588. int fsync (int handle);
  3589.  
  3590.     Flush the buffers associated with HANDLE and update the directory.
  3591.     fsync() returns 0 if successful, -1 otherwise.
  3592.  
  3593.     Restriction: fsync() is currently not implemented for DOS: errno
  3594.     is set to EMSDOS.
  3595.  
  3596. ------------------------------------------------------------------------------
  3597. #include <stdio.h>                                                      [ANSI]
  3598.  
  3599. long ftell (FILE *stream);
  3600.  
  3601.     ftell() returns the current position of the file pointer of
  3602.     STREAM.  If there is an error, ftell() returns -1.  ftell()
  3603.     currently does not work with text-mode files.
  3604.  
  3605.     See also: fgetpos(), fseek()
  3606.  
  3607. ------------------------------------------------------------------------------
  3608. #include <sys/timeb.h>                                                  [SysV]
  3609.  
  3610. void ftime (struct timeb *ptr);
  3611.  
  3612.     Get current time and store it to the structure pointed to by PTR.
  3613.     That structure has the following fields:
  3614.  
  3615.         dstflag         Non-zero if daylight saving time is active for
  3616.                         the local timezone.  Currently, this field is
  3617.                         always 0.
  3618.  
  3619.         millitm         Milliseconds of current time.
  3620.  
  3621.         time            Current time in seconds since 00:00 GMT
  3622.                         1-Jan-1970.
  3623.  
  3624.         timezone        Difference between GMT and local time in
  3625.                         minutes.  Positive values are to the west of
  3626.                         GMT.
  3627.  
  3628.     See also: gettimeofday(), time()
  3629.  
  3630. ------------------------------------------------------------------------------
  3631. #include <io.h>                                                          [BSD]
  3632.  
  3633. int ftruncate (int handle, long length);
  3634.  
  3635.     Truncate the file associated with HANDLE to at most LENGTH bytes.
  3636.     The position of the file pointer is undefined after calling this
  3637.     function.  If LENGTH is greater than the current length of the
  3638.     file, the length is not changed.  HANDLE must be open for writing.
  3639.     If successful, 0 is returned.  Otherwise, -1 is returned.
  3640.  
  3641.     See also: chsize(), truncate()
  3642.  
  3643. ------------------------------------------------------------------------------
  3644. #include <sys/types.h>
  3645. #include <sys/stat.h>
  3646. #include <ftw.h>
  3647.  
  3648. int ftw (const char *path,
  3649.          int (*fn)(const char *name, const struct stat *stat_ptr, int flag),
  3650.          int depth);
  3651.  
  3652.     Call FN for all entries of the directory tree whose root is PATH.
  3653.     Directories are visited before the entries they contain.  FN is
  3654.     not called for the directories `.' and `..'.  The name of the
  3655.     entry is passed in NAME.  Forward slashes are used to separate
  3656.     directories (backslashes in PATH are not converted to forward
  3657.     slashes).  _fnlwr() is called to convert the file names to lower
  3658.     case on upper-case-only file systems.  A structure filled in by
  3659.     stat() is pointed to by STAT_PTR.  FLAG is one of the following:
  3660.  
  3661.     FTW_D       NAME is a directory
  3662.  
  3663.     FTW_F       NAME is a file
  3664.  
  3665.     FTW_NS      stat() failed, the contents of structure pointed to by
  3666.                 STAT_PTR are undefined
  3667.  
  3668.     FTW_DNR     NAME is an unreadable directory (does not happen under
  3669.                 DOS and OS/2)
  3670.  
  3671.     If FN returns 0, ftw() continues.  Otherwise, ftw() terminates and
  3672.     returns the value returned by FN.  On error, ftw() returns -1.
  3673.  
  3674.     The DEPTH argument is ignored by this implementation of ftw().  In
  3675.     other implementations, DEPTH is used to restrict the number of
  3676.     file handles used by ftw(): one file handle is required for each
  3677.     level.  If DEPTH is less than the number of levels, ftw() will be
  3678.     slow.
  3679.  
  3680.     Example: /emx/test/ftwtest.c
  3681.  
  3682.     See also: _fnlwr(), opendir()
  3683.  
  3684. ------------------------------------------------------------------------------
  3685. #include <stdlib.h>                                                       [PC]
  3686.  
  3687. int _fullpath (char *dst, const char *src, int size);
  3688.  
  3689.     Construct an absolute path name for the file name or directory
  3690.     name SRC.  The absolute path name is put to DST.  It is assumed
  3691.     that there are SIZE bytes available at DST, this includes the
  3692.     terminating 0 byte.  If there is an error, -1 is returned.  If
  3693.     _fullpath() succeeds, 0 is returned.  If SIZE is too small, errno
  3694.     is set to ERANGE and -1 is returned.  DST can be identical to SRC.
  3695.     Backslashes are translated into forward slashes.  The absolute
  3696.     path name is not translated to lower case.
  3697.  
  3698.     _fullpath() accesses the appropriate drive.  It fails if a
  3699.     directory does not exist unless the non-existing directory is the
  3700.     last member of the resulting path name.
  3701.  
  3702.     See also: _abspath()
  3703.  
  3704. ------------------------------------------------------------------------------
  3705. #include <stdio.h>                                                      [ANSI]
  3706.  
  3707. size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream);
  3708.  
  3709.     Write COUNT objects of SIZE bytes each from BUFFER to STREAM.  The
  3710.     file pointer is incremented by the number of bytes written.  The
  3711.     number of complete objects written is returned which may be less
  3712.     than COUNT, for instance 0, if an error occurs.  On failure, the
  3713.     value of the file pointer is undefined.  If STREAM has been opened
  3714.     in text mode, LF characters are translated to CR/LF pairs.  This
  3715.     translation does not affect the return value -- SIZE and COUNT are
  3716.     applied before the translation.
  3717.  
  3718.     See also: fputc(), fputs(), fread(), printf()
  3719.  
  3720. ------------------------------------------------------------------------------
  3721. #include <graph.h>                                                       [emx]
  3722.  
  3723. void g_box (int x0, int y0, int x1, int y1, int color, int fill_flag);
  3724.  
  3725.     Draw a box which has the four vertices (X0,Y0), (X0,Y1), (X1, Y0)
  3726.     AND (X1, Y1).  If FILL_FLAG is G_OUTLINE, the outline is drawn,
  3727.     that is, four lines between the vertices.  If FILL_FLAG is G_FILL,
  3728.     the interior of the box is filled.  The color COLOR is used for
  3729.     drawing.
  3730.  
  3731.     See also: g_clip()
  3732.  
  3733. ------------------------------------------------------------------------------
  3734. #include <graph.h>                                                       [emx]
  3735.  
  3736. void g_clear (int color);
  3737.  
  3738.     Clear the screen (graphics mode, only).  All pixels are set to the
  3739.     color COLOR.  The clipping rectangle is ignored.
  3740.  
  3741. ------------------------------------------------------------------------------
  3742. #include <graph.h>                                                       [emx]
  3743.  
  3744. void g_clip (int x0, int y0, int x1, int y1);
  3745.  
  3746.     Define the clipping rectangle.  Only pixels with X coordinate
  3747.     between X0 and X1 (inclusive) and Y0 and with Y coordinate between
  3748.     X1 and Y1 (inclusive) are drawn.  No drawing is performed outside
  3749.     that clipping rectangle.  After switching to graphics mode with
  3750.     g_mode(), the clipping rectangle is set to the entire screen.  This
  3751.     is equivalent to calling
  3752.  
  3753.        g_clip (0, 0, g_xsize-1, g_ysize-1)
  3754.  
  3755.     See also: g_mode(), g_xsize, g_ysize
  3756.  
  3757. ------------------------------------------------------------------------------
  3758. #include <graph.h>                                                       [emx]
  3759.  
  3760. void g_ellipse (int cx, int cy, int rx, int ry, int color, int fill_flag);
  3761.  
  3762.     Draw an ellipse or a circle.  One axis is horizontal, the other
  3763.     one vertical.  The center of the ellipse is at (CX,CY).  The
  3764.     horizontal radius is RX, the vertical radius is RY.  It's
  3765.     impossible to draw an ellipse with even length of an axis.  If
  3766.     FILL_FLAG is G_OUTLINE, the outline of the ellipse is drawn.  If
  3767.     FILL_FLAG is G_FILL, the interior of the ellipse is filled.  The
  3768.     color COLOR is used for drawing.
  3769.  
  3770.     See also: g_clip()
  3771.  
  3772. ------------------------------------------------------------------------------
  3773. #include <graph.h>                                                       [emx]
  3774.  
  3775. int g_get (int x, int y);
  3776.  
  3777.     Return the color of the pixel at (X,Y).  If (X,Y) is outside the
  3778.     clipping rectangle, -1 is returned.
  3779.  
  3780.     See also: g_clip(), g_set()
  3781.  
  3782. ------------------------------------------------------------------------------
  3783. #include <graph.h>                                                       [emx]
  3784.  
  3785. void g_hline (int y, int x0, int x1, int color);
  3786.  
  3787.     Draw a horizontal line between (X0,Y) and (X1,Y).  The color COLOR
  3788.     is used for drawing.
  3789.  
  3790.     See also: g_box(), g_clip(), g_line(), g_vline()
  3791.  
  3792. ------------------------------------------------------------------------------
  3793. #include <graph.h>                                                       [emx]
  3794.  
  3795. void g_line (int x0, int y0, int x1,int y1, int color);
  3796.  
  3797.     Draw a line of arbitrary slope between (X0,Y0) and (X1,Y1).  The
  3798.     color COLOR is used for drawing.  To draw horizontal or vertical
  3799.     lines, you should use g_hline() and g_vline(), respectively, which
  3800.     are specialized functions optimized for speed.
  3801.  
  3802.     See also: g_clip(), g_hline(), g_polygon(), g_triangle(), g_vline()
  3803.  
  3804. ------------------------------------------------------------------------------
  3805. #include <graph.h>                                                       [emx]
  3806.  
  3807. void g_lock (void);
  3808.  
  3809.     Lock the screen.  Under OS/2, the screen must be locked while
  3810.     access graphics memory.  All the graphics drawing functions lock
  3811.     the screen, draw, and unlock the screen unless it's already
  3812.     locked.  To avoid the overhead of locking and unlocking for each
  3813.     function call, you can lock and unlock the screen yourself when
  3814.     performing many successive drawing operations.  Note that you
  3815.     should not lock the screen for more than a few seconds.  g_lock()
  3816.     increments a counter, which is initialized to zero by g_mode().
  3817.     The screen is locked while the counter is non-zero.  g_unlock()
  3818.     decrements the counter and unlocks the screen if the counter
  3819.     reaches zero.
  3820.  
  3821.     See also: g_unlock()
  3822.  
  3823. ------------------------------------------------------------------------------
  3824. #include <graph.h>                                                       [emx]
  3825.  
  3826. int g_mode (int mode);
  3827.  
  3828.     Select graphics mode.  If MODE is G_MODE_OFF, graphics mode is
  3829.     turned off and 0 is returned.  If MODE is G_MODE_VGA_L, the
  3830.     320x200 VGA mode with 256 colors is chosen.  If switching to
  3831.     graphics mode succeeds, 1 is returned.  Otherwise, 0 is returned.
  3832.  
  3833.     The global variables g_xsize, g_ysize and g_colors are set.  The
  3834.     clipping rectangle is set to the entire screen.
  3835.  
  3836.     General information about the graphics library: Programs using the
  3837.     graphics library work both under DOS and in OS/2 full-screen
  3838.     sessions.  The coordinates of the screen are (0,0) (upper left)
  3839.     through (g_xsize-1,g_ysize-1) (lower right).  You have to link
  3840.     with libgraph (use the -lgraph option).  Under DOS, emx option
  3841.     -acm is required, see `Using emx options'.
  3842.  
  3843.     Restriction: Only G_MODE_VGA_L mode is currently implemented.
  3844.  
  3845.     Example: /emx/test/graph.c
  3846.  
  3847.     See also: g_clip(), g_modeset(), g_colors, g_xsize, g_ysize
  3848.  
  3849. ------------------------------------------------------------------------------
  3850. #include <graph.h>                                                       [emx]
  3851.  
  3852. int g_modeset (int mode, int flag);
  3853.  
  3854.     Modify a graphics mode number.  The mode number to be modified is
  3855.     passed in MODE, the value passed in FLAG specifies how to modify
  3856.     the mode number: G_SET_KEEP causes the mode number to be not
  3857.     modified.  The new mode number is returned.  On failure,
  3858.     G_MODE_OFF is returned.
  3859.  
  3860.     The global variables g_xsize, g_ysize and g_colors are set.
  3861.  
  3862.     Restriction: As only G_SET_KEEP is implemented, g_modeset() is
  3863.     useless.  It's included for compatibility with existing programs.
  3864.  
  3865.     See also: g_mode(), g_colors, g_xsize, g_ysize
  3866.  
  3867. ------------------------------------------------------------------------------
  3868. #include <graph.h>                                                       [emx]
  3869.  
  3870. void g_polygon (const int *x, const int *y, int n, int color,
  3871.                 int fill_flag);
  3872.  
  3873.     Draw a polygon.  The N vertices are stored in the X and Y arrays:
  3874.     (X[i],Y[i]) for i = 0, ..., n-1.  If FILL_FLAG is G_OUTLINE, the
  3875.     outline of the polygon is drawn, that is, a line from vertex 0 to
  3876.     vertex 1, from vertex 1 to vertex 2, ..., vertex n-2 to vertex
  3877.     n-1, vertex n-1 to vertex 0.  If FILL_FLAG is G_FILL, the interior
  3878.     of the polygon is filled.  A point is defined to be in the
  3879.     interior of the polygon, if an infinite line to any side of that
  3880.     pixel intersects the polygon an odd number of times.  The color
  3881.     COLOR is used for drawing.
  3882.  
  3883.     See also: g_clip(), g_line(), g_triangle()
  3884.  
  3885. ------------------------------------------------------------------------------
  3886. #include <graph.h>                                                       [emx]
  3887.  
  3888. void g_set (int x, int y, int color);
  3889.  
  3890.     Set the pixel (X,Y) to the color COLOR.
  3891.  
  3892.     See also: g_clip(), g_get()
  3893.  
  3894. ------------------------------------------------------------------------------
  3895. #include <graph.h>                                                       [emx]
  3896.  
  3897. void g_triangle (int x0, int y0, int x1, int y1, int x2, int y2, int color,
  3898.                  int fill_flag);
  3899.  
  3900.     Draw a triangle.  The vertices are (X0,Y0), (X1,Y1) and (X2,Y2).
  3901.     If FILL_FLAG is G_OUTLINE, the outline of the triangle is drawn,
  3902.     that is, a line from (X0,Y0) to (X1,Y1), a line from (X1,Y1) to
  3903.     (X2,Y2) and a line from (X2,Y2) to (X0,Y0).  If FILL_FLAG is
  3904.     G_FILL, the interior of the triangle is filled.  The color COLOR
  3905.     is used for drawing.
  3906.  
  3907.     See also: g_clip(), g_line(), g_polygon()
  3908.  
  3909. ------------------------------------------------------------------------------
  3910. #include <graph.h>                                                       [emx]
  3911.  
  3912. void g_unlock (void);
  3913. void g_unlockall (void);
  3914.  
  3915.     Unlock the screen.  g_unlock() undoes one invocation of g_lock()
  3916.     by decrementing the counter incremented by g_lock().  If the
  3917.     counter reaches zero, the screen is unlocked.  If the counter
  3918.     already was zero, the counter is not changed.  g_unlockall()
  3919.     undoes all invocations of g_lock() by resetting the counter to
  3920.     zero and unlocking the screen if the counter was non-zero.
  3921.  
  3922.     See also: g_lock()
  3923.  
  3924. ------------------------------------------------------------------------------
  3925. #include <graph.h>                                                       [emx]
  3926.  
  3927. void g_vgapal (const char *pal, int first, int n, int wait_flag);
  3928.  
  3929.     Set the VGA palette.  This function sets N (1 through 256) DAC
  3930.     registers starting with register FIRST (0 through 255).  For each
  3931.     register, 3 bytes are taken from PAL: red, green, blue.  Each byte
  3932.     should have a value between 0 and 63, inclusive.  If WAIT_FLAG is
  3933.     non-zero, g_vgapal() waits for the vertical retrace to avoid snow
  3934.     on the screen, see g_waitv().  Under DOS, emx option -ai is
  3935.     required, see `Using emx options'.  Under OS/2, emxio.dll is
  3936.     required.  When linking with LINK386 (-Zomf) or when using
  3937.     emxlibc.dll (-Zmt), you have to use libemxio (-lemxio) after
  3938.     libgraph (-lgraph).  libemxio must not be used if the program
  3939.     should run under DOS.
  3940.  
  3941.     See also: g_waitv()
  3942.  
  3943. ------------------------------------------------------------------------------
  3944. #include <graph.h>                                                       [emx]
  3945.  
  3946. void g_vline (int x, int y0, int y1, int color);
  3947.  
  3948.     Draw a vertical line between (X,Y0) and (X,Y1).  The color COLOR
  3949.     is used for drawing.
  3950.  
  3951.     See also: g_box(), g_clip(), g_hline(), g_line()
  3952.  
  3953. ------------------------------------------------------------------------------
  3954. #include <graph.h>                                                       [emx]
  3955.  
  3956. void g_waitv (void);
  3957.  
  3958.     Wait for vertical retrace.  Under DOS, emx option -ai is required,
  3959.     see `Using emx options'.  Under OS/2, emxio.dll is required.  When
  3960.     linking with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you
  3961.     have to use libemxio (-lemxio) after libgraph (-lgraph).  libemxio
  3962.     must not be used if the program should run under DOS.  Note that
  3963.     this function eats lots of CPU time.
  3964.  
  3965.     See also: g_vgapal(), _wait01()
  3966.  
  3967. ------------------------------------------------------------------------------
  3968. #include <graph.h>                                                       [emx]
  3969.  
  3970. void g_wmode (int wmode);
  3971.  
  3972.     Select a `writing mode'.  This is not yet implemented.
  3973.  
  3974. ------------------------------------------------------------------------------
  3975. #include <stdlib.h>                                                     [ANSI]
  3976.  
  3977. char *getcwd (char *buffer, int size);
  3978.  
  3979.     getcwd() retrieves the name of the current working directory
  3980.     (excluding the drive name) and stores it to BUFFER.  It is assumed
  3981.     that there are SIZE bytes available at BUFFER.  This includes the
  3982.     terminating 0.  If SIZE is too small, getcwd() returns NULL and
  3983.     sets errno to ERANGE.  If BUFFER is NULL, a buffer of suitable
  3984.     size, but at least SIZE bytes, is allocated with malloc().  If
  3985.     getcwd() succeeds, BUFFER is returned.  getcwd() translates
  3986.     backslashes into forward slashes.  It does not translate
  3987.     upper-case directory names to lower case.
  3988.  
  3989.     See also: chdir(), _getcwd1(), _getcwd2(), getwd()
  3990.  
  3991. ------------------------------------------------------------------------------
  3992. #include <stdlib.h>                                                      [emx]
  3993.  
  3994. int _getcwd1 (char *buffer, char drive);
  3995.  
  3996.     _getcwd1() retrieves the name of the current working directory
  3997.     (starting with a slash, excluding the drive name) of drive DRIVE
  3998.     and stores it to BUFFER.  If DRIVE is 0, the currently selected
  3999.     drive is used.  Otherwise, DRIVE must be in 'A' through 'Z'.  It
  4000.     is assumed that there are enough bytes available at BUFFER.  If
  4001.     _getcwd1() succeeds, 0 is returned.  _getcwd1() translates
  4002.     backslashes into forward slashes.  It does not translate
  4003.     upper-case directory names to lower case.
  4004.  
  4005.     See also: chdir(), getcwd(), _getcwd2()
  4006.  
  4007. ------------------------------------------------------------------------------
  4008. #include <stdlib.h>                                                      [emx]
  4009.  
  4010. char *_getcwd2 (char *buffer, int size);
  4011.  
  4012.     _getcwd2() works like getcwd() but in addition it includes the
  4013.     drive name in BUFFER.
  4014.  
  4015.     See also: chdir(), getcwd(), _getcwd1()
  4016.  
  4017. ------------------------------------------------------------------------------
  4018. #include <stdlib.h>                                                       [PC]
  4019.  
  4020. char _getdrive (void);
  4021.  
  4022.     Return as upper-case letter the currently selected drive.
  4023.  
  4024.     See also: _chdir2(), _chdrive(), _getcwd2()
  4025.  
  4026. ------------------------------------------------------------------------------
  4027. #include <stdlib.h>                                                     [ANSI]
  4028.  
  4029. char *getenv (const char *name);
  4030.  
  4031.     Find NAME in the environment.  If the variable is found, a pointer
  4032.     to the value is returned.  Otherwise, NULL is returned.
  4033.  
  4034.     See also: environ, putenv()
  4035.  
  4036. ------------------------------------------------------------------------------
  4037. #include <stdlib.h>                                                      [emx]
  4038.  
  4039. char *_getext (const char *path);
  4040.  
  4041.     Return a pointer to the extension of the file name PATH.  The
  4042.     pointer points to the dot character that starts the extension.  If
  4043.     there is no extension, NULL is returned.  If the last member of
  4044.     PATH starts with a dot ("/usr/mattes/.profile", for instance),
  4045.     NULL is returned.
  4046.  
  4047.     See also: _defext(), _getname(), _remext(), _splitpath()
  4048.  
  4049. ------------------------------------------------------------------------------
  4050. #include <stdlib.h>                                                      [emx]
  4051.  
  4052. char *_getname (const char *path);
  4053.  
  4054.     Return a pointer to the name part (last component, including the
  4055.     extension) of the file name PATH.  The pointer points to the
  4056.     character after the last path separator (slash, backslash and
  4057.     colon).  If there is no path separator, PATH is returned.
  4058.  
  4059.     See also: _getext(), _splitpath()
  4060.  
  4061. ------------------------------------------------------------------------------
  4062. #include <stdlib.h>                                                      [BSD]
  4063.  
  4064. int getpagesize (void);
  4065.  
  4066.     Return the page size, which is 4096 for the 386.
  4067.  
  4068. ------------------------------------------------------------------------------
  4069. #include <stdio.h>                                                      [ANSI]
  4070.  
  4071. int getc (FILE *stream);
  4072. int getchar (void);
  4073.  
  4074.     Read a character from STREAM or stdin, respectively.  The
  4075.     character is returned.  If an error occurs or if the end of the
  4076.     file is reached, EOF is returned.
  4077.  
  4078.         getchar ()
  4079.  
  4080.     is equivalent to
  4081.  
  4082.         getc (stdin).
  4083.  
  4084.     getc() and getchar() are in-line functions or macros.
  4085.  
  4086.     See also: fgetc()
  4087.  
  4088. ------------------------------------------------------------------------------
  4089. #include <getopt.h>                                                     [UNIX]
  4090.  
  4091. int getopt (int argc, char **argv, const char *opt_str);
  4092.  
  4093.     Parse command line options.  ARGC is the number of argument
  4094.     strings, ARGV is an array of argument strings, OPT_STR is a string
  4095.     describing the available options.  Typically, the ARGC and ARGV
  4096.     arguments of main() are passed to getopt().  Each option is of one
  4097.     of the following types:
  4098.  
  4099.     - option without argument: the option letter is listed in OPT_STR;
  4100.  
  4101.     - option with mandatory argument: the option letter in OPT_STR is
  4102.       followed by a colon
  4103.  
  4104.     - option with optional argument: the option letter in OPT_STR is
  4105.       followed by two colons.
  4106.  
  4107.     For instance,
  4108.  
  4109.         c = getopt (argc, argv, "abc:d::v")
  4110.  
  4111.     defines five options: -a, -b, -c and -v don't take arguments, -c
  4112.     takes a mandatory argument, -d takes an optional argument.
  4113.  
  4114.     Before the first call to getopt(), the global variable optind must
  4115.     be set to 0 (that's the initial value, see also bugs below).
  4116.     Calling getopt() parses the next command line option.  If there
  4117.     are no more command line options, getopt() returns EOF.  After
  4118.     calling getopt(), optind is the index of the next command line
  4119.     argument.  After calling getopt(), the global variable optarg
  4120.     points to the argument of the option.  If there is no argument,
  4121.     optarg is NULL.
  4122.  
  4123.     There are three modes of operation, which are controlled by the
  4124.     global variable optmode:
  4125.  
  4126.     GETOPT_UNIX  Options are at the start of the command line.  When
  4127.                  the first non-option is reached, parsing options
  4128.                  stops and getopt() returns EOF.  GETOPT_UNIX is the
  4129.                  default.
  4130.  
  4131.     GETOPT_ANY   Options may appear anywhere on the command line.
  4132.                  ARGV is reordered to move the non-options to the end.
  4133.                  When there are no more options, getopt() returns EOF.
  4134.                  The remaining arguments are all the arguments of the
  4135.                  command line which are not options.
  4136.  
  4137.     GETOPT_KEEP  Options may appear anywhere on the command line.  If
  4138.                  the current argument is not an option, getopt()
  4139.                  returns 0.  optarg will point to the argument.  The
  4140.                  next call to getopt() examines the next command line
  4141.                  argument.
  4142.  
  4143.     If the global variable opterr is non-zero (this is the default),
  4144.     getopt() writes an appropriate error message to stderr on failure
  4145.     and returns '?'.  If opterr is zero, getopt() does not display an
  4146.     error message on failure and returns '?'.
  4147.  
  4148.     The global variable optswchar is a string of characters which
  4149.     start options.  The default value is "-", that is, options are
  4150.     started by hyphens.  You might want to assign "-/" or "/" to
  4151.     optswchar.
  4152.  
  4153.     If a command line argument consists of two equal switch characters
  4154.     (see optswchar), the remaining command line arguments are not
  4155.     treated as options.
  4156.  
  4157.     Options may be clustered, that is, if an option does not take an
  4158.     argument, getopt() treats the following character of the same
  4159.     command line argument as option.  If an option takes a mandatory
  4160.     argument, the argument either follows immediately the option or is
  4161.     taken from the next command line argument.  If an option takes an
  4162.     optional argument, the argument must immediately follow the
  4163.     option.
  4164.  
  4165.     getopt() returns the next option character.  If there are no more
  4166.     command line options, EOF is returned.  On failure, '?' is
  4167.     returned.  If optmode is GETOPT_KEEP and the current command line
  4168.     argument is not an option, 0 is returned.
  4169.  
  4170.     When writing portable programs, you should not use optmode,
  4171.     optswchar and options taking optional arguments.  Only letters
  4172.     should be used as options.
  4173.  
  4174.     optmode must not be changed after the first call to getopt().
  4175.     optswchar, however, may be changed at any time.
  4176.  
  4177.     Bugs: optind should be set to 1 (instead of 0) for parsing the
  4178.     first command line argument.  As it is initialized to 0 by this
  4179.     implementation of getopt() and seems to be initialized to 1 by the
  4180.     BSD implementation, just do not initialize optind and everything
  4181.     will be OK.
  4182.  
  4183.     See also: main(), _swchar()
  4184.  
  4185. ------------------------------------------------------------------------------
  4186. #include <process.h>                                                    [UNIX]
  4187.  
  4188. int getpid (void);
  4189.  
  4190.     Return the process identification number of the calling process.
  4191.  
  4192. ------------------------------------------------------------------------------
  4193. #include <process.h>                                                    [UNIX]
  4194.  
  4195. int getppid (void);
  4196.  
  4197.     Return the process identification number of the parent process of
  4198.     the calling process.
  4199.  
  4200. ------------------------------------------------------------------------------
  4201. #include <pwd.h>                                                        [UNIX]
  4202.  
  4203. struct passwd *getpwent (void);
  4204. struct passwd *getpwuid (int uid);
  4205. struct passwd *getpwnam (char *name);
  4206. void setpwent (void);
  4207. void endpwent (void);
  4208.  
  4209.     Dummy functions.
  4210.  
  4211. ------------------------------------------------------------------------------
  4212. #include <stdio.h>                                                      [ANSI]
  4213.  
  4214. char *gets (char *buffer);
  4215.  
  4216.     Read a string from stdin to BUFFER.  Stop after a newline (LF)
  4217.     character has been read.  The newline character is replaced with a
  4218.     null character.  gets() returns BUFFER.  If an error occurs or the
  4219.     end of the file is reached, gets() returns NULL.  Use fgets()
  4220.     instead as gets() doesn't know how big BUFFER is.
  4221.  
  4222.     See also: fgets(), scanf()
  4223.  
  4224. ------------------------------------------------------------------------------
  4225. #include <stdio.h>                                                      [UNIX]
  4226.  
  4227. int getw (FILE *stream);
  4228.  
  4229.     Read a word (int) from STREAM and return it.  On failure, -1 is
  4230.     returned.  As -1 is also a possible word value, you have to use
  4231.     ferror() to recognize an error condition.
  4232.  
  4233.     Avoid using this function.
  4234.  
  4235.     See also: putw(), fwrite()
  4236.  
  4237. ------------------------------------------------------------------------------
  4238. #include <stdlib.h>
  4239.  
  4240. char *getwd (char *buffer);
  4241.  
  4242.     getwd() retrieves the name of the current working directory
  4243.     (excluding the drive name) and stores it to BUFFER.  It is assumed
  4244.     that there are MAXPATHLEN bytes available at BUFFER.  This
  4245.     includes the terminating 0.  MAXPATHLEN is defined in sys/param.h.
  4246.     If getwd() succeeds, BUFFER is returned.  If getwd() fails, an
  4247.     error message is copied to BUFFER and NULL is returned.  getwd()
  4248.     translates backslashes into forward slashes.  It does not
  4249.     translate upper-case directory names to lower case.
  4250.  
  4251.     See also: getcwd()
  4252.  
  4253. ------------------------------------------------------------------------------
  4254. #include <sys/time.h>                                                    [BSD]
  4255.  
  4256. int gettimeofday (struct timeval *tp, struct timezone *tzp);
  4257.  
  4258.     Obtain the current time and timezone.  If TP is not NULL, the
  4259.     current Greenwich Mean Time, expressed in seconds and microseconds
  4260.     since 00:00 1-Jan-1970, is stored to *TP.  If TZP is not NULL,
  4261.     information about the timezone is stored to *TZP.
  4262.  
  4263.     See also: ftime(), time()
  4264.  
  4265. ------------------------------------------------------------------------------
  4266. #include <time.h>                                                       [ANSI]
  4267.  
  4268. struct tm *gmtime (const time_t *t);
  4269.  
  4270.     Convert the number of seconds elapsed since 00:00 1-Jan-1970 (GMT)
  4271.     given by the variable pointed to by T to a time and date structure
  4272.     (GMT) and return a pointer to the structure.  gmtime(), mktime()
  4273.     and localtime() use the same memory location, therefore the values
  4274.     are overwritten if one of these functions is called.
  4275.  
  4276.     See also: localtime()
  4277.  
  4278. ------------------------------------------------------------------------------
  4279. #include <stdlib.h>                                                       [PC]
  4280.  
  4281. int _heapchk (void);
  4282. int _heapset (unsigned fill);
  4283.  
  4284.     _heapchk() checks the heap and returns _HEAPBADBEGIN (if the
  4285.     pointers to the heap are corrupt), _HEAPBADNODE (if there is a
  4286.     corrupt entry in the heap), _HEAPEMPTY (if the heap is empty) or
  4287.     _HEAPOK (if the heap is ok).
  4288.  
  4289.     _heapset() fills unused areas of the heap with FILL.  See
  4290.     _heapchk() for the return values.  In fact, _heapchk() is a
  4291.     special variant of _heapset() which doesn't fill unused areas of
  4292.     the heap.
  4293.  
  4294. ------------------------------------------------------------------------------
  4295. #include <math.h>                                                       [UNIX]
  4296.  
  4297. double hypot (double x, double y);
  4298.  
  4299.     Compute and return sqrt (x*x + y*y).  On overflow, #INF is
  4300.     returned and errno is set to ERANGE.
  4301.  
  4302.     See also: sqrt()
  4303.  
  4304. ------------------------------------------------------------------------------
  4305. #include <strings.h>                                                     [BSD]
  4306.  
  4307. char *index (const char *string, int c);
  4308.  
  4309.     Return a pointer to the first occurrence of the character C in the
  4310.     null-terminated string STRING.  If there is no character C in
  4311.     STRING, NULL is returned.  If C is 0, a pointer to the terminating
  4312.     zero of STRING is returned.
  4313.  
  4314.     See also: rindex(), strchr()
  4315.  
  4316. ------------------------------------------------------------------------------
  4317. #include <sys/hw.h>                                                  [*] [emx]
  4318.  
  4319. unsigned _inp8 (unsigned port);
  4320. unsigned _inp16 (unsigned port);
  4321. unsigned _inp32 (unsigned port);
  4322.  
  4323.     These functions read a single byte or word from a hardware port.
  4324.     _inp8() reads a byte from PORT, _inp16() reads a 16-bit word from
  4325.     PORT, _inp32() reads a 32-bit word from PORT.
  4326.  
  4327.     You have to call _portaccess() first to enable access to a range
  4328.     of ports.  To make your program work under DOS, you have to use
  4329.     emx option -ai, see `Using emx options'.  Under OS/2, your program
  4330.     requires emxio.dll in a directory listed in LIBPATH.  When linking
  4331.     with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to
  4332.     use libemxio (-lemxio).  libemxio must not be used if the program
  4333.     should run under DOS.
  4334.  
  4335.     See also: _portaccess(), _inps8(), _outp8(), _wait0()
  4336.  
  4337. ------------------------------------------------------------------------------
  4338. #include <sys/hw.h>                                                  [*] [emx]
  4339.  
  4340. void _inps8 (unsigned port, unsigned char *dst, unsigned count);
  4341. void _inps16 (unsigned port, unsigned short *dst, unsigned count);
  4342. void _inps32 (unsigned port, unsigned long *dst, unsigned count);
  4343.  
  4344.     These functions read multiple bytes or words from a hardware port.
  4345.     _inps8() reads COUNT bytes from PORT to the buffer DST.  _inps16()
  4346.     reads COUNT 16-bit words from PORT to the buffer DST.
  4347.  
  4348.     The COUNT argument of _inps8() must not exceed 65535.
  4349.  
  4350.     The DST pointer of _inps16() must be aligned on a 16-bit boundary,
  4351.     that is, the address must be even.  COUNT must not exceed 32768.
  4352.  
  4353.     The DST pointer of _inps32() must be aligned on a 32-bit boundary,
  4354.     that is, the address must be a multiple of four.  COUNT must not
  4355.     exceed 65536.
  4356.  
  4357.     You have to call _portaccess() first to enable access to a range
  4358.     of ports.  To make your program work under DOS, you have to use
  4359.     emx option -ai, see `Using emx options'.  Under OS/2, your program
  4360.     requires emxio.dll in a directory listed in LIBPATH.  When linking
  4361.     with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to
  4362.     use libemxio (-lemxio).  libemxio must not be used if the program
  4363.     should run under DOS.
  4364.  
  4365.     See also: _portaccess(), _inp8(), _outps8()
  4366.  
  4367. ------------------------------------------------------------------------------
  4368. #include <dos.h>                                                          [PC]
  4369.  
  4370. int _int86 (int int_num, union REGS *inp_regs, union REGS *out_regs);
  4371.  
  4372.     Issue software interrupt under DOS.  This function loads the
  4373.     processor registers EAX, EBX, ECX, EDX, ESI and EDI from INP_REGS,
  4374.     calls software interrupt INT_NUM and stores the processor
  4375.     registers EAX, EBX, ECX, EDX, ESI, EDI and the flags register to
  4376.     OUT_REGS.  The value of EAX is returned.
  4377.  
  4378.     emx option -ac must be used to enable _int86().  If -ac is not
  4379.     used, a protection violation exception occurs when _int86() is
  4380.     called.  See `Using emx options'.
  4381.  
  4382.     Restrictions: _int86() is not supported under OS/2 (there are no
  4383.     software interrupts under OS/2).  The emx DOS extender currently
  4384.     supports only interrupts 0x10, 0x11, 0x14, 0x16, 0x17 and 0x21.
  4385.     Note that pointer conversion is done only for the subset of
  4386.     interrupt 0x21 services known by DOS 3.3.  Pointer conversion is
  4387.     currently done for interrupt 0x21 only.  Please note the following
  4388.     difference to DOS C compilers: the REGS union does not contain an
  4389.     X.CFLAG field.  The complete flags register is stored to the
  4390.     E.EFLAGS field instead.  The carry flag is available in bit 0 of
  4391.     the E.EFLAGS and X.FLAGS fields.
  4392.  
  4393.     Example: /emx/test/vmode.c
  4394.  
  4395. ------------------------------------------------------------------------------
  4396. #include <sys/ioctl.h>                                              [*] [SysV]
  4397.  
  4398. int ioctl (int handle, int request, int int_arg);
  4399. int ioctl (int handle, int request, void *ptr_arg);
  4400.  
  4401.     Device control for HANDLE.  REQUEST codes are:
  4402.  
  4403.     TCGETA      see `termio'
  4404.  
  4405.     TCSETA      see `termio'
  4406.  
  4407.     TCGETAF     see `termio'
  4408.  
  4409.     TCGETAW     see `termio'
  4410.  
  4411.     TCFLSH      flush the buffers.  If INT_ARG is 0, the input buffer
  4412.                 is flushed; if INT_ARG is 1, the output buffer is
  4413.                 flushed; if INT_ARG is 2, both the input and output
  4414.                 buffers are flushed.  Works only if HANDLE is 0 and
  4415.                 HANDLE refers to the keyboard.  Only flushing the
  4416.                 keyboard buffer is implemented
  4417.  
  4418.     FIONREAD    get number of available characters.  The number of
  4419.                 available characters is stored to the int pointed to
  4420.                 by PTR_ARG.  FIONREAD is implemented for the following
  4421.                 types of handles:
  4422.  
  4423.                   - stdin handles (keyboard) with IDEFAULT not set
  4424.                     (DOS: handle 0 only). Note that if ICANON is set,
  4425.                     the number of characters in the keyboard buffer is
  4426.                     returned which is not the number of characters
  4427.                     available for read(), as at least one of the
  4428.                     buffered characters (carriage return) is used for
  4429.                     command line editing
  4430.  
  4431.                   - named pipes
  4432.  
  4433.                   - pipes created with pipe() by programs using
  4434.                     emx.dll
  4435.  
  4436.                   - all file handles under DOS (0 or 1 character
  4437.                     available)
  4438.  
  4439.     FGETHTYPE   get the handle type and store it to the int pointed to
  4440.                 by PTR_ARG.  See /emx/include/sys/ioctl.h for handle
  4441.                 types (HT_FILE, for instance).
  4442.  
  4443.     If an error occurs, errno is set and -1 is returned.
  4444.  
  4445.     Restriction: When using the system call library libsys.lib
  4446.     (-Zsys), only the FGETHTYPE request is available.
  4447.  
  4448.     See also: fcntl(), open(), read()
  4449.  
  4450. ------------------------------------------------------------------------------
  4451. #include <ctype.h>                                                      [UNIX]
  4452.  
  4453. int isascii (int c);
  4454.  
  4455.     Return a non-zero value iff C is a valid ASCII character which can
  4456.     be used with isalnum() etc.  isascii() can be applied to all
  4457.     integer values.  isascii() is implemented both as macro and as
  4458.     function.
  4459.  
  4460.     See also: isalnum()
  4461.  
  4462. ------------------------------------------------------------------------------
  4463. #include <ctype.h>                                                      [ANSI]
  4464.  
  4465. int isalnum (int c);            /* alphanumeric character */
  4466. int isalpha (int c);            /* alphabetic character */
  4467. int iscntrl (int c);            /* control character */
  4468. int isdigit (int c);            /* decimal digit */
  4469. int isgraph (int c);            /* printable character but not space */
  4470. int islower (int c);            /* lower-case letter */
  4471. int isprint (int c);            /* printable character */
  4472. int ispunct (int c);            /* punctuation character */
  4473. int isspace (int c);            /* white-space character */
  4474. int isupper (int c);            /* upper-case letter */
  4475. int isxdigit (int c);           /* hexadecimal digit */
  4476.  
  4477.     These functions (or macros) return a non-zero value if the
  4478.     condition is true, or 0 if it is not true.  C must be an ASCII
  4479.     character or EOF.  Otherwise the result is unpredictable.  Use
  4480.     isascii() to check for valid ASCII characters.  These routines are
  4481.     implemented both as macros and as functions.
  4482.  
  4483.     See also: isascii(), tolower(), toupper(), _tolower(), _toupper()
  4484.  
  4485. ------------------------------------------------------------------------------
  4486. #include <io.h>                                                         [UNIX]
  4487.  
  4488. int isatty (int handle);
  4489.  
  4490.     Returns a non-zero value if HANDLE refers to a character device.
  4491.     Returns 0 if HANDLE does not refer to a character file (file or
  4492.     pipe).  If there is an error, errno is set and -1 is returned.
  4493.  
  4494.     See also: _isterm(), ioctl()
  4495.  
  4496. ------------------------------------------------------------------------------
  4497. #include <io.h>                                                          [emx]
  4498.  
  4499. int _isterm (int handle);
  4500.  
  4501.     Returns a non-zero value if HANDLE refers to the stdin (keyboard)
  4502.     or stdout (screen) device.  Otherwise, returns 0.  If there is an
  4503.     error, errno is set and 0 is returned.
  4504.  
  4505.     Consider using ioctl (FGETHTYPE) instead.
  4506.  
  4507.     See also: _isterm(), ioctl()
  4508.  
  4509. ------------------------------------------------------------------------------
  4510. #include <stdlib.h>                                                       [PC]
  4511.  
  4512. char *_itoa (long value, char *string, int radix);
  4513. char *_ltoa (int value, char *string, int radix);
  4514. char *_ultoa (unsigned long value, char *string, int radix);
  4515.  
  4516.     Convert the number VALUE to a string using the number base RADIX
  4517.     (between 2 and 36).  The string is stored to STRING.  STRING is
  4518.     returned.
  4519.  
  4520.     See also: atoi(), _lltoa(), strtol()
  4521.  
  4522. ------------------------------------------------------------------------------
  4523. #include <signal.h>                                                 [*] [UNIX]
  4524.  
  4525. int kill (int pid, int sig);
  4526.  
  4527.     Send the signal SIG to process PID.  Only SIGINT and SIGBREAK can
  4528.     be sent to arbitrary child processes.  A process can send the
  4529.     other signals only to itself, see raise(), or to other emx
  4530.     programs.  If SIG is 0, kill() checks only if PID is valid or not.
  4531.     If PID is smaller than -1, the signal is sent to process -PID and
  4532.     its children.  Some special cases are not implemented: pid=0,
  4533.     pid=1.
  4534.  
  4535.     If successful, kill() returns 0.  Otherwise -1 is returned and
  4536.     errno set to one of the following values:
  4537.  
  4538.     EINVAL    SIG is not a valid signal number
  4539.  
  4540.     ESRCH     PID is not the process ID of a process or process PID is not
  4541.               a child process
  4542.  
  4543.     Restrictions: Special treatment of PID=0, PID=1 and PID=-1 is not
  4544.     implemented.  Negative values of PID are implemented for OS/2 only
  4545.     and work only for direct children of the caller.
  4546.  
  4547.     When using the system call library libsys.lib (-Zsys), a process
  4548.     can send arbitrary signals to itself, only SIGINT and SIGBREAK can
  4549.     be sent to only child processes, negative values of PID are not
  4550.     allowed.
  4551.  
  4552.     See also: raise(), signal()
  4553.  
  4554. ------------------------------------------------------------------------------
  4555. #include <stdlib.h>     /* use this */                                  [ANSI]
  4556. #include <math.h>       /* or this */
  4557.  
  4558. long labs (long n);
  4559.  
  4560.     Return the absolute value of N: If N is negative, -N is returned.
  4561.     Otherwise, N is returned.  In-line code is generated for this
  4562.     function.
  4563.  
  4564.     See also: abs(), fabs()
  4565.  
  4566. ------------------------------------------------------------------------------
  4567. #include <math.h>                                                       [ANSI]
  4568.  
  4569. double ldexp (double x, int exp);
  4570.  
  4571.     Compute and return X * 2 ^ EXP.  On overflow, #NAN is returned and
  4572.     errno is set to ERANGE.
  4573.  
  4574. ------------------------------------------------------------------------------
  4575. #include <stdlib.h>                                                      [emx]
  4576.  
  4577. _lldiv_t _lldiv (long long num, long long den);
  4578. _uldiv_t _uldiv (unsigned long num, unsigned long den);
  4579. _ulldiv_t _ulldiv (unsigned long long num, unsigned long long den);
  4580.  
  4581.     Perform an integer division, dividing NUM by DEN.  The quotient
  4582.     and the remainder are returned in the quot and rem fields,
  4583.     respectively.
  4584.  
  4585.     The following table shows the signs of quot and rem depending on
  4586.     the signs of NUM and DEN for _lldiv():
  4587.  
  4588.         NUM DEN | quot rem
  4589.         --------+---------
  4590.          +   +  |  +    +
  4591.          +   -  |  -    +
  4592.          -   +  |  -    -
  4593.          -   -  |  +    -
  4594.  
  4595.     Note: Do not use the -fpcc-struct-return GCC option.
  4596.  
  4597.     See also: div(), ldiv()
  4598.  
  4599. ------------------------------------------------------------------------------
  4600. #include <stdlib.h>                                                      [emx]
  4601.  
  4602. char *_lltoa (long long value, char *string, int radix);
  4603. char *_ulltoa (unsigned long long value, char *string, int radix);
  4604.  
  4605.     Convert the number VALUE to a string using the number base RADIX
  4606.     (between 2 and 36).  The string is stored to STRING.  STRING is
  4607.     returned.
  4608.  
  4609.     See also: atoi(), _itoa(), strtol()
  4610.  
  4611. ------------------------------------------------------------------------------
  4612. #include <locale.h>                                                     [ANSI]
  4613.  
  4614. struct lconv *localeconv (void);
  4615.  
  4616.     Not implemented.
  4617.  
  4618. ------------------------------------------------------------------------------
  4619. #include <time.h>                                                       [ANSI]
  4620.  
  4621. struct tm *localtime (const time_t *t);
  4622.  
  4623.     Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970
  4624.     given by the variable pointed to by T to a time and date structure
  4625.     for the local timezone and return a pointer to the structure.
  4626.     gmtime(), mktime() and localtime() use the same memory location,
  4627.     therefore the values are overwritten if one of these functions is
  4628.     called.
  4629.  
  4630.     See also: gmtime()
  4631.  
  4632. ------------------------------------------------------------------------------
  4633. #include <math.h>                                                       [ANSI]
  4634.  
  4635. double log (double x);
  4636. double log10 (double x);
  4637.  
  4638.     log() returns the natural logarithm of X.  log10() returns the
  4639.     base-10 logarithm of X.
  4640.  
  4641.     If X is zero, -#INF is returned and errno set to EDOM.
  4642.     If X is negative, +#NAN is returned and errno set to EDOM.
  4643.  
  4644.     See also: exp(), pow()
  4645.  
  4646. ------------------------------------------------------------------------------
  4647. #include <setjmp.h>                                                     [ANSI]
  4648.  
  4649. void volatile longjmp (jmp_buf there, int n);
  4650.  
  4651.     Restore the context saved in THERE by setjmp().  longjmp() does a
  4652.     non-local `goto'.  When calling longjmp() in a signal handler or
  4653.     in a function called by a signal handler (that is, while a signal
  4654.     handler is active), the signal handler will be unwound, that is,
  4655.     it is assumed that the signal handler doesn't return.
  4656.  
  4657.     See also: setjmp()
  4658.  
  4659. ------------------------------------------------------------------------------
  4660. #include <io.h>                                                         [UNIX]
  4661.  
  4662. long lseek (int handle, long offset, int origin);
  4663.  
  4664.     lseek() moves the file pointer of HANDLE.  The new position OFFSET
  4665.     is relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative
  4666.     to the beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is
  4667.     relative to the current position, if ORIGIN is SEEK_END, OFFSET is
  4668.     relative to the end of the file.  The file pointer cannot be moved
  4669.     before the beginning of the file.  lseek() returns the new
  4670.     position relative to the beginning of the file.  If there is an
  4671.     error, -1 is returned.
  4672.  
  4673.     See also: tell()
  4674.  
  4675. ------------------------------------------------------------------------------
  4676.                                                                         [ANSI]
  4677. int main (void);
  4678. int main (int argc, char *argv[]);
  4679. int main (int argc, char *argv[], char *envp[]);
  4680.  
  4681.     This is the function called by the startup code to run your
  4682.     program.  It is not a library function.  ARGC is the number of
  4683.     command line arguments, including the program name.  ARGV is an
  4684.     array of pointers to the command line arguments.  ENVP is an array
  4685.     of pointers to the environment strings.  The last entry of ARGV
  4686.     and ENVP is a NULL pointer.  main() should always return a value.
  4687.     If main() returns, exit() is called using the return value of
  4688.     main() as argument.  If main() ends without return() or calling
  4689.     exit(), the return code of the program is undefined.  This should
  4690.     be avoided.  After changing the environment with putenv(), you
  4691.     should use the environ global variable instead of the ENVP
  4692.     argument of main().
  4693.  
  4694.     See also: environ, exit(), _response(), _wildcard()
  4695.  
  4696. ------------------------------------------------------------------------------
  4697. #include <stdlib.h>                                                     [ANSI]
  4698.  
  4699. void *malloc (size_t size);
  4700.  
  4701.     Allocate a block of memory big enough for holding SIZE bytes.  If
  4702.     there is an error, malloc() returns NULL.  If SIZE is 0, zero
  4703.     bytes of memory are allocated, the return value will be unequal
  4704.     NULL.
  4705.  
  4706.     Restriction: The current malloc() implementation is not really
  4707.     suitable for virtual memory because the complete heap (including
  4708.     allocated blocks) is traversed for a free block.  It's possible to
  4709.     use GNU malloc instead.  Do not replace malloc() etc. when using
  4710.     emxlibc.dll as the functions in emxlibc.dll won't call your
  4711.     replacements.
  4712.  
  4713.     See also: calloc(), free(), realloc()
  4714.  
  4715. ------------------------------------------------------------------------------
  4716. #include <math.h>                                                         [PC]
  4717.  
  4718. int matherr (struct exception *x);
  4719.  
  4720.     Exception handler for floating point math.
  4721.  
  4722.     Restriction: matherr() is not implemented.
  4723.  
  4724. ------------------------------------------------------------------------------
  4725. #include <sys/hw.h>                                                      [emx]
  4726.  
  4727. void *_memaccess (unsigned first, unsigned last, int flag);
  4728.  
  4729.     Gain access to physical memory under DOS.  To access memory which
  4730.     is outside the memory space of the current process, you have to
  4731.     call _memaccess().  emx option -am must be used to enable
  4732.     _memaccess(), see `Using emx options'.
  4733.  
  4734.     FIRST is the address of the first byte of the physical memory
  4735.     area, LAST is the address of the last byte of the physical memory
  4736.     area to be accessed.  Both addresses are physical addresses.
  4737.     FIRST and LAST+1 must be page aligned: FIRST and LAST+1 must be
  4738.     integral multiples of 4096.  That is, with using hexadecimal
  4739.     notation, FIRST must end with 000, LAST must end with fff.  A
  4740.     pointer to virtual memory mapped to the physical memory area is
  4741.     returned.  If FLAG is 0, read access is granted.  If FLAG is 1,
  4742.     read and write access is granted.  Write access can be granted if
  4743.     the address range of the physical memory area is entirely in the
  4744.     range 0xa0000 to 0xbffff.  If bytes outside this range are
  4745.     included in FIRST to LAST, emx option -aw must be used to enable
  4746.     write access, see `Using emx options'.
  4747.  
  4748.     If _memaccess() fails, NULL is returned and errno set to one of
  4749.     the following values:
  4750.  
  4751.     EACCES    FIRST not page aligned; LAST+1 not page aligned; LAST
  4752.               not greater than FIRST; write access not allowed
  4753.  
  4754.     EINVAL    FLAG is not 0 or 1
  4755.  
  4756.     ENOMEM    not enough virtual memory for storing the paging tables;
  4757.               linear address space of process not big enough for the
  4758.               request
  4759.  
  4760.     Restriction: _memaccess() is not available under OS/2.
  4761.  
  4762.     Example: /emx/test/hw_mem.c
  4763.  
  4764.     See also: _portaccess()
  4765.  
  4766. ------------------------------------------------------------------------------
  4767. #include <string.h>     /* use this */                                   [emx]
  4768. #include <memory.h>     /* or this */
  4769.  
  4770. size_t _memcount (void *mem, int c, size_t n);
  4771.  
  4772.     Return the number of bytes equal to C of the N bytes at address
  4773.     MEM.
  4774.  
  4775. ------------------------------------------------------------------------------
  4776. #include <string.h>     /* use this */                                    [PC]
  4777. #include <memory.h>     /* or this */
  4778.  
  4779. void *memccpy (void *s1, const void *s2, int c, size_t n);
  4780.  
  4781.     Copy at most the first N bytes from S2 to S1, stopping after
  4782.     copying a byte equal to the lower 8 bits C.  If memccpy() stops
  4783.     because a byte equal to C has been found, a pointer to the byte
  4784.     after the last destination byte (which is equal to C) is returned.
  4785.     If N bytes have been copied without finding a byte equal to C,
  4786.     NULL is returned.
  4787.  
  4788.     See also: memchr(), memcpy(), memmove(), strcpy(), strncpy()
  4789.  
  4790. ------------------------------------------------------------------------------
  4791. #include <string.h>     /* use this */                                  [ANSI]
  4792. #include <memory.h>     /* or this */
  4793.  
  4794. void *memchr (const void *s, int c, size_t n);
  4795.  
  4796.     Search the first N bytes at S for a byte equal to the lower 8 bits
  4797.     of C.  If a byte equal to C is found, a pointer to the first
  4798.     occurrence of C is returned.  If there is no such byte, NULL is
  4799.     returned.
  4800.  
  4801. ------------------------------------------------------------------------------
  4802. #include <string.h>     /* use this */                                  [ANSI]
  4803. #include <memory.h>     /* or this */
  4804.  
  4805. int memcmp (const void *s1, const void *s2, size_t n);
  4806.  
  4807.     Compare the first N bytes at S1 to the first N bytes at S2.  If
  4808.     the two buffers are identical (or if N is zero), 0 is returned.
  4809.     Otherwise, a value is returned which indicates the relationship of
  4810.     the first differing byte: a negative value means buffer S1 is
  4811.     lexically less than buffer S2, a positive value means buffer S1 is
  4812.     lexically greater than buffer S2.
  4813.  
  4814.     See also: bcmp(), _memdif(), memicmp()
  4815.  
  4816. ------------------------------------------------------------------------------
  4817. #include <string.h>     /* use this */                                   [emx]
  4818. #include <memory.h>     /* or this */
  4819.  
  4820. size_t _memcount (const void *mem, int c, size_t n);
  4821.  
  4822.     Count and return the number of occurrences of character C in the
  4823.     memory area of size N bytes at MEM.
  4824.  
  4825. ------------------------------------------------------------------------------
  4826. #include <string.h>     /* use this */                                  [ANSI]
  4827. #include <memory.h>     /* or this */
  4828.  
  4829. void *memcpy (void *s1, const void *s2, size_t n);
  4830.  
  4831.     Copy memory.  Copy N bytes from S2 to S1.  The two regions must
  4832.     not overlap.  memcpy() returns S1.  GCC generates in-line code for
  4833.     special applications of memcpy().  Use memmove() instead of
  4834.     memcpy() to copy overlapping regions of memory.
  4835.  
  4836.     See also: bcopy(), memmove()
  4837.  
  4838. ------------------------------------------------------------------------------
  4839. #include <string.h>     /* use this */                                   [emx]
  4840. #include <memory.h>     /* or this */
  4841.  
  4842. size_t _memdif (const void *mem1, const void *mem2, size_t n);
  4843.  
  4844.     Compare the first N bytes at MEM1 to the first N bytes at MEM2.
  4845.     If the two buffers are identical (or if N is zero), _MEMDIF_EQ is
  4846.     returned.  Otherwise, the byte offset of the first difference is
  4847.     returned.
  4848.  
  4849.     See also: memcmp()
  4850.  
  4851. ------------------------------------------------------------------------------
  4852. #include <string.h>     /* use this */                                    [PC]
  4853. #include <memory.h>     /* or this */
  4854.  
  4855. int memicmp (const void *s1, const void *s2, size_t n);
  4856.  
  4857.     Compare the first N bytes at S1 to the first N bytes at S2,
  4858.     ignoring letter case.  If the two buffers are identical (or if N
  4859.     is zero), 0 is returned.  Otherwise, a value is returned which
  4860.     indicates the relationship of the first differing byte: a negative
  4861.     value means buffer S1 is lexically less than buffer S2 (after
  4862.     conversion to lower case), a positive value means buffer S1 is
  4863.     lexically greater than buffer S2 (after conversion to lower case).
  4864.  
  4865.     See also: memcmp(), tolower()
  4866.  
  4867. ------------------------------------------------------------------------------
  4868. #include <string.h>     /* use this */                                  [ANSI]
  4869. #include <memory.h>     /* or this */
  4870.  
  4871. void *memmove (void *s1, const void *s2, size_t n);
  4872.  
  4873.     Copy memory.  Copy N bytes from S2 to S1.  The two regions may
  4874.     overlap.  memmove() returns S1.
  4875.  
  4876.     See also: bcopy(), memcpy()
  4877.  
  4878. ------------------------------------------------------------------------------
  4879. #include <string.h>     /* use this */                                  [ANSI]
  4880. #include <memory.h>     /* or this */
  4881.  
  4882. void *memset (void *s, int c, size_t n);
  4883.  
  4884.     Fill memory.  Set N bytes at S to C.  memset() returns S.
  4885.  
  4886.     See also: bzero()
  4887.  
  4888. ------------------------------------------------------------------------------
  4889. #include <string.h>     /* use this */                                   [emx]
  4890. #include <memory.h>     /* or this */
  4891.  
  4892. void _memswap (void *s1, void *s2, size_t n);
  4893.  
  4894.     Swap two areas of memory of N bytes each, pointed to by S1 and S2.
  4895.     The two areas must not overlap.
  4896.  
  4897. ------------------------------------------------------------------------------
  4898. #include <stdlib.h>                                                      [BSD]
  4899.  
  4900. int mkdir (const char *name, long mode);
  4901.  
  4902.     Create a directory named NAME.  Only one directory can be created
  4903.     in one step, therefore all but the last component of NAME must
  4904.     exist.  MODE (containing the permission bits) is ignored.
  4905.  
  4906.     See also: chdir(), rmdir()
  4907.  
  4908. ------------------------------------------------------------------------------
  4909. #include <io.h>                                                         [UNIX]
  4910.  
  4911. char *mktemp (char *template);
  4912.  
  4913.     Create a unique file name by modifying TEMPLATE.  Trailing X
  4914.     characters of TEMPLATE are replaced by a letter followed by digits
  4915.     (the process ID).  There should be 6 trailing X characters.  Only
  4916.     26 different file names per process can be created.  On success,
  4917.     TEMPLATE is returned.  On failure, NULL is returned.  Note that
  4918.     the TEMPLATE string is modified, do not use a string constant!
  4919.  
  4920.     Example:
  4921.  
  4922.         char tmp[20];
  4923.  
  4924.         strcpy (tmp, "exXXXXXX");
  4925.         if (mktemp (tmp) != NULL)
  4926.           {
  4927.             /* ... */
  4928.           }
  4929.  
  4930.     See also: tempnam(), tmpfile(), tmpnam()
  4931.  
  4932. ------------------------------------------------------------------------------
  4933. #include <time.h>                                                       [ANSI]
  4934.  
  4935. time_t mktime (struct tm *t);
  4936.  
  4937.     Return the number of seconds elapsed between 00:00 GMT 1-Jan-1970
  4938.     and the moment defined by the structure pointed to by T.  T is
  4939.     interpreted as local time.  On error, -1 cast as time_t is
  4940.     returned.
  4941.  
  4942.     See also: gmtime(), localtime()
  4943.  
  4944. ------------------------------------------------------------------------------
  4945. #include <math.h>                                                       [ANSI]
  4946.  
  4947. double modf (double x, double *int_ptr);
  4948.  
  4949.     Split X into fractional part (which is returned) and integer part
  4950.     (which is stored to *INT_PTR).  Both the fractional and the
  4951.     integer part have the same sign as X.
  4952.  
  4953.     See also: ceil(), floor(), frexp(), rint(), trunc()
  4954.  
  4955. ------------------------------------------------------------------------------
  4956. #include <stdlib.h>                                                       [PC]
  4957.  
  4958. size_t _msize (const void *mem);
  4959.  
  4960.     Return the size of the memory block MEM which has been allocated
  4961.     by malloc(), realloc() or calloc().  MEM must be the pointer
  4962.     obtained by calling malloc(), realloc() or calloc().
  4963.  
  4964.     See also: _expand()
  4965.  
  4966. ------------------------------------------------------------------------------
  4967. #include <sys/nls.h>                                                     [emx]
  4968.  
  4969. void _nls_init (void);
  4970.  
  4971.     Initialize the global variables _nls_tolower_tab and
  4972.     _nls_toupper_tab which are used by _nls_tolower(), _nls_toupper(),
  4973.     _nls_strlwr() and _nls_strupr().  Before calling one of these
  4974.     functions, _nls_init() must be called.  Moreover, _nls_init()
  4975.     should be called after changing the country or code page.  The
  4976.     tables are initialized appropriately for the current country code
  4977.     and code page.
  4978.  
  4979.     See also: _fncmp(), _nls_tolower(), _nls_strlwr()
  4980.  
  4981. ------------------------------------------------------------------------------
  4982. #include <sys/nls.h>                                                     [emx]
  4983.  
  4984. unsigned char *_nls_strlwr (unsigned char *string);
  4985. unsigned char *_nls_strupr (unsigned char *string);
  4986.  
  4987.     These functions convert all the characters of the string STRING to
  4988.     lower case or upper case, respectively.  Accented characters etc.
  4989.     are converted as well.  STRING is returned.  Before using one of
  4990.     these functions, _nls_init() must be called.
  4991.  
  4992.     See also: _nls_init(), _nls_tolower(), _nls_toupper()
  4993.  
  4994. ------------------------------------------------------------------------------
  4995. #include <sys/nls.h>                                                     [emx]
  4996.  
  4997. unsigned char _nls_tolower (unsigned char c);
  4998. unsigned char _nls_toupper (unsigned char c);
  4999.  
  5000.     These routines convert the character C to lower case or upper
  5001.     case, respectively.  Accented characters etc.  are converted as
  5002.     well.  Before using one of these routines, _nls_init() must be
  5003.     called.  These routines are implemented as macros.
  5004.  
  5005.     See also: _nls_init(), _nls_strlwr(), _nls_strupr()
  5006.  
  5007. ------------------------------------------------------------------------------
  5008. #include <io.h>                                                         [UNIX]
  5009. #include <fcntl.h>
  5010. #include <sys/types.h>
  5011. #include <sys/stat.h>
  5012.  
  5013. int open (const char *name, int oflag);
  5014. int open (const char *name, int oflag, int pmode);
  5015.  
  5016.     Open a file or device.  NAME is the name of the file or device.
  5017.     OFLAG contains one or more of the following values, combined by
  5018.     the | operator:
  5019.  
  5020.         O_RDONLY        Open for reading.  Writing is not allowed
  5021.  
  5022.         O_WRONLY        Open for writing.  Reading is not allowed
  5023.  
  5024.         O_RDWR          Open for reading and writing
  5025.  
  5026.         O_APPEND        Move the file pointer to the end of file
  5027.                         before any write operation takes place.  This
  5028.                         is used for appending to a file
  5029.  
  5030.         O_CREAT         Create the file if it does not exist
  5031.  
  5032.         O_TRUNC         Truncate the size of the file to 0
  5033.  
  5034.         O_EXCL          Fail if the O_CREAT is used and the file
  5035.                         already exists
  5036.  
  5037.         O_NDELAY        Currently ignored.
  5038.  
  5039.         O_BINARY        Binary mode, no translation.  See below
  5040.  
  5041.         O_TEXT          Text mode, translate CR/LF to LF.  See below
  5042.  
  5043.     If a new file is created, PMODE (modified by the umask value), is
  5044.     used to set the file permissions.  S_IREAD grants read access,
  5045.     S_IWRITE grants write access.  S_IREAD is ignored (DOS and OS/2
  5046.     limitation).  To grant both read and write access, use
  5047.     S_IREAD|S_IWRITE.
  5048.  
  5049.     There are two additional OFLAG flags: O_TEXT for text mode,
  5050.     O_BINARY for binary mode.  Text mode, which is the default,
  5051.     translates each CR/LF pair to a LF character on input and
  5052.     translates LF characters to CR/LF pairs on output.  If the last
  5053.     character of a file is Ctrl-Z, it is discarded on input.  Binary
  5054.     mode disables these transformations.
  5055.  
  5056.     If the file or device cannot be opened, open() sets errno and
  5057.     returns -1.  If open() succeeds, the file handle is returned.  The
  5058.     file handle is always greater than -1.
  5059.  
  5060.     The mode O_TRUNC|O_RDONLY is not implemented.  The mode
  5061.     O_TEXT|O_WRONLY does not overwrite a Ctrl-Z at the end of the file
  5062.     -- this causes problems when appending.  Ctrl-Z at the end of the
  5063.     file is obsolete, anyway.
  5064.  
  5065.     The file is opened in the sharing mode SH_DENYNO, see sopen().
  5066.  
  5067.     See also: close(), fdopen(), sopen()
  5068.  
  5069. ------------------------------------------------------------------------------
  5070. #include <sys/types.h>                                                   [BSD]
  5071. #include <dirent.h>             /* this is recommended */
  5072. #include <sys/dir.h>            /* this also works (for now) */
  5073.  
  5074. DIR *opendir (char *name);
  5075. int closedir (DIR *dirp);
  5076. struct dirent *readdir (DIR *dirp);
  5077. void seekdir (DIR *dirp, long off);
  5078. long telldir (DIR *dirp);
  5079. void rewinddir (DIR *dirp);
  5080.  
  5081.     Scan directories.  opendir() opens the directory NAME for
  5082.     scanning.  If there is an error, NULL is returned.  Otherwise a
  5083.     value is returned which is used with the other functions to
  5084.     continue the scanning.
  5085.  
  5086.     closedir() ends the directory scan of DIRP.  After closing DIRP,
  5087.     you must not use DIRP.  You should close all handles created by
  5088.     opendir().
  5089.  
  5090.     readdir() retrieves the next directory entry for DIRP.  If there
  5091.     are no more directory entries, NULL is returned.
  5092.  
  5093.     seekdir() moves to the specified directory entry of DIRP.  If OFF
  5094.     is 0, the first directory entry will be read next.  If OFF is 1,
  5095.     the second directory entry will be read next.  And so on.
  5096.  
  5097.     telldir() returns the current position in DIRP.  0 is returned for
  5098.     the first directory entry.
  5099.  
  5100.     rewinddir() is equivalent to seekdir (0).
  5101.  
  5102.     These functions use _fnlwr() to convert the file names to lower
  5103.     case on upper-case-only file systems.
  5104.  
  5105.     See also: _fnlwr(), _wildcard()
  5106.  
  5107. ------------------------------------------------------------------------------
  5108. #include <sys/hw.h>                                                  [*] [emx]
  5109.  
  5110. void _outp8 (unsigned port, unsigned value);
  5111. void _outp16 (unsigned port, unsigned value);
  5112. void _outp32 (unsigned port, unsigned value);
  5113.  
  5114.     These functions write a single byte or word to a hardware port.
  5115.     _outp8() writes the byte VALUE to PORT, _outp16() writes the
  5116.     16-bit word VALUE to PORT, _outp32() writes the 32-bit word VALUE
  5117.     to PORT.
  5118.  
  5119.     You have to call _portaccess() first to enable access to a range
  5120.     of ports.  To make your program work under DOS, you have to use
  5121.     emx option -ai, see `Using emx options'.  Under OS/2, your program
  5122.     requires emxio.dll in a directory listed in LIBPATH.  When linking
  5123.     with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to
  5124.     use libemxio (-lemxio).  libemxio must not be used if the program
  5125.     should run under DOS.
  5126.  
  5127.     See also: _portaccess(), _inp8(), _outps8()
  5128.  
  5129. ------------------------------------------------------------------------------
  5130. #include <sys/hw.h>                                                  [*] [emx]
  5131.  
  5132. void _outps8 (unsigned port, const unsigned char *src, unsigned count);
  5133. void _outps16 (unsigned port, const unsigned short *src, unsigned count);
  5134. void _outps32 (unsigned port, const unsigned short *src, unsigned count);
  5135. void _outps8dac (unsigned port, const unsigned char *src, unsigned count);
  5136.  
  5137.     These functions write multiple bytes or words to a hardware port.
  5138.     _outps8() writes COUNT bytes from SRC to PORT.  _outps16() writes
  5139.     COUNT 16-bit words from SRC to PORT.  _outps32() writes COUNT
  5140.     32-bit words from SRC to PORT.
  5141.  
  5142.     The COUNT argument of _outps8() must not exceed 65535.
  5143.  
  5144.     The SRC pointer of _outps16() must be aligned on a 16-bit
  5145.     boundary, that is, the address must be even.  COUNT must not
  5146.     exceed 32768.
  5147.  
  5148.     The SRC pointer of _outps32() must be aligned on a 32-bit
  5149.     boundary, that is, the address must be a multiple of four.  COUNT
  5150.     must not exceed 65536.
  5151.  
  5152.     _outps8dac() is a slowed-down version of _outps8() suitable for
  5153.     writing to the VGA palette registers.
  5154.  
  5155.     You have to call _portaccess() first to enable access to a range
  5156.     of ports.  To make your program work under DOS, you have to use
  5157.     emx option -ai, see `Using emx options'.  Under OS/2, your program
  5158.     requires emxio.dll in a directory listed in LIBPATH.  When linking
  5159.     with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to
  5160.     use libemxio (-lemxio).  libemxio must not be used if the program
  5161.     should run under DOS.
  5162.  
  5163.     See also: _portaccess(), _inps8(), _outp8()
  5164.  
  5165. ------------------------------------------------------------------------------
  5166. #include <stdlib.h>                                                      [emx]
  5167.  
  5168. int _path (char *dst, const char *name);
  5169.  
  5170.     Find an executable file.  If NAME contains a colon, a slash or a
  5171.     backslash, only that name will be tried.  If NAME does not contain
  5172.     colons, slashes or backslashes, the file will be sought in the
  5173.     directories listed in the EMXPATH and PATH environment variables.
  5174.     If the file is not found, DST will be an empty string, errno will
  5175.     be ENOENT and -1 will be returned.  If the file is found, the path
  5176.     name will be copied to DST and 0 will be returned.  No default
  5177.     extension is used.
  5178.  
  5179.     See also: getenv(), _searchenv()
  5180.  
  5181. ------------------------------------------------------------------------------
  5182. #include <stdio.h>                                                      [UNIX]
  5183.  
  5184. int pclose (FILE *stream);
  5185.  
  5186.     Close a pipe created by popen().  pclose() waits until the child
  5187.     process started by popen() ends and closes STREAM.  The
  5188.     termination status of the child process is returned.  See wait()
  5189.     for details about the return value.  If there is an error,
  5190.     pclose() returns -1.
  5191.  
  5192.     Restriction: pclose() is not implemented under DOS.
  5193.  
  5194.     See also: popen()
  5195.  
  5196. ------------------------------------------------------------------------------
  5197. #include <stdio.h>                                                      [ANSI]
  5198.  
  5199. void perror (const char *string);
  5200.  
  5201.     Print an appropriate error message for the current errno value to
  5202.     stderr.  If STRING is NULL or is the empty string "", just the
  5203.     error message is printed.  Otherwise, STRING and a colon precede
  5204.     the error message.
  5205.  
  5206.     See also: errno, strerror(), sys_errlist, sys_nerr
  5207.  
  5208. ------------------------------------------------------------------------------
  5209. #include <io.h>                                                         [UNIX]
  5210.  
  5211. int pipe (int *two_handles);
  5212.  
  5213.     Create an unnamed pipe.  The handle used for reading from the pipe
  5214.     is stored to TWO_HANDLES[0], the handle used for writing to the
  5215.     pipe is stored to TWO_HANDLES[1].  Both handles are in text mode;
  5216.     use setmode() if you want to switch to binary mode.  pipe()
  5217.     returns 0 if successful, -1 otherwise.
  5218.  
  5219.     Restrictions: pipe() is implemented for OS/2 only.
  5220.  
  5221.     See also: close(), dup(), popen(), setmode()
  5222.  
  5223. ------------------------------------------------------------------------------
  5224. #include <stdio.h>                                                      [UNIX]
  5225.  
  5226. FILE *popen (const char *command, const char *mode);
  5227.  
  5228.     Start a child process and connect one end of a pipe to it.
  5229.     popen() runs the command COMMAND by starting a command processor.
  5230.     MODE must start with `r' or `w'.  If it starts with `r', stdout of
  5231.     COMMAND will be redirected, you can get the output by reading from
  5232.     the stream returned by popen().  If MODE starts with `w', stdin of
  5233.     COMMAND will be redirected, you can send data to COMMAND by
  5234.     writing to the stream returned by popen().  Append `b' for binary
  5235.     mode or `t' for text mode to the MODE string.  The default is text
  5236.     mode, see also fopen().  If an error occurs, popen() returns NULL.
  5237.     Otherwise, popen() returns a stream which is connected to the
  5238.     local end of the pipe.  Use pclose() to close the stream.
  5239.  
  5240.     Restriction: popen() is not implemented under DOS.
  5241.  
  5242.     See also: pclose(), pipe(), _splitargs(), system()
  5243.  
  5244. ------------------------------------------------------------------------------
  5245. #include <sys/hw.h>                                                      [emx]
  5246.  
  5247. int _portaccess (unsigned first, unsigned last);
  5248.  
  5249.     Gain access to hardware ports.  To access hardware ports, you have
  5250.     to call _portaccess().  FIRST is the address of the first port,
  5251.     LAST is the address of the last port.  emx option -ai must be used
  5252.     to enable _portaccess() under DOS, see `Using emx options'.  On
  5253.     success, 0 is returned.  On failure, -1 is returned.
  5254.  
  5255.     _portaccess() always succeeds under OS/2.
  5256.  
  5257.     Example: /emx/test/hw_io.c
  5258.  
  5259.     See also: _memaccess(), _inp8(), _outp8(), _wait0()
  5260.  
  5261. ------------------------------------------------------------------------------
  5262. #include <math.h>                                                       [ANSI]
  5263.  
  5264. double pow (double x, double y);
  5265.  
  5266.     Raise X to the power of Y and return the result.  If pow() is
  5267.     undefined for a given pair of X and Y, #NAN is returned and errno
  5268.     is set to EDOM.  On overflow, #INF is returned and errno is set to
  5269.     ERANGE.
  5270.  
  5271.     See also: cbrt(), exp(), log(), sqrt()
  5272.  
  5273. ------------------------------------------------------------------------------
  5274. #include <stdio.h>                                                      [ANSI]
  5275.  
  5276. int printf (const char *format, ...);
  5277.  
  5278.     Formatted output to the stdout stream.  On success, the number of
  5279.     characters written to stdout is returned.  Otherwise, EOF is
  5280.     returned.
  5281.  
  5282.     Characters in FORMAT are copied unmodified to the destination
  5283.     unless a format specification is hit.  A format specification has
  5284.     the following format:
  5285.  
  5286.         %[flags][width][.precision][size]type
  5287.  
  5288.     where items in brackets are optional.  For each format
  5289.     specification an argument of the specified type is taken from the
  5290.     argument list, is formatted according to the format specification
  5291.     and written to the destination.  To include one percent sign in
  5292.     the output, put two percent signs (%%) into the FORMAT string.
  5293.  
  5294.     The following FLAGS characters are available:
  5295.  
  5296.         -         left-justify the converted value.  Without this
  5297.                   flag, the value is right-justified
  5298.  
  5299.         +         always insert sign (+ or -) for a signed number
  5300.  
  5301.         (blank)   insert a blank space if the conversion of a signed
  5302.                   number doesn't start with a sign (+ or -).  If both
  5303.                   + and (blank) are given, (blank) is ignored.
  5304.  
  5305.         0         pad with '0' characters instead of blanks.  This
  5306.                   flag is ignored for non-numeric conversions
  5307.  
  5308.         #         use alternate conversion.  See below
  5309.  
  5310.     If the length of the converted value is less than WIDTH, it is
  5311.     padded with blanks or '0' characters, depending on the 0 flag and
  5312.     the conversion type.  Unless the - flag is used, the field is
  5313.     padded on the left.  If the length of the converted value is
  5314.     greater than WIDTH, the field is not truncated.  WIDTH is either a
  5315.     decimal number or a '*' character.  In the latter case, the width
  5316.     is taken from the argument list.
  5317.  
  5318.     PRECISION specifies the number of decimal digits after the decimal
  5319.     point of a floating point number.  For the s conversion, PRECISION
  5320.     specifies the maximum string length.  PRECISION is either a
  5321.     decimal number or a '*' character.  In the latter case, the
  5322.     precision is taken from the argument list.
  5323.  
  5324.     SIZE is either h for a `short' type or l for a `long' type.  If
  5325.     SIZE is not specified, the default size is used.  Use L or ll for
  5326.     a `long long' type.
  5327.  
  5328.     TYPE is one of the following characters:
  5329.  
  5330.         c   character (char)
  5331.  
  5332.         d   signed decimal number (int)
  5333.  
  5334.         e   floating-point number (double), using e as exponent sign:
  5335.             -#.###e+##.  There's exactly one digit before the decimal
  5336.             point.  The number of digits after the decimal point is
  5337.             specified by PRECISION.  If PRECISION is missing, 6 digits
  5338.             are printed
  5339.  
  5340.         E   floating-point number (double), using E as exponent sign.
  5341.             See e
  5342.  
  5343.         f   floating-point number (double) printed in fixed-point
  5344.             format.  The number of digits after the decimal point is
  5345.             specified by PRECISION.  If PRECISION is missing, 6 digits
  5346.             are printed.  If PRECISION is specified as 0, no decimal
  5347.             point is printed
  5348.  
  5349.         g   floating-point number (double).  The number is printed
  5350.             using type d, e or f, depending on the number.  If the
  5351.             number is an integer, type d is used.  If the exponent (of
  5352.             f format output) is less than -4 or greater than PRECISION
  5353.             (default: 6), type e is used.  Otherwise, type f is used
  5354.  
  5355.         G   floating-point number (double), using E as exponent sign
  5356.             instead of e.  See g
  5357.  
  5358.         i   signed decimal number (int).  Same as d
  5359.  
  5360.         n   store the number of characters formatted up to this point
  5361.             in the FORMAT string (int *).  No output
  5362.  
  5363.         o   octal number (unsigned).  The # flag prepends 0.
  5364.  
  5365.         p   pointer (void *).  The output format of a pointer is
  5366.             implementation-dependent.  In this implementation, p is
  5367.             equivalent to x
  5368.  
  5369.         s   string (char *).  Print characters of the string until a
  5370.             null character is reached or PRECISION (if specified and
  5371.             non-zero) is exhausted
  5372.  
  5373.         u   unsigned decimal number (unsigned)
  5374.  
  5375.         x   hexadecimal number (unsigned), using lower-case letters.  The #
  5376.             flag prepends 0x.
  5377.  
  5378.         X   hexadecimal number (unsigned), using upper-case letters.
  5379.             The # flag prepends 0x
  5380.  
  5381.     Restriction: The output could be more accurate for floating point
  5382.     values.  Some rather special cases are not implemented.
  5383.  
  5384.     See also: fopen(), fwrite(), scanf()
  5385.  
  5386. ------------------------------------------------------------------------------
  5387. #include <sys/ptrace.h>                                             [*] [SysV]
  5388.  
  5389. int ptrace (int request, int pid, int addr, int data);
  5390.  
  5391.     Debug child process.  The child process is identified by PID.  The
  5392.     following REQUEST codes are defined:
  5393.  
  5394.     PTRACE_TRACEME      Not implemented -- use spawn (P_DEBUG) instead
  5395.  
  5396.     PTRACE_PEEKTEXT     Read a 32-bit word from the text space of the
  5397.                         child process.  ADDR is the address of the
  5398.                         word.  The word at ADDR is returned.
  5399.  
  5400.     PTRACE_PEEKDATA     See PTRACE_PEEKTEXT.  On machines with
  5401.                         separate data and text space, this request
  5402.                         will read from the data space.
  5403.  
  5404.     PTRACE_PEEKUSER     Read a 32-bit word from the process table of
  5405.                         the child process.  This can be used to read
  5406.                         the registers of the child process.  See
  5407.                         sys/user.h for details.
  5408.  
  5409.     PTRACE_POKETEXT     Write the 32-bit word DATA to address ADDR of
  5410.                         the text space of the child process.
  5411.  
  5412.     PTRACE_POKEDATA     See PTRACE_POKETEXT.  On machines with
  5413.                         separate data and text space, this request
  5414.                         will write to the data space.
  5415.  
  5416.     PTRACE_POKEUSER     Write a 32-bit word to the process table of
  5417.                         the child process.  This can be used to alter
  5418.                         the registers of the child process.  See
  5419.                         sys/user.h for details.  Not all registers can
  5420.                         be modified.
  5421.  
  5422.     PTRACE_RESUME       Resume the child process.  The child process
  5423.                         will run until a signal occurs.
  5424.  
  5425.     PTRACE_EXIT         Kill the child process.
  5426.  
  5427.     PTRACE_STEP         Execute the next instruction of the child
  5428.                         process.
  5429.  
  5430.     PTRACE_SESSION      If DATA is 0, select the session of the
  5431.                         calling process.  If DATA is 1, select the
  5432.                         child session.  If DATA is 2, the child
  5433.                         session is automatically selected by the next
  5434.                         PTRACE_STEP (on CALL instructions only) or
  5435.                         PTRACE_RESUME command.  This request is emx
  5436.                         specific and is ignored under DOS.
  5437.  
  5438.     As -1 is a legal return value for the PTRACE_PEEK requests, you
  5439.     should set errno to 0 before calling ptrace() and check errno
  5440.     after the call.
  5441.  
  5442.     Restrictions: Currently, a process can debug only one child
  5443.     process.  While debugging a child process, wait() cannot be used
  5444.     for waiting for another child.  When using the system call library
  5445.     libsys.lib (-Zsys), ptrace() is not available.
  5446.  
  5447.     See also: spawn(), wait()
  5448.  
  5449. ------------------------------------------------------------------------------
  5450. #include <stdio.h>                                                      [ANSI]
  5451.  
  5452. int putc (int c, FILE *stream);
  5453. int putchar (int c);
  5454.  
  5455.     Write the character C to STREAM or stdout, respectively.
  5456.  
  5457.         putchar (c)
  5458.  
  5459.     is equivalent to
  5460.  
  5461.         putc (c, stdout).
  5462.  
  5463.     The character written is returned.  On failure, EOF is returned.
  5464.     putc() and putchar() are in-line functions or macros.
  5465.  
  5466.     See also: fprintf(), fputs(), fputc()
  5467.  
  5468. ------------------------------------------------------------------------------
  5469. #include <stdlib.h>                                                      [BSD]
  5470.  
  5471. int putenv (const char *string);
  5472.  
  5473.     Put STRING into the environment of the calling process.  STRING is
  5474.     a pointer to a string of the form
  5475.  
  5476.         name=value
  5477.  
  5478.     where NAME is the name of the environment variable and VALUE is
  5479.     the value of the environment variable.  If the environment
  5480.     variable NAME already exists, the current value is replaced by the
  5481.     new value, VALUE.  If NAME is not already in the environment,
  5482.     STRING is put into the environment.  Do not free or reuse STRING
  5483.     after calling putenv().  Using an auto variable is also a bad
  5484.     idea.  After calling putenv(), do not use the ENVP argument of
  5485.     main().  Use environ instead.  On success, 0 is returned.  On
  5486.     failure, -1 is returned.
  5487.  
  5488.     See also: getenv()
  5489.  
  5490. ------------------------------------------------------------------------------
  5491. #include <stdio.h>                                                      [ANSI]
  5492.  
  5493. int puts (const char *string);
  5494.  
  5495.     Write the string STRING followed by a newline (LF) character
  5496.     (which is translated to CR/LF if stdout is in text mode) to the
  5497.     stdout stream.  On failure, EOF is returned.  Otherwise, a
  5498.     non-negative value is returned.
  5499.  
  5500.     See also: fputs(), fgets()
  5501.  
  5502. ------------------------------------------------------------------------------
  5503. #include <stdio.h>                                                      [UNIX]
  5504.  
  5505. int putw (int x, FILE *stream);
  5506.  
  5507.     Write the word (int) X to STREAM and return it.  On failure, -1 is
  5508.     returned.  As -1 is also a possible int value, you have to use
  5509.     ferror() to recognize an error condition.
  5510.  
  5511.     Avoid using this function.
  5512.  
  5513.     See also: getw(), fwrite()
  5514.  
  5515. ------------------------------------------------------------------------------
  5516. #include <stdlib.h> /* use this */                                      [ANSI]
  5517. #include <search.h> /* or this */
  5518.  
  5519. void qsort (void *base, size_t num, size_t width,
  5520.             int (*compare)(const void *x1, const void *x2));
  5521.  
  5522.    Sort an array.  BASE is a pointer to the beginning of the array.
  5523.    The array contains NUM elements of WIDTH bytes each.  COMPARE is
  5524.    called to compare the two elements pointed to by X1 and X2.
  5525.    COMPARE should return a negative value, if element X1 is less than
  5526.    element X2, zero, if element X1 equals element X2, and a positive
  5527.    value if element X1 is greater than element X2.
  5528.  
  5529.    qsort() is not stable: the order of equal elements is undefined.
  5530.  
  5531. ------------------------------------------------------------------------------
  5532. #include <signal.h>                                                     [ANSI]
  5533.  
  5534. int raise (int sig);
  5535.  
  5536.     Raise the signal SIG.  This causes the program to end, if SIG_DFL
  5537.     is installed for that signal.  If SIG_IGN is installed for that
  5538.     signal, the request is ignored.  If a signal handler has been
  5539.     installed and the signal is not waiting for acknowledgement, the
  5540.     signal handler will be called.  If SIGQUIT, SIGILL, SIGTRAP,
  5541.     SIGEMT, SIGFPE, SIGBUS, SIGSEGV or SIGSYS is raised and SIG_DFL is
  5542.     installed for that signal, a core dump file will be created unless
  5543.     the -c emx option is used (see `Using emx options').
  5544.  
  5545.     If successful, raise() returns 0.  Otherwise -1 is returned and
  5546.     errno set to the following value:
  5547.  
  5548.     EINVAL    SIG is not a valid signal number
  5549.  
  5550.     Restriction: Core dump files are not written if LINK386 was used
  5551.     for linking.
  5552.  
  5553.     See also: abort(), kill(), signal()
  5554.  
  5555. ------------------------------------------------------------------------------
  5556. #include <stdlib.h>                                                     [ANSI]
  5557.  
  5558. int rand (void);
  5559. void srand (unsigned int seed);
  5560.  
  5561.     rand() returns a pseudo-random number in the range 0 through
  5562.     RAND_MAX (32767).  RAND_MAX is defined in stdlib.h.  srand()
  5563.     initializes the sequence of random numbers.  The initial SEED
  5564.     value (without calling srand()) is 1.
  5565.  
  5566.     See also: libbsd (bsddev.doc)
  5567.  
  5568. ------------------------------------------------------------------------------
  5569. #include <io.h>                                                         [UNIX]
  5570.  
  5571. int read (int handle, void *buf, size_t nbyte);
  5572.  
  5573.     Read up to NBYTE characters from file HANDLE to the buffer BUF.
  5574.     The number of characters read is returned.  If there is an error,
  5575.     -1 is returned.  The return value may be less than NBYTE.  For
  5576.     instance, this happens if the end of the file is reached.  See
  5577.     also `termio' below.  If HANDLE is 0 and HANDLE refers to the
  5578.     keyboard and O_NDELAY has been set with fcntl() for HANDLE and the
  5579.     IDEFAULT and ICANON bits have been reset with ioctl() for HANDLE,
  5580.     -1 is returned and errno is set to EAGAIN if the call to read()
  5581.     would block.  Even if there is some data available, but not enough
  5582.     with respect to VMIN, -1 is returned.
  5583.  
  5584.     See also: open(), setmode(), write()
  5585.  
  5586. ------------------------------------------------------------------------------
  5587. #include <stdlib.h>                                                  [*] [emx]
  5588. #include <sys/kbdscan.h>  /* optional, for extended scan codes */
  5589.  
  5590. int _read_kbd (int echo, int wait, int sig);
  5591.  
  5592.     Get a character from the keyboard.  Extended codes are preceded by
  5593.     a null character (call _read_kbd() again!), the scan codes are
  5594.     defined in /emx/include/sys/kbdscan.h.  If ECHO is non-zero, input
  5595.     will be echoed, if WAIT is non-zero, _read_kbd() will wait until a
  5596.     character is available, if WAIT is zero and no character is
  5597.     available, _read_kbd() will return -1, if SIG is zero, Ctrl-C will
  5598.     be ignored.  Examples:
  5599.  
  5600.         #define getch()  _read_kbd (0, 1, 0)
  5601.         #define getche() _read_kbd (1, 1, 0)
  5602.  
  5603.     Please use `termio' instead, see below.  See also the termio.c
  5604.     test program.
  5605.  
  5606.     It's important to call _read_kbd() again if _read_kbd() returns 0.
  5607.     To see what happens if you don't, type Ctrl-S F10 under DOS.
  5608.  
  5609.     See also: ioctl(), read(), conio.h
  5610.  
  5611. ------------------------------------------------------------------------------
  5612. #include <stdlib.h>                                                     [ANSI]
  5613.  
  5614. void *realloc (void *mem, size_t size);
  5615.  
  5616.     Reallocate the block of memory pointed to by MEM, making it big
  5617.     enough to hold SIZE bytes.  If MEM is NULL, a new block of memory
  5618.     is allocated.  Otherwise, MEM must be a pointer returned by
  5619.     calloc(), malloc() or realloc(); the size of MEM is adjusted.  If
  5620.     MEM cannot be expanded in-place, it is moved.  A pointer to the
  5621.     new, resized block of memory is returned.  If there is not enough
  5622.     memory available, NULL is returned.
  5623.  
  5624.     MEM can also be a pointer to a block of memory freed by free() as
  5625.     long as calloc(), malloc() and realloc() have not been called
  5626.     since freeing the block.  Using this feature is not recommended,
  5627.     it may be removed in future implementations of realloc().
  5628.  
  5629.     See also: malloc()
  5630.  
  5631. ------------------------------------------------------------------------------
  5632. #include <stdlib.h>                                                      [emx]
  5633.  
  5634. void _remext (char *path);
  5635.  
  5636.     Remove the extension from the file name PATH.  If the last member
  5637.     of PATH starts with a dot ("/usr/mattes/.profile", for instance)
  5638.     PATH isn't modified.
  5639.  
  5640.     See also: _defext(), _getext(), _splitpath()
  5641.  
  5642. ------------------------------------------------------------------------------
  5643. #include <stdio.h>      /* use this */                                  [ANSI]
  5644. #include <io.h>         /* or this */
  5645.  
  5646. int remove (const char *name);
  5647.  
  5648.     Delete the file NAME.  0 is returned if successful, -1 if not.
  5649.     Under OS/2 and DOS, unlink() and remove() are equivalent.
  5650.  
  5651.     See also: unlink().
  5652.  
  5653. ------------------------------------------------------------------------------
  5654. #include <stdio.h>      /* use this */                                  [ANSI]
  5655. #include <io.h>         /* or this */
  5656.  
  5657. int rename (const char *old_name, const char *new_name);
  5658.  
  5659.     Rename the file or directory OLD_NAME to NEW_NAME.  Moving a file
  5660.     to a different directory on the same drive is possible.  0 is
  5661.     returned if successful, -1 if not.
  5662.  
  5663. ------------------------------------------------------------------------------
  5664. #include <stdlib.h>                                                      [emx]
  5665.  
  5666. void _response (int *argcp, char ***argvp);
  5667.  
  5668.     Expand response files.  If you want response files (@filename,
  5669.     filename contains a list of arguments one per line) to be
  5670.     expanded, call
  5671.  
  5672.         _response (&argc, &argv);
  5673.  
  5674.     at the beginning of main().  Response file arguments enclosed in
  5675.     double quotes won't be expanded.  If a response file cannot be
  5676.     opened, the argument is kept unchanged.
  5677.  
  5678.     See also: main(), _wildcard()
  5679.  
  5680. ------------------------------------------------------------------------------
  5681. #include <stdio.h>                                                      [ANSI]
  5682.  
  5683. void rewind (FILE *stream);
  5684.  
  5685.     Move the file pointer of STREAM to the beginning of the file and
  5686.     clear the error and end-of-file indicators.
  5687.  
  5688.     See also: fseek()
  5689.  
  5690. ------------------------------------------------------------------------------
  5691. #include <strings.h>                                                     [BSD]
  5692.  
  5693. char *rindex (const char *string, int c);
  5694.  
  5695.     Return a pointer to the last occurrence of the character C in the
  5696.     null-terminated string STRING.  If there is no character C in
  5697.     STRING, NULL is returned.  If C is 0, a pointer to the terminating
  5698.     null character of STRING is returned.
  5699.  
  5700.     See also: index(), strrchr()
  5701.  
  5702. ------------------------------------------------------------------------------
  5703. #include <math.h>
  5704.  
  5705. double rint (double x);
  5706.  
  5707.     Return as floating-point number the integer that is nearest to X.
  5708.     If there's a tie, that is, fabs(rint(x)-x) == 0.5, rint(x) is
  5709.     even.
  5710.  
  5711.     See also: ceil(), floor(), trunc()
  5712.  
  5713. ------------------------------------------------------------------------------
  5714. #include <stdlib.h>                                                      [BSD]
  5715.  
  5716. int rmdir (const char *name);
  5717.  
  5718.     Remove the directory NAME.  Only one directory is removed in one
  5719.     step.  If NAME (or a subdirectory of NAME) is the current working
  5720.     directory of a process, it cannot be removed.  On success, 0 is
  5721.     returned.  On failure, -1 is returned.
  5722.  
  5723.     See also: mkdir()
  5724.  
  5725. ------------------------------------------------------------------------------
  5726. #include <stdio.h>                                                      [UNIX]
  5727.  
  5728. int _rmtmp (void);
  5729.  
  5730.     Close and delete the files created by tmpfile() in the current
  5731.     working directory.  It must be used only in the directory in which
  5732.     tmpfile() created the temporary files.  The number of closed (and
  5733.     deleted) files is returned.
  5734.  
  5735.     See also: tmpfile()
  5736.  
  5737. ------------------------------------------------------------------------------
  5738. #include <stdlib.h>                                                     [UNIX]
  5739.  
  5740. void *sbrk (int incr);
  5741.  
  5742.     Change memory allocation by INCR bytes.  If INCR is positive, the
  5743.     memory limit is increased.  If INCR is negative, the memory limit
  5744.     is decreased (not yet completely implemented).  On success, sbrk()
  5745.     returns the previous memory limit.  Otherwise, -1 cast as pointer
  5746.     is returned and errno set to ENOMEM.  Please don't use sbrk() --
  5747.     use malloc() instead for memory allocation.
  5748.  
  5749.     See also: brk(), malloc()
  5750.  
  5751. ------------------------------------------------------------------------------
  5752. #include <stdio.h>                                                      [ANSI]
  5753.  
  5754. int scanf (const char *format, ...);
  5755.  
  5756.     The stream STREAM is read and input is parsed according to the
  5757.     format string FORMAT.  For each field in FORMAT there must be a
  5758.     pointer to the location receiving the value.  The pointers are
  5759.     passed after the FORMAT argument.
  5760.  
  5761.     Whitespace in FORMAT matches whitespace in the input.  All other
  5762.     characters except for % are compared to the input.  Parsing ends
  5763.     if a mismatch is encountered.  %% in FORMAT matches % in the
  5764.     input.  A % which is not followed by another % or the end of the
  5765.     string starts a field specification.  The field in the input is
  5766.     interpreted according to the field specification.  For most field
  5767.     types, whitespace is ignored at the start of a field.  Field
  5768.     specifications have the format
  5769.  
  5770.         %[*][width][size]type
  5771.  
  5772.     where items in brackets are optional.  If the * is present, the
  5773.     value is not assigned.  No pointer will be fetched from the
  5774.     argument list.
  5775.  
  5776.     WIDTH is a positive integral decimal number specifying the maximum
  5777.     field width.  At most this many characters are read for this
  5778.     field.
  5779.  
  5780.     SIZE is either h for a `short' type or l for a `long' type.  If
  5781.     SIZE is omitted, the default size is used.
  5782.  
  5783.     TYPE is one of the following characters:
  5784.  
  5785.         c       character.  Whitespace is not skipped (char)
  5786.  
  5787.         d       decimal integer (int)
  5788.  
  5789.         e f g   floating-point value (float)
  5790.  
  5791.         E F G   floating-point value (float)
  5792.  
  5793.         i       decimal, octal or hexadecimal integer (int)
  5794.  
  5795.         n       number of characters read so far (int).  Doesn't take
  5796.                 input
  5797.  
  5798.         o       octal integer (int)
  5799.  
  5800.         s       string (char *)
  5801.  
  5802.         x       hexadecimal integer (int)
  5803.  
  5804.         [       string (char *)  [...]
  5805.  
  5806.     Note: Use %lf for variables of type `double'.
  5807.  
  5808.     On success, the number of fields converted is returned.
  5809.     Otherwise, EOF is returned.
  5810.  
  5811.     See also: fgets(), fread(), fscanf(), printf(), sscanf(), vscanf()
  5812.  
  5813. ------------------------------------------------------------------------------
  5814. #include <stdlib.h>                                                  [*] [emx]
  5815.  
  5816. void _scrsize (int *dst);
  5817.  
  5818.     Retrieve the screen (window) size.  The number of text columns
  5819.     (width) is stored to DST[0], the number of text rows (height) is
  5820.     stored to DST[1].
  5821.  
  5822.     Restriction: When using the system call library libsys.lib
  5823.     (-Zsys), this function always sets DST[0] to 80 and DST[1] to 25.
  5824.  
  5825.     See also: v_dimen()
  5826.  
  5827. ------------------------------------------------------------------------------
  5828. #include <stdlib.h>                                                       [PC]
  5829.  
  5830. void _searchenv (const char *name, const char *var, char *path);
  5831.  
  5832.     Search a file in the directories listed in an environment
  5833.     variable.  First, the file name NAME is tried as is.  If that file
  5834.     does not exist, the directories listed in the environment variable
  5835.     VAR are searched.  If the file is found, the constructed path name
  5836.     (either NAME or a directory plus NAME) will be copied to PATH.  If
  5837.     the file is not found, PATH will be the empty string.
  5838.  
  5839.     See also: getenv(), _path()
  5840.  
  5841. ------------------------------------------------------------------------------
  5842. #include <io.h>                                                          [emx]
  5843.  
  5844. int _seek_hdr (int handle);
  5845.  
  5846.     Move the file pointer of HANDLE to the a.out header of an
  5847.     executable file (a.out or bound .exe).  _seek_hdr() assumes that
  5848.     the file pointer points to the beginning of the header (ie, the
  5849.     beginning of the file).  If there is an error, _seek_hdr() sets
  5850.     errno and returns -1.  If no header is found, the file pointer
  5851.     will be repositioned to the original position.
  5852.  
  5853.     See also: _fseek_hdr()
  5854.  
  5855. ------------------------------------------------------------------------------
  5856. #include <sys/types.h>                                               [*] [BSD]
  5857. #include <sys/time.h>
  5858. #include <io.h>
  5859.  
  5860. int select (int nfds, struct _fd_set *readfds, struct _fd_set *writefds,
  5861.             struct _fd_set *exceptfds, struct timeval *timeout);
  5862.  
  5863.     Wait for a file handle to become ready.  select() returns as soon
  5864.     as there's data ready to be read from a handle in READFDS.  If
  5865.     TIMEOUT is NULL, select() waits indefinitely.  Otherwise, waiting
  5866.     terminates after the time-out value given by TIMEOUT.  NFDS is the
  5867.     number of handles to be checked.  select() returns the number of
  5868.     ready handles and updates READFDS to include only the ready
  5869.     handles.  On time out, 0 is returned.  On failure, -1 is returned.
  5870.  
  5871.     The following macros are available for handling the bitstrings
  5872.     used by select():
  5873.  
  5874.     FD_ZERO(s)          clear all bits of S
  5875.  
  5876.     FD_SET(n,s)         set bit N in S
  5877.  
  5878.     FD_CLR(n,s)         clear bit N in S
  5879.  
  5880.     FD_ISSET(n,s)       Return a non-zero value iff bit N is set in S
  5881.  
  5882.     select() is implemented for the following types of handles:
  5883.  
  5884.     - stdin handles (keyboard) with IDEFAULT not set (DOS: handle 0
  5885.       only).  Note that if ICANON is set, read() has to wait until the
  5886.       line is completed
  5887.  
  5888.     - named pipes
  5889.  
  5890.     - pipes created with pipe() by programs using emx.dll
  5891.  
  5892.     - all file handles under DOS
  5893.  
  5894.     Restrictions: WRITEFDS and EXCEPTFDS are ignored.  When using the
  5895.     system call library libsys.lib (-Zsys), select() is not available.
  5896.  
  5897.     See also: ioctl(), pipe()
  5898.  
  5899. ------------------------------------------------------------------------------
  5900. #include <stdio.h>                                                      [ANSI]
  5901.  
  5902. int setbuf (FILE *stream, char *buffer);
  5903.  
  5904.     Associate the buffer BUFFER (of size BUFSIZ) with STREAM.  This
  5905.     must be done before the file has been read or written.  If BUFFER
  5906.     is NULL, the file is unbuffered.  You should use setvbuf()
  5907.     instead.
  5908.  
  5909.     BSD setbuf() seems to have an `int' return value, therefore emx
  5910.     setbuf() has an `int' return value.  This should not break
  5911.     programs which expect `void setbuf()'.
  5912.  
  5913.     See also: setbuffer(), setvbuf()
  5914.  
  5915. ------------------------------------------------------------------------------
  5916. #include <stdio.h>                                                      [UNIX]
  5917.  
  5918. int setbuffer (FILE *stream, char *buffer, size_t size);
  5919.  
  5920.     Associate the buffer BUFFER (of size SIZE) with STREAM.  This must
  5921.     be done before the file has been read or written.  If BUFFER is
  5922.     NULL, the file is unbuffered.  You should use setvbuf() instead.
  5923.  
  5924.     BSD setbuffer() seems to have an `int' return value, therefore emx
  5925.     setbuffer() has an `int' return value.  This should not break
  5926.     programs which expect `void setbuffer()'.
  5927.  
  5928.     See also: setvbuf()
  5929.  
  5930. ------------------------------------------------------------------------------
  5931. #include <setjmp.h>                                                     [ANSI]
  5932.  
  5933. int setjmp (jmp_buf here);
  5934.  
  5935.     Save the current stack context in HERE and return 0.  Later, you
  5936.     can continue at this point by calling longjmp().  When execution
  5937.     continues at setjmp() after calling longjmp(), the second argument
  5938.     of longjmp() is returned, which is always non-zero.
  5939.  
  5940.     See also: longjmp()
  5941.  
  5942. ------------------------------------------------------------------------------
  5943. #include <locale.h>                                                     [ANSI]
  5944.  
  5945. char *setlocale (int category, const char *locale);
  5946.  
  5947.     Not implemented.
  5948.  
  5949. ------------------------------------------------------------------------------
  5950. #include <io.h>                                                           [PC]
  5951. #include <fcntl.h>
  5952.  
  5953. int setmode (int handle, int mode);
  5954.  
  5955.     Change the text/binary mode of a file handle.  MODE must be either
  5956.     O_BINARY or O_TEXT.  If there's an error, setmode() returns -1 and
  5957.     sets errno to EBADF or EINVAL otherwise setmode() returns the
  5958.     previous mode, that is, O_BINARY or O_TEXT.
  5959.  
  5960.     Note: Use _fsetmode() to change the mode of a stream.
  5961.  
  5962.     See also: _fsetmode(), open()
  5963.  
  5964. ------------------------------------------------------------------------------
  5965. #include <sys/time.h>                                                    [BSD]
  5966.  
  5967. int settimeofday (const struct timeval *tp, const struct timezone *tzp);
  5968.  
  5969.     Not implemented.
  5970.  
  5971. ------------------------------------------------------------------------------
  5972. #include <stdio.h>                                                      [ANSI]
  5973.  
  5974. int setvbuf (FILE *stream, char *buffer, int mode, size_t size);
  5975.  
  5976.     Set the buffering mode of STREAM to MODE, using the buffer BUFFER
  5977.     of size SIZE bytes.  Available modes are:
  5978.  
  5979.     _IONBF  the file is unbuffered, BUFFER and SIZE are ignored
  5980.  
  5981.     _IOFBF  the file is full buffered
  5982.  
  5983.     _IOLBF  the file is line buffered
  5984.  
  5985.     The file must not have been read or written since it was opened.
  5986.  
  5987.     If BUFFER is NULL, a buffer of SIZE bytes is allocated by
  5988.     setvbuf() using malloc() unless MODE is _IONBF.
  5989.  
  5990.     When reading a file, _IOFBF and _IOLBF are equivalent.  Each time
  5991.     a newline character is written to a line-buffered file, the buffer
  5992.     is flushed.  The buffer is also flushed if it becomes full while
  5993.     writing.  The buffer is filled by reading from the disk file (or
  5994.     device) if the buffer becomes empty while reading.
  5995.  
  5996.     On success, 0 is returned.  On failure, a non-zero value is
  5997.     returned.
  5998.  
  5999.     See also: fflush()
  6000.  
  6001. ------------------------------------------------------------------------------
  6002. #include <signal.h>                                                     [ANSI]
  6003.  
  6004. void (*signal (int sig, void (*handler)()))(int sig);
  6005.  
  6006.     Install the signal handler HANDLER for signal SIG.  You can
  6007.     install the default signal handler by using SIG_DFL for HANDLER.
  6008.     You can cause the signal to be ignored by using SIG_IGN for
  6009.     HANDLER.  SIG must not be SIGKILL.  Some systems reset a signal to
  6010.     SIG_DFL before calling the signal handler.  emx doesn't.  SIG_ACK
  6011.     is used instead: Once a signal handler for a specific signal has
  6012.     been called, that signal is disabled until acknowledged.  You can
  6013.     acknowledge a signal by calling
  6014.  
  6015.         signal (signal_number, SIG_ACK).
  6016.  
  6017.     Only one signal of any type may be pending.  (May change in the
  6018.     future.)  The default processing for all signals except for SIGCLD
  6019.     is to terminate the process.  If a signal which isn't ignored
  6020.     (that is, SIG_DFL or handler installed) occurs while calling
  6021.     read() with `termio' enabled (see below), -1 will be returned by
  6022.     read() and errno will be set to EINTR.  The buffer will flushed.
  6023.     Do not use floating point math in a signal handler if the signal
  6024.     handler will return to the interrupted code.  File i/o in the
  6025.     signal handler is also dangerous because a file i/o function could
  6026.     have been interrupted by the signal.
  6027.  
  6028.     If successful, signal() returns the previous signal handler
  6029.     (includes SIG_IGN and SIG_DFL) defined for signal SIG.  On
  6030.     failure, SIG_ERR is returned.
  6031.  
  6032.     Restrictions: SIGPIPE is not yet implemented.  When using the
  6033.     system call library libsys.lib (-Zsys), SIGALRM and SIGCLD don't
  6034.     occur.
  6035.  
  6036.     See also: abort(), kill(), raise()
  6037.  
  6038. ------------------------------------------------------------------------------
  6039. #include <stdlib.h>                                                     [UNIX]
  6040.  
  6041. unsigned sleep (unsigned sec);
  6042.  
  6043.     Suspend the calling process for SEC seconds.  Currently, sleep()
  6044.     doesn't get interrupted by SIGALRM and always returns 0.  SEC
  6045.     should not exceed 4294967.
  6046.  
  6047.     See also: alarm(), _sleep2()
  6048.  
  6049. ------------------------------------------------------------------------------
  6050. #include <stdlib.h>                                                      [emx]
  6051.  
  6052. unsigned _sleep2 (unsigned millisec);
  6053.  
  6054.     Suspend the calling process for MILLISEC milliseconds.  Currently,
  6055.     _sleep2() doesn't get interrupted by SIGALRM and always returns 0.
  6056.     As the system clock is used for timing, the actual duration of the
  6057.     time interval depends on the granularity of the system clock.  The
  6058.     time interval is rounded up to the next clock tick.  Also note
  6059.     that calling _sleep2() involves an overhead.
  6060.  
  6061.     See also: alarm(), sleep()
  6062.  
  6063. ------------------------------------------------------------------------------
  6064. #include <io.h>                                                           [PC]
  6065. #include <share.h>
  6066.  
  6067. int sopen (const char *name, int oflag, int shflag, ...);
  6068.  
  6069.     Open a file or device with an explicit sharing mode.  NAME is the
  6070.     name of the file or device.  OFLAG contains one or more of the
  6071.     following values, combined by the | operator:
  6072.  
  6073.         O_RDONLY        Open for reading.  Writing is not allowed
  6074.  
  6075.         O_WRONLY        Open for writing.  Reading is not allowed
  6076.  
  6077.         O_RDWR          Open for reading and writing
  6078.  
  6079.         O_APPEND        Move the file pointer to the end of file
  6080.                         before any write operation takes place.  This
  6081.                         is used for appending to a file
  6082.  
  6083.         O_CREAT         Create the file if it does not exist
  6084.  
  6085.         O_TRUNC         Truncate the size of the file to 0
  6086.  
  6087.         O_EXCL          Fail if the O_CREAT is used and the file
  6088.                         already exists
  6089.  
  6090.         O_NDELAY        Currently ignored.
  6091.  
  6092.         O_BINARY        Binary mode, no translation.  See below
  6093.  
  6094.         O_TEXT          Text mode, translate CR/LF to LF.  See below
  6095.  
  6096.     If a new file is created, PMODE (modified by the umask value), is
  6097.     used to set the file permissions.  S_IREAD grants read access,
  6098.     S_IWRITE grants write access.  S_IREAD is ignored (DOS and OS/2
  6099.     limitation).
  6100.  
  6101.     There are two additional OFLAG flags: O_TEXT for text mode,
  6102.     O_BINARY for binary mode.  Text mode, which is the default,
  6103.     translates each CR/LF pair to a LF character on input and
  6104.     translates LF characters to CR/LF pairs on output.  If the last
  6105.     character of a file is Ctrl-Z, it is discarded on input.  Binary
  6106.     mode disables these transformations.
  6107.  
  6108.     If the file or device cannot be opened, open() sets errno and
  6109.     returns -1.  If open() succeeds, the file handle is returned.  The
  6110.     file handle is always greater than -1.
  6111.  
  6112.     The mode O_TRUNC|O_RDONLY is not implemented.  The mode
  6113.     O_TEXT|O_WRONLY does not overwrite a Ctrl-Z at the end of the file
  6114.     -- this causes problems when appending.  Ctrl-Z at the end of the
  6115.     file is obsolete, anyway.
  6116.  
  6117.     The sharing mode of the file is given by SHFLAG.  The following
  6118.     sharing modes are available:
  6119.  
  6120.       SH_DENYRW       Deny read and write access
  6121.       SH_DENYRD       Deny read access (permit write access)
  6122.       SH_DENYWR       Deny write access (permit read access)
  6123.       SH_DENYNO       Deny nothing (permit read and write access)
  6124.  
  6125.     See also: close(), fdopen(), open()
  6126.  
  6127. ------------------------------------------------------------------------------
  6128. #include <process.h>                                                  [*] [PC]
  6129.  
  6130. /* spawn() */
  6131.  
  6132. int spawnl (int mode, const char *name, const char *arg0, ...);
  6133. int spawnle (int mode, const char *name, const char *arg0, ...);
  6134. int spawnlp (int mode, const char *name, const char *arg0, ...);
  6135. int spawnlpe (int mode, const char *name, const char *arg0, ...);
  6136. int spawnv (int mode, const char *name, const char * const *argv);
  6137. int spawnve (int mode, const char *name, const char * const *argv,
  6138.              const char * const *envp);
  6139. int spawnvp (int mode, const char *name, const char * const *argv);
  6140. int spawnvpe (int mode, const char *name, const char * const *argv,
  6141.               const char * const *envp);
  6142.  
  6143.     Run a process.  NAME is the name of the executable file to run.
  6144.     Use spawnl(), spawnle(), spawnlp() or spawnlpe() for passing a
  6145.     fixed number of arguments.  ARG0 is the 0th argument which is the
  6146.     program name, by convention.  Following ARG0, the arguments are
  6147.     given.  After the last argument, a NULL pointer must be following.
  6148.     At least ARG0 must be specified.  Use spawnv(), spawnve(),
  6149.     spawnvp() or spawnvpe() for passing a variable number of
  6150.     arguments.  ARGV points to an array of strings.  The first entry
  6151.     is the program name, by convention.  The last argument must be
  6152.     followed by a NULL pointer.
  6153.  
  6154.     spawnl(), spawnlp(), spawnv() and spawnvp() pass the environment
  6155.     of the current process to the child process.  To pass a different
  6156.     environment to the child process pass a pointer to an array of
  6157.     strings after the NULL argument pointer of spawnle() and
  6158.     spawnlpe() or pass the pointer in the ENVP argument of spawnve()
  6159.     and spawnvpe().  The last environment string in the array must be
  6160.     followed by a NULL pointer.
  6161.  
  6162.     The MODE argument specifies how to run the child process.  The
  6163.     following values are available:
  6164.  
  6165.         P_WAIT        run the process synchronously, that is, control
  6166.                       returns to the parent process after the child
  6167.                       process finishes
  6168.  
  6169.         P_NOWAIT      run the process asynchronously, that is in
  6170.                       parallel with the parent process.  P_NOWAIT is
  6171.                       not implemented for DOS
  6172.  
  6173.         P_OVERLAY     replace the parent process, that is, run the
  6174.                       child process and terminate the parent process
  6175.  
  6176.         P_DEBUG       run the process in debugging mode, that is,
  6177.                       under control of the parent process.  Use
  6178.                       ptrace() to control the child process
  6179.  
  6180.         P_DETACH      run the process detached, that is, without input
  6181.                       and output.  P_DETACH is not available under
  6182.                       DOS
  6183.  
  6184.         P_SESSION     run the process in a separate session.
  6185.                       P_SESSION is not available under DOS.
  6186.  
  6187.     Additional flags are available for P_SESSION, which can be added
  6188.     by using the | operator.  Use one of the following for selecting
  6189.     the session type:
  6190.  
  6191.         P_DEFAULT     let the operating system choose the session type
  6192.  
  6193.         P_FULLSCREEN  start a full-screen session
  6194.  
  6195.         P_WINDOWED    start a windowed session
  6196.  
  6197.     These flags control the initial appearance of the window:
  6198.  
  6199.         P_MINIMIZE    minimize the window
  6200.  
  6201.         P_MAXIMIZE    maximize the window
  6202.  
  6203.     Additionally, you can use the following flags:
  6204.  
  6205.         P_BACKGROUND  start the session in the background
  6206.  
  6207.         P_FOREGROUND  start the session in the foreground.  This works
  6208.                       only if the calling session is in the
  6209.                       foreground.  P_FOREGROUND is the default
  6210.  
  6211.         P_NOCLOSE     don't close the window automatically when the
  6212.                       process ends
  6213.  
  6214.     When the new process terminates, SIGCLD is raised in the process
  6215.     which started that process.  This does not apply to P_WAIT,
  6216.     P_OVERLAY and P_DETACH.
  6217.  
  6218.     Return value: the return value of the child process (P_WAIT) or
  6219.     the process ID of the child process (P_NOWAIT and P_DEBUG) if
  6220.     successful.  Otherwise -1.
  6221.  
  6222.     Restrictions: When running a (native) DOS program, the environment
  6223.     of emx, not that of the process calling spawn() will be inherited.
  6224.     The command line length is restricted to 126 characters when
  6225.     running DOS programs.  DOS programs can only be run in P_WAIT
  6226.     mode.  P_NOWAIT is not implemented under DOS.  The default
  6227.     extension is .exe; if you want to run a .com file, explicitly add
  6228.     .com.  Currently, DOS seems to crash if you try to spawn a .COM
  6229.     file without using emx option -p, see `Using emx options'.  (The
  6230.     machine crashes on the second attempt.)  When using the system
  6231.     call library libsys.lib (-Zsys), only modes P_WAIT, P_NOWAIT and
  6232.     P_OVERLAY are currently available.  SIGCLD is not implemented
  6233.     under DOS.
  6234.  
  6235.     See also: exit(), ptrace(), system(), wait()
  6236.  
  6237. ------------------------------------------------------------------------------
  6238. #include <stdlib.h>                                                      [emx]
  6239.  
  6240. char **_splitargs (char *string, int *count);
  6241.  
  6242.     Parse STRING like a command line and build a vector of pointers to
  6243.     the arguments.  The vector is terminated by a NULL pointer.  The
  6244.     number of arguments is stored to the variable pointed to by COUNT
  6245.     unless COUNT is NULL.  STRING is modified by _splitargs(), the
  6246.     pointers in the resulting vector point into STRING.  _splitargs()
  6247.     allocates the vector using malloc().  If you no longer need the
  6248.     vector, use free() to deallocate it.  On error, _splitargs() sets
  6249.     errno and returns NULL.
  6250.  
  6251.     Arguments in STRING are separated by whitespace (one or more
  6252.     blanks, tabs and linefeeds).  Whitespace at the start of STRING is
  6253.     skipped.  To include blanks, tabs or linefeeds in an argument, the
  6254.     argument must be quoted using double quotation marks.  To remove
  6255.     the special meaning of a double quote, precede it with a
  6256.     backslash.  To remove the special meaning of a backslash in front
  6257.     of a double quote, precede the backslash with a backslash.  The
  6258.     backslash character doesn't have a special meaning unless it
  6259.     precedes a double quote or any number of backslashes followed by a
  6260.     double quote.
  6261.  
  6262.     In other words: If there are n backslashes (\) immediately
  6263.     preceding a double quote character ("), floor(n/2) backslashes are
  6264.     put into the argument.  If n is odd, the double quote character is
  6265.     put into the argument.  If n is even (including zero), the double
  6266.     quote character is used for quoting, that is, spaces are not
  6267.     treated as argument delimiters until the next `quoting' double
  6268.     quote character (ie, a double quote character immediately preceded
  6269.     by an even number (including zero) of backslashes) is found.
  6270.     Backslashes not preceding a quote character are always read as
  6271.     backslashes.
  6272.  
  6273.     See also: popen(), system()
  6274.  
  6275. ------------------------------------------------------------------------------
  6276. #include <stdlib.h>                                                       [PC]
  6277.  
  6278. void _splitpath (const char *src, char *drive, char *dir, char *fname,
  6279.                  char *ext);
  6280.  
  6281.     Split the path name SRC into its components.  The drive name
  6282.     (including the colon) is stored to DRIVE.  The directory
  6283.     (including the final slash or backslash) is copied to DIR, the
  6284.     file name without extension is copied to FNAME, the extension
  6285.     (including the dot) is copied to EXT.  The buffers should be of
  6286.     size _MAX_DRIVE, _MAX_DIR, _MAX_FNAME and _MAX_EXT, respectively.
  6287.     These constants include the terminating null characters.  If one
  6288.     of the pointers (except for SRC) is NULL, that component is not
  6289.     stored.
  6290.  
  6291.     Example:
  6292.  
  6293.         char drive[_MAX_DRIVE], dir[_MAX_DIR];
  6294.         char fname[_MAX_FNAME], ext[_MAX_EXT];
  6295.         char *path = "c:/files/more/test.file.c";
  6296.  
  6297.         _splitpath (path, drive, dir, fname, ext);
  6298.  
  6299.     Results of the example:
  6300.  
  6301.         drive = "c:"
  6302.         dir   = "/files/more/"
  6303.         fname = "test.file"
  6304.         ext   = ".c"
  6305.  
  6306.     See also: _fngetdrive(), _getext(), _getname()
  6307.  
  6308. ------------------------------------------------------------------------------
  6309. #include <stdio.h>                                                      [ANSI]
  6310.  
  6311. int sprintf (char *buffer, const char *format, ...);
  6312.  
  6313.     Formatted output to the string BUFFER.  The string must be big
  6314.     enough to hold the output.  On success, the number of characters
  6315.     copied to BUFFER (excluding the terminating null character) is
  6316.     returned.  Otherwise, EOF is returned.
  6317.  
  6318.     See also: printf(), sscanf()
  6319.  
  6320. ------------------------------------------------------------------------------
  6321. #include <math.h>                                                       [ANSI]
  6322.  
  6323. double sqrt (double x);
  6324.  
  6325.     Compute and return the square root of X.  If X is negative, +#NAN
  6326.     is returned and errno set to EDOM.
  6327.  
  6328.     See also: cbrt(), pow()
  6329.  
  6330. ------------------------------------------------------------------------------
  6331. #include <stdio.h>                                                      [ANSI]
  6332.  
  6333. int sscanf (const char *buffer, const char *format, ...);
  6334.  
  6335.     Parse BUFFER according to the format string FORMAT.  For each
  6336.     field in FORMAT there must be a pointer to the location receiving
  6337.     the value.  The pointers are passed after the FORMAT argument.  On
  6338.     success, the number of fields converted is returned.  Otherwise,
  6339.     EOF is returned.
  6340.  
  6341.     See also: scanf(), sprintf()
  6342.  
  6343. ------------------------------------------------------------------------------
  6344. #include <io.h>                                                         [UNIX]
  6345. #include <sys/types.h>
  6346. #include <sys/stat.h>
  6347.  
  6348. int stat (const char *name, struct stat *buffer);
  6349.  
  6350.     Retrieve information about the file or directory NAME.  stat()
  6351.     will put the data into the structure pointed to by BUFFER.
  6352.  
  6353.     Restrictions: st_dev and st_rdev are set to zero.  Each call to
  6354.     stat() returns a different value for st_ino.
  6355.  
  6356.     See also: fstat()
  6357.  
  6358. ------------------------------------------------------------------------------
  6359. #include <string.h>                                                     [ANSI]
  6360.  
  6361. char *strcat (char *string1, const char *string2);
  6362.  
  6363.     Append the null-terminated string STRING2 to the null-terminated
  6364.     string STRING1 and return STRING1.  The strings must not overlap.
  6365.  
  6366.     See also: strcpy()
  6367.  
  6368. ------------------------------------------------------------------------------
  6369. #include <string.h>                                                     [ANSI]
  6370.  
  6371. char *strchr (const char *string, int c);
  6372.  
  6373.     Return a pointer to the first occurrence of the character C in the
  6374.     null-terminated string STRING.  If there is no character C in
  6375.     STRING, NULL is returned.  If C is 0, a pointer to the terminating
  6376.     zero of STRING is returned.
  6377.  
  6378.     See also: index(), memchr(), strrchr(), strstr()
  6379.  
  6380. ------------------------------------------------------------------------------
  6381. #include <string.h>                                                     [ANSI]
  6382.  
  6383. int strcmp (const char *string1, const char *string2);
  6384.  
  6385.     Compare the null-terminated strings STRING1 and STRING2.  If
  6386.     STRING1 is less than STRING2, a negative value is returned.  If
  6387.     STRING1 is equal to STRING2, zero is returned.  If STRING1 is
  6388.     greater than STRING2, a positive value is returned.
  6389.  
  6390.     See also: memcmp(), stricmp(), strncmp()
  6391.  
  6392. ------------------------------------------------------------------------------
  6393. #include <string.h>                                                     [ANSI]
  6394.  
  6395. int strcoll (const char *string1, const char *string2);
  6396.  
  6397.     Not implemented.
  6398.  
  6399.     See also: strcmp()
  6400.  
  6401. ------------------------------------------------------------------------------
  6402. #include <string.h>                                                     [ANSI]
  6403.  
  6404. char *strcpy (char *string1, const char *string2);
  6405.  
  6406.     Copy the null-terminated string STRING2 to STRING1 and return
  6407.     STRING1.  The strings must not overlap.
  6408.  
  6409.     See also: memccpy(), memcpy(), strcat(), strncpy()
  6410.  
  6411. ------------------------------------------------------------------------------
  6412. #include <string.h>                                                     [ANSI]
  6413.  
  6414. size_t strcspn (const char *string1, const char *string2);
  6415.  
  6416.     Return the length of the initial substring of STRING1 which
  6417.     consists of characters not in STRING2.  That is, the index of the
  6418.     first character in STRING1 which also occurs in STRING2 is
  6419.     returned.  If all characters of STRING1 are not in STRING2, the
  6420.     length of STRING1 is returned.
  6421.  
  6422.     See also: strpbrk(), strspn()
  6423.  
  6424. ------------------------------------------------------------------------------
  6425. #include <string.h>                                                     [UNIX]
  6426.  
  6427. char *strdup (const char *string);
  6428.  
  6429.     Creates a duplicate of STRING by using malloc() to allocate
  6430.     storage and copying STRING.  A pointer to the new string is
  6431.     returned.  If there is not enough memory, NULL is returned.
  6432.  
  6433.     See also: malloc(), strcpy()
  6434.  
  6435. ------------------------------------------------------------------------------
  6436. #include <string.h>                                                     [ANSI]
  6437.  
  6438. char *strerror (int errnum);
  6439.  
  6440.     Return a pointer to a an error message according to the error
  6441.     number ERRNO.  You must not write to the string returned by
  6442.     strerror().  The string may get changed by the next call to
  6443.     strerror().
  6444.  
  6445.     See also: errno, perror(), sys_errlist
  6446.  
  6447. ------------------------------------------------------------------------------
  6448. #include <time.h>                                                       [ANSI]
  6449.  
  6450. size_t strftime (char *string, size_t size, const char *format,
  6451.                  const struct tm *t);
  6452.  
  6453.     Format time.  The output string is written to the buffer STRING of
  6454.     SIZE characters, including the terminating null character.  Like
  6455.     sprintf(), strftime() copies FORMAT to STRING, replacing format
  6456.     specifications with formatted data from T.  Ordinary characters
  6457.     are copied unmodified.  The following format specifications are
  6458.     available:
  6459.  
  6460.         %%    percent sign
  6461.  
  6462.         %a    locale's abbreviated weekday name
  6463.  
  6464.         %A    locale's full weekday name
  6465.  
  6466.         %b    locale's abbreviated month name
  6467.  
  6468.         %B    locale's full month name
  6469.  
  6470.         %c    locale's date and time (this is currently equivalent to
  6471.               %a %b %d %H:%M:%S %Y)
  6472.  
  6473.         %d    day of month (01-31)
  6474.  
  6475.         %D    date, this is equivalent to %m/%d/%y
  6476.  
  6477.         %e    day of month ( 1-31), blank padded
  6478.  
  6479.         %h    locale's abbreviated month name
  6480.  
  6481.         %H    hour (00-23)
  6482.  
  6483.         %I    hour (01-12)
  6484.  
  6485.         %j    day of year (001-366)
  6486.  
  6487.         %m    month (01-12)
  6488.  
  6489.         %M    minute (00-59)
  6490.  
  6491.         %n    newline character
  6492.  
  6493.         %p    locale's equivalent to AM or PM, as appropriate
  6494.  
  6495.         %r    time in AM/PM notation, this is equivalent to %I:%M:%S %p
  6496.  
  6497.         %S    second (00-59)
  6498.  
  6499.         %t    TAB character
  6500.  
  6501.         %T    time, this is equivalent to %H:%M:%S
  6502.  
  6503.         %U    week number of the year, the first day of the week is
  6504.               Sunday (00-53)
  6505.  
  6506.         %w    weekday, the first day of the week is Sunday (0-6)
  6507.  
  6508.         %W    week number of the year, the first day of the week is
  6509.               Monday (00-53)
  6510.  
  6511.         %x    locale's date representation (this is currently
  6512.               equivalent to %m/%d/%y)
  6513.  
  6514.         %X    locale's time representation (this is currently
  6515.               equivalent to %H:%M:%S)
  6516.  
  6517.         %y    year without century (00-99)
  6518.  
  6519.         %Y    year with century (1970-2038)
  6520.  
  6521.         %Z    timezone name (taken from the timezone variable, as the
  6522.               timezone isn't provided by T)
  6523.  
  6524.     If % is followed by a character not listed above, the results are
  6525.     undefined.
  6526.  
  6527.     On success, the number of characters copied to STRING, excluding
  6528.     the terminating null character, is returned.  On failure (SIZE
  6529.     exceeded), 0 is returned.
  6530.  
  6531.     Restrictions: locales are not yet implemented.
  6532.  
  6533.     See also: asctime(), sprintf()
  6534.  
  6535. ------------------------------------------------------------------------------
  6536. #include <string.h>                                                       [PC]
  6537.  
  6538. int stricmp (const char *string1, const char *string2);
  6539.  
  6540.     Compare STRING1 and STRING2, ignoring letter case.  If the strings
  6541.     are equal, 0 is returned.  Otherwise, a positive value is returned
  6542.     if STRING1 is greater than STRING2 (after conversion to lower
  6543.     case).  A negative value is returned if STRING1 is less than
  6544.     STRING2 (after conversion to lower case).
  6545.  
  6546.     See also: strcmp(), tolower()
  6547.  
  6548. ------------------------------------------------------------------------------
  6549. #include <string.h>                                                     [ANSI]
  6550.  
  6551. size_t strlen (const char *string);
  6552.  
  6553.     Returns the length (number of characters) of the string STRING.
  6554.     The length does not include the terminating null character.
  6555.  
  6556.     See also: strchr()
  6557.  
  6558. ------------------------------------------------------------------------------
  6559. #include <string.h>                                                       [PC]
  6560.  
  6561. char *strlwr (char *string);
  6562.  
  6563.     Converts the string STRING to lower case.  The characters 'A'
  6564.     through 'Z' are mapped to the characters 'a' through 'z'.  All
  6565.     other characters are not changed.  The STRING argument is
  6566.     returned.
  6567.  
  6568.     See also: _fnlwr(), strupr()
  6569.  
  6570. ------------------------------------------------------------------------------
  6571. #include <string.h>                                                     [ANSI]
  6572.  
  6573. char *strncat (char *string1, const char *string2, size_t count);
  6574.  
  6575.     Append the null-terminated string STRING2 to the null-terminated
  6576.     string STRING1.  At most COUNT characters of STRING2 are appended
  6577.     to STRING1.  strncat() terminates the new value of STRING1 with a
  6578.     null character.  STRING1 is returned.
  6579.  
  6580.     See also: strcat(), strncpy()
  6581.  
  6582. ------------------------------------------------------------------------------
  6583. #include <string.h>                                                     [ANSI]
  6584.  
  6585. int strncmp (const char *string1, const char *string2, size_t count);
  6586.  
  6587.     Compare the null-terminated strings STRING1 and STRING2.  At most
  6588.     the first COUNT characters are compared.  If STRING1 is less than
  6589.     STRING2, a negative value is returned.  If STRING1 is equal to
  6590.     STRING2, zero is returned.  If STRING1 is greater than STRING2, a
  6591.     positive value is returned.
  6592.  
  6593.     See also: memcmp(), strcmp(), strnicmp()
  6594.  
  6595. ------------------------------------------------------------------------------
  6596. #include <string.h>                                                     [ANSI]
  6597.  
  6598. char *strncpy (char *string1, const char *string2, size_t count);
  6599.  
  6600.     Copy the null-terminated string STRING2 to STRING1 and return
  6601.     STRING1.  The strings must not overlap.  At most the first COUNT
  6602.     characters of STRING2 are copied.  If STRING2 is shorter than
  6603.     COUNT characters, STRING1 is padded with null characters to COUNT
  6604.     characters.  A terminating null character is always appended.
  6605.  
  6606.     See also: strcpy(), strncat()
  6607.  
  6608. ------------------------------------------------------------------------------
  6609. #include <string.h>                                                      [emx]
  6610.  
  6611. char *_strncpy (char *string1, const char *string2, size_t size);
  6612.  
  6613.     Copy the null-terminated string STRING2 to STRING1 and return
  6614.     STRING1.  The strings must not overlap.  At most SIZE characters,
  6615.     including the terminating null character, are copied to STRING1.
  6616.     A terminating null character is always appended, even if STRING2
  6617.     is too long.
  6618.  
  6619.     See also: strcpy(), strncpy()
  6620.  
  6621. ------------------------------------------------------------------------------
  6622. #include <string.h>                                                       [PC]
  6623.  
  6624. int strnicmp (const char *string1, const char *string2, size_t count);
  6625.  
  6626.     Compare the null-terminated strings STRING1 and STRING2 ignoring
  6627.     letter case.  At most the first COUNT characters are compared.  If
  6628.     STRING1 is equal to STRING2, zero is returned.  If STRING1 is less
  6629.     than STRING2 (after conversion to lower case), a negative value is
  6630.     returned.  If STRING1 is greater than STRING2 (after conversion to
  6631.     lower case), a positive value is returned.
  6632.  
  6633.     See also: memicmp(), strcmp(), strncmp(), tolower()
  6634.  
  6635. ------------------------------------------------------------------------------
  6636. #include <string.h>                                                       [PC]
  6637.  
  6638. char *strnset (char *string, int c, size_t count);
  6639.  
  6640.     Set, at most, the first COUNT characters of STRING to the
  6641.     character C and return STRING.  If the length of STRING is less
  6642.     than COUNT, strnset() stops at the terminating null character.
  6643.  
  6644.     See also: memset(), strset()
  6645.  
  6646. ------------------------------------------------------------------------------
  6647. #include <string.h>                                                     [ANSI]
  6648.  
  6649. char *strpbrk (const char *string1, const char *string2);
  6650.  
  6651.     Return a pointer to the first occurrence in STRING1 of a character
  6652.     of STRING2.  The terminating null character is not included in the
  6653.     search.  If no character of STRING2 can be found in STRING1, NULL
  6654.     is returned.
  6655.  
  6656.     See also: strchr(), strcspn()
  6657.  
  6658. ------------------------------------------------------------------------------
  6659. #include <string.h>                                                     [ANSI]
  6660.  
  6661. char *strrchr (const char *string, int c);
  6662.  
  6663.     Return a pointer to the last occurrence of the character C in the
  6664.     null-terminated string STRING.  If there is no character C in
  6665.     STRING, NULL is returned.  If C is 0, a pointer to the terminating
  6666.     null character of STRING is returned.
  6667.  
  6668.     See also: rindex(), strchr()
  6669.  
  6670. ------------------------------------------------------------------------------
  6671. #include <string.h>                                                       [PC]
  6672.  
  6673. char *strrev (char *string);
  6674.  
  6675.     Reverse the order of the characters in STRING return STRING.  The
  6676.     terminating null character remains in place.
  6677.  
  6678. ------------------------------------------------------------------------------
  6679. #include <string.h>                                                       [PC]
  6680.  
  6681. char *strset (char *string, int c);
  6682.  
  6683.     Replace all the characters of STRING with the character C.  The
  6684.     terminating null character is not changed.
  6685.  
  6686.     See also: memset(), strnset()
  6687.  
  6688. ------------------------------------------------------------------------------
  6689. #include <string.h>                                                     [ANSI]
  6690.  
  6691. size_t strspn (const char *string1, const char *string2);
  6692.  
  6693.     Return the length of the initial substring of STRING1 which
  6694.     consists entirely of characters in STRING2.  That is, the index of
  6695.     the first character in STRING1 which does not occur in STRING2 is
  6696.     returned.  If all characters in STRING1 also occur in STRING2, the
  6697.     length of STRING1 is returned.
  6698.  
  6699.     See also: strcspn(), strpbrk()
  6700.  
  6701. ------------------------------------------------------------------------------
  6702. #include <string.h>                                                     [ANSI]
  6703.  
  6704. char *strstr (const char *string1, const char *string2);
  6705.  
  6706.     Return a pointer to the first occurrence of STRING2 in STRING1.
  6707.     If the length of STRING2 is zero, STRING1 is returned.  If STRING2
  6708.     is not a substring of STRING1, NULL is returned.
  6709.  
  6710.     See also: strchr()
  6711.  
  6712. ------------------------------------------------------------------------------
  6713. #include <stdlib.h>                                                     [ANSI]
  6714.  
  6715. double strtod (const char *string, char **end_ptr);
  6716.  
  6717.     Convert ASCII representation of a number to a double.  Leading
  6718.     white space is skipped.  strtod() stops at the first character
  6719.     that cannot be converted.  If END_PTR is not NULL, a pointer to
  6720.     that character is stored to *END_PTR.  strtod() sets errno and
  6721.     returns 0.0 on failure, sets errno and returns +#NAN or -#NAN on
  6722.     overflow.  The string pointed to by STRING is expected to have the
  6723.     following form:
  6724.  
  6725.         [whitespace] [+|-] [digits] [.digits] [[d|D|e|E] [+|-] digits]
  6726.  
  6727.     See also: sscanf()
  6728.  
  6729. ------------------------------------------------------------------------------
  6730. #include <string.h>                                                     [ANSI]
  6731.  
  6732. char *strtok (char *string1, const char *string2);
  6733.  
  6734.     Return a pointer to the next token in STRING1.  The characters of
  6735.     STRING2 are the set of delimiting characters.  Tokens in STRING1
  6736.     are separated by one or more characters from STRING2.
  6737.  
  6738.     The first call to strtok() for STRING1 skips leading delimiters
  6739.     and returns a pointer to the first token.  To get the next token
  6740.     of STRING1, call strtok() with a NULL argument for STRING1.
  6741.     STRING2, the set of delimiters, may be different on subsequent
  6742.     calls.
  6743.  
  6744.     strtok() modifies the string STRING1 by inserting null characters
  6745.     for terminating tokens.  Thus, the pointer returned by strtok()
  6746.     points to a null-terminated token.
  6747.  
  6748.     If there are no more tokens, NULL is returned.
  6749.  
  6750. ------------------------------------------------------------------------------
  6751. #include <stdlib.h>                                                     [ANSI]
  6752.  
  6753. long strtol (const char *string, char **end_ptr, int radix);
  6754.  
  6755.     Convert ASCII representation of a number to a signed long integer.
  6756.     Leading white space is skipped.  RADIX is the number base used for
  6757.     conversion.  It must either be between 2 and 36 or be zero.  If
  6758.     RADIX is 0, the number base is derived from the format of the
  6759.     number.  If the number starts with `0x', base 16 is used.  If the
  6760.     number starts with `0' (not followed by `x'), base 8 used.  If the
  6761.     number does not start with `0', base 10 is used.  strtol() stops
  6762.     at the first character that cannot be converted.  If END_PTR is
  6763.     not NULL, a pointer to that character is stored to *END_PTR.
  6764.     strtol() sets errno and returns 0 on failure, sets errno and
  6765.     returns LONG_MIN or LONG_MAX on overflow.
  6766.  
  6767.     See also: _ltoa(), strtoul(), sscanf()
  6768.  
  6769. ------------------------------------------------------------------------------
  6770. #include <stdlib.h>                                                     [ANSI]
  6771.  
  6772. unsigned long strtoul (const char *string, char **end_ptr, int radix);
  6773.  
  6774.     Convert ASCII representation of a number to an unsigned long
  6775.     integer.  Leading white space is skipped, a sign character is not
  6776.     allowed.  RADIX is the number base used for conversion.  It must
  6777.     either be between 2 and 36 or be zero.  If RADIX is 0, the number
  6778.     base is derived from the format of the number.  If the number
  6779.     starts with `0x', base 16 is used.  If the number starts with `0'
  6780.     (not followed by `x'), base 8 used.  If the number does not start
  6781.     with `0', base 10 is used.  strtoul() stops at the first character
  6782.     that cannot be converted.  If END_PTR is not NULL, a pointer to
  6783.     that character is stored to *END_PTR.  strtoul() sets errno and
  6784.     returns 0 on failure, sets errno and returns ULONG_MAX on
  6785.     overflow.
  6786.  
  6787.     See also: _ultoa(), strtol(), sscanf()
  6788.  
  6789. ------------------------------------------------------------------------------
  6790. #include <string.h>                                                       [PC]
  6791.  
  6792. char *strupr (char *string);
  6793.  
  6794.     Converts the string STRING to upper case.  The characters 'a'
  6795.     through 'z' are mapped to the characters 'A' through 'Z'.  All
  6796.     other characters are not changed.  The STRING argument is
  6797.     returned.
  6798.  
  6799.     See also: strlwr()
  6800.  
  6801. ------------------------------------------------------------------------------
  6802. #include <stdlib.h>                                                     [UNIX]
  6803.  
  6804. void swab (const void *src, void *dst, size_t n);
  6805.  
  6806.     Copy N bytes from SRC to DST, swapping each pair of adjacent
  6807.     bytes.  N must be even.
  6808.  
  6809. ------------------------------------------------------------------------------
  6810. #include <stdlib.h>                                                      [emx]
  6811.  
  6812. char _swchar (void);
  6813.  
  6814.     Retrieve the current switch character.  If the switch character
  6815.     has been changed to '-', _swchar() returns '-'.  Otherwise,
  6816.     _swchar() returns 0.  In this case, you should use the standard
  6817.     switch character '/'.
  6818.  
  6819.     See also: getopt()
  6820.  
  6821. ------------------------------------------------------------------------------
  6822. #include <stdlib.h>                                                  [*] [emx]
  6823.  
  6824. int _syserrno (void);
  6825.  
  6826.     Return the OS/2 or DOS error code for the last system call of the
  6827.     current thread.  If there was no error, 0 is returned.  If the
  6828.     last system call hasn't called an OS/2 or DOS function, 0 is
  6829.     returned.
  6830.  
  6831.     Restrictions: Not implemented under DOS.  When using the system
  6832.     call library libsys.lib (-Zsys), this function is not supported.
  6833.  
  6834. ------------------------------------------------------------------------------
  6835. #include <process.h>                                                    [ANSI]
  6836.  
  6837. int system (const char *name);
  6838.  
  6839.     Execute the command NAME by passing it to the command interpreter.
  6840.     system() uses the COMSPEC environment variable for locating
  6841.     cmd.exe or command.com, respectively.  The PATH environment
  6842.     variable is not used for locating cmd.exe.  If the argument is "",
  6843.     an interactive shell will be started.  If the argument is NULL,
  6844.     system() only checks whether cmd.exe or command.com, respectively,
  6845.     can be found.
  6846.  
  6847.     When running a (native) DOS program, the environment of emx, not
  6848.     that of the process calling spawn() will be inherited.  Because
  6849.     command.com is used under DOS, the command line is restricted to
  6850.     about 123 characters.  If you don't need a command shell, use
  6851.     spawn() instead of system().  It's a bad idea to run emx programs
  6852.     using system() -- not tested.  You must use the -p emx option when
  6853.     using system() under DOS, see `Using emx options'.
  6854.  
  6855.     If system() failed, errno is set and -1 is returned.  If the
  6856.     argument is NULL and the command processor can be found, 0 is
  6857.     returned.  In all other cases, the return code of the command
  6858.     processor is returned.  The return code of the program run by the
  6859.     command processor is returned by cmd.exe but not by command.com.
  6860.     command.com always returns 0.
  6861.  
  6862.     See also: popen(), spawn(), _splitargs()
  6863.  
  6864. ------------------------------------------------------------------------------
  6865. #include <io.h>                                                           [PC]
  6866.  
  6867. long tell (int handle);
  6868.  
  6869.     tell() returns the current position of the file pointer of HANDLE.
  6870.     If there is an error, tell() returns -1.
  6871.  
  6872.     See also: lseek()
  6873.  
  6874. ------------------------------------------------------------------------------
  6875. #include <stdio.h>                                                      [UNIX]
  6876.  
  6877. char *tempnam (const char *dir, const char *prefix);
  6878.  
  6879.     Generate the name suitable for a temporary file without
  6880.     overwriting an existing file.  tempnam() returns a pointer to a
  6881.     string allocated by malloc().  If the TMP environment variable is
  6882.     set and the directory specified by TMP exists, that directory is
  6883.     used.  Otherwise, the DIR argument is used.  If DIR is NULL or the
  6884.     directory specified by DIR does not exist, P_tmpdir as defined in
  6885.     stdio.h is used.  If even this fails, NULL is returned.  The name
  6886.     of the file will start with PREFIX.  PREFIX must not be longer
  6887.     than 5 characters.
  6888.  
  6889.     See also: tmpnam()
  6890.  
  6891. ------------------------------------------------------------------------------
  6892. #include <time.h>                                                       [ANSI]
  6893.  
  6894. time_t time (time_t *ptr);
  6895.  
  6896.     Return the number of seconds elapsed since 00:00 GMT 1-Jan-1970.
  6897.     The system time is converted according to the local timezone.  If
  6898.     PTR is not NULL, the result is also stored to the variable pointed
  6899.     to by PTR.
  6900.  
  6901.     See also: ftime(), gettimeofday()
  6902.  
  6903. ------------------------------------------------------------------------------
  6904. #include <time.h>                                                       [UNIX]
  6905. #include <sys/times.h>
  6906.  
  6907. long times (struct tms *buffer);
  6908.  
  6909.     Return the current time in CLK_TCK fractions of a second since
  6910.     00:00 GMT 1-Jan-1970.  Also sets the tms_utime field of BUFFER to
  6911.     the number of seconds the process has been running.  The other
  6912.     fields are set to 0.
  6913.  
  6914.     Restriction: The return value is unusable due to overflow.
  6915.  
  6916.     See also: clock(), time()
  6917.  
  6918. ------------------------------------------------------------------------------
  6919. #include <stdio.h>                                                      [ANSI]
  6920.  
  6921. FILE *tmpfile (void);
  6922.  
  6923.     Create and open a temporary file.  The name of the file is created
  6924.     with tmpnam().  The file is opened in "w+b" mode.
  6925.  
  6926.     On success, a stream pointer is returned.  On failure, NULL is
  6927.     returned.
  6928.  
  6929.     See also: _rmtmp(), tmpnam()
  6930.  
  6931. ------------------------------------------------------------------------------
  6932. #include <stdio.h>                                                      [ANSI]
  6933.  
  6934. char *tmpnam (char *string);
  6935.  
  6936.     Create a unique file name and store it to STRING.  There must be
  6937.     L_tmpnam bytes at STRING.  If STRING is NULL, a static buffer is
  6938.     used which will be overwritten by subsequent calls.  The file name
  6939.     is a concatenation of P_tmpdir and a sequence of digits.
  6940.  
  6941.     On success, a pointer to the new name is returned.  On failure,
  6942.     NULL is returned.
  6943.  
  6944.     See also: tempnam(), tmpfile(), mktemp()
  6945.  
  6946. ------------------------------------------------------------------------------
  6947. #include <ctype.h>                                                      [ANSI]
  6948.  
  6949. int tolower (int c);
  6950. int toupper (int c);
  6951.  
  6952.     tolower() converts the character C to lower case, if it is in the
  6953.     range 'A' ... 'Z'.  toupper() converts the character C to upper
  6954.     case, if it is in the range 'a' ... 'z'.
  6955.  
  6956.     See also: stricmp(), strlwr(), strupr(), _tolower(), _toupper()
  6957.  
  6958. ------------------------------------------------------------------------------
  6959. #include <ctype.h>                                                      [UNIX]
  6960.  
  6961. int _tolower (int c);
  6962. int _toupper (int c);
  6963.  
  6964.     _tolower() converts the upper-case character C to lower case; C
  6965.     must be in the range 'A' through 'Z'.  _toupper() converts the
  6966.     lower-case character C to upper case; C must be in the range 'a'
  6967.     through 'z'.
  6968.  
  6969.     See also: tolower(), toupper()
  6970.  
  6971. ------------------------------------------------------------------------------
  6972. #include <math.h>
  6973.  
  6974. double trunc (double x);
  6975.  
  6976.     Return as floating-point number X chopped to an integer by
  6977.     truncating the fractional digits (rounding toward 0).
  6978.  
  6979.     See also: ceil(), floor(), modf(), rint()
  6980.  
  6981. ------------------------------------------------------------------------------
  6982. #include <io.h>                                                          [BSD]
  6983.  
  6984. int truncate (char *name, long length);
  6985.  
  6986.     Truncate the file NAME to at most LENGTH bytes.  If LENGTH is
  6987.     greater than the current length of the file, the length is not
  6988.     changed.  If successful, 0 is returned.  Otherwise, -1 is
  6989.     returned.
  6990.  
  6991.     See also: chsize(), ftruncate()
  6992.  
  6993. ------------------------------------------------------------------------------
  6994. #include <time.h>                                                       [UNIX]
  6995.  
  6996. void tzset (void);
  6997.  
  6998.     Set timezone according to the TZ environment variable.  If you
  6999.     have a problem with a program interpreting TZ differently (for
  7000.     instance a program which supports day-light-saving time), set
  7001.     EMXTZ for emx programs.  If EMXTZ is set, emx will use the value
  7002.     of EMXTZ instead of the value of TZ.  The following global
  7003.     variables are set by tzset(): daylight, timezone, tzname.  TZ has
  7004.     the following format:
  7005.  
  7006.        TZ1[offset][TZ2]
  7007.  
  7008.     Where TZ1 is the three-letter name of the local timezone, offset
  7009.     is the optional offset to GMT (hours; positive values are to the
  7010.     west of Greenwich) and TZ2 is the optional name of the
  7011.     day-light-saving timezone, which is currently ignored.  Example:
  7012.     PST8PDT.
  7013.  
  7014.     If TZ is not set, GMT is used.
  7015.  
  7016. ------------------------------------------------------------------------------
  7017. #include <stdlib.h>                                                     [SysV]
  7018.  
  7019. long ulimit (int request, long newlimit);
  7020.  
  7021.     Set or get process limits.  The following REQUEST codes are
  7022.     implemented:
  7023.  
  7024.         1  Return the maximum file size.  Always returns 1 << 21.
  7025.  
  7026.         2  Set the maximum file size to NEWLIMIT.  Ignored.  Returns
  7027.            NEWLIMIT.
  7028.  
  7029.         3  Return the greatest possible break value
  7030.  
  7031.         4  Return the number of files that can be open simultaneously
  7032.            per process.  Always returns 40.
  7033.  
  7034. ------------------------------------------------------------------------------
  7035. #include <io.h>                                                         [UNIX]
  7036.  
  7037. int umask (int pmode);
  7038.  
  7039.     Set the file-permission mask of the current process to PMODE.  The
  7040.     previous file-permission mask is returned.  Only the S_IWRITE bit
  7041.     is used.
  7042.  
  7043.     Restrictions: The current file-permission mask is inherited by emx
  7044.     programs spawned under DOS.  Under OS/2, the file-permission mask
  7045.     is not yet inherited.  When spawning a non-emx program (such as
  7046.     command.com, see system()) which spawns an emx program, that
  7047.     program won't inherit the file-permission mask.
  7048.  
  7049.     See also: fopen(), open()
  7050.  
  7051. ------------------------------------------------------------------------------
  7052. #include <sys/utsname.h>                                                [UNIX]
  7053.  
  7054. int uname (struct utsname *name);
  7055.  
  7056.     Store information identifying the current system to the structure
  7057.     pointed to by NAME.
  7058.  
  7059.     This function returns 0 (always successful).
  7060.  
  7061. ------------------------------------------------------------------------------
  7062. #include <stdio.h>                                                      [ANSI]
  7063.  
  7064. int ungetc (int c, FILE *stream);
  7065.  
  7066.     Push back the character C onto STREAM and clear the end-of-file
  7067.     indicator.  STREAM must be open for reading.  The next read
  7068.     operation on STREAM starts with C.  If C is EOF, nothing is done.
  7069.     Only one character can be pushed onto a stream.  fflush(),
  7070.     fseek(), fsetpos() and rewind() undo ungetc().  After a successful
  7071.     ungetc(), the value of the file pointer is undefined until the
  7072.     character has been read.
  7073.  
  7074.     On success, the character C is returned.  On failure, EOF is
  7075.     returned.
  7076.  
  7077.     See also: fgetc(), fflush()
  7078.  
  7079. ------------------------------------------------------------------------------
  7080. #include <stdio.h>      /* use this */                                  [UNIX]
  7081. #include <io.h>         /* or this */
  7082.  
  7083. int unlink (const char *name);
  7084.  
  7085.     Delete the file NAME.  0 is returned if successful, -1 if not.
  7086.  
  7087.     Under OS/2 and DOS, unlink() and remove() are equivalent.
  7088.  
  7089.     See also: remove().
  7090.  
  7091. ------------------------------------------------------------------------------
  7092. #include <sys/utime.h>                                                  [SysV]
  7093.  
  7094. int utime (const char *name, const struct utimbuf *times);
  7095.  
  7096.     Set time stamp of file NAME to the access time and modification
  7097.     time given in TIMES.  If TIMES is NULL, both the access time and
  7098.     the modification time are set to the current time.
  7099.  
  7100.     See also: stat(), utimes()
  7101.  
  7102. ------------------------------------------------------------------------------
  7103. #include <sys/time.h>                                                    [BSD]
  7104.  
  7105. int utimes (const char *name, const struct timeval *tvp);
  7106.  
  7107.     Set time stamp of file NAME to the access time given in TVP[0] and
  7108.     the modification time given in TVP[1].  If TVP is NULL, both the
  7109.     access time and the modification time are set to the current time.
  7110.  
  7111.     See also: stat(), utime()
  7112.  
  7113. ------------------------------------------------------------------------------
  7114. #include <sys/video.h>                                                   [emx]
  7115.  
  7116. void v_attrib (int a);
  7117.  
  7118.     Set the attributes (colors etc.) used by video library functions
  7119.     to A.  You can make A by using the binary OR operator and the
  7120.     F_whatever, B_whatever, INTENSITY and BLINK constants.
  7121.  
  7122.     See also: v_init(), v_putc()
  7123.  
  7124. ------------------------------------------------------------------------------
  7125. #include <sys/video.h>                                                   [emx]
  7126.  
  7127. void v_backsp (int count);
  7128.  
  7129.     Backspace the cursor.  The cursor is moved left by COUNT
  7130.     characters.  If the cursor leaves the screen at the left edge, it
  7131.     is moved to the end of the previous line.  The cursor cannot leave
  7132.     the screen at the top edge.
  7133.  
  7134.     See also: v_putc()
  7135.  
  7136. ------------------------------------------------------------------------------
  7137. #include <sys/video.h>                                                   [emx]
  7138.  
  7139. void v_clear (void);
  7140.  
  7141.     Clear the screen using the current attributes.
  7142.  
  7143.     See also: v_attrib(), v_clreol()
  7144.  
  7145. ------------------------------------------------------------------------------
  7146. #include <sys/video.h>                                                   [emx]
  7147.  
  7148. void v_clreol (void);
  7149.  
  7150.     Clear the line from the current cursor position to the end of the
  7151.     current line using the current attributes.
  7152.  
  7153.     See also: v_attrib(), v_clear()
  7154.  
  7155. ------------------------------------------------------------------------------
  7156. #include <sys/video.h>                                                   [emx]
  7157.  
  7158. void v_ctype (int start, int end);
  7159.  
  7160.     Set the cursor type.  START is the first row of the cursor, END is
  7161.     the last row of the cursor.  Both values are zero-based. Use
  7162.     v_hardware() to determine the size of the character box.
  7163.  
  7164.     See also: v_getctype(), v_hardware(), v_hidecursor()
  7165.  
  7166. ------------------------------------------------------------------------------
  7167. #include <sys/video.h>                                                   [emx]
  7168.  
  7169. void v_delline (int count);
  7170.  
  7171.     Delete COUNT lines at the current cursor position by moving up the
  7172.     lines below the current line.  The current attributes are used for
  7173.     filling lines becoming empty at the bottom of the screen.
  7174.  
  7175.     See also: v_attrib(), v_insline(), v_scroll()
  7176.  
  7177. ------------------------------------------------------------------------------
  7178. #include <sys/video.h>                                                   [emx]
  7179.  
  7180. void v_dimen (int *width, int *height);
  7181.  
  7182.     Store the screen width (columns) to WIDTH, the screen height
  7183.     (lines) to HEIGHT.
  7184.  
  7185.     See also: _scrsize()
  7186.  
  7187. ------------------------------------------------------------------------------
  7188. #include <sys/video.h>                                                   [emx]
  7189.  
  7190. int v_getattr (void);
  7191.  
  7192.     Return the current attributes.
  7193.  
  7194.     See also: v_attrib()
  7195.  
  7196. ------------------------------------------------------------------------------
  7197. #include <sys/video.h>                                                   [emx]
  7198.  
  7199. void v_getctype (int *start, int *end);
  7200.  
  7201.     Store the current cursor start and end rows to START and END.
  7202.  
  7203.     See also: v_ctype()
  7204.  
  7205. ------------------------------------------------------------------------------
  7206. #include <sys/video.h>                                                   [emx]
  7207.  
  7208. void v_getline (char *dst, int x, int y, int count);
  7209.  
  7210.     Copy COUNT character/attributes pairs from the screen at position
  7211.     (X,Y) to DST.  2*COUNT bytes are copied.  The cursor is not moved.
  7212.  
  7213.     See also: v_putline()
  7214.  
  7215. ------------------------------------------------------------------------------
  7216. #include <sys/video.h>                                                   [emx]
  7217.  
  7218. void v_getxy (int *x, int *y);
  7219.  
  7220.     Store the current cursor position to X (column) and Y (line).
  7221.  
  7222.     See also: v_gotoxy()
  7223.  
  7224. ------------------------------------------------------------------------------
  7225. #include <sys/video.h>                                                   [emx]
  7226.  
  7227. void v_gotoxy (int x, int y);
  7228.  
  7229.     Move the cursor to line Y, column X.  Both values are zero-based.
  7230.     Line 0 is the top line, column 0 is the left-most column.
  7231.  
  7232.     See also: v_getxy()
  7233.  
  7234. ------------------------------------------------------------------------------
  7235. #include <sys/video.h>                                                   [emx]
  7236.  
  7237. int v_hardware (void);
  7238.  
  7239.     Return a value indicating the display adapter type.  The following
  7240.     values are defined:
  7241.  
  7242.     V_MONOCHROME        Monochrome display adapter
  7243.  
  7244.     V_COLOR_8           Color display adapter, the character box
  7245.                         height is 8 scan lines
  7246.  
  7247.     V_COLOR_12          Color display adapter, the character box
  7248.                         height is 12 scan lines
  7249.  
  7250.     See also: v_ctype()
  7251.  
  7252. ------------------------------------------------------------------------------
  7253. #include <sys/video.h>                                                   [emx]
  7254.  
  7255. void v_hidecursor (void);
  7256.  
  7257.     Turn off the cursor.  Use v_ctype() to turn the cursor on.
  7258.  
  7259.     See also: v_ctype()
  7260.  
  7261. ------------------------------------------------------------------------------
  7262. #include <sys/video.h>                                                   [emx]
  7263.  
  7264. int v_init (void);
  7265.  
  7266.     Initialize video library.  You must call this function before
  7267.     calling any other video library function.  The attributes are set
  7268.     to F_WHITE|B_BLACK.
  7269.  
  7270.     General information about the video library: The video library
  7271.     implements text-mode output to the screen.  You have to link with
  7272.     libvideo (use the -lvideo option).  Under DOS, emx option -acm is
  7273.     required, see `Using emx options'.  See wm_init() for a
  7274.     higher-level interface.
  7275.  
  7276.     Example: /emx/test/video.c
  7277.  
  7278.     See also: v_attrib()
  7279.  
  7280. ------------------------------------------------------------------------------
  7281. #include <sys/video.h>                                                   [emx]
  7282.  
  7283. void v_insline (int count);
  7284.  
  7285.     Insert COUNT empty lines at the current cursor position by moving
  7286.     down the line at the current cursor position and all lines below
  7287.     that line.  The current attributes are used for filling the empty
  7288.     lines.
  7289.  
  7290.     See also: v_attrib(), v_delline(), v_scroll()
  7291.  
  7292. ------------------------------------------------------------------------------
  7293. #include <sys/video.h>                                                   [emx]
  7294.  
  7295. int v_printf (const char *fmt, ...);
  7296.  
  7297.     Formatted output to the screen at the current cursor position.
  7298.     The cursor is moved.  See printf() for details on FMT.  The number
  7299.     of output characters is returned.
  7300.  
  7301.     See also: v_attrib(), v_putc(), v_puts()
  7302.  
  7303. ------------------------------------------------------------------------------
  7304. #include <sys/video.h>                                                   [emx]
  7305.  
  7306. void v_putc (char c);
  7307.  
  7308.     Display character C on the screen at the current cursor position,
  7309.     using the current attributes.  The cursor is moved.  If the cursor
  7310.     leaves the screen at the right edge, it will be moved to the start
  7311.     of the next line.  If C is '\n', the cursor is moved to the start
  7312.     of the next line.  If the cursor leaves the screen at the bottom
  7313.     edge, the screen is scrolled up.
  7314.  
  7315.     See also: v_attrib(), v_puts(), v_scrollup()
  7316.  
  7317. ------------------------------------------------------------------------------
  7318. #include <sys/video.h>                                                   [emx]
  7319.  
  7320. void v_putline (const char *src, int x, int y, int count);
  7321.  
  7322.     Copy COUNT character/attributes pairs from SRC to the screen at
  7323.     position (X,Y).  2*COUNT bytes are copied.  The cursor is not
  7324.     moved.
  7325.  
  7326.     See also: v_getline(), v_putmask(), v_putn()
  7327.  
  7328. ------------------------------------------------------------------------------
  7329. #include <sys/video.h>                                                   [emx]
  7330.  
  7331. void v_putm (const char *str, int len);
  7332.  
  7333.     Display LEN characters of STR at the current cursor position using
  7334.     the current attributes.  The cursor is not moved.
  7335.  
  7336.     See also: v_putline(), v_putn(), v_puts()
  7337.  
  7338. ------------------------------------------------------------------------------
  7339. #include <sys/video.h>                                                   [emx]
  7340.  
  7341. void v_putmask (const char *src, const char *mask, int x, int y, int count);
  7342.  
  7343.     Copy COUNT character/attributes pairs from SRC to the screen.  A
  7344.     character/attributes pair at SRC[2*i] and SRC[2*i+1], is copied
  7345.     only if MASK[i] is non-zero.  The cursor is not moved.
  7346.  
  7347.     See also: v_putline()
  7348.  
  7349. ------------------------------------------------------------------------------
  7350. #include <sys/video.h>                                                   [emx]
  7351.  
  7352. void v_putn (char c, int count);
  7353.  
  7354.     Display character C at the current cursor position.  COUNT is the
  7355.     number of times to display the character.  The cursor is not
  7356.     moved.
  7357.  
  7358.     See also: v_attrib(), v_putc()
  7359.  
  7360. ------------------------------------------------------------------------------
  7361. #include <sys/video.h>                                                   [emx]
  7362.  
  7363. void v_puts (const char *str);
  7364.  
  7365.     Display string STR at the current cursor position using the
  7366.     current attributes.  The '\n' character moves the cursor to the
  7367.     start of the next line.  Scrolling is performed when the cursor
  7368.     leaves the screen at the bottom edge.
  7369.  
  7370.     See also: v_attrib(), v_putc(), v_putm()
  7371.  
  7372. ------------------------------------------------------------------------------
  7373. #include <sys/video.h>                                                   [emx]
  7374.  
  7375. void v_scroll (int tl_x, int tl_y, int br_x, int br_y, int count, int flag);
  7376.  
  7377.     Scroll a rectangle of the screen by COUNT lines.  The top left
  7378.     character cell is at (TL_X,TL_Y), the bottom right character cell
  7379.     is at (BR_X,BR_Y).  If FLAG is V_SCROLL_UP, the rectangle is
  7380.     scrolled up, if FLAG is V_SCROLL_DOWN, the rectangle is scrolled
  7381.     down.  If FLAG is V_SCROLL_CLEAR, the rectangle is filled with
  7382.     blanks.  Lines becoming empty are filled with blanks using the
  7383.     current attributes.
  7384.  
  7385.     See also: v_attrib(), v_scrollup()
  7386.  
  7387. ------------------------------------------------------------------------------
  7388. #include <sys/video.h>                                                   [emx]
  7389.  
  7390. void v_scrollup (void);
  7391.  
  7392.     Scroll screen up by one line.  The bottom line is filled with
  7393.     blanks, using the current attributes.
  7394.  
  7395.     See also: v_attrib(), v_putc()
  7396.  
  7397. ------------------------------------------------------------------------------
  7398. #include <sys/video.h>                                                   [emx]
  7399.  
  7400. int v_vprintf (const char *fmt, va_list arg_ptr);
  7401.  
  7402.     Formatted output to the screen.  Instead of a list of arguments,
  7403.     this function takes a pointer to the list of arguments.  See
  7404.     v_printf() for details.
  7405.  
  7406.     See also: v_printf(), va_arg()
  7407.  
  7408. ------------------------------------------------------------------------------
  7409. #include <stdarg.h>                                                     [ANSI]
  7410.  
  7411. type va_arg (va_list arg_ptr, type);
  7412. void va_end (va_list arg_ptr);
  7413. void va_start (va_list arg_ptr, type prev_arg);
  7414.  
  7415.     Access arguments of a function with variable number of arguments.
  7416.     You have to declare a variable of type va_list, for instance
  7417.     ARG_PTR.  Use
  7418.  
  7419.         va_start (arg_ptr, prev_arg),
  7420.  
  7421.     where PREV_ARG is the argument preceding the variable arguments,
  7422.     to initialize ARG_PTR.  Use
  7423.  
  7424.         va_arg (arg_ptr, type)
  7425.  
  7426.     to get the next argument, which is of type TYPE.  Use va_end
  7427.     (arg_ptr) if you no longer need ARG_PTR.
  7428.  
  7429.     Restriction: PREV_ARG should not be of type `float' unless there's
  7430.     a prototype for the function, TYPE should not be `float'.  Both
  7431.     problems are due to the fact that float is promoted to double.
  7432.  
  7433.     See also: vprintf()
  7434.  
  7435. ------------------------------------------------------------------------------
  7436. #include <stdio.h>                                                      [ANSI]
  7437.  
  7438. int vprintf (const char *format, va_list arg_ptr);
  7439. int vfprintf (FILE *stream, const char *format, va_list arg_ptr);
  7440. int vsprintf (char *buffer, const char *format, va_list arg_ptr);
  7441.  
  7442.     Formatted output to stdout, to the stream STREAM or to the string
  7443.     BUFFER, respectively.  Instead of a list of arguments, these
  7444.     functions take a pointer to the list of arguments.  See printf()
  7445.     for details.
  7446.  
  7447.     See also: printf(), va_arg()
  7448.  
  7449. ------------------------------------------------------------------------------
  7450. #include <stdio.h>                                                       [emx]
  7451.  
  7452. int vscanf (const char *format, va_list arg_ptr);
  7453. int vfscanf (FILE *stream, const char *format, va_list arg_ptr);
  7454. int vsscanf (const char *buffer, const char *format, va_list arg_ptr);
  7455.  
  7456.     Parse input from stdin, STREAM or BUFFER, respectively.  Instead
  7457.     of a list of arguments, these functions take a pointer to the list
  7458.     of arguments.  See scanf() for details.
  7459.  
  7460.     See also: scanf(), va_arg()
  7461.  
  7462. ------------------------------------------------------------------------------
  7463. #include <process.h>    /* use this */                                  [UNIX]
  7464. #include <sys/wait.h>   /* or this */
  7465.  
  7466. int wait (int *status);
  7467.  
  7468.     Wait until a child process terminates or if a child process which
  7469.     is being debugged gets a signal, for instance, SIGTRAP after a
  7470.     single step has been performed.  If there are no child processes,
  7471.     wait() returns immediately, setting errno to ECHILD and returning
  7472.     -1.  If STATUS is not NULL, the return code and the termination
  7473.     status are stored to the location pointed to by STATUS.  The
  7474.     termination status is stored in the low-order byte, the return
  7475.     code is stored in the high-order byte.  If the child process
  7476.     terminates normally, the low-order byte contains 0, the high-order
  7477.     byte contains the return code.  If the child process has been
  7478.     stopped, the low-order byte contains 127, the high-order byte
  7479.     contains the signal number.  This occurs only if the child process
  7480.     is being debugged.  If the child process terminated due to a
  7481.     signal, the low-order byte contains the signal number, the
  7482.     high-order byte contains 0.  See also the macros defined in
  7483.     sys/wait.h.  [...] wait() returns the process ID of the child
  7484.     process.  If an error occurs, wait() sets errno and returns -1.
  7485.     Example:
  7486.  
  7487.         int tc, pid;
  7488.  
  7489.         pid = wait (&tc);
  7490.         if (pid >= 0)
  7491.           {
  7492.             if ((tc & 0xff) == 0)
  7493.               printf ("Normal process termination, rc=%d\n", tc >> 8);
  7494.             else if ((tc & 0xff) == 127)
  7495.               printf ("Process stopped by signal %d\n", tc >> 8);
  7496.             else
  7497.               printf ("Process terminated by signal %d\n", tc & 0xff);
  7498.           }
  7499.  
  7500.     Restrictions: Under DOS wait() is currently implemented only for
  7501.     processes being debugged; see ptrace() and spawn().  Under OS/2,
  7502.     wait() works only for processes started with spawn() or exec().
  7503.     It does not work for processes started with DosExecPgm or
  7504.     DosStartSession.  If the processes found by wait() has been
  7505.     started as a session, only the return code is available, not the
  7506.     signal number.  wait() is not interrupted by signals.
  7507.  
  7508.     See also: ptrace(), signal(), spawn(), waitpid()
  7509.  
  7510. ------------------------------------------------------------------------------
  7511. #include <sys/hw.h>                                                  [*] [emx]
  7512.  
  7513. void _wait0 (unsigned port, unsigned mask);
  7514. void _wait1 (unsigned port, unsigned mask);
  7515. void _wait01 (unsigned port, unsigned mask);
  7516. void _wait10 (unsigned port, unsigned mask);
  7517.  
  7518.     The _wait0() and _wait1() functions wait for the bit indicated by
  7519.     MASK of the 8-bit hardware port PORT being 0 or 1, respectively.
  7520.  
  7521.     The _wait01() and _wait10() functions wait for a 0->1 or 1->0
  7522.     transition, respectively, of the bit indicated by MASK of the
  7523.     8-bit hardware port PORT.
  7524.  
  7525.     If there are multiple bits set in MASK, `0' means all bits
  7526.     cleared, `1' means at least one bit set.
  7527.  
  7528.     You have to call _portaccess() first to enable access to a range
  7529.     of ports.  To make your program work under DOS, you have to use
  7530.     emx option -ai, see `Using emx options'.  Under OS/2, your program
  7531.     requires emxio.dll in a directory listed in LIBPATH.  When linking
  7532.     with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to
  7533.     use libemxio (-lemxio).  libemxio must not be used if the program
  7534.     should run under DOS.
  7535.  
  7536.     Note that these functions eat lots of CPU time.
  7537.  
  7538.     See also: _portaccess(), _inp8()
  7539.  
  7540. ------------------------------------------------------------------------------
  7541. #include <sys/wait.h>                                                   [UNIX]
  7542.  
  7543. int waitpid (int pid, int *status, int options);
  7544.  
  7545.     Wait until the child process PID terminates.  If PID is -1,
  7546.     waitpid() waits for any child process, as does wait().  If there
  7547.     is no child process with process ID PID (or if PID is -1 and there
  7548.     is no child process), errno is set to ESRCH and -1 is returned.
  7549.     If STATUS is not NULL, the return code and the termination status
  7550.     are stored to the location pointed to by STATUS, see wait() for
  7551.     details.  OPTIONS is currently ignored.
  7552.  
  7553.     Restrictions: waitpid() is not implemented for negative values of
  7554.     PID.  OPTIONS is ignored.  waitpid() is not implemented under DOS.
  7555.     waitpid() cannot be used with ptrace() -- wait() must be used
  7556.     instead.
  7557.  
  7558.     See also: wait()
  7559.  
  7560. ------------------------------------------------------------------------------
  7561. #include <stdlib.h>                                                      [emx]
  7562.  
  7563. void _wildcard (int *argcp, char ***argvp);
  7564.  
  7565.     Expand wildcards.  If you want wildcards on the command line to be
  7566.     expanded, call
  7567.  
  7568.         _wildcard (&argc, &argv);
  7569.  
  7570.     at the beginning of main().  Wildcard arguments enclosed in double
  7571.     quotes won't be expanded.  If the expansion of a wildcard argument
  7572.     is empty, the wildcard argument is kept unchanged.  Directories
  7573.     are included in the expansion.  Hidden and system files are
  7574.     omitted.
  7575.  
  7576.     _fnlwr() is used to convert file names to lower case on
  7577.     upper-case-only file systems.
  7578.  
  7579.     See also: _fnexplode(), main(), _response()
  7580.  
  7581. ------------------------------------------------------------------------------
  7582. #include <sys/winmgr.h>                                                  [emx]
  7583.  
  7584. void wm_attrib (wm_handle wh, int a);
  7585.  
  7586.     Set the default attributes of window WH to A.
  7587.  
  7588.     See also: wm_create(), wm_get_attrib(), wm_putc()
  7589.  
  7590. ------------------------------------------------------------------------------
  7591. #include <sys/winmgr.h>                                                  [emx]
  7592.  
  7593. void wm_attrib_all (wm_handle wh, int a);
  7594.  
  7595.     Change the attributes of all characters of window WH (except of
  7596.     the border) to A.  The character codes are not changed.
  7597.  
  7598.     See also: wm_attrib(), wm_clear(), wm_create()
  7599.  
  7600. ------------------------------------------------------------------------------
  7601. #include <sys/winmgr.h>                                                  [emx]
  7602.  
  7603. void wm_backsp (wm_handle wh, int count);
  7604.  
  7605.     Backspace the cursor of window WH.  The cursor is moved left by
  7606.     COUNT characters.  If the cursor leaves the window at the left
  7607.     edge, it is moved to the end of the previous line.  The cursor
  7608.     cannot leave the window at the top edge.
  7609.  
  7610.     See also: wm_putc()
  7611.  
  7612. ------------------------------------------------------------------------------
  7613. #include <sys/winmgr.h>                                                  [emx]
  7614.  
  7615. void wm_border (wm_handle wh, int bflag, int battr, const char *title,
  7616.                 int tflag, int tattr);
  7617.  
  7618.     Change the border of window WH.  The border type is set to BFLAG:
  7619.     0 turns the border off, 1 uses a single line, 2 uses a double
  7620.     line, 3 and 4 use both single and double lines -- which is not
  7621.     recommended as most code pages do not contain the necessary
  7622.     symbols.  All other values are used as characters for drawing the
  7623.     border.  The attributes BATTR are used for drawing the border.
  7624.     TITLE is displayed centered in the top line of the border.  If
  7625.     TFLAG is non-zero, vertical bars are used to separate the title
  7626.     text from the border.  The attributes TATTR are used for
  7627.     displaying the title text.
  7628.  
  7629.     See also: wm_create()
  7630.  
  7631. ------------------------------------------------------------------------------
  7632. #include <sys/winmgr.h>                                                  [emx]
  7633.  
  7634. void wm_bottom (wm_handle wh);
  7635.  
  7636.     Move window WH to the bottom of the window stack, that is, it will
  7637.     be moved below all other windows.
  7638.  
  7639.     See also: wm_top(), wm_up()
  7640.  
  7641. ------------------------------------------------------------------------------
  7642. #include <sys/winmgr.h>                                                  [emx]
  7643.  
  7644. void wm_chide (int flag);
  7645.  
  7646.     Set the cursor hide mode.  If FLAG is non-zero, the cursor is
  7647.     hidden if the current cursor position is hidden by another window.
  7648.     If FLAG is zero, the cursor is visible even if the cursor position
  7649.     is hidden by another window.  The initial value is non-zero.
  7650.  
  7651.     See also: wm_ctype(), wm_cursor()
  7652.  
  7653. ------------------------------------------------------------------------------
  7654. #include <sys/winmgr.h>                                                  [emx]
  7655.  
  7656. void wm_clear (wm_handle wh);
  7657.  
  7658.     Clear window WH by filling WH with blanks using the current
  7659.     attributes.
  7660.  
  7661.     See also: wm_attrib(), wm_attrib_all()
  7662.  
  7663. ------------------------------------------------------------------------------
  7664. #include <sys/winmgr.h>                                                  [emx]
  7665.  
  7666. void wm_close (wm_handle wh);
  7667.  
  7668.     Close the window WH.  After closing the window, it still exists
  7669.     but is not visible.
  7670.  
  7671.     See also: wm_open()
  7672.  
  7673. ------------------------------------------------------------------------------
  7674. #include <sys/winmgr.h>                                                  [emx]
  7675.  
  7676. void wm_close_all (void);
  7677.  
  7678.    Close all the windows.  wm_close_all() restores the original screen
  7679.    contents.
  7680.  
  7681.    See also: wm_close(), wm_open()
  7682.  
  7683. ------------------------------------------------------------------------------
  7684. #include <sys/winmgr.h>                                                  [emx]
  7685.  
  7686. void wm_clr_eol (wm_handle wh, int x, int y);
  7687.  
  7688.     Clear from position (X,Y) of window WH to the end of that line of
  7689.     that window by displaying blanks.  The current attributes are
  7690.     used.
  7691.  
  7692.     See also: wm_clear()
  7693.  
  7694. ------------------------------------------------------------------------------
  7695. #include <sys/winmgr.h>                                                  [emx]
  7696.  
  7697. wm_handle wm_create (int x0, int y0, int x1, int y1, int border, int battr,
  7698.                      int wattr);
  7699.  
  7700.     Create a window.  The upper left character of the window interior
  7701.     is at (X0,Y0), the bottom right character of the window interior
  7702.     is at (X1,Y1).  A window may be larger than the screen or
  7703.     partially or completely outside the screen.  BORDER specifies the
  7704.     border type: 0 doesn't draw a border, 1 uses a single line, 2 uses
  7705.     a double line, 3 and 4 use both single and double lines -- which
  7706.     is not recommended as most code pages do not contain the necessary
  7707.     symbols.  All other values are used as characters for drawing the
  7708.     border.  The attributes BATTR are used for drawing the border.
  7709.     The attributes for displaying text in the window are set to WATTR.
  7710.     After creating a window, it is invisible.  Use wm_open() to show
  7711.     the window.  wm_create() returns the handle of the window if
  7712.     successful.  Otherwise, NULL is returned.
  7713.  
  7714.     See also: wm_attrib(), wm_border(), wm_delete(), wm_open()
  7715.  
  7716. ------------------------------------------------------------------------------
  7717. #include <sys/winmgr.h>                                                  [emx]
  7718.  
  7719. void wm_ctype (wm_handle wh, int start, int end);
  7720.  
  7721.     Set the cursor type of window WH.  START is the first row of the
  7722.     cursor, END is the last row of the cursor.  Both values are
  7723.     zero-based.  The cursor type set by wm_ctype() is used for
  7724.     displaying the cursor if it is connected to window WH.  Use
  7725.     v_hardware() to determine the size of the character box.
  7726.  
  7727.     See also: v_hardware(), wm_chide(), wm_cursor()
  7728.  
  7729. ------------------------------------------------------------------------------
  7730. #include <sys/winmgr.h>                                                  [emx]
  7731.  
  7732. void wm_cursor (wm_handle wh);
  7733.  
  7734.     Connect the screen cursor with the cursor of window WH.  The
  7735.     cursor is displayed at the cursor position of window WH, using the
  7736.     cursor type of window WH.  If WH is NULL, the screen cursor is not
  7737.     connected to any window and is invisible.  Initially, the screen
  7738.     cursor is not connected to any window.
  7739.  
  7740.     See also: wm_chide(), wm_ctype(), wm_cvis()
  7741.  
  7742. ------------------------------------------------------------------------------
  7743. #include <sys/winmgr.h>                                                  [emx]
  7744.  
  7745. void wm_cvis (wm_handle wh, int flag);
  7746.  
  7747.     Set the cursor status of window WH.  If FLAG is non-zero, the
  7748.     cursor is enabled, if FLAG is zero, the cursor is disabled.
  7749.  
  7750.     See also: wm_chide(), wm_cursor()
  7751.  
  7752. ------------------------------------------------------------------------------
  7753. #include <sys/winmgr.h>                                                  [emx]
  7754.  
  7755. void wm_del_char (wm_handle wh, int x, int y, int count);
  7756.  
  7757.     Delete COUNT characters at position (X,Y) of window WH.
  7758.     Characters to the right of that position are moved left, the
  7759.     positions becoming vacant at the right edge of the window are
  7760.     filled with blanks using the current attributes.
  7761.  
  7762.     See also: wm_attrib(), wm_del_line(), wm_ins_char()
  7763.  
  7764. ------------------------------------------------------------------------------
  7765. #include <sys/winmgr.h>                                                  [emx]
  7766.  
  7767. void wm_del_line (wm_handle wh, int y, int count);
  7768.  
  7769.     Delete COUNT lines at line Y of window WH by moving up the
  7770.     lines below that line.  The current attributes are used for
  7771.     filling lines becoming empty at the bottom of the window.
  7772.  
  7773.     See also: wm_attrib(), wm_del_char(), wm_ins_line(), wm_scroll()
  7774.  
  7775. ------------------------------------------------------------------------------
  7776. #include <sys/winmgr.h>                                                  [emx]
  7777.  
  7778. void wm_delete (wm_handle wh);
  7779.  
  7780.     Destroy the window WH.  After calling wm_delete(), the window
  7781.     handle WH must no longer be used.  The window is not closed.
  7782.  
  7783.     See also: wm_close(), wm_create()
  7784.  
  7785. ------------------------------------------------------------------------------
  7786. #include <sys/winmgr.h>                                                  [emx]
  7787.  
  7788. void wm_dimen (wm_handle wh, int *width, int *height);
  7789.  
  7790.     Store the width of the window WH (columns) to WIDTH, the height
  7791.     (lines) to HEIGHT.
  7792.  
  7793.     See also: wm_create()
  7794.  
  7795. ------------------------------------------------------------------------------
  7796. #include <sys/winmgr.h>                                                  [emx]
  7797.  
  7798. void wm_down (wm_handle wh);
  7799.  
  7800.     Move window WH down the window stack, that is, it will be covered
  7801.     by an additional window unless WH is already the bottom window.
  7802.  
  7803.     See also: wm_bottom(), wm_top(), wm_up()
  7804.  
  7805. ------------------------------------------------------------------------------
  7806. #include <sys/winmgr.h>                                                  [emx]
  7807.  
  7808. void wm_exit (void);
  7809.  
  7810.     Quit the window manager and release all memory allocated by the
  7811.     window manager.  All window handles become invalid.  The windows
  7812.     are not closed.
  7813.  
  7814.     See also: wm_close(), wm_delete()
  7815.  
  7816. ------------------------------------------------------------------------------
  7817. #include <sys/winmgr.h>                                                  [emx]
  7818.  
  7819. wm_handle wm_find (int x, int y);
  7820.  
  7821.     Find the window which is visible at position (X,Y) of the screen.
  7822.     The window handle is returned if such a window exists.  Otherwise,
  7823.     NULL is returned.
  7824.  
  7825. ------------------------------------------------------------------------------
  7826. #include <sys/winmgr.h>                                                  [emx]
  7827.  
  7828. int wm_get_attrib (wm_handle wh);
  7829.  
  7830.     Return the current attributes of window WH.
  7831.  
  7832.     See also: wm_attrib()
  7833.  
  7834. ------------------------------------------------------------------------------
  7835. #include <sys/winmgr.h>                                                  [emx]
  7836.  
  7837. wm_handle wm_get_cursor (void);
  7838.  
  7839.     Get the window to which the screen cursor is connected.  The
  7840.     window handle is returned.  If the cursor is not connected to any
  7841.     window, NULL is returned.
  7842.  
  7843.     See also: wm_cursor()
  7844.  
  7845. ------------------------------------------------------------------------------
  7846. #include <sys/winmgr.h>                                                  [emx]
  7847.  
  7848. void wm_get_pos (wm_handle wh, int *x, int *y);
  7849.  
  7850.     Store the screen coordinates of the upper left character of the
  7851.     interior of window WH to X and Y.
  7852.  
  7853.     See also: wm_create(), wm_move()
  7854.  
  7855. ------------------------------------------------------------------------------
  7856. #include <sys/winmgr.h>                                                  [emx]
  7857.  
  7858. void wm_getxy (wm_handle wh, int *x, int *y);
  7859. int wm_getx (wm_handle wh);
  7860. int wm_gety (wm_handle wh);
  7861.  
  7862.     wm_getxy() stores the cursor coordinates of window WH to X and Y.
  7863.     wm_getx() returns the horizontal position (column) of the cursor
  7864.     of window WH.  wm_gety() returns the vertical position (line) of
  7865.     the cursor of window WH.  The coordinates are zero-based and are
  7866.     relative to the upper left character of the interior of window WH.
  7867.  
  7868.     See also: wm_gotoxy()
  7869.  
  7870. ------------------------------------------------------------------------------
  7871. #include <sys/winmgr.h>                                                  [emx]
  7872.  
  7873. void wm_gotoxy (wm_handle wh, int x, int y);
  7874.  
  7875.     Move the cursor of window WH to (X,Y).  The coordinates are
  7876.     zero-based and are relative to the upper left character of the
  7877.     interior of window WH.  If the screen cursor is connected to the
  7878.     cursor of window WH, the screen cursor is moved.
  7879.  
  7880.     See also: wm_cursor(), wm_getxy()
  7881.  
  7882. ------------------------------------------------------------------------------
  7883. #include <sys/winmgr.h>                                                  [emx]
  7884.  
  7885. void wm_ins_char (wm_handle wh, int x, int y, int count);
  7886.  
  7887.     Insert COUNT blank characters at position (X,Y) of window WH.
  7888.     Characters to the right of that position are moved right.  The
  7889.     current attributes are used for displaying the blank characters.
  7890.  
  7891.     See also: wm_attrib(), wm_del_char(), wm_ins_line()
  7892.  
  7893. ------------------------------------------------------------------------------
  7894. #include <sys/winmgr.h>                                                  [emx]
  7895.  
  7896. void wm_ins_line (wm_handle wh, int y, int count);
  7897.  
  7898.     Insert COUNT empty lines at line Y of window WH by moving down
  7899.     that line and all lines below that line.  The current attributes
  7900.     are used for filling the empty lines.
  7901.  
  7902.     See also: wm_attrib(), wm_del_line(), wm_scroll()
  7903.  
  7904. ------------------------------------------------------------------------------
  7905. #include <sys/winmgr.h>                                                  [emx]
  7906.  
  7907. int wm_init (int n);
  7908.  
  7909.     Initialize the window manager and allocate memory for N windows.
  7910.     You must call this function before calling any other window
  7911.     manager function.
  7912.  
  7913.     General information about window manager functions: The window
  7914.     manager functions implement text-mode output to windows on the
  7915.     screen.  You have to link with libvideo (use the -lvideo option).
  7916.     Under DOS, emx option -acm is required, see `Using emx options'.
  7917.  
  7918.     Example: /emx/test/wm_demo.c, /emx/test/wm_hello.c
  7919.  
  7920.     See also: wm_exit()
  7921.  
  7922. ------------------------------------------------------------------------------
  7923. #include <sys/winmgr.h>                                                  [emx]
  7924.  
  7925. void wm_move (wm_handle wh, int x, int y);
  7926.  
  7927.     Move the window WH.  The upper left character of the interior of
  7928.     the window will be at screen coordinates (X,Y).
  7929.  
  7930.     See also: wm_get_pos()
  7931.  
  7932. ------------------------------------------------------------------------------
  7933. #include <sys/winmgr.h>                                                  [emx]
  7934.  
  7935. void wm_open (wm_handle wh);
  7936.  
  7937.     Open the window WH.  The window will be showed on the screen
  7938.     unless it is covered by other windows or outside the screen.
  7939.  
  7940.     See also: wm_close()
  7941.  
  7942. ------------------------------------------------------------------------------
  7943. #include <sys/winmgr.h>                                                  [emx]
  7944.  
  7945. int wm_printf (wm_handle wh, const char *fmt, ...);
  7946.  
  7947.     Formatted output to window WH at the current cursor position of
  7948.     that window.  The cursor is moved.  See printf() for details on
  7949.     FMT.  The number of output characters is returned.
  7950.  
  7951.     See also: wm_attrib(), wm_putc(), wm_puts()
  7952.  
  7953. ------------------------------------------------------------------------------
  7954. #include <sys/winmgr.h>                                                  [emx]
  7955.  
  7956. void wm_puta_at (wm_handle wh, int x, int y, int a, int count);
  7957.  
  7958.     Change to A the attributes of COUNT characters at position (X,Y)
  7959.     of window WH.  All COUNT characters must be in one line of the
  7960.     window.
  7961.  
  7962.     See also: wm_attrib(), wm_putsa_at()
  7963.  
  7964. ------------------------------------------------------------------------------
  7965. #include <sys/winmgr.h>                                                  [emx]
  7966.  
  7967. void wm_putc (wm_handle wh, char c);
  7968.  
  7969.     Display character C in window WH at the current cursor position of
  7970.     that window, using the current attributes of that window.  The
  7971.     cursor of that window is moved.  If the cursor leaves the window
  7972.     at the right edge, it will be moved to the start of the next line.
  7973.     If C is '\n', the cursor is moved to the start of the next line.
  7974.     If the cursor leaves the window at the bottom edge, the window is
  7975.     scrolled up.
  7976.  
  7977.     See also: wm_attrib(), wm_putc_at(), wm_putca(), wm_scroll(), wm_wrap()
  7978.  
  7979. ------------------------------------------------------------------------------
  7980. #include <sys/winmgr.h>                                                  [emx]
  7981.  
  7982. void wm_putc_at (wm_handle wh, int x, int y, char c);
  7983.  
  7984.     Display character C at position (X,Y) of window WH using the
  7985.     current attributes of that window.  The cursor is not moved.
  7986.  
  7987.     See also: wm_attrib(), wm_gotoxy()
  7988.  
  7989. ------------------------------------------------------------------------------
  7990. #include <sys/winmgr.h>                                                  [emx]
  7991.  
  7992. void wm_putca (wm_handle wh, char c, int a);
  7993.  
  7994.     Display character C in window WH at the current cursor position of
  7995.     that window, using the attributes A.  The cursor of that window is
  7996.     moved.  If the cursor leaves the window at the right edge, it will
  7997.     be moved to the start of the next line.  If C is '\n', the cursor
  7998.     is moved to the start of the next line.  If the cursor leaves the
  7999.     window at the bottom edge, the window is scrolled up.
  8000.  
  8001.     See also: wm_putc(), wm_putca_at(), wm_scroll(), wm_wrap()
  8002.  
  8003. ------------------------------------------------------------------------------
  8004. #include <sys/winmgr.h>                                                  [emx]
  8005.  
  8006. void wm_putca_at (wm_handle wh, int x, int y, char c, int a);
  8007.  
  8008.     Display character C at position (X,Y) of window WH using the
  8009.     attributes A.  The cursor is not moved.
  8010.  
  8011. ------------------------------------------------------------------------------
  8012. #include <sys/winmgr.h>                                                  [emx]
  8013.  
  8014. void wm_puts (wm_handle wh, const char *str);
  8015.  
  8016.     Display string STR in window WH at the current cursor position of
  8017.     that window using the current attributes of that window.  The '\n'
  8018.     character moves the cursor to the start of the next line.
  8019.     Scrolling is performed when the cursor leaves the window at the
  8020.     bottom edge.
  8021.  
  8022.     See also: wm_attrib(), wm_putc(), wm_putsa(), wm_scroll(), wm_wrap()
  8023.  
  8024. ------------------------------------------------------------------------------
  8025. #include <sys/winmgr.h>                                                  [emx]
  8026.  
  8027. void wm_puts_at (wm_handle wh, int x, int y, const char *str);
  8028.  
  8029.     Display string STR in window WH at position (X,Y) using the
  8030.     current attributes of that window.  The '\n' character is not
  8031.     interpreted, the cursor is not moved.
  8032.  
  8033.     See also: wm_attrib(), wm_puts()
  8034.  
  8035. ------------------------------------------------------------------------------
  8036. #include <sys/winmgr.h>                                                  [emx]
  8037.  
  8038. void wm_putsa (wm_handle wh, const char *str, int a);
  8039.  
  8040.     Display string STR in window WH at the current cursor position of
  8041.     that window using the attributes A.  The '\n' character moves the
  8042.     cursor to the start of the next line.  Scrolling is performed when
  8043.     the cursor leaves the window at the bottom edge.
  8044.  
  8045.     See also: wm_putca(), wm_puts(), wm_scroll(), wm_wrap()
  8046.  
  8047. ------------------------------------------------------------------------------
  8048. #include <sys/winmgr.h>                                                  [emx]
  8049.  
  8050. void wm_putsa_at (wm_handle wh, int x, int y, const char *str, int a);
  8051.  
  8052.     Display string STR in window WH at position (X,Y) using the
  8053.     attributes A. The '\n' character is not interpreted, the cursor is
  8054.     not moved.
  8055.  
  8056.     See also: wm_putsa()
  8057.  
  8058. ------------------------------------------------------------------------------
  8059. #include <sys/winmgr.h>                                                  [emx]
  8060.  
  8061. void wm_scroll (wm_handle wh, int count);
  8062.  
  8063.     Scroll the interior of window WH up by one line.  The bottom line
  8064.     is filled with blanks, using the current attributes.
  8065.  
  8066.     See also: wm_attrib(), wm_del_line(), wm_ins_line(), wm_putc()
  8067.  
  8068. ------------------------------------------------------------------------------
  8069. #include <sys/winmgr.h>                                                  [emx]
  8070.  
  8071. void wm_top (wm_handle wh);
  8072.  
  8073.     Move window WH to the top of the window stack, that is, it will
  8074.     cover all other windows.
  8075.  
  8076.     See also: wm_bottom(), wm_down()
  8077.  
  8078. ------------------------------------------------------------------------------
  8079. #include <sys/winmgr.h>                                                  [emx]
  8080.  
  8081. void wm_up (wm_handle wh);
  8082.  
  8083.     Move window WH up the window stack, that is, it will cover an
  8084.     additional window unless WH is already the top window.
  8085.  
  8086.     See also: wm_bottom(), wm_down(), wm_top()
  8087.  
  8088. ------------------------------------------------------------------------------
  8089. #include <sys/winmgr.h>                                                  [emx]
  8090.  
  8091. void wm_update (wm_handle wh, int flag);
  8092.  
  8093.     Set the update mode of window WH.  If FLAG is non-zero (which is
  8094.     the default), the screen is updated immediately if window WH is
  8095.     changed.  If FLAG is zero, changes to window WH are done in memory
  8096.     only.  This can be done to improve speed.  Each call to update()
  8097.     copies the window to the screen, regardless of the FLAG argument.
  8098.  
  8099. ------------------------------------------------------------------------------
  8100. #include <sys/winmgr.h>                                                  [emx]
  8101.  
  8102. int wm_vprintf (wm_handle wh, const char *fmt, va_list arg_ptr);
  8103.  
  8104.     Formatted output to window WH.  Instead of a list of arguments,
  8105.     this function takes a pointer to the list of arguments.  See
  8106.     wm_printf() for details.
  8107.  
  8108.     See also: wm_printf(), va_arg()
  8109.  
  8110. ------------------------------------------------------------------------------
  8111. #include <sys/winmgr.h>                                                  [emx]
  8112.  
  8113. void wm_wrap (wm_handle wh, int wrap_flag);
  8114.  
  8115.     Set the end-of-line wrap mode of window WH.  If FLAG is non-zero
  8116.     (which is the default), the cursor is moved to the next line if it
  8117.     reaches the end of a line.  If FLAG is zero, the cursor stays at
  8118.     the end of the line.  wm_wrap() applies to wm_putc(), wm_puts(),
  8119.     wm_printf(), etc.
  8120.  
  8121.     See also: wm_putc()
  8122.  
  8123. ------------------------------------------------------------------------------
  8124. #include <io.h>                                                         [UNIX]
  8125.  
  8126. int write (int handle, const void *buf, size_t nbyte);
  8127.  
  8128.     Write NBYTE characters from the buffer BUF to the file HANDLE.
  8129.     The number of characters written is returned.  If there is an
  8130.     error, -1 is returned.  Writing 0 characters is allowed -- the
  8131.     request will be ignored.  In text mode, LF characters are
  8132.     translated to CR/LF pairs.  This translation does not affect the
  8133.     return value.
  8134.  
  8135.     See also: open(), setmode(), read()
  8136.  
  8137. ------------------------------------------------------------------------------
  8138.  
  8139.  
  8140. 5.4 Library reference: variables
  8141. --------------------------------
  8142.  
  8143. The variables are listed almost alphabetically.
  8144.  
  8145. ------------------------------------------------------------------------------
  8146. #include <time.h>
  8147.  
  8148. int daylight;
  8149.  
  8150.     Not implemented, always zero.
  8151.  
  8152.     See also: timezone, tzname, tzset()
  8153.  
  8154. ------------------------------------------------------------------------------
  8155. #include <stdlib.h>                                                      [emx]
  8156.  
  8157. const unsigned int _emx_env;
  8158.  
  8159.     This variable contains bits describing the environment your
  8160.     program is running in:
  8161.  
  8162.         0x0001    Running under VCPI
  8163.         0x0002    Running under XMS
  8164.         0x0004    VDISK 3.3 detected
  8165.         0x0008    Running under DESQview
  8166.         0x0010    287 coprocessor present
  8167.         0x0020    387 coprocessor present
  8168.         0x0200    Running under OS/2 2.0
  8169.         0x0400    File names are truncated (-t option)
  8170.         0x0800    Data and stack executable (-ac option under DOS)
  8171.  
  8172.     You should check the 0x0200 bit before calling an OS/2 API
  8173.     function.  You should check the 0x0400 bit when comparing file
  8174.     names.
  8175.  
  8176.     See also: _osmode
  8177.  
  8178. ------------------------------------------------------------------------------
  8179. #include <stdlib.h>                                                      [emx]
  8180.  
  8181. const unsigned int _emx_vcmp;
  8182.  
  8183.     This variable contains the emx version number, suitable for
  8184.     comparing.  Example:
  8185.  
  8186.         if (_emx_vcmp > 0x302e3861)             /* > 0.8a */
  8187.  
  8188.     See also: _emx_vprt
  8189.  
  8190. ------------------------------------------------------------------------------
  8191. #include <stdlib.h>                                                      [emx]
  8192.  
  8193. const char _emx_vprt[5];
  8194.  
  8195.     This variable contains the emx version number, suitable for
  8196.     printing.  Example:
  8197.  
  8198.         printf ("emx version: %s\n", _emx_vprt);
  8199.  
  8200.     See also: _emx_vcmp
  8201.  
  8202. ------------------------------------------------------------------------------
  8203. #include <stdlib.h>
  8204.  
  8205. char **environ;
  8206.  
  8207.     A pointer to the current environment of the process.  After
  8208.     changing the environment with putenv(), you should use this
  8209.     variable instead of the ENVP parameter of main().
  8210.  
  8211.     See also: main(), putenv()
  8212.  
  8213. ------------------------------------------------------------------------------
  8214. #include <stdlib.h> /* use this */                                      [ANSI]
  8215. #include <errno.h>  /* or this */
  8216.  
  8217. int errno;
  8218.  
  8219.     When a library function call fails, errno is usually set to a
  8220.     value indicating the type of error.  On success, errno is not
  8221.     changed.  The following errno values are supported:
  8222.  
  8223.       EPERM             1     Operation not permitted
  8224.       ENOENT            2     No such file or directory
  8225.       ESRCH             3     No such process
  8226.       EINTR             4     Interrupted system call
  8227.       EIO               5     I/O error
  8228.       E2BIG             7     Arguments or environment too big
  8229.       ENOEXEC           8     Invalid executable file format
  8230.       EBADF             9     Bad file number
  8231.       ECHILD            10    No child processes
  8232.       EAGAIN            11    No more processes
  8233.       ENOMEM            12    Not enough memory
  8234.       EACCES            13    Permission denied
  8235.       EEXIST            17    File exists
  8236.       EXDEV             18    Cross-device link
  8237.       ENOTDIR           20    Not a directory
  8238.       EISDIR            21    Is a directory
  8239.       EINVAL            22    Invalid argument
  8240.       EMFILE            24    Too many open files
  8241.       ENOSPC            28    Disk full
  8242.       ESPIPE            29    Illegal seek
  8243.       EROFS             30    Read-only file system
  8244.       EPIPE             32    Broken pipe
  8245.       EDOM              33    Domain error
  8246.       ERANGE            34    Result too large
  8247.       EMSDOS            37    Not supported under MS-DOS
  8248.       ENAMETOOLONG      38    File name too long
  8249.  
  8250.     When creating a multi-threaded program (-Zmt), errno is not a
  8251.     global variable; it's an lvalue that depends on the thread number.
  8252.     Threads started with _beginthread() have independent errno values.
  8253.     Threads started with DosCreateThread must not use errno or library
  8254.     functions which use errno.
  8255.  
  8256.     See also: _beginthread(), perror(), strerror(), sys_errlist
  8257.  
  8258. ------------------------------------------------------------------------------
  8259. #include <graph.h>                                                       [emx]
  8260.  
  8261. int g_xsize;
  8262. int g_ysize;
  8263. int g_colors;
  8264.  
  8265.     These variables describe the graphics mode selected by g_mode() or
  8266.     g_modeset().  g_xsize is the horizontal resolution (width),
  8267.     g_ysize is the vertical resolution (height), g_colors is the
  8268.     number of distinct colors that can be displayed at a time.
  8269.  
  8270.     See also: g_mode(), g_modeset()
  8271.  
  8272. ------------------------------------------------------------------------------
  8273. #include <stdlib.h>                                                       [PC]
  8274.  
  8275. const unsigned char _osminor;
  8276. const unsigned char _osmajor;
  8277.  
  8278.     These variables contain the minor and major version numbers of the
  8279.     operating system.  For DOS 3.30, _osmajor is 3 and _osminor is 30.
  8280.     For OS/2 2.0, _osmajor is 20, _osminor is 0.  Example:
  8281.  
  8282.         printf ("OS version: %d.%d\n", _osmajor, _osminor);
  8283.  
  8284.     See also: _emx_env, _osmode
  8285.  
  8286. ------------------------------------------------------------------------------
  8287. #include <stdlib.h>                                                       [PC]
  8288.  
  8289. const unsigned char _osmode;
  8290.  
  8291.     This variable contains DOS_MODE if your program is running under
  8292.     DOS or OS2_MODE if your program is running under OS/2.
  8293.  
  8294.     See also: _emx_env
  8295.  
  8296. ------------------------------------------------------------------------------
  8297. #include <stdlib.h>
  8298.  
  8299. const char * const sys_errlist[];
  8300. const int sys_nerr;
  8301.  
  8302.     sys_errlist is an array of error messages indexed by errno values.
  8303.     sys_nerr is the number of elements in the sys_errlist array.
  8304.  
  8305.     See also: errno, perror(), strerror()
  8306.  
  8307. ------------------------------------------------------------------------------
  8308. #include <time.h>
  8309.  
  8310. long timezone;
  8311.  
  8312.     Seconds west of Greenwich.  This variable is set by tzset().
  8313.  
  8314.     See also: daylight, tzname, tzset()
  8315.  
  8316. ------------------------------------------------------------------------------
  8317. #include <time.h>
  8318.  
  8319. char *tzname[2];
  8320.  
  8321.     The first pointer points to the name of the current timezone.  The
  8322.     second pointer points to the day-light-saving timezone name (not
  8323.     implemented).  This variable is set by tzset().
  8324.  
  8325.     See also: daylight, timezone, tzset()
  8326.  
  8327. ------------------------------------------------------------------------------
  8328.  
  8329.  
  8330. 5.5 termio
  8331. ----------
  8332.  
  8333. #include <io.h>
  8334. #include <sys/termio.h>
  8335. #include <sys/kbdscan.h>  /* optional, for extended scan codes */
  8336.  
  8337. int ioctl (int handle, int request, struct termio *buffer);
  8338.  
  8339.     Get or set parameters for the keyboard.  The parameters are used
  8340.     only for read() and functions which call read().  HANDLE must be
  8341.     the stdin handle (0) and must be connected to the keyboard.
  8342.     REQUEST is TCGETA to get the parameters, TCSETA to set the
  8343.     parameters.  TCSETAW waits for the output buffer to be empty, then
  8344.     sets the parameters (emx treats TCSETAW exactly like TCSETA).
  8345.     TCSETAF waits for the output buffer to be empty, then flushes the
  8346.     input buffer, then sets the parameters.  BUFFER points to the
  8347.     following structure:
  8348.  
  8349.         struct termio
  8350.         {
  8351.           unsigned int  c_iflag;      /* input modes */
  8352.           unsigned int  c_oflag;      /* output modes */
  8353.           unsigned int  c_cflag;      /* control modes */
  8354.           unsigned int  c_lflag;      /* local modes */
  8355.           unsigned int  c_line;       /* unused */
  8356.           unsigned char c_cc[NCC];    /* control characters etc. */
  8357.         };
  8358.  
  8359.     If c_lflag includes IDEFAULT, the default operating system input
  8360.     method is used (including command line editing).  Input is always
  8361.     done line by line.  All other fields of the termio structure are
  8362.     ignored.
  8363.  
  8364.     If c_lflag does not include IDEFAULT, UNIX-like input processing
  8365.     is performed; the following bits of c_iflag are used by emx in the
  8366.     following sequence:
  8367.  
  8368.         IDELETE     Backspace key generates DEL character (emx extension)
  8369.         ISTRIP      Clear bit 7 of all input characters
  8370.         INLCR       Translate linefeed into carriage return
  8371.         IGNCR       Ignore carriage return
  8372.         ICRNL       Translate carriage return into linefeed
  8373.         IUCLC       Convert upper case letters (A-Z) into lower case (a-z)
  8374.  
  8375.     If IDELETE is set, the two meanings of the backspace key (the one
  8376.     above the Return key) are swapped: Backspace generates DEL and
  8377.     Ctrl-Backspace generates Ctrl-H.  If IDELETE is not set, Backspace
  8378.     generates Ctrl-H and Ctrl-Backspace generates DEL.  The IDELETE
  8379.     bit applies only to the backspace key and does not affect other
  8380.     methods of entering Ctrl-H or DEL.
  8381.  
  8382.     All bits of c_oflag and c_cflag are ignored.
  8383.  
  8384.     The following bits of c_lflag are used by emx:
  8385.  
  8386.         IDEFAULT    Enable termio (emx extension)
  8387.         ISIG        Enable signal processing (see VINTR and VQUIT)
  8388.         ICANON      Read input line by line, enable line editing
  8389.         ECHO        Echo input
  8390.         ECHOK       Echo CR/LF after VKILL
  8391.  
  8392.     The c_cc array contains control characters.  If an element of c_cc
  8393.     is set to zero, no character will trigger the action associated
  8394.     with that element.
  8395.  
  8396.         VINTR       Raise SIGINT if ISIG is set in c_iflag
  8397.         VQUIT       Raise SIGQUIT if ISIG is set in c_iflag
  8398.  
  8399.     The following characters are used if ICANON is set:
  8400.  
  8401.         VERASE      Delete one character to the left (default: Ctrl-H)
  8402.         VKILL       Deletes the entire input line (default: Ctrl-U)
  8403.         VEOF        Indicates EOF (default: Ctrl-D)
  8404.         VEOL        Indicates end of line (default: none)
  8405.  
  8406.     The VERASE, VKILL and VEOF characters can be escaped by preceding
  8407.     them with a backslash.  EOF at the beginning of a line is usually
  8408.     interpreted as end of input.
  8409.  
  8410.     The following elements are used if ICANON is not set:
  8411.  
  8412.         VMIN        Minimum number of characters to be read (default: 6)
  8413.         VTIME       Time-Out in 0.1 seconds (default: 1)
  8414.  
  8415.     Note that VMIN and VTIME are not equal to VEOF and VEOL,
  8416.     respectively.  Unix uses the VEOF field for both VEOF and VMIN,
  8417.     the VEOL field for both VEOL and VTIME.  emx uses separate fields
  8418.     for the four values.
  8419.  
  8420.     There are four cases for VMIN and VTIME (that is,
  8421.     BUFFER->c_cc[VMIN] and BUFFER->c_cc[VTIME]):
  8422.  
  8423.         VMIN = 0, VTIME = 0
  8424.  
  8425.             Return all the characters stored in the input buffer.  If
  8426.             there are no characters in the buffer, read() returns
  8427.             immediately.  read() doesn't wait for input.
  8428.  
  8429.         VMIN = 0, VTIME > 0
  8430.  
  8431.             Return after at least one character has been received or
  8432.             after waiting for VTIME * 0.1 seconds, whichever happens
  8433.             first.  In the latter case, read() will return 0.
  8434.  
  8435.         VMIN > 0, VTIME = 0
  8436.  
  8437.             Return after at least VMIN characters have been received.
  8438.  
  8439.         VMIN > 0, VTIME > 0
  8440.  
  8441.             Return after at least VMIN characters have been received
  8442.             or if no characters have been received for VMIN * 0.1
  8443.             seconds after receipt of a character (the time-out applies
  8444.             after at least one character has been received and is
  8445.             reset after each character).
  8446.  
  8447.     In all cases, read() will return as many characters as are
  8448.     available in the input buffer, up to the number of characters
  8449.     requested in the read() call.
  8450.  
  8451.     If O_NDELAY has been set for HANDLE with fcntl(), read() will
  8452.     always immediately return.  If there is not enough data available
  8453.     with respect to VMIN, read() will immediately return -1 and set
  8454.     errno to EAGAIN.
  8455.  
  8456.     If IDEFAULT is not set, the text/binary mode of the handle is
  8457.     ignored: the conversions are set by ioctl() including CR-to-LF
  8458.     conversion and EOF character.
  8459.  
  8460.     If ICANON is not set, function keys are returned as two
  8461.     characters.  The first one is a null ('\0') character, the second
  8462.     one is the scan code.  See /emx/include/sys/kbdscan.h for scan
  8463.     codes.
  8464.  
  8465.     When using the system call library libsys.lib (-Zsys), termio is
  8466.     not supported.
  8467.  
  8468.  
  8469. 5.6 System calls
  8470. ----------------
  8471.  
  8472. [To be written.]
  8473.  
  8474. All system calls are declared in sys/emx.h.  Interface routines are in
  8475. the libemx1.a and libemx1.lib libraries.  System call emulation
  8476. routines are in the libsys.lib library.  Please do not use system
  8477. calls from application programs -- always use C library functions.  If
  8478. you need a system call, put a function into the library which issues
  8479. the system call.
  8480.  
  8481. Do not use INT 21H: the function numbers and the parameter passing
  8482. conventions are subject to change.  Similarities to DOS function
  8483. numbers are just coincidence and will probably disappear.  Moreover,
  8484. INT 21H cannot be used under OS/2.  The goal is to have Unix-like
  8485. system calls.
  8486.  
  8487.  
  8488. 6 Hints for porting Unix programs to emx
  8489. ========================================
  8490.  
  8491. - If you want Unix-like wildcard expansion built into the program, use
  8492.  
  8493.         int main (int argc, char *argv[])
  8494.         {
  8495.           _wildcard (&argc, &argv);
  8496.           /* ... the program ... */
  8497.         }
  8498.  
  8499.   This should be done at the very beginning of main(), before argc and
  8500.   argv are used.
  8501.  
  8502. - Change all open(), fopen(), fdopen() and freopen() calls to use
  8503.   O_BINARY or "b", respectively, for binary files.  If a file contains
  8504.   both binary and textual data, read the file in binary mode and do
  8505.   the conversion yourself.  This is also required if fseek() is used
  8506.   on the file (see GDB), due to library restrictions.
  8507.  
  8508. - Replace fork() and exec() with spawn().
  8509.  
  8510. - Replace exec() with spawn() and exit() if the parent process waits
  8511.   for the termination of the new process (wait(), SIGCLD).
  8512.  
  8513. - Programs reading a.out files should be changed to call _seek_hdr()
  8514.   or _fseek_hdr() before reading the header to support .exe files.
  8515.   More changes are usually required.
  8516.  
  8517. - Watch out for Unix file system hacks: Unix allows deleting and
  8518.   renaming an open file (the file will be deleted after being closed).
  8519.  
  8520. - Watch out for Unix file names (Unix is case sensitive, long file
  8521.   names and multiple dots are allowed).
  8522.  
  8523. - The null device is called /dev/null under Unix.  Use nul, /dev/nul
  8524.   or \dev\nul instead.
  8525.  
  8526. - Programs using stdin, stdout or stderr for binary data should call
  8527.   _fsetmode().
  8528.  
  8529. - If you want to use \ for separating directories, changes may be
  8530.   necessary.  These changes are optional because / also works.
  8531.  
  8532. - Implement support for drive names.  This can be done by using
  8533.  
  8534.       #define getcwd _getcwd2
  8535.       #define chdir _chdir2
  8536.  
  8537.   In addition, some changes will be necessary.  For instance, you have
  8538.   to change code which checks whether a file name is an absolute path
  8539.   name.  _fullpath() and _abspath() can also be useful.
  8540.  
  8541. - Note that ///abc is a valid Unix file name.  It's equivalent to
  8542.   /abc.
  8543.  
  8544. - Use `termio' or read the keyboard with _read_kbd() if you don't want
  8545.   to get input line by line.
  8546.  
  8547. - Under Unix, directories in environment variables (PATH, for
  8548.   instance) are separated by colons; use semicolons instead.
  8549.  
  8550. - Do not use ptrace(PTRACE_TRACEME): use P_DEBUG instead when starting
  8551.   the process with spawn().
  8552.  
  8553. - Signal handling is different: SIG_ACK should be used instead of the
  8554.   signal handler address to re-enable a signal when the signal handler
  8555.   has been called.
  8556.  
  8557. - The shell isn't called /bin/sh.  Use system().  system() doesn't
  8558.   expand wildcards.
  8559.  
  8560. - Outputting single characters is inefficient.  A solution is to use
  8561.  
  8562.       setvbuf (stdout, NULL, _IOLBF, BUFSIZ)
  8563.  
  8564.   and to use fflush (stdout) if you need the output immediately
  8565.   (flushing is required only after displaying prompting texts before
  8566.   reading input or displaying progress reports that don't end with a
  8567.   newline character).  GDB output has been made much faster by using
  8568.   line buffering.
  8569.  
  8570. - Note that VEOF != VMIN and VEOL != VTIME.  Programs which use VEOF
  8571.   and VEOL to access VMIN and VTIME, respectively, should be changed
  8572.   to use VMIN and VTIME.  emx uses separate fields for VEOF, VEOL,
  8573.   VMIN and VTIME.
  8574.  
  8575. - To use `termio', you have to reset the IDEFAULT bit of c_lflag.
  8576.  
  8577.  
  8578. 7 Creating OS/2 programs
  8579. ========================
  8580.  
  8581. 7.1 Calling OS/2 API functions
  8582. ------------------------------
  8583.  
  8584. Use
  8585.  
  8586.     #include <os2.h>
  8587.  
  8588. in your C files to call OS/2 API functions.  GCC automatically links
  8589. your program with libos2.a (or libos2.lib) by passing the -los2 option
  8590. to the linker.  If you call the linker manually, you have to tell the
  8591. linker to link with libos2.  Note that your program will crash if it
  8592. calls an OS/2 API function when run under DOS.
  8593.  
  8594. You can use either the header file that comes with emx (os2emx.h) or
  8595. the header files that come with the Developer's Toolkit for OS/2 2.0
  8596. (an IBM product).  By default, os2emx.h is used when #including os2.h.
  8597. To use the header files of the Developer's Toolkit for OS/2 2.0, edit
  8598. /emx/include/os2.h to #include os2tk.h instead of os2emx.h, and add
  8599. the toolkit include file directory to the C_INCLUDE_PATH,
  8600. CPLUS_INCLUDE_PATH and OBJC_INCLUDE_PATH environment variables.
  8601.  
  8602. Note that you should define INCL_WHATEVER constants when using
  8603. os2emx.h as you would with the IBM Developer's Toolkit for OS/2 2.0 --
  8604. though not all constants are tested by the current version of
  8605. os2emx.h.
  8606.  
  8607. os2emx.h contains definitions of the following OS/2 API functions:
  8608.  
  8609. Device I/O
  8610. ----------
  8611.  
  8612.     DosDevConfig                        DosPhysicalDisk
  8613.     DosDevIOCtl
  8614.  
  8615. Dynamic linking
  8616. ---------------
  8617.  
  8618.     DosFreeModule                       DosQueryModuleName
  8619.     DosLoadModule                       DosQueryProcAddr
  8620.     DosQueryModuleHandle                DosQueryProcType
  8621.  
  8622. Errors
  8623. ------
  8624.  
  8625.     DosErrClass                         DosError
  8626.  
  8627. Exceptions
  8628. ----------
  8629.  
  8630.     DosAcknowledgeSignalException       DosSetExceptionHandler
  8631.     DosEnterMustComplete                DosSetSignalExceptionFocus
  8632.     DosExitMustComplete                 DosUnsetExceptionHandler
  8633.     DosRaiseException                   DosUnwindException
  8634.     DosSendSignalException
  8635.  
  8636. File system
  8637. -----------
  8638.  
  8639.     DosCancelLockRequest                DosQueryFSAttach
  8640.     DosClose                            DosQueryFSInfo
  8641.     DosCopy                             DosQueryHType
  8642.     DosCreateDir                        DosQueryPathInfo
  8643.     DosCreatePipe                       DosQueryVerify
  8644.     DosDelete                           DosRead
  8645.     DosDeleteDir                        DosSetCurrentDir
  8646.     DosDupHandle                        DosSetDefaultDisk
  8647.     DosEditName                         DosSetFHState
  8648.     DosEnumAttribute                    DosSetFileInfo
  8649.     DosFindClose                        DosSetFileLocks
  8650.     DosFindFirst                        DosSetFilePtr
  8651.     DosFindNext                         DosSetFileSize
  8652.     DosForceDelete                      DosSetFSInfo
  8653.     DosFSAttach                         DosSetMaxFH
  8654.     DosFSCtl                            DosSetPathInfo
  8655.     DosMove                             DosSetRelMaxFH
  8656.     DosOpen                             DosSetVerify
  8657.     DosQueryCurrentDir                  DosShutdown
  8658.     DosQueryCurrentDisk                 DosResetBuffer
  8659.     DosQueryFHState                     DosWrite
  8660.     DosQueryFileInfo
  8661.  
  8662. Help Manager
  8663. ------------
  8664.  
  8665.     DdfBeginList                        DdfSetFontStyle
  8666.     DdfBitmap                           DdfSetFormat
  8667.     DdfEndList                          DdfSetTextAlign
  8668.     DdfHyperText                        DdfText
  8669.     DdfInform                           WinAssociateHelpInstance
  8670.     DdfInitialize                       WinCreateHelpInstance
  8671.     DdfListItem                         WinCreateHelpTable
  8672.     DdfMetafile                         WinDestroyHelpInstance
  8673.     DdfPara                             WinLoadHelpTable
  8674.     DdfSetColor                         WinQueryHelpInstance
  8675.     DdfSetFont
  8676.  
  8677. Memory management
  8678. -----------------
  8679.  
  8680.     DosAllocMem                         DosQueryMem
  8681.     DosAllocSharedMem                   DosSetMem
  8682.     DosFreeMem                          DosSubAllocMem
  8683.     DosGetNamedSharedMem                DosSubFreeMem
  8684.     DosGetSharedMem                     DosSubSetMem
  8685.     DosGiveSharedMem                    DosSubUnsetMem
  8686.  
  8687. Messages
  8688. --------
  8689.  
  8690.     DosGetMessage                       DosPutMessage
  8691.     DosInsertMessage                    DosQueryMessageCP
  8692.  
  8693. Miscellanea
  8694. -----------
  8695.  
  8696.     DosQuerySysInfo                     DosSearchPath
  8697.     DosScanEnv
  8698.  
  8699. Named pipes
  8700. -----------
  8701.  
  8702.     DosCallNPipe                        DosQueryNPipeInfo
  8703.     DosConnectNPipe                     DosQueryNPipeSemState
  8704.     DosCreateNPipe                      DosSetNPHState
  8705.     DosDisConnectNPipe                  DosSetNPipeSem
  8706.     DosPeekNPipe                        DosTransactNPipe
  8707.     DosQueryNPHState                    DosWaitNPipe
  8708.  
  8709. National language support
  8710. -------------------------
  8711.  
  8712.     DosMapCase                          DosQueryCtryInfo
  8713.     DosQueryCollate                     DosQueryDBCSEnv
  8714.     DosQueryCp                          DosSetProcessCp
  8715.  
  8716. Queues
  8717. ------
  8718.  
  8719.     DosCloseQueue                       DosPurgeQueue
  8720.     DosCreateQueue                      DosQueryQueue
  8721.     DosOpenQueue                        DosReadQueue
  8722.     DosPeekQueue                        DosWriteQueue
  8723.  
  8724. Resources
  8725. ---------
  8726.  
  8727.     DosFreeResource                     DosQueryResourceSize
  8728.     DosGetResource
  8729.  
  8730. Semaphores
  8731. ----------
  8732.  
  8733.     DosAddMuxWaitSem                    DosOpenMuxWaitSem
  8734.     DosCloseEventSem                    DosPostEventSem
  8735.     DosCloseMutexSem                    DosQueryEventSem
  8736.     DosCloseMuxWaitSem                  DosQueryMutexSem
  8737.     DosCreateEventSem                   DosQueryMuxWaitSem
  8738.     DosCreateMutexSem                   DosReleaseMutexSem
  8739.     DosCreateMuxWaitSem                 DosRequestMutexSem
  8740.     DosDeleteMuxWaitSem                 DosResetEventSem
  8741.     DosOpenEventSem                     DosWaitEventSem
  8742.     DosOpenMutexSem                     DosWaitMuxWaitSem
  8743.  
  8744. Sessions
  8745. --------
  8746.  
  8747.     DosQueryAppType                     DosStartSession
  8748.     DosSelectSession                    DosStopSession
  8749.     DosSetSession
  8750.  
  8751. Tasking
  8752. -------
  8753.  
  8754.     DosBeep                             DosKillProcess
  8755.     DosCreateThread                     DosKillThread
  8756.     DosDebug                            DosResumeThread
  8757.     DosEnterCritSect                    DosSetPriority
  8758.     DosExecPgm                          DosSleep
  8759.     DosExit                             DosSuspendThread
  8760.     DosExitCritSect                     DosWaitChild
  8761.     DosExitList                         DosWaitThread
  8762.     DosGetInfoBlocks
  8763.  
  8764. Timers
  8765. ------
  8766.  
  8767.     DosAsyncTimer                       DosStopTimer
  8768.     DosGetDateTime                      DosTmrQueryFreq
  8769.     DosStartTimer                       DosTmrQueryTime
  8770.  
  8771. Virtual DOS machines
  8772. --------------------
  8773.  
  8774.     DosCloseVDD                         DosRequestVDD
  8775.     DosOpenVDD                          DosSetDOSProperty
  8776.     DosQueryDOSProperty
  8777.  
  8778. Graphics Programming Interface
  8779. ------------------------------
  8780.  
  8781.     GpiAnimatePalette                   GpiQueryFaceString
  8782.     GpiAssociate                        GpiQueryFontAction
  8783.     GpiBeginArea                        GpiQueryFontFileDescriptions
  8784.     GpiBeginElement                     GpiQueryFontMetrics
  8785.     GpiBeginPath                        GpiQueryFonts
  8786.     GpiBitBlt                           GpiQueryFullFontFileDescs
  8787.     GpiBox                              GpiQueryGraphicsField
  8788.     GpiCallSegmentMatrix                GpiQueryInitialSegmentAttrs
  8789.     GpiCharString                       GpiQueryKerningPairs
  8790.     GpiCharStringAt                     GpiQueryLineEnd
  8791.     GpiCharStringPos                    GpiQueryLineJoin
  8792.     GpiCharStringPosAt                  GpiQueryLineType
  8793.     GpiCloseFigure                      GpiQueryLineWidth
  8794.     GpiCloseSegment                     GpiQueryLineWidthGeom
  8795.     GpiCombineRegion                    GpiQueryLogColorTable
  8796.     GpiComment                          GpiQueryLogicalFont
  8797.     GpiConvert                          GpiQueryMarker
  8798.     GpiConvertWithMatrix                GpiQueryMarkerBox
  8799.     GpiCopyMetaFile                     GpiQueryMarkerSet
  8800.     GpiCorrelateChain                   GpiQueryMetaFileBits
  8801.     GpiCorrelateFrom                    GpiQueryMetaFileLength
  8802.     GpiCorrelateSegment                 GpiQueryMix
  8803.     GpiCreateBitmap                     GpiQueryModelTransformMatrix
  8804.     GpiCreateLogColorTable              GpiQueryNearestColor
  8805.     GpiCreateLogFont                    GpiQueryNumberSetIds
  8806.     GpiCreatePalette                    GpiQueryPS
  8807.     GpiCreateRegion                     GpiQueryPageViewport
  8808.     GpiCreatePS                         GpiQueryPalette
  8809.     GpiDeleteBitmap                     GpiQueryPaletteInfo
  8810.     GpiDeleteElement                    GpiQueryPattern
  8811.     GpiDeleteElementrange               GpiQueryPatternRefPoint
  8812.     GpiDeleteElementsBetweenLabels      GpiQueryPatternSet
  8813.     GpiDeleteMetaFile                   GpiQueryPel
  8814.     GpiDeletePalette                    GpiQueryPickAperturePosition
  8815.     GpiDeleteSegment                    GpiQueryPickApertureSize
  8816.     GpiDeleteSegments                   GpiQueryRealColors
  8817.     GpiDeleteSetId                      GpiQueryRegionBox
  8818.     GpiDestroyPS                        GpiQueryRegionRects
  8819.     GpiDestroyRegion                    GpiQueryRGBColor
  8820.     GpiDrawBits                         GpiQuerySegmentAttrs
  8821.     GpiDrawChain                        GpiQuerySegmentNames
  8822.     GpiDrawDynamics                     GpiQuerySegmentPriority
  8823.     GpiDrawFrom                         GpiQuerySegmentTransformMatrix
  8824.     GpiDrawSegment                      GpiQuerySetIds
  8825.     GpiElement                          GpiQueryStopDraw
  8826.     GpiEndArea                          GpiQueryTag
  8827.     GpiEndElement                       GpiQueryTextAlignment
  8828.     GpiEndPath                          GpiQueryTextBox
  8829.     GpiEqualRegion                      GpiQueryViewingLimits
  8830.     GpiErase                            GpiQueryViewingTransformMatrix
  8831.     GpiErrorSegmentData                 GpiQueryWidthTable
  8832.     GpiExcludeClipRectangle             GpiRectInRegion
  8833.     GpiFillPath                         GpiRectVisible
  8834.     GpiFloodFill                        GpiRemoveDynamics
  8835.     GpiFrameRegion                      GpiResetBoundaryData
  8836.     GpiFullArc                          GpiResetPS
  8837.     GpiGetData                          GpiRestorePS
  8838.     GpiImage                            GpiRotate
  8839.     GpiIntersectClipRectangle           GpiSaveMetaFile
  8840.     GpiLabel                            GpiSavePS
  8841.     GpiLine                             GpiScale
  8842.     GpiLoadBitmap                       GpiSelectPalette
  8843.     GpiLoadFonts                        GpiSetArcParams
  8844.     GpiLoadMetaFile                     GpiSetAttrMode
  8845.     GpiLoadPublicFonts                  GpiSetAttrs
  8846.     GpiMarker                           GpiSetBackColor
  8847.     GpiModifyPath                       GpiSetBackMix
  8848.     GpiMove                             GpiSetBitmap
  8849.     GpiOffsetClipRegion                 GpiSetBitmapBits
  8850.     GpiOffsetElementPointer             GpiSetBitmapDimension
  8851.     GpiOffsetRegion                     GpiSetBitmapId
  8852.     GpiOpenSegment                      GpiSetCharAngle
  8853.     GpiOutlinePath                      GpiSetCharBox
  8854.     GpiPaintRegion                      GpiSetCharBreakExtra
  8855.     GpiPartialArc                       GpiSetCharDirection
  8856.     GpiPathToRegion                     GpiSetCharExtra
  8857.     GpiPlayMetaFile                     GpiSetCharMode
  8858.     GpiPointArc                         GpiSetCharSet
  8859.     GpiPolyFillet                       GpiSetCharShear
  8860.     GpiPolyFilletSharp                  GpiSetClipPath
  8861.     GpiPolygons                         GpiSetClipRegion
  8862.     GpiPolyLine                         GpiSetColor
  8863.     GpiPolyLineDisjoint                 GpiSetCp
  8864.     GpiPolyMarker                       GpiSetCurrentPosition
  8865.     GpiPolySpline                       GpiSetDefArcParams
  8866.     GpiPop                              GpiSetDefAttrs
  8867.     GpiPtInRegion                       GpiSetDefaultViewMatrix
  8868.     GpiPtVisible                        GpiSetDefTag
  8869.     GpiPutData                          GpiSetDefViewingLimits
  8870.     GpiQueryArcParams                   GpiSetDrawControl
  8871.     GpiQueryAttrMode                    GpiSetDrawingMode
  8872.     GpiQueryAttrs                       GpiSetEditMode
  8873.     GpiQueryBackColor                   GpiSetElementPointer
  8874.     GpiQueryBackMix                     GpiSetElementPointerAtLabel
  8875.     GpiQueryBitmapBits                  GpiSetGraphicsField
  8876.     GpiQueryBitmapDimension             GpiSetInitialSegmentAttrs
  8877.     GpiQueryBitmapHandle                GpiSetLineEnd
  8878.     GpiQueryBitmapInfoHeader            GpiSetLineJoin
  8879.     GpiQueryBitmapParameters            GpiSetLineType
  8880.     GpiQueryBoundaryData                GpiSetLineWidth
  8881.     GpiQueryCharAngle                   GpiSetLineWidthGeom
  8882.     GpiQueryCharBox                     GpiSetMarker
  8883.     GpiQueryCharBreakExtra              GpiSetMarkerBox
  8884.     GpiQueryCharDirection               GpiSetMarkerSet
  8885.     GpiQueryCharExtra                   GpiSetMetaFileBits
  8886.     GpiQueryCharMode                    GpiSetMix
  8887.     GpiQueryCharSet                     GpiSetModelTransformMatrix
  8888.     GpiQueryCharShear                   GpiSetPageViewport
  8889.     GpiQueryCharStringPos               GpiSetPaletteEntries
  8890.     GpiQueryCharStringPosAt             GpiSetPattern
  8891.     GpiQueryClipBox                     GpiSetPatternRefPoint
  8892.     GpiQueryClipRegion                  GpiSetPatternSet
  8893.     GpiQueryColor                       GpiSetPel
  8894.     GpiQueryColorData                   GpiSetPickAperturePosition
  8895.     GpiQueryColorIndex                  GpiSetPickApertureSize
  8896.     GpiQueryCp                          GpiSetPS
  8897.     GpiQueryCurrentPosition             GpiSetRegion
  8898.     GpiQueryDefArcParams                GpiSetSegmentAttrs
  8899.     GpiQueryDefAttrs                    GpiSetSegmentPriority
  8900.     GpiQueryDefCharBox                  GpiSetSegmentTransformMatrix
  8901.     GpiQueryDefTag                      GpiSetStopDraw
  8902.     GpiQueryDefViewingLimits            GpiSetTag
  8903.     GpiQueryDefaultViewMatrix           GpiSetTextAlignment
  8904.     GpiQueryDevice                      GpiSetViewingLimits
  8905.     GpiQueryDeviceBitmapFormats         GpiSetViewingTransformMatrix
  8906.     GpiQueryDrawControl                 GpiStrokePath
  8907.     GpiQueryDrawingMode                 GpiTranslate
  8908.     GpiQueryEditMode                    GpiUnloadFonts
  8909.     GpiQueryElement                     GpiUnloadPublicFonts
  8910.     GpiQueryElementPointer              GpiWCBitBlt
  8911.     GpiQueryElementType
  8912.  
  8913. Device Contexts
  8914. ---------------
  8915.  
  8916.     DevCloseDC                          DevQueryCaps
  8917.     DevEscape                           DevQueryDeviceNames
  8918.     DevOpenDC                           DevQueryHardcopyCaps
  8919.     DevPostDeviceModes
  8920.  
  8921. Presentation Manager
  8922. --------------------
  8923.  
  8924.     WinAddAtom                          WinQueryAtomName
  8925.     WinAlarm                            WinQueryAtomUsage
  8926.     WinBeginEnumWindows                 WinQueryCapture
  8927.     WinBeginPaint                       WinQueryClassInfo
  8928.     WinBroadcastMsg                     WinQueryClassName
  8929.     WinCalcFrameRect                    WinQueryClassThunkProc
  8930.     WinCallMsgFilter                    WinQueryClipbrdData
  8931.     WinCancelShutdown                   WinQueryClipbrdFmtInfo
  8932.     WinCloseClipbrd                     WinQueryClipbrdOwner
  8933.     WinCompareStrings                   WinQueryClipbrdViewer
  8934.     WinCopyAccelTable                   WinQueryCp
  8935.     WinCopyRect                         WinQueryCpList
  8936.     WinCpTranslateChar                  WinQueryCursorInfo
  8937.     WinCpTranslateString                WinQueryDesktopBkgnd
  8938.     WinCreateAccelTable                 WinQueryDesktopWindow
  8939.     WinCreateAtomTable                  WinQueryDlgItemShort
  8940.     WinCreateCursor                     WinQueryDlgItemText
  8941.     WinCreateDlg                        WinQueryDlgItemTextLength
  8942.     WinCreateFrameControls              WinQueryFocus
  8943.     WinCreateMenu                       WinQueryMsgPos
  8944.     WinCreateMsgQueue                   WinQueryMsgTime
  8945.     WinCreatePointer                    WinQueryObjectWindow
  8946.     WinCreatePointerIndirect            WinQueryPointer
  8947.     WinCreateStdWindow                  WinQueryPointerInfo
  8948.     WinCreateWindow                     WinQueryPointerPos
  8949.     WinDdeInitiate                      WinQueryPresParam
  8950.     WinDdePostMsg                       WinQueryQueueInfo
  8951.     WinDdeRespond                       WinQueryQueueStatus
  8952.     WinDefWindowProc                    WinQuerySysColor
  8953.     WinDefDlgProc                       WinQuerySysModalWindow
  8954.     WinDeleteAtom                       WinQuerySysPointer
  8955.     WinDeleteLibrary                    WinQuerySystemAtomTable
  8956.     WinDeleteProcedure                  WinQuerySysValue
  8957.     WinDestroyAccelTable                WinQueryUpdateRect
  8958.     WinDestroyAtomTable                 WinQueryUpdateRegion
  8959.     WinDestroyCursor                    WinQueryVersion
  8960.     WinDestroyMsgQueue                  WinQueryWindow
  8961.     WinDestroyPointer                   WinQueryWindowDC
  8962.     WinDestroyWindow                    WinQueryWindowModel
  8963.     WinDismissDlg                       WinQueryWindowPos
  8964.     WinDispatchMsg                      WinQueryWindowProcess
  8965.     WinDlgBox                           WinQueryWindowPtr
  8966.     WinDrawBitmap                       WinQueryWindowRect
  8967.     WinDrawBorder                       WinQueryWindowText
  8968.     WinDrawPointer                      WinQueryWindowTextLength
  8969.     WinDrawText                         WinQueryWindowThunkProc
  8970.     WinEmptyClipbrd                     WinQueryWindowULong
  8971.     WinEnablePhysInput                  WinQueryWindowUShort
  8972.     WinEnableWindow                     WinRealizePalette
  8973.     WinEnableWindowUpdate               WinRegisterClass
  8974.     WinEndEnumWindows                   WinRegisterUserDatatype
  8975.     WinEndPaint                         WinRegisterUserMsg
  8976.     WinEnumClipbrdFmts                  WinReleaseHook
  8977.     WinEnumDlgItem                      WinReleasePS
  8978.     WinEqualRect                        WinRemovePresParam
  8979.     WinExcludeUpdateRegion              WinRequestMutexSem
  8980.     WinFillRect                         WinSaveWindowPos
  8981.     WinFindAtom                         WinScrollWindow
  8982.     WinFlashWindow                      WinSendMsg
  8983.     WinFocusChange                      WinSendDlgItemMsg
  8984.     WinFreeErrorInfo                    WinSetAccelTable
  8985.     WinGetClipPS                        WinSetActiveWindow
  8986.     WinGetCurrentTime                   WinSetCapture
  8987.     WinGetDlgMsg                        WinSetClassMsgInterest
  8988.     WinGetErrorInfo                     WinSetClassThunkProc
  8989.     WinGetKeyState                      WinSetClipbrdData
  8990.     WinGetLastError                     WinSetClipbrdOwner
  8991.     WinGetMaxPosition                   WinSetClipbrdViewer
  8992.     WinGetMinPosition                   WinSetCp
  8993.     WinGetMsg                           WinSetDesktopBkgnd
  8994.     WinGetNextWindow                    WinSetDlgItemShort
  8995.     WinGetPkysKeyState                  WinSetDlgItemText
  8996.     WinGetPS                            WinSetFocus
  8997.     WinGetScreenPS                      WinSetHook
  8998.     WinGetSysBitmap                     WinSetKeyboardStateTable
  8999.     WinInflateRect                      WinSetMsgInterest
  9000.     WinInitialize                       WinSetMsgMode
  9001.     WinInSendMsg                        WinSetMultWindowPos
  9002.     WinIntersectRect                    WinSetOwner
  9003.     WinInvalidateRect                   WinSetParent
  9004.     WinInvalidateRegion                 WinSetPointer
  9005.     WinInvertRect                       WinSetPointerOwner
  9006.     WinIsChild                          WinSetPointerPos
  9007.     WinIsPhysInputEnabled               WinSetPresParam
  9008.     WinIsRectEmpty                      WinSetRect
  9009.     WinIsThreadActive                   WinSetRectEmpty
  9010.     WinIsWindow                         WinSetSynchroMode
  9011.     WinIsWindowEnabled                  WinSetSysColors
  9012.     WinIsWindowShowing                  WinSetSysModalWindow
  9013.     WinIsWindowVisible                  WinSetSysValue
  9014.     WinLoadAccelTable                   WinSetWindowBits
  9015.     WinLoadDlg                          WinSetWindowPos
  9016.     WinLoadMenu                         WinSetWindowPtr
  9017.     WinLoadLibrary                      WinSetWindowText
  9018.     WinLoadMessage                      WinSetWindowThunkProc
  9019.     WinLoadPointer                      WinSetWindowULong
  9020.     WinLoadProcedure                    WinSetWindowUShort
  9021.     WinLoadString                       WinShowCursor
  9022.     WinLockVisRegions                   WinShowPointer
  9023.     WinLockWindowUpdate                 WinShowTrackRect
  9024.     WinMakePoints                       WinShowWindow
  9025.     WinMakeRect                         WinStartTimer
  9026.     WinMapDlgPoints                     WinStopTimer
  9027.     WinMapWindowPoints                  WinSubclassWindow
  9028.     WinMessageBox                       WinSubstituteStrings
  9029.     WinMultWindowsFromIDs               WinSubtractRect
  9030.     WinNextChar                         WinTerminate
  9031.     WinOffsetRect                       WinTrackRect
  9032.     WinOpenClipBrd                      WinTranslateAccel
  9033.     WinOpenWindowDC                     WinUnionRect
  9034.     WinPeekMsg                          WinUpdateWindow
  9035.     WinPopupMenu                        WinUpper
  9036.     WinPostMsg                          WinUpperChar
  9037.     WinPostQueueMsg                     WinValidateRect
  9038.     WinPrevChar                         WinValidateRegion
  9039.     WinProcessDlg                       WinWaitEventSem
  9040.     WinPtInRect                         WinWaitMsg
  9041.     WinQueryAccelTable                  WinWaitMuxWaitSem
  9042.     WinQueryActiveWindow                WinWindowFromDC
  9043.     WinQueryAnchorBlock                 WinWindowFromID
  9044.     WinQueryAtomLength                  WinWindowFromPoint
  9045.  
  9046. Standard Dialogs
  9047. ----------------
  9048.  
  9049.     WinDefFileDlgProc                   WinFreeFileDlgList
  9050.     WinFileDlg
  9051.  
  9052. Presentation Manager Shell
  9053. --------------------------
  9054.  
  9055.     WinAddSwitchEntry                   WinQueryTaskSizePos
  9056.     WinChangeSwitchEntry                WinQueryTaskTitle
  9057.     WinCreateSwitchEntry                WinRemoveSwitchEntry
  9058.     WinQuerySessionTitle                WinSwitchToProgram
  9059.     WinQuerySwitchEntry                 WinStartApp
  9060.     WinQuerySwitchHandle                WinTerminateApp
  9061.     WinQuerySwitchList
  9062.  
  9063. Keyboard Subsystem
  9064. ------------------
  9065.  
  9066.     KbdCharIn                           KbdPeek
  9067.     KbdClose                            KbdRegister
  9068.     KbdDeRegister                       KbdSetCp
  9069.     KbdFlushBuffer                      KbdSetCustXt
  9070.     KbdFreeFocus                        KbdSetFgnd
  9071.     KbdGetCp                            KbdSetHWID
  9072.     KbdGetFocus                         KbdSetStatus
  9073.     KbdGetHWID                          KbdStringIn
  9074.     KbdGetStatus                        KbdSynch
  9075.     KbdOpen                             KbdXlate
  9076.  
  9077. Video Subsystem
  9078. ---------------
  9079.  
  9080.     VioCheckCharType                    VioSavRedrawWait
  9081.     VioDeRegister                       VioScrLock
  9082.     VioEndPopUp                         VioScrollDn
  9083.     VioGetAnsi                          VioScrollLf
  9084.     VioGetBuf                           VioScrollRt
  9085.     VioGetConfig                        VioScrollUp
  9086.     VioGetCp                            VioScrUnLock
  9087.     VioGetCurPos                        VioSetAnsi
  9088.     VioGetCurType                       VioSetCp
  9089.     VioGetFont                          VioSetCurPos
  9090.     VioGetMode                          VioSetCurType
  9091.     VioGetPhysBuf                       VioSetFont
  9092.     VioGlobalReg                        VioSetMode
  9093.     VioModeUndo                         VioShowBuf
  9094.     VioModeWait                         VioWrtCellStr
  9095.     VioPopUp                            VioWrtCharStr
  9096.     VioPrtSc                            VioWrtCharStrAttr
  9097.     VioPrtScToggle                      VioWrtNAttr
  9098.     VioReadCellStr                      VioWrtNCell
  9099.     VioReadCharStr                      VioWrtNChar
  9100.     VioRegister                         VioWrtTTY
  9101.     VioSavRedrawUndo
  9102.  
  9103. Advanced Video
  9104. --------------
  9105.  
  9106.     VioAssociate                        VioQueryFonts
  9107.     VioCreateLogFont                    VioQuerySetIds
  9108.     VioCreatePS                         VioSetDeviceCellSize
  9109.     VioDeleteSetId                      VioSetOrg
  9110.     VioDestroyPS                        VioShowPS
  9111.     VioGetDeviceCellSize                WinDefAVioWindowProc
  9112.     VioGetOrg
  9113.  
  9114. Mouse Subsystem
  9115. ---------------
  9116.  
  9117.     MouClose                            MouInitReal
  9118.     MouDeRegister                       MouOpen
  9119.     MouDrawPtr                          MouReadEventQue
  9120.     MouFlushQue                         MouRegister
  9121.     MouGetDevStatus                     MouRemovePtr
  9122.     MouGetEventMask                     MouSetDevStatus
  9123.     MouGetNumButtons                    MouSetEventMask
  9124.     MouGetNumMickeys                    MouSetPtrPos
  9125.     MouGetNumQueEl                      MouSetPtrShape
  9126.     MouGetPtrPos                        MouSetScaleFact
  9127.     MouGetPtrShape                      MouSetThreshold
  9128.     MouGetScaleFact                     MouSynch
  9129.     MouGetThreshold
  9130.  
  9131.  
  9132. 7.2 Importing from OS/2 DLLs
  9133. ----------------------------
  9134.  
  9135. All functions in the list above are defined in libos2.a and
  9136. libos2.lib.  To import functions not defined in libos2.a and
  9137. libos2.lib, you have to create an import list file for these
  9138. functions.
  9139.  
  9140. See the emximp documentation for details.
  9141.  
  9142. Please note that you cannot directly call 16-bit functions not listed
  9143. above.  See below for details.
  9144.  
  9145.  
  9146. 7.3 Creating Presentation Manager applications using ld and emxbind
  9147. -------------------------------------------------------------------
  9148.  
  9149. - #include <os2.h>
  9150.  
  9151. - Link with libos2.a (done automatically when using GCC to link)
  9152.  
  9153. - Use `rc -r' to compile the resource-definition file into a binary
  9154.   resource file (.res file)
  9155.  
  9156. - Use `emxbind -ep' or a module definition file to set the application
  9157.   type
  9158.  
  9159. - Use the -r option of emxbind to put the resources from the binary
  9160.   source file into the .exe file.  If there's a .res file on the GCC
  9161.   or ld command line, it is automatically passed to emxbind
  9162.  
  9163. Do not use rc to put the resources into the .exe file!
  9164.  
  9165. Example:
  9166.  
  9167.     cd \emx\test
  9168.     rc -r pm1.rc
  9169.     gcc -o pm1 pm1.c
  9170.     emxbind -bp -rpm1.res /emx/bin/emxl pm1
  9171.  
  9172. Ditto, using a module definition file:
  9173.  
  9174.     cd \emx\test
  9175.     rc -r pm1.rc
  9176.     gcc -o pm1.exe pm1.c pm1.def pm1.res
  9177.  
  9178. Example (compiling the `template' toolkit sample program):
  9179.  
  9180.     cd \toolkt20\c\samples\template
  9181.     copy ..\prodinfo.bmp
  9182.     rc -r main.rc
  9183.     gcc -s -o template.exe *.c template.def main.res
  9184.  
  9185.  
  9186. 7.4 Creating Presentation Manager applications using emxomf and LINK386
  9187. -----------------------------------------------------------------------
  9188.  
  9189. - #include <os2.h>
  9190.  
  9191. - Link with libos2.lib (done automatically when using GCC to link)
  9192.  
  9193. - Use a module definition file which uses the WINDOWAPI keyword of the
  9194.   NAME statement
  9195.  
  9196. - Use `rc -r' to compile the resource-definition file into a binary
  9197.   resource file (.res file)
  9198.  
  9199. - Use `rc' or emxomfld to add the binary resource file to the .EXE
  9200.   file.  Optionally, you can compile the resource-definition file and
  9201.   add it to the .EXE file using `rc' in one step.  Using two steps is
  9202.   recommended in makefiles
  9203.  
  9204. Example:
  9205.  
  9206.     cd \emx\test
  9207.     rc -r pm1.rc
  9208.     gcc -o pm1.exe pm1.c pm1.def pm1.res -Zomf
  9209.  
  9210. Example (compiling the `template' toolkit sample program):
  9211.  
  9212.     cd \toolkt20\c\samples\template
  9213.     copy ..\prodinfo.bmp
  9214.     rc -r main.rc
  9215.     gcc -Zomf -o template.exe *.c template.def main.res
  9216.  
  9217. If you want to use the -Zsys option, you should increase the stack
  9218. size by editing the STACKSIZE statement in the .def file.  Note that
  9219. the command line arguments and the complete environment are copied to
  9220. the stack!  The stack size should be at least 32768.
  9221.  
  9222.  
  9223. 7.5 Creating dynamic link libraries
  9224. -----------------------------------
  9225.  
  9226. If you want to use C library functions (such as memory allocation and
  9227. i/o functions) that need initialization, you have to write a library
  9228. initialization function which initializes the library by calling
  9229. _CRT_init().  See _DLL_InitTerm() for details.  The default
  9230. _DLL_InitTerm() function does nothing.
  9231.  
  9232. Write a module definition file (.def file) that contains a LIBRARY
  9233. statement and an EXPORTS statement.  The EXPORTS statement has to list
  9234. all functions to be exported by your DLL.  The .def file should have
  9235. the same name as the .dll file to be created.
  9236.  
  9237. Compile and link your program using the -Zdll option of GCC.  This
  9238. option causes the dll0 startup to be used instead of crt0.  Specify
  9239. the name of the .def file on the GCC or ld command line, respectively.
  9240.  
  9241. Linking with LINK386 is recommended for dynamic link libraries.  Using
  9242. ld and emxbind offers no advantages when creating dynamic link
  9243. libraries.
  9244.  
  9245.  
  9246. 7.5.1 Creating dynamic link libraries that use emxlibc.dll
  9247. ----------------------------------------------------------
  9248.  
  9249. Dynamic link libraries that use emxlibc.dll are allowed to call all
  9250. library functions, including stream I/O, as long as they're used
  9251. together with programs and other dynamic link libraries that use
  9252. emxlibc.dll.  That is, all I/O done by C library functions must be
  9253. done in a single place, emxlibc.dll.  The relevant GCC command line
  9254. options are -Zomf -Zmt.  As the C library is initialized by the
  9255. program using the DLL, your library initialization function must not
  9256. call _CRT_init().
  9257.  
  9258.  
  9259. 7.5.2 Creating dynamic link libraries that don't use emxlibc.dll
  9260. ----------------------------------------------------------------
  9261.  
  9262. When linking a dynamic link libraries statically with the C library,
  9263. you have to keep in mind that the DLL and the program using the DLL
  9264. don't share global variables such as errno, timezone, and -- very
  9265. important -- the variables used for I/O.
  9266.  
  9267. Therefore you should not call C I/O functions; use OS/2 API functions
  9268. instead.  Functions such as strcpy() that don't use global variables
  9269. are safe to use.
  9270.  
  9271. See /emx/test/dlltest1.c for an example.
  9272.  
  9273.  
  9274. 7.6 Using the DLL version of the C library
  9275. ------------------------------------------
  9276.  
  9277. To use emxlibc.dll, simply say -Zmt on the GCC command line.  This
  9278. links your program with libmt.a or libmt.lib, the import library for
  9279. emxlibc.dll, instead of the static C library (libc, libgcc, libemx1).
  9280. -Zmt can be used with methods (E1) and (E2).  See the introduction for
  9281. further information.
  9282.  
  9283. Note that emxlibc.dll uses emx.dll.  Thus, the restrictions of -Zsys
  9284. do not apply.
  9285.  
  9286. Do not redefine functions in your program which are contained in
  9287. emxlibc.dll.  Other functions in emxlibc.dll will continue to use the
  9288. original versions in emxlibc.dll which will cause problems.  If you
  9289. have to replace library functions and want to use emxlibc.dll, create
  9290. a new DLL (which must not be called emxlibc.dll), add your replacement
  9291. functions and all the functions of emxlibc.dll except for the
  9292. functions you're replacing.
  9293.  
  9294.  
  9295. 7.7 Creating multi-threaded programs
  9296. ------------------------------------
  9297.  
  9298. Multi-threaded programs have to use emxlibc.dll.  Therefore you have
  9299. to say -Zmt on the GCC command line.
  9300.  
  9301. Use _beginthread() to start a new thread.  Do not use DosCreateThread
  9302. unless the new thread doesn't call C library functions.
  9303.  
  9304. The C library functions in emxlibc.dll are not yet completely
  9305. thread-safe: access to the stream I/O data should be serialized.  The
  9306. -Zmt option defines the __MT__ preprocessor macro.  The C library
  9307. header files check for __MT__ to use alternate definitions suitable
  9308. for multi-threaded programs when -Zmt is used.
  9309.  
  9310. Signal handling is currently implemented only for the main thread.  A
  9311. future version of emx will support per-thread signal handlers.
  9312.  
  9313. Each thread has its own errno value.
  9314.  
  9315. If you're very careful, you can write multi-threaded programs that
  9316. don't use emxlibc.dll.  Only the main thread is allowed to call
  9317. library functions that have side effects, including functions that set
  9318. errno.  All other threads should use OS/2 API functions instead.
  9319.  
  9320.  
  9321. 7.8 Calling 16-bit functions
  9322. ----------------------------
  9323.  
  9324. Limited support for calling 16-bit functions has been introduced with
  9325. emx 0.8f.  You can call 16-bit OS/2 API functions and other 16-bit
  9326. functions that use the pascal calling convention and are exported by a
  9327. dynamic link library.  As no changes have been made to GCC to support
  9328. direct calls to 16-bit functions (this would require big changes to
  9329. GCC), you have to call 16-bit functions by applying the following
  9330. (awkward) macros and functions:
  9331.  
  9332.     _THUNK_FUNCTION(FUNCTION)
  9333.  
  9334.         This macro is used for declaring the 16-bit function.  The
  9335.         function is declared as usual, using a prototype, but
  9336.         _THUNK_FUNCTION is applied to the function name.  The 16-bit
  9337.         function must not be called directly.
  9338.  
  9339.     _THUNK_PROLOG(SIZE)
  9340.  
  9341.         This macro must be called first.  SIZE is the number of bytes
  9342.         in the argument list of the 16-bit function.  After
  9343.         _THUNK_PROLOG, the following macros are used to build the
  9344.         argument list.  The macros are to be applied left-to-right,
  9345.         that is, the first argument is handled first.
  9346.  
  9347.     _THUNK_CHAR(ARG)
  9348.  
  9349.         Pass an 8-bit argument to the function.
  9350.  
  9351.     _THUNK_SHORT(ARG)
  9352.  
  9353.         Pass a 16-bit argument to the function.
  9354.  
  9355.     _THUNK_LONG(ARG)
  9356.  
  9357.         Pass a 32-bit argument to the function.
  9358.  
  9359.     _THUNK_FLAT(ARG)
  9360.  
  9361.         Pass a 32-bit (flat) pointer to the function.
  9362.  
  9363.     _THUNK_FAR16(ARG)
  9364.  
  9365.         Pass a 16:16-bit (far) pointer to the function.  After
  9366.         building the argument list, the 16-bit function is called by
  9367.         invoking the following macro.
  9368.  
  9369.     _THUNK_CALL(FUNCTION)
  9370.  
  9371.         Call the 16-bit function FUNCTION.  Do not apply
  9372.         _THUNK_FUNCTION to the function name.
  9373.  
  9374. There should be no statements other than calls to the _THUNK macros
  9375. between _THUNK_PROLOG and _THUNK_CALL.  _THUNK_PROLOG starts an
  9376. expression which is terminated by _THUNK_CALL.  Therefore, the return
  9377. value of the 16-bit function is returned by _THUNK_CALL and by the
  9378. entire sequences of statements from _THUNK_PROLOG to _THUNK_CALL.  The
  9379. return value is the value returned by the 16-bit function in the DX
  9380. and AX registers.  If the function returns a 16-bit value, you have to
  9381. typecast the return value to SHORT or USHORT to discard the upper 16
  9382. bits.
  9383.  
  9384. See the description of _emx_16to32() and _emx_32to16() for converting
  9385. 16-bit far pointers to 32-bit flat pointers and vice versa.  This
  9386. conversion is not done automatically.
  9387.  
  9388. Example:
  9389.  
  9390.     #include <os2.h>                /* define _THUNK macros */
  9391.  
  9392.     /* Declare 16-bit function */
  9393.     USHORT _THUNK_FUNCTION (Dos16Beep) (USHORT usFrequency, USHORT usDuration);
  9394.  
  9395.     void beep (int frequency, int duration)
  9396.     {
  9397.       _THUNK_PROLOG (2+2);
  9398.       _THUNK_SHORT (frequency);
  9399.       _THUNK_SHORT (duration);
  9400.       _THUNK_CALL (Dos16Beep);
  9401.     }
  9402.  
  9403. See /emx/lib/os2/*.c for more examples.
  9404.  
  9405.  
  9406. 8 Customizing
  9407. =============
  9408.  
  9409. Default values are provided for the heap size, the stack size and the
  9410. number of files that can be simultaneously open.  The following
  9411. sections describe how to increase the limits.
  9412.  
  9413.  
  9414. 8.1 Increasing the heap size
  9415. ----------------------------
  9416.  
  9417. The maximum size of the heap available for malloc() is fixed.  The
  9418. default for the combined size of the heap and stack is 8 MB under DOS.
  9419. Use the -s# emx option (see `Using emx options') to increase the heap
  9420. and stack size.
  9421.  
  9422. The default heap size is 32 MB under OS/2.  When using ld and emxbind,
  9423. you can change the heap size with the -h# option of emxbind.
  9424.  
  9425. When using emxomf and LINK386 without -Zsys, the heap size cannot be
  9426. changed (currently).  When using -Zsys, you have to build a new
  9427. libsys.lib after changing /emx/lib/sys/init.c.  The following line of
  9428. that file defines the heap size:
  9429.  
  9430.     _sys_heap_size = 0x2000000;
  9431.  
  9432. See build.doc on information about rebuilding libraries.
  9433.  
  9434.  
  9435. 8.2 Increasing the stack size
  9436. -----------------------------
  9437.  
  9438. The default for the combined size of the heap and stack is 8 MB under
  9439. DOS.  When using emxbind, the default stack size is 8 MB under OS/2.
  9440. When using emxomf and LINK386, the default stack size is 8192 bytes
  9441. under OS/2.  This default stack size is too small.
  9442.  
  9443. The stack size for DOS can be changed with the -s# emx option.  emxbind
  9444. can put this option into the executable file.
  9445.  
  9446. The stack size for OS/2 can be changed with the -k# option of emxbind
  9447. when using emxbind.  When using LINK386, use the STACKSIZE statement
  9448. in a module definition file.  The stack size should be at least 32768
  9449. bytes.
  9450.  
  9451.  
  9452. 8.3 Increasing the number of files
  9453. -----------------------------------
  9454.  
  9455. Under DOS and when using emx.dll under OS/2, you can set the number of
  9456. file handles supported by the emx runtime by setting the EMXOPT
  9457. environment variable or by using emxbind to put emx options into the
  9458. .exe file.  The relevant option is -h#, see `Using emx options'.
  9459.  
  9460. Note that you might have to change the FILES settings in the
  9461. CONFIG.SYS file under DOS.
  9462.  
  9463. The number of file handles and streams supported by the C library is
  9464. given by the _NFILES constant in /emx/include/sys/emx.h.  The default
  9465. value is 40.  After changing emx.h, you have to rebuild the libraries.
  9466. (At least stdio.c and iodata.c in /emx/lib/io must be recompiled.)
  9467. Note that at least three file handles (for stdin, stdout and stderr)
  9468. are (almost) always predefined.  When using the system call library
  9469. (-Zsys, libsys.lib) you have to call DosSetMaxFH to increase the
  9470. number of file handles.
  9471.  
  9472. The number of file handles and streams supported by emxlibc.dll is
  9473. 256.
  9474.  
  9475.  
  9476. 9 Debugger (DOS)
  9477. ================
  9478.  
  9479. emxd.exe contains a debugger, emx.exe doesn't.  Use the -S option to
  9480. enable the debugger.  If you want to debug using a terminal, enter -S1
  9481. to use COM1, -S2 to use COM2.
  9482.  
  9483. Command keys
  9484.  
  9485.     .               display registers and next instruction
  9486.     :               show CS:EIP and next instruction (toggle)
  9487.     <blank>         1 step
  9488.     0               10 steps
  9489.     1-9             1 to 9 steps
  9490.     C               set breakpoint after next instruction and start program
  9491.     F               display floating point (387) status
  9492.     N               step without stopping
  9493.     F2              display registers and next instruction
  9494.     F5              start program without setting breakpoint
  9495.     F8              1 step
  9496.     F10             set breakpoint after next instruction and start program
  9497.  
  9498. Commands:
  9499.  
  9500.     A address       display info about address (virt/phys/external addresses)
  9501.     A range         ditto, loop through range, adding 1000H
  9502.     B               display breakpoints and watchpoints
  9503.     B address       set breakpoint (default segment: CS)
  9504.     D               continue last D command
  9505.     D address       display hex dump: 16 lines (default segment: DS)
  9506.     D range         display hex dump (default segment: DS)
  9507.     G               start program
  9508.     G address       set temporary breakpoint at given address (default
  9509.                     segment: CS) and start program
  9510.     I               display process table:
  9511.                         process index, process id, parent process id,
  9512.                         number of open files
  9513.     K               display breakpoints and watchpoints
  9514.     K value         delete breakpoint or watchpoint (by number)
  9515.     L value         display info about selector
  9516.     L value value   ditto, loop through range, adding 8 (not 4!)
  9517.     Q               quit, return value 0
  9518.     Q value         quit with given return value
  9519.     R               display registers and next instruction
  9520.     R reg value     set register to value
  9521.     R condition     set/reset processor flag
  9522.     S range list    search memory
  9523.     U               continue last U command
  9524.     U address       unassemble (default segment: CS)
  9525.     V value         display info about virtual address
  9526.     V value value   ditto, loop through range, adding 1000H
  9527.     VP              display info about pages that have physical memory assigned
  9528.     VP value        display info by physical address
  9529.     VP value value  ditto, loop through range, adding 1000H
  9530.     VX              display info about pages that have an external address
  9531.     VX value        display info by external address
  9532.     VX value value  ditto, loop through range, adding 1000H
  9533.     W               display breakpoints and watchpoints
  9534.     Wla address     set watchpoint at given address (default segment: DS)
  9535.                         l:      B       byte
  9536.                                 W       word (address must be even)
  9537.                                 D       dword (the 2 low bits of addr must = 0)
  9538.                         a:      R       trap read & write accesses
  9539.                                 W       trap write accesses
  9540.                                 X       trap change
  9541.     X value         Find symbol at address `value' or below
  9542.  
  9543. Up to 3 breakpoints and watchpoints can be set.
  9544.  
  9545.  
  9546. Address:
  9547.  
  9548.     [value:]value   segment and offset
  9549.     symbol          symbol (search symbol; if this fails, search _symbol)
  9550.  
  9551. Condition:
  9552.  
  9553.     NC, CY, PE, PO, NA, AC, NZ, ZR, PL, NG, DI, EI, UP, DN, NV, OV
  9554.  
  9555. Register:
  9556.  
  9557.     EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP, EFLAGS,
  9558.     AX, BX, CX, DX, SI, DI, BP, SP, IP,
  9559.     AL, AH, BL, BH, CL, CH, DL, DH,
  9560.     CS, DS, ES, FS, GS, SS
  9561.  
  9562. Range:
  9563.  
  9564.     address address (same segments, second offset >= first offset,
  9565.                      second selector should be omitted)
  9566.  
  9567. List:
  9568.     value|'text' ...
  9569.  
  9570. Value:
  9571.  
  9572.     Hexadecimal number, register name or character ('c')
  9573.  
  9574. If the -S option is used, emx will display swapper statistics when
  9575. returning to DOS.  It displays
  9576.  
  9577.     Swapper statistics: F=f R=r W=w N=n S=s
  9578.  
  9579. where f is the number of page faults, r is the number of swapper file
  9580. reads, w is the number of swapper file writes, n is the number of
  9581. times the swap space of present pages has been recycled, and s is the
  9582. size of the swapper file.  All numbers are decimal numbers.
  9583.  
  9584.  
  9585. 10 Executable file format
  9586. =========================
  9587.  
  9588. a.out       see /emx/include/a_out.h
  9589. exe         OS/2 LX format with additional sections, see emxbind.doc
  9590.  
  9591.  
  9592. 11 Known problems
  9593. =================
  9594.  
  9595. - select(), sleep(), _sleep2() hold signals under DOS, that is, if the
  9596.   alarm() timer elapses, the signal handler for SIGALRM isn't called
  9597.   until the completion of those functions
  9598.  
  9599. - when using the -C# emx option, memory allocated by an unsuccessful
  9600.   brk() or sbrk() call isn't freed.  That is, as soon as a malloc()
  9601.   call fails, further calls will also fail.  Actually, this isn't a
  9602.   bug -- it's a lacking feature
  9603.  
  9604. - emx doesn't work under DOS if more than 16 MB of memory is installed
  9605.  
  9606. - running emx programs by a DOS program started by an emx program
  9607.   seems not to work under certain circumstances
  9608.  
  9609. - under circumstances not yet isolated, OS/2 crashes when running
  9610.   multiple emx applications.  For instance, this happens when doing a
  9611.   parallel make with dmake.  Under some versions of OS/2, only the emx
  9612.   applications freeze instead of OS/2.  It has not been tested whether
  9613.   this problem still exists with emx 0.8f
  9614.  
  9615. - breakpoints are shared by all instances of a program under OS/2 --
  9616.   this is an OS/2 bug
  9617.  
  9618. - _read_kbd() of the system call library (-Zsys) sometimes crashes the
  9619.   program (or even OS/2) if Ctrl-C or Ctrl-Break is pressed
  9620.  
  9621. --------------------------- END OF EMXDEV.DOC ------------------------------
  9622.