home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / archive / emx / doc / emxfn.inf (.txt) < prev    next >
Encoding:
OS/2 Help File  |  1993-03-28  |  214.6 KB  |  7,353 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Library reference: functions ΓòÉΓòÉΓòÉ
  3.  
  4. 5.3 Library reference: functions 
  5.  
  6. The functions are listed almost alphabetically.  The origin of most of the 
  7. functions is shown in [brackets] at the end of the first line. Functions which 
  8. are not available or are limited with the system call library (-Zsys, 
  9. libsys.lib) are marked [*]. 
  10.  
  11. Copyright (c) 1990-1993 by Eberhard Mattes 
  12. Original text document by Eberhard Mattes 
  13. INF version by Mike Levis 
  14.  
  15. (This INF file contains the library function reference for emx/gcc 0.8f) 
  16. (This is version 1.0 of the INF file) 
  17. (Mike Levis -- OS/2,  March 28, 1993) 
  18.  
  19.  
  20. ΓòÉΓòÉΓòÉ 2. function a ΓòÉΓòÉΓòÉ
  21.  
  22. This sections documents functions starting with the letter a 
  23.  
  24.  
  25. ΓòÉΓòÉΓòÉ 2.1. abort() ΓòÉΓòÉΓòÉ
  26.  
  27. #include <stdlib.h>                           [ANSI]
  28.  
  29. void volatile abort (void);
  30.  
  31.      abort() does some cleaning up and aborts program by raising SIGABRT.  The 
  32.      default action for SIGABRT is to display the message `Abnormal program 
  33.      termination' and exit with return code 3. 
  34.  
  35.      See also: exit() , _exit() , raise() , signal() 
  36.  
  37.  
  38. ΓòÉΓòÉΓòÉ 2.2. abs() ΓòÉΓòÉΓòÉ
  39.  
  40. #include <stdlib.h>   /* use this */                  [ANSI]
  41. #include <math.h>    /* or this */
  42.  
  43. int abs (int n);
  44.  
  45.      Return the absolute value of N: If N is negative, -N is returned. 
  46.      Otherwise, N is returned.  In-line code is generated for this function. 
  47.  
  48.      See also: fabs() , labs() 
  49.  
  50.  
  51. ΓòÉΓòÉΓòÉ 2.3. _abspath() ΓòÉΓòÉΓòÉ
  52.  
  53. #include <stdlib.h>                            [emx]
  54.  
  55. int _abspath (char *dst, const char *src, int size);
  56.  
  57.      Construct an absolute path name for the file name or directory name SRC. 
  58.      The absolute path name is put to DST.  It is assumed that there are SIZE 
  59.      bytes available at DST, this includes the terminating 0 byte.  If there is 
  60.      an error, -1 is returned.  If _abspath() succeeds, 0 is returned.  If SIZE 
  61.      is too small, errno is set to ERANGE and -1 is returned.  DST can be 
  62.      identical to SRC. Backslashes are translated into forward slashes.  The 
  63.      absolute path name is not translated to lower case.  If SRC ends with a 
  64.      slash or backslash, DST will end with a slash. 
  65.  
  66.      _abspath() works with non-existing paths, it accesses the appropriate 
  67.      drive only for finding out the current working directory, if necessary. 
  68.  
  69.      See also: _fnisabs() , _fullpath() 
  70.  
  71.  
  72. ΓòÉΓòÉΓòÉ 2.4. access() ΓòÉΓòÉΓòÉ
  73.  
  74. #include <io.h>                             [UNIX]
  75.  
  76. int access (const char *name, int mode);
  77.  
  78.      Returns 0 if the file or directory NAME is accessible in mode MODE. 
  79.      Otherwise returns -1 and sets errno to ENOENT or EACCES. If MODE is 0, 
  80.      access() checks only for existence of the file or directory.  If MODE is 
  81.      2, access() checks for write permission. If MODE is 4, access() checks for 
  82.      read permission (always granted under DOS and OS/2 if the file exists). 
  83.      If MODE is 6, access() checks for read and write permission. 
  84.  
  85.      Restrictions: access() does not work with devices (ENOENT). 
  86.  
  87.      See also: open() , stat() 
  88.  
  89.  
  90. ΓòÉΓòÉΓòÉ 2.5. alarm() ΓòÉΓòÉΓòÉ
  91.  
  92. #include <stdlib.h>                         [*] [UNIX]
  93.  
  94. unsigned alarm (unsigned SEC);
  95.  
  96.      Raises SIGALRM after SEC seconds have expired.  There is only one alarm 
  97.      clock, calling alarm() while the alarm clock is running, the time will be 
  98.      reset to the new value.  If SEC is zero, the alarm clock will be stopped. 
  99.      alarm() returns the number of seconds remaining on the alarm clock before 
  100.      setting the new value.  Under DOS, SIGALRM is not raised until return from 
  101.      DOS if the timer expired during a DOS call. 
  102.  
  103.      Restriction: When using the system call library libsys.lib (-Zsys), 
  104.      alarm() is not available. 
  105.  
  106.      See also: raise() , signal() , sleep() , _sleep2() 
  107.  
  108.  
  109. ΓòÉΓòÉΓòÉ 2.6. alloca() ΓòÉΓòÉΓòÉ
  110.  
  111. #include <alloca.h>
  112.  
  113. void *alloca (size_t n);
  114.  
  115.      Allocate N bytes from the current stack frame.  The memory space allocated 
  116.      by alloca() will be freed on exit from the current function.  Do not pass 
  117.      the pointer returned by alloca() to free(). 
  118.  
  119.      This note applies only if you need stack probes: 
  120.  
  121.      If alloca() with constant argument occurs in the first statement of a 
  122.      function with less than 4096 bytes of local data or if two calls to 
  123.      alloca() with constant arguments occur twice in a row without accessing 
  124.      the memory pointed to by the return value of the first call, you have to 
  125.      change your code to make GCC generate correct stack probes.  This can be 
  126.      done by storing a dummy value to the return value of alloca(). 
  127.  
  128.      Example: 
  129.  
  130.             p = alloca (0xf00);
  131.             {char *fix=alloca (0); *fix = 0;}
  132.             q = alloca (0xf00);
  133.  
  134.      Example: 
  135.  
  136.             void test (void)
  137.             {
  138.               char local[0xf00], *p;
  139.  
  140.               {char *fix=alloca (0); *fix = 0;}
  141.               p = alloca (0xf00);
  142.               /*...*/
  143.             }
  144.  
  145.      See also: GCC , malloc() 
  146.  
  147.  
  148. ΓòÉΓòÉΓòÉ 2.7. asctime() ΓòÉΓòÉΓòÉ
  149.  
  150. #include <time.h>                            [ANSI]
  151.  
  152. char *asctime (const struct tm *t);
  153.  
  154.      Convert the time and date given by the structure pointed to by T to a 
  155.      string.  A pointer to the string is returned.  There is only one memory 
  156.      location for the ctime() and asctime() results, a call to ctime() or 
  157.      asctime() overwrites the result of a previous calls to ctime() or 
  158.      asctime().  As localtime() is called by ctime(), the memory location 
  159.      shared by localtime(), gmtime(), and mktime() is overwritten.  The string 
  160.      looks like 
  161.  
  162.               "Sun Mar 22 22:59:18 1992\n"
  163.  
  164.      with a terminating 0.  All fields have fixed width. 
  165.  
  166.      See also: ctime() 
  167.  
  168.  
  169. ΓòÉΓòÉΓòÉ 2.8. acos() ΓòÉΓòÉΓòÉ
  170.  
  171. #include <math.h>                            [ANSI]
  172.  
  173. double acos (double x);
  174. double asin (double x);
  175. double atan (double x);
  176. double atan2 (double y, double x);
  177.  
  178.      Compute the arc sine, arc cosine and arc tangent of X, respectively. 
  179.      atan2() computes the arctangent of Y/X, using the signs of Y and X to 
  180.      determine the quadrant.  If X is outside [-1,1], asin() and acos() return 
  181.      #NAN and set errno to EDOM. 
  182.  
  183.      See also: cos() , sin() , tan() 
  184.  
  185.  
  186. ΓòÉΓòÉΓòÉ 2.9. asin() ΓòÉΓòÉΓòÉ
  187.  
  188.  
  189. ΓòÉΓòÉΓòÉ 2.10. assert() ΓòÉΓòÉΓòÉ
  190.  
  191. #include <assert.h>                           [ANSI]
  192.  
  193. void assert (int exp);
  194.  
  195.      If the preprocessor macro NDEBUG is defined, assert() does nothing. 
  196.      Otherwise, if EXP is zero, the message 
  197.  
  198.             Assertion failed: EXP, file FILE, line LINE
  199.  
  200.      is displayed and the program is aborted.  EXP, FILE and LINE are replaced 
  201.      with EXP (as text), the source file name and the source line number, 
  202.      respectively.  If EXP is non-zero, nothing is done. 
  203.  
  204.      See also: abort() 
  205.  
  206.  
  207. ΓòÉΓòÉΓòÉ 2.11. atan() ΓòÉΓòÉΓòÉ
  208.  
  209.  
  210. ΓòÉΓòÉΓòÉ 2.12. atan2() ΓòÉΓòÉΓòÉ
  211.  
  212.  
  213. ΓòÉΓòÉΓòÉ 2.13. atexit() ΓòÉΓòÉΓòÉ
  214.  
  215. #include <stdlib.h>                           [ANSI]
  216.  
  217. int atexit (void (*func)(void));
  218.  
  219.      The function FUNC will be called when the process is terminated. The last 
  220.      function installed by calling atexit() will be called first.  Up to 32 
  221.      functions can be installed.  0 is returned if successful, -1 otherwise. 
  222.  
  223.      See also: abort() , exit() , _exit() 
  224.  
  225.  
  226. ΓòÉΓòÉΓòÉ 2.14. atof() ΓòÉΓòÉΓòÉ
  227.  
  228. #include <stdlib.h>                           [ANSI]
  229. #include <math.h>  /* alternate include file for atof() */
  230.  
  231. double atof (const char *string);
  232. int atoi (const char *string);
  233. long atol (const char *string);
  234.  
  235.      Convert the textual representation of a number in STRING to a number. 
  236.      Leading whitespace is ignored.  If the string cannot be converted, 0 is 
  237.      returned. 
  238.  
  239.      See also: _atoll() , _itoa() , _ltoa() , scanf() 
  240.  
  241.  
  242. ΓòÉΓòÉΓòÉ 2.15. atoi() ΓòÉΓòÉΓòÉ
  243.  
  244.  
  245. ΓòÉΓòÉΓòÉ 2.16. atol() ΓòÉΓòÉΓòÉ
  246.  
  247.  
  248. ΓòÉΓòÉΓòÉ 2.17. _atoll() ΓòÉΓòÉΓòÉ
  249.  
  250. #include <stdlib.h>                            [emx]
  251.  
  252. long long _atoll (const char *string);
  253.  
  254.      Convert the textual representation of a number in STRING to a number. 
  255.      Leading whitespace is ignored.  If the string cannot be converted, 0 is 
  256.      returned. 
  257.  
  258.      See also: atol() 
  259.  
  260.  
  261. ΓòÉΓòÉΓòÉ 3. function b ΓòÉΓòÉΓòÉ
  262.  
  263. This sections documents functions starting with the letter b 
  264.  
  265.  
  266. ΓòÉΓòÉΓòÉ 3.1. bcmp() ΓòÉΓòÉΓòÉ
  267.  
  268. #include <strings.h>                           [BSD]
  269.  
  270. int bcmp (const void *buffer1, const void *buffer2, size_t n);
  271.  
  272.      Compare the first N bytes at BUFFER1 to the first N bytes at BUFFER2.  If 
  273.      the two buffers are identical (or if N is zero), 0 is returned. 
  274.      Otherwise, a non-zero value is returned. 
  275.  
  276.      See also: memcmp() 
  277.  
  278.  
  279. ΓòÉΓòÉΓòÉ 3.2. bcopy() ΓòÉΓòÉΓòÉ
  280.  
  281. #include <strings.h>                           [BSD]
  282.  
  283. void bcopy (const void *src, void *dst, size_t n);
  284.  
  285.      Copy memory.  Copy N bytes from SRC to DST.  The two regions may overlap. 
  286.  
  287.      See also: memmove() 
  288.  
  289.  
  290. ΓòÉΓòÉΓòÉ 3.3. _beginthread() ΓòÉΓòÉΓòÉ
  291.  
  292. #include <stdlib.h>                            [PC]
  293.  
  294. int _beginthread (void (*start)(void *arg), void *stack, unsigned stack_size,
  295.          void *arg_list);
  296.  
  297.      Start a thread.  START is the start address (a function). ARG_LIST will be 
  298.      passed in the ARG parameter of the START function.  STACK is ignored, 
  299.      using NULL is recommended. STACK_SIZE is the size of the stack for the new 
  300.      thread.  When the START function returns, the thread is terminated.  A 
  301.      thread can also terminate itself by calling _endthread().  If successful, 
  302.      _beginthread() returns the thread ID.  On error, _beginthread() sets errno 
  303.      and returns -1.  The stack allocated for the new thread is completely 
  304.      committed, that is, stack probes are not required. 
  305.  
  306.      Do not start a thread with DosCreateThread unless it doesn't call C 
  307.      library functions. 
  308.  
  309.      _beginthread() is available only when using emxlibc.dll (-Zmt). 
  310.  
  311.      See also: _endthread() 
  312.  
  313.  
  314. ΓòÉΓòÉΓòÉ 3.4. brk() ΓòÉΓòÉΓòÉ
  315.  
  316. #include <stdlib.h>                           [UNIX]
  317.  
  318. void *brk (void *addr);
  319.  
  320.      Change end address of data segment to ADDR.  On success, brk() returns 0, 
  321.      cast as pointer.  Otherwise, -1 cast as pointer is returned and errno set 
  322.      to ENOMEM.  Please don't use brk() -- use malloc() instead for memory 
  323.      allocation. 
  324.  
  325.      See also: malloc() , sbrk() 
  326.  
  327.  
  328. ΓòÉΓòÉΓòÉ 3.5. bsearch() ΓòÉΓòÉΓòÉ
  329.  
  330. #include <stdlib.h>                           [ANSI]
  331.  
  332. void *bsearch (const void *key, const void *base, size_t num, size_t width,
  333.         int (*compare)(const void *key, const void *element));
  334.  
  335.      Perform a binary search on the sorted array BASE to find KEY.  The array 
  336.      has NUM elements of size WIDTH bytes each.  bsearch() calls COMPARE to 
  337.      compare an array element pointed to by ELEMENT with KEY.  COMPARE should 
  338.      return 0 if KEY and ELEMENT are equal; a negative value, if KEY is smaller 
  339.      than ELEMENT; a positive value if KEY is greater than ELEMENT with respect 
  340.      to the sorting order of ARRAY.  bsearch() returns a pointer to an 
  341.      occurrence of KEY in the array.  If KEY is not found, NULL is returned. 
  342.      If there are multiple occurrences of KEY in ARRAY, bsearch() returns a 
  343.      pointer to any one of the entries.  If ARRAY is not sorted, bsearch() does 
  344.      not work. 
  345.  
  346.      See also: qsort() 
  347.  
  348.  
  349. ΓòÉΓòÉΓòÉ 3.6. bzero() ΓòÉΓòÉΓòÉ
  350.  
  351. #include <strings.h>                           [BSD]
  352.  
  353. void bzero (void *buffer, size_t n);
  354.  
  355.      Set N bytes at BUFFER to 0. 
  356.  
  357.      See also: memset() 
  358.  
  359.  
  360. ΓòÉΓòÉΓòÉ 4. function c ΓòÉΓòÉΓòÉ
  361.  
  362. This sections documents functions starting with the letter c 
  363.  
  364.  
  365. ΓòÉΓòÉΓòÉ 4.1. cbrt() ΓòÉΓòÉΓòÉ
  366.  
  367. #include <math.h>
  368.  
  369. double cbrt (double x);
  370.  
  371.      Compute and return the cube root of X.  This is done by calling pow() and 
  372.      adjusting the sign. 
  373.  
  374.      See also: pow() , sqrt() 
  375.  
  376.  
  377. ΓòÉΓòÉΓòÉ 4.2. ceil() ΓòÉΓòÉΓòÉ
  378.  
  379. #include <math.h>                            [ANSI]
  380.  
  381. double ceil (double x);
  382.  
  383.      Return as floating-point number the smallest integer that is greater than 
  384.      or equal to X (round up). 
  385.  
  386.      See also: floor() , rint() , trunc() 
  387.  
  388.  
  389. ΓòÉΓòÉΓòÉ 4.3. chdir() ΓòÉΓòÉΓòÉ
  390.  
  391. #include <stdlib.h>                           [UNIX]
  392.  
  393. int chdir (const char *name);
  394.  
  395.      Change to directory NAME.  If NAME contains a drive letter, the working 
  396.      directory on that drive is changed, but the selected drive does not 
  397.      change.  If successful, 0 is returned.  Otherwise, -1 is returned. 
  398.  
  399.      Restriction: Under DOS, the current working directory is not a property of 
  400.      a process, it's a system-wide property.  That may change in a future 
  401.      release of emx. 
  402.  
  403.      See also: _chdir2() , getcwd() 
  404.  
  405.  
  406. ΓòÉΓòÉΓòÉ 4.4. _chdir2() ΓòÉΓòÉΓòÉ
  407.  
  408. #include <stdlib.h>                            [emx]
  409.  
  410. int _chdir2 (const char *name);
  411.  
  412.      Change to drive and directory NAME.  If NAME contains a drive letter, that 
  413.      drive is selected.  If successful, 0 is returned. Otherwise, -1 is 
  414.      returned. 
  415.  
  416.      Restriction: Under DOS, the current working directory and the default 
  417.      drive is not a property of a process, it's a system-wide property.  That 
  418.      may change in a future release of emx. 
  419.  
  420.      See also: chdir() , getcwd() 
  421.  
  422.  
  423. ΓòÉΓòÉΓòÉ 4.5. _chdrive() ΓòÉΓòÉΓòÉ
  424.  
  425. #include <stdlib.h>                            [PC]
  426.  
  427. int _chdrive (char drive);
  428.  
  429.      Make the disk drive DRIVE the default drive.  DRIVE must be in 'A' through 
  430.      'Z'.  _chdrive() always returns 0, even if the drive does not exist. 
  431.  
  432.      See also: _chdir2() , _getdrive() 
  433.  
  434.  
  435. ΓòÉΓòÉΓòÉ 4.6. chmod() ΓòÉΓòÉΓòÉ
  436.  
  437. #include <io.h>                             [UNIX]
  438. #include <sys/stat.h>
  439.  
  440. int chmod (const char *name, int pmode);
  441.  
  442.      Change permission settings of the file named NAME to PMODE. There's only 
  443.      one permission bit under OS/2 and DOS, the read-only attribute. 
  444.  
  445.      Return value: 
  446.  
  447.      0         success 
  448.  
  449.      -1        failure 
  450.  
  451.      Restriction: Only the S_IWRITE bit of PMODE is used. 
  452.  
  453.      See also: creat() , open() , stat() , umask() 
  454.  
  455.  
  456. ΓòÉΓòÉΓòÉ 4.7. chsize() ΓòÉΓòÉΓòÉ
  457.  
  458. #include <io.h>                              [PC]
  459.  
  460. int chsize (int handle, long size);
  461.  
  462.      Change the length of the file associated with HANDLE to LENGTH bytes.  The 
  463.      position of the file pointer is undefined after calling this function.  If 
  464.      LENGTH is greater than the current length of the file, bytes of zeros are 
  465.      appended.  HANDLE must be open for writing.  If successful, 0 is returned. 
  466.      Otherwise, -1 is returned. 
  467.  
  468.      See also: ftruncate() 
  469.  
  470.  
  471. ΓòÉΓòÉΓòÉ 4.8. clearerr() ΓòÉΓòÉΓòÉ
  472.  
  473. #include <stdio.h>                            [ANSI]
  474.  
  475. void clearerr (FILE *stream);
  476.  
  477.      Clear the error and end-of-file indicators of STREAM. 
  478.  
  479.      See also: ferror() , feof() 
  480.  
  481.  
  482. ΓòÉΓòÉΓòÉ 4.9. clock() ΓòÉΓòÉΓòÉ
  483.  
  484. #include <time.h>                            [ANSI]
  485.  
  486. clock_t clock (void);
  487.  
  488.      clock() returns the amount of processor time (timer ticks) used by the 
  489.      calling process since the process has been started.  There are 
  490.      CLOCKS_PER_SEC timer ticks per second. 
  491.  
  492.      Restriction: clock() returns the time elapsed, not the CPU time. 
  493.  
  494.      See also: time() 
  495.  
  496.  
  497. ΓòÉΓòÉΓòÉ 4.10. close() ΓòÉΓòÉΓòÉ
  498.  
  499. #include <io.h>                             [UNIX]
  500.  
  501. int close (int handle);
  502.  
  503.      Close the file associated with the handle HANDLE.  If successful, 0 is 
  504.      returned, -1 if not. 
  505.  
  506.      See also: dup() , open() 
  507.  
  508.  
  509. ΓòÉΓòÉΓòÉ 4.11. closedir() ΓòÉΓòÉΓòÉ
  510.  
  511.  
  512. ΓòÉΓòÉΓòÉ 4.12. _core() ΓòÉΓòÉΓòÉ
  513.  
  514. #include <stdlib.h>                          [*] [emx]
  515.  
  516. int _core (int handle);
  517.  
  518.      Write a core dump to the file HANDLE.  HANDLE must be open for writing. 
  519.      The core dump file can be used later for debugging or for creating another 
  520.      .exe file which includes the data as saved when _core() was called. 
  521.  
  522.      Restriction: _core() works only in programs linked with ld.  It does not 
  523.      work in programs linked with LINK386.  When using the system call library 
  524.      libsys.lib (-Zsys), _core() is not available. 
  525.  
  526.      See also: raise() 
  527.  
  528.  
  529. ΓòÉΓòÉΓòÉ 4.13. cos() ΓòÉΓòÉΓòÉ
  530.  
  531. #include <math.h>                            [ANSI]
  532.  
  533. double cos (double x);
  534. double sin (double x);
  535. double tan (double x);
  536.  
  537.      Compute the sine, cosine and tangent of X, respectively.  If the absolute 
  538.      value of x is greater than or equal to 2^63, #NAN is returned and errno 
  539.      set to EDOM. 
  540.  
  541.      See also: acos() , asin() , atan() 
  542.  
  543.  
  544. ΓòÉΓòÉΓòÉ 4.14. cosh() ΓòÉΓòÉΓòÉ
  545.  
  546. #include <math.h>                            [ANSI]
  547.  
  548. double cosh (double x);
  549. double sinh (double x);
  550. double tanh (double x);
  551.  
  552.      Compute the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of 
  553.      X, respectively.  On overflow, #INF is returned and errno set to ERANGE. 
  554.  
  555.      See also: exp() 
  556.  
  557.  
  558. ΓòÉΓòÉΓòÉ 4.15. creat() ΓòÉΓòÉΓòÉ
  559.  
  560. #include <io.h>                             [UNIX]
  561. #include <sys/stat.h>
  562.  
  563. int creat (const char *name, int pmode);
  564.  
  565.      Create a file named NAME with permission settings PMODE.  This is 
  566.      equivalent to 
  567.  
  568.               open (name, O_WRONLY|O_TRUNC|O_CREAT, pmode)
  569.  
  570.      See also: open() 
  571.  
  572.  
  573. ΓòÉΓòÉΓòÉ 4.16. _crlf() ΓòÉΓòÉΓòÉ
  574.  
  575. #include <io.h>                              [emx]
  576.  
  577. int _crlf (char *buf, size_t size, size_t *new_size);
  578.  
  579.      Translate CR/LF pairs to LF characters.  The conversion is done in-place 
  580.      in the buffer BUF of size SIZE.  The new size is stored to *NEW_SIZE.  If 
  581.      the buffer ends with a CR, 1 is returned. Otherwise, 0 is returned. 
  582.  
  583.      See also: fread() , _fsetmode() , read() , setmode() 
  584.  
  585.  
  586. ΓòÉΓòÉΓòÉ 4.17. _CRT_init() ΓòÉΓòÉΓòÉ
  587.  
  588.                                     [OS/2]
  589.  
  590. int _CRT_init (void);
  591. void _CRT_term (void);
  592.  
  593.      These two functions are provided for being called from _DLL_InitTerm(), 
  594.      the DLL initialization and termination function. 
  595.  
  596.      _CRT_init() initializes the C run-time library.  On success, 0 is 
  597.      returned.  On failure, -1 is returned. 
  598.  
  599.      _CRT_term() terminates the C run-time library. 
  600.  
  601.      Example: /emx/test/testdll1.c 
  602.  
  603.      See also: _DLL_InitTerm() 
  604.  
  605.  
  606. ΓòÉΓòÉΓòÉ 4.18. _CRT_term() ΓòÉΓòÉΓòÉ
  607.  
  608.  
  609. ΓòÉΓòÉΓòÉ 4.19. ctime() ΓòÉΓòÉΓòÉ
  610.  
  611. #include <time.h>                            [ANSI]
  612.  
  613. char *ctime (const time_t *t);
  614.  
  615.      Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970 given by 
  616.      the variable pointed to by T to a string representing that moment for the 
  617.      local timezone.  A pointer to the string is returned.  There is only one 
  618.      memory location for the ctime() and asctime() results, a call to ctime() 
  619.      or asctime() overwrites the result of a previous calls to ctime() or 
  620.      asctime().  As localtime() is called by ctime(), the memory location 
  621.      shared by localtime(), gmtime(), and mktime() is overwritten.  The string 
  622.      looks like 
  623.  
  624.               "Sun Mar 22 22:59:18 1992\n"
  625.  
  626.      with a terminating 0.  All fields have fixed width. 
  627.  
  628.      See also: asctime() 
  629.  
  630.  
  631. ΓòÉΓòÉΓòÉ 5. function d ΓòÉΓòÉΓòÉ
  632.  
  633. This sections documents functions starting with the letter d 
  634.  
  635.  
  636. ΓòÉΓòÉΓòÉ 5.1. _defext() ΓòÉΓòÉΓòÉ
  637.  
  638. #include <stdlib.h>                            [emx]
  639.  
  640. void _defext (char *dst, const char *ext);
  641.  
  642.      Add the default extension EXT to the file name DST.  If the file name part 
  643.      of DST contains an extension (including the empty extension), nothing will 
  644.      be done.  Otherwise, a dot and EXT will be appended. 
  645.  
  646.      See also: _getext() , _remext() , _splitpath() 
  647.  
  648.  
  649. ΓòÉΓòÉΓòÉ 5.2. difftime() ΓòÉΓòÉΓòÉ
  650.  
  651. #include <time.h>                            [ANSI]
  652.  
  653. double difftime (time_t t1, time_t t0);
  654.  
  655.      Return the difference (in seconds) T1-T0 between T0 and T1. 
  656.  
  657.  
  658. ΓòÉΓòÉΓòÉ 5.3. div() ΓòÉΓòÉΓòÉ
  659.  
  660. #include <stdlib.h>                           [ANSI]
  661.  
  662. div_t div (int num, int den);
  663. ldiv_t ldiv (long num, long den);
  664.  
  665.      Perform an integer division, dividing NUM by DEN.  The quotient and the 
  666.      remainder are returned in the quot and rem fields, respectively. 
  667.  
  668.      The following table shows the signs of quot and rem depending on the signs 
  669.      of NUM and DEN: 
  670.  
  671.           ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  672.           ΓöéNUM  ΓöéDEN  Γöéquot Γöérem  Γöé
  673.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  674.           Γöé+    Γöé+    Γöé+    Γöé+    Γöé
  675.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  676.           Γöé+    Γöé-    Γöé-    Γöé+    Γöé
  677.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  678.           Γöé-    Γöé+    Γöé-    Γöé-    Γöé
  679.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  680.           Γöé-    Γöé-    Γöé+    Γöé-    Γöé
  681.           ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  682.  
  683.      See also: _lldiv() , _uldiv() , _ulldiv() 
  684.  
  685.  
  686. ΓòÉΓòÉΓòÉ 5.4. _DLL_InitTerm() ΓòÉΓòÉΓòÉ
  687.  
  688.                                     [OS/2]
  689.  
  690. unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag);
  691.  
  692.      _DLL_InitTerm is the library initialization and termination function for 
  693.      dynamic link libraries.  It is called by the operating system to 
  694.      initialize the library (if FLAG is zero) or to terminate the library (if 
  695.      FLAG is one).  MOD_HANDLE is the module handle of the dynamic link 
  696.      library.  _DLL_InitTerm() should return 1 to indicate success.  On 
  697.      failure, 0 should be returned.  The default _DLL_InitTerm() function does 
  698.      nothing but returning 1.  To initialize the C library, you have to write 
  699.      an _DLL_InitTerm() function which calls _CRT_init(). 
  700.  
  701.      Example: /emx/test/testdll1.c 
  702.  
  703.      See also: _CRT_init() , _CRT_term() 
  704.  
  705.  
  706. ΓòÉΓòÉΓòÉ 5.5. _dt_free() ΓòÉΓòÉΓòÉ
  707.  
  708. #include <sys/dirtree.h>                         [emx]
  709.  
  710. void _dt_free (struct _dt_tree *dt);
  711.  
  712.      Deallocate the memory allocated by _dt_read() for the directory tree DT. 
  713.  
  714.      See also: _dt_read() 
  715.  
  716.  
  717. ΓòÉΓòÉΓòÉ 5.6. _dt_read() ΓòÉΓòÉΓòÉ
  718.  
  719. #include <sys/dirtree.h>                         [emx]
  720.  
  721. struct _dt_tree *_dt_read (const char *dir, const char *mask, unsigned flags);
  722.  
  723.      Create a directory tree in memory.  The tree consists of a linked list of 
  724.      _dt_node structures.  Subtrees are attached to the SUB field of _dt_node 
  725.      structures for directories.  Files matching MASK in the directory DIR are 
  726.      put into the tree.  If FLAGS includes _DT_TREE, all subdirectories of DIR 
  727.      are also scanned for files and directories matching MASK.  If _DT_TREE is 
  728.      not included, the subdirectories of DIR are not scanned.  If FLAGS 
  729.      includes _DT_NOCPDIR, the `.' and `..' entries are omitted.  If 
  730.      successful, _dt_read() returns a pointer to a _dt_tree structure.  The 
  731.      TREE field of that structure is the root of the tree.  On error, the errno 
  732.      variable is set and NULL is returned. 
  733.  
  734.      _fnlwr() is used to convert file names to lower case on upper-case-only 
  735.      file systems. 
  736.  
  737.      Example: /emx/test/dttest.c 
  738.  
  739.      See also: _dt_free() , _dt_sort() , _dt_split() , _fnlwr() , _fnexplode() 
  740.  
  741.  
  742. ΓòÉΓòÉΓòÉ 5.7. _dt_sort() ΓòÉΓòÉΓòÉ
  743.  
  744. #include <sys/dirtree.h>                         [emx]
  745.  
  746. void _dt_sort (struct _dt_tree *dt, const char *spec);
  747.  
  748.      Sort the directory tree DT according to SPEC.  DT is a directory tree 
  749.      created by _dt_read().  SPEC is a string of characters which is read from 
  750.      left to right.  Each character tells _dt_sort() how to compare two tree 
  751.      nodes.  If the nodes compare equal, the next character is examined.  This 
  752.      is repeated until the two nodes are different according to the sorting 
  753.      criterion indicated by a character of SPEC or the end of the SPEC string 
  754.      is reached.  If the end of the SPEC string is reached, the two nodes are 
  755.      considered equal and the two nodes are put in an arbitrary order. The 
  756.      following characters of SPEC are defined: 
  757.  
  758.      e         File name extensions are compared, ascending ASCII order 
  759.  
  760.      E         File name extensions are compared, descending ASCII order 
  761.  
  762.      f         Directories are placed before files 
  763.  
  764.      F         Files are placed before directories 
  765.  
  766.      n         File names are compared, ascending ASCII order 
  767.  
  768.      N         File names are compared, descending ASCII order 
  769.  
  770.      s         File size is compared, ascending 
  771.  
  772.      S         File size is compared, descending 
  773.  
  774.      t         Time stamps (last modification) are compared, ascending 
  775.  
  776.      T         Time stamps (last modification) are compared, descending 
  777.  
  778.      All other characters are ignored.  _fncmp() is used for comparing file 
  779.      names.  If _fncmp() returns 0, strcmp() is used in addition. strcmp() can 
  780.      return a non-zero value only if the current code page doesn't match the 
  781.      code page used when creating the directory entries. 
  782.  
  783.      See also: _dt_read() , _fncmp() 
  784.  
  785.  
  786. ΓòÉΓòÉΓòÉ 5.8. _dt_split() ΓòÉΓòÉΓòÉ
  787.  
  788. #include <sys/dirtree.h>                         [emx]
  789.  
  790. int _dt_split (const char *src, char *dir, char *mask);
  791.  
  792.      Split the path name SRC into a directory part and a name part for 
  793.      _dt_read().  The directory part is stored to DIR, the name part is stored 
  794.      to MASK.  If SRC is a directory, MASK is set to "*". 
  795.  
  796.      See also: _dt_read() 
  797.  
  798.  
  799. ΓòÉΓòÉΓòÉ 5.9. dup() ΓòÉΓòÉΓòÉ
  800.  
  801. #include <io.h>                             [UNIX]
  802.  
  803. int dup (int handle);
  804. int dup2 (int handle1, int handle2);
  805.  
  806.      Create a duplicate of the file handle HANDLE or HANDLE1, respectively, 
  807.      that is, another handle that refers to the same file or device or pipe as 
  808.      the handle given.  Both handles share the same file pointer.  dup() 
  809.      chooses the lowest numbered available handle.  dup2() uses HANDLE2 for the 
  810.      new file handle.  If HANDLE2 is open when dup2() is called, it is closed 
  811.      by dup2().  If there is an error, -1 is returned.  Otherwise, the new file 
  812.      handle is returned. 
  813.  
  814.      Restriction: dup2() currently doesn't work correctly under DOS. 
  815.  
  816.      See also: close() , fcntl() , open() 
  817.  
  818.  
  819. ΓòÉΓòÉΓòÉ 5.10. dup2() ΓòÉΓòÉΓòÉ
  820.  
  821.  
  822. ΓòÉΓòÉΓòÉ 6. function e ΓòÉΓòÉΓòÉ
  823.  
  824. This sections documents functions starting with the letter e 
  825.  
  826.  
  827. ΓòÉΓòÉΓòÉ 6.1. _ea_free() ΓòÉΓòÉΓòÉ
  828.  
  829. #include <sys/ea.h>                            [emx]
  830.  
  831. void _ea_free (struct _ea *ptr);
  832.  
  833.      Free the memory allocated for the value of an extended attribute stored in 
  834.      the structure pointed to by PTR.  If the VALUE field of the structure is 
  835.      non-NULL, free() is called for that pointer. Then, the VALUE field is set 
  836.      to NULL. 
  837.  
  838.      See also: _ea_get() 
  839.  
  840.  
  841. ΓòÉΓòÉΓòÉ 6.2. _ea_get() ΓòÉΓòÉΓòÉ
  842.  
  843. #include <sys/ea.h>                            [emx]
  844.  
  845. int _ea_get (struct _ea *dst, const char *path, int handle,
  846.        const char *name);
  847.  
  848.      Retrieve the extended attribute NAME of a file or directory.  If PATH is 
  849.      non-NULL, an extended attribute of the file or directory named by PATH is 
  850.      retrieved.  Otherwise, an extended attribute of the file referred to by 
  851.      HANDLE is retrieved.  The letter case of NAME is ignored.  The flags, the 
  852.      value and the size of the value of the extended attribute is copied to 
  853.      DST.  If there is an error, errno is set and -1 is returned.  Otherwise, 0 
  854.      is returned.  If the extended attribute NAME does not exist, 0 is 
  855.      returned, the SIZE field of DST is set to 0 and the VALUE field of DST is 
  856.      set to NULL.  _ea_get() allocates memory for the value of the extended 
  857.      attribute by calling malloc().  The structure declaration is: 
  858.  
  859.               struct _ea
  860.               {
  861.                 int flags;
  862.                 int size;
  863.                 void *value;
  864.               };
  865.  
  866.      The FLAGS field contains the flags byte of the extended attribute (only 
  867.      bits 0 through 7 of FLAGS are used).  Currently, OS/2 defines only bit 7: 
  868.      it's set for critical EAs.  SIZE is the length of the value in bytes.  The 
  869.      VALUE field points to the (binary) value of the extended attribute. 
  870.  
  871.      Use _ead_read() to retrieve all the extended attributes of a file or 
  872.      directory. 
  873.  
  874.      See also: _ea_free() , _ea_put() , _ead_read() 
  875.  
  876.  
  877. ΓòÉΓòÉΓòÉ 6.3. _ea_put() ΓòÉΓòÉΓòÉ
  878.  
  879. #include <sys/ea.h>                            [emx]
  880.  
  881. int _ea_put (struct _ea *src, const char *path, int handle,
  882.        const char *name);
  883.  
  884.      Add an extended attribute to a file or directory.  If PATH is non-NULL, 
  885.      the extended attribute is added to the file or directory named by PATH. 
  886.      Otherwise, the extended attribute is added to the file referred to by 
  887.      HANDLE which must be open for writing.  NAME is the name of the extended 
  888.      attribute.  The letter case of NAME is ignored.  SRC points to an _ea 
  889.      structure which holds the flags, size and value of the extended attribute 
  890.      to be added.  If the SIZE field is 0, the extended attribute is removed. 
  891.      Bits 0 though 7 of FLAGS contain the flags byte for the extended 
  892.      attribute. Currently, OS/2 defines only bit: it's the critical EA bit. 
  893.      The FLAGS field should be zero unless you exactly know what you're doing. 
  894.      If there is an error, errno is set and -1 is returned. Otherwise, 0 is 
  895.      returned. 
  896.  
  897.      Use _ead_write() to replace or update multiple extended attributes at 
  898.      once. 
  899.  
  900.      See also: _ea_get() , _ea_remove() , _ead_write() 
  901.  
  902.  
  903. ΓòÉΓòÉΓòÉ 6.4. _ea_remove() ΓòÉΓòÉΓòÉ
  904.  
  905. #include <sys/ea.h>                            [emx]
  906.  
  907. int _ea_remove (const char *path, int handle, const char *name);
  908.  
  909.      Remove the extended attribute named NAME from a file or directory. If PATH 
  910.      is non-NULL, the extended attribute is removed from the file or directory 
  911.      named by PATH.  Otherwise, the extended attribute is removed from the file 
  912.      referred to by HANDLE.  The letter case of NAME is ignored.  If there is 
  913.      an error, errno is set and -1 is returned.  Otherwise, 0 is returned. 
  914.      Removing a non-existing extended attribute of an existing file or 
  915.      directory is not an error. 
  916.  
  917.      See also: _ea_put() , _ead_write() 
  918.  
  919.  
  920. ΓòÉΓòÉΓòÉ 6.5. _ead_add() ΓòÉΓòÉΓòÉ
  921.  
  922. #include <sys/ead.h>                           [emx]
  923.  
  924. int _ead_add (_ead ead, const char *name, int flags, const void *value,
  925.        int size);
  926.  
  927.      Add the extended attribute NAME to the extended attributes descriptor EAD. 
  928.      NAME should be a null-terminated string.  The value of the extended 
  929.      attribute is set to SIZE bytes of VALUE. The flags byte of the extended 
  930.      attribute is set to FLAGS.  Only bits 0 through 7 of FLAGS are used. 
  931.      Currently, OS/2 defines only bit 7 of the flags byte: it's the critical EA 
  932.      bit.  FLAGS should be zero unless you exactly know what you're doing.  If 
  933.      an extended attribute named NAME already exists in EAD, it is updated with 
  934.      FLAGS, SIZE and VALUE.  If there is an error, errno is set and a negative 
  935.      value is returned.  On success, the index of the new (or updated) extended 
  936.      attribute is returned.  The extended attributes on disk are not affected. 
  937.      After calling _ead_add(), the pointers returned by previous invocations of 
  938.      _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid. 
  939.      As _ead_add() does a case-sensitive search, you should pass an upper-case 
  940.      names in NAME.  If there are two extended attributes in an extended 
  941.      attributes descriptor whose names differ only in letter case, only one of 
  942.      both will be written to the disk by _ead_write(). 
  943.  
  944.      See also: _ead_delete() , _ead_replace() , _ead_write() , _nls_strupr() 
  945.  
  946.  
  947. ΓòÉΓòÉΓòÉ 6.6. _ead_clear() ΓòÉΓòÉΓòÉ
  948.  
  949. #include <sys/ead.h>                           [emx]
  950.  
  951. _ead _ead_clear (_ead ead);
  952.  
  953.      Discard the extended attributes of the extended attributes descriptor EAD. 
  954.      After calling _ead_clear(), _ead_count() will return 0 for EAD.  The 
  955.      extended attributes on disk are not modified.  After calling _ead_clear(), 
  956.      do not use pointers returned by _ead_get_name(), _ead_get_value() and 
  957.      _ead_get_fea2list() for that descriptor. 
  958.  
  959.      See also: _ead_create() , _ead_destroy() , _ead_read() 
  960.  
  961.  
  962. ΓòÉΓòÉΓòÉ 6.7. _ead_copy() ΓòÉΓòÉΓòÉ
  963.  
  964. #include <sys/ead.h>                           [emx]
  965.  
  966. int _ead_copy (_ead dst_ead, _ead src_ead, int src_index);
  967.  
  968.      Copy the extended attribute SRC_INDEX from the extended attributes 
  969.      descriptor SRC_EAD to the extended attributes descriptor DST_EAD. If 
  970.      SRC_INDEX is 0, all extended attributes of SRC_EAD are copied to DST_EAD. 
  971.      Otherwise, SRC_INDEX must be a number between 1 and the number of extended 
  972.      attributes of SRC_EAD.  _ead_copy() uses _ead_add() to copy the extended 
  973.      attributes.  The extended attributes on disk are not affected. 
  974.  
  975.      See also: _ead_add() 
  976.  
  977.  
  978. ΓòÉΓòÉΓòÉ 6.8. _ead_count() ΓòÉΓòÉΓòÉ
  979.  
  980. #include <sys/ead.h>                           [emx]
  981.  
  982. int _ead_count (_ead ead);
  983.  
  984.      Return the number of extended attributes available from the extended 
  985.      attributes descriptor EAD. 
  986.  
  987.      See also: _ead_create() , _ead_get_name() , _ead_get_value() 
  988.  
  989.  
  990. ΓòÉΓòÉΓòÉ 6.9. _ead_create() ΓòÉΓòÉΓòÉ
  991.  
  992. #include <sys/ead.h>                           [emx]
  993.  
  994. _ead _ead_create (void)
  995.  
  996.      Create an extended attributes descriptor.  Such a descriptor is used for 
  997.      handling the extended attributes of files and directories.  If successful, 
  998.      _ead_create() returns a descriptor which can be used by the other 
  999.      functions for handling extended attributes.  Otherwise, errno is set and 
  1000.      NULL is returned.  Use _ead_destroy() if you no longer need the 
  1001.      descriptor.  To copy all the extended attributes of a file or a directory 
  1002.      to an extended attributes descriptor, use _ead_read().  Initially, no 
  1003.      extended attributes are held by an extended attributes descriptor. 
  1004.  
  1005.      Example: /emx/test/eatool.c 
  1006.  
  1007.      See also: _ead_destroy() , _ead_get_name() , _ead_get_value() , 
  1008.      _ead_read() 
  1009.  
  1010.  
  1011. ΓòÉΓòÉΓòÉ 6.10. _ead_delete() ΓòÉΓòÉΓòÉ
  1012.  
  1013. #include <sys/ead.h>                           [emx]
  1014.  
  1015. int _ead_delete (_ead ead, int index);
  1016.  
  1017.      Delete the extended attribute INDEX from the extended attributes 
  1018.      descriptor EAD.  INDEX must be a number between 1 and the number of 
  1019.      extended attributes of EAD.  If successful, this function returns 0. 
  1020.      Otherwise, errno is set and a negative number is returned.  After calling 
  1021.      _ead_delete(), the pointers returned by previous invocations of 
  1022.      _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid. 
  1023.      Moreover, _ead_delete() invalidates index numbers. 
  1024.  
  1025.      See also: _ead_add() , _ead_find() 
  1026.  
  1027.  
  1028. ΓòÉΓòÉΓòÉ 6.11. _ead_destroy() ΓòÉΓòÉΓòÉ
  1029.  
  1030. #include <sys/ead.h>                           [emx]
  1031.  
  1032. void _ead_destroy (_ead ead);
  1033.  
  1034.      Invalidate the extended attributes descriptor EAD which has been created 
  1035.      by _ead_create().  All memory associated with EAD is released.  EAD must 
  1036.      not be NULL.  After calling _ead_destroy(), EAD is invalid and can no 
  1037.      longer be used.  After calling _ead_destroy(), do not use pointers 
  1038.      returned by _ead_get_name(), _ead_get_value() and _ead_get_fea2list() for 
  1039.      that descriptor. 
  1040.  
  1041.      See also: _ead_clear() , _ead_create() 
  1042.  
  1043.  
  1044. ΓòÉΓòÉΓòÉ 6.12. _ead_fea2list_size() ΓòÉΓòÉΓòÉ
  1045.  
  1046. #include <sys/ead.h>                           [emx]
  1047.  
  1048. int _ead_fea2list_size (_ead ead);
  1049.  
  1050.      Return the size of the FEA2LIST of the extended attributes descriptor EAD. 
  1051.      If EAD doesn't hold any extended attributes, 0 is returned. 
  1052.  
  1053.      See also: _ead_get_fea2list() 
  1054.  
  1055.  
  1056. ΓòÉΓòÉΓòÉ 6.13. _ead_fea2list_to_fealist() ΓòÉΓòÉΓòÉ
  1057.  
  1058. #include <sys/ead.h>                           [emx]
  1059.  
  1060. void *_ead_fea2list_to_fealist (const void *src);
  1061.  
  1062.      Convert the FEA2LIST SRC (OS/2 2.0 format) to a FEALIST (OS/2 1.2 format). 
  1063.      SRC must not be NULL.  This function allocates memory with malloc() to 
  1064.      hold the converted list.  A pointer to the converted list is returned.  If 
  1065.      you no longer need the buffer allocated by this function, you should 
  1066.      deallocate it with free(). If there is an error, errno is set and NULL is 
  1067.      returned.  SRC is of type PFEA2LIST, the return value is of type PFEALIST. 
  1068.      To avoid having to include os2.h when including ead.h, void pointers are 
  1069.      used instead. 
  1070.  
  1071.      See also: _ead_fealist_to_fea2list() , _ead_get_fea2list() 
  1072.  
  1073.  
  1074. ΓòÉΓòÉΓòÉ 6.14. _ead_fealist_to_fea2list() ΓòÉΓòÉΓòÉ
  1075.  
  1076. #include <sys/ead.h>                           [emx]
  1077.  
  1078. void *_ead_fealist_to_fea2list (const void *src);
  1079.  
  1080.      Convert the FEALIST SRC (OS/2 1.2 format) to a FEA2LIST (OS/2 2.0 format). 
  1081.      SRC must not be NULL.  This function allocates memory with malloc() to 
  1082.      hold the converted list.  A pointer to the converted list is returned.  If 
  1083.      you no longer need the buffer allocated by this function, you should 
  1084.      deallocate it with free(). If there is an error, errno is set and NULL is 
  1085.      returned.  SRC is of type PFEALIST, the return value is of type PFEA2LIST. 
  1086.      To avoid having to include os2.h when including ead.h, void pointers are 
  1087.      used instead. 
  1088.  
  1089.      See also: _ead_fea2list_to_fealist() 
  1090.  
  1091.  
  1092. ΓòÉΓòÉΓòÉ 6.15. _ead_find() ΓòÉΓòÉΓòÉ
  1093.  
  1094. #include <sys/ead.h>                           [emx]
  1095.  
  1096. int _ead_find (_ead ead, const char *name);
  1097.  
  1098.      Return the index of the extended attribute named NAME of the extended 
  1099.      attributes descriptor EAD.  NAME should be a null-terminated string.  If 
  1100.      there is no such extended attribute, errno is set to ENOENT and -1 is 
  1101.      returned.  Otherwise, a number between 1 and the number of extended 
  1102.      attributes of EAD is returned.  Note that OS/2 converts names of extended 
  1103.      attributes to upper case when writing them to the disk.  As _ead_find() 
  1104.      does a case-sensitive compare, lower-case names are not found. 
  1105.  
  1106.      See also: _ead_count() , _ead_get_name() , _ead_get_value() , 
  1107.      _nls_strupr() 
  1108.  
  1109.  
  1110. ΓòÉΓòÉΓòÉ 6.16. _ead_get_fea2list() ΓòÉΓòÉΓòÉ
  1111.  
  1112. #include <sys/ead.h>                           [emx]
  1113.  
  1114. const void *_ead_get_fea2list (_ead ead);
  1115.  
  1116.      Return a pointer to the FEA2LIST of the extended attributes descriptor 
  1117.      EAD.  You should cast the return value to PFEA2LIST. The return type of 
  1118.      _ead_get_fea2list() is not PFEA2LIST to be able to include ead.h without 
  1119.      having to include os2.h.  The pointer points to memory allocated by the 
  1120.      extended attributes functions -- do not use the pointer after calling 
  1121.      _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(), _ead_destroy() or 
  1122.      _ead_replace() and do not write to the buffer. 
  1123.  
  1124.      See also: _ead_fea2list_size() , _ead_fea2list_to_fealist() 
  1125.  
  1126.  
  1127. ΓòÉΓòÉΓòÉ 6.17. _ead_get_flags() ΓòÉΓòÉΓòÉ
  1128.  
  1129. #include <sys/ead.h>                           [emx]
  1130.  
  1131. int _ead_get_flags (_ead ead, int index);
  1132.  
  1133.      Return the flags byte of the extended attribute INDEX of the extended 
  1134.      attributes descriptor EAD.  INDEX must be a number between 1 and the 
  1135.      number of extended attributes of EAD.  On error, errno is set and -1 is 
  1136.      returned. 
  1137.  
  1138.      See also: _ead_count() , _ead_get_value() 
  1139.  
  1140.  
  1141. ΓòÉΓòÉΓòÉ 6.18. _ead_get_name() ΓòÉΓòÉΓòÉ
  1142.  
  1143. #include <sys/ead.h>                           [emx]
  1144.  
  1145. const char *_ead_get_name (_ead ead, int index);
  1146.  
  1147.      Return a pointer to the name of the extended attribute INDEX of the 
  1148.      extended attributes descriptor EAD.  INDEX must be a number between 1 and 
  1149.      the number of extended attributes of EAD.  The pointer points to memory 
  1150.      allocated by the extended attributes functions -- do not use the pointer 
  1151.      after calling _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(), 
  1152.      _ead_destroy() or _ead_replace() and do not write to the buffer.  On 
  1153.      error, errno is set and NULL is returned. 
  1154.  
  1155.      See also: _ead_count() , _ead_name_len() 
  1156.  
  1157.  
  1158. ΓòÉΓòÉΓòÉ 6.19. _ead_get_value() ΓòÉΓòÉΓòÉ
  1159.  
  1160. #include <sys/ead.h>                           [emx]
  1161.  
  1162. const void *_ead_get_value (_ead ead, int index);
  1163.  
  1164.      Return a pointer to the value of the extended attribute INDEX of the 
  1165.      extended attributes descriptor EAD.  INDEX must be a number between 1 and 
  1166.      the number of extended attributes of EAD.  The pointer points to memory 
  1167.      allocated by the extended attributes functions -- do not use the pointer 
  1168.      after calling _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(), 
  1169.      _ead_destroy() or _ead_replace() and do not write to the buffer.  On 
  1170.      error, errno is set and NULL is returned. 
  1171.  
  1172.      See also: _ead_count() , _ead_find() , _ead_get_flags() , 
  1173.      _ead_value_size() 
  1174.  
  1175.  
  1176. ΓòÉΓòÉΓòÉ 6.20. _ead_name_len() ΓòÉΓòÉΓòÉ
  1177.  
  1178. #include <sys/ead.h>                           [emx]
  1179.  
  1180. int _ead_name_len (_ead ead, int index);
  1181.  
  1182.      Return the length of the name of the extended attribute INDEX of the 
  1183.      extended attributes descriptor EAD.  If INDEX is 0, the total length of 
  1184.      all the names is returned, not including the terminating null characters. 
  1185.      Otherwise, INDEX must be a number between 1 and the number of extended 
  1186.      attributes of EAD; the length of the name of the INDEXth extended 
  1187.      attribute is returned.  The terminating null character is not included in 
  1188.      the length.  On error, errno is set and -1 is returned. 
  1189.  
  1190.      See also: _ead_count() , _ead_get_name() 
  1191.  
  1192.  
  1193. ΓòÉΓòÉΓòÉ 6.21. _ead_read() ΓòÉΓòÉΓòÉ
  1194.  
  1195. #include <sys/ead.h>                           [emx]
  1196.  
  1197. _ead _ead_read (_ead ead, const char *path, int handle, int flags);
  1198.  
  1199.      Copy the extended attributes of a file or directory to the extended 
  1200.      attributes descriptor EAD.  The extended attributes held previously by EAD 
  1201.      are discarded.  If PATH is not NULL, the extended attributes of that path 
  1202.      name (file or directory) are copied to EAD.  If PATH is NULL, the extended 
  1203.      attributes of the file referred to by the file handle HANDLE are copied to 
  1204.      EAD. FLAGS is not yet used and must be 0.  If successful, _ead_read() 
  1205.      returns zero.  Otherwise, errno is set and a negative number is returned. 
  1206.      _ead_read() calls _ead_clear(), reads all the extended attributes and 
  1207.      stores them in memory.  Use _ead_destroy() to deallocate that memory and 
  1208.      invalidate EAD.  When using a non-NULL PATH, _ead_read() does not lock the 
  1209.      file while while reading the extended attributes.  You might want to open 
  1210.      a handle in deny-write mode and pass it in HANDLE to avoid problems due to 
  1211.      other threads or processes modifying the extended attributes while 
  1212.      _ead_read() is reading.  This doesn't work with and isn't required for 
  1213.      directories.  _ead_read() can also be used under DOS though no extended 
  1214.      attributes will be copied.  Therefore, your program doesn't have to decide 
  1215.      whether to use these functions or not. 
  1216.  
  1217.      Use _ea_get() to retrieve extended attributes one by one. 
  1218.  
  1219.      See also: _ea_get() , _ead_create() , _ead_destroy() , _ead_get_name() 
  1220.      _ead_get_value() 
  1221.  
  1222.  
  1223. ΓòÉΓòÉΓòÉ 6.22. _ead_replace() ΓòÉΓòÉΓòÉ
  1224.  
  1225. #include <sys/ead.h>                           [emx]
  1226.  
  1227. int _ead_replace (_ead ead, int index, int flags, const void *value, int size);
  1228.  
  1229.      Update the extended attribute INDEX of the extended attributes descriptor 
  1230.      EAD with FLAGS and SIZE bytes of VALUE.  INDEX must be a number between 1 
  1231.      and the number of extended attributes of EAD. On success, _ead_replace() 
  1232.      returns 0.  On error, errno is set and a negative value is returned.  The 
  1233.      extended attributes on disk are not affected.  After calling 
  1234.      _ead_replace(), the pointers returned by previous invocations of 
  1235.      _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid. 
  1236.  
  1237.      See also: _ead_add() , _ead_write() 
  1238.  
  1239.  
  1240. ΓòÉΓòÉΓòÉ 6.23. _ead_sort() ΓòÉΓòÉΓòÉ
  1241.  
  1242. #include <sys/ead.h>                           [emx]
  1243.  
  1244. void _ead_sort (_ead ead);
  1245.  
  1246.      Sort by name the extended attributes of the extended attributes descriptor 
  1247.      EAD.  Sorting is done in memory -- the extended attributes on disk are not 
  1248.      affected.  After calling _ead_sort(), index 1 refers to the extended 
  1249.      attribute with the lexically smallest name.  strcmp() is used for 
  1250.      comparing names.  _ead_sort() sorts the index, not the extended attributes 
  1251.      proper.  Therefore, all functions that modify the extended attributes of 
  1252.      EAD undo the effect of _ead_sort(). 
  1253.  
  1254.      See also: _ead_create() , _ead_get_name() , _ead_read() 
  1255.  
  1256.  
  1257. ΓòÉΓòÉΓòÉ 6.24. _ead_use_fea2list() ΓòÉΓòÉΓòÉ
  1258.  
  1259. #include <sys/ead.h>                           [emx]
  1260.  
  1261. int _ead_use_fea2list (_ead ead, const void *src);
  1262.  
  1263.      Copy all the extended attributes from the FEA2LIST SRC (OS/2 2.0 format) 
  1264.      to the extended attributes descriptor EAD.  All extended attributes 
  1265.      previously held by EAD are discarded.  The extended attributes on the disk 
  1266.      are not affected.  If successful, _ead_use_fea2list() returns 0. 
  1267.      Otherwise, errno is set and a negative value is returned. 
  1268.  
  1269.      See also: _ead_write() 
  1270.  
  1271.  
  1272. ΓòÉΓòÉΓòÉ 6.25. _ead_value_size() ΓòÉΓòÉΓòÉ
  1273.  
  1274. #include <sys/ead.h>                           [emx]
  1275.  
  1276. int _ead_value_size (_ead ead, int index);
  1277.  
  1278.      Return the size of the extended attribute INDEX of the extended attributes 
  1279.      descriptor EAD.  If INDEX is 0, the total size of all the values of EAD is 
  1280.      returned.  Otherwise, INDEX must be a number between 1 and the number of 
  1281.      extended attributes of EAD; the size of the INDEXth extended attribute is 
  1282.      returned.  On error, errno is set and -1 is returned. 
  1283.  
  1284.      See also: _ead_count() , _ead_get_value() 
  1285.  
  1286.  
  1287. ΓòÉΓòÉΓòÉ 6.26. _ead_write() ΓòÉΓòÉΓòÉ
  1288.  
  1289. #include <sys/ead.h>                           [emx]
  1290.  
  1291. int _ead_write (_ead ead, const char *path, int handle, int flags);
  1292.  
  1293.      Write all the extended attributes of the extended attributes descriptor 
  1294.      EAD to the file or directory PATH or HANDLE.  The extended attributes 
  1295.      previously attached to that file or directory are discarded and replaced 
  1296.      by the extended attributes of EAD if FLAGS is 0.  This is done by deleting 
  1297.      the extended attributes of the file or directory which are not in EAD.  If 
  1298.      FLAGS is _EAD_MERGE, the extended attributes of the file or directory 
  1299.      which are also present in EAD are replaced by those of EAD.  Extended 
  1300.      attributes of EAD which are not attached to the file or directory are 
  1301.      added to the extended attributes of the file or directory.  If PATH is 
  1302.      non-NULL, the extended attributes are written to the file or directory 
  1303.      specified by the path name PATH.  If PATH is NULL, the extended attributes 
  1304.      are written to the file referred to by the file handle HANDLE.  The 
  1305.      extended attributes of EAD are not modified.  If _ead_write() is 
  1306.      successful, 0 is returned. Otherwise, errno is set and a negative value is 
  1307.      returned.  Under DOS, _ead_write() does nothing and always returns 0. 
  1308.  
  1309.      Use _ea_put() to add or update extended attributes one by one. 
  1310.  
  1311.      See also: _ea_put() , _ead_clear() , _ead_read() , _ead_use_fea2list() 
  1312.  
  1313.  
  1314. ΓòÉΓòÉΓòÉ 6.27. _emx_16to32() ΓòÉΓòÉΓòÉ
  1315.  
  1316. #include <os2.h>                             [emx]
  1317.  
  1318. void *_emx_16to32 (_far16ptr ptr);
  1319. _far16ptr _emx_32to16 (void *ptr);
  1320.  
  1321.      _emx_16to32 converts a 16-bit far pointer (16:16 format) to a 32-bit flat 
  1322.      pointer. 
  1323.  
  1324.      _emx_32to16 converts a 32-bit flat pointer to a 16-bit far pointer (16:16 
  1325.      format). 
  1326.  
  1327.      The type _far16ptr is used for 16-bit far pointers. 
  1328.  
  1329.  
  1330. ΓòÉΓòÉΓòÉ 6.28. _emx_32to16() ΓòÉΓòÉΓòÉ
  1331.  
  1332.  
  1333. ΓòÉΓòÉΓòÉ 6.29. _endthread() ΓòÉΓòÉΓòÉ
  1334.  
  1335. #include <stdlib.h>                            [PC]
  1336.  
  1337. void _endthread (void);
  1338.  
  1339.      A thread that has been created by _beginthread() can call _endthread() to 
  1340.      end its execution.  A thread also ends when the function started with 
  1341.      _beginthread() returns.  Terminating the main thread (thread 1) of a 
  1342.      process terminates the process (return value will be 0).  Do not use 
  1343.      DosExit to end a thread started by _beginthread(). 
  1344.  
  1345.      _endthread() is available only when using emxlibc.dll (-Zmt). 
  1346.  
  1347.      See also: _beginthread () 
  1348.  
  1349.  
  1350. ΓòÉΓòÉΓòÉ 6.30. eof() ΓòÉΓòÉΓòÉ
  1351.  
  1352. #include <io.h>                              [PC]
  1353.  
  1354. int eof (int handle);
  1355.  
  1356.      Return 1 if the current position of HANDLE is at the end of the file, 
  1357.      return 0 otherwise.  On failure, -1 is returned. 
  1358.  
  1359.  
  1360. ΓòÉΓòÉΓòÉ 6.31. exec () ΓòÉΓòÉΓòÉ
  1361.  
  1362. #include <process.h>                           [UNIX]
  1363.  
  1364. /* exec () */
  1365.  
  1366. int execl (const char *name, const char *arg0, ...);
  1367. int execle (const char *name, const char *arg0, ...);
  1368. int execlp (const char *name, const char *arg0, ...);
  1369. int execlpe (const char *name, const char *arg0, ...);
  1370. int execv (const char *name, const char * const *argv);
  1371. int execve (const char *name, const char * const *argv,
  1372.       const char * const *envp);
  1373. int execvp (const char *name, const char * const *argv);
  1374. int execvpe(const char *name, const char * const *argv,
  1375.       const char * const *envp);
  1376.  
  1377.      Replace calling process with a new process.  The calling process 
  1378.      terminates after starting the new process.  NAME is the name of the 
  1379.      executable file to run.  Use execl(), execle(), execlp() or execlpe() for 
  1380.      passing a fixed number of arguments.  ARG0 is the 0th argument which is 
  1381.      the program name, by convention.  Following ARG0, the arguments are given. 
  1382.      After the last argument, a NULL pointer must be following.  At least ARG0 
  1383.      must be specified.  Use execv(), execve(), execvp() or execvpe() for 
  1384.      passing a variable number of arguments.  ARGV points to an array of 
  1385.      strings.  The first entry is the program name, by convention.  The last 
  1386.      argument must be followed by a NULL pointer. 
  1387.  
  1388.      execl(), execlp(), execv() and execvp() pass the environment of the 
  1389.      current process to the child process.  To pass a different environment to 
  1390.      the child process pass a pointer to an array of strings after the NULL 
  1391.      argument pointer of execle() and execlpe() or pass the pointer in the ENVP 
  1392.      argument of execve() and execvpe().  The last environment string in the 
  1393.      array must be followed by a NULL pointer. 
  1394.  
  1395.      When the new process ends, the parent process is notified by SIGCLD and 
  1396.      wait() will return the original process ID. 
  1397.  
  1398.      Return value: the return value is -1 if an error occurs.  On success, 
  1399.      these functions do not return. 
  1400.  
  1401.      Restrictions: Native DOS programs cannot be run.  The new process gets a 
  1402.      new process ID.  All signals are reset to SIG_DFL in the new process. 
  1403.  
  1404.      See also: spawn() 
  1405.  
  1406.  
  1407. ΓòÉΓòÉΓòÉ 6.32. exit() ΓòÉΓòÉΓòÉ
  1408.  
  1409. #include <stdlib.h>                           [ANSI]
  1410.  
  1411. void volatile exit (int ret);
  1412.  
  1413.      Flush streams, remove temporary files, call functions set by atexit() and 
  1414.      terminate the current process.  The return code RET is passed to the 
  1415.      parent process.  If RET is negative or greater than 255, 255 will be used 
  1416.      instead to avoid returning 0 (success) for non-zero RET due to truncation 
  1417.      to 8 bits. 
  1418.  
  1419.      See also: abort() , atexit() , _exit() 
  1420.  
  1421.  
  1422. ΓòÉΓòÉΓòÉ 6.33. _exit() ΓòÉΓòÉΓòÉ
  1423.  
  1424. #include <stdlib.h>                           [UNIX]
  1425.  
  1426. void volatile _exit (int ret);
  1427.  
  1428.      Exit without flushing streams, removing temporary files or calling 
  1429.      functions set by atexit().  The return code RET is passed to the parent 
  1430.      process.  If RET is negative or greater than 255, 255 will be used instead 
  1431.      to avoid returning 0 (success) for non-zero RET due to truncation to 8 
  1432.      bits. 
  1433.  
  1434.      See also: abort() , atexit() , exit() 
  1435.  
  1436.  
  1437. ΓòÉΓòÉΓòÉ 6.34. exp() ΓòÉΓòÉΓòÉ
  1438.  
  1439. #include <math.h>                            [ANSI]
  1440.  
  1441. double exp (double x);
  1442.  
  1443.      exp() computes the exponential function of X, e^X is returned. 
  1444.  
  1445.      On overflow, +#INF is returned and errno set to ERANGE. 
  1446.  
  1447.      See also: log() , pow() 
  1448.  
  1449.  
  1450. ΓòÉΓòÉΓòÉ 6.35. _expand() ΓòÉΓòÉΓòÉ
  1451.  
  1452. #include <stdlib.h>                            [PC]
  1453.  
  1454. void *_expand (void *mem, size_t new_size);
  1455.  
  1456.      Try to expand the memory block pointed to by MEM to the new size NEW_SIZE. 
  1457.      If the block cannot be expanded, NULL is returned. Otherwise, MEM is 
  1458.      returned.  Please do not use this function -- use realloc() instead. 
  1459.  
  1460.      See also: realloc() 
  1461.  
  1462.  
  1463. ΓòÉΓòÉΓòÉ 7. function f ΓòÉΓòÉΓòÉ
  1464.  
  1465. This sections documents functions starting with the letter f 
  1466.  
  1467.  
  1468. ΓòÉΓòÉΓòÉ 7.1. fabs() ΓòÉΓòÉΓòÉ
  1469.  
  1470. #include <math.h>                            [ANSI]
  1471.  
  1472. double fabs (double x);
  1473.  
  1474.      Return the absolute value of X: If X is negative, -X is returned. 
  1475.      Otherwise, X is returned. 
  1476.  
  1477.      See also: abs() , labs() 
  1478.  
  1479.  
  1480. ΓòÉΓòÉΓòÉ 7.2. fclose() ΓòÉΓòÉΓòÉ
  1481.  
  1482. #include <stdio.h>                            [ANSI]
  1483.  
  1484. int fclose (FILE *stream);
  1485.  
  1486.      Close the open stream STREAM.  Return 0 if successful, EOF otherwise. 
  1487.  
  1488.      See also: fcloseall() , fflush() , fopen() 
  1489.  
  1490.  
  1491. ΓòÉΓòÉΓòÉ 7.3. fcloseall() ΓòÉΓòÉΓòÉ
  1492.  
  1493. #include <stdio.h>                             [PC]
  1494.  
  1495. int fcloseall (void);
  1496.  
  1497.      Close all open streams.  Return the number streams closed or EOF if an 
  1498.      error occurs. 
  1499.  
  1500.      See also: fclose() , flushall() , fopen() 
  1501.  
  1502.  
  1503. ΓòÉΓòÉΓòÉ 7.4. fcntl() ΓòÉΓòÉΓòÉ
  1504.  
  1505. #include <fcntl.h>                          [*] [BSD]
  1506.  
  1507. int fcntl (int handle, int request, int arg);
  1508.  
  1509.      File control.  The following two REQUEST codes are implemented 
  1510.      (partially): 
  1511.  
  1512.      F_GETFL        Return the file flags of the file specified by HANDLE. 
  1513.                     Currently, only two file flags are supported by fcntl: 
  1514.                     O_APPEND and O_NDELAY. 
  1515.  
  1516.      F_SETFL        Set the file flags of the file specified by HANDLE. 
  1517.                     Currently, only two file flags are supported by fcntl: 
  1518.                     O_APPEND and O_NDELAY.  O_NDELAY has an effect only if 
  1519.                     HANDLE is 0 and HANDLE refers to the keyboard and the 
  1520.                     IDEFAULT and ICANON bits are not set.  O_NDELAY also works 
  1521.                     for pipes created by emx programs and for named pipes.  See 
  1522.                     `termio' and read(). 
  1523.  
  1524.      F_GETFD        Return close-on-exec flag in bit 0 of return value. If the 
  1525.                     bit is set, HANDLE will not be inherited by child 
  1526.                     processes. 
  1527.  
  1528.      F_SETFD        Set close-on-exec flag from bit 0 of ARG.  If the bit is 
  1529.                     set, HANDLE will not be inherited by child processes. 
  1530.  
  1531.      Restrictions: F_GETFD and F_SETFD are not implemented under DOS. When 
  1532.      using the system call library libsys.lib (-Zsys), O_NDELAY is not 
  1533.      supported. 
  1534.  
  1535.      See also: dup() , ioctl() , open() 
  1536.  
  1537.  
  1538. ΓòÉΓòÉΓòÉ 7.5. fdopen() ΓòÉΓòÉΓòÉ
  1539.  
  1540. #include <stdio.h>                            [UNIX]
  1541.  
  1542. FILE *fdopen (int handle, const char *mode);
  1543.  
  1544.      Create a stream for the low-level file handle HANDLE.  The MODE flags 
  1545.      should match the mode used for opening the file handle HANDLE.  If `b' or 
  1546.      `t' is used in MODE, the handle will be changed using setmode() to 
  1547.      O_BINARY or O_TEXT mode, respectively.  If neither `b' nor `t' is used, 
  1548.      the translation mode is not changed. You should not rely on this 
  1549.      behaviour: always specify the desired translation mode.  A future release 
  1550.      of the C library will have independent modes for low-level files and 
  1551.      streams.  If fdopen() fails, NULL is returned. 
  1552.  
  1553.      See also: fopen() , open() 
  1554.  
  1555.  
  1556. ΓòÉΓòÉΓòÉ 7.6. feof() ΓòÉΓòÉΓòÉ
  1557.  
  1558.  
  1559. ΓòÉΓòÉΓòÉ 7.7. ferror() ΓòÉΓòÉΓòÉ
  1560.  
  1561. #include <stdio.h>                            [ANSI]
  1562.  
  1563. int ferror (FILE *stream);
  1564. int feof (FILE *stream);
  1565.  
  1566.      ferror() returns a non-zero value if the error indicator of STREAM is set. 
  1567.      feof() returns a non-zero value if the end-of-file indicator of STREAM is 
  1568.      set. 
  1569.  
  1570.      See also: clearerr() 
  1571.  
  1572.  
  1573. ΓòÉΓòÉΓòÉ 7.8. fflush() ΓòÉΓòÉΓòÉ
  1574.  
  1575. #include <stdio.h>                            [ANSI]
  1576.  
  1577. int fflush (FILE *stream);
  1578.  
  1579.      Write the buffer of STREAM to its file if STREAM is open for writing. 
  1580.      Clear the buffer of STREAM if STREAM is open for reading.  The effect of 
  1581.      ungetc() is undone. 
  1582.  
  1583.      Return value: 
  1584.  
  1585.      0         success 
  1586.  
  1587.      EOF       failure 
  1588.  
  1589.      See also: fclose() 
  1590.  
  1591.  
  1592. ΓòÉΓòÉΓòÉ 7.9. ffs() ΓòÉΓòÉΓòÉ
  1593.  
  1594. #include <strings.h>                           [BSD]
  1595.  
  1596. int ffs (int i);
  1597.  
  1598.      Find the first bit set in I and return the index of that bit.  The least 
  1599.      significant bit is numbered 1, the most significant bit is numbered 32. 
  1600.      The smallest number n is returned for which bit n is set in I.  If there 
  1601.      are no bits set in I (that is, I is zero), zero is returned. 
  1602.  
  1603.  
  1604. ΓòÉΓòÉΓòÉ 7.10. fgetc() ΓòÉΓòÉΓòÉ
  1605.  
  1606. #include <stdio.h>                            [ANSI]
  1607.  
  1608. int fgetc (FILE *stream);
  1609.  
  1610.      Read a character from STREAM.  The character is returned.  If an error 
  1611.      occurs or if the end of the file is reached, EOF is returned.  fgetc() is 
  1612.      a function. 
  1613.  
  1614.      See also: fgetchar() , getc() , getchar() 
  1615.  
  1616.  
  1617. ΓòÉΓòÉΓòÉ 7.11. fgetchar() ΓòÉΓòÉΓòÉ
  1618.  
  1619. #include <stdio.h>                             [PC]
  1620.  
  1621. int fgetchar (void);
  1622.  
  1623.      Read a character from stdin, respectively.  The character is returned.  If 
  1624.      an error occurs or if the end of the file is reached, EOF is returned. 
  1625.  
  1626.               fgetchar ()
  1627.  
  1628.      is equivalent to 
  1629.  
  1630.               fgetc (stdin).
  1631.  
  1632.      fgetchar() is a function. 
  1633.  
  1634.      See also: fgetc() , getchar() 
  1635.  
  1636.  
  1637. ΓòÉΓòÉΓòÉ 7.12. fgetpos() ΓòÉΓòÉΓòÉ
  1638.  
  1639. #include <stdio.h>                            [ANSI]
  1640.  
  1641. int fgetpos (FILE *stream, fpos_t *pos);
  1642.  
  1643.      Store the current position of the file pointer of the file STREAM in the 
  1644.      variable pointed to by POS.  fgetpos() currently does not work with 
  1645.      text-mode files. 
  1646.  
  1647.      See also: fsetpos() , ftell() 
  1648.  
  1649.  
  1650. ΓòÉΓòÉΓòÉ 7.13. fgets() ΓòÉΓòÉΓòÉ
  1651.  
  1652. #include <stdio.h>                            [ANSI]
  1653.  
  1654. char *fgets (char *buffer, int n, FILE *stream);
  1655.  
  1656.      Read a string from STREAM to BUFFER.  Stop after reading N-1 characters or 
  1657.      after a newline (LF) character has been read.  A null character is 
  1658.      appended.  fgets() returns BUFFER.  If an error occurs or the end of the 
  1659.      file is reached, fgets() returns NULL. 
  1660.  
  1661.      See also: gets() , scanf() 
  1662.  
  1663.  
  1664. ΓòÉΓòÉΓòÉ 7.14. filelength() ΓòÉΓòÉΓòÉ
  1665.  
  1666. #include <io.h>                              [PC]
  1667.  
  1668. long filelength (int handle);
  1669.  
  1670.      Return the length in bytes of the file HANDLE.  If there is an error, -1 
  1671.      is returned. 
  1672.  
  1673.      See also: chsize() , ftruncate() , lseek() 
  1674.  
  1675.  
  1676. ΓòÉΓòÉΓòÉ 7.15. fileno() ΓòÉΓòÉΓòÉ
  1677.  
  1678. #include <stdio.h>                            [UNIX]
  1679.  
  1680. int fileno (FILE *stream);
  1681.  
  1682.      fileno() returns the file handle associated with STREAM. 
  1683.  
  1684.      See also: fdopen() 
  1685.  
  1686.  
  1687. ΓòÉΓòÉΓòÉ 7.16. _filesys() ΓòÉΓòÉΓòÉ
  1688.  
  1689. #include <stdlib.h>                            [emx]
  1690.  
  1691. int _filesys (const char *drive, char *name, size_t size);
  1692.  
  1693.      Copy the file system type of DRIVE to the buffer NAME.  The size of the 
  1694.      buffer is SIZE bytes.  DRIVE must point to a drive letter followed by a 
  1695.      colon.  Examples for file system types are: FAT, LAN, HPFS, CDFS, NFS. 
  1696.  
  1697.      Return value: 
  1698.  
  1699.      0         success.  The file system type has been copied to NAME. 
  1700.  
  1701.      -1        failure.  errno contains the error number. 
  1702.  
  1703.      Example: 
  1704.  
  1705.                char drive[3] = "C:";
  1706.                char fsys[16];
  1707.  
  1708.                if (_filesys (drive, fsys, sizeof (fsys)) != 0)
  1709.                  perror ("_filesys");
  1710.                else
  1711.                  printf ("File system: %s\n", fsys);
  1712.  
  1713.      Typical output of the example: 
  1714.  
  1715.                File system: FAT
  1716.  
  1717.      See also: _fnlwr() 
  1718.  
  1719.  
  1720. ΓòÉΓòÉΓòÉ 7.17. floor() ΓòÉΓòÉΓòÉ
  1721.  
  1722. #include <math.h>                            [ANSI]
  1723.  
  1724. double floor (double x);
  1725.  
  1726.      Return as floating-point number the largest integer that is less than or 
  1727.      equal to X (round down). 
  1728.  
  1729.      See also: ceil() , rint() , trunc() 
  1730.  
  1731.  
  1732. ΓòÉΓòÉΓòÉ 7.18. flushall() ΓòÉΓòÉΓòÉ
  1733.  
  1734. #include <stdio.h>                             [PC]
  1735.  
  1736. int flushall (void);
  1737.  
  1738.      Flush the buffers of all open streams.  Write the buffers of streams open 
  1739.      for writing to their files, clear the buffers of streams open for reading. 
  1740.      The number of open streams is returned. 
  1741.  
  1742.      See also: fflush() 
  1743.  
  1744.  
  1745. ΓòÉΓòÉΓòÉ 7.19. fmod() ΓòÉΓòÉΓòÉ
  1746.  
  1747. #include <math.h>                            [ANSI]
  1748.  
  1749. double fmod (double x, double y);
  1750.  
  1751.      Compute remainder of X/Y.  The return value z is calculated such that X = 
  1752.      i * Y + z, where i is an integer, z has the same sign as X and |z| < |Y|. 
  1753.      fmod (x, 0.0) returns 0.0. 
  1754.  
  1755.  
  1756. ΓòÉΓòÉΓòÉ 7.20. _fncmp() ΓòÉΓòÉΓòÉ
  1757.  
  1758. #include <stdlib.h>                            [emx]
  1759.  
  1760. int _fncmp (const unsigned char *string1, const unsigned char *string2);
  1761.  
  1762.      _fncmp() compares the two file name strings STRING1 and STRING2 and 
  1763.      returns zero if the two strings are identical after conversion to upper 
  1764.      case.  Otherwise, a non-zero value is returned which is negative if 
  1765.      STRING1 is less than STRING2 and positive if STRING1 is greater than 
  1766.      STRING2 after conversion to upper case. Conversion to upper case includes 
  1767.      accented characters etc., depending on the current country code and code 
  1768.      page.  If _nls_init() has not yet been called, it is called by _fncmp(). 
  1769.  
  1770.      See also: _nls_init() , _nls_strupr() , strcmp() 
  1771.  
  1772.  
  1773. ΓòÉΓòÉΓòÉ 7.21. _fnexplode() ΓòÉΓòÉΓòÉ
  1774.  
  1775. #include <stdlib.h>                            [emx]
  1776.  
  1777. char **_fnexplode (const char *mask);
  1778. void _fnexplodefree (char **list);
  1779.  
  1780.      Wildcard expansion of MASK.  _fnexplode() returns a vector containing 
  1781.      pointers to the file names.  The list includes directories.  Hidden and 
  1782.      system files are omitted.  The end of the list is marked by a NULL 
  1783.      pointer.  On error, NULL is returned. Memory is allocated with malloc(). 
  1784.  
  1785.      _fnlwr() is used to convert file names to lower case on upper-case-only 
  1786.      file systems. 
  1787.  
  1788.      Use _fnexplodefree() to free the memory allocated for a file name list. 
  1789.  
  1790.      Example: /emx/test/eatool.c 
  1791.  
  1792.      See also: _dt_read() , _fnlwr() , opendir() , _wildcard() 
  1793.  
  1794.  
  1795. ΓòÉΓòÉΓòÉ 7.22. _fnexplodefree() ΓòÉΓòÉΓòÉ
  1796.  
  1797.  
  1798. ΓòÉΓòÉΓòÉ 7.23. _fngetdrive() ΓòÉΓòÉΓòÉ
  1799.  
  1800. #include <stdlib.h>                            [emx]
  1801.  
  1802. char _fngetdrive (const char *src);
  1803.  
  1804.      Return as upper-case letter the drive name given in the path name SRC.  If 
  1805.      SRC does not contain a drive name, _fngetdrive() returns 0. 
  1806.  
  1807.      Example: 
  1808.  
  1809.               char *fname, drive;
  1810.  
  1811.               drive = _fngetdrive (fname);
  1812.               if (drive == 0)
  1813.                 drive = _getdrive ();
  1814.  
  1815.  
  1816. ΓòÉΓòÉΓòÉ 7.24. _fnisabs() ΓòÉΓòÉΓòÉ
  1817.  
  1818. #include <stdlib.h>                            [emx]
  1819.  
  1820. int _fnisabs (const char *name);
  1821.  
  1822.      Return a non-zero value if NAME is an absolute file name. Otherwise, 
  1823.      return 0.  Absolute file names start with \ or /, optionally preceded by a 
  1824.      drive name. 
  1825.  
  1826.      See also: _abspath() 
  1827.  
  1828.  
  1829. ΓòÉΓòÉΓòÉ 7.25. _fnlwr() ΓòÉΓòÉΓòÉ
  1830.  
  1831. #include <stdlib.h>                            [emx]
  1832.  
  1833. void _fnlwr (char *name);
  1834. void _rfnlwr (void);
  1835. void _sfnlwr (const char *name);
  1836.  
  1837.      _fnlwr() converts the file name NAME to lower case unless the file system 
  1838.      is case preserving.  Accented characters etc. are converted as well.  If 
  1839.      NAME does not contain a drive letter, it is assumed to refer to the drive 
  1840.      set by _sfnlwr().  To save time, _fnlwr() caches information about file 
  1841.      systems.  If the file system of a drive changes or if the current drive 
  1842.      changes, you should call _rfnlwr() to reset the cache.  _sfnlwr() takes 
  1843.      the drive name from NAME for future _fnlwr() calls.  If _sfnlwr() hasn't 
  1844.      been called since the last call to _rfnlwr() or if NAME does not contain a 
  1845.      drive letter, _fnlwr() uses the current drive.  If _nls_init() has not yet 
  1846.      been called, it is called by _fnlwr(). 
  1847.  
  1848.      See also: _filesys() , _nls_init() , _nls_strlwr() 
  1849.  
  1850.  
  1851. ΓòÉΓòÉΓòÉ 7.26. fopen() ΓòÉΓòÉΓòÉ
  1852.  
  1853. #include <stdio.h>                            [ANSI]
  1854.  
  1855. FILE *fopen (const char *fname, const char *mode);
  1856.  
  1857.      Open a stream.  FNAME is the name of the file, MODE is a string which 
  1858.      specifies the file mode.  The first character of MODE is `r' for reading, 
  1859.      `w' for writing or `a' for appending.  If a `+' character follows `a' or 
  1860.      `w', the file will be also opened for reading.  There are two additional 
  1861.      MODE flags: `t' for text mode, `b' for binary mode.  Text mode, which is 
  1862.      the default, skips CR characters on input and converts LF characters to 
  1863.      CR/LF pairs on output.  Ctrl-Z on input indicates EOF.  Binary mode 
  1864.      disables these transformations. 
  1865.  
  1866.      The file is opened in the sharing mode SH_DENYNO, see sopen().  If you 
  1867.      want to use a different sharing mode, use _fsopen(). 
  1868.  
  1869.      See also: fclose() , fdopen() , freopen() , _fsopen() , sopen() 
  1870.  
  1871.  
  1872. ΓòÉΓòÉΓòÉ 7.27. fork() ΓòÉΓòÉΓòÉ
  1873.  
  1874. #include <process.h>                         [*] [UNIX]
  1875.  
  1876. int fork (void);
  1877.  
  1878.      Duplicate current process.  A child process is created which is a copy of 
  1879.      the calling process.  Both the parent process and the child process resume 
  1880.      at the point where fork() was called.  The child process inherits the 
  1881.      following attributes of the parent process: 
  1882.  
  1883.         - environment 
  1884.  
  1885.         - memory 
  1886.  
  1887.         - signal settings (function address or SIG_DFL or SIG_IGN) 
  1888.  
  1889.         - file handles (unless private, see fcntl()) 
  1890.  
  1891.         - current working directories 
  1892.  
  1893.         - umask 
  1894.  
  1895.         - break points.  This is an OS/2 bug.  When debugging a program 
  1896.           containing fork(), set a breakpoint in the branch of execution that's 
  1897.           executed only in the parent process 
  1898.  
  1899.  
  1900.      The new process differs from the parent process in the following ways: 
  1901.      ;li.the child process has a unique process ID 
  1902.  
  1903.         - the child process has a different parent process ID (the process ID 
  1904.           of the parent process) 
  1905.  
  1906.         - the child process has copies of the file descriptors of the parent 
  1907.           process.  The file pointers are shared 
  1908.  
  1909.         - termio is turned off in child process 
  1910.  
  1911.         - all resources allocated using OS/2 calls are not inherited by the 
  1912.           child process: semaphores, queues, threads, memory, file handles, 
  1913.           etc. 
  1914.  
  1915.         - the alarm clock is turned off 
  1916.  
  1917.         - the CPU time (returned by clock()) is set to 0 
  1918.  
  1919.  
  1920.      When the new process terminates, SIGCLD is raised in the process which 
  1921.      forked that process. 
  1922.  
  1923.      On error, -1 is returned.  On success, the process ID of the new process 
  1924.      is returned to the calling process, 0 to the new process. 
  1925.  
  1926.      Restrictions: fork() is not implemented for DOS.  fork() works only in 
  1927.      programs linked by ld.  It does not work in programs linked by LINK386. 
  1928.      When using the system call library libsys.lib (-Zsys), fork() is not 
  1929.      available.  fork() is very inefficient for OS/2.  To start a child 
  1930.      process, use spawn() instead of fork() and exec().  Private file handles 
  1931.      (see fcntl()) are not inherited by the child process.  If the parent 
  1932.      process uses termio for the keyboard, the child process cannot read from 
  1933.      the keyboard using _read_kbd(), termio or the Kbd OS/2 API functions. 
  1934.  
  1935.      See also: alarm() , fcntl() , spawn() 
  1936.  
  1937.  
  1938. ΓòÉΓòÉΓòÉ 7.28. fprintf() ΓòÉΓòÉΓòÉ
  1939.  
  1940. #include <stdio.h>                            [ANSI]
  1941.  
  1942. int fprintf (FILE *stream, const char *format, ...);
  1943.  
  1944.      Formatted output to the stream STREAM.  On success, the number of 
  1945.      characters written to STREAM is returned.  Otherwise, EOF is returned. 
  1946.  
  1947.      See also: fscanf() , printf() 
  1948.  
  1949.  
  1950. ΓòÉΓòÉΓòÉ 7.29. fputc() ΓòÉΓòÉΓòÉ
  1951.  
  1952. #include <stdio.h>                            [ANSI]
  1953.  
  1954. int fputc (int c, FILE *stream);
  1955.  
  1956.      Write the character C to STREAM. 
  1957.  
  1958.      The character written is returned.  On failure, EOF is returned. fputc() 
  1959.      is a functions. 
  1960.  
  1961.      See also: fprintf() , fputchar() , fputs() , putc() , putchar() 
  1962.  
  1963.  
  1964. ΓòÉΓòÉΓòÉ 7.30. fputchar() ΓòÉΓòÉΓòÉ
  1965.  
  1966. #include <stdio.h>                             [PC]
  1967.  
  1968. int fputchar (int c);
  1969.  
  1970.      Write the character C to stdout. 
  1971.  
  1972.               fputchar (c)
  1973.  
  1974.      is equivalent to 
  1975.  
  1976.               fputc (c, stdout).
  1977.  
  1978.      The character written is returned.  On failure, EOF is returned. 
  1979.      fputchar() is a function. 
  1980.  
  1981.      See also: fputc() , putchar() 
  1982.  
  1983.  
  1984. ΓòÉΓòÉΓòÉ 7.31. fputs() ΓòÉΓòÉΓòÉ
  1985.  
  1986. #include <stdio.h>                            [ANSI]
  1987.  
  1988. int fputs (const char *string, FILE *stream);
  1989.  
  1990.      Write the string STRING to STREAM.  On failure, EOF is returned. 
  1991.      Otherwise, a non-negative value is returned.  In contrast to puts(), a LF 
  1992.      character is not appended automatically. 
  1993.  
  1994.      See also: fgets() , fputc() , printf() , puts() 
  1995.  
  1996.  
  1997. ΓòÉΓòÉΓòÉ 7.32. fread() ΓòÉΓòÉΓòÉ
  1998.  
  1999. #include <stdio.h>                            [ANSI]
  2000.  
  2001. size_t fread (void *buffer, size_t size, size_t count, FILE *stream);
  2002.  
  2003.      Read COUNT objects of SIZE bytes each from STREAM to BUFFER.  The file 
  2004.      pointer is incremented by the number of bytes read.  The number of 
  2005.      complete objects read is returned which may be less than COUNT, for 
  2006.      instance 0, if an error occurs or if the end of the file is reached.  Use 
  2007.      ferror() and feof() to distinguish between these two conditions.  On 
  2008.      failure, the position of the file pointer is undefined. 
  2009.  
  2010.      If STREAM has been opened in text mode, CR/LF pairs are translated to LF 
  2011.      characters.  This translation does not affect the return value -- SIZE and 
  2012.      COUNT are applied after translation. 
  2013.  
  2014.      See also: fgetc() , fgets() , fwrite() 
  2015.  
  2016.  
  2017. ΓòÉΓòÉΓòÉ 7.33. free() ΓòÉΓòÉΓòÉ
  2018.  
  2019. #include <stdlib.h>                           [ANSI]
  2020.  
  2021. void free (void *mem);
  2022.  
  2023.      Deallocate a block of memory allocated by malloc(), calloc() or realloc(). 
  2024.      MEM points to the block of memory.  MEM must have been returned by 
  2025.      malloc(), calloc() or realloc().  Do not use MEM after calling free(). 
  2026.  
  2027.      See also: calloc() , malloc() , realloc() 
  2028.  
  2029.  
  2030. ΓòÉΓòÉΓòÉ 7.34. freopen() ΓòÉΓòÉΓòÉ
  2031.  
  2032. #include <stdio.h>                            [ANSI]
  2033.  
  2034. FILE *freopen (const char *fname, const char *mode, FILE *stream);
  2035.  
  2036.      Close and reopen STREAM.  The file FNAME will be opened in mode MODE.  See 
  2037.      fopen() for details.  If successful, a pointer to the new stream is 
  2038.      returned.  Otherwise, NULL is returned. 
  2039.  
  2040.      See also: fclose() , fopen() 
  2041.  
  2042.  
  2043. ΓòÉΓòÉΓòÉ 7.35. frexp() ΓòÉΓòÉΓòÉ
  2044.  
  2045. #include <math.h>                            [ANSI]
  2046.  
  2047. double frexp (double x, int *exp_ptr);
  2048.  
  2049.      Extract mantissa and exponent of X.  The mantissa is returned, the 
  2050.      exponent, an integer, is stored to *EXP_PTR.  The following holds for the 
  2051.      mantissa m: 0.5 <= |m| < 1.0.  If X is zero, both the mantissa and the 
  2052.      exponent are 0. 
  2053.  
  2054.  
  2055. ΓòÉΓòÉΓòÉ 7.36. fscanf() ΓòÉΓòÉΓòÉ
  2056.  
  2057. #include <stdio.h>                            [ANSI]
  2058.  
  2059. int fscanf (FILE *stream, const char *format, ...);
  2060.  
  2061.      The stream STREAM is read and input is parsed according to the format 
  2062.      string FORMAT.  For each field in FORMAT there must be a pointer to the 
  2063.      location receiving the value.  The pointers are passed after the FORMAT 
  2064.      argument.  On success, the number of fields converted is returned. 
  2065.      Otherwise, EOF is returned. 
  2066.  
  2067.      See also: fprintf() , scanf() 
  2068.  
  2069.  
  2070. ΓòÉΓòÉΓòÉ 7.37. fseek() ΓòÉΓòÉΓòÉ
  2071.  
  2072. #include <stdio.h>                            [ANSI]
  2073.  
  2074. int fseek (FILE *stream, long offset, int origin);
  2075.  
  2076.      fseek() moves the file pointer of STREAM.  The new position OFFSET is 
  2077.      relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative to the 
  2078.      beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is relative to the 
  2079.      current position, if ORIGIN is SEEK_END, OFFSET is relative to the end of 
  2080.      the file.  The file pointer cannot be moved before the beginning of the 
  2081.      file.  fseek() does not work with text-mode files.  On success, 0 is 
  2082.      returned.  On error, a non-zero value is returned. 
  2083.  
  2084.      See also: fgetpos() , fsetpos() , ftell() , rewind() 
  2085.  
  2086.  
  2087. ΓòÉΓòÉΓòÉ 7.38. _fseek_hdr() ΓòÉΓòÉΓòÉ
  2088.  
  2089. #include <stdio.h>                            [emx]
  2090.  
  2091. int _fseek_hdr (FILE *stream);
  2092.  
  2093.      Move the file pointer of STREAM to the a.out header of an executable file 
  2094.      (a.out or bound .exe).  _fseek_hdr() assumes that the file pointer points 
  2095.      to the beginning of the header (ie, the beginning of the file).  If there 
  2096.      is an error, _fseek_hdr() sets errno and returns -1.  If no header is 
  2097.      found, the file pointer will be repositioned to the original position. 
  2098.  
  2099.      See also: _seek_hdr() 
  2100.  
  2101.  
  2102. ΓòÉΓòÉΓòÉ 7.39. _fsetmode() ΓòÉΓòÉΓòÉ
  2103.  
  2104. #include <stdio.h>                            [emx]
  2105.  
  2106. int _fsetmode (FILE *stream, const char *mode);
  2107.  
  2108.      Change the text/binary mode of a stream.  MODE must be either "b" or "t". 
  2109.      _fsetmode() returns 0 if successful.  Otherwise, -1 is returned. 
  2110.      _fsetmode() is usually used to put stdin or stdout to binary mode. 
  2111.  
  2112.      See also: fopen() 
  2113.  
  2114.  
  2115. ΓòÉΓòÉΓòÉ 7.40. fsetpos() ΓòÉΓòÉΓòÉ
  2116.  
  2117. #include <stdio.h>                            [ANSI]
  2118.  
  2119. int fsetpos (FILE *stream, const fpos_t *pos);
  2120.  
  2121.      Restore the position of the file pointer of the file STREAM to the 
  2122.      position saved by fgetpos() in the variable pointed to by POS. fsetpos() 
  2123.      currently does not work with text-mode files. 
  2124.  
  2125.      See also: fgetpos() , fseek() 
  2126.  
  2127.  
  2128. ΓòÉΓòÉΓòÉ 7.41. _fsopen() ΓòÉΓòÉΓòÉ
  2129.  
  2130. #include <stdio.h>                             [PC]
  2131. #include <share.h>
  2132.  
  2133. FILE *_fsopen (const char *fname, const char *mode, int shflag);
  2134.  
  2135.      Open a stream.  FNAME is the name of the file, MODE is a string which 
  2136.      specifies the file mode.  The first character of MODE is `r' for reading, 
  2137.      `w' for writing or `a' for appending.  If a `+' character follows `a' or 
  2138.      `w', the file will be also opened for reading.  There are two additional 
  2139.      MODE flags: `t' for text mode, `b' for binary mode.  Text mode, which is 
  2140.      the default, skips CR characters on input and converts LF characters to 
  2141.      CR/LF pairs on output.  Ctrl-Z on input indicates EOF.  Binary mode 
  2142.      disables these transformations. 
  2143.  
  2144.      The sharing mode of the file is given by SHFLAG.  The following sharing 
  2145.      modes are available: 
  2146.  
  2147.      SH_DENYRW      Deny read and write access 
  2148.  
  2149.      SH_DENYRD      Deny read access (permit write access) 
  2150.  
  2151.      SH_DENYWR      Deny write access (permit read access) 
  2152.  
  2153.      SH_DENYNO      Deny nothing (permit read and write access) 
  2154.  
  2155.      See also: fopen() , sopen() 
  2156.  
  2157.  
  2158. ΓòÉΓòÉΓòÉ 7.42. fstat() ΓòÉΓòÉΓòÉ
  2159.  
  2160. #include <io.h>                             [UNIX]
  2161. #include <sys/types.h>
  2162. #include <sys/stat.h>
  2163.  
  2164. int fstat (int handle, struct stat *buffer);
  2165.  
  2166.      Retrieve information about the open file HANDLE.  fstat() will put the 
  2167.      data into the structure pointed to by BUFFER. 
  2168.  
  2169.      Restrictions: st_dev and st_rdev are set to zero.  Each call to fstat() 
  2170.      returns a different value for st_ino. 
  2171.  
  2172.      See also: ioctl() , stat() 
  2173.  
  2174.  
  2175. ΓòÉΓòÉΓòÉ 7.43. fsync() ΓòÉΓòÉΓòÉ
  2176.  
  2177. #include <io.h>                              [BSD]
  2178.  
  2179. int fsync (int handle);
  2180.  
  2181.      Flush the buffers associated with HANDLE and update the directory. fsync() 
  2182.      returns 0 if successful, -1 otherwise. 
  2183.  
  2184.      Restriction: fsync() is currently not implemented for DOS: errno is set to 
  2185.      EMSDOS. 
  2186.  
  2187.  
  2188. ΓòÉΓòÉΓòÉ 7.44. ftell() ΓòÉΓòÉΓòÉ
  2189.  
  2190. #include <stdio.h>                            [ANSI]
  2191.  
  2192. long ftell (FILE *stream);
  2193.  
  2194.      ftell() returns the current position of the file pointer of STREAM.  If 
  2195.      there is an error, ftell() returns -1.  ftell() currently does not work 
  2196.      with text-mode files. 
  2197.  
  2198.      See also: fgetpos() , fseek() 
  2199.  
  2200.  
  2201. ΓòÉΓòÉΓòÉ 7.45. ftime() ΓòÉΓòÉΓòÉ
  2202.  
  2203. #include <sys/timeb.h>                          [SysV]
  2204.  
  2205. void ftime (struct timeb *ptr);
  2206.  
  2207.      Get current time and store it to the structure pointed to by PTR. That 
  2208.      structure has the following fields: 
  2209.  
  2210.      dstflag        Non-zero if daylight saving time is active for the local 
  2211.                     timezone.  Currently, this field is always 0. 
  2212.  
  2213.      millitm        Milliseconds of current time. 
  2214.  
  2215.      time           Current time in seconds since 00:00 GMT 1-Jan-1970. 
  2216.  
  2217.      timezone       Difference between GMT and local time in minutes.  Positive 
  2218.                     values are to the west of GMT. 
  2219.  
  2220.      See also: gettimeofday() , time() 
  2221.  
  2222.  
  2223. ΓòÉΓòÉΓòÉ 7.46. ftruncate() ΓòÉΓòÉΓòÉ
  2224.  
  2225. #include <io.h>                              [BSD]
  2226.  
  2227. int ftruncate (int handle, long length);
  2228.  
  2229.      Truncate the file associated with HANDLE to at most LENGTH bytes. The 
  2230.      position of the file pointer is undefined after calling this function.  If 
  2231.      LENGTH is greater than the current length of the file, the length is not 
  2232.      changed.  HANDLE must be open for writing. If successful, 0 is returned. 
  2233.      Otherwise, -1 is returned. 
  2234.  
  2235.      See also: chsize() , truncate() 
  2236.  
  2237.  
  2238. ΓòÉΓòÉΓòÉ 7.47. ftw() ΓòÉΓòÉΓòÉ
  2239.  
  2240. #include <sys/types.h>
  2241. #include <sys/stat.h>
  2242. #include <ftw.h>
  2243.  
  2244. int ftw (const char *path,
  2245.      int (*fn)(const char *name, const struct stat *stat_ptr, int flag),
  2246.      int depth);
  2247.  
  2248.      Call FN for all entries of the directory tree whose root is PATH. 
  2249.      Directories are visited before the entries they contain.  FN is not called 
  2250.      for the directories `.' and `..'.  The name of the entry is passed in 
  2251.      NAME.  Forward slashes are used to separate directories (backslashes in 
  2252.      PATH are not converted to forward slashes).  _fnlwr() is called to convert 
  2253.      the file names to lower case on upper-case-only file systems.  A structure 
  2254.      filled in by stat() is pointed to by STAT_PTR.  FLAG is one of the 
  2255.      following: 
  2256.  
  2257.      FTW_D          NAME is a directory 
  2258.  
  2259.      FTW_F          NAME is a file 
  2260.  
  2261.      FTW_NS         stat() failed, the contents of structure pointed to by 
  2262.                     STAT_PTR are undefined 
  2263.  
  2264.      FTW_DNR        NAME is an unreadable directory (does not happen under DOS 
  2265.                     and OS/2) 
  2266.  
  2267.      If FN returns 0, ftw() continues.  Otherwise, ftw() terminates and returns 
  2268.      the value returned by FN.  On error, ftw() returns -1. 
  2269.  
  2270.      The DEPTH argument is ignored by this implementation of ftw().  In other 
  2271.      implementations, DEPTH is used to restrict the number of file handles used 
  2272.      by ftw(): one file handle is required for each level.  If DEPTH is less 
  2273.      than the number of levels, ftw() will be slow. 
  2274.  
  2275.      Example: /emx/test/ftwtest.c 
  2276.  
  2277.      See also: _fnlwr() , opendir() 
  2278.  
  2279.  
  2280. ΓòÉΓòÉΓòÉ 7.48. _fullpath() ΓòÉΓòÉΓòÉ
  2281.  
  2282. #include <stdlib.h>                            [PC]
  2283.  
  2284. int _fullpath (char *dst, const char *src, int size);
  2285.  
  2286.      Construct an absolute path name for the file name or directory name SRC. 
  2287.      The absolute path name is put to DST.  It is assumed that there are SIZE 
  2288.      bytes available at DST, this includes the terminating 0 byte.  If there is 
  2289.      an error, -1 is returned.  If _fullpath() succeeds, 0 is returned.  If 
  2290.      SIZE is too small, errno is set to ERANGE and -1 is returned.  DST can be 
  2291.      identical to SRC. Backslashes are translated into forward slashes.  The 
  2292.      absolute path name is not translated to lower case. 
  2293.  
  2294.      _fullpath() accesses the appropriate drive.  It fails if a directory does 
  2295.      not exist unless the non-existing directory is the last member of the 
  2296.      resulting path name. 
  2297.  
  2298.      See also: _abspath() 
  2299.  
  2300.  
  2301. ΓòÉΓòÉΓòÉ 7.49. fwrite() ΓòÉΓòÉΓòÉ
  2302.  
  2303. #include <stdio.h>                            [ANSI]
  2304.  
  2305. size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream);
  2306.  
  2307.      Write COUNT objects of SIZE bytes each from BUFFER to STREAM.  The file 
  2308.      pointer is incremented by the number of bytes written.  The number of 
  2309.      complete objects written is returned which may be less than COUNT, for 
  2310.      instance 0, if an error occurs.  On failure, the value of the file pointer 
  2311.      is undefined.  If STREAM has been opened in text mode, LF characters are 
  2312.      translated to CR/LF pairs.  This translation does not affect the return 
  2313.      value -- SIZE and COUNT are applied before the translation. 
  2314.  
  2315.      See also: fputc() , fputs() , fread() , printf() 
  2316.  
  2317.  
  2318. ΓòÉΓòÉΓòÉ 8. function g ΓòÉΓòÉΓòÉ
  2319.  
  2320. This sections documents functions starting with the letter g 
  2321.  
  2322.  
  2323. ΓòÉΓòÉΓòÉ 8.1. g_box() ΓòÉΓòÉΓòÉ
  2324.  
  2325. #include <graph.h>                            [emx]
  2326.  
  2327. void g_box (int x0, int y0, int x1, int y1, int color, int fill_flag);
  2328.  
  2329.      Draw a box which has the four vertices (X0,Y0), (X0,Y1), (X1, Y0) AND (X1, 
  2330.      Y1).  If FILL_FLAG is G_OUTLINE, the outline is drawn, that is, four lines 
  2331.      between the vertices.  If FILL_FLAG is G_FILL, the interior of the box is 
  2332.      filled.  The color COLOR is used for drawing. 
  2333.  
  2334.      See also: g_clip() 
  2335.  
  2336.  
  2337. ΓòÉΓòÉΓòÉ 8.2. g_clear() ΓòÉΓòÉΓòÉ
  2338.  
  2339. #include <graph.h>                            [emx]
  2340.  
  2341. void g_clear (int color);
  2342.  
  2343.      Clear the screen (graphics mode, only).  All pixels are set to the color 
  2344.      COLOR.  The clipping rectangle is ignored. 
  2345.  
  2346.  
  2347. ΓòÉΓòÉΓòÉ 8.3. g_clip() ΓòÉΓòÉΓòÉ
  2348.  
  2349. #include <graph.h>                            [emx]
  2350.  
  2351. void g_clip (int x0, int y0, int x1, int y1);
  2352.  
  2353.      Define the clipping rectangle.  Only pixels with X coordinate between X0 
  2354.      and X1 (inclusive) and Y0 and with Y coordinate between X1 and Y1 
  2355.      (inclusive) are drawn.  No drawing is performed outside that clipping 
  2356.      rectangle.  After switching to graphics mode with g_mode(), the clipping 
  2357.      rectangle is set to the entire screen.  This is equivalent to calling 
  2358.  
  2359.              g_clip (0, 0, g_xsize-1, g_ysize-1)
  2360.  
  2361.      See also: g_mode() , g_xsize , g_ysize 
  2362.  
  2363.  
  2364. ΓòÉΓòÉΓòÉ 8.4. g_ellipse() ΓòÉΓòÉΓòÉ
  2365.  
  2366. #include <graph.h>                            [emx]
  2367.  
  2368. void g_ellipse (int cx, int cy, int rx, int ry, int color, int fill_flag);
  2369.  
  2370.      Draw an ellipse or a circle.  One axis is horizontal, the other one 
  2371.      vertical.  The center of the ellipse is at (CX,CY).  The horizontal radius 
  2372.      is RX, the vertical radius is RY.  It's impossible to draw an ellipse with 
  2373.      even length of an axis.  If FILL_FLAG is G_OUTLINE, the outline of the 
  2374.      ellipse is drawn.  If FILL_FLAG is G_FILL, the interior of the ellipse is 
  2375.      filled.  The color COLOR is used for drawing. 
  2376.  
  2377.      See also: g_clip() 
  2378.  
  2379.  
  2380. ΓòÉΓòÉΓòÉ 8.5. g_get() ΓòÉΓòÉΓòÉ
  2381.  
  2382. #include <graph.h>                            [emx]
  2383.  
  2384. int g_get (int x, int y);
  2385.  
  2386.      Return the color of the pixel at (X,Y).  If (X,Y) is outside the clipping 
  2387.      rectangle, -1 is returned. 
  2388.  
  2389.      See also: g_clip() , g_set() 
  2390.  
  2391.  
  2392. ΓòÉΓòÉΓòÉ 8.6. g_hline() ΓòÉΓòÉΓòÉ
  2393.  
  2394. #include <graph.h>                            [emx]
  2395.  
  2396. void g_hline (int y, int x0, int x1, int color);
  2397.  
  2398.      Draw a horizontal line between (X0,Y) and (X1,Y).  The color COLOR is used 
  2399.      for drawing. 
  2400.  
  2401.      See also: g_box() , g_clip() , g_line() , g_vline() 
  2402.  
  2403.  
  2404. ΓòÉΓòÉΓòÉ 8.7. g_line() ΓòÉΓòÉΓòÉ
  2405.  
  2406. #include <graph.h>                            [emx]
  2407.  
  2408. void g_line (int x0, int y0, int x1,int y1, int color);
  2409.  
  2410.      Draw a line of arbitrary slope between (X0,Y0) and (X1,Y1).  The color 
  2411.      COLOR is used for drawing.  To draw horizontal or vertical lines, you 
  2412.      should use g_hline() and g_vline(), respectively, which are specialized 
  2413.      functions optimized for speed. 
  2414.  
  2415.      See also: g_clip() , g_hline() , g_polygon() , g_triangle() , g_vline() 
  2416.  
  2417.  
  2418. ΓòÉΓòÉΓòÉ 8.8. g_lock() ΓòÉΓòÉΓòÉ
  2419.  
  2420. #include <graph.h>                            [emx]
  2421.  
  2422. void g_lock (void);
  2423.  
  2424.      Lock the screen.  Under OS/2, the screen must be locked while access 
  2425.      graphics memory.  All the graphics drawing functions lock the screen, 
  2426.      draw, and unlock the screen unless it's already locked.  To avoid the 
  2427.      overhead of locking and unlocking for each function call, you can lock and 
  2428.      unlock the screen yourself when performing many successive drawing 
  2429.      operations.  Note that you should not lock the screen for more than a few 
  2430.      seconds.  g_lock() increments a counter, which is initialized to zero by 
  2431.      g_mode(). The screen is locked while the counter is non-zero.  g_unlock() 
  2432.      decrements the counter and unlocks the screen if the counter reaches zero. 
  2433.  
  2434.      See also: g_unlock() 
  2435.  
  2436.  
  2437. ΓòÉΓòÉΓòÉ 8.9. g_mode() ΓòÉΓòÉΓòÉ
  2438.  
  2439. #include <graph.h>                            [emx]
  2440.  
  2441. int g_mode (int mode);
  2442.  
  2443.      Select graphics mode.  If MODE is G_MODE_OFF, graphics mode is turned off 
  2444.      and 0 is returned.  If MODE is G_MODE_VGA_L, the 320x200 VGA mode with 256 
  2445.      colors is chosen.  If switching to graphics mode succeeds, 1 is returned. 
  2446.      Otherwise, 0 is returned. 
  2447.  
  2448.      The global variables g_xsize, g_ysize and g_colors are set.  The clipping 
  2449.      rectangle is set to the entire screen. 
  2450.  
  2451.      General information about the graphics library: Programs using the 
  2452.      graphics library work both under DOS and in OS/2 full-screen sessions. 
  2453.      The coordinates of the screen are (0,0) (upper left) through 
  2454.      (g_xsize-1,g_ysize-1) (lower right).  You have to link with libgraph (use 
  2455.      the -lgraph option).  Under DOS, emx option -acm is required, see `Using 
  2456.      emx options'. 
  2457.  
  2458.      Restriction: Only G_MODE_VGA_L mode is currently implemented. 
  2459.  
  2460.      Example: /emx/test/graph.c 
  2461.  
  2462.      See also: g_clip() , g_modeset() , g_colors , g_xsize , g_ysize 
  2463.  
  2464.  
  2465. ΓòÉΓòÉΓòÉ 8.10. g_modeset() ΓòÉΓòÉΓòÉ
  2466.  
  2467. #include <graph.h>                            [emx]
  2468.  
  2469. int g_modeset (int mode, int flag);
  2470.  
  2471.      Modify a graphics mode number.  The mode number to be modified is passed 
  2472.      in MODE, the value passed in FLAG specifies how to modify the mode number: 
  2473.      G_SET_KEEP causes the mode number to be not modified.  The new mode number 
  2474.      is returned.  On failure, G_MODE_OFF is returned. 
  2475.  
  2476.      The global variables g_xsize, g_ysize and g_colors are set. 
  2477.  
  2478.      Restriction: As only G_SET_KEEP is implemented, g_modeset() is useless. 
  2479.      It's included for compatibility with existing programs. 
  2480.  
  2481.      See also: g_mode() , g_colors , g_xsize , g_ysize 
  2482.  
  2483.  
  2484. ΓòÉΓòÉΓòÉ 8.11. g_polygon() ΓòÉΓòÉΓòÉ
  2485.  
  2486. #include <graph.h>                            [emx]
  2487.  
  2488. void g_polygon (const int *x, const int *y, int n, int color,
  2489.         int fill_flag);
  2490.  
  2491.      Draw a polygon.  The N vertices are stored in the X and Y arrays: 
  2492.      (X[i],Y[i]) for i = 0, ..., n-1.  If FILL_FLAG is G_OUTLINE, the outline 
  2493.      of the polygon is drawn, that is, a line from vertex 0 to vertex 1, from 
  2494.      vertex 1 to vertex 2, ..., vertex n-2 to vertex n-1, vertex n-1 to vertex 
  2495.      0.  If FILL_FLAG is G_FILL, the interior of the polygon is filled.  A 
  2496.      point is defined to be in the interior of the polygon, if an infinite line 
  2497.      to any side of that pixel intersects the polygon an odd number of times. 
  2498.      The color COLOR is used for drawing. 
  2499.  
  2500.      See also: g_clip() , g_line() , g_triangle() 
  2501.  
  2502.  
  2503. ΓòÉΓòÉΓòÉ 8.12. g_set() ΓòÉΓòÉΓòÉ
  2504.  
  2505. #include <graph.h>                            [emx]
  2506.  
  2507. void g_set (int x, int y, int color);
  2508.  
  2509.      Set the pixel (X,Y) to the color COLOR. 
  2510.  
  2511.      See also: g_clip() , g_get() 
  2512.  
  2513.  
  2514. ΓòÉΓòÉΓòÉ 8.13. g_triangle() ΓòÉΓòÉΓòÉ
  2515.  
  2516. #include <graph.h>                            [emx]
  2517.  
  2518. void g_triangle (int x0, int y0, int x1, int y1, int x2, int y2, int color,
  2519.          int fill_flag);
  2520.  
  2521.      Draw a triangle.  The vertices are (X0,Y0), (X1,Y1) and (X2,Y2). If 
  2522.      FILL_FLAG is G_OUTLINE, the outline of the triangle is drawn, that is, a 
  2523.      line from (X0,Y0) to (X1,Y1), a line from (X1,Y1) to (X2,Y2) and a line 
  2524.      from (X2,Y2) to (X0,Y0).  If FILL_FLAG is G_FILL, the interior of the 
  2525.      triangle is filled.  The color COLOR is used for drawing. 
  2526.  
  2527.      See also: g_clip() , g_line() , g_polygon() 
  2528.  
  2529.  
  2530. ΓòÉΓòÉΓòÉ 8.14. g_unlock() ΓòÉΓòÉΓòÉ
  2531.  
  2532. #include <graph.h>                            [emx]
  2533.  
  2534. void g_unlock (void);
  2535. void g_unlockall (void);
  2536.  
  2537.      Unlock the screen.  g_unlock() undoes one invocation of g_lock() by 
  2538.      decrementing the counter incremented by g_lock().  If the counter reaches 
  2539.      zero, the screen is unlocked.  If the counter already was zero, the 
  2540.      counter is not changed.  g_unlockall() undoes all invocations of g_lock() 
  2541.      by resetting the counter to zero and unlocking the screen if the counter 
  2542.      was non-zero. 
  2543.  
  2544.      See also: g_lock() 
  2545.  
  2546.  
  2547. ΓòÉΓòÉΓòÉ 8.15. g_unlockall() ΓòÉΓòÉΓòÉ
  2548.  
  2549.  
  2550. ΓòÉΓòÉΓòÉ 8.16. g_vgapal() ΓòÉΓòÉΓòÉ
  2551.  
  2552. #include <graph.h>                            [emx]
  2553.  
  2554. void g_vgapal (const char *pal, int first, int n, int wait_flag);
  2555.  
  2556.      Set the VGA palette.  This function sets N (1 through 256) DAC registers 
  2557.      starting with register FIRST (0 through 255).  For each register, 3 bytes 
  2558.      are taken from PAL: red, green, blue.  Each byte should have a value 
  2559.      between 0 and 63, inclusive.  If WAIT_FLAG is non-zero, g_vgapal() waits 
  2560.      for the vertical retrace to avoid snow on the screen, see g_waitv(). 
  2561.      Under DOS, emx option -ai is required, see `Using emx options'.  Under 
  2562.      OS/2, emxio.dll is required.  When linking with LINK386 (-Zomf) or when 
  2563.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio) after 
  2564.      libgraph (-lgraph).  libemxio must not be used if the program should run 
  2565.      under DOS. 
  2566.  
  2567.      See also: g_waitv() 
  2568.  
  2569.  
  2570. ΓòÉΓòÉΓòÉ 8.17. g_vline() ΓòÉΓòÉΓòÉ
  2571.  
  2572. #include <graph.h>                            [emx]
  2573.  
  2574. void g_vline (int x, int y0, int y1, int color);
  2575.  
  2576.      Draw a vertical line between (X,Y0) and (X,Y1).  The color COLOR is used 
  2577.      for drawing. 
  2578.  
  2579.      See also: g_box() , g_clip() , g_hline() , g_line() 
  2580.  
  2581.  
  2582. ΓòÉΓòÉΓòÉ 8.18. g_waitv() ΓòÉΓòÉΓòÉ
  2583.  
  2584. #include <graph.h>                            [emx]
  2585.  
  2586. void g_waitv (void);
  2587.  
  2588.      Wait for vertical retrace.  Under DOS, emx option -ai is required, see 
  2589.      `Using emx options'.  Under OS/2, emxio.dll is required.  When linking 
  2590.      with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to use 
  2591.      libemxio (-lemxio) after libgraph (-lgraph).  libemxio must not be used if 
  2592.      the program should run under DOS.  Note that this function eats lots of 
  2593.      CPU time. 
  2594.  
  2595.      See also: g_vgapal() , _wait01() 
  2596.  
  2597.  
  2598. ΓòÉΓòÉΓòÉ 8.19. g_wmode() ΓòÉΓòÉΓòÉ
  2599.  
  2600. #include <graph.h>                            [emx]
  2601.  
  2602. void g_wmode (int wmode);
  2603.  
  2604.      Select a `writing mode'.  This is not yet implemented. 
  2605.  
  2606.  
  2607. ΓòÉΓòÉΓòÉ 8.20. getcwd() ΓòÉΓòÉΓòÉ
  2608.  
  2609. #include <stdlib.h>                           [ANSI]
  2610.  
  2611. char *getcwd (char *buffer, int size);
  2612.  
  2613.      getcwd() retrieves the name of the current working directory (excluding 
  2614.      the drive name) and stores it to BUFFER.  It is assumed that there are 
  2615.      SIZE bytes available at BUFFER.  This includes the terminating 0.  If SIZE 
  2616.      is too small, getcwd() returns NULL and sets errno to ERANGE.  If BUFFER 
  2617.      is NULL, a buffer of suitable size, but at least SIZE bytes, is allocated 
  2618.      with malloc().  If getcwd() succeeds, BUFFER is returned.  getcwd() 
  2619.      translates backslashes into forward slashes.  It does not translate 
  2620.      upper-case directory names to lower case. 
  2621.  
  2622.      See also: chdir() , _getcwd1() , _getcwd2() , getwd() 
  2623.  
  2624.  
  2625. ΓòÉΓòÉΓòÉ 8.21. _getcwd1() ΓòÉΓòÉΓòÉ
  2626.  
  2627. #include <stdlib.h>                            [emx]
  2628.  
  2629. int _getcwd1 (char *buffer, char drive);
  2630.  
  2631.      _getcwd1() retrieves the name of the current working directory (starting 
  2632.      with a slash, excluding the drive name) of drive DRIVE and stores it to 
  2633.      BUFFER.  If DRIVE is 0, the currently selected drive is used.  Otherwise, 
  2634.      DRIVE must be in 'A' through 'Z'.  It is assumed that there are enough 
  2635.      bytes available at BUFFER.  If _getcwd1() succeeds, 0 is returned. 
  2636.      _getcwd1() translates backslashes into forward slashes.  It does not 
  2637.      translate upper-case directory names to lower case. 
  2638.  
  2639.      See also: chdir() , getcwd() , _getcwd2() 
  2640.  
  2641.  
  2642. ΓòÉΓòÉΓòÉ 8.22. _getcwd2() ΓòÉΓòÉΓòÉ
  2643.  
  2644. #include <stdlib.h>                            [emx]
  2645.  
  2646. char *_getcwd2 (char *buffer, int size);
  2647.  
  2648.      _getcwd2() works like getcwd() but in addition it includes the drive name 
  2649.      in BUFFER. 
  2650.  
  2651.      See also: chdir() , getcwd() , _getcwd1() 
  2652.  
  2653.  
  2654. ΓòÉΓòÉΓòÉ 8.23. _getdrive() ΓòÉΓòÉΓòÉ
  2655.  
  2656. #include <stdlib.h>                            [PC]
  2657.  
  2658. char _getdrive (void);
  2659.  
  2660.      Return as upper-case letter the currently selected drive. 
  2661.  
  2662.      See also: _chdir2() , _chdrive() , _getcwd2() 
  2663.  
  2664.  
  2665. ΓòÉΓòÉΓòÉ 8.24. getenv() ΓòÉΓòÉΓòÉ
  2666.  
  2667. #include <stdlib.h>                           [ANSI]
  2668.  
  2669. char *getenv (const char *name);
  2670.  
  2671.      Find NAME in the environment.  If the variable is found, a pointer to the 
  2672.      value is returned.  Otherwise, NULL is returned. 
  2673.  
  2674.      See also: environ , putenv() 
  2675.  
  2676.  
  2677. ΓòÉΓòÉΓòÉ 8.25. _getext() ΓòÉΓòÉΓòÉ
  2678.  
  2679. #include <stdlib.h>                            [emx]
  2680.  
  2681. char *_getext (const char *path);
  2682.  
  2683.      Return a pointer to the extension of the file name PATH.  The pointer 
  2684.      points to the dot character that starts the extension.  If there is no 
  2685.      extension, NULL is returned.  If the last member of PATH starts with a dot 
  2686.      ("/usr/mattes/.profile", for instance), NULL is returned. 
  2687.  
  2688.      See also: _defext() , _getname() , _remext() , _splitpath() 
  2689.  
  2690.  
  2691. ΓòÉΓòÉΓòÉ 8.26. _getname() ΓòÉΓòÉΓòÉ
  2692.  
  2693. #include <stdlib.h>                            [emx]
  2694.  
  2695. char *_getname (const char *path);
  2696.  
  2697.      Return a pointer to the name part (last component, including the 
  2698.      extension) of the file name PATH.  The pointer points to the character 
  2699.      after the last path separator (slash, backslash and colon).  If there is 
  2700.      no path separator, PATH is returned. 
  2701.  
  2702.      See also: _getext() , _splitpath() 
  2703.  
  2704.  
  2705. ΓòÉΓòÉΓòÉ 8.27. getpagesize() ΓòÉΓòÉΓòÉ
  2706.  
  2707. #include <stdlib.h>                            [BSD]
  2708.  
  2709. int getpagesize (void);
  2710.  
  2711.      Return the page size, which is 4096 for the 386. 
  2712.  
  2713.  
  2714. ΓòÉΓòÉΓòÉ 8.28. getc() ΓòÉΓòÉΓòÉ
  2715.  
  2716. #include <stdio.h>                            [ANSI]
  2717.  
  2718. int getc (FILE *stream);
  2719. int getchar (void);
  2720.  
  2721.      Read a character from STREAM or stdin, respectively.  The character is 
  2722.      returned.  If an error occurs or if the end of the file is reached, EOF is 
  2723.      returned. 
  2724.  
  2725.               getchar ()
  2726.  
  2727.      is equivalent to 
  2728.  
  2729.               getc (stdin).
  2730.  
  2731.      getc() and getchar() are in-line functions or macros. 
  2732.  
  2733.      See also: fgetc() 
  2734.  
  2735.  
  2736. ΓòÉΓòÉΓòÉ 8.29. getchar() ΓòÉΓòÉΓòÉ
  2737.  
  2738.  
  2739. ΓòÉΓòÉΓòÉ 8.30. getopt() ΓòÉΓòÉΓòÉ
  2740.  
  2741. #include <getopt.h>                           [UNIX]
  2742.  
  2743. int getopt (int argc, char **argv, const char *opt_str);
  2744.  
  2745.      Parse command line options.  ARGC is the number of argument strings, ARGV 
  2746.      is an array of argument strings, OPT_STR is a string describing the 
  2747.      available options.  Typically, the ARGC and ARGV arguments of main() are 
  2748.      passed to getopt().  Each option is of one of the following types: 
  2749.  
  2750.         - option without argument: the option letter is listed in OPT_STR; 
  2751.  
  2752.         - option with mandatory argument: the option letter in OPT_STR is 
  2753.           followed by a colon 
  2754.  
  2755.         - option with optional argument: the option letter in OPT_STR is 
  2756.           followed by two colons. 
  2757.  
  2758.  
  2759.      For instance, 
  2760.  
  2761.               c = getopt (argc, argv, "abc:d::v")
  2762.  
  2763.      defines five options: -a, -b, -c and -v don't take arguments, -c takes a 
  2764.      mandatory argument, -d takes an optional argument. 
  2765.  
  2766.      Before the first call to getopt(), the global variable optind must be set 
  2767.      to 0 (that's the initial value, see also bugs below). Calling getopt() 
  2768.      parses the next command line option.  If there are no more command line 
  2769.      options, getopt() returns EOF.  After calling getopt(), optind is the 
  2770.      index of the next command line argument.  After calling getopt(), the 
  2771.      global variable optarg points to the argument of the option.  If there is 
  2772.      no argument, optarg is NULL. 
  2773.  
  2774.      There are three modes of operation, which are controlled by the global 
  2775.      variable optmode: 
  2776.  
  2777.      GETOPT_UNIX         Options are at the start of the command line.  When 
  2778.                          the first non-option is reached, parsing options stops 
  2779.                          and getopt() returns EOF.  GETOPT_UNIX is the default. 
  2780.  
  2781.      GETOPT_ANY          Options may appear anywhere on the command line. ARGV 
  2782.                          is reordered to move the non-options to the end. When 
  2783.                          there are no more options, getopt() returns EOF. The 
  2784.                          remaining arguments are all the arguments of the 
  2785.                          command line which are not options. 
  2786.  
  2787.      GETOPT_KEEP         Options may appear anywhere on the command line.  If 
  2788.                          the current argument is not an option, getopt() 
  2789.                          returns 0.  optarg will point to the argument.  The 
  2790.                          next call to getopt() examines the next command line 
  2791.                          argument. 
  2792.  
  2793.      If the global variable opterr is non-zero (this is the default), getopt() 
  2794.      writes an appropriate error message to stderr on failure and returns '?'. 
  2795.      If opterr is zero, getopt() does not display an error message on failure 
  2796.      and returns '?'. 
  2797.  
  2798.      The global variable optswchar is a string of characters which start 
  2799.      options.  The default value is "-", that is, options are started by 
  2800.      hyphens.  You might want to assign "-/" or "/" to optswchar. 
  2801.  
  2802.      If a command line argument consists of two equal switch characters (see 
  2803.      optswchar), the remaining command line arguments are not treated as 
  2804.      options. 
  2805.  
  2806.      Options may be clustered, that is, if an option does not take an argument, 
  2807.      getopt() treats the following character of the same command line argument 
  2808.      as option.  If an option takes a mandatory argument, the argument either 
  2809.      follows immediately the option or is taken from the next command line 
  2810.      argument.  If an option takes an optional argument, the argument must 
  2811.      immediately follow the option. 
  2812.  
  2813.      getopt() returns the next option character.  If there are no more command 
  2814.      line options, EOF is returned.  On failure, '?' is returned.  If optmode 
  2815.      is GETOPT_KEEP and the current command line argument is not an option, 0 
  2816.      is returned. 
  2817.  
  2818.      When writing portable programs, you should not use optmode, optswchar and 
  2819.      options taking optional arguments.  Only letters should be used as 
  2820.      options. 
  2821.  
  2822.      optmode must not be changed after the first call to getopt(). optswchar, 
  2823.      however, may be changed at any time. 
  2824.  
  2825.      Bugs: optind should be set to 1 (instead of 0) for parsing the first 
  2826.      command line argument.  As it is initialized to 0 by this implementation 
  2827.      of getopt() and seems to be initialized to 1 by the BSD implementation, 
  2828.      just do not initialize optind and everything will be OK. 
  2829.  
  2830.      See also: main() , _swchar() 
  2831.  
  2832.  
  2833. ΓòÉΓòÉΓòÉ 8.31. getpid() ΓòÉΓòÉΓòÉ
  2834.  
  2835. #include <process.h>                           [UNIX]
  2836.  
  2837. int getpid (void);
  2838.  
  2839.      Return the process identification number of the calling process. 
  2840.  
  2841.  
  2842. ΓòÉΓòÉΓòÉ 8.32. getppid() ΓòÉΓòÉΓòÉ
  2843.  
  2844. #include <process.h>                           [UNIX]
  2845.  
  2846. int getppid (void);
  2847.  
  2848.      Return the process identification number of the parent process of the 
  2849.      calling process. 
  2850.  
  2851.  
  2852. ΓòÉΓòÉΓòÉ 8.33. getpwent() ΓòÉΓòÉΓòÉ
  2853.  
  2854. #include <pwd.h>                             [UNIX]
  2855.  
  2856. struct passwd *getpwent (void);
  2857. struct passwd *getpwuid (int uid);
  2858. struct passwd *getpwnam (char *name);
  2859. void setpwent (void);
  2860. void endpwent (void);
  2861.  
  2862.      Dummy functions. 
  2863.  
  2864.  
  2865. ΓòÉΓòÉΓòÉ 8.34. gets() ΓòÉΓòÉΓòÉ
  2866.  
  2867. #include <stdio.h>                            [ANSI]
  2868.  
  2869. char *gets (char *buffer);
  2870.  
  2871.      Read a string from stdin to BUFFER.  Stop after a newline (LF) character 
  2872.      has been read.  The newline character is replaced with a null character. 
  2873.      gets() returns BUFFER.  If an error occurs or the end of the file is 
  2874.      reached, gets() returns NULL.  Use fgets() instead as gets() doesn't know 
  2875.      how big BUFFER is. 
  2876.  
  2877.      See also: fgets() , scanf() 
  2878.  
  2879.  
  2880. ΓòÉΓòÉΓòÉ 8.35. getw() ΓòÉΓòÉΓòÉ
  2881.  
  2882. #include <stdio.h>                            [UNIX]
  2883.  
  2884. int getw (FILE *stream);
  2885.  
  2886.      Read a word (int) from STREAM and return it.  On failure, -1 is returned. 
  2887.      As -1 is also a possible word value, you have to use ferror() to recognize 
  2888.      an error condition. 
  2889.  
  2890.      Avoid using this function. 
  2891.  
  2892.      See also: putw() , fwrite() 
  2893.  
  2894.  
  2895. ΓòÉΓòÉΓòÉ 8.36. getwd() ΓòÉΓòÉΓòÉ
  2896.  
  2897. #include <stdlib.h>
  2898.  
  2899. char *getwd (char *buffer);
  2900.  
  2901.      getwd() retrieves the name of the current working directory (excluding the 
  2902.      drive name) and stores it to BUFFER.  It is assumed that there are 
  2903.      MAXPATHLEN bytes available at BUFFER.  This includes the terminating 0. 
  2904.      MAXPATHLEN is defined in sys/param.h. If getwd() succeeds, BUFFER is 
  2905.      returned.  If getwd() fails, an error message is copied to BUFFER and NULL 
  2906.      is returned.  getwd() translates backslashes into forward slashes.  It 
  2907.      does not translate upper-case directory names to lower case. 
  2908.  
  2909.      See also: getcwd() 
  2910.  
  2911.  
  2912. ΓòÉΓòÉΓòÉ 8.37. gettimeofday() ΓòÉΓòÉΓòÉ
  2913.  
  2914. #include <sys/time.h>                           [BSD]
  2915.  
  2916. int gettimeofday (struct timeval *tp, struct timezone *tzp);
  2917.  
  2918.      Obtain the current time and timezone.  If TP is not NULL, the current 
  2919.      Greenwich Mean Time, expressed in seconds and microseconds since 00:00 
  2920.      1-Jan-1970, is stored to *TP.  If TZP is not NULL, information about the 
  2921.      timezone is stored to *TZP. 
  2922.  
  2923.      See also: ftime() , time() 
  2924.  
  2925.  
  2926. ΓòÉΓòÉΓòÉ 8.38. gmtime() ΓòÉΓòÉΓòÉ
  2927.  
  2928. #include <time.h>                            [ANSI]
  2929.  
  2930. struct tm *gmtime (const time_t *t);
  2931.  
  2932.      Convert the number of seconds elapsed since 00:00 1-Jan-1970 (GMT) given 
  2933.      by the variable pointed to by T to a time and date structure (GMT) and 
  2934.      return a pointer to the structure.  gmtime(), mktime() and localtime() use 
  2935.      the same memory location, therefore the values are overwritten if one of 
  2936.      these functions is called. 
  2937.  
  2938.      See also: localtime() 
  2939.  
  2940.  
  2941. ΓòÉΓòÉΓòÉ 9. function h ΓòÉΓòÉΓòÉ
  2942.  
  2943. This sections documents functions starting with the letter h 
  2944.  
  2945.  
  2946. ΓòÉΓòÉΓòÉ 9.1. _heapchk() ΓòÉΓòÉΓòÉ
  2947.  
  2948. #include <stdlib.h>                            [PC]
  2949.  
  2950. int _heapchk (void);
  2951. int _heapset (unsigned fill);
  2952.  
  2953.      _heapchk() checks the heap and returns _HEAPBADBEGIN (if the pointers to 
  2954.      the heap are corrupt), _HEAPBADNODE (if there is a corrupt entry in the 
  2955.      heap), _HEAPEMPTY (if the heap is empty) or _HEAPOK (if the heap is ok). 
  2956.  
  2957.      _heapset() fills unused areas of the heap with FILL.  See _heapchk() for 
  2958.      the return values.  In fact, _heapchk() is a special variant of _heapset() 
  2959.      which doesn't fill unused areas of the heap. 
  2960.  
  2961.  
  2962. ΓòÉΓòÉΓòÉ 9.2. _heapset() ΓòÉΓòÉΓòÉ
  2963.  
  2964.  
  2965. ΓòÉΓòÉΓòÉ 9.3. hypot() ΓòÉΓòÉΓòÉ
  2966.  
  2967. #include <math.h>                            [UNIX]
  2968.  
  2969. double hypot (double x, double y);
  2970.  
  2971.      Compute and return sqrt (x*x + y*y).  On overflow, #INF is returned and 
  2972.      errno is set to ERANGE. 
  2973.  
  2974.      See also: sqrt() 
  2975.  
  2976.  
  2977. ΓòÉΓòÉΓòÉ 10. function i ΓòÉΓòÉΓòÉ
  2978.  
  2979. This sections documents functions starting with the letter i 
  2980.  
  2981.  
  2982. ΓòÉΓòÉΓòÉ 10.1. index() ΓòÉΓòÉΓòÉ
  2983.  
  2984. #include <strings.h>                           [BSD]
  2985.  
  2986. char *index (const char *string, int c);
  2987.  
  2988.      Return a pointer to the first occurrence of the character C in the 
  2989.      null-terminated string STRING.  If there is no character C in STRING, NULL 
  2990.      is returned.  If C is 0, a pointer to the terminating zero of STRING is 
  2991.      returned. 
  2992.  
  2993.      See also: rindex() , strchr() 
  2994.  
  2995.  
  2996. ΓòÉΓòÉΓòÉ 10.2. _inp8() ΓòÉΓòÉΓòÉ
  2997.  
  2998. #include <sys/hw.h>                          [*] [emx]
  2999.  
  3000. unsigned _inp8 (unsigned port);
  3001. unsigned _inp16 (unsigned port);
  3002. unsigned _inp32 (unsigned port);
  3003.  
  3004.      These functions read a single byte or word from a hardware port. _inp8() 
  3005.      reads a byte from PORT, _inp16() reads a 16-bit word from PORT, _inp32() 
  3006.      reads a 32-bit word from PORT. 
  3007.  
  3008.      You have to call _portaccess() first to enable access to a range of ports. 
  3009.      To make your program work under DOS, you have to use emx option -ai, see 
  3010.      `Using emx options'.  Under OS/2, your program requires emxio.dll in a 
  3011.      directory listed in LIBPATH.  When linking with LINK386 (-Zomf) or when 
  3012.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio).  libemxio 
  3013.      must not be used if the program should run under DOS. 
  3014.  
  3015.      See also: _portaccess() , _inps8() , _outp8() , _wait0() 
  3016.  
  3017.  
  3018. ΓòÉΓòÉΓòÉ 10.3. _inp16() ΓòÉΓòÉΓòÉ
  3019.  
  3020.  
  3021. ΓòÉΓòÉΓòÉ 10.4. _inp32() ΓòÉΓòÉΓòÉ
  3022.  
  3023.  
  3024. ΓòÉΓòÉΓòÉ 10.5. _inps8() ΓòÉΓòÉΓòÉ
  3025.  
  3026. #include <sys/hw.h>                          [*] [emx]
  3027.  
  3028. void _inps8 (unsigned port, unsigned char *dst, unsigned count);
  3029. void _inps16 (unsigned port, unsigned short *dst, unsigned count);
  3030. void _inps32 (unsigned port, unsigned long *dst, unsigned count);
  3031.  
  3032.      These functions read multiple bytes or words from a hardware port. 
  3033.      _inps8() reads COUNT bytes from PORT to the buffer DST.  _inps16() reads 
  3034.      COUNT 16-bit words from PORT to the buffer DST. 
  3035.  
  3036.      The COUNT argument of _inps8() must not exceed 65535. 
  3037.  
  3038.      The DST pointer of _inps16() must be aligned on a 16-bit boundary, that 
  3039.      is, the address must be even.  COUNT must not exceed 32768. 
  3040.  
  3041.      The DST pointer of _inps32() must be aligned on a 32-bit boundary, that 
  3042.      is, the address must be a multiple of four.  COUNT must not exceed 65536. 
  3043.  
  3044.      You have to call _portaccess() first to enable access to a range of ports. 
  3045.      To make your program work under DOS, you have to use emx option -ai, see 
  3046.      `Using emx options'.  Under OS/2, your program requires emxio.dll in a 
  3047.      directory listed in LIBPATH.  When linking with LINK386 (-Zomf) or when 
  3048.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio).  libemxio 
  3049.      must not be used if the program should run under DOS. 
  3050.  
  3051.      See also: _portaccess() , _inp8() , _outps8() 
  3052.  
  3053.  
  3054. ΓòÉΓòÉΓòÉ 10.6. _inps16() ΓòÉΓòÉΓòÉ
  3055.  
  3056.  
  3057. ΓòÉΓòÉΓòÉ 10.7. _inps32() ΓòÉΓòÉΓòÉ
  3058.  
  3059.  
  3060. ΓòÉΓòÉΓòÉ 10.8. _int86() ΓòÉΓòÉΓòÉ
  3061.  
  3062. #include <dos.h>                              [PC]
  3063.  
  3064. int _int86 (int int_num, union REGS *inp_regs, union REGS *out_regs);
  3065.  
  3066.      Issue software interrupt under DOS.  This function loads the processor 
  3067.      registers EAX, EBX, ECX, EDX, ESI and EDI from INP_REGS, calls software 
  3068.      interrupt INT_NUM and stores the processor registers EAX, EBX, ECX, EDX, 
  3069.      ESI, EDI and the flags register to OUT_REGS.  The value of EAX is 
  3070.      returned. 
  3071.  
  3072.      emx option -ac must be used to enable _int86().  If -ac is not used, a 
  3073.      protection violation exception occurs when _int86() is called.  See `Using 
  3074.      emx options'. 
  3075.  
  3076.      Restrictions: _int86() is not supported under OS/2 (there are no software 
  3077.      interrupts under OS/2).  The emx DOS extender currently supports only 
  3078.      interrupts 0x10, 0x11, 0x14, 0x16, 0x17 and 0x21. Note that pointer 
  3079.      conversion is done only for the subset of interrupt 0x21 services known by 
  3080.      DOS 3.3.  Pointer conversion is currently done for interrupt 0x21 only. 
  3081.      Please note the following difference to DOS C compilers: the REGS union 
  3082.      does not contain an X.CFLAG field.  The complete flags register is stored 
  3083.      to the E.EFLAGS field instead.  The carry flag is available in bit 0 of 
  3084.      the E.EFLAGS and X.FLAGS fields. 
  3085.  
  3086.      Example: /emx/test/vmode.c 
  3087.  
  3088.  
  3089. ΓòÉΓòÉΓòÉ 10.9. ioctl() ΓòÉΓòÉΓòÉ
  3090.  
  3091. #include <sys/ioctl.h>                        [*] [SysV]
  3092.  
  3093. int ioctl (int handle, int request, int int_arg);
  3094. int ioctl (int handle, int request, void *ptr_arg);
  3095.  
  3096.      Device control for HANDLE.  REQUEST codes are: 
  3097.  
  3098.      TCGETA         see `termio' 
  3099.  
  3100.      TCSETA         see `termio' 
  3101.  
  3102.      TCGETAF        see `termio' 
  3103.  
  3104.      TCGETAW        see `termio' 
  3105.  
  3106.      TCFLSH         flush the buffers.  If INT_ARG is 0, the input buffer is 
  3107.                     flushed; if INT_ARG is 1, the output buffer is flushed; if 
  3108.                     INT_ARG is 2, both the input and output buffers are 
  3109.                     flushed.  Works only if HANDLE is 0 and HANDLE refers to 
  3110.                     the keyboard.  Only flushing the keyboard buffer is 
  3111.                     implemented 
  3112.  
  3113.      FIONREAD       get number of available characters.  The number of 
  3114.                     available characters is stored to the int pointed to by 
  3115.                     PTR_ARG.  FIONREAD is implemented for the following types 
  3116.                     of handles: 
  3117.  
  3118.            - stdin handles (keyboard) with IDEFAULT not set (DOS: handle 0 
  3119.              only). Note that if ICANON is set, the number of characters in the 
  3120.              keyboard buffer is returned which is not the number of characters 
  3121.              available for read(), as at least one of the buffered characters 
  3122.              (carriage return) is used for command line editing 
  3123.  
  3124.            - named pipes 
  3125.  
  3126.            - pipes created with pipe() by programs using emx.dll 
  3127.  
  3128.            - all file handles under DOS (0 or 1 character available) 
  3129.  
  3130.      FGETHTYPE      get the handle type and store it to the int pointed to by 
  3131.                     PTR_ARG.  See /emx/include/sys/ioctl.h for handle types 
  3132.                     (HT_FILE, for instance). 
  3133.  
  3134.      If an error occurs, errno is set and -1 is returned. 
  3135.  
  3136.      Restriction: When using the system call library libsys.lib (-Zsys), only 
  3137.      the FGETHTYPE request is available. 
  3138.  
  3139.      See also: fcntl() , open() , read() 
  3140.  
  3141.  
  3142. ΓòÉΓòÉΓòÉ 10.10. isascii() ΓòÉΓòÉΓòÉ
  3143.  
  3144. #include <ctype.h>                            [UNIX]
  3145.  
  3146. int isascii (int c);
  3147.  
  3148.      Return a non-zero value iff C is a valid ASCII character which can be used 
  3149.      with isalnum() etc.  isascii() can be applied to all integer values. 
  3150.      isascii() is implemented both as macro and as function. 
  3151.  
  3152.      See also: isalnum() 
  3153.  
  3154.  
  3155. ΓòÉΓòÉΓòÉ 10.11. isalnum() ΓòÉΓòÉΓòÉ
  3156.  
  3157. #include <ctype.h>                            [ANSI]
  3158.  
  3159. int isalnum (int c);       /* alphanumeric character */
  3160. int isalpha (int c);       /* alphabetic character */
  3161. int iscntrl (int c);       /* control character */
  3162. int isdigit (int c);       /* decimal digit */
  3163. int isgraph (int c);       /* printable character but not space */
  3164. int islower (int c);       /* lower-case letter */
  3165. int isprint (int c);       /* printable character */
  3166. int ispunct (int c);       /* punctuation character */
  3167. int isspace (int c);       /* white-space character */
  3168. int isupper (int c);       /* upper-case letter */
  3169. int isxdigit (int c);      /* hexadecimal digit */
  3170.  
  3171.      These functions (or macros) return a non-zero value if the condition is 
  3172.      true, or 0 if it is not true.  C must be an ASCII character or EOF. 
  3173.      Otherwise the result is unpredictable.  Use isascii() to check for valid 
  3174.      ASCII characters.  These routines are implemented both as macros and as 
  3175.      functions. 
  3176.  
  3177.      See also: isascii() , tolower() , toupper() , _tolower() , _toupper() 
  3178.  
  3179.  
  3180. ΓòÉΓòÉΓòÉ 10.12. isalpha() ΓòÉΓòÉΓòÉ
  3181.  
  3182.  
  3183. ΓòÉΓòÉΓòÉ 10.13. isatty() ΓòÉΓòÉΓòÉ
  3184.  
  3185. #include <io.h>                             [UNIX]
  3186.  
  3187. int isatty (int handle);
  3188.  
  3189.      Returns a non-zero value if HANDLE refers to a character device. Returns 0 
  3190.      if HANDLE does not refer to a character file (file or pipe).  If there is 
  3191.      an error, errno is set and -1 is returned. 
  3192.  
  3193.      See also: _isterm() , ioctl() 
  3194.  
  3195.  
  3196. ΓòÉΓòÉΓòÉ 10.14. iscntrl() ΓòÉΓòÉΓòÉ
  3197.  
  3198.  
  3199. ΓòÉΓòÉΓòÉ 10.15. isdigit() ΓòÉΓòÉΓòÉ
  3200.  
  3201.  
  3202. ΓòÉΓòÉΓòÉ 10.16. isgraph() ΓòÉΓòÉΓòÉ
  3203.  
  3204.  
  3205. ΓòÉΓòÉΓòÉ 10.17. islower() ΓòÉΓòÉΓòÉ
  3206.  
  3207.  
  3208. ΓòÉΓòÉΓòÉ 10.18. isprint() ΓòÉΓòÉΓòÉ
  3209.  
  3210.  
  3211. ΓòÉΓòÉΓòÉ 10.19. isspace() ΓòÉΓòÉΓòÉ
  3212.  
  3213.  
  3214. ΓòÉΓòÉΓòÉ 10.20. _isterm() ΓòÉΓòÉΓòÉ
  3215.  
  3216. #include <io.h>                              [emx]
  3217.  
  3218. int _isterm (int handle);
  3219.  
  3220.      Returns a non-zero value if HANDLE refers to the stdin (keyboard) or 
  3221.      stdout (screen) device.  Otherwise, returns 0.  If there is an error, 
  3222.      errno is set and 0 is returned. 
  3223.  
  3224.      Consider using ioctl (FGETHTYPE) instead. 
  3225.  
  3226.      See also: _isterm() , ioctl() 
  3227.  
  3228.  
  3229. ΓòÉΓòÉΓòÉ 10.21. isupper() ΓòÉΓòÉΓòÉ
  3230.  
  3231.  
  3232. ΓòÉΓòÉΓòÉ 10.22. isxdigit() ΓòÉΓòÉΓòÉ
  3233.  
  3234.  
  3235. ΓòÉΓòÉΓòÉ 10.23. _itoa() ΓòÉΓòÉΓòÉ
  3236.  
  3237. #include <stdlib.h>                            [PC]
  3238.  
  3239. char *_itoa (long value, char *string, int radix);
  3240. char *_ltoa (int value, char *string, int radix);
  3241. char *_ultoa (unsigned long value, char *string, int radix);
  3242.  
  3243.      Convert the number VALUE to a string using the number base RADIX (between 
  3244.      2 and 36).  The string is stored to STRING.  STRING is returned. 
  3245.  
  3246.      See also: atoi() , _lltoa() , strtol() 
  3247.  
  3248.  
  3249. ΓòÉΓòÉΓòÉ 11. function k ΓòÉΓòÉΓòÉ
  3250.  
  3251. This sections documents functions starting with the letter k 
  3252.  
  3253.  
  3254. ΓòÉΓòÉΓòÉ 11.1. kill() ΓòÉΓòÉΓòÉ
  3255.  
  3256. #include <signal.h>                         [*] [UNIX]
  3257.  
  3258. int kill (int pid, int sig);
  3259.  
  3260.      Send the signal SIG to process PID.  Only SIGINT and SIGBREAK can be sent 
  3261.      to arbitrary child processes.  A process can send the other signals only 
  3262.      to itself, see raise(), or to other emx programs.  If SIG is 0, kill() 
  3263.      checks only if PID is valid or not. If PID is smaller than -1, the signal 
  3264.      is sent to process -PID and its children.  Some special cases are not 
  3265.      implemented: pid=0, pid=1. 
  3266.  
  3267.      If successful, kill() returns 0.  Otherwise -1 is returned and errno set 
  3268.      to one of the following values: 
  3269.  
  3270.      EINVAL         SIG is not a valid signal number 
  3271.  
  3272.      ESRCH          PID is not the process ID of a process or process PID is 
  3273.                     not a child process 
  3274.  
  3275.      Restrictions: Special treatment of PID=0, PID=1 and PID=-1 is not 
  3276.      implemented.  Negative values of PID are implemented for OS/2 only and 
  3277.      work only for direct children of the caller. 
  3278.  
  3279.      When using the system call library libsys.lib (-Zsys), a process can send 
  3280.      arbitrary signals to itself, only SIGINT and SIGBREAK can be sent to only 
  3281.      child processes, negative values of PID are not allowed. 
  3282.  
  3283.      See also: raise() , signal() 
  3284.  
  3285.  
  3286. ΓòÉΓòÉΓòÉ 12. function l ΓòÉΓòÉΓòÉ
  3287.  
  3288. This sections documents functions starting with the letter l 
  3289.  
  3290.  
  3291. ΓòÉΓòÉΓòÉ 12.1. labs() ΓòÉΓòÉΓòÉ
  3292.  
  3293. #include <stdlib.h>   /* use this */                  [ANSI]
  3294. #include <math.h>    /* or this */
  3295.  
  3296. long labs (long n);
  3297.  
  3298.      Return the absolute value of N: If N is negative, -N is returned. 
  3299.      Otherwise, N is returned.  In-line code is generated for this function. 
  3300.  
  3301.      See also: abs() , fabs() 
  3302.  
  3303.  
  3304. ΓòÉΓòÉΓòÉ 12.2. ldexp() ΓòÉΓòÉΓòÉ
  3305.  
  3306. #include <math.h>                            [ANSI]
  3307.  
  3308. double ldexp (double x, int exp);
  3309.  
  3310.      Compute and return X * 2 ^ EXP.  On overflow, #NAN is returned and errno 
  3311.      is set to ERANGE. 
  3312.  
  3313.  
  3314. ΓòÉΓòÉΓòÉ 12.3. ldiv() ΓòÉΓòÉΓòÉ
  3315.  
  3316.  
  3317. ΓòÉΓòÉΓòÉ 12.4. _lldiv() ΓòÉΓòÉΓòÉ
  3318.  
  3319. #include <stdlib.h>                            [emx]
  3320.  
  3321. _lldiv_t _lldiv (long long num, long long den);
  3322. _uldiv_t _uldiv (unsigned long num, unsigned long den);
  3323. _ulldiv_t _ulldiv (unsigned long long num, unsigned long long den);
  3324.  
  3325.      Perform an integer division, dividing NUM by DEN.  The quotient and the 
  3326.      remainder are returned in the quot and rem fields, respectively. 
  3327.  
  3328.      The following table shows the signs of quot and rem depending on the signs 
  3329.      of NUM and DEN for _lldiv(): 
  3330.  
  3331.           ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  3332.           ΓöéNUM  ΓöéDEN  Γöéquot Γöérem  Γöé
  3333.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3334.           Γöé+    Γöé+    Γöé+    Γöé+    Γöé
  3335.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3336.           Γöé+    Γöé-    Γöé-    Γöé+    Γöé
  3337.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3338.           Γöé-    Γöé+    Γöé-    Γöé-    Γöé
  3339.           Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3340.           Γöé-    Γöé-    Γöé+    Γöé-    Γöé
  3341.           ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  3342.  
  3343.      Note: Do not use the -fpcc-struct-return GCC option. 
  3344.  
  3345.      See also: div() , ldiv() 
  3346.  
  3347.  
  3348. ΓòÉΓòÉΓòÉ 12.5. _lltoa() ΓòÉΓòÉΓòÉ
  3349.  
  3350. #include <stdlib.h>                            [emx]
  3351.  
  3352. char *_lltoa (long long value, char *string, int radix);
  3353. char *_ulltoa (unsigned long long value, char *string, int radix);
  3354.  
  3355.      Convert the number VALUE to a string using the number base RADIX (between 
  3356.      2 and 36).  The string is stored to STRING.  STRING is returned. 
  3357.  
  3358.      See also: atoi() , _itoa() , strtol() 
  3359.  
  3360.  
  3361. ΓòÉΓòÉΓòÉ 12.6. localeconv() ΓòÉΓòÉΓòÉ
  3362.  
  3363. #include <locale.h>                           [ANSI]
  3364.  
  3365. struct lconv *localeconv (void);
  3366.  
  3367.      Not implemented. 
  3368.  
  3369.  
  3370. ΓòÉΓòÉΓòÉ 12.7. localtime() ΓòÉΓòÉΓòÉ
  3371.  
  3372. #include <time.h>                            [ANSI]
  3373.  
  3374. struct tm *localtime (const time_t *t);
  3375.  
  3376.      Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970 given by 
  3377.      the variable pointed to by T to a time and date structure for the local 
  3378.      timezone and return a pointer to the structure. gmtime(), mktime() and 
  3379.      localtime() use the same memory location, therefore the values are 
  3380.      overwritten if one of these functions is called. 
  3381.  
  3382.      See also: gmtime() 
  3383.  
  3384.  
  3385. ΓòÉΓòÉΓòÉ 12.8. log() ΓòÉΓòÉΓòÉ
  3386.  
  3387. #include <math.h>                            [ANSI]
  3388.  
  3389. double log (double x);
  3390. double log10 (double x);
  3391.  
  3392.      log() returns the natural logarithm of X.  log10() returns the base-10 
  3393.      logarithm of X. 
  3394.  
  3395.      If X is zero, -#INF is returned and errno set to EDOM. If X is negative, 
  3396.      +#NAN is returned and errno set to EDOM. 
  3397.  
  3398.      See also: exp() , pow() 
  3399.  
  3400.  
  3401. ΓòÉΓòÉΓòÉ 12.9. log10() ΓòÉΓòÉΓòÉ
  3402.  
  3403.  
  3404. ΓòÉΓòÉΓòÉ 12.10. longjmp() ΓòÉΓòÉΓòÉ
  3405.  
  3406. #include <setjmp.h>                           [ANSI]
  3407.  
  3408. void volatile longjmp (jmp_buf there, int n);
  3409.  
  3410.      Restore the context saved in THERE by setjmp().  longjmp() does a 
  3411.      non-local `goto'.  When calling longjmp() in a signal handler or in a 
  3412.      function called by a signal handler (that is, while a signal handler is 
  3413.      active), the signal handler will be unwound, that is, it is assumed that 
  3414.      the signal handler doesn't return. 
  3415.  
  3416.      See also: setjmp() 
  3417.  
  3418.  
  3419. ΓòÉΓòÉΓòÉ 12.11. lseek() ΓòÉΓòÉΓòÉ
  3420.  
  3421. #include <io.h>                             [UNIX]
  3422.  
  3423. long lseek (int handle, long offset, int origin);
  3424.  
  3425.      lseek() moves the file pointer of HANDLE.  The new position OFFSET is 
  3426.      relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative to the 
  3427.      beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is relative to the 
  3428.      current position, if ORIGIN is SEEK_END, OFFSET is relative to the end of 
  3429.      the file.  The file pointer cannot be moved before the beginning of the 
  3430.      file.  lseek() returns the new position relative to the beginning of the 
  3431.      file.  If there is an error, -1 is returned. 
  3432.  
  3433.      See also: tell() 
  3434.  
  3435.  
  3436. ΓòÉΓòÉΓòÉ 12.12. _ltoa() ΓòÉΓòÉΓòÉ
  3437.  
  3438.  
  3439. ΓòÉΓòÉΓòÉ 13. function m ΓòÉΓòÉΓòÉ
  3440.  
  3441. This sections documents functions starting with the letter m 
  3442.  
  3443.  
  3444. ΓòÉΓòÉΓòÉ 13.1. main() ΓòÉΓòÉΓòÉ
  3445.  
  3446.                                     [ANSI]
  3447.  
  3448. int main (void);
  3449. int main (int argc, char *argv[]);
  3450. int main (int argc, char *argv[], char *envp[]);
  3451.  
  3452.      This is the function called by the startup code to run your program.  It 
  3453.      is not a library function.  ARGC is the number of command line arguments, 
  3454.      including the program name.  ARGV is an array of pointers to the command 
  3455.      line arguments.  ENVP is an array of pointers to the environment strings. 
  3456.      The last entry of ARGV and ENVP is a NULL pointer.  main() should always 
  3457.      return a value. If main() returns, exit() is called using the return value 
  3458.      of main() as argument.  If main() ends without return() or calling exit(), 
  3459.      the return code of the program is undefined.  This should be avoided. 
  3460.      After changing the environment with putenv(), you should use the environ 
  3461.      global variable instead of the ENVP argument of main(). 
  3462.  
  3463.      See also: environ , exit() , _response() , _wildcard() 
  3464.  
  3465.  
  3466. ΓòÉΓòÉΓòÉ 13.2. malloc() ΓòÉΓòÉΓòÉ
  3467.  
  3468. #include <stdlib.h>                           [ANSI]
  3469.  
  3470. void *malloc (size_t size);
  3471.  
  3472.      Allocate a block of memory big enough for holding SIZE bytes.  If there is 
  3473.      an error, malloc() returns NULL.  If SIZE is 0, zero bytes of memory are 
  3474.      allocated, the return value will be unequal NULL. 
  3475.  
  3476.      Restriction: The current malloc() implementation is not really suitable 
  3477.      for virtual memory because the complete heap (including allocated blocks) 
  3478.      is traversed for a free block.  It's possible to use GNU malloc instead. 
  3479.      Do not replace malloc() etc. when using emxlibc.dll as the functions in 
  3480.      emxlibc.dll won't call your replacements. 
  3481.  
  3482.      See also: calloc() , free() , realloc() 
  3483.  
  3484.  
  3485. ΓòÉΓòÉΓòÉ 13.3. matherr() ΓòÉΓòÉΓòÉ
  3486.  
  3487. #include <math.h>                             [PC]
  3488.  
  3489. int matherr (struct exception *x);
  3490.  
  3491.      Exception handler for floating point math. 
  3492.  
  3493.      Restriction: matherr() is not implemented. 
  3494.  
  3495.  
  3496. ΓòÉΓòÉΓòÉ 13.4. _memaccess() ΓòÉΓòÉΓòÉ
  3497.  
  3498. #include <sys/hw.h>                            [emx]
  3499.  
  3500. void *_memaccess (unsigned first, unsigned last, int flag);
  3501.  
  3502.      Gain access to physical memory under DOS.  To access memory which is 
  3503.      outside the memory space of the current process, you have to call 
  3504.      _memaccess().  emx option -am must be used to enable _memaccess(), see 
  3505.      `Using emx options'. 
  3506.  
  3507.      FIRST is the address of the first byte of the physical memory area, LAST 
  3508.      is the address of the last byte of the physical memory area to be 
  3509.      accessed.  Both addresses are physical addresses. FIRST and LAST+1 must be 
  3510.      page aligned: FIRST and LAST+1 must be integral multiples of 4096.  That 
  3511.      is, with using hexadecimal notation, FIRST must end with 000, LAST must 
  3512.      end with fff.  A pointer to virtual memory mapped to the physical memory 
  3513.      area is returned.  If FLAG is 0, read access is granted.  If FLAG is 1, 
  3514.      read and write access is granted.  Write access can be granted if the 
  3515.      address range of the physical memory area is entirely in the range 0xa0000 
  3516.      to 0xbffff.  If bytes outside this range are included in FIRST to LAST, 
  3517.      emx option -aw must be used to enable write access, see `Using emx 
  3518.      options'. 
  3519.  
  3520.      If _memaccess() fails, NULL is returned and errno set to one of the 
  3521.      following values: 
  3522.  
  3523.      EACCES         FIRST not page aligned; LAST+1 not page aligned; LAST not 
  3524.                     greater than FIRST; write access not allowed 
  3525.  
  3526.      EINVAL         FLAG is not 0 or 1 
  3527.  
  3528.      ENOMEM         not enough virtual memory for storing the paging tables; 
  3529.                     linear address space of process not big enough for the 
  3530.                     request 
  3531.  
  3532.      Restriction: _memaccess() is not available under OS/2. 
  3533.  
  3534.      Example: /emx/test/hw_mem.c 
  3535.  
  3536.      See also: _portaccess() 
  3537.  
  3538.  
  3539. ΓòÉΓòÉΓòÉ 13.5. _memcount() ΓòÉΓòÉΓòÉ
  3540.  
  3541. #include <string.h>   /* use this */                  [emx]
  3542. #include <memory.h>   /* or this */
  3543.  
  3544. size_t _memcount (void *mem, int c, size_t n);
  3545.  
  3546.      Return the number of bytes equal to C of the N bytes at address MEM. 
  3547.  
  3548.  
  3549. ΓòÉΓòÉΓòÉ 13.6. memccpy() ΓòÉΓòÉΓòÉ
  3550.  
  3551. #include <string.h>   /* use this */                   [PC]
  3552. #include <memory.h>   /* or this */
  3553.  
  3554. void *memccpy (void *s1, const void *s2, int c, size_t n);
  3555.  
  3556.      Copy at most the first N bytes from S2 to S1, stopping after copying a 
  3557.      byte equal to the lower 8 bits C.  If memccpy() stops because a byte equal 
  3558.      to C has been found, a pointer to the byte after the last destination byte 
  3559.      (which is equal to C) is returned. If N bytes have been copied without 
  3560.      finding a byte equal to C, NULL is returned. 
  3561.  
  3562.      See also: memchr() , memcpy() , memmove() , strcpy() , strncpy() 
  3563.  
  3564.  
  3565. ΓòÉΓòÉΓòÉ 13.7. memchr() ΓòÉΓòÉΓòÉ
  3566.  
  3567. #include <string.h>   /* use this */                  [ANSI]
  3568. #include <memory.h>   /* or this */
  3569.  
  3570. void *memchr (const void *s, int c, size_t n);
  3571.  
  3572.      Search the first N bytes at S for a byte equal to the lower 8 bits of C. 
  3573.      If a byte equal to C is found, a pointer to the first occurrence of C is 
  3574.      returned.  If there is no such byte, NULL is returned. 
  3575.  
  3576.  
  3577. ΓòÉΓòÉΓòÉ 13.8. memcmp() ΓòÉΓòÉΓòÉ
  3578.  
  3579. #include <string.h>   /* use this */                  [ANSI]
  3580. #include <memory.h>   /* or this */
  3581.  
  3582. int memcmp (const void *s1, const void *s2, size_t n);
  3583.  
  3584.      Compare the first N bytes at S1 to the first N bytes at S2.  If the two 
  3585.      buffers are identical (or if N is zero), 0 is returned. Otherwise, a value 
  3586.      is returned which indicates the relationship of the first differing byte: 
  3587.      a negative value means buffer S1 is lexically less than buffer S2, a 
  3588.      positive value means buffer S1 is lexically greater than buffer S2. 
  3589.  
  3590.      See also: bcmp() , _memdif() , memicmp() 
  3591.  
  3592.  
  3593. ΓòÉΓòÉΓòÉ 13.9. _memcount() ΓòÉΓòÉΓòÉ
  3594.  
  3595. #include <string.h>   /* use this */                  [emx]
  3596. #include <memory.h>   /* or this */
  3597.  
  3598. size_t _memcount (const void *mem, int c, size_t n);
  3599.  
  3600.      Count and return the number of occurrences of character C in the memory 
  3601.      area of size N bytes at MEM. 
  3602.  
  3603.  
  3604. ΓòÉΓòÉΓòÉ 13.10. memcpy() ΓòÉΓòÉΓòÉ
  3605.  
  3606. #include <string.h>   /* use this */                  [ANSI]
  3607. #include <memory.h>   /* or this */
  3608.  
  3609. void *memcpy (void *s1, const void *s2, size_t n);
  3610.  
  3611.      Copy memory.  Copy N bytes from S2 to S1.  The two regions must not 
  3612.      overlap.  memcpy() returns S1.  GCC generates in-line code for special 
  3613.      applications of memcpy().  Use memmove() instead of memcpy() to copy 
  3614.      overlapping regions of memory. 
  3615.  
  3616.      See also: bcopy() , memmove() 
  3617.  
  3618.  
  3619. ΓòÉΓòÉΓòÉ 13.11. _memdif() ΓòÉΓòÉΓòÉ
  3620.  
  3621. #include <string.h>   /* use this */                  [emx]
  3622. #include <memory.h>   /* or this */
  3623.  
  3624. size_t _memdif (const void *mem1, const void *mem2, size_t n);
  3625.  
  3626.      Compare the first N bytes at MEM1 to the first N bytes at MEM2. If the two 
  3627.      buffers are identical (or if N is zero), _MEMDIF_EQ is returned. 
  3628.      Otherwise, the byte offset of the first difference is returned. 
  3629.  
  3630.      See also: memcmp() 
  3631.  
  3632.  
  3633. ΓòÉΓòÉΓòÉ 13.12. memicmp() ΓòÉΓòÉΓòÉ
  3634.  
  3635. #include <string.h>   /* use this */                   [PC]
  3636. #include <memory.h>   /* or this */
  3637.  
  3638. int memicmp (const void *s1, const void *s2, size_t n);
  3639.  
  3640.      Compare the first N bytes at S1 to the first N bytes at S2, ignoring 
  3641.      letter case.  If the two buffers are identical (or if N is zero), 0 is 
  3642.      returned.  Otherwise, a value is returned which indicates the relationship 
  3643.      of the first differing byte: a negative value means buffer S1 is lexically 
  3644.      less than buffer S2 (after conversion to lower case), a positive value 
  3645.      means buffer S1 is lexically greater than buffer S2 (after conversion to 
  3646.      lower case). 
  3647.  
  3648.      See also: memcmp() , tolower() 
  3649.  
  3650.  
  3651. ΓòÉΓòÉΓòÉ 13.13. memmove() ΓòÉΓòÉΓòÉ
  3652.  
  3653. #include <string.h>   /* use this */                  [ANSI]
  3654. #include <memory.h>   /* or this */
  3655.  
  3656. void *memmove (void *s1, const void *s2, size_t n);
  3657.  
  3658.      Copy memory.  Copy N bytes from S2 to S1.  The two regions may overlap. 
  3659.      memmove() returns S1. 
  3660.  
  3661.      See also: bcopy() , memcpy() 
  3662.  
  3663.  
  3664. ΓòÉΓòÉΓòÉ 13.14. memset() ΓòÉΓòÉΓòÉ
  3665.  
  3666. #include <string.h>   /* use this */                  [ANSI]
  3667. #include <memory.h>   /* or this */
  3668.  
  3669. void *memset (void *s, int c, size_t n);
  3670.  
  3671.      Fill memory.  Set N bytes at S to C.  memset() returns S. 
  3672.  
  3673.      See also: bzero() 
  3674.  
  3675.  
  3676. ΓòÉΓòÉΓòÉ 13.15. _memswap() ΓòÉΓòÉΓòÉ
  3677.  
  3678. #include <string.h>   /* use this */                  [emx]
  3679. #include <memory.h>   /* or this */
  3680.  
  3681. void _memswap (void *s1, void *s2, size_t n);
  3682.  
  3683.      Swap two areas of memory of N bytes each, pointed to by S1 and S2. The two 
  3684.      areas must not overlap. 
  3685.  
  3686.  
  3687. ΓòÉΓòÉΓòÉ 13.16. mkdir() ΓòÉΓòÉΓòÉ
  3688.  
  3689. #include <stdlib.h>                            [BSD]
  3690.  
  3691. int mkdir (const char *name, long mode);
  3692.  
  3693.      Create a directory named NAME.  Only one directory can be created in one 
  3694.      step, therefore all but the last component of NAME must exist.  MODE 
  3695.      (containing the permission bits) is ignored. 
  3696.  
  3697.      See also: chdir() , rmdir() 
  3698.  
  3699.  
  3700. ΓòÉΓòÉΓòÉ 13.17. mktemp() ΓòÉΓòÉΓòÉ
  3701.  
  3702. #include <io.h>                             [UNIX]
  3703.  
  3704. char *mktemp (char *template);
  3705.  
  3706.      Create a unique file name by modifying TEMPLATE.  Trailing X characters of 
  3707.      TEMPLATE are replaced by a letter followed by digits (the process ID). 
  3708.      There should be 6 trailing X characters.  Only 26 different file names per 
  3709.      process can be created.  On success, TEMPLATE is returned.  On failure, 
  3710.      NULL is returned.  Note that the TEMPLATE string is modified, do not use a 
  3711.      string constant! 
  3712.  
  3713.      Example: 
  3714.  
  3715.               char tmp[20];
  3716.  
  3717.               strcpy (tmp, "exXXXXXX");
  3718.               if (mktemp (tmp) != NULL)
  3719.                 {
  3720.                   /* ... */
  3721.                 }
  3722.  
  3723.      See also: tempnam() , tmpfile() , tmpnam() 
  3724.  
  3725.  
  3726. ΓòÉΓòÉΓòÉ 13.18. mktime() ΓòÉΓòÉΓòÉ
  3727.  
  3728. #include <time.h>                            [ANSI]
  3729.  
  3730. time_t mktime (struct tm *t);
  3731.  
  3732.      Return the number of seconds elapsed between 00:00 GMT 1-Jan-1970 and the 
  3733.      moment defined by the structure pointed to by T.  T is interpreted as 
  3734.      local time.  On error, -1 cast as time_t is returned. 
  3735.  
  3736.      See also: gmtime() , localtime() 
  3737.  
  3738.  
  3739. ΓòÉΓòÉΓòÉ 13.19. modf() ΓòÉΓòÉΓòÉ
  3740.  
  3741. #include <math.h>                            [ANSI]
  3742.  
  3743. double modf (double x, double *int_ptr);
  3744.  
  3745.      Split X into fractional part (which is returned) and integer part (which 
  3746.      is stored to *INT_PTR).  Both the fractional and the integer part have the 
  3747.      same sign as X. 
  3748.  
  3749.      See also: ceil() , floor() , frexp() , rint() , trunc() 
  3750.  
  3751.  
  3752. ΓòÉΓòÉΓòÉ 13.20. _msize() ΓòÉΓòÉΓòÉ
  3753.  
  3754. #include <stdlib.h>                            [PC]
  3755.  
  3756. size_t _msize (const void *mem);
  3757.  
  3758.      Return the size of the memory block MEM which has been allocated by 
  3759.      malloc(), realloc() or calloc().  MEM must be the pointer obtained by 
  3760.      calling malloc(), realloc() or calloc(). 
  3761.  
  3762.      See also: _expand() 
  3763.  
  3764.  
  3765. ΓòÉΓòÉΓòÉ 14. function n ΓòÉΓòÉΓòÉ
  3766.  
  3767. This sections documents functions starting with the letter n 
  3768.  
  3769.  
  3770. ΓòÉΓòÉΓòÉ 14.1. _nls_init() ΓòÉΓòÉΓòÉ
  3771.  
  3772. #include <sys/nls.h>                           [emx]
  3773.  
  3774. void _nls_init (void);
  3775.  
  3776.      Initialize the global variables _nls_tolower_tab and _nls_toupper_tab 
  3777.      which are used by _nls_tolower(), _nls_toupper(), _nls_strlwr() and 
  3778.      _nls_strupr().  Before calling one of these functions, _nls_init() must be 
  3779.      called.  Moreover, _nls_init() should be called after changing the country 
  3780.      or code page.  The tables are initialized appropriately for the current 
  3781.      country code and code page. 
  3782.  
  3783.      See also: _fncmp() , _nls_tolower() , _nls_strlwr() 
  3784.  
  3785.  
  3786. ΓòÉΓòÉΓòÉ 14.2. _nls_strlwr() ΓòÉΓòÉΓòÉ
  3787.  
  3788. #include <sys/nls.h>                           [emx]
  3789.  
  3790. unsigned char *_nls_strlwr (unsigned char *string);
  3791. unsigned char *_nls_strupr (unsigned char *string);
  3792.  
  3793.      These functions convert all the characters of the string STRING to lower 
  3794.      case or upper case, respectively.  Accented characters etc. are converted 
  3795.      as well.  STRING is returned.  Before using one of these functions, 
  3796.      _nls_init() must be called. 
  3797.  
  3798.      See also: _nls_init() , _nls_tolower() , _nls_toupper() 
  3799.  
  3800.  
  3801. ΓòÉΓòÉΓòÉ 14.3. _nls_strupr() ΓòÉΓòÉΓòÉ
  3802.  
  3803.  
  3804. ΓòÉΓòÉΓòÉ 14.4. _nls_tolower() ΓòÉΓòÉΓòÉ
  3805.  
  3806. #include <sys/nls.h>                           [emx]
  3807.  
  3808. unsigned char _nls_tolower (unsigned char c);
  3809. unsigned char _nls_toupper (unsigned char c);
  3810.  
  3811.      These routines convert the character C to lower case or upper case, 
  3812.      respectively.  Accented characters etc.  are converted as well.  Before 
  3813.      using one of these routines, _nls_init() must be called.  These routines 
  3814.      are implemented as macros. 
  3815.  
  3816.      See also: _nls_init() , _nls_strlwr() , _nls_strupr() 
  3817.  
  3818.  
  3819. ΓòÉΓòÉΓòÉ 14.5. _nls_toupper() ΓòÉΓòÉΓòÉ
  3820.  
  3821.  
  3822. ΓòÉΓòÉΓòÉ 15. function o ΓòÉΓòÉΓòÉ
  3823.  
  3824. This sections documents functions starting with the letter o 
  3825.  
  3826.  
  3827. ΓòÉΓòÉΓòÉ 15.1. open() ΓòÉΓòÉΓòÉ
  3828.  
  3829. #include <io.h>                             [UNIX]
  3830. #include <fcntl.h>
  3831. #include <sys/types.h>
  3832. #include <sys/stat.h>
  3833.  
  3834. int open (const char *name, int oflag);
  3835. int open (const char *name, int oflag, int pmode);
  3836.  
  3837.      Open a file or device.  NAME is the name of the file or device. OFLAG 
  3838.      contains one or more of the following values, combined by the | operator: 
  3839.  
  3840.      O_RDONLY       Open for reading.  Writing is not allowed 
  3841.  
  3842.      O_WRONLY       Open for writing.  Reading is not allowed 
  3843.  
  3844.      O_RDWR         Open for reading and writing 
  3845.  
  3846.      O_APPEND       Move the file pointer to the end of file before any write 
  3847.                     operation takes place.  This is used for appending to a 
  3848.                     file 
  3849.  
  3850.      O_CREAT        Create the file if it does not exist 
  3851.  
  3852.      O_TRUNC        Truncate the size of the file to 0 
  3853.  
  3854.      O_EXCL         Fail if the O_CREAT is used and the file already exists 
  3855.  
  3856.      O_NDELAY       Currently ignored. 
  3857.  
  3858.      O_BINARY       Binary mode, no translation.  See below 
  3859.  
  3860.      O_TEXT         Text mode, translate CR/LF to LF.  See below 
  3861.  
  3862.      If a new file is created, PMODE (modified by the umask value), is used to 
  3863.      set the file permissions.  S_IREAD grants read access, S_IWRITE grants 
  3864.      write access.  S_IREAD is ignored (DOS and OS/2 limitation).  To grant 
  3865.      both read and write access, use S_IREAD|S_IWRITE. 
  3866.  
  3867.      There are two additional OFLAG flags: O_TEXT for text mode, O_BINARY for 
  3868.      binary mode.  Text mode, which is the default, translates each CR/LF pair 
  3869.      to a LF character on input and translates LF characters to CR/LF pairs on 
  3870.      output.  If the last character of a file is Ctrl-Z, it is discarded on 
  3871.      input.  Binary mode disables these transformations. 
  3872.  
  3873.      If the file or device cannot be opened, open() sets errno and returns -1. 
  3874.      If open() succeeds, the file handle is returned.  The file handle is 
  3875.      always greater than -1. 
  3876.  
  3877.      The mode O_TRUNC|O_RDONLY is not implemented.  The mode O_TEXT|O_WRONLY 
  3878.      does not overwrite a Ctrl-Z at the end of the file -- this causes problems 
  3879.      when appending.  Ctrl-Z at the end of the file is obsolete, anyway. 
  3880.  
  3881.      The file is opened in the sharing mode SH_DENYNO, see sopen(). 
  3882.  
  3883.      See also: close() , fdopen() , sopen() 
  3884.  
  3885.  
  3886. ΓòÉΓòÉΓòÉ 15.2. opendir() ΓòÉΓòÉΓòÉ
  3887.  
  3888. #include <sys/types.h>                          [BSD]
  3889. #include <dirent.h>       /* this is recommended */
  3890. #include <sys/dir.h>       /* this also works (for now) */
  3891.  
  3892. DIR *opendir (char *name);
  3893. int closedir (DIR *dirp);
  3894. struct dirent *readdir (DIR *dirp);
  3895. void seekdir (DIR *dirp, long off);
  3896. long telldir (DIR *dirp);
  3897. void rewinddir (DIR *dirp);
  3898.  
  3899.      Scan directories.  opendir() opens the directory NAME for scanning.  If 
  3900.      there is an error, NULL is returned.  Otherwise a value is returned which 
  3901.      is used with the other functions to continue the scanning. 
  3902.  
  3903.      closedir() ends the directory scan of DIRP.  After closing DIRP, you must 
  3904.      not use DIRP.  You should close all handles created by opendir(). 
  3905.  
  3906.      readdir() retrieves the next directory entry for DIRP.  If there are no 
  3907.      more directory entries, NULL is returned. 
  3908.  
  3909.      seekdir() moves to the specified directory entry of DIRP.  If OFF is 0, 
  3910.      the first directory entry will be read next.  If OFF is 1, the second 
  3911.      directory entry will be read next.  And so on. 
  3912.  
  3913.      telldir() returns the current position in DIRP.  0 is returned for the 
  3914.      first directory entry. 
  3915.  
  3916.      rewinddir() is equivalent to seekdir (0). 
  3917.  
  3918.      These functions use _fnlwr() to convert the file names to lower case on 
  3919.      upper-case-only file systems. 
  3920.  
  3921.      See also: _fnlwr() , _wildcard() 
  3922.  
  3923.  
  3924. ΓòÉΓòÉΓòÉ 15.3. _outp16() ΓòÉΓòÉΓòÉ
  3925.  
  3926.  
  3927. ΓòÉΓòÉΓòÉ 15.4. _outp32() ΓòÉΓòÉΓòÉ
  3928.  
  3929.  
  3930. ΓòÉΓòÉΓòÉ 15.5. _outp8() ΓòÉΓòÉΓòÉ
  3931.  
  3932. #include <sys/hw.h>                          [*] [emx]
  3933.  
  3934. void _outp8 (unsigned port, unsigned value);
  3935. void _outp16 (unsigned port, unsigned value);
  3936. void _outp32 (unsigned port, unsigned value);
  3937.  
  3938.      These functions write a single byte or word to a hardware port. _outp8() 
  3939.      writes the byte VALUE to PORT, _outp16() writes the 16-bit word VALUE to 
  3940.      PORT, _outp32() writes the 32-bit word VALUE to PORT. 
  3941.  
  3942.      You have to call _portaccess() first to enable access to a range of ports. 
  3943.      To make your program work under DOS, you have to use emx option -ai, see 
  3944.      `Using emx options'.  Under OS/2, your program requires emxio.dll in a 
  3945.      directory listed in LIBPATH.  When linking with LINK386 (-Zomf) or when 
  3946.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio).  libemxio 
  3947.      must not be used if the program should run under DOS. 
  3948.  
  3949.      See also: _portaccess() , _inp8() , _outps8() 
  3950.  
  3951.  
  3952. ΓòÉΓòÉΓòÉ 15.6. _outps16() ΓòÉΓòÉΓòÉ
  3953.  
  3954.  
  3955. ΓòÉΓòÉΓòÉ 15.7. _outps32() ΓòÉΓòÉΓòÉ
  3956.  
  3957.  
  3958. ΓòÉΓòÉΓòÉ 15.8. _outps8() ΓòÉΓòÉΓòÉ
  3959.  
  3960. #include <sys/hw.h>                          [*] [emx]
  3961.  
  3962. void _outps8 (unsigned port, const unsigned char *src, unsigned count);
  3963. void _outps16 (unsigned port, const unsigned short *src, unsigned count);
  3964. void _outps32 (unsigned port, const unsigned short *src, unsigned count);
  3965. void _outps8dac (unsigned port, const unsigned char *src, unsigned count);
  3966.  
  3967.      These functions write multiple bytes or words to a hardware port. 
  3968.      _outps8() writes COUNT bytes from SRC to PORT.  _outps16() writes COUNT 
  3969.      16-bit words from SRC to PORT.  _outps32() writes COUNT 32-bit words from 
  3970.      SRC to PORT. 
  3971.  
  3972.      The COUNT argument of _outps8() must not exceed 65535. 
  3973.  
  3974.      The SRC pointer of _outps16() must be aligned on a 16-bit boundary, that 
  3975.      is, the address must be even.  COUNT must not exceed 32768. 
  3976.  
  3977.      The SRC pointer of _outps32() must be aligned on a 32-bit boundary, that 
  3978.      is, the address must be a multiple of four.  COUNT must not exceed 65536. 
  3979.  
  3980.      _outps8dac() is a slowed-down version of _outps8() suitable for writing to 
  3981.      the VGA palette registers. 
  3982.  
  3983.      You have to call _portaccess() first to enable access to a range of ports. 
  3984.      To make your program work under DOS, you have to use emx option -ai, see 
  3985.      `Using emx options'.  Under OS/2, your program requires emxio.dll in a 
  3986.      directory listed in LIBPATH.  When linking with LINK386 (-Zomf) or when 
  3987.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio).  libemxio 
  3988.      must not be used if the program should run under DOS. 
  3989.  
  3990.      See also: _portaccess() , _inps8() , _outp8() 
  3991.  
  3992.  
  3993. ΓòÉΓòÉΓòÉ 15.9. _outps8dac() ΓòÉΓòÉΓòÉ
  3994.  
  3995.  
  3996. ΓòÉΓòÉΓòÉ 16. function p ΓòÉΓòÉΓòÉ
  3997.  
  3998. This sections documents functions starting with the letter p 
  3999.  
  4000.  
  4001. ΓòÉΓòÉΓòÉ 16.1. _path() ΓòÉΓòÉΓòÉ
  4002.  
  4003. #include <stdlib.h>                            [emx]
  4004.  
  4005. int _path (char *dst, const char *name);
  4006.  
  4007.      Find an executable file.  If NAME contains a colon, a slash or a 
  4008.      backslash, only that name will be tried.  If NAME does not contain colons, 
  4009.      slashes or backslashes, the file will be sought in the directories listed 
  4010.      in the EMXPATH and PATH environment variables. If the file is not found, 
  4011.      DST will be an empty string, errno will be ENOENT and -1 will be returned. 
  4012.      If the file is found, the path name will be copied to DST and 0 will be 
  4013.      returned.  No default extension is used. 
  4014.  
  4015.      See also: getenv() , _searchenv() 
  4016.  
  4017.  
  4018. ΓòÉΓòÉΓòÉ 16.2. pclose() ΓòÉΓòÉΓòÉ
  4019.  
  4020. #include <stdio.h>                            [UNIX]
  4021.  
  4022. int pclose (FILE *stream);
  4023.  
  4024.      Close a pipe created by popen().  pclose() waits until the child process 
  4025.      started by popen() ends and closes STREAM.  The termination status of the 
  4026.      child process is returned.  See wait() for details about the return value. 
  4027.      If there is an error, pclose() returns -1. 
  4028.  
  4029.      Restriction: pclose() is not implemented under DOS. 
  4030.  
  4031.      See also: popen() 
  4032.  
  4033.  
  4034. ΓòÉΓòÉΓòÉ 16.3. perror() ΓòÉΓòÉΓòÉ
  4035.  
  4036. #include <stdio.h>                            [ANSI]
  4037.  
  4038. void perror (const char *string);
  4039.  
  4040.      Print an appropriate error message for the current errno value to stderr. 
  4041.      If STRING is NULL or is the empty string "", just the error message is 
  4042.      printed.  Otherwise, STRING and a colon precede the error message. 
  4043.  
  4044.      See also: errno , strerror() , sys_errlist , sys_nerr 
  4045.  
  4046.  
  4047. ΓòÉΓòÉΓòÉ 16.4. pipe() ΓòÉΓòÉΓòÉ
  4048.  
  4049. #include <io.h>                             [UNIX]
  4050.  
  4051. int pipe (int *two_handles);
  4052.  
  4053.      Create an unnamed pipe.  The handle used for reading from the pipe is 
  4054.      stored to TWO_HANDLES[0], the handle used for writing to the pipe is 
  4055.      stored to TWO_HANDLES[1].  Both handles are in text mode; use setmode() if 
  4056.      you want to switch to binary mode.  pipe() returns 0 if successful, -1 
  4057.      otherwise. 
  4058.  
  4059.      Restrictions: pipe() is implemented for OS/2 only. 
  4060.  
  4061.      See also: close() , dup() , popen() , setmode() 
  4062.  
  4063.  
  4064. ΓòÉΓòÉΓòÉ 16.5. popen() ΓòÉΓòÉΓòÉ
  4065.  
  4066. #include <stdio.h>                            [UNIX]
  4067.  
  4068. FILE *popen (const char *command, const char *mode);
  4069.  
  4070.      Start a child process and connect one end of a pipe to it. popen() runs 
  4071.      the command COMMAND by starting a command processor. MODE must start with 
  4072.      `r' or `w'.  If it starts with `r', stdout of COMMAND will be redirected, 
  4073.      you can get the output by reading from the stream returned by popen().  If 
  4074.      MODE starts with `w', stdin of COMMAND will be redirected, you can send 
  4075.      data to COMMAND by writing to the stream returned by popen().  Append `b' 
  4076.      for binary mode or `t' for text mode to the MODE string.  The default is 
  4077.      text mode, see also fopen().  If an error occurs, popen() returns NULL. 
  4078.      Otherwise, popen() returns a stream which is connected to the local end of 
  4079.      the pipe.  Use pclose() to close the stream. 
  4080.  
  4081.      Restriction: popen() is not implemented under DOS. 
  4082.  
  4083.      See also: pclose() , pipe() , _splitargs() , system() 
  4084.  
  4085.  
  4086. ΓòÉΓòÉΓòÉ 16.6. _portaccess() ΓòÉΓòÉΓòÉ
  4087.  
  4088. #include <sys/hw.h>                            [emx]
  4089.  
  4090. int _portaccess (unsigned first, unsigned last);
  4091.  
  4092.      Gain access to hardware ports.  To access hardware ports, you have to call 
  4093.      _portaccess().  FIRST is the address of the first port, LAST is the 
  4094.      address of the last port.  emx option -ai must be used to enable 
  4095.      _portaccess() under DOS, see `Using emx options'.  On success, 0 is 
  4096.      returned.  On failure, -1 is returned. 
  4097.  
  4098.      _portaccess() always succeeds under OS/2. 
  4099.  
  4100.      Example: /emx/test/hw_io.c 
  4101.  
  4102.      See also: _memaccess() , _inp8() , _outp8() , _wait0() 
  4103.  
  4104.  
  4105. ΓòÉΓòÉΓòÉ 16.7. pow() ΓòÉΓòÉΓòÉ
  4106.  
  4107. #include <math.h>                            [ANSI]
  4108.  
  4109. double pow (double x, double y);
  4110.  
  4111.      Raise X to the power of Y and return the result.  If pow() is undefined 
  4112.      for a given pair of X and Y, #NAN is returned and errno is set to EDOM. 
  4113.      On overflow, #INF is returned and errno is set to ERANGE. 
  4114.  
  4115.      See also: cbrt() , exp() , log() , sqrt() 
  4116.  
  4117.  
  4118. ΓòÉΓòÉΓòÉ 16.8. printf() ΓòÉΓòÉΓòÉ
  4119.  
  4120. #include <stdio.h>                            [ANSI]
  4121.  
  4122. int printf (const char *format, ...);
  4123.  
  4124.      Formatted output to the stdout stream.  On success, the number of 
  4125.      characters written to stdout is returned.  Otherwise, EOF is returned. 
  4126.  
  4127.      Characters in FORMAT are copied unmodified to the destination unless a 
  4128.      format specification is hit.  A format specification has the following 
  4129.      format: 
  4130.  
  4131.               %[flags][width][.precision][size]type
  4132.  
  4133.      where items in brackets are optional.  For each format specification an 
  4134.      argument of the specified type is taken from the argument list, is 
  4135.      formatted according to the format specification and written to the 
  4136.      destination.  To include one percent sign in the output, put two percent 
  4137.      signs (%%) into the FORMAT string. 
  4138.  
  4139.      The following FLAGS characters are available: 
  4140.  
  4141.      -         left-justify the converted value.  Without this flag, the value 
  4142.                is right-justified 
  4143.  
  4144.      +         always insert sign (+ or -) for a signed number 
  4145.  
  4146.      (blank)   insert a blank space if the conversion of a signed number 
  4147.                doesn't start with a sign (+ or -).  If both + and (blank) are 
  4148.                given, (blank) is ignored. 
  4149.  
  4150.      0         pad with '0' characters instead of blanks.  This flag is ignored 
  4151.                for non-numeric conversions 
  4152.  
  4153.      #         use alternate conversion.  See below 
  4154.  
  4155.      If the length of the converted value is less than WIDTH, it is padded with 
  4156.      blanks or '0' characters, depending on the 0 flag and the conversion type. 
  4157.      Unless the - flag is used, the field is padded on the left.  If the length 
  4158.      of the converted value is greater than WIDTH, the field is not truncated. 
  4159.      WIDTH is either a decimal number or a '*' character.  In the latter case, 
  4160.      the width is taken from the argument list. 
  4161.  
  4162.      PRECISION specifies the number of decimal digits after the decimal point 
  4163.      of a floating point number.  For the s conversion, PRECISION specifies the 
  4164.      maximum string length.  PRECISION is either a decimal number or a '*' 
  4165.      character.  In the latter case, the precision is taken from the argument 
  4166.      list. 
  4167.  
  4168.      SIZE is either h for a `short' type or l for a `long' type.  If SIZE is 
  4169.      not specified, the default size is used.  Use L or ll for a `long long' 
  4170.      type. 
  4171.  
  4172.      TYPE is one of the following characters: 
  4173.  
  4174.      c         character (char) 
  4175.  
  4176.      d         signed decimal number (int) 
  4177.  
  4178.      e         floating-point number (double), using e as exponent sign: 
  4179.                -#.###e+##.  There's exactly one digit before the decimal point. 
  4180.                The number of digits after the decimal point is specified by 
  4181.                PRECISION.  If PRECISION is missing, 6 digits are printed 
  4182.  
  4183.      E         floating-point number (double), using E as exponent sign. See e 
  4184.  
  4185.      f         floating-point number (double) printed in fixed-point format. 
  4186.                The number of digits after the decimal point is specified by 
  4187.                PRECISION.  If PRECISION is missing, 6 digits are printed.  If 
  4188.                PRECISION is specified as 0, no decimal point is printed 
  4189.  
  4190.      g         floating-point number (double).  The number is printed using 
  4191.                type d, e or f, depending on the number.  If the number is an 
  4192.                integer, type d is used.  If the exponent (of f format output) 
  4193.                is less than -4 or greater than PRECISION (default: 6), type e 
  4194.                is used.  Otherwise, type f is used 
  4195.  
  4196.      G         floating-point number (double), using E as exponent sign instead 
  4197.                of e.  See g 
  4198.  
  4199.      i         signed decimal number (int).  Same as d 
  4200.  
  4201.      n         store the number of characters formatted up to this point in the 
  4202.                FORMAT string (int *).  No output 
  4203.  
  4204.      o         octal number (unsigned).  The # flag prepends 0. 
  4205.  
  4206.      p         pointer (void *).  The output format of a pointer is 
  4207.                implementation-dependent.  In this implementation, p is 
  4208.                equivalent to x 
  4209.  
  4210.      s         string (char *).  Print characters of the string until a null 
  4211.                character is reached or PRECISION (if specified and non-zero) is 
  4212.                exhausted 
  4213.  
  4214.      u         unsigned decimal number (unsigned) 
  4215.  
  4216.      x         hexadecimal number (unsigned), using lower-case letters.  The # 
  4217.                flag prepends 0x. 
  4218.  
  4219.      X         hexadecimal number (unsigned), using upper-case letters. The # 
  4220.                flag prepends 0x 
  4221.  
  4222.      Restriction: The output could be more accurate for floating point values. 
  4223.      Some rather special cases are not implemented. 
  4224.  
  4225.      See also: fopen() , fwrite() , scanf() 
  4226.  
  4227.  
  4228. ΓòÉΓòÉΓòÉ 16.9. ptrace() ΓòÉΓòÉΓòÉ
  4229.  
  4230. #include <sys/ptrace.h>                       [*] [SysV]
  4231.  
  4232. int ptrace (int request, int pid, int addr, int data);
  4233.  
  4234.      Debug child process.  The child process is identified by PID.  The 
  4235.      following REQUEST codes are defined: 
  4236.  
  4237.      PTRACE_TRACEME           Not implemented -- use spawn (P_DEBUG) instead 
  4238.  
  4239.      PTRACE_PEEKTEXT          Read a 32-bit word from the text space of the 
  4240.                               child process.  ADDR is the address of the word. 
  4241.                               The word at ADDR is returned. 
  4242.  
  4243.      PTRACE_PEEKDATA          See PTRACE_PEEKTEXT.  On machines with separate 
  4244.                               data and text space, this request will read from 
  4245.                               the data space. 
  4246.  
  4247.      PTRACE_PEEKUSER          Read a 32-bit word from the process table of the 
  4248.                               child process.  This can be used to read the 
  4249.                               registers of the child process.  See sys/user.h 
  4250.                               for details. 
  4251.  
  4252.      PTRACE_POKETEXT          Write the 32-bit word DATA to address ADDR of the 
  4253.                               text space of the child process. 
  4254.  
  4255.      PTRACE_POKEDATA          See PTRACE_POKETEXT.  On machines with separate 
  4256.                               data and text space, this request will write to 
  4257.                               the data space. 
  4258.  
  4259.      PTRACE_POKEUSER          Write a 32-bit word to the process table of the 
  4260.                               child process.  This can be used to alter the 
  4261.                               registers of the child process.  See sys/user.h 
  4262.                               for details.  Not all registers can be modified. 
  4263.  
  4264.      PTRACE_RESUME            Resume the child process.  The child process will 
  4265.                               run until a signal occurs. 
  4266.  
  4267.      PTRACE_EXIT              Kill the child process. 
  4268.  
  4269.      PTRACE_STEP              Execute the next instruction of the child 
  4270.                               process. 
  4271.  
  4272.      PTRACE_SESSION           If DATA is 0, select the session of the calling 
  4273.                               process.  If DATA is 1, select the child session. 
  4274.                               If DATA is 2, the child session is automatically 
  4275.                               selected by the next PTRACE_STEP (on CALL 
  4276.                               instructions only) or PTRACE_RESUME command. 
  4277.                               This request is emx specific and is ignored under 
  4278.                               DOS. 
  4279.  
  4280.      As -1 is a legal return value for the PTRACE_PEEK requests, you should set 
  4281.      errno to 0 before calling ptrace() and check errno after the call. 
  4282.  
  4283.      Restrictions: Currently, a process can debug only one child process. 
  4284.      While debugging a child process, wait() cannot be used for waiting for 
  4285.      another child.  When using the system call library libsys.lib (-Zsys), 
  4286.      ptrace() is not available. 
  4287.  
  4288.      See also: spawn() , wait() 
  4289.  
  4290.  
  4291. ΓòÉΓòÉΓòÉ 16.10. putc() ΓòÉΓòÉΓòÉ
  4292.  
  4293. #include <stdio.h>                            [ANSI]
  4294.  
  4295. int putc (int c, FILE *stream);
  4296. int putchar (int c);
  4297.  
  4298.      Write the character C to STREAM or stdout, respectively. 
  4299.  
  4300.               putchar (c)
  4301.  
  4302.      is equivalent to 
  4303.  
  4304.               putc (c, stdout).
  4305.  
  4306.      The character written is returned.  On failure, EOF is returned. putc() 
  4307.      and putchar() are in-line functions or macros. 
  4308.  
  4309.      See also: fprintf() , fputs() , fputc() 
  4310.  
  4311.  
  4312. ΓòÉΓòÉΓòÉ 16.11. putchar() ΓòÉΓòÉΓòÉ
  4313.  
  4314.  
  4315. ΓòÉΓòÉΓòÉ 16.12. putenv() ΓòÉΓòÉΓòÉ
  4316.  
  4317. #include <stdlib.h>                            [BSD]
  4318.  
  4319. int putenv (const char *string);
  4320.  
  4321.      Put STRING into the environment of the calling process.  STRING is a 
  4322.      pointer to a string of the form 
  4323.  
  4324.               name=value
  4325.  
  4326.      where NAME is the name of the environment variable and VALUE is the value 
  4327.      of the environment variable.  If the environment variable NAME already 
  4328.      exists, the current value is replaced by the new value, VALUE.  If NAME is 
  4329.      not already in the environment, STRING is put into the environment.  Do 
  4330.      not free or reuse STRING after calling putenv().  Using an auto variable 
  4331.      is also a bad idea.  After calling putenv(), do not use the ENVP argument 
  4332.      of main().  Use environ instead.  On success, 0 is returned.  On failure, 
  4333.      -1 is returned. 
  4334.  
  4335.      See also: getenv() 
  4336.  
  4337.  
  4338. ΓòÉΓòÉΓòÉ 16.13. puts() ΓòÉΓòÉΓòÉ
  4339.  
  4340. #include <stdio.h>                            [ANSI]
  4341.  
  4342. int puts (const char *string);
  4343.  
  4344.      Write the string STRING followed by a newline (LF) character (which is 
  4345.      translated to CR/LF if stdout is in text mode) to the stdout stream.  On 
  4346.      failure, EOF is returned.  Otherwise, a non-negative value is returned. 
  4347.  
  4348.      See also: fputs() , fgets() 
  4349.  
  4350.  
  4351. ΓòÉΓòÉΓòÉ 16.14. putw() ΓòÉΓòÉΓòÉ
  4352.  
  4353. #include <stdio.h>                            [UNIX]
  4354.  
  4355. int putw (int x, FILE *stream);
  4356.  
  4357.      Write the word (int) X to STREAM and return it.  On failure, -1 is 
  4358.      returned.  As -1 is also a possible int value, you have to use ferror() to 
  4359.      recognize an error condition. 
  4360.  
  4361.      Avoid using this function. 
  4362.  
  4363.      See also: getw() , fwrite() 
  4364.  
  4365.  
  4366. ΓòÉΓòÉΓòÉ 17. function q ΓòÉΓòÉΓòÉ
  4367.  
  4368. This sections documents functions starting with the letter q 
  4369.  
  4370.  
  4371. ΓòÉΓòÉΓòÉ 17.1. qsort() ΓòÉΓòÉΓòÉ
  4372.  
  4373. #include <stdlib.h> /* use this */                    [ANSI]
  4374. #include <search.h> /* or this */
  4375.  
  4376. void qsort (void *base, size_t num, size_t width,
  4377.       int (*compare)(const void *x1, const void *x2));
  4378.  
  4379.      ort an array.  BASE is a pointer to the beginning of the array. he array 
  4380.      contains NUM elements of WIDTH bytes each.  COMPARE is alled to compare 
  4381.      the two elements pointed to by X1 and X2. OMPARE should return a negative 
  4382.      value, if element X1 is less than lement X2, zero, if element X1 equals 
  4383.      element X2, and a positive alue if element X1 is greater than element X2. 
  4384.  
  4385.      sort() is not stable: the order of equal elements is undefined. 
  4386.  
  4387.  
  4388. ΓòÉΓòÉΓòÉ 18. function r ΓòÉΓòÉΓòÉ
  4389.  
  4390. This sections documents functions starting with the letter r 
  4391.  
  4392.  
  4393. ΓòÉΓòÉΓòÉ 18.1. raise() ΓòÉΓòÉΓòÉ
  4394.  
  4395. #include <signal.h>                           [ANSI]
  4396.  
  4397. int raise (int sig);
  4398.  
  4399.      Raise the signal SIG.  This causes the program to end, if SIG_DFL is 
  4400.      installed for that signal.  If SIG_IGN is installed for that signal, the 
  4401.      request is ignored.  If a signal handler has been installed and the signal 
  4402.      is not waiting for acknowledgement, the signal handler will be called.  If 
  4403.      SIGQUIT, SIGILL, SIGTRAP, SIGEMT, SIGFPE, SIGBUS, SIGSEGV or SIGSYS is 
  4404.      raised and SIG_DFL is installed for that signal, a core dump file will be 
  4405.      created unless the -c emx option is used (see `Using emx options'). 
  4406.  
  4407.      If successful, raise() returns 0.  Otherwise -1 is returned and errno set 
  4408.      to the following value: 
  4409.  
  4410.      EINVAL   SIG is not a valid signal number 
  4411.  
  4412.      Restriction: Core dump files are not written if LINK386 was used for 
  4413.      linking. 
  4414.  
  4415.      See also: abort() , kill() , signal() 
  4416.  
  4417.  
  4418. ΓòÉΓòÉΓòÉ 18.2. rand() ΓòÉΓòÉΓòÉ
  4419.  
  4420. #include <stdlib.h>                           [ANSI]
  4421.  
  4422. int rand (void);
  4423. void srand (unsigned int seed);
  4424.  
  4425.      rand() returns a pseudo-random number in the range 0 through RAND_MAX 
  4426.      (32767).  RAND_MAX is defined in stdlib.h.  srand() initializes the 
  4427.      sequence of random numbers.  The initial SEED value (without calling 
  4428.      srand()) is 1. 
  4429.  
  4430.      See also: libbsd (bsddev.doc) 
  4431.  
  4432.  
  4433. ΓòÉΓòÉΓòÉ 18.3. read() ΓòÉΓòÉΓòÉ
  4434.  
  4435. #include <io.h>                             [UNIX]
  4436.  
  4437. int read (int handle, void *buf, size_t nbyte);
  4438.  
  4439.      Read up to NBYTE characters from file HANDLE to the buffer BUF. The number 
  4440.      of characters read is returned.  If there is an error, -1 is returned. 
  4441.      The return value may be less than NBYTE.  For instance, this happens if 
  4442.      the end of the file is reached.  See also `termio' below.  If HANDLE is 0 
  4443.      and HANDLE refers to the keyboard and O_NDELAY has been set with fcntl() 
  4444.      for HANDLE and the IDEFAULT and ICANON bits have been reset with ioctl() 
  4445.      for HANDLE, -1 is returned and errno is set to EAGAIN if the call to 
  4446.      read() would block.  Even if there is some data available, but not enough 
  4447.      with respect to VMIN, -1 is returned. 
  4448.  
  4449.      See also: open() , setmode() , write() 
  4450.  
  4451.  
  4452. ΓòÉΓòÉΓòÉ 18.4. readdir() ΓòÉΓòÉΓòÉ
  4453.  
  4454.  
  4455. ΓòÉΓòÉΓòÉ 18.5. _read_kbd() ΓòÉΓòÉΓòÉ
  4456.  
  4457. #include <stdlib.h>                          [*] [emx]
  4458. #include <sys/kbdscan.h>  /* optional, for extended scan codes */
  4459.  
  4460. int _read_kbd (int echo, int wait, int sig);
  4461.  
  4462.      Get a character from the keyboard.  Extended codes are preceded by a null 
  4463.      character (call _read_kbd() again!), the scan codes are defined in 
  4464.      /emx/include/sys/kbdscan.h.  If ECHO is non-zero, input will be echoed, if 
  4465.      WAIT is non-zero, _read_kbd() will wait until a character is available, if 
  4466.      WAIT is zero and no character is available, _read_kbd() will return -1, if 
  4467.      SIG is zero, Ctrl-C will be ignored.  Examples: 
  4468.  
  4469.               #define getch()  _read_kbd (0, 1, 0)
  4470.               #define getche() _read_kbd (1, 1, 0)
  4471.  
  4472.      Please use `termio' instead, see below.  See also the termio.c test 
  4473.      program. 
  4474.  
  4475.      It's important to call _read_kbd() again if _read_kbd() returns 0. To see 
  4476.      what happens if you don't, type Ctrl-S F10 under DOS. 
  4477.  
  4478.      See also: ioctl() , read() , conio.h 
  4479.  
  4480.  
  4481. ΓòÉΓòÉΓòÉ 18.6. realloc() ΓòÉΓòÉΓòÉ
  4482.  
  4483. #include <stdlib.h>                           [ANSI]
  4484.  
  4485. void *realloc (void *mem, size_t size);
  4486.  
  4487.      Reallocate the block of memory pointed to by MEM, making it big enough to 
  4488.      hold SIZE bytes.  If MEM is NULL, a new block of memory is allocated. 
  4489.      Otherwise, MEM must be a pointer returned by calloc(), malloc() or 
  4490.      realloc(); the size of MEM is adjusted.  If MEM cannot be expanded 
  4491.      in-place, it is moved.  A pointer to the new, resized block of memory is 
  4492.      returned.  If there is not enough memory available, NULL is returned. 
  4493.  
  4494.      MEM can also be a pointer to a block of memory freed by free() as long as 
  4495.      calloc(), malloc() and realloc() have not been called since freeing the 
  4496.      block.  Using this feature is not recommended, it may be removed in future 
  4497.      implementations of realloc(). 
  4498.  
  4499.      See also: malloc() 
  4500.  
  4501.  
  4502. ΓòÉΓòÉΓòÉ 18.7. _remext() ΓòÉΓòÉΓòÉ
  4503.  
  4504. #include <stdlib.h>                            [emx]
  4505.  
  4506. void _remext (char *path);
  4507.  
  4508.      Remove the extension from the file name PATH.  If the last member of PATH 
  4509.      starts with a dot ("/usr/mattes/.profile", for instance) PATH isn't 
  4510.      modified. 
  4511.  
  4512.      See also: _defext() , _getext() , _splitpath() 
  4513.  
  4514.  
  4515. ΓòÉΓòÉΓòÉ 18.8. remove() ΓòÉΓòÉΓòÉ
  4516.  
  4517. #include <stdio.h>    /* use this */                  [ANSI]
  4518. #include <io.h>     /* or this */
  4519.  
  4520. int remove (const char *name);
  4521.  
  4522.      Delete the file NAME.  0 is returned if successful, -1 if not. Under OS/2 
  4523.      and DOS, unlink() and remove() are equivalent. 
  4524.  
  4525.      See also: unlink() 
  4526.  
  4527.  
  4528. ΓòÉΓòÉΓòÉ 18.9. rename() ΓòÉΓòÉΓòÉ
  4529.  
  4530. #include <stdio.h>    /* use this */                  [ANSI]
  4531. #include <io.h>     /* or this */
  4532.  
  4533. int rename (const char *old_name, const char *new_name);
  4534.  
  4535.      Rename the file or directory OLD_NAME to NEW_NAME.  Moving a file to a 
  4536.      different directory on the same drive is possible.  0 is returned if 
  4537.      successful, -1 if not. 
  4538.  
  4539.  
  4540. ΓòÉΓòÉΓòÉ 18.10. _response() ΓòÉΓòÉΓòÉ
  4541.  
  4542. #include <stdlib.h>                            [emx]
  4543.  
  4544. void _response (int *argcp, char ***argvp);
  4545.  
  4546.      Expand response files.  If you want response files (@filename, filename 
  4547.      contains a list of arguments one per line) to be expanded, call 
  4548.  
  4549.               _response (&argc, &argv);
  4550.  
  4551.      at the beginning of main().  Response file arguments enclosed in double 
  4552.      quotes won't be expanded.  If a response file cannot be opened, the 
  4553.      argument is kept unchanged. 
  4554.  
  4555.      See also: main() , _wildcard() 
  4556.  
  4557.  
  4558. ΓòÉΓòÉΓòÉ 18.11. rewind() ΓòÉΓòÉΓòÉ
  4559.  
  4560. #include <stdio.h>                            [ANSI]
  4561.  
  4562. void rewind (FILE *stream);
  4563.  
  4564.      Move the file pointer of STREAM to the beginning of the file and clear the 
  4565.      error and end-of-file indicators. 
  4566.  
  4567.      See also: fseek() 
  4568.  
  4569.  
  4570. ΓòÉΓòÉΓòÉ 18.12. rewinddir() ΓòÉΓòÉΓòÉ
  4571.  
  4572.  
  4573. ΓòÉΓòÉΓòÉ 18.13. _rfnlwr() ΓòÉΓòÉΓòÉ
  4574.  
  4575.  
  4576. ΓòÉΓòÉΓòÉ 18.14. rindex() ΓòÉΓòÉΓòÉ
  4577.  
  4578. #include <strings.h>                           [BSD]
  4579.  
  4580. char *rindex (const char *string, int c);
  4581.  
  4582.      Return a pointer to the last occurrence of the character C in the 
  4583.      null-terminated string STRING.  If there is no character C in STRING, NULL 
  4584.      is returned.  If C is 0, a pointer to the terminating null character of 
  4585.      STRING is returned. 
  4586.  
  4587.      See also: index() , strrchr() 
  4588.  
  4589.  
  4590. ΓòÉΓòÉΓòÉ 18.15. rint() ΓòÉΓòÉΓòÉ
  4591.  
  4592. #include <math.h>
  4593.  
  4594. double rint (double x);
  4595.  
  4596.      Return as floating-point number the integer that is nearest to X. If 
  4597.      there's a tie, that is, fabs(rint(x)-x) == 0.5, rint(x) is even. 
  4598.  
  4599.      See also: ceil() , floor() , trunc() 
  4600.  
  4601.  
  4602. ΓòÉΓòÉΓòÉ 18.16. rmdir() ΓòÉΓòÉΓòÉ
  4603.  
  4604. #include <stdlib.h>                            [BSD]
  4605.  
  4606. int rmdir (const char *name);
  4607.  
  4608.      Remove the directory NAME.  Only one directory is removed in one step.  If 
  4609.      NAME (or a subdirectory of NAME) is the current working directory of a 
  4610.      process, it cannot be removed.  On success, 0 is returned.  On failure, -1 
  4611.      is returned. 
  4612.  
  4613.      See also: mkdir() 
  4614.  
  4615.  
  4616. ΓòÉΓòÉΓòÉ 18.17. _rmtmp() ΓòÉΓòÉΓòÉ
  4617.  
  4618. #include <stdio.h>                            [UNIX]
  4619.  
  4620. int _rmtmp (void);
  4621.  
  4622.      Close and delete the files created by tmpfile() in the current working 
  4623.      directory.  It must be used only in the directory in which tmpfile() 
  4624.      created the temporary files.  The number of closed (and deleted) files is 
  4625.      returned. 
  4626.  
  4627.      See also: tmpfile() 
  4628.  
  4629.  
  4630. ΓòÉΓòÉΓòÉ 19. function s ΓòÉΓòÉΓòÉ
  4631.  
  4632. This sections documents functions starting with the letter s 
  4633.  
  4634.  
  4635. ΓòÉΓòÉΓòÉ 19.1. sbrk() ΓòÉΓòÉΓòÉ
  4636.  
  4637. #include <stdlib.h>                           [UNIX]
  4638.  
  4639. void *sbrk (int incr);
  4640.  
  4641.      Change memory allocation by INCR bytes.  If INCR is positive, the memory 
  4642.      limit is increased.  If INCR is negative, the memory limit is decreased 
  4643.      (not yet completely implemented).  On success, sbrk() returns the previous 
  4644.      memory limit.  Otherwise, -1 cast as pointer is returned and errno set to 
  4645.      ENOMEM.  Please don't use sbrk() -- use malloc() instead for memory 
  4646.      allocation. 
  4647.  
  4648.      See also: brk() , malloc() 
  4649.  
  4650.  
  4651. ΓòÉΓòÉΓòÉ 19.2. scanf() ΓòÉΓòÉΓòÉ
  4652.  
  4653. #include <stdio.h>                            [ANSI]
  4654.  
  4655. int scanf (const char *format, ...);
  4656.  
  4657.      The stream STREAM is read and input is parsed according to the format 
  4658.      string FORMAT.  For each field in FORMAT there must be a pointer to the 
  4659.      location receiving the value.  The pointers are passed after the FORMAT 
  4660.      argument. 
  4661.  
  4662.      Whitespace in FORMAT matches whitespace in the input.  All other 
  4663.      characters except for % are compared to the input.  Parsing ends if a 
  4664.      mismatch is encountered.  %% in FORMAT matches % in the input.  A % which 
  4665.      is not followed by another % or the end of the string starts a field 
  4666.      specification.  The field in the input is interpreted according to the 
  4667.      field specification.  For most field types, whitespace is ignored at the 
  4668.      start of a field.  Field specifications have the format 
  4669.  
  4670.               %[*][width][size]type
  4671.  
  4672.      where items in brackets are optional.  If the * is present, the value is 
  4673.      not assigned.  No pointer will be fetched from the argument list. 
  4674.  
  4675.      WIDTH is a positive integral decimal number specifying the maximum field 
  4676.      width.  At most this many characters are read for this field. 
  4677.  
  4678.      SIZE is either h for a `short' type or l for a `long' type.  If SIZE is 
  4679.      omitted, the default size is used. 
  4680.  
  4681.      TYPE is one of the following characters: 
  4682.  
  4683.      c         character.  Whitespace is not skipped (char) 
  4684.  
  4685.      d         decimal integer (int) 
  4686.  
  4687.      e f g     floating-point value (float) 
  4688.  
  4689.      E F G     floating-point value (float) 
  4690.  
  4691.      i         decimal, octal or hexadecimal integer (int) 
  4692.  
  4693.      n         number of characters read so far (int).  Doesn't take input 
  4694.  
  4695.      o         octal integer (int) 
  4696.  
  4697.      s         string (char *) 
  4698.  
  4699.      x         hexadecimal integer (int) 
  4700.  
  4701.      [         string (char *)  [...] 
  4702.  
  4703.      Note: Use %lf for variables of type `double'. 
  4704.  
  4705.      On success, the number of fields converted is returned. Otherwise, EOF is 
  4706.      returned. 
  4707.  
  4708.      See also: fgets() , fread() , fscanf() , printf() , sscanf() , vscanf() 
  4709.  
  4710.  
  4711. ΓòÉΓòÉΓòÉ 19.3. _scrsize() ΓòÉΓòÉΓòÉ
  4712.  
  4713. #include <stdlib.h>                          [*] [emx]
  4714.  
  4715. void _scrsize (int *dst);
  4716.  
  4717.      Retrieve the screen (window) size.  The number of text columns (width) is 
  4718.      stored to DST[0], the number of text rows (height) is stored to DST[1]. 
  4719.  
  4720.      Restriction: When using the system call library libsys.lib (-Zsys), this 
  4721.      function always sets DST[0] to 80 and DST[1] to 25. 
  4722.  
  4723.      See also: v_dimen() 
  4724.  
  4725.  
  4726. ΓòÉΓòÉΓòÉ 19.4. _searchenv() ΓòÉΓòÉΓòÉ
  4727.  
  4728. #include <stdlib.h>                            [PC]
  4729.  
  4730. void _searchenv (const char *name, const char *var, char *path);
  4731.  
  4732.      Search a file in the directories listed in an environment variable. 
  4733.      First, the file name NAME is tried as is.  If that file does not exist, 
  4734.      the directories listed in the environment variable VAR are searched.  If 
  4735.      the file is found, the constructed path name (either NAME or a directory 
  4736.      plus NAME) will be copied to PATH.  If the file is not found, PATH will be 
  4737.      the empty string. 
  4738.  
  4739.      See also: getenv() , _path() 
  4740.  
  4741.  
  4742. ΓòÉΓòÉΓòÉ 19.5. seekdir() ΓòÉΓòÉΓòÉ
  4743.  
  4744.  
  4745. ΓòÉΓòÉΓòÉ 19.6. _seek_hdr() ΓòÉΓòÉΓòÉ
  4746.  
  4747. #include <io.h>                              [emx]
  4748.  
  4749. int _seek_hdr (int handle);
  4750.  
  4751.      Move the file pointer of HANDLE to the a.out header of an executable file 
  4752.      (a.out or bound .exe).  _seek_hdr() assumes that the file pointer points 
  4753.      to the beginning of the header (ie, the beginning of the file).  If there 
  4754.      is an error, _seek_hdr() sets errno and returns -1.  If no header is 
  4755.      found, the file pointer will be repositioned to the original position. 
  4756.  
  4757.      See also: _fseek_hdr() 
  4758.  
  4759.  
  4760. ΓòÉΓòÉΓòÉ 19.7. select() ΓòÉΓòÉΓòÉ
  4761.  
  4762. #include <sys/types.h>                        [*] [BSD]
  4763. #include <sys/time.h>
  4764. #include <io.h>
  4765.  
  4766. int select (int nfds, struct _fd_set *readfds, struct _fd_set *writefds,
  4767.       struct _fd_set *exceptfds, struct timeval *timeout);
  4768.  
  4769.      Wait for a file handle to become ready.  select() returns as soon as 
  4770.      there's data ready to be read from a handle in READFDS.  If TIMEOUT is 
  4771.      NULL, select() waits indefinitely.  Otherwise, waiting terminates after 
  4772.      the time-out value given by TIMEOUT.  NFDS is the number of handles to be 
  4773.      checked.  select() returns the number of ready handles and updates READFDS 
  4774.      to include only the ready handles.  On time out, 0 is returned.  On 
  4775.      failure, -1 is returned. 
  4776.  
  4777.      The following macros are available for handling the bitstrings used by 
  4778.      select(): 
  4779.  
  4780.      FD_ZERO(s)     clear all bits of S 
  4781.  
  4782.      FD_SET(n,s)    set bit N in S 
  4783.  
  4784.      FD_CLR(n,s)    clear bit N in S 
  4785.  
  4786.      FD_ISSET(n,s)  Return a non-zero value iff bit N is set in S 
  4787.  
  4788.      select() is implemented for the following types of handles: 
  4789.  
  4790.         - stdin handles (keyboard) with IDEFAULT not set (DOS: handle 0 only). 
  4791.           Note that if ICANON is set, read() has to wait until the line is 
  4792.           completed 
  4793.  
  4794.         - named pipes 
  4795.  
  4796.         - pipes created with pipe() by programs using emx.dll 
  4797.  
  4798.         - all file handles under DOS 
  4799.  
  4800.      Restrictions: WRITEFDS and EXCEPTFDS are ignored.  When using the system 
  4801.      call library libsys.lib (-Zsys), select() is not available. 
  4802.  
  4803.      See also: ioctl() , pipe() 
  4804.  
  4805.  
  4806. ΓòÉΓòÉΓòÉ 19.8. setbuf() ΓòÉΓòÉΓòÉ
  4807.  
  4808. #include <stdio.h>                            [ANSI]
  4809.  
  4810. int setbuf (FILE *stream, char *buffer);
  4811.  
  4812.      Associate the buffer BUFFER (of size BUFSIZ) with STREAM.  This must be 
  4813.      done before the file has been read or written.  If BUFFER is NULL, the 
  4814.      file is unbuffered.  You should use setvbuf() instead. 
  4815.  
  4816.      BSD setbuf() seems to have an `int' return value, therefore emx setbuf() 
  4817.      has an `int' return value.  This should not break programs which expect 
  4818.      `void setbuf()'. 
  4819.  
  4820.      See also: setbuffer() , setvbuf() 
  4821.  
  4822.  
  4823. ΓòÉΓòÉΓòÉ 19.9. setbuffer() ΓòÉΓòÉΓòÉ
  4824.  
  4825. #include <stdio.h>                            [UNIX]
  4826.  
  4827. int setbuffer (FILE *stream, char *buffer, size_t size);
  4828.  
  4829.      Associate the buffer BUFFER (of size SIZE) with STREAM.  This must be done 
  4830.      before the file has been read or written.  If BUFFER is NULL, the file is 
  4831.      unbuffered.  You should use setvbuf() instead. 
  4832.  
  4833.      BSD setbuffer() seems to have an `int' return value, therefore emx 
  4834.      setbuffer() has an `int' return value.  This should not break programs 
  4835.      which expect `void setbuffer()'. 
  4836.  
  4837.      See also: setvbuf() 
  4838.  
  4839.  
  4840. ΓòÉΓòÉΓòÉ 19.10. setjmp() ΓòÉΓòÉΓòÉ
  4841.  
  4842. #include <setjmp.h>                           [ANSI]
  4843.  
  4844. int setjmp (jmp_buf here);
  4845.  
  4846.      Save the current stack context in HERE and return 0.  Later, you can 
  4847.      continue at this point by calling longjmp().  When execution continues at 
  4848.      setjmp() after calling longjmp(), the second argument of longjmp() is 
  4849.      returned, which is always non-zero. 
  4850.  
  4851.      See also: longjmp() 
  4852.  
  4853.  
  4854. ΓòÉΓòÉΓòÉ 19.11. setlocale() ΓòÉΓòÉΓòÉ
  4855.  
  4856. #include <locale.h>                           [ANSI]
  4857.  
  4858. char *setlocale (int category, const char *locale);
  4859.  
  4860.      Not implemented. 
  4861.  
  4862.  
  4863. ΓòÉΓòÉΓòÉ 19.12. setmode() ΓòÉΓòÉΓòÉ
  4864.  
  4865. #include <io.h>                              [PC]
  4866. #include <fcntl.h>
  4867.  
  4868. int setmode (int handle, int mode);
  4869.  
  4870.      Change the text/binary mode of a file handle.  MODE must be either 
  4871.      O_BINARY or O_TEXT.  If there's an error, setmode() returns -1 and sets 
  4872.      errno to EBADF or EINVAL otherwise setmode() returns the previous mode, 
  4873.      that is, O_BINARY or O_TEXT. 
  4874.  
  4875.      Note: Use _fsetmode() to change the mode of a stream. 
  4876.  
  4877.      See also: _fsetmode() , open() 
  4878.  
  4879.  
  4880. ΓòÉΓòÉΓòÉ 19.13. settimeofday() ΓòÉΓòÉΓòÉ
  4881.  
  4882. #include <sys/time.h>                           [BSD]
  4883.  
  4884. int settimeofday (const struct timeval *tp, const struct timezone *tzp);
  4885.  
  4886.      Not implemented. 
  4887.  
  4888.  
  4889. ΓòÉΓòÉΓòÉ 19.14. setvbuf() ΓòÉΓòÉΓòÉ
  4890.  
  4891. #include <stdio.h>                            [ANSI]
  4892.  
  4893. int setvbuf (FILE *stream, char *buffer, int mode, size_t size);
  4894.  
  4895.      Set the buffering mode of STREAM to MODE, using the buffer BUFFER of size 
  4896.      SIZE bytes.  Available modes are: 
  4897.  
  4898.      _IONBF         the file is unbuffered, BUFFER and SIZE are ignored 
  4899.  
  4900.      _IOFBF         the file is full buffered 
  4901.  
  4902.      _IOLBF         the file is line buffered 
  4903.  
  4904.      The file must not have been read or written since it was opened. 
  4905.  
  4906.      If BUFFER is NULL, a buffer of SIZE bytes is allocated by setvbuf() using 
  4907.      malloc() unless MODE is _IONBF. 
  4908.  
  4909.      When reading a file, _IOFBF and _IOLBF are equivalent.  Each time a 
  4910.      newline character is written to a line-buffered file, the buffer is 
  4911.      flushed.  The buffer is also flushed if it becomes full while writing. 
  4912.      The buffer is filled by reading from the disk file (or device) if the 
  4913.      buffer becomes empty while reading. 
  4914.  
  4915.      On success, 0 is returned.  On failure, a non-zero value is returned. 
  4916.  
  4917.      See also: fflush() 
  4918.  
  4919.  
  4920. ΓòÉΓòÉΓòÉ 19.15. _sfnlwr() ΓòÉΓòÉΓòÉ
  4921.  
  4922.  
  4923. ΓòÉΓòÉΓòÉ 19.16. signal () ΓòÉΓòÉΓòÉ
  4924.  
  4925. #include <signal.h>                           [ANSI]
  4926.  
  4927. void (*signal (int sig, void (*handler)()))(int sig);
  4928.  
  4929.      Install the signal handler HANDLER for signal SIG.  You can install the 
  4930.      default signal handler by using SIG_DFL for HANDLER. You can cause the 
  4931.      signal to be ignored by using SIG_IGN for HANDLER.  SIG must not be 
  4932.      SIGKILL.  Some systems reset a signal to SIG_DFL before calling the signal 
  4933.      handler.  emx doesn't.  SIG_ACK is used instead: Once a signal handler for 
  4934.      a specific signal has been called, that signal is disabled until 
  4935.      acknowledged.  You can acknowledge a signal by calling 
  4936.  
  4937.               signal (signal_number, SIG_ACK).
  4938.  
  4939.      Only one signal of any type may be pending.  (May change in the future.) 
  4940.      The default processing for all signals except for SIGCLD is to terminate 
  4941.      the process.  If a signal which isn't ignored (that is, SIG_DFL or handler 
  4942.      installed) occurs while calling read() with `termio' enabled (see below), 
  4943.      -1 will be returned by read() and errno will be set to EINTR.  The buffer 
  4944.      will flushed. Do not use floating point math in a signal handler if the 
  4945.      signal handler will return to the interrupted code.  File i/o in the 
  4946.      signal handler is also dangerous because a file i/o function could have 
  4947.      been interrupted by the signal. 
  4948.  
  4949.      If successful, signal() returns the previous signal handler (includes 
  4950.      SIG_IGN and SIG_DFL) defined for signal SIG.  On failure, SIG_ERR is 
  4951.      returned. 
  4952.  
  4953.      Restrictions: SIGPIPE is not yet implemented.  When using the system call 
  4954.      library libsys.lib (-Zsys), SIGALRM and SIGCLD don't occur. 
  4955.  
  4956.      See also: abort() , kill() , raise() 
  4957.  
  4958.  
  4959. ΓòÉΓòÉΓòÉ 19.17. sin() ΓòÉΓòÉΓòÉ
  4960.  
  4961.  
  4962. ΓòÉΓòÉΓòÉ 19.18. sinh() ΓòÉΓòÉΓòÉ
  4963.  
  4964.  
  4965. ΓòÉΓòÉΓòÉ 19.19. sleep() ΓòÉΓòÉΓòÉ
  4966.  
  4967. #include <stdlib.h>                           [UNIX]
  4968.  
  4969. unsigned sleep (unsigned sec);
  4970.  
  4971.      Suspend the calling process for SEC seconds.  Currently, sleep() doesn't 
  4972.      get interrupted by SIGALRM and always returns 0.  SEC should not exceed 
  4973.      4294967. 
  4974.  
  4975.      See also: alarm() , _sleep2() 
  4976.  
  4977.  
  4978. ΓòÉΓòÉΓòÉ 19.20. _sleep2() ΓòÉΓòÉΓòÉ
  4979.  
  4980. #include <stdlib.h>                            [emx]
  4981.  
  4982. unsigned _sleep2 (unsigned millisec);
  4983.  
  4984.      Suspend the calling process for MILLISEC milliseconds.  Currently, 
  4985.      _sleep2() doesn't get interrupted by SIGALRM and always returns 0. As the 
  4986.      system clock is used for timing, the actual duration of the time interval 
  4987.      depends on the granularity of the system clock.  The time interval is 
  4988.      rounded up to the next clock tick.  Also note that calling _sleep2() 
  4989.      involves an overhead. 
  4990.  
  4991.      See also: alarm() , sleep() 
  4992.  
  4993.  
  4994. ΓòÉΓòÉΓòÉ 19.21. sopen() ΓòÉΓòÉΓòÉ
  4995.  
  4996. #include <io.h>                              [PC]
  4997. #include <share.h>
  4998.  
  4999. int sopen (const char *name, int oflag, int shflag, ...);
  5000.  
  5001.      Open a file or device with an explicit sharing mode.  NAME is the name of 
  5002.      the file or device.  OFLAG contains one or more of the following values, 
  5003.      combined by the | operator: 
  5004.  
  5005.      O_RDONLY       Open for reading.  Writing is not allowed 
  5006.  
  5007.      O_WRONLY       Open for writing.  Reading is not allowed 
  5008.  
  5009.      O_RDWR         Open for reading and writing 
  5010.  
  5011.      O_APPEND       Move the file pointer to the end of file before any write 
  5012.                     operation takes place.  This is used for appending to a 
  5013.                     file 
  5014.  
  5015.      O_CREAT        Create the file if it does not exist 
  5016.  
  5017.      O_TRUNC        Truncate the size of the file to 0 
  5018.  
  5019.      O_EXCL         Fail if the O_CREAT is used and the file already exists 
  5020.  
  5021.      O_NDELAY       Currently ignored. 
  5022.  
  5023.      O_BINARY       Binary mode, no translation.  See below 
  5024.  
  5025.      O_TEXT         Text mode, translate CR/LF to LF.  See below 
  5026.  
  5027.      If a new file is created, PMODE (modified by the umask value), is used to 
  5028.      set the file permissions.  S_IREAD grants read access, S_IWRITE grants 
  5029.      write access.  S_IREAD is ignored (DOS and OS/2 limitation). 
  5030.  
  5031.      There are two additional OFLAG flags: O_TEXT for text mode, O_BINARY for 
  5032.      binary mode.  Text mode, which is the default, translates each CR/LF pair 
  5033.      to a LF character on input and translates LF characters to CR/LF pairs on 
  5034.      output.  If the last character of a file is Ctrl-Z, it is discarded on 
  5035.      input.  Binary mode disables these transformations. 
  5036.  
  5037.      If the file or device cannot be opened, open() sets errno and returns -1. 
  5038.      If open() succeeds, the file handle is returned.  The file handle is 
  5039.      always greater than -1. 
  5040.  
  5041.      The mode O_TRUNC|O_RDONLY is not implemented.  The mode O_TEXT|O_WRONLY 
  5042.      does not overwrite a Ctrl-Z at the end of the file -- this causes problems 
  5043.      when appending.  Ctrl-Z at the end of the file is obsolete, anyway. 
  5044.  
  5045.      The sharing mode of the file is given by SHFLAG.  The following sharing 
  5046.      modes are available: 
  5047.  
  5048.      SH_DENYRW Deny read and write access 
  5049.      SH_DENYRD Deny read access (permit write access) 
  5050.      SH_DENYWR Deny write access (permit read access) 
  5051.      SH_DENYNO Deny nothing (permit read and write access) 
  5052.  
  5053.      See also: close() , fdopen() , open() 
  5054.  
  5055.  
  5056. ΓòÉΓòÉΓòÉ 19.22. spawn() ΓòÉΓòÉΓòÉ
  5057.  
  5058. #include <process.h>                          [*] [PC]
  5059.  
  5060. /* spawn() */
  5061.  
  5062. int spawnl (int mode, const char *name, const char *arg0, ...);
  5063. int spawnle (int mode, const char *name, const char *arg0, ...);
  5064. int spawnlp (int mode, const char *name, const char *arg0, ...);
  5065. int spawnlpe (int mode, const char *name, const char *arg0, ...);
  5066. int spawnv (int mode, const char *name, const char * const *argv);
  5067. int spawnve (int mode, const char *name, const char * const *argv,
  5068.        const char * const *envp);
  5069. int spawnvp (int mode, const char *name, const char * const *argv);
  5070. int spawnvpe (int mode, const char *name, const char * const *argv,
  5071.        const char * const *envp);
  5072.  
  5073.      Run a process.  NAME is the name of the executable file to run. Use 
  5074.      spawnl(), spawnle(), spawnlp() or spawnlpe() for passing a fixed number of 
  5075.      arguments.  ARG0 is the 0th argument which is the program name, by 
  5076.      convention.  Following ARG0, the arguments are given.  After the last 
  5077.      argument, a NULL pointer must be following. At least ARG0 must be 
  5078.      specified.  Use spawnv(), spawnve(), spawnvp() or spawnvpe() for passing a 
  5079.      variable number of arguments.  ARGV points to an array of strings.  The 
  5080.      first entry is the program name, by convention.  The last argument must be 
  5081.      followed by a NULL pointer. 
  5082.  
  5083.      spawnl(), spawnlp(), spawnv() and spawnvp() pass the environment of the 
  5084.      current process to the child process.  To pass a different environment to 
  5085.      the child process pass a pointer to an array of strings after the NULL 
  5086.      argument pointer of spawnle() and spawnlpe() or pass the pointer in the 
  5087.      ENVP argument of spawnve() and spawnvpe().  The last environment string in 
  5088.      the array must be followed by a NULL pointer. 
  5089.  
  5090.      The MODE argument specifies how to run the child process.  The following 
  5091.      values are available: 
  5092.  
  5093.      P_WAIT         run the process synchronously, that is, control returns to 
  5094.                     the parent process after the child process finishes 
  5095.  
  5096.      P_NOWAIT       run the process asynchronously, that is in parallel with 
  5097.                     the parent process.  P_NOWAIT is not implemented for DOS 
  5098.  
  5099.      P_OVERLAY      replace the parent process, that is, run the child process 
  5100.                     and terminate the parent process 
  5101.  
  5102.      P_DEBUG        run the process in debugging mode, that is, under control 
  5103.                     of the parent process.  Use ptrace() to control the child 
  5104.                     process 
  5105.  
  5106.      P_DETACH       run the process detached, that is, without input and 
  5107.                     output.  P_DETACH is not available under DOS 
  5108.  
  5109.      P_SESSION      run the process in a separate session. P_SESSION is not 
  5110.                     available under DOS. 
  5111.  
  5112.      Additional flags are available for P_SESSION, which can be added by using 
  5113.      the | operator.  Use one of the following for selecting the session type: 
  5114.  
  5115.      P_DEFAULT      let the operating system choose the session type 
  5116.  
  5117.      P_FULLSCREEN   start a full-screen session 
  5118.  
  5119.      P_WINDOWED     start a windowed session 
  5120.  
  5121.      These flags control the initial appearance of the window: 
  5122.  
  5123.      P_MINIMIZE     minimize the window 
  5124.  
  5125.      P_MAXIMIZE     maximize the window 
  5126.  
  5127.      Additionally, you can use the following flags: 
  5128.  
  5129.      P_BACKGROUND  start the session in the background 
  5130.  
  5131.      P_FOREGROUND  start the session in the foreground.  This works only if the 
  5132.      calling session is in the foreground.  P_FOREGROUND is the default 
  5133.  
  5134.      P_NOCLOSE   don't close the window automatically when the process ends 
  5135.  
  5136.      When the new process terminates, SIGCLD is raised in the process which 
  5137.      started that process.  This does not apply to P_WAIT, P_OVERLAY and 
  5138.      P_DETACH. 
  5139.  
  5140.      Return value: the return value of the child process (P_WAIT) or the 
  5141.      process ID of the child process (P_NOWAIT and P_DEBUG) if successful. 
  5142.      Otherwise -1. 
  5143.  
  5144.      Restrictions: When running a (native) DOS program, the environment of emx, 
  5145.      not that of the process calling spawn() will be inherited. The command 
  5146.      line length is restricted to 126 characters when running DOS programs. 
  5147.      DOS programs can only be run in P_WAIT mode.  P_NOWAIT is not implemented 
  5148.      under DOS.  The default extension is .exe; if you want to run a .com file, 
  5149.      explicitly add .com.  Currently, DOS seems to crash if you try to spawn a 
  5150.      .COM file without using emx option -p, see `Using emx options'.  (The 
  5151.      machine crashes on the second attempt.)  When using the system call 
  5152.      library libsys.lib (-Zsys), only modes P_WAIT, P_NOWAIT and P_OVERLAY are 
  5153.      currently available.  SIGCLD is not implemented under DOS. 
  5154.  
  5155.      See also: exit() , ptrace() , system() , wait() 
  5156.  
  5157.  
  5158. ΓòÉΓòÉΓòÉ 19.23. _splitargs() ΓòÉΓòÉΓòÉ
  5159.  
  5160. #include <stdlib.h>                            [emx]
  5161.  
  5162. char **_splitargs (char *string, int *count);
  5163.  
  5164.      Parse STRING like a command line and build a vector of pointers to the 
  5165.      arguments.  The vector is terminated by a NULL pointer.  The number of 
  5166.      arguments is stored to the variable pointed to by COUNT unless COUNT is 
  5167.      NULL.  STRING is modified by _splitargs(), the pointers in the resulting 
  5168.      vector point into STRING.  _splitargs() allocates the vector using 
  5169.      malloc().  If you no longer need the vector, use free() to deallocate it. 
  5170.      On error, _splitargs() sets errno and returns NULL. 
  5171.  
  5172.      Arguments in STRING are separated by whitespace (one or more blanks, tabs 
  5173.      and linefeeds).  Whitespace at the start of STRING is skipped.  To include 
  5174.      blanks, tabs or linefeeds in an argument, the argument must be quoted 
  5175.      using double quotation marks.  To remove the special meaning of a double 
  5176.      quote, precede it with a backslash.  To remove the special meaning of a 
  5177.      backslash in front of a double quote, precede the backslash with a 
  5178.      backslash.  The backslash character doesn't have a special meaning unless 
  5179.      it precedes a double quote or any number of backslashes followed by a 
  5180.      double quote. 
  5181.  
  5182.      In other words: If there are n backslashes (\) immediately preceding a 
  5183.      double quote character ("), floor(n/2) backslashes are put into the 
  5184.      argument.  If n is odd, the double quote character is put into the 
  5185.      argument.  If n is even (including zero), the double quote character is 
  5186.      used for quoting, that is, spaces are not treated as argument delimiters 
  5187.      until the next `quoting' double quote character (ie, a double quote 
  5188.      character immediately preceded by an even number (including zero) of 
  5189.      backslashes) is found. Backslashes not preceding a quote character are 
  5190.      always read as backslashes. 
  5191.  
  5192.      See also: popen() , system() 
  5193.  
  5194.  
  5195. ΓòÉΓòÉΓòÉ 19.24. _splitpath() ΓòÉΓòÉΓòÉ
  5196.  
  5197. #include <stdlib.h>                            [PC]
  5198.  
  5199. void _splitpath (const char *src, char *drive, char *dir, char *fname,
  5200.          char *ext);
  5201.  
  5202.      Split the path name SRC into its components.  The drive name (including 
  5203.      the colon) is stored to DRIVE.  The directory (including the final slash 
  5204.      or backslash) is copied to DIR, the file name without extension is copied 
  5205.      to FNAME, the extension (including the dot) is copied to EXT.  The buffers 
  5206.      should be of size _MAX_DRIVE, _MAX_DIR, _MAX_FNAME and _MAX_EXT, 
  5207.      respectively. These constants include the terminating null characters.  If 
  5208.      one of the pointers (except for SRC) is NULL, that component is not 
  5209.      stored. 
  5210.  
  5211.      Example: 
  5212.  
  5213.               char drive[_MAX_DRIVE], dir[_MAX_DIR];
  5214.               char fname[_MAX_FNAME], ext[_MAX_EXT];
  5215.               char *path = "c:/files/more/test.file.c";
  5216.  
  5217.               _splitpath (path, drive, dir, fname, ext);
  5218.  
  5219.      Results of the example: 
  5220.  
  5221.               drive = "c:"
  5222.               dir   = "/files/more/"
  5223.               fname = "test.file"
  5224.               ext   = ".c"
  5225.  
  5226.      See also: _fngetdrive() , _getext() , _getname() 
  5227.  
  5228.  
  5229. ΓòÉΓòÉΓòÉ 19.25. sprintf() ΓòÉΓòÉΓòÉ
  5230.  
  5231. #include <stdio.h>                            [ANSI]
  5232.  
  5233. int sprintf (char *buffer, const char *format, ...);
  5234.  
  5235.      Formatted output to the string BUFFER.  The string must be big enough to 
  5236.      hold the output.  On success, the number of characters copied to BUFFER 
  5237.      (excluding the terminating null character) is returned.  Otherwise, EOF is 
  5238.      returned. 
  5239.  
  5240.      See also: printf() , sscanf() 
  5241.  
  5242.  
  5243. ΓòÉΓòÉΓòÉ 19.26. sqrt() ΓòÉΓòÉΓòÉ
  5244.  
  5245. #include <math.h>                            [ANSI]
  5246.  
  5247. double sqrt (double x);
  5248.  
  5249.      Compute and return the square root of X.  If X is negative, +#NAN is 
  5250.      returned and errno set to EDOM. 
  5251.  
  5252.      See also: cbrt() , pow() 
  5253.  
  5254.  
  5255. ΓòÉΓòÉΓòÉ 19.27. srand() ΓòÉΓòÉΓòÉ
  5256.  
  5257.  
  5258. ΓòÉΓòÉΓòÉ 19.28. sscanf() ΓòÉΓòÉΓòÉ
  5259.  
  5260. #include <stdio.h>                            [ANSI]
  5261.  
  5262. int sscanf (const char *buffer, const char *format, ...);
  5263.  
  5264.      Parse BUFFER according to the format string FORMAT.  For each field in 
  5265.      FORMAT there must be a pointer to the location receiving the value.  The 
  5266.      pointers are passed after the FORMAT argument.  On success, the number of 
  5267.      fields converted is returned.  Otherwise, EOF is returned. 
  5268.  
  5269.      See also: scanf() , sprintf() 
  5270.  
  5271.  
  5272. ΓòÉΓòÉΓòÉ 19.29. stat() ΓòÉΓòÉΓòÉ
  5273.  
  5274. #include <io.h>                             [UNIX]
  5275. #include <sys/types.h>
  5276. #include <sys/stat.h>
  5277.  
  5278. int stat (const char *name, struct stat *buffer);
  5279.  
  5280.      Retrieve information about the file or directory NAME.  stat() will put 
  5281.      the data into the structure pointed to by BUFFER. 
  5282.  
  5283.      Restrictions: st_dev and st_rdev are set to zero.  Each call to stat() 
  5284.      returns a different value for st_ino. 
  5285.  
  5286.      See also: fstat() 
  5287.  
  5288.  
  5289. ΓòÉΓòÉΓòÉ 19.30. strcat() ΓòÉΓòÉΓòÉ
  5290.  
  5291. #include <string.h>                           [ANSI]
  5292.  
  5293. char *strcat (char *string1, const char *string2);
  5294.  
  5295.      Append the null-terminated string STRING2 to the null-terminated string 
  5296.      STRING1 and return STRING1.  The strings must not overlap. 
  5297.  
  5298.      See also: strcpy() 
  5299.  
  5300.  
  5301. ΓòÉΓòÉΓòÉ 19.31. strchr() ΓòÉΓòÉΓòÉ
  5302.  
  5303. #include <string.h>                           [ANSI]
  5304.  
  5305. char *strchr (const char *string, int c);
  5306.  
  5307.      Return a pointer to the first occurrence of the character C in the 
  5308.      null-terminated string STRING.  If there is no character C in STRING, NULL 
  5309.      is returned.  If C is 0, a pointer to the terminating zero of STRING is 
  5310.      returned. 
  5311.  
  5312.      See also: index() , memchr() , strrchr() , strstr() 
  5313.  
  5314.  
  5315. ΓòÉΓòÉΓòÉ 19.32. strcmp() ΓòÉΓòÉΓòÉ
  5316.  
  5317. #include <string.h>                           [ANSI]
  5318.  
  5319. int strcmp (const char *string1, const char *string2);
  5320.  
  5321.      Compare the null-terminated strings STRING1 and STRING2.  If STRING1 is 
  5322.      less than STRING2, a negative value is returned.  If STRING1 is equal to 
  5323.      STRING2, zero is returned.  If STRING1 is greater than STRING2, a positive 
  5324.      value is returned. 
  5325.  
  5326.      See also: memcmp() , stricmp() , strncmp() 
  5327.  
  5328.  
  5329. ΓòÉΓòÉΓòÉ 19.33. strcoll() ΓòÉΓòÉΓòÉ
  5330.  
  5331. #include <string.h>                           [ANSI]
  5332.  
  5333. int strcoll (const char *string1, const char *string2);
  5334.  
  5335.      Not implemented. 
  5336.  
  5337.      See also: strcmp() 
  5338.  
  5339.  
  5340. ΓòÉΓòÉΓòÉ 19.34. strcpy() ΓòÉΓòÉΓòÉ
  5341.  
  5342. #include <string.h>                           [ANSI]
  5343.  
  5344. char *strcpy (char *string1, const char *string2);
  5345.  
  5346.      Copy the null-terminated string STRING2 to STRING1 and return STRING1. 
  5347.      The strings must not overlap. 
  5348.  
  5349.      See also: memccpy() , memcpy() , strcat() , strncpy() 
  5350.  
  5351.  
  5352. ΓòÉΓòÉΓòÉ 19.35. strcspn() ΓòÉΓòÉΓòÉ
  5353.  
  5354. #include <string.h>                           [ANSI]
  5355.  
  5356. size_t strcspn (const char *string1, const char *string2);
  5357.  
  5358.      Return the length of the initial substring of STRING1 which consists of 
  5359.      characters not in STRING2.  That is, the index of the first character in 
  5360.      STRING1 which also occurs in STRING2 is returned.  If all characters of 
  5361.      STRING1 are not in STRING2, the length of STRING1 is returned. 
  5362.  
  5363.      See also: strpbrk() , strspn() 
  5364.  
  5365.  
  5366. ΓòÉΓòÉΓòÉ 19.36. strdup() ΓòÉΓòÉΓòÉ
  5367.  
  5368. #include <string.h>                           [UNIX]
  5369.  
  5370. char *strdup (const char *string);
  5371.  
  5372.      Creates a duplicate of STRING by using malloc() to allocate storage and 
  5373.      copying STRING.  A pointer to the new string is returned.  If there is not 
  5374.      enough memory, NULL is returned. 
  5375.  
  5376.      See also: malloc() , strcpy() 
  5377.  
  5378.  
  5379. ΓòÉΓòÉΓòÉ 19.37. strerror() ΓòÉΓòÉΓòÉ
  5380.  
  5381. #include <string.h>                           [ANSI]
  5382.  
  5383. char *strerror (int errnum);
  5384.  
  5385.      Return a pointer to a an error message according to the error number 
  5386.      ERRNO.  You must not write to the string returned by strerror().  The 
  5387.      string may get changed by the next call to strerror(). 
  5388.  
  5389.      See also: errno , perror() , sys_errlist 
  5390.  
  5391.  
  5392. ΓòÉΓòÉΓòÉ 19.38. strftime() ΓòÉΓòÉΓòÉ
  5393.  
  5394. #include <time.h>                            [ANSI]
  5395.  
  5396. size_t strftime (char *string, size_t size, const char *format,
  5397.          const struct tm *t);
  5398.  
  5399.      Format time.  The output string is written to the buffer STRING of SIZE 
  5400.      characters, including the terminating null character.  Like sprintf(), 
  5401.      strftime() copies FORMAT to STRING, replacing format specifications with 
  5402.      formatted data from T.  Ordinary characters are copied unmodified.  The 
  5403.      following format specifications are available: 
  5404.  
  5405.      %%        percent sign 
  5406.  
  5407.      %a        locale's abbreviated weekday name 
  5408.  
  5409.      %A        locale's full weekday name 
  5410.  
  5411.      %b        locale's abbreviated month name 
  5412.  
  5413.      %B        locale's full month name 
  5414.  
  5415.      %c        locale's date and time (this is currently equivalent to %a %b %d 
  5416.                %H:%M:%S %Y) 
  5417.  
  5418.      %d        day of month (01-31) 
  5419.  
  5420.      %D        date, this is equivalent to %m/%d/%y 
  5421.  
  5422.      %e        day of month ( 1-31), blank padded 
  5423.  
  5424.      %h        locale's abbreviated month name 
  5425.  
  5426.      %H        hour (00-23) 
  5427.  
  5428.      %I        hour (01-12) 
  5429.  
  5430.      %j        day of year (001-366) 
  5431.  
  5432.      %m        month (01-12) 
  5433.  
  5434.      %M        minute (00-59) 
  5435.  
  5436.      %n        newline character 
  5437.  
  5438.      %p        locale's equivalent to AM or PM, as appropriate 
  5439.  
  5440.      %r        time in AM/PM notation, this is equivalent to %I:%M:%S %p 
  5441.  
  5442.      %S        second (00-59) 
  5443.  
  5444.      %t        TAB character 
  5445.  
  5446.      %T        time, this is equivalent to %H:%M:%S 
  5447.  
  5448.      %U        week number of the year, the first day of the week is Sunday 
  5449.                (00-53) 
  5450.  
  5451.      %w        weekday, the first day of the week is Sunday (0-6) 
  5452.  
  5453.      %W        week number of the year, the first day of the week is Monday 
  5454.                (00-53) 
  5455.  
  5456.      %x        locale's date representation (this is currently equivalent to 
  5457.                %m/%d/%y) 
  5458.  
  5459.      %X        locale's time representation (this is currently equivalent to 
  5460.                %H:%M:%S) 
  5461.  
  5462.      %y        year without century (00-99) 
  5463.  
  5464.      %Y        year with century (1970-2038) 
  5465.  
  5466.      %Z        timezone name (taken from the timezone variable, as the timezone 
  5467.                isn't provided by T) 
  5468.  
  5469.      If % is followed by a character not listed above, the results are 
  5470.      undefined. 
  5471.  
  5472.      On success, the number of characters copied to STRING, excluding the 
  5473.      terminating null character, is returned.  On failure (SIZE exceeded), 0 is 
  5474.      returned. 
  5475.  
  5476.      Restrictions: locales are not yet implemented. 
  5477.  
  5478.      See also: asctime() , sprintf() 
  5479.  
  5480.  
  5481. ΓòÉΓòÉΓòÉ 19.39. stricmp() ΓòÉΓòÉΓòÉ
  5482.  
  5483. #include <string.h>                            [PC]
  5484.  
  5485. int stricmp (const char *string1, const char *string2);
  5486.  
  5487.      Compare STRING1 and STRING2, ignoring letter case.  If the strings are 
  5488.      equal, 0 is returned.  Otherwise, a positive value is returned if STRING1 
  5489.      is greater than STRING2 (after conversion to lower case).  A negative 
  5490.      value is returned if STRING1 is less than STRING2 (after conversion to 
  5491.      lower case). 
  5492.  
  5493.      See also: strcmp() , tolower() 
  5494.  
  5495.  
  5496. ΓòÉΓòÉΓòÉ 19.40. strlen() ΓòÉΓòÉΓòÉ
  5497.  
  5498. #include <string.h>                           [ANSI]
  5499.  
  5500. size_t strlen (const char *string);
  5501.  
  5502.      Returns the length (number of characters) of the string STRING. The length 
  5503.      does not include the terminating null character. 
  5504.  
  5505.      See also: strchr() 
  5506.  
  5507.  
  5508. ΓòÉΓòÉΓòÉ 19.41. strlwr() ΓòÉΓòÉΓòÉ
  5509.  
  5510. #include <string.h>                            [PC]
  5511.  
  5512. char *strlwr (char *string);
  5513.  
  5514.      Converts the string STRING to lower case.  The characters 'A' through 'Z' 
  5515.      are mapped to the characters 'a' through 'z'.  All other characters are 
  5516.      not changed.  The STRING argument is returned. 
  5517.  
  5518.      See also: _fnlwr() , strupr() 
  5519.  
  5520.  
  5521. ΓòÉΓòÉΓòÉ 19.42. strncat() ΓòÉΓòÉΓòÉ
  5522.  
  5523. #include <string.h>                           [ANSI]
  5524.  
  5525. char *strncat (char *string1, const char *string2, size_t count);
  5526.  
  5527.      Append the null-terminated string STRING2 to the null-terminated string 
  5528.      STRING1.  At most COUNT characters of STRING2 are appended to STRING1. 
  5529.      strncat() terminates the new value of STRING1 with a null character. 
  5530.      STRING1 is returned. 
  5531.  
  5532.      See also: strcat() , strncpy() 
  5533.  
  5534.  
  5535. ΓòÉΓòÉΓòÉ 19.43. strncmp() ΓòÉΓòÉΓòÉ
  5536.  
  5537. #include <string.h>                           [ANSI]
  5538.  
  5539. int strncmp (const char *string1, const char *string2, size_t count);
  5540.  
  5541.      Compare the null-terminated strings STRING1 and STRING2.  At most the 
  5542.      first COUNT characters are compared.  If STRING1 is less than STRING2, a 
  5543.      negative value is returned.  If STRING1 is equal to STRING2, zero is 
  5544.      returned.  If STRING1 is greater than STRING2, a positive value is 
  5545.      returned. 
  5546.  
  5547.      See also: memcmp() , strcmp() , strnicmp() 
  5548.  
  5549.  
  5550. ΓòÉΓòÉΓòÉ 19.44. strncpy() ΓòÉΓòÉΓòÉ
  5551.  
  5552. #include <string.h>                           [ANSI]
  5553.  
  5554. char *strncpy (char *string1, const char *string2, size_t count);
  5555.  
  5556.      Copy the null-terminated string STRING2 to STRING1 and return STRING1. 
  5557.      The strings must not overlap.  At most the first COUNT characters of 
  5558.      STRING2 are copied.  If STRING2 is shorter than COUNT characters, STRING1 
  5559.      is padded with null characters to COUNT characters.  A terminating null 
  5560.      character is always appended. 
  5561.  
  5562.      See also: strcpy() , strncat() 
  5563.  
  5564.  
  5565. ΓòÉΓòÉΓòÉ 19.45. _strncpy() ΓòÉΓòÉΓòÉ
  5566.  
  5567. #include <string.h>                            [emx]
  5568.  
  5569. char *_strncpy (char *string1, const char *string2, size_t size);
  5570.  
  5571.      Copy the null-terminated string STRING2 to STRING1 and return STRING1. 
  5572.      The strings must not overlap.  At most SIZE characters, including the 
  5573.      terminating null character, are copied to STRING1. A terminating null 
  5574.      character is always appended, even if STRING2 is too long. 
  5575.  
  5576.      See also: strcpy() , strncpy() 
  5577.  
  5578.  
  5579. ΓòÉΓòÉΓòÉ 19.46. strnicmp() ΓòÉΓòÉΓòÉ
  5580.  
  5581. #include <string.h>                            [PC]
  5582.  
  5583. int strnicmp (const char *string1, const char *string2, size_t count);
  5584.  
  5585.      Compare the null-terminated strings STRING1 and STRING2 ignoring letter 
  5586.      case.  At most the first COUNT characters are compared.  If STRING1 is 
  5587.      equal to STRING2, zero is returned.  If STRING1 is less than STRING2 
  5588.      (after conversion to lower case), a negative value is returned.  If 
  5589.      STRING1 is greater than STRING2 (after conversion to lower case), a 
  5590.      positive value is returned. 
  5591.  
  5592.      See also: memicmp() , strcmp() , strncmp() , tolower() 
  5593.  
  5594.  
  5595. ΓòÉΓòÉΓòÉ 19.47. strnset() ΓòÉΓòÉΓòÉ
  5596.  
  5597. #include <string.h>                            [PC]
  5598.  
  5599. char *strnset (char *string, int c, size_t count);
  5600.  
  5601.      Set, at most, the first COUNT characters of STRING to the character C and 
  5602.      return STRING.  If the length of STRING is less than COUNT, strnset() 
  5603.      stops at the terminating null character. 
  5604.  
  5605.      See also: memset() , strset() 
  5606.  
  5607.  
  5608. ΓòÉΓòÉΓòÉ 19.48. strpbrk() ΓòÉΓòÉΓòÉ
  5609.  
  5610. #include <string.h>                           [ANSI]
  5611.  
  5612. char *strpbrk (const char *string1, const char *string2);
  5613.  
  5614.      Return a pointer to the first occurrence in STRING1 of a character of 
  5615.      STRING2.  The terminating null character is not included in the search. 
  5616.      If no character of STRING2 can be found in STRING1, NULL is returned. 
  5617.  
  5618.      See also: strchr() , strcspn() 
  5619.  
  5620.  
  5621. ΓòÉΓòÉΓòÉ 19.49. strrchr() ΓòÉΓòÉΓòÉ
  5622.  
  5623. #include <string.h>                           [ANSI]
  5624.  
  5625. char *strrchr (const char *string, int c);
  5626.  
  5627.      Return a pointer to the last occurrence of the character C in the 
  5628.      null-terminated string STRING.  If there is no character C in STRING, NULL 
  5629.      is returned.  If C is 0, a pointer to the terminating null character of 
  5630.      STRING is returned. 
  5631.  
  5632.      See also: rindex() , strchr() 
  5633.  
  5634.  
  5635. ΓòÉΓòÉΓòÉ 19.50. strrev() ΓòÉΓòÉΓòÉ
  5636.  
  5637. #include <string.h>                            [PC]
  5638.  
  5639. char *strrev (char *string);
  5640.  
  5641.      Reverse the order of the characters in STRING return STRING.  The 
  5642.      terminating null character remains in place. 
  5643.  
  5644.  
  5645. ΓòÉΓòÉΓòÉ 19.51. strset() ΓòÉΓòÉΓòÉ
  5646.  
  5647. #include <string.h>                            [PC]
  5648.  
  5649. char *strset (char *string, int c);
  5650.  
  5651.      Replace all the characters of STRING with the character C.  The 
  5652.      terminating null character is not changed. 
  5653.  
  5654.      See also: memset() , strnset() 
  5655.  
  5656.  
  5657. ΓòÉΓòÉΓòÉ 19.52. strspn() ΓòÉΓòÉΓòÉ
  5658.  
  5659. #include <string.h>                           [ANSI]
  5660.  
  5661. size_t strspn (const char *string1, const char *string2);
  5662.  
  5663.      Return the length of the initial substring of STRING1 which consists 
  5664.      entirely of characters in STRING2.  That is, the index of the first 
  5665.      character in STRING1 which does not occur in STRING2 is returned.  If all 
  5666.      characters in STRING1 also occur in STRING2, the length of STRING1 is 
  5667.      returned. 
  5668.  
  5669.      See also: strcspn() , strpbrk() 
  5670.  
  5671.  
  5672. ΓòÉΓòÉΓòÉ 19.53. strstr() ΓòÉΓòÉΓòÉ
  5673.  
  5674. #include <string.h>                           [ANSI]
  5675.  
  5676. char *strstr (const char *string1, const char *string2);
  5677.  
  5678.      Return a pointer to the first occurrence of STRING2 in STRING1. If the 
  5679.      length of STRING2 is zero, STRING1 is returned.  If STRING2 is not a 
  5680.      substring of STRING1, NULL is returned. 
  5681.  
  5682.      See also: strchr() 
  5683.  
  5684.  
  5685. ΓòÉΓòÉΓòÉ 19.54. strtod() ΓòÉΓòÉΓòÉ
  5686.  
  5687. #include <stdlib.h>                           [ANSI]
  5688.  
  5689. double strtod (const char *string, char **end_ptr);
  5690.  
  5691.      Convert ASCII representation of a number to a double.  Leading white space 
  5692.      is skipped.  strtod() stops at the first character that cannot be 
  5693.      converted.  If END_PTR is not NULL, a pointer to that character is stored 
  5694.      to *END_PTR.  strtod() sets errno and returns 0.0 on failure, sets errno 
  5695.      and returns +#NAN or -#NAN on overflow.  The string pointed to by STRING 
  5696.      is expected to have the following form: 
  5697.  
  5698.               [whitespace] [+|-] [digits] [.digits] [[d|D|e|E] [+|-] digits]
  5699.  
  5700.      See also: sscanf() 
  5701.  
  5702.  
  5703. ΓòÉΓòÉΓòÉ 19.55. strtok() ΓòÉΓòÉΓòÉ
  5704.  
  5705. #include <string.h>                           [ANSI]
  5706.  
  5707. char *strtok (char *string1, const char *string2);
  5708.  
  5709.      Return a pointer to the next token in STRING1.  The characters of STRING2 
  5710.      are the set of delimiting characters.  Tokens in STRING1 are separated by 
  5711.      one or more characters from STRING2. 
  5712.  
  5713.      The first call to strtok() for STRING1 skips leading delimiters and 
  5714.      returns a pointer to the first token.  To get the next token of STRING1, 
  5715.      call strtok() with a NULL argument for STRING1. STRING2, the set of 
  5716.      delimiters, may be different on subsequent calls. 
  5717.  
  5718.      strtok() modifies the string STRING1 by inserting null characters for 
  5719.      terminating tokens.  Thus, the pointer returned by strtok() points to a 
  5720.      null-terminated token. 
  5721.  
  5722.      If there are no more tokens, NULL is returned. 
  5723.  
  5724.  
  5725. ΓòÉΓòÉΓòÉ 19.56. strtol() ΓòÉΓòÉΓòÉ
  5726.  
  5727. #include <stdlib.h>                           [ANSI]
  5728.  
  5729. long strtol (const char *string, char **end_ptr, int radix);
  5730.  
  5731.      Convert ASCII representation of a number to a signed long integer. Leading 
  5732.      white space is skipped.  RADIX is the number base used for conversion.  It 
  5733.      must either be between 2 and 36 or be zero.  If RADIX is 0, the number 
  5734.      base is derived from the format of the number.  If the number starts with 
  5735.      `0x', base 16 is used.  If the number starts with `0' (not followed by 
  5736.      `x'), base 8 used.  If the number does not start with `0', base 10 is 
  5737.      used.  strtol() stops at the first character that cannot be converted.  If 
  5738.      END_PTR is not NULL, a pointer to that character is stored to *END_PTR. 
  5739.      strtol() sets errno and returns 0 on failure, sets errno and returns 
  5740.      LONG_MIN or LONG_MAX on overflow. 
  5741.  
  5742.      See also: _ltoa() , strtoul() , sscanf() 
  5743.  
  5744.  
  5745. ΓòÉΓòÉΓòÉ 19.57. strtoul() ΓòÉΓòÉΓòÉ
  5746.  
  5747. #include <stdlib.h>                           [ANSI]
  5748.  
  5749. unsigned long strtoul (const char *string, char **end_ptr, int radix);
  5750.  
  5751.      Convert ASCII representation of a number to an unsigned long integer. 
  5752.      Leading white space is skipped, a sign character is not allowed.  RADIX is 
  5753.      the number base used for conversion.  It must either be between 2 and 36 
  5754.      or be zero.  If RADIX is 0, the number base is derived from the format of 
  5755.      the number.  If the number starts with `0x', base 16 is used.  If the 
  5756.      number starts with `0' (not followed by `x'), base 8 used.  If the number 
  5757.      does not start with `0', base 10 is used.  strtoul() stops at the first 
  5758.      character that cannot be converted.  If END_PTR is not NULL, a pointer to 
  5759.      that character is stored to *END_PTR.  strtoul() sets errno and returns 0 
  5760.      on failure, sets errno and returns ULONG_MAX on overflow. 
  5761.  
  5762.      See also: _ultoa() , strtol() , sscanf() 
  5763.  
  5764.  
  5765. ΓòÉΓòÉΓòÉ 19.58. strupr() ΓòÉΓòÉΓòÉ
  5766.  
  5767. #include <string.h>                            [PC]
  5768.  
  5769. char *strupr (char *string);
  5770.  
  5771.      Converts the string STRING to upper case.  The characters 'a' through 'z' 
  5772.      are mapped to the characters 'A' through 'Z'.  All other characters are 
  5773.      not changed.  The STRING argument is returned. 
  5774.  
  5775.      See also: strlwr() 
  5776.  
  5777.  
  5778. ΓòÉΓòÉΓòÉ 19.59. swab() ΓòÉΓòÉΓòÉ
  5779.  
  5780. #include <stdlib.h>                           [UNIX]
  5781.  
  5782. void swab (const void *src, void *dst, size_t n);
  5783.  
  5784.      Copy N bytes from SRC to DST, swapping each pair of adjacent bytes.  N 
  5785.      must be even. 
  5786.  
  5787.  
  5788. ΓòÉΓòÉΓòÉ 19.60. _swchar() ΓòÉΓòÉΓòÉ
  5789.  
  5790. #include <stdlib.h>                            [emx]
  5791.  
  5792. char _swchar (void);
  5793.  
  5794.      Retrieve the current switch character.  If the switch character has been 
  5795.      changed to '-', _swchar() returns '-'.  Otherwise, _swchar() returns 0. 
  5796.      In this case, you should use the standard switch character '/'. 
  5797.  
  5798.      See also: getopt() 
  5799.  
  5800.  
  5801. ΓòÉΓòÉΓòÉ 19.61. _syserrno() ΓòÉΓòÉΓòÉ
  5802.  
  5803. #include <stdlib.h>                          [*] [emx]
  5804.  
  5805. int _syserrno (void);
  5806.  
  5807.      Return the OS/2 or DOS error code for the last system call of the current 
  5808.      thread.  If there was no error, 0 is returned.  If the last system call 
  5809.      hasn't called an OS/2 or DOS function, 0 is returned. 
  5810.  
  5811.      Restrictions: Not implemented under DOS.  When using the system call 
  5812.      library libsys.lib (-Zsys), this function is not supported. 
  5813.  
  5814.  
  5815. ΓòÉΓòÉΓòÉ 19.62. system() ΓòÉΓòÉΓòÉ
  5816.  
  5817. #include <process.h>                           [ANSI]
  5818.  
  5819. int system (const char *name);
  5820.  
  5821.      Execute the command NAME by passing it to the command interpreter. 
  5822.      system() uses the COMSPEC environment variable for locating cmd.exe or 
  5823.      command.com, respectively.  The PATH environment variable is not used for 
  5824.      locating cmd.exe.  If the argument is "", an interactive shell will be 
  5825.      started.  If the argument is NULL, system() only checks whether cmd.exe or 
  5826.      command.com, respectively, can be found. 
  5827.  
  5828.      When running a (native) DOS program, the environment of emx, not that of 
  5829.      the process calling spawn() will be inherited.  Because command.com is 
  5830.      used under DOS, the command line is restricted to about 123 characters. 
  5831.      If you don't need a command shell, use spawn() instead of system().  It's 
  5832.      a bad idea to run emx programs using system() -- not tested.  You must use 
  5833.      the -p emx option when using system() under DOS, see `Using emx options'. 
  5834.  
  5835.      If system() failed, errno is set and -1 is returned.  If the argument is 
  5836.      NULL and the command processor can be found, 0 is returned.  In all other 
  5837.      cases, the return code of the command processor is returned.  The return 
  5838.      code of the program run by the command processor is returned by cmd.exe 
  5839.      but not by command.com. command.com always returns 0. 
  5840.  
  5841.      See also: popen() , spawn() , _splitargs() 
  5842.  
  5843.  
  5844. ΓòÉΓòÉΓòÉ 19.63. tan() ΓòÉΓòÉΓòÉ
  5845.  
  5846.  
  5847. ΓòÉΓòÉΓòÉ 19.64. tanh() ΓòÉΓòÉΓòÉ
  5848.  
  5849.  
  5850. ΓòÉΓòÉΓòÉ 20. function t ΓòÉΓòÉΓòÉ
  5851.  
  5852. This sections documents functions starting with the letter t 
  5853.  
  5854.  
  5855. ΓòÉΓòÉΓòÉ 20.1. tell() ΓòÉΓòÉΓòÉ
  5856.  
  5857. #include <io.h>                              [PC]
  5858.  
  5859. long tell (int handle);
  5860.  
  5861.      tell() returns the current position of the file pointer of HANDLE. If 
  5862.      there is an error, tell() returns -1. 
  5863.  
  5864.      See also: lseek() 
  5865.  
  5866.  
  5867. ΓòÉΓòÉΓòÉ 20.2. telldir() ΓòÉΓòÉΓòÉ
  5868.  
  5869.  
  5870. ΓòÉΓòÉΓòÉ 20.3. tempnam() ΓòÉΓòÉΓòÉ
  5871.  
  5872. #include <stdio.h>                            [UNIX]
  5873.  
  5874. char *tempnam (const char *dir, const char *prefix);
  5875.  
  5876.      Generate the name suitable for a temporary file without overwriting an 
  5877.      existing file.  tempnam() returns a pointer to a string allocated by 
  5878.      malloc().  If the TMP environment variable is set and the directory 
  5879.      specified by TMP exists, that directory is used.  Otherwise, the DIR 
  5880.      argument is used.  If DIR is NULL or the directory specified by DIR does 
  5881.      not exist, P_tmpdir as defined in stdio.h is used.  If even this fails, 
  5882.      NULL is returned.  The name of the file will start with PREFIX.  PREFIX 
  5883.      must not be longer than 5 characters. 
  5884.  
  5885.      See also: tmpnam() 
  5886.  
  5887.  
  5888. ΓòÉΓòÉΓòÉ 20.4. time() ΓòÉΓòÉΓòÉ
  5889.  
  5890. #include <time.h>                            [ANSI]
  5891.  
  5892. time_t time (time_t *ptr);
  5893.  
  5894.      Return the number of seconds elapsed since 00:00 GMT 1-Jan-1970. The 
  5895.      system time is converted according to the local timezone.  If PTR is not 
  5896.      NULL, the result is also stored to the variable pointed to by PTR. 
  5897.  
  5898.      See also: ftime() , gettimeofday() 
  5899.  
  5900.  
  5901. ΓòÉΓòÉΓòÉ 20.5. times() ΓòÉΓòÉΓòÉ
  5902.  
  5903. #include <time.h>                            [UNIX]
  5904. #include <sys/times.h>
  5905.  
  5906. long times (struct tms *buffer);
  5907.  
  5908.      Return the current time in CLK_TCK fractions of a second since 00:00 GMT 
  5909.      1-Jan-1970.  Also sets the tms_utime field of BUFFER to the number of 
  5910.      seconds the process has been running.  The other fields are set to 0. 
  5911.  
  5912.      Restriction: The return value is unusable due to overflow. 
  5913.  
  5914.      See also: clock() , time() 
  5915.  
  5916.  
  5917. ΓòÉΓòÉΓòÉ 20.6. tmpfile() ΓòÉΓòÉΓòÉ
  5918.  
  5919. #include <stdio.h>                            [ANSI]
  5920.  
  5921. FILE *tmpfile (void);
  5922.  
  5923.      Create and open a temporary file.  The name of the file is created with 
  5924.      tmpnam().  The file is opened in "w+b" mode. 
  5925.  
  5926.      On success, a stream pointer is returned.  On failure, NULL is returned. 
  5927.  
  5928.      See also: _rmtmp() , tmpnam() 
  5929.  
  5930.  
  5931. ΓòÉΓòÉΓòÉ 20.7. tmpnam() ΓòÉΓòÉΓòÉ
  5932.  
  5933. #include <stdio.h>                            [ANSI]
  5934.  
  5935. char *tmpnam (char *string);
  5936.  
  5937.      Create a unique file name and store it to STRING.  There must be L_tmpnam 
  5938.      bytes at STRING.  If STRING is NULL, a static buffer is used which will be 
  5939.      overwritten by subsequent calls.  The file name is a concatenation of 
  5940.      P_tmpdir and a sequence of digits. 
  5941.  
  5942.      On success, a pointer to the new name is returned.  On failure, NULL is 
  5943.      returned. 
  5944.  
  5945.      See also: tempnam() , tmpfile() , mktemp() 
  5946.  
  5947.  
  5948. ΓòÉΓòÉΓòÉ 20.8. tolower() ΓòÉΓòÉΓòÉ
  5949.  
  5950. #include <ctype.h>                            [ANSI]
  5951.  
  5952. int tolower (int c);
  5953. int toupper (int c);
  5954.  
  5955.      tolower() converts the character C to lower case, if it is in the range 
  5956.      'A' ... 'Z'.  toupper() converts the character C to upper case, if it is 
  5957.      in the range 'a' ... 'z'. 
  5958.  
  5959.      See also: stricmp() , strlwr() , strupr() , _tolower() , _toupper() 
  5960.  
  5961.  
  5962. ΓòÉΓòÉΓòÉ 20.9. _tolower() ΓòÉΓòÉΓòÉ
  5963.  
  5964. #include <ctype.h>                            [UNIX]
  5965.  
  5966. int _tolower (int c);
  5967. int _toupper (int c);
  5968.  
  5969.      _tolower() converts the upper-case character C to lower case; C must be in 
  5970.      the range 'A' through 'Z'.  _toupper() converts the lower-case character C 
  5971.      to upper case; C must be in the range 'a' through 'z'. 
  5972.  
  5973.      See also: tolower() , toupper() 
  5974.  
  5975.  
  5976. ΓòÉΓòÉΓòÉ 20.10. toupper() ΓòÉΓòÉΓòÉ
  5977.  
  5978.  
  5979. ΓòÉΓòÉΓòÉ 20.11. _toupper() ΓòÉΓòÉΓòÉ
  5980.  
  5981.  
  5982. ΓòÉΓòÉΓòÉ 20.12. trunc() ΓòÉΓòÉΓòÉ
  5983.  
  5984. #include <math.h>
  5985.  
  5986. double trunc (double x);
  5987.  
  5988.      Return as floating-point number X chopped to an integer by truncating the 
  5989.      fractional digits (rounding toward 0). 
  5990.  
  5991.      See also: ceil() , floor() , modf() , rint() 
  5992.  
  5993.  
  5994. ΓòÉΓòÉΓòÉ 20.13. truncate() ΓòÉΓòÉΓòÉ
  5995.  
  5996. #include <io.h>                              [BSD]
  5997.  
  5998. int truncate (char *name, long length);
  5999.  
  6000.      Truncate the file NAME to at most LENGTH bytes.  If LENGTH is greater than 
  6001.      the current length of the file, the length is not changed.  If successful, 
  6002.      0 is returned.  Otherwise, -1 is returned. 
  6003.  
  6004.      See also: chsize() , ftruncate() 
  6005.  
  6006.  
  6007. ΓòÉΓòÉΓòÉ 20.14. tzset() ΓòÉΓòÉΓòÉ
  6008.  
  6009. #include <time.h>                            [UNIX]
  6010.  
  6011. void tzset (void);
  6012.  
  6013.      Set timezone according to the TZ environment variable.  If you have a 
  6014.      problem with a program interpreting TZ differently (for instance a program 
  6015.      which supports day-light-saving time), set EMXTZ for emx programs.  If 
  6016.      EMXTZ is set, emx will use the value of EMXTZ instead of the value of TZ. 
  6017.      The following global variables are set by tzset(): daylight, timezone, 
  6018.      tzname.  TZ has the following format: 
  6019.  
  6020.              TZ1[offset][TZ2]
  6021.  
  6022.      Where TZ1 is the three-letter name of the local timezone, offset is the 
  6023.      optional offset to GMT (hours; positive values are to the west of 
  6024.      Greenwich) and TZ2 is the optional name of the day-light-saving timezone, 
  6025.      which is currently ignored.  Example: PST8PDT. 
  6026.  
  6027.      If TZ is not set, GMT is used. 
  6028.  
  6029.  
  6030. ΓòÉΓòÉΓòÉ 20.15. _uldiv() ΓòÉΓòÉΓòÉ
  6031.  
  6032.  
  6033. ΓòÉΓòÉΓòÉ 21. function u ΓòÉΓòÉΓòÉ
  6034.  
  6035. This sections documents functions starting with the letter u 
  6036.  
  6037.  
  6038. ΓòÉΓòÉΓòÉ 21.1. ulimit() ΓòÉΓòÉΓòÉ
  6039.  
  6040. #include <stdlib.h>                           [SysV]
  6041.  
  6042. long ulimit (int request, long newlimit);
  6043.  
  6044.      Set or get process limits.  The following REQUEST codes are implemented: 
  6045.  
  6046.      1         Return the maximum file size.  Always returns 1 << 21. 
  6047.  
  6048.      2         Set the maximum file size to NEWLIMIT.  Ignored.  Returns 
  6049.                NEWLIMIT. 
  6050.  
  6051.      3         Return the greatest possible break value 
  6052.  
  6053.      4         Return the number of files that can be open simultaneously per 
  6054.                process.  Always returns 40. 
  6055.  
  6056.  
  6057. ΓòÉΓòÉΓòÉ 21.2. _ulldiv() ΓòÉΓòÉΓòÉ
  6058.  
  6059.  
  6060. ΓòÉΓòÉΓòÉ 21.3. _ulltoa() ΓòÉΓòÉΓòÉ
  6061.  
  6062.  
  6063. ΓòÉΓòÉΓòÉ 21.4. _ultoa() ΓòÉΓòÉΓòÉ
  6064.  
  6065.  
  6066. ΓòÉΓòÉΓòÉ 21.5. umask() ΓòÉΓòÉΓòÉ
  6067.  
  6068. #include <io.h>                             [UNIX]
  6069.  
  6070. int umask (int pmode);
  6071.  
  6072.      Set the file-permission mask of the current process to PMODE.  The 
  6073.      previous file-permission mask is returned.  Only the S_IWRITE bit is used. 
  6074.  
  6075.      Restrictions: The current file-permission mask is inherited by emx 
  6076.      programs spawned under DOS.  Under OS/2, the file-permission mask is not 
  6077.      yet inherited.  When spawning a non-emx program (such as command.com, see 
  6078.      system()) which spawns an emx program, that program won't inherit the 
  6079.      file-permission mask. 
  6080.  
  6081.      See also: fopen() , open() 
  6082.  
  6083.  
  6084. ΓòÉΓòÉΓòÉ 21.6. uname() ΓòÉΓòÉΓòÉ
  6085.  
  6086. #include <sys/utsname.h>                         [UNIX]
  6087.  
  6088. int uname (struct utsname *name);
  6089.  
  6090.      Store information identifying the current system to the structure pointed 
  6091.      to by NAME. 
  6092.  
  6093.      This function returns 0 (always successful). 
  6094.  
  6095.  
  6096. ΓòÉΓòÉΓòÉ 21.7. ungetc() ΓòÉΓòÉΓòÉ
  6097.  
  6098. #include <stdio.h>                            [ANSI]
  6099.  
  6100. int ungetc (int c, FILE *stream);
  6101.  
  6102.      Push back the character C onto STREAM and clear the end-of-file indicator. 
  6103.      STREAM must be open for reading.  The next read operation on STREAM starts 
  6104.      with C.  If C is EOF, nothing is done. Only one character can be pushed 
  6105.      onto a stream.  fflush(), fseek(), fsetpos() and rewind() undo ungetc(). 
  6106.      After a successful ungetc(), the value of the file pointer is undefined 
  6107.      until the character has been read. 
  6108.  
  6109.      On success, the character C is returned.  On failure, EOF is returned. 
  6110.  
  6111.      See also: fgetc() , fflush() 
  6112.  
  6113.  
  6114. ΓòÉΓòÉΓòÉ 21.8. unlink() ΓòÉΓòÉΓòÉ
  6115.  
  6116. #include <stdio.h>    /* use this */                  [UNIX]
  6117. #include <io.h>     /* or this */
  6118.  
  6119. int unlink (const char *name);
  6120.  
  6121.      Delete the file NAME.  0 is returned if successful, -1 if not. 
  6122.  
  6123.      Under OS/2 and DOS, unlink() and remove() are equivalent. 
  6124.  
  6125.      See also: remove() 
  6126.  
  6127.  
  6128. ΓòÉΓòÉΓòÉ 21.9. utime() ΓòÉΓòÉΓòÉ
  6129.  
  6130. #include <sys/utime.h>                          [SysV]
  6131.  
  6132. int utime (const char *name, const struct utimbuf *times);
  6133.  
  6134.      Set time stamp of file NAME to the access time and modification time given 
  6135.      in TIMES.  If TIMES is NULL, both the access time and the modification 
  6136.      time are set to the current time. 
  6137.  
  6138.      See also: stat() , utimes() 
  6139.  
  6140.  
  6141. ΓòÉΓòÉΓòÉ 21.10. utimes() ΓòÉΓòÉΓòÉ
  6142.  
  6143. #include <sys/time.h>                           [BSD]
  6144.  
  6145. int utimes (const char *name, const struct timeval *tvp);
  6146.  
  6147.      Set time stamp of file NAME to the access time given in TVP[0] and the 
  6148.      modification time given in TVP[1].  If TVP is NULL, both the access time 
  6149.      and the modification time are set to the current time. 
  6150.  
  6151.      See also: stat() , utime() 
  6152.  
  6153.  
  6154. ΓòÉΓòÉΓòÉ 22. function v ΓòÉΓòÉΓòÉ
  6155.  
  6156. This sections documents functions starting with the letter v 
  6157.  
  6158.  
  6159. ΓòÉΓòÉΓòÉ 22.1. v_attrib() ΓòÉΓòÉΓòÉ
  6160.  
  6161. #include <sys/video.h>                          [emx]
  6162.  
  6163. void v_attrib (int a);
  6164.  
  6165.      Set the attributes (colors etc.) used by video library functions to A. 
  6166.      You can make A by using the binary OR operator and the F_whatever, 
  6167.      B_whatever, INTENSITY and BLINK constants. 
  6168.  
  6169.      See also: v_init() , v_putc() 
  6170.  
  6171.  
  6172. ΓòÉΓòÉΓòÉ 22.2. v_backsp() ΓòÉΓòÉΓòÉ
  6173.  
  6174. #include <sys/video.h>                          [emx]
  6175.  
  6176. void v_backsp (int count);
  6177.  
  6178.      Backspace the cursor.  The cursor is moved left by COUNT characters.  If 
  6179.      the cursor leaves the screen at the left edge, it is moved to the end of 
  6180.      the previous line.  The cursor cannot leave the screen at the top edge. 
  6181.  
  6182.      See also: v_putc() 
  6183.  
  6184.  
  6185. ΓòÉΓòÉΓòÉ 22.3. v_clear() ΓòÉΓòÉΓòÉ
  6186.  
  6187. #include <sys/video.h>                          [emx]
  6188.  
  6189. void v_clear (void);
  6190.  
  6191.      Clear the screen using the current attributes. 
  6192.  
  6193.      See also: v_attrib() , v_clreol() 
  6194.  
  6195.  
  6196. ΓòÉΓòÉΓòÉ 22.4. v_clreol() ΓòÉΓòÉΓòÉ
  6197.  
  6198. #include <sys/video.h>                          [emx]
  6199.  
  6200. void v_clreol (void);
  6201.  
  6202.      Clear the line from the current cursor position to the end of the current 
  6203.      line using the current attributes. 
  6204.  
  6205.      See also: v_attrib() , v_clear() 
  6206.  
  6207.  
  6208. ΓòÉΓòÉΓòÉ 22.5. v_ctype() ΓòÉΓòÉΓòÉ
  6209.  
  6210. #include <sys/video.h>                          [emx]
  6211.  
  6212. void v_ctype (int start, int end);
  6213.  
  6214.      Set the cursor type.  START is the first row of the cursor, END is the 
  6215.      last row of the cursor.  Both values are zero-based. Use v_hardware() to 
  6216.      determine the size of the character box. 
  6217.  
  6218.      See also: v_getctype() , v_hardware() , v_hidecursor() 
  6219.  
  6220.  
  6221. ΓòÉΓòÉΓòÉ 22.6. v_delline() ΓòÉΓòÉΓòÉ
  6222.  
  6223. #include <sys/video.h>                          [emx]
  6224.  
  6225. void v_delline (int count);
  6226.  
  6227.      Delete COUNT lines at the current cursor position by moving up the lines 
  6228.      below the current line.  The current attributes are used for filling lines 
  6229.      becoming empty at the bottom of the screen. 
  6230.  
  6231.      See also: v_attrib() , v_insline() , v_scroll() 
  6232.  
  6233.  
  6234. ΓòÉΓòÉΓòÉ 22.7. v_dimen() ΓòÉΓòÉΓòÉ
  6235.  
  6236. #include <sys/video.h>                          [emx]
  6237.  
  6238. void v_dimen (int *width, int *height);
  6239.  
  6240.      Store the screen width (columns) to WIDTH, the screen height (lines) to 
  6241.      HEIGHT. 
  6242.  
  6243.      See also: _scrsize() 
  6244.  
  6245.  
  6246. ΓòÉΓòÉΓòÉ 22.8. vfprintf() ΓòÉΓòÉΓòÉ
  6247.  
  6248.  
  6249. ΓòÉΓòÉΓòÉ 22.9. vfscanf() ΓòÉΓòÉΓòÉ
  6250.  
  6251.  
  6252. ΓòÉΓòÉΓòÉ 22.10. v_getattr() ΓòÉΓòÉΓòÉ
  6253.  
  6254. #include <sys/video.h>                          [emx]
  6255.  
  6256. int v_getattr (void);
  6257.  
  6258.      Return the current attributes. 
  6259.  
  6260.      See also: v_attrib() 
  6261.  
  6262.  
  6263. ΓòÉΓòÉΓòÉ 22.11. v_getctype() ΓòÉΓòÉΓòÉ
  6264.  
  6265. #include <sys/video.h>                          [emx]
  6266.  
  6267. void v_getctype (int *start, int *end);
  6268.  
  6269.      Store the current cursor start and end rows to START and END. 
  6270.  
  6271.      See also: v_ctype() 
  6272.  
  6273.  
  6274. ΓòÉΓòÉΓòÉ 22.12. v_getline() ΓòÉΓòÉΓòÉ
  6275.  
  6276. #include <sys/video.h>                          [emx]
  6277.  
  6278. void v_getline (char *dst, int x, int y, int count);
  6279.  
  6280.      Copy COUNT character/attributes pairs from the screen at position (X,Y) to 
  6281.      DST.  2*COUNT bytes are copied.  The cursor is not moved. 
  6282.  
  6283.      See also: v_putline() 
  6284.  
  6285.  
  6286. ΓòÉΓòÉΓòÉ 22.13. v_getxy() ΓòÉΓòÉΓòÉ
  6287.  
  6288. #include <sys/video.h>                          [emx]
  6289.  
  6290. void v_getxy (int *x, int *y);
  6291.  
  6292.      Store the current cursor position to X (column) and Y (line). 
  6293.  
  6294.      See also: v_gotoxy() 
  6295.  
  6296.  
  6297. ΓòÉΓòÉΓòÉ 22.14. v_gotoxy() ΓòÉΓòÉΓòÉ
  6298.  
  6299. #include <sys/video.h>                          [emx]
  6300.  
  6301. void v_gotoxy (int x, int y);
  6302.  
  6303.      Move the cursor to line Y, column X.  Both values are zero-based. Line 0 
  6304.      is the top line, column 0 is the left-most column. 
  6305.  
  6306.      See also: v_getxy() 
  6307.  
  6308.  
  6309. ΓòÉΓòÉΓòÉ 22.15. v_hardware() ΓòÉΓòÉΓòÉ
  6310.  
  6311. #include <sys/video.h>                          [emx]
  6312.  
  6313. int v_hardware (void);
  6314.  
  6315.      Return a value indicating the display adapter type.  The following values 
  6316.      are defined: 
  6317.  
  6318.      V_MONOCHROME   Monochrome display adapter 
  6319.  
  6320.      V_COLOR_8      Color display adapter, the character box height is 8 scan 
  6321.                     lines 
  6322.  
  6323.      V_COLOR_12     Color display adapter, the character box height is 12 scan 
  6324.                     lines 
  6325.  
  6326.      See also: v_ctype() 
  6327.  
  6328.  
  6329. ΓòÉΓòÉΓòÉ 22.16. v_hidecursor() ΓòÉΓòÉΓòÉ
  6330.  
  6331. #include <sys/video.h>                          [emx]
  6332.  
  6333. void v_hidecursor (void);
  6334.  
  6335.      Turn off the cursor.  Use v_ctype() to turn the cursor on. 
  6336.  
  6337.      See also: v_ctype() 
  6338.  
  6339.  
  6340. ΓòÉΓòÉΓòÉ 22.17. v_init() ΓòÉΓòÉΓòÉ
  6341.  
  6342. #include <sys/video.h>                          [emx]
  6343.  
  6344. int v_init (void);
  6345.  
  6346.      Initialize video library.  You must call this function before calling any 
  6347.      other video library function.  The attributes are set to F_WHITE|B_BLACK. 
  6348.  
  6349.      General information about the video library: The video library implements 
  6350.      text-mode output to the screen.  You have to link with libvideo (use the 
  6351.      -lvideo option).  Under DOS, emx option -acm is required, see `Using emx 
  6352.      options'.  See wm_init() for a higher-level interface. 
  6353.  
  6354.      Example: /emx/test/video.c 
  6355.  
  6356.      See also: v_attrib() 
  6357.  
  6358.  
  6359. ΓòÉΓòÉΓòÉ 22.18. v_insline() ΓòÉΓòÉΓòÉ
  6360.  
  6361. #include <sys/video.h>                          [emx]
  6362.  
  6363. void v_insline (int count);
  6364.  
  6365.      Insert COUNT empty lines at the current cursor position by moving down the 
  6366.      line at the current cursor position and all lines below that line.  The 
  6367.      current attributes are used for filling the empty lines. 
  6368.  
  6369.      See also: v_attrib() , v_delline() , v_scroll() 
  6370.  
  6371.  
  6372. ΓòÉΓòÉΓòÉ 22.19. v_printf() ΓòÉΓòÉΓòÉ
  6373.  
  6374. #include <sys/video.h>                          [emx]
  6375.  
  6376. int v_printf (const char *fmt, ...);
  6377.  
  6378.      Formatted output to the screen at the current cursor position. The cursor 
  6379.      is moved.  See printf() for details on FMT.  The number of output 
  6380.      characters is returned. 
  6381.  
  6382.      See also: v_attrib() , v_putc() , v_puts() 
  6383.  
  6384.  
  6385. ΓòÉΓòÉΓòÉ 22.20. v_putc() ΓòÉΓòÉΓòÉ
  6386.  
  6387. #include <sys/video.h>                          [emx]
  6388.  
  6389. void v_putc (char c);
  6390.  
  6391.      Display character C on the screen at the current cursor position, using 
  6392.      the current attributes.  The cursor is moved.  If the cursor leaves the 
  6393.      screen at the right edge, it will be moved to the start of the next line. 
  6394.      If C is '\n', the cursor is moved to the start of the next line.  If the 
  6395.      cursor leaves the screen at the bottom edge, the screen is scrolled up. 
  6396.  
  6397.      See also: v_attrib() , v_puts() , v_scrollup() 
  6398.  
  6399.  
  6400. ΓòÉΓòÉΓòÉ 22.21. v_putline() ΓòÉΓòÉΓòÉ
  6401.  
  6402. #include <sys/video.h>                          [emx]
  6403.  
  6404. void v_putline (const char *src, int x, int y, int count);
  6405.  
  6406.      Copy COUNT character/attributes pairs from SRC to the screen at position 
  6407.      (X,Y).  2*COUNT bytes are copied.  The cursor is not moved. 
  6408.  
  6409.      See also: v_getline() , v_putmask() , v_putn() 
  6410.  
  6411.  
  6412. ΓòÉΓòÉΓòÉ 22.22. v_putm() ΓòÉΓòÉΓòÉ
  6413.  
  6414. #include <sys/video.h>                          [emx]
  6415.  
  6416. void v_putm (const char *str, int len);
  6417.  
  6418.      Display LEN characters of STR at the current cursor position using the 
  6419.      current attributes.  The cursor is not moved. 
  6420.  
  6421.      See also: v_putline() , v_putn() , v_puts() 
  6422.  
  6423.  
  6424. ΓòÉΓòÉΓòÉ 22.23. v_putmask() ΓòÉΓòÉΓòÉ
  6425.  
  6426. #include <sys/video.h>                          [emx]
  6427.  
  6428. void v_putmask (const char *src, const char *mask, int x, int y, int count);
  6429.  
  6430.      Copy COUNT character/attributes pairs from SRC to the screen.  A 
  6431.      character/attributes pair at SRC[2*i] and SRC[2*i+1], is copied only if 
  6432.      MASK[i] is non-zero.  The cursor is not moved. 
  6433.  
  6434.      See also: v_putline() 
  6435.  
  6436.  
  6437. ΓòÉΓòÉΓòÉ 22.24. v_putn() ΓòÉΓòÉΓòÉ
  6438.  
  6439. #include <sys/video.h>                          [emx]
  6440.  
  6441. void v_putn (char c, int count);
  6442.  
  6443.      Display character C at the current cursor position.  COUNT is the number 
  6444.      of times to display the character.  The cursor is not moved. 
  6445.  
  6446.      See also: v_attrib() , v_putc() 
  6447.  
  6448.  
  6449. ΓòÉΓòÉΓòÉ 22.25. v_puts() ΓòÉΓòÉΓòÉ
  6450.  
  6451. #include <sys/video.h>                          [emx]
  6452.  
  6453. void v_puts (const char *str);
  6454.  
  6455.      Display string STR at the current cursor position using the current 
  6456.      attributes.  The '\n' character moves the cursor to the start of the next 
  6457.      line.  Scrolling is performed when the cursor leaves the screen at the 
  6458.      bottom edge. 
  6459.  
  6460.      See also: v_attrib() , v_putc() , v_putm() 
  6461.  
  6462.  
  6463. ΓòÉΓòÉΓòÉ 22.26. v_scroll() ΓòÉΓòÉΓòÉ
  6464.  
  6465. #include <sys/video.h>                          [emx]
  6466.  
  6467. void v_scroll (int tl_x, int tl_y, int br_x, int br_y, int count, int flag);
  6468.  
  6469.      Scroll a rectangle of the screen by COUNT lines.  The top left character 
  6470.      cell is at (TL_X,TL_Y), the bottom right character cell is at (BR_X,BR_Y). 
  6471.      If FLAG is V_SCROLL_UP, the rectangle is scrolled up, if FLAG is 
  6472.      V_SCROLL_DOWN, the rectangle is scrolled down.  If FLAG is V_SCROLL_CLEAR, 
  6473.      the rectangle is filled with blanks.  Lines becoming empty are filled with 
  6474.      blanks using the current attributes. 
  6475.  
  6476.      See also: v_attrib() , v_scrollup() 
  6477.  
  6478.  
  6479. ΓòÉΓòÉΓòÉ 22.27. v_scrollup() ΓòÉΓòÉΓòÉ
  6480.  
  6481. #include <sys/video.h>                          [emx]
  6482.  
  6483. void v_scrollup (void);
  6484.  
  6485.      Scroll screen up by one line.  The bottom line is filled with blanks, 
  6486.      using the current attributes. 
  6487.  
  6488.      See also: v_attrib() , v_putc() 
  6489.  
  6490.  
  6491. ΓòÉΓòÉΓòÉ 22.28. v_vprintf() ΓòÉΓòÉΓòÉ
  6492.  
  6493. #include <sys/video.h>                          [emx]
  6494.  
  6495. int v_vprintf (const char *fmt, va_list arg_ptr);
  6496.  
  6497.      Formatted output to the screen.  Instead of a list of arguments, this 
  6498.      function takes a pointer to the list of arguments.  See v_printf() for 
  6499.      details. 
  6500.  
  6501.      See also: v_printf() , va_arg() 
  6502.  
  6503.  
  6504. ΓòÉΓòÉΓòÉ 22.29. va_arg() ΓòÉΓòÉΓòÉ
  6505.  
  6506. #include <stdarg.h>                           [ANSI]
  6507.  
  6508. type va_arg (va_list arg_ptr, type);
  6509. void va_end (va_list arg_ptr);
  6510. void va_start (va_list arg_ptr, type prev_arg);
  6511.  
  6512.      Access arguments of a function with variable number of arguments. You have 
  6513.      to declare a variable of type va_list, for instance ARG_PTR.  Use 
  6514.  
  6515.               va_start (arg_ptr, prev_arg),
  6516.  
  6517.      where PREV_ARG is the argument preceding the variable arguments, to 
  6518.      initialize ARG_PTR.  Use 
  6519.  
  6520.               va_arg (arg_ptr, type)
  6521.  
  6522.      to get the next argument, which is of type TYPE.  Use va_end (arg_ptr) if 
  6523.      you no longer need ARG_PTR. 
  6524.  
  6525.      Restriction: PREV_ARG should not be of type `float' unless there's a 
  6526.      prototype for the function, TYPE should not be `float'.  Both problems are 
  6527.      due to the fact that float is promoted to double. 
  6528.  
  6529.      See also: vprintf() 
  6530.  
  6531.  
  6532. ΓòÉΓòÉΓòÉ 22.30. va_end() ΓòÉΓòÉΓòÉ
  6533.  
  6534.  
  6535. ΓòÉΓòÉΓòÉ 22.31. va_start() ΓòÉΓòÉΓòÉ
  6536.  
  6537.  
  6538. ΓòÉΓòÉΓòÉ 22.32. vprintf() ΓòÉΓòÉΓòÉ
  6539.  
  6540. #include <stdio.h>                            [ANSI]
  6541.  
  6542. int vprintf (const char *format, va_list arg_ptr);
  6543. int vfprintf (FILE *stream, const char *format, va_list arg_ptr);
  6544. int vsprintf (char *buffer, const char *format, va_list arg_ptr);
  6545.  
  6546.      Formatted output to stdout, to the stream STREAM or to the string BUFFER, 
  6547.      respectively.  Instead of a list of arguments, these functions take a 
  6548.      pointer to the list of arguments.  See printf() for details. 
  6549.  
  6550.      See also: printf() , va_arg() 
  6551.  
  6552.  
  6553. ΓòÉΓòÉΓòÉ 22.33. vscanf() ΓòÉΓòÉΓòÉ
  6554.  
  6555. #include <stdio.h>                            [emx]
  6556.  
  6557. int vscanf (const char *format, va_list arg_ptr);
  6558. int vfscanf (FILE *stream, const char *format, va_list arg_ptr);
  6559. int vsscanf (const char *buffer, const char *format, va_list arg_ptr);
  6560.  
  6561.      Parse input from stdin, STREAM or BUFFER, respectively.  Instead of a list 
  6562.      of arguments, these functions take a pointer to the list of arguments. 
  6563.      See scanf() for details. 
  6564.  
  6565.      See also: scanf() , va_arg() 
  6566.  
  6567.  
  6568. ΓòÉΓòÉΓòÉ 22.34. vsprintf() ΓòÉΓòÉΓòÉ
  6569.  
  6570.  
  6571. ΓòÉΓòÉΓòÉ 22.35. vsscanf() ΓòÉΓòÉΓòÉ
  6572.  
  6573.  
  6574. ΓòÉΓòÉΓòÉ 23. function w ΓòÉΓòÉΓòÉ
  6575.  
  6576. This sections documents functions starting with the letter w 
  6577.  
  6578.  
  6579. ΓòÉΓòÉΓòÉ 23.1. wait() ΓòÉΓòÉΓòÉ
  6580.  
  6581. #include <process.h>   /* use this */                  [UNIX]
  6582. #include <sys/wait.h>  /* or this */
  6583.  
  6584. int wait (int *status);
  6585.  
  6586.      Wait until a child process terminates or if a child process which is being 
  6587.      debugged gets a signal, for instance, SIGTRAP after a single step has been 
  6588.      performed.  If there are no child processes, wait() returns immediately, 
  6589.      setting errno to ECHILD and returning -1.  If STATUS is not NULL, the 
  6590.      return code and the termination status are stored to the location pointed 
  6591.      to by STATUS.  The termination status is stored in the low-order byte, the 
  6592.      return code is stored in the high-order byte.  If the child process 
  6593.      terminates normally, the low-order byte contains 0, the high-order byte 
  6594.      contains the return code.  If the child process has been stopped, the 
  6595.      low-order byte contains 127, the high-order byte contains the signal 
  6596.      number.  This occurs only if the child process is being debugged.  If the 
  6597.      child process terminated due to a signal, the low-order byte contains the 
  6598.      signal number, the high-order byte contains 0.  See also the macros 
  6599.      defined in sys/wait.h.  [...] wait() returns the process ID of the child 
  6600.      process.  If an error occurs, wait() sets errno and returns -1. Example: 
  6601.  
  6602.               int tc, pid;
  6603.  
  6604.               pid = wait (&tc);
  6605.               if (pid >= 0)
  6606.                 {
  6607.                   if ((tc & 0xff) == 0)
  6608.                     printf ("Normal process termination, rc=%d\n", tc >> 8);
  6609.                   else if ((tc & 0xff) == 127)
  6610.                     printf ("Process stopped by signal %d\n", tc >> 8);
  6611.                   else
  6612.                     printf ("Process terminated by signal %d\n", tc & 0xff);
  6613.                 }
  6614.  
  6615.      Restrictions: Under DOS wait() is currently implemented only for processes 
  6616.      being debugged; see ptrace() and spawn().  Under OS/2, wait() works only 
  6617.      for processes started with spawn() or exec(). It does not work for 
  6618.      processes started with DosExecPgm or DosStartSession.  If the processes 
  6619.      found by wait() has been started as a session, only the return code is 
  6620.      available, not the signal number.  wait() is not interrupted by signals. 
  6621.  
  6622.      See also: ptrace() , signal() , spawn() , waitpid() 
  6623.  
  6624.  
  6625. ΓòÉΓòÉΓòÉ 23.2. _wait0() ΓòÉΓòÉΓòÉ
  6626.  
  6627. #include <sys/hw.h>                          [*] [emx]
  6628.  
  6629. void _wait0 (unsigned port, unsigned mask);
  6630. void _wait1 (unsigned port, unsigned mask);
  6631. void _wait01 (unsigned port, unsigned mask);
  6632. void _wait10 (unsigned port, unsigned mask);
  6633.  
  6634.      The _wait0() and _wait1() functions wait for the bit indicated by MASK of 
  6635.      the 8-bit hardware port PORT being 0 or 1, respectively. 
  6636.  
  6637.      The _wait01() and _wait10() functions wait for a 0->1 or 1->0 transition, 
  6638.      respectively, of the bit indicated by MASK of the 8-bit hardware port 
  6639.      PORT. 
  6640.  
  6641.      If there are multiple bits set in MASK, `0' means all bits cleared, `1' 
  6642.      means at least one bit set. 
  6643.  
  6644.      You have to call _portaccess() first to enable access to a range of ports. 
  6645.      To make your program work under DOS, you have to use emx option -ai, see 
  6646.      `Using emx options'.  Under OS/2, your program requires emxio.dll in a 
  6647.      directory listed in LIBPATH.  When linking with LINK386 (-Zomf) or when 
  6648.      using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio).  libemxio 
  6649.      must not be used if the program should run under DOS. 
  6650.  
  6651.      Note that these functions eat lots of CPU time. 
  6652.  
  6653.      See also: _portaccess() , _inp8() 
  6654.  
  6655.  
  6656. ΓòÉΓòÉΓòÉ 23.3. _wait01() ΓòÉΓòÉΓòÉ
  6657.  
  6658.  
  6659. ΓòÉΓòÉΓòÉ 23.4. _wait1() ΓòÉΓòÉΓòÉ
  6660.  
  6661.  
  6662. ΓòÉΓòÉΓòÉ 23.5. _wait10() ΓòÉΓòÉΓòÉ
  6663.  
  6664.  
  6665. ΓòÉΓòÉΓòÉ 23.6. waitpid() ΓòÉΓòÉΓòÉ
  6666.  
  6667. #include <sys/wait.h>                          [UNIX]
  6668.  
  6669. int waitpid (int pid, int *status, int options);
  6670.  
  6671.      Wait until the child process PID terminates.  If PID is -1, waitpid() 
  6672.      waits for any child process, as does wait().  If there is no child process 
  6673.      with process ID PID (or if PID is -1 and there is no child process), errno 
  6674.      is set to ESRCH and -1 is returned. If STATUS is not NULL, the return code 
  6675.      and the termination status are stored to the location pointed to by 
  6676.      STATUS, see wait() for details.  OPTIONS is currently ignored. 
  6677.  
  6678.      Restrictions: waitpid() is not implemented for negative values of PID. 
  6679.      OPTIONS is ignored.  waitpid() is not implemented under DOS. waitpid() 
  6680.      cannot be used with ptrace() -- wait() must be used instead. 
  6681.  
  6682.      See also: wait() 
  6683.  
  6684.  
  6685. ΓòÉΓòÉΓòÉ 23.7. _wildcard() ΓòÉΓòÉΓòÉ
  6686.  
  6687. #include <stdlib.h>                            [emx]
  6688.  
  6689. void _wildcard (int *argcp, char ***argvp);
  6690.  
  6691.      Expand wildcards.  If you want wildcards on the command line to be 
  6692.      expanded, call 
  6693.  
  6694.               _wildcard (&argc, &argv);
  6695.  
  6696.      at the beginning of main().  Wildcard arguments enclosed in double quotes 
  6697.      won't be expanded.  If the expansion of a wildcard argument is empty, the 
  6698.      wildcard argument is kept unchanged.  Directories are included in the 
  6699.      expansion.  Hidden and system files are omitted. 
  6700.  
  6701.      _fnlwr() is used to convert file names to lower case on upper-case-only 
  6702.      file systems. 
  6703.  
  6704.      See also: _fnexplode() , main() , _response() 
  6705.  
  6706.  
  6707. ΓòÉΓòÉΓòÉ 23.8. wm_attrib() ΓòÉΓòÉΓòÉ
  6708.  
  6709. #include <sys/winmgr.h>                          [emx]
  6710.  
  6711. void wm_attrib (wm_handle wh, int a);
  6712.  
  6713.      Set the default attributes of window WH to A. 
  6714.  
  6715.      See also: wm_create() , wm_get_attrib() , wm_putc() 
  6716.  
  6717.  
  6718. ΓòÉΓòÉΓòÉ 23.9. wm_attrib_all() ΓòÉΓòÉΓòÉ
  6719.  
  6720. #include <sys/winmgr.h>                          [emx]
  6721.  
  6722. void wm_attrib_all (wm_handle wh, int a);
  6723.  
  6724.      Change the attributes of all characters of window WH (except of the 
  6725.      border) to A.  The character codes are not changed. 
  6726.  
  6727.      See also: wm_attrib() , wm_clear() , wm_create() 
  6728.  
  6729.  
  6730. ΓòÉΓòÉΓòÉ 23.10. wm_backsp() ΓòÉΓòÉΓòÉ
  6731.  
  6732. #include <sys/winmgr.h>                          [emx]
  6733.  
  6734. void wm_backsp (wm_handle wh, int count);
  6735.  
  6736.      Backspace the cursor of window WH.  The cursor is moved left by COUNT 
  6737.      characters.  If the cursor leaves the window at the left edge, it is moved 
  6738.      to the end of the previous line.  The cursor cannot leave the window at 
  6739.      the top edge. 
  6740.  
  6741.      See also: wm_putc() 
  6742.  
  6743.  
  6744. ΓòÉΓòÉΓòÉ 23.11. wm_border() ΓòÉΓòÉΓòÉ
  6745.  
  6746. #include <sys/winmgr.h>                          [emx]
  6747.  
  6748. void wm_border (wm_handle wh, int bflag, int battr, const char *title,
  6749.         int tflag, int tattr);
  6750.  
  6751.      Change the border of window WH.  The border type is set to BFLAG: 0 turns 
  6752.      the border off, 1 uses a single line, 2 uses a double line, 3 and 4 use 
  6753.      both single and double lines -- which is not recommended as most code 
  6754.      pages do not contain the necessary symbols.  All other values are used as 
  6755.      characters for drawing the border.  The attributes BATTR are used for 
  6756.      drawing the border. TITLE is displayed centered in the top line of the 
  6757.      border.  If TFLAG is non-zero, vertical bars are used to separate the 
  6758.      title text from the border.  The attributes TATTR are used for displaying 
  6759.      the title text. 
  6760.  
  6761.      See also: wm_create() 
  6762.  
  6763.  
  6764. ΓòÉΓòÉΓòÉ 23.12. wm_bottom() ΓòÉΓòÉΓòÉ
  6765.  
  6766. #include <sys/winmgr.h>                          [emx]
  6767.  
  6768. void wm_bottom (wm_handle wh);
  6769.  
  6770.      Move window WH to the bottom of the window stack, that is, it will be 
  6771.      moved below all other windows. 
  6772.  
  6773.      See also: wm_top() , wm_up() 
  6774.  
  6775.  
  6776. ΓòÉΓòÉΓòÉ 23.13. wm_chide() ΓòÉΓòÉΓòÉ
  6777.  
  6778. #include <sys/winmgr.h>                          [emx]
  6779.  
  6780. void wm_chide (int flag);
  6781.  
  6782.      Set the cursor hide mode.  If FLAG is non-zero, the cursor is hidden if 
  6783.      the current cursor position is hidden by another window. If FLAG is zero, 
  6784.      the cursor is visible even if the cursor position is hidden by another 
  6785.      window.  The initial value is non-zero. 
  6786.  
  6787.      See also: wm_ctype() , wm_cursor() 
  6788.  
  6789.  
  6790. ΓòÉΓòÉΓòÉ 23.14. wm_clear() ΓòÉΓòÉΓòÉ
  6791.  
  6792. #include <sys/winmgr.h>                          [emx]
  6793.  
  6794. void wm_clear (wm_handle wh);
  6795.  
  6796.      Clear window WH by filling WH with blanks using the current attributes. 
  6797.  
  6798.      See also: wm_attrib() , wm_attrib_all() 
  6799.  
  6800.  
  6801. ΓòÉΓòÉΓòÉ 23.15. wm_close() ΓòÉΓòÉΓòÉ
  6802.  
  6803. #include <sys/winmgr.h>                          [emx]
  6804.  
  6805. void wm_close (wm_handle wh);
  6806.  
  6807.      Close the window WH.  After closing the window, it still exists but is not 
  6808.      visible. 
  6809.  
  6810.      See also: wm_open() 
  6811.  
  6812.  
  6813. ΓòÉΓòÉΓòÉ 23.16. wm_close_all() ΓòÉΓòÉΓòÉ
  6814.  
  6815. #include <sys/winmgr.h>                          [emx]
  6816.  
  6817. void wm_close_all (void);
  6818.  
  6819.      Close all the windows.  wm_close_all() restores the original screen 
  6820.      contents. 
  6821.  
  6822.      See also: wm_close() , wm_open() 
  6823.  
  6824.  
  6825. ΓòÉΓòÉΓòÉ 23.17. wm_clr_eol() ΓòÉΓòÉΓòÉ
  6826.  
  6827. #include <sys/winmgr.h>                          [emx]
  6828.  
  6829. void wm_clr_eol (wm_handle wh, int x, int y);
  6830.  
  6831.      Clear from position (X,Y) of window WH to the end of that line of that 
  6832.      window by displaying blanks.  The current attributes are used. 
  6833.  
  6834.      See also: wm_clear() 
  6835.  
  6836.  
  6837. ΓòÉΓòÉΓòÉ 23.18. wm_create() ΓòÉΓòÉΓòÉ
  6838.  
  6839. #include <sys/winmgr.h>                          [emx]
  6840.  
  6841. wm_handle wm_create (int x0, int y0, int x1, int y1, int border, int battr,
  6842.            int wattr);
  6843.  
  6844.      Create a window.  The upper left character of the window interior is at 
  6845.      (X0,Y0), the bottom right character of the window interior is at (X1,Y1). 
  6846.      A window may be larger than the screen or partially or completely outside 
  6847.      the screen.  BORDER specifies the border type: 0 doesn't draw a border, 1 
  6848.      uses a single line, 2 uses a double line, 3 and 4 use both single and 
  6849.      double lines -- which is not recommended as most code pages do not contain 
  6850.      the necessary symbols.  All other values are used as characters for 
  6851.      drawing the border.  The attributes BATTR are used for drawing the border. 
  6852.      The attributes for displaying text in the window are set to WATTR. After 
  6853.      creating a window, it is invisible.  Use wm_open() to show the window. 
  6854.      wm_create() returns the handle of the window if successful.  Otherwise, 
  6855.      NULL is returned. 
  6856.  
  6857.      See also: wm_attrib() , wm_border() , wm_delete() , wm_open() 
  6858.  
  6859.  
  6860. ΓòÉΓòÉΓòÉ 23.19. wm_ctype() ΓòÉΓòÉΓòÉ
  6861.  
  6862. #include <sys/winmgr.h>                          [emx]
  6863.  
  6864. void wm_ctype (wm_handle wh, int start, int end);
  6865.  
  6866.      Set the cursor type of window WH.  START is the first row of the cursor, 
  6867.      END is the last row of the cursor.  Both values are zero-based.  The 
  6868.      cursor type set by wm_ctype() is used for displaying the cursor if it is 
  6869.      connected to window WH.  Use v_hardware() to determine the size of the 
  6870.      character box. 
  6871.  
  6872.      See also: v_hardware() , wm_chide() , wm_cursor() 
  6873.  
  6874.  
  6875. ΓòÉΓòÉΓòÉ 23.20. wm_cursor() ΓòÉΓòÉΓòÉ
  6876.  
  6877. #include <sys/winmgr.h>                          [emx]
  6878.  
  6879. void wm_cursor (wm_handle wh);
  6880.  
  6881.      Connect the screen cursor with the cursor of window WH.  The cursor is 
  6882.      displayed at the cursor position of window WH, using the cursor type of 
  6883.      window WH.  If WH is NULL, the screen cursor is not connected to any 
  6884.      window and is invisible.  Initially, the screen cursor is not connected to 
  6885.      any window. 
  6886.  
  6887.      See also: wm_chide() , wm_ctype() , wm_cvis() 
  6888.  
  6889.  
  6890. ΓòÉΓòÉΓòÉ 23.21. wm_cvis() ΓòÉΓòÉΓòÉ
  6891.  
  6892. #include <sys/winmgr.h>                          [emx]
  6893.  
  6894. void wm_cvis (wm_handle wh, int flag);
  6895.  
  6896.      Set the cursor status of window WH.  If FLAG is non-zero, the cursor is 
  6897.      enabled, if FLAG is zero, the cursor is disabled. 
  6898.  
  6899.      See also: wm_chide() , wm_cursor() 
  6900.  
  6901.  
  6902. ΓòÉΓòÉΓòÉ 23.22. wm_del_char() ΓòÉΓòÉΓòÉ
  6903.  
  6904. #include <sys/winmgr.h>                          [emx]
  6905.  
  6906. void wm_del_char (wm_handle wh, int x, int y, int count);
  6907.  
  6908.      Delete COUNT characters at position (X,Y) of window WH. Characters to the 
  6909.      right of that position are moved left, the positions becoming vacant at 
  6910.      the right edge of the window are filled with blanks using the current 
  6911.      attributes. 
  6912.  
  6913.      See also: wm_attrib() , wm_del_line() , wm_ins_char() 
  6914.  
  6915.  
  6916. ΓòÉΓòÉΓòÉ 23.23. wm_del_line() ΓòÉΓòÉΓòÉ
  6917.  
  6918. #include <sys/winmgr.h>                          [emx]
  6919.  
  6920. void wm_del_line (wm_handle wh, int y, int count);
  6921.  
  6922.      Delete COUNT lines at line Y of window WH by moving up the lines below 
  6923.      that line.  The current attributes are used for filling lines becoming 
  6924.      empty at the bottom of the window. 
  6925.  
  6926.      See also: wm_attrib() , wm_del_char() , wm_ins_line() , wm_scroll() 
  6927.  
  6928.  
  6929. ΓòÉΓòÉΓòÉ 23.24. wm_delete() ΓòÉΓòÉΓòÉ
  6930.  
  6931. #include <sys/winmgr.h>                          [emx]
  6932.  
  6933. void wm_delete (wm_handle wh);
  6934.  
  6935.      Destroy the window WH.  After calling wm_delete(), the window handle WH 
  6936.      must no longer be used.  The window is not closed. 
  6937.  
  6938.      See also: wm_close() , wm_create() 
  6939.  
  6940.  
  6941. ΓòÉΓòÉΓòÉ 23.25. wm_dimen() ΓòÉΓòÉΓòÉ
  6942.  
  6943. #include <sys/winmgr.h>                          [emx]
  6944.  
  6945. void wm_dimen (wm_handle wh, int *width, int *height);
  6946.  
  6947.      Store the width of the window WH (columns) to WIDTH, the height (lines) to 
  6948.      HEIGHT. 
  6949.  
  6950.      See also: wm_create() 
  6951.  
  6952.  
  6953. ΓòÉΓòÉΓòÉ 23.26. wm_down() ΓòÉΓòÉΓòÉ
  6954.  
  6955. #include <sys/winmgr.h>                          [emx]
  6956.  
  6957. void wm_down (wm_handle wh);
  6958.  
  6959.      Move window WH down the window stack, that is, it will be covered by an 
  6960.      additional window unless WH is already the bottom window. 
  6961.  
  6962.      See also: wm_bottom() , wm_top() , wm_up() 
  6963.  
  6964.  
  6965. ΓòÉΓòÉΓòÉ 23.27. wm_exit() ΓòÉΓòÉΓòÉ
  6966.  
  6967. #include <sys/winmgr.h>                          [emx]
  6968.  
  6969. void wm_exit (void);
  6970.  
  6971.      Quit the window manager and release all memory allocated by the window 
  6972.      manager.  All window handles become invalid.  The windows are not closed. 
  6973.  
  6974.      See also: wm_close() , wm_delete() 
  6975.  
  6976.  
  6977. ΓòÉΓòÉΓòÉ 23.28. wm_find() ΓòÉΓòÉΓòÉ
  6978.  
  6979. #include <sys/winmgr.h>                          [emx]
  6980.  
  6981. wm_handle wm_find (int x, int y);
  6982.  
  6983.      Find the window which is visible at position (X,Y) of the screen. The 
  6984.      window handle is returned if such a window exists.  Otherwise, NULL is 
  6985.      returned. 
  6986.  
  6987.  
  6988. ΓòÉΓòÉΓòÉ 23.29. wm_get_attrib() ΓòÉΓòÉΓòÉ
  6989.  
  6990. #include <sys/winmgr.h>                          [emx]
  6991.  
  6992. int wm_get_attrib (wm_handle wh);
  6993.  
  6994.      Return the current attributes of window WH. 
  6995.  
  6996.      See also: wm_attrib() 
  6997.  
  6998.  
  6999. ΓòÉΓòÉΓòÉ 23.30. wm_get_cursor() ΓòÉΓòÉΓòÉ
  7000.  
  7001. #include <sys/winmgr.h>                          [emx]
  7002.  
  7003. wm_handle wm_get_cursor (void);
  7004.  
  7005.      Get the window to which the screen cursor is connected.  The window handle 
  7006.      is returned.  If the cursor is not connected to any window, NULL is 
  7007.      returned. 
  7008.  
  7009.      See also: wm_cursor() 
  7010.  
  7011.  
  7012. ΓòÉΓòÉΓòÉ 23.31. wm_get_pos() ΓòÉΓòÉΓòÉ
  7013.  
  7014. #include <sys/winmgr.h>                          [emx]
  7015.  
  7016. void wm_get_pos (wm_handle wh, int *x, int *y);
  7017.  
  7018.      Store the screen coordinates of the upper left character of the interior 
  7019.      of window WH to X and Y. 
  7020.  
  7021.      See also: wm_create() , wm_move() 
  7022.  
  7023.  
  7024. ΓòÉΓòÉΓòÉ 23.32. wm_getx() ΓòÉΓòÉΓòÉ
  7025.  
  7026.  
  7027. ΓòÉΓòÉΓòÉ 23.33. wm_getxy() ΓòÉΓòÉΓòÉ
  7028.  
  7029. #include <sys/winmgr.h>                          [emx]
  7030.  
  7031. void wm_getxy (wm_handle wh, int *x, int *y);
  7032. int wm_getx (wm_handle wh);
  7033. int wm_gety (wm_handle wh);
  7034.  
  7035.      wm_getxy() stores the cursor coordinates of window WH to X and Y. 
  7036.      wm_getx() returns the horizontal position (column) of the cursor of window 
  7037.      WH.  wm_gety() returns the vertical position (line) of the cursor of 
  7038.      window WH.  The coordinates are zero-based and are relative to the upper 
  7039.      left character of the interior of window WH. 
  7040.  
  7041.      See also: wm_gotoxy() 
  7042.  
  7043.  
  7044. ΓòÉΓòÉΓòÉ 23.34. wm_gety() ΓòÉΓòÉΓòÉ
  7045.  
  7046.  
  7047. ΓòÉΓòÉΓòÉ 23.35. wm_gotoxy() ΓòÉΓòÉΓòÉ
  7048.  
  7049. #include <sys/winmgr.h>                          [emx]
  7050.  
  7051. void wm_gotoxy (wm_handle wh, int x, int y);
  7052.  
  7053.      Move the cursor of window WH to (X,Y).  The coordinates are zero-based and 
  7054.      are relative to the upper left character of the interior of window WH.  If 
  7055.      the screen cursor is connected to the cursor of window WH, the screen 
  7056.      cursor is moved. 
  7057.  
  7058.      See also: wm_cursor() , wm_getxy() 
  7059.  
  7060.  
  7061. ΓòÉΓòÉΓòÉ 23.36. wm_ins_char() ΓòÉΓòÉΓòÉ
  7062.  
  7063. #include <sys/winmgr.h>                          [emx]
  7064.  
  7065. void wm_ins_char (wm_handle wh, int x, int y, int count);
  7066.  
  7067.      Insert COUNT blank characters at position (X,Y) of window WH. Characters 
  7068.      to the right of that position are moved right.  The current attributes are 
  7069.      used for displaying the blank characters. 
  7070.  
  7071.      See also: wm_attrib() , wm_del_char() , wm_ins_line() 
  7072.  
  7073.  
  7074. ΓòÉΓòÉΓòÉ 23.37. wm_ins_line() ΓòÉΓòÉΓòÉ
  7075.  
  7076. #include <sys/winmgr.h>                          [emx]
  7077.  
  7078. void wm_ins_line (wm_handle wh, int y, int count);
  7079.  
  7080.      Insert COUNT empty lines at line Y of window WH by moving down that line 
  7081.      and all lines below that line.  The current attributes are used for 
  7082.      filling the empty lines. 
  7083.  
  7084.      See also: wm_attrib() , wm_del_line() , wm_scroll() 
  7085.  
  7086.  
  7087. ΓòÉΓòÉΓòÉ 23.38. wm_init() ΓòÉΓòÉΓòÉ
  7088.  
  7089. #include <sys/winmgr.h>                          [emx]
  7090.  
  7091. int wm_init (int n);
  7092.  
  7093.      Initialize the window manager and allocate memory for N windows. You must 
  7094.      call this function before calling any other window manager function. 
  7095.  
  7096.      General information about window manager functions: The window manager 
  7097.      functions implement text-mode output to windows on the screen.  You have 
  7098.      to link with libvideo (use the -lvideo option). Under DOS, emx option -acm 
  7099.      is required, see `Using emx options'. 
  7100.  
  7101.      Example: /emx/test/wm_demo.c, /emx/test/wm_hello.c 
  7102.  
  7103.      See also: wm_exit() 
  7104.  
  7105.  
  7106. ΓòÉΓòÉΓòÉ 23.39. wm_move() ΓòÉΓòÉΓòÉ
  7107.  
  7108. #include <sys/winmgr.h>                          [emx]
  7109.  
  7110. void wm_move (wm_handle wh, int x, int y);
  7111.  
  7112.      Move the window WH.  The upper left character of the interior of the 
  7113.      window will be at screen coordinates (X,Y). 
  7114.  
  7115.      See also: wm_get_pos() 
  7116.  
  7117.  
  7118. ΓòÉΓòÉΓòÉ 23.40. wm_open() ΓòÉΓòÉΓòÉ
  7119.  
  7120. #include <sys/winmgr.h>                          [emx]
  7121.  
  7122. void wm_open (wm_handle wh);
  7123.  
  7124.      Open the window WH.  The window will be showed on the screen unless it is 
  7125.      covered by other windows or outside the screen. 
  7126.  
  7127.      See also: wm_close() 
  7128.  
  7129.  
  7130. ΓòÉΓòÉΓòÉ 23.41. wm_printf() ΓòÉΓòÉΓòÉ
  7131.  
  7132. #include <sys/winmgr.h>                          [emx]
  7133.  
  7134. int wm_printf (wm_handle wh, const char *fmt, ...);
  7135.  
  7136.      Formatted output to window WH at the current cursor position of that 
  7137.      window.  The cursor is moved.  See printf() for details on FMT.  The 
  7138.      number of output characters is returned. 
  7139.  
  7140.      See also: wm_attrib() , wm_putc() , wm_puts() 
  7141.  
  7142.  
  7143. ΓòÉΓòÉΓòÉ 23.42. wm_puta_at() ΓòÉΓòÉΓòÉ
  7144.  
  7145. #include <sys/winmgr.h>                          [emx]
  7146.  
  7147. void wm_puta_at (wm_handle wh, int x, int y, int a, int count);
  7148.  
  7149.      Change to A the attributes of COUNT characters at position (X,Y) of window 
  7150.      WH.  All COUNT characters must be in one line of the window. 
  7151.  
  7152.      See also: wm_attrib() , wm_putsa_at() 
  7153.  
  7154.  
  7155. ΓòÉΓòÉΓòÉ 23.43. wm_putc() ΓòÉΓòÉΓòÉ
  7156.  
  7157. #include <sys/winmgr.h>                          [emx]
  7158.  
  7159. void wm_putc (wm_handle wh, char c);
  7160.  
  7161.      Display character C in window WH at the current cursor position of that 
  7162.      window, using the current attributes of that window.  The cursor of that 
  7163.      window is moved.  If the cursor leaves the window at the right edge, it 
  7164.      will be moved to the start of the next line. If C is '\n', the cursor is 
  7165.      moved to the start of the next line. If the cursor leaves the window at 
  7166.      the bottom edge, the window is scrolled up. 
  7167.  
  7168.      See also: wm_attrib() , wm_putc_at() , wm_putca() , wm_scroll() , 
  7169.      wm_wrap() 
  7170.  
  7171.  
  7172. ΓòÉΓòÉΓòÉ 23.44. wm_putc_at() ΓòÉΓòÉΓòÉ
  7173.  
  7174. #include <sys/winmgr.h>                          [emx]
  7175.  
  7176. void wm_putc_at (wm_handle wh, int x, int y, char c);
  7177.  
  7178.      Display character C at position (X,Y) of window WH using the current 
  7179.      attributes of that window.  The cursor is not moved. 
  7180.  
  7181.      See also: wm_attrib() , wm_gotoxy() 
  7182.  
  7183.  
  7184. ΓòÉΓòÉΓòÉ 23.45. wm_putca() ΓòÉΓòÉΓòÉ
  7185.  
  7186. #include <sys/winmgr.h>                          [emx]
  7187.  
  7188. void wm_putca (wm_handle wh, char c, int a);
  7189.  
  7190.      Display character C in window WH at the current cursor position of that 
  7191.      window, using the attributes A.  The cursor of that window is moved.  If 
  7192.      the cursor leaves the window at the right edge, it will be moved to the 
  7193.      start of the next line.  If C is '\n', the cursor is moved to the start of 
  7194.      the next line.  If the cursor leaves the window at the bottom edge, the 
  7195.      window is scrolled up. 
  7196.  
  7197.      See also: wm_putc() , wm_putca_at() , wm_scroll() , wm_wrap() 
  7198.  
  7199.  
  7200. ΓòÉΓòÉΓòÉ 23.46. wm_putca_at() ΓòÉΓòÉΓòÉ
  7201.  
  7202. #include <sys/winmgr.h>                          [emx]
  7203.  
  7204. void wm_putca_at (wm_handle wh, int x, int y, char c, int a);
  7205.  
  7206.      Display character C at position (X,Y) of window WH using the attributes A. 
  7207.      The cursor is not moved. 
  7208.  
  7209.  
  7210. ΓòÉΓòÉΓòÉ 23.47. wm_puts() ΓòÉΓòÉΓòÉ
  7211.  
  7212. #include <sys/winmgr.h>                          [emx]
  7213.  
  7214. void wm_puts (wm_handle wh, const char *str);
  7215.  
  7216.      Display string STR in window WH at the current cursor position of that 
  7217.      window using the current attributes of that window.  The '\n' character 
  7218.      moves the cursor to the start of the next line. Scrolling is performed 
  7219.      when the cursor leaves the window at the bottom edge. 
  7220.  
  7221.      See also: wm_attrib() , wm_putc() , wm_putsa() , wm_scroll() , wm_wrap() 
  7222.  
  7223.  
  7224. ΓòÉΓòÉΓòÉ 23.48. wm_puts_at() ΓòÉΓòÉΓòÉ
  7225.  
  7226. #include <sys/winmgr.h>                          [emx]
  7227.  
  7228. void wm_puts_at (wm_handle wh, int x, int y, const char *str);
  7229.  
  7230.      Display string STR in window WH at position (X,Y) using the current 
  7231.      attributes of that window.  The '\n' character is not interpreted, the 
  7232.      cursor is not moved. 
  7233.  
  7234.      See also: wm_attrib() , wm_puts() 
  7235.  
  7236.  
  7237. ΓòÉΓòÉΓòÉ 23.49. wm_putsa() ΓòÉΓòÉΓòÉ
  7238.  
  7239. #include <sys/winmgr.h>                          [emx]
  7240.  
  7241. void wm_putsa (wm_handle wh, const char *str, int a);
  7242.  
  7243.      Display string STR in window WH at the current cursor position of that 
  7244.      window using the attributes A.  The '\n' character moves the cursor to the 
  7245.      start of the next line.  Scrolling is performed when the cursor leaves the 
  7246.      window at the bottom edge. 
  7247.  
  7248.      See also: wm_putca() , wm_puts() , wm_scroll() , wm_wrap() 
  7249.  
  7250.  
  7251. ΓòÉΓòÉΓòÉ 23.50. wm_putsa_at() ΓòÉΓòÉΓòÉ
  7252.  
  7253. #include <sys/winmgr.h>                          [emx]
  7254.  
  7255. void wm_putsa_at (wm_handle wh, int x, int y, const char *str, int a);
  7256.  
  7257.      Display string STR in window WH at position (X,Y) using the attributes A. 
  7258.      The '\n' character is not interpreted, the cursor is not moved. 
  7259.  
  7260.      See also: wm_putsa() 
  7261.  
  7262.  
  7263. ΓòÉΓòÉΓòÉ 23.51. wm_scroll() ΓòÉΓòÉΓòÉ
  7264.  
  7265. #include <sys/winmgr.h>                          [emx]
  7266.  
  7267. void wm_scroll (wm_handle wh, int count);
  7268.  
  7269.      Scroll the interior of window WH up by one line.  The bottom line is 
  7270.      filled with blanks, using the current attributes. 
  7271.  
  7272.      See also: wm_attrib() , wm_del_line() , wm_ins_line() , wm_putc() 
  7273.  
  7274.  
  7275. ΓòÉΓòÉΓòÉ 23.52. wm_top() ΓòÉΓòÉΓòÉ
  7276.  
  7277. #include <sys/winmgr.h>                          [emx]
  7278.  
  7279. void wm_top (wm_handle wh);
  7280.  
  7281.      Move window WH to the top of the window stack, that is, it will cover all 
  7282.      other windows. 
  7283.  
  7284.      See also: wm_bottom() , wm_down() 
  7285.  
  7286.  
  7287. ΓòÉΓòÉΓòÉ 23.53. wm_up() ΓòÉΓòÉΓòÉ
  7288.  
  7289. #include <sys/winmgr.h>                          [emx]
  7290.  
  7291. void wm_up (wm_handle wh);
  7292.  
  7293.      Move window WH up the window stack, that is, it will cover an additional 
  7294.      window unless WH is already the top window. 
  7295.  
  7296.      See also: wm_bottom() , wm_down() , wm_top() 
  7297.  
  7298.  
  7299. ΓòÉΓòÉΓòÉ 23.54. wm_update() ΓòÉΓòÉΓòÉ
  7300.  
  7301. #include <sys/winmgr.h>                          [emx]
  7302.  
  7303. void wm_update (wm_handle wh, int flag);
  7304.  
  7305.      Set the update mode of window WH.  If FLAG is non-zero (which is the 
  7306.      default), the screen is updated immediately if window WH is changed.  If 
  7307.      FLAG is zero, changes to window WH are done in memory only.  This can be 
  7308.      done to improve speed.  Each call to update() copies the window to the 
  7309.      screen, regardless of the FLAG argument. 
  7310.  
  7311.  
  7312. ΓòÉΓòÉΓòÉ 23.55. wm_vprintf() ΓòÉΓòÉΓòÉ
  7313.  
  7314. #include <sys/winmgr.h>                          [emx]
  7315.  
  7316. int wm_vprintf (wm_handle wh, const char *fmt, va_list arg_ptr);
  7317.  
  7318.      Formatted output to window WH.  Instead of a list of arguments, this 
  7319.      function takes a pointer to the list of arguments.  See wm_printf() for 
  7320.      details. 
  7321.  
  7322.      See also: wm_printf() , va_arg() 
  7323.  
  7324.  
  7325. ΓòÉΓòÉΓòÉ 23.56. wm_wrap() ΓòÉΓòÉΓòÉ
  7326.  
  7327. #include <sys/winmgr.h>                          [emx]
  7328.  
  7329. void wm_wrap (wm_handle wh, int wrap_flag);
  7330.  
  7331.      Set the end-of-line wrap mode of window WH.  If FLAG is non-zero (which is 
  7332.      the default), the cursor is moved to the next line if it reaches the end 
  7333.      of a line.  If FLAG is zero, the cursor stays at the end of the line. 
  7334.      wm_wrap() applies to wm_putc(), wm_puts(), wm_printf(), etc. 
  7335.  
  7336.      See also: wm_putc() 
  7337.  
  7338.  
  7339. ΓòÉΓòÉΓòÉ 23.57. write() ΓòÉΓòÉΓòÉ
  7340.  
  7341. #include <io.h>                             [UNIX]
  7342.  
  7343. int write (int handle, const void *buf, size_t nbyte);
  7344.  
  7345.      Write NBYTE characters from the buffer BUF to the file HANDLE. The number 
  7346.      of characters written is returned.  If there is an error, -1 is returned. 
  7347.      Writing 0 characters is allowed -- the request will be ignored.  In text 
  7348.      mode, LF characters are translated to CR/LF pairs.  This translation does 
  7349.      not affect the return value. 
  7350.  
  7351.      See also: open() , setmode() , read() 
  7352.  
  7353.