home *** CD-ROM | disk | FTP | other *** search
-
- ΓòÉΓòÉΓòÉ 1. Library reference: functions ΓòÉΓòÉΓòÉ
-
- 5.3 Library reference: functions
-
- The functions are listed almost alphabetically. The origin of most of the
- functions is shown in [brackets] at the end of the first line. Functions which
- are not available or are limited with the system call library (-Zsys,
- libsys.lib) are marked [*].
-
- Copyright (c) 1990-1993 by Eberhard Mattes
- Original text document by Eberhard Mattes
- INF version by Mike Levis
-
- (This INF file contains the library function reference for emx/gcc 0.8f)
- (This is version 1.0 of the INF file)
- (Mike Levis -- OS/2, March 28, 1993)
-
-
- ΓòÉΓòÉΓòÉ 2. function a ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter a
-
-
- ΓòÉΓòÉΓòÉ 2.1. abort() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void volatile abort (void);
-
- abort() does some cleaning up and aborts program by raising SIGABRT. The
- default action for SIGABRT is to display the message `Abnormal program
- termination' and exit with return code 3.
-
- See also: exit() , _exit() , raise() , signal()
-
-
- ΓòÉΓòÉΓòÉ 2.2. abs() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> /* use this */ [ANSI]
- #include <math.h> /* or this */
-
- int abs (int n);
-
- Return the absolute value of N: If N is negative, -N is returned.
- Otherwise, N is returned. In-line code is generated for this function.
-
- See also: fabs() , labs()
-
-
- ΓòÉΓòÉΓòÉ 2.3. _abspath() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _abspath (char *dst, const char *src, int size);
-
- Construct an absolute path name for the file name or directory name SRC.
- The absolute path name is put to DST. It is assumed that there are SIZE
- bytes available at DST, this includes the terminating 0 byte. If there is
- an error, -1 is returned. If _abspath() succeeds, 0 is returned. If SIZE
- is too small, errno is set to ERANGE and -1 is returned. DST can be
- identical to SRC. Backslashes are translated into forward slashes. The
- absolute path name is not translated to lower case. If SRC ends with a
- slash or backslash, DST will end with a slash.
-
- _abspath() works with non-existing paths, it accesses the appropriate
- drive only for finding out the current working directory, if necessary.
-
- See also: _fnisabs() , _fullpath()
-
-
- ΓòÉΓòÉΓòÉ 2.4. access() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int access (const char *name, int mode);
-
- Returns 0 if the file or directory NAME is accessible in mode MODE.
- Otherwise returns -1 and sets errno to ENOENT or EACCES. If MODE is 0,
- access() checks only for existence of the file or directory. If MODE is
- 2, access() checks for write permission. If MODE is 4, access() checks for
- read permission (always granted under DOS and OS/2 if the file exists).
- If MODE is 6, access() checks for read and write permission.
-
- Restrictions: access() does not work with devices (ENOENT).
-
- See also: open() , stat()
-
-
- ΓòÉΓòÉΓòÉ 2.5. alarm() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [*] [UNIX]
-
- unsigned alarm (unsigned SEC);
-
- Raises SIGALRM after SEC seconds have expired. There is only one alarm
- clock, calling alarm() while the alarm clock is running, the time will be
- reset to the new value. If SEC is zero, the alarm clock will be stopped.
- alarm() returns the number of seconds remaining on the alarm clock before
- setting the new value. Under DOS, SIGALRM is not raised until return from
- DOS if the timer expired during a DOS call.
-
- Restriction: When using the system call library libsys.lib (-Zsys),
- alarm() is not available.
-
- See also: raise() , signal() , sleep() , _sleep2()
-
-
- ΓòÉΓòÉΓòÉ 2.6. alloca() ΓòÉΓòÉΓòÉ
-
- #include <alloca.h>
-
- void *alloca (size_t n);
-
- Allocate N bytes from the current stack frame. The memory space allocated
- by alloca() will be freed on exit from the current function. Do not pass
- the pointer returned by alloca() to free().
-
- This note applies only if you need stack probes:
-
- If alloca() with constant argument occurs in the first statement of a
- function with less than 4096 bytes of local data or if two calls to
- alloca() with constant arguments occur twice in a row without accessing
- the memory pointed to by the return value of the first call, you have to
- change your code to make GCC generate correct stack probes. This can be
- done by storing a dummy value to the return value of alloca().
-
- Example:
-
- p = alloca (0xf00);
- {char *fix=alloca (0); *fix = 0;}
- q = alloca (0xf00);
-
- Example:
-
- void test (void)
- {
- char local[0xf00], *p;
-
- {char *fix=alloca (0); *fix = 0;}
- p = alloca (0xf00);
- /*...*/
- }
-
- See also: GCC , malloc()
-
-
- ΓòÉΓòÉΓòÉ 2.7. asctime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- char *asctime (const struct tm *t);
-
- Convert the time and date given by the structure pointed to by T to a
- string. A pointer to the string is returned. There is only one memory
- location for the ctime() and asctime() results, a call to ctime() or
- asctime() overwrites the result of a previous calls to ctime() or
- asctime(). As localtime() is called by ctime(), the memory location
- shared by localtime(), gmtime(), and mktime() is overwritten. The string
- looks like
-
- "Sun Mar 22 22:59:18 1992\n"
-
- with a terminating 0. All fields have fixed width.
-
- See also: ctime()
-
-
- ΓòÉΓòÉΓòÉ 2.8. acos() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double acos (double x);
- double asin (double x);
- double atan (double x);
- double atan2 (double y, double x);
-
- Compute the arc sine, arc cosine and arc tangent of X, respectively.
- atan2() computes the arctangent of Y/X, using the signs of Y and X to
- determine the quadrant. If X is outside [-1,1], asin() and acos() return
- #NAN and set errno to EDOM.
-
- See also: cos() , sin() , tan()
-
-
- ΓòÉΓòÉΓòÉ 2.9. asin() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 2.10. assert() ΓòÉΓòÉΓòÉ
-
- #include <assert.h> [ANSI]
-
- void assert (int exp);
-
- If the preprocessor macro NDEBUG is defined, assert() does nothing.
- Otherwise, if EXP is zero, the message
-
- Assertion failed: EXP, file FILE, line LINE
-
- is displayed and the program is aborted. EXP, FILE and LINE are replaced
- with EXP (as text), the source file name and the source line number,
- respectively. If EXP is non-zero, nothing is done.
-
- See also: abort()
-
-
- ΓòÉΓòÉΓòÉ 2.11. atan() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 2.12. atan2() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 2.13. atexit() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- int atexit (void (*func)(void));
-
- The function FUNC will be called when the process is terminated. The last
- function installed by calling atexit() will be called first. Up to 32
- functions can be installed. 0 is returned if successful, -1 otherwise.
-
- See also: abort() , exit() , _exit()
-
-
- ΓòÉΓòÉΓòÉ 2.14. atof() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
- #include <math.h> /* alternate include file for atof() */
-
- double atof (const char *string);
- int atoi (const char *string);
- long atol (const char *string);
-
- Convert the textual representation of a number in STRING to a number.
- Leading whitespace is ignored. If the string cannot be converted, 0 is
- returned.
-
- See also: _atoll() , _itoa() , _ltoa() , scanf()
-
-
- ΓòÉΓòÉΓòÉ 2.15. atoi() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 2.16. atol() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 2.17. _atoll() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- long long _atoll (const char *string);
-
- Convert the textual representation of a number in STRING to a number.
- Leading whitespace is ignored. If the string cannot be converted, 0 is
- returned.
-
- See also: atol()
-
-
- ΓòÉΓòÉΓòÉ 3. function b ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter b
-
-
- ΓòÉΓòÉΓòÉ 3.1. bcmp() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- int bcmp (const void *buffer1, const void *buffer2, size_t n);
-
- Compare the first N bytes at BUFFER1 to the first N bytes at BUFFER2. If
- the two buffers are identical (or if N is zero), 0 is returned.
- Otherwise, a non-zero value is returned.
-
- See also: memcmp()
-
-
- ΓòÉΓòÉΓòÉ 3.2. bcopy() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- void bcopy (const void *src, void *dst, size_t n);
-
- Copy memory. Copy N bytes from SRC to DST. The two regions may overlap.
-
- See also: memmove()
-
-
- ΓòÉΓòÉΓòÉ 3.3. _beginthread() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- int _beginthread (void (*start)(void *arg), void *stack, unsigned stack_size,
- void *arg_list);
-
- Start a thread. START is the start address (a function). ARG_LIST will be
- passed in the ARG parameter of the START function. STACK is ignored,
- using NULL is recommended. STACK_SIZE is the size of the stack for the new
- thread. When the START function returns, the thread is terminated. A
- thread can also terminate itself by calling _endthread(). If successful,
- _beginthread() returns the thread ID. On error, _beginthread() sets errno
- and returns -1. The stack allocated for the new thread is completely
- committed, that is, stack probes are not required.
-
- Do not start a thread with DosCreateThread unless it doesn't call C
- library functions.
-
- _beginthread() is available only when using emxlibc.dll (-Zmt).
-
- See also: _endthread()
-
-
- ΓòÉΓòÉΓòÉ 3.4. brk() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- void *brk (void *addr);
-
- Change end address of data segment to ADDR. On success, brk() returns 0,
- cast as pointer. Otherwise, -1 cast as pointer is returned and errno set
- to ENOMEM. Please don't use brk() -- use malloc() instead for memory
- allocation.
-
- See also: malloc() , sbrk()
-
-
- ΓòÉΓòÉΓòÉ 3.5. bsearch() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void *bsearch (const void *key, const void *base, size_t num, size_t width,
- int (*compare)(const void *key, const void *element));
-
- Perform a binary search on the sorted array BASE to find KEY. The array
- has NUM elements of size WIDTH bytes each. bsearch() calls COMPARE to
- compare an array element pointed to by ELEMENT with KEY. COMPARE should
- return 0 if KEY and ELEMENT are equal; a negative value, if KEY is smaller
- than ELEMENT; a positive value if KEY is greater than ELEMENT with respect
- to the sorting order of ARRAY. bsearch() returns a pointer to an
- occurrence of KEY in the array. If KEY is not found, NULL is returned.
- If there are multiple occurrences of KEY in ARRAY, bsearch() returns a
- pointer to any one of the entries. If ARRAY is not sorted, bsearch() does
- not work.
-
- See also: qsort()
-
-
- ΓòÉΓòÉΓòÉ 3.6. bzero() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- void bzero (void *buffer, size_t n);
-
- Set N bytes at BUFFER to 0.
-
- See also: memset()
-
-
- ΓòÉΓòÉΓòÉ 4. function c ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter c
-
-
- ΓòÉΓòÉΓòÉ 4.1. cbrt() ΓòÉΓòÉΓòÉ
-
- #include <math.h>
-
- double cbrt (double x);
-
- Compute and return the cube root of X. This is done by calling pow() and
- adjusting the sign.
-
- See also: pow() , sqrt()
-
-
- ΓòÉΓòÉΓòÉ 4.2. ceil() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double ceil (double x);
-
- Return as floating-point number the smallest integer that is greater than
- or equal to X (round up).
-
- See also: floor() , rint() , trunc()
-
-
- ΓòÉΓòÉΓòÉ 4.3. chdir() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- int chdir (const char *name);
-
- Change to directory NAME. If NAME contains a drive letter, the working
- directory on that drive is changed, but the selected drive does not
- change. If successful, 0 is returned. Otherwise, -1 is returned.
-
- Restriction: Under DOS, the current working directory is not a property of
- a process, it's a system-wide property. That may change in a future
- release of emx.
-
- See also: _chdir2() , getcwd()
-
-
- ΓòÉΓòÉΓòÉ 4.4. _chdir2() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _chdir2 (const char *name);
-
- Change to drive and directory NAME. If NAME contains a drive letter, that
- drive is selected. If successful, 0 is returned. Otherwise, -1 is
- returned.
-
- Restriction: Under DOS, the current working directory and the default
- drive is not a property of a process, it's a system-wide property. That
- may change in a future release of emx.
-
- See also: chdir() , getcwd()
-
-
- ΓòÉΓòÉΓòÉ 4.5. _chdrive() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- int _chdrive (char drive);
-
- Make the disk drive DRIVE the default drive. DRIVE must be in 'A' through
- 'Z'. _chdrive() always returns 0, even if the drive does not exist.
-
- See also: _chdir2() , _getdrive()
-
-
- ΓòÉΓòÉΓòÉ 4.6. chmod() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
- #include <sys/stat.h>
-
- int chmod (const char *name, int pmode);
-
- Change permission settings of the file named NAME to PMODE. There's only
- one permission bit under OS/2 and DOS, the read-only attribute.
-
- Return value:
-
- 0 success
-
- -1 failure
-
- Restriction: Only the S_IWRITE bit of PMODE is used.
-
- See also: creat() , open() , stat() , umask()
-
-
- ΓòÉΓòÉΓòÉ 4.7. chsize() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
-
- int chsize (int handle, long size);
-
- Change the length of the file associated with HANDLE to LENGTH bytes. The
- position of the file pointer is undefined after calling this function. If
- LENGTH is greater than the current length of the file, bytes of zeros are
- appended. HANDLE must be open for writing. If successful, 0 is returned.
- Otherwise, -1 is returned.
-
- See also: ftruncate()
-
-
- ΓòÉΓòÉΓòÉ 4.8. clearerr() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- void clearerr (FILE *stream);
-
- Clear the error and end-of-file indicators of STREAM.
-
- See also: ferror() , feof()
-
-
- ΓòÉΓòÉΓòÉ 4.9. clock() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- clock_t clock (void);
-
- clock() returns the amount of processor time (timer ticks) used by the
- calling process since the process has been started. There are
- CLOCKS_PER_SEC timer ticks per second.
-
- Restriction: clock() returns the time elapsed, not the CPU time.
-
- See also: time()
-
-
- ΓòÉΓòÉΓòÉ 4.10. close() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int close (int handle);
-
- Close the file associated with the handle HANDLE. If successful, 0 is
- returned, -1 if not.
-
- See also: dup() , open()
-
-
- ΓòÉΓòÉΓòÉ 4.11. closedir() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 4.12. _core() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [*] [emx]
-
- int _core (int handle);
-
- Write a core dump to the file HANDLE. HANDLE must be open for writing.
- The core dump file can be used later for debugging or for creating another
- .exe file which includes the data as saved when _core() was called.
-
- Restriction: _core() works only in programs linked with ld. It does not
- work in programs linked with LINK386. When using the system call library
- libsys.lib (-Zsys), _core() is not available.
-
- See also: raise()
-
-
- ΓòÉΓòÉΓòÉ 4.13. cos() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double cos (double x);
- double sin (double x);
- double tan (double x);
-
- Compute the sine, cosine and tangent of X, respectively. If the absolute
- value of x is greater than or equal to 2^63, #NAN is returned and errno
- set to EDOM.
-
- See also: acos() , asin() , atan()
-
-
- ΓòÉΓòÉΓòÉ 4.14. cosh() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double cosh (double x);
- double sinh (double x);
- double tanh (double x);
-
- Compute the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of
- X, respectively. On overflow, #INF is returned and errno set to ERANGE.
-
- See also: exp()
-
-
- ΓòÉΓòÉΓòÉ 4.15. creat() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
- #include <sys/stat.h>
-
- int creat (const char *name, int pmode);
-
- Create a file named NAME with permission settings PMODE. This is
- equivalent to
-
- open (name, O_WRONLY|O_TRUNC|O_CREAT, pmode)
-
- See also: open()
-
-
- ΓòÉΓòÉΓòÉ 4.16. _crlf() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [emx]
-
- int _crlf (char *buf, size_t size, size_t *new_size);
-
- Translate CR/LF pairs to LF characters. The conversion is done in-place
- in the buffer BUF of size SIZE. The new size is stored to *NEW_SIZE. If
- the buffer ends with a CR, 1 is returned. Otherwise, 0 is returned.
-
- See also: fread() , _fsetmode() , read() , setmode()
-
-
- ΓòÉΓòÉΓòÉ 4.17. _CRT_init() ΓòÉΓòÉΓòÉ
-
- [OS/2]
-
- int _CRT_init (void);
- void _CRT_term (void);
-
- These two functions are provided for being called from _DLL_InitTerm(),
- the DLL initialization and termination function.
-
- _CRT_init() initializes the C run-time library. On success, 0 is
- returned. On failure, -1 is returned.
-
- _CRT_term() terminates the C run-time library.
-
- Example: /emx/test/testdll1.c
-
- See also: _DLL_InitTerm()
-
-
- ΓòÉΓòÉΓòÉ 4.18. _CRT_term() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 4.19. ctime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- char *ctime (const time_t *t);
-
- Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970 given by
- the variable pointed to by T to a string representing that moment for the
- local timezone. A pointer to the string is returned. There is only one
- memory location for the ctime() and asctime() results, a call to ctime()
- or asctime() overwrites the result of a previous calls to ctime() or
- asctime(). As localtime() is called by ctime(), the memory location
- shared by localtime(), gmtime(), and mktime() is overwritten. The string
- looks like
-
- "Sun Mar 22 22:59:18 1992\n"
-
- with a terminating 0. All fields have fixed width.
-
- See also: asctime()
-
-
- ΓòÉΓòÉΓòÉ 5. function d ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter d
-
-
- ΓòÉΓòÉΓòÉ 5.1. _defext() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- void _defext (char *dst, const char *ext);
-
- Add the default extension EXT to the file name DST. If the file name part
- of DST contains an extension (including the empty extension), nothing will
- be done. Otherwise, a dot and EXT will be appended.
-
- See also: _getext() , _remext() , _splitpath()
-
-
- ΓòÉΓòÉΓòÉ 5.2. difftime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- double difftime (time_t t1, time_t t0);
-
- Return the difference (in seconds) T1-T0 between T0 and T1.
-
-
- ΓòÉΓòÉΓòÉ 5.3. div() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- div_t div (int num, int den);
- ldiv_t ldiv (long num, long den);
-
- Perform an integer division, dividing NUM by DEN. The quotient and the
- remainder are returned in the quot and rem fields, respectively.
-
- The following table shows the signs of quot and rem depending on the signs
- of NUM and DEN:
-
- ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
- ΓöéNUM ΓöéDEN Γöéquot Γöérem Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé+ Γöé+ Γöé+ Γöé+ Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé+ Γöé- Γöé- Γöé+ Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé- Γöé+ Γöé- Γöé- Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé- Γöé- Γöé+ Γöé- Γöé
- ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
-
- See also: _lldiv() , _uldiv() , _ulldiv()
-
-
- ΓòÉΓòÉΓòÉ 5.4. _DLL_InitTerm() ΓòÉΓòÉΓòÉ
-
- [OS/2]
-
- unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag);
-
- _DLL_InitTerm is the library initialization and termination function for
- dynamic link libraries. It is called by the operating system to
- initialize the library (if FLAG is zero) or to terminate the library (if
- FLAG is one). MOD_HANDLE is the module handle of the dynamic link
- library. _DLL_InitTerm() should return 1 to indicate success. On
- failure, 0 should be returned. The default _DLL_InitTerm() function does
- nothing but returning 1. To initialize the C library, you have to write
- an _DLL_InitTerm() function which calls _CRT_init().
-
- Example: /emx/test/testdll1.c
-
- See also: _CRT_init() , _CRT_term()
-
-
- ΓòÉΓòÉΓòÉ 5.5. _dt_free() ΓòÉΓòÉΓòÉ
-
- #include <sys/dirtree.h> [emx]
-
- void _dt_free (struct _dt_tree *dt);
-
- Deallocate the memory allocated by _dt_read() for the directory tree DT.
-
- See also: _dt_read()
-
-
- ΓòÉΓòÉΓòÉ 5.6. _dt_read() ΓòÉΓòÉΓòÉ
-
- #include <sys/dirtree.h> [emx]
-
- struct _dt_tree *_dt_read (const char *dir, const char *mask, unsigned flags);
-
- Create a directory tree in memory. The tree consists of a linked list of
- _dt_node structures. Subtrees are attached to the SUB field of _dt_node
- structures for directories. Files matching MASK in the directory DIR are
- put into the tree. If FLAGS includes _DT_TREE, all subdirectories of DIR
- are also scanned for files and directories matching MASK. If _DT_TREE is
- not included, the subdirectories of DIR are not scanned. If FLAGS
- includes _DT_NOCPDIR, the `.' and `..' entries are omitted. If
- successful, _dt_read() returns a pointer to a _dt_tree structure. The
- TREE field of that structure is the root of the tree. On error, the errno
- variable is set and NULL is returned.
-
- _fnlwr() is used to convert file names to lower case on upper-case-only
- file systems.
-
- Example: /emx/test/dttest.c
-
- See also: _dt_free() , _dt_sort() , _dt_split() , _fnlwr() , _fnexplode()
-
-
- ΓòÉΓòÉΓòÉ 5.7. _dt_sort() ΓòÉΓòÉΓòÉ
-
- #include <sys/dirtree.h> [emx]
-
- void _dt_sort (struct _dt_tree *dt, const char *spec);
-
- Sort the directory tree DT according to SPEC. DT is a directory tree
- created by _dt_read(). SPEC is a string of characters which is read from
- left to right. Each character tells _dt_sort() how to compare two tree
- nodes. If the nodes compare equal, the next character is examined. This
- is repeated until the two nodes are different according to the sorting
- criterion indicated by a character of SPEC or the end of the SPEC string
- is reached. If the end of the SPEC string is reached, the two nodes are
- considered equal and the two nodes are put in an arbitrary order. The
- following characters of SPEC are defined:
-
- e File name extensions are compared, ascending ASCII order
-
- E File name extensions are compared, descending ASCII order
-
- f Directories are placed before files
-
- F Files are placed before directories
-
- n File names are compared, ascending ASCII order
-
- N File names are compared, descending ASCII order
-
- s File size is compared, ascending
-
- S File size is compared, descending
-
- t Time stamps (last modification) are compared, ascending
-
- T Time stamps (last modification) are compared, descending
-
- All other characters are ignored. _fncmp() is used for comparing file
- names. If _fncmp() returns 0, strcmp() is used in addition. strcmp() can
- return a non-zero value only if the current code page doesn't match the
- code page used when creating the directory entries.
-
- See also: _dt_read() , _fncmp()
-
-
- ΓòÉΓòÉΓòÉ 5.8. _dt_split() ΓòÉΓòÉΓòÉ
-
- #include <sys/dirtree.h> [emx]
-
- int _dt_split (const char *src, char *dir, char *mask);
-
- Split the path name SRC into a directory part and a name part for
- _dt_read(). The directory part is stored to DIR, the name part is stored
- to MASK. If SRC is a directory, MASK is set to "*".
-
- See also: _dt_read()
-
-
- ΓòÉΓòÉΓòÉ 5.9. dup() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int dup (int handle);
- int dup2 (int handle1, int handle2);
-
- Create a duplicate of the file handle HANDLE or HANDLE1, respectively,
- that is, another handle that refers to the same file or device or pipe as
- the handle given. Both handles share the same file pointer. dup()
- chooses the lowest numbered available handle. dup2() uses HANDLE2 for the
- new file handle. If HANDLE2 is open when dup2() is called, it is closed
- by dup2(). If there is an error, -1 is returned. Otherwise, the new file
- handle is returned.
-
- Restriction: dup2() currently doesn't work correctly under DOS.
-
- See also: close() , fcntl() , open()
-
-
- ΓòÉΓòÉΓòÉ 5.10. dup2() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 6. function e ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter e
-
-
- ΓòÉΓòÉΓòÉ 6.1. _ea_free() ΓòÉΓòÉΓòÉ
-
- #include <sys/ea.h> [emx]
-
- void _ea_free (struct _ea *ptr);
-
- Free the memory allocated for the value of an extended attribute stored in
- the structure pointed to by PTR. If the VALUE field of the structure is
- non-NULL, free() is called for that pointer. Then, the VALUE field is set
- to NULL.
-
- See also: _ea_get()
-
-
- ΓòÉΓòÉΓòÉ 6.2. _ea_get() ΓòÉΓòÉΓòÉ
-
- #include <sys/ea.h> [emx]
-
- int _ea_get (struct _ea *dst, const char *path, int handle,
- const char *name);
-
- Retrieve the extended attribute NAME of a file or directory. If PATH is
- non-NULL, an extended attribute of the file or directory named by PATH is
- retrieved. Otherwise, an extended attribute of the file referred to by
- HANDLE is retrieved. The letter case of NAME is ignored. The flags, the
- value and the size of the value of the extended attribute is copied to
- DST. If there is an error, errno is set and -1 is returned. Otherwise, 0
- is returned. If the extended attribute NAME does not exist, 0 is
- returned, the SIZE field of DST is set to 0 and the VALUE field of DST is
- set to NULL. _ea_get() allocates memory for the value of the extended
- attribute by calling malloc(). The structure declaration is:
-
- struct _ea
- {
- int flags;
- int size;
- void *value;
- };
-
- The FLAGS field contains the flags byte of the extended attribute (only
- bits 0 through 7 of FLAGS are used). Currently, OS/2 defines only bit 7:
- it's set for critical EAs. SIZE is the length of the value in bytes. The
- VALUE field points to the (binary) value of the extended attribute.
-
- Use _ead_read() to retrieve all the extended attributes of a file or
- directory.
-
- See also: _ea_free() , _ea_put() , _ead_read()
-
-
- ΓòÉΓòÉΓòÉ 6.3. _ea_put() ΓòÉΓòÉΓòÉ
-
- #include <sys/ea.h> [emx]
-
- int _ea_put (struct _ea *src, const char *path, int handle,
- const char *name);
-
- Add an extended attribute to a file or directory. If PATH is non-NULL,
- the extended attribute is added to the file or directory named by PATH.
- Otherwise, the extended attribute is added to the file referred to by
- HANDLE which must be open for writing. NAME is the name of the extended
- attribute. The letter case of NAME is ignored. SRC points to an _ea
- structure which holds the flags, size and value of the extended attribute
- to be added. If the SIZE field is 0, the extended attribute is removed.
- Bits 0 though 7 of FLAGS contain the flags byte for the extended
- attribute. Currently, OS/2 defines only bit: it's the critical EA bit.
- The FLAGS field should be zero unless you exactly know what you're doing.
- If there is an error, errno is set and -1 is returned. Otherwise, 0 is
- returned.
-
- Use _ead_write() to replace or update multiple extended attributes at
- once.
-
- See also: _ea_get() , _ea_remove() , _ead_write()
-
-
- ΓòÉΓòÉΓòÉ 6.4. _ea_remove() ΓòÉΓòÉΓòÉ
-
- #include <sys/ea.h> [emx]
-
- int _ea_remove (const char *path, int handle, const char *name);
-
- Remove the extended attribute named NAME from a file or directory. If PATH
- is non-NULL, the extended attribute is removed from the file or directory
- named by PATH. Otherwise, the extended attribute is removed from the file
- referred to by HANDLE. The letter case of NAME is ignored. If there is
- an error, errno is set and -1 is returned. Otherwise, 0 is returned.
- Removing a non-existing extended attribute of an existing file or
- directory is not an error.
-
- See also: _ea_put() , _ead_write()
-
-
- ΓòÉΓòÉΓòÉ 6.5. _ead_add() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_add (_ead ead, const char *name, int flags, const void *value,
- int size);
-
- Add the extended attribute NAME to the extended attributes descriptor EAD.
- NAME should be a null-terminated string. The value of the extended
- attribute is set to SIZE bytes of VALUE. The flags byte of the extended
- attribute is set to FLAGS. Only bits 0 through 7 of FLAGS are used.
- Currently, OS/2 defines only bit 7 of the flags byte: it's the critical EA
- bit. FLAGS should be zero unless you exactly know what you're doing. If
- an extended attribute named NAME already exists in EAD, it is updated with
- FLAGS, SIZE and VALUE. If there is an error, errno is set and a negative
- value is returned. On success, the index of the new (or updated) extended
- attribute is returned. The extended attributes on disk are not affected.
- After calling _ead_add(), the pointers returned by previous invocations of
- _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid.
- As _ead_add() does a case-sensitive search, you should pass an upper-case
- names in NAME. If there are two extended attributes in an extended
- attributes descriptor whose names differ only in letter case, only one of
- both will be written to the disk by _ead_write().
-
- See also: _ead_delete() , _ead_replace() , _ead_write() , _nls_strupr()
-
-
- ΓòÉΓòÉΓòÉ 6.6. _ead_clear() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- _ead _ead_clear (_ead ead);
-
- Discard the extended attributes of the extended attributes descriptor EAD.
- After calling _ead_clear(), _ead_count() will return 0 for EAD. The
- extended attributes on disk are not modified. After calling _ead_clear(),
- do not use pointers returned by _ead_get_name(), _ead_get_value() and
- _ead_get_fea2list() for that descriptor.
-
- See also: _ead_create() , _ead_destroy() , _ead_read()
-
-
- ΓòÉΓòÉΓòÉ 6.7. _ead_copy() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_copy (_ead dst_ead, _ead src_ead, int src_index);
-
- Copy the extended attribute SRC_INDEX from the extended attributes
- descriptor SRC_EAD to the extended attributes descriptor DST_EAD. If
- SRC_INDEX is 0, all extended attributes of SRC_EAD are copied to DST_EAD.
- Otherwise, SRC_INDEX must be a number between 1 and the number of extended
- attributes of SRC_EAD. _ead_copy() uses _ead_add() to copy the extended
- attributes. The extended attributes on disk are not affected.
-
- See also: _ead_add()
-
-
- ΓòÉΓòÉΓòÉ 6.8. _ead_count() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_count (_ead ead);
-
- Return the number of extended attributes available from the extended
- attributes descriptor EAD.
-
- See also: _ead_create() , _ead_get_name() , _ead_get_value()
-
-
- ΓòÉΓòÉΓòÉ 6.9. _ead_create() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- _ead _ead_create (void)
-
- Create an extended attributes descriptor. Such a descriptor is used for
- handling the extended attributes of files and directories. If successful,
- _ead_create() returns a descriptor which can be used by the other
- functions for handling extended attributes. Otherwise, errno is set and
- NULL is returned. Use _ead_destroy() if you no longer need the
- descriptor. To copy all the extended attributes of a file or a directory
- to an extended attributes descriptor, use _ead_read(). Initially, no
- extended attributes are held by an extended attributes descriptor.
-
- Example: /emx/test/eatool.c
-
- See also: _ead_destroy() , _ead_get_name() , _ead_get_value() ,
- _ead_read()
-
-
- ΓòÉΓòÉΓòÉ 6.10. _ead_delete() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_delete (_ead ead, int index);
-
- Delete the extended attribute INDEX from the extended attributes
- descriptor EAD. INDEX must be a number between 1 and the number of
- extended attributes of EAD. If successful, this function returns 0.
- Otherwise, errno is set and a negative number is returned. After calling
- _ead_delete(), the pointers returned by previous invocations of
- _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid.
- Moreover, _ead_delete() invalidates index numbers.
-
- See also: _ead_add() , _ead_find()
-
-
- ΓòÉΓòÉΓòÉ 6.11. _ead_destroy() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- void _ead_destroy (_ead ead);
-
- Invalidate the extended attributes descriptor EAD which has been created
- by _ead_create(). All memory associated with EAD is released. EAD must
- not be NULL. After calling _ead_destroy(), EAD is invalid and can no
- longer be used. After calling _ead_destroy(), do not use pointers
- returned by _ead_get_name(), _ead_get_value() and _ead_get_fea2list() for
- that descriptor.
-
- See also: _ead_clear() , _ead_create()
-
-
- ΓòÉΓòÉΓòÉ 6.12. _ead_fea2list_size() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_fea2list_size (_ead ead);
-
- Return the size of the FEA2LIST of the extended attributes descriptor EAD.
- If EAD doesn't hold any extended attributes, 0 is returned.
-
- See also: _ead_get_fea2list()
-
-
- ΓòÉΓòÉΓòÉ 6.13. _ead_fea2list_to_fealist() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- void *_ead_fea2list_to_fealist (const void *src);
-
- Convert the FEA2LIST SRC (OS/2 2.0 format) to a FEALIST (OS/2 1.2 format).
- SRC must not be NULL. This function allocates memory with malloc() to
- hold the converted list. A pointer to the converted list is returned. If
- you no longer need the buffer allocated by this function, you should
- deallocate it with free(). If there is an error, errno is set and NULL is
- returned. SRC is of type PFEA2LIST, the return value is of type PFEALIST.
- To avoid having to include os2.h when including ead.h, void pointers are
- used instead.
-
- See also: _ead_fealist_to_fea2list() , _ead_get_fea2list()
-
-
- ΓòÉΓòÉΓòÉ 6.14. _ead_fealist_to_fea2list() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- void *_ead_fealist_to_fea2list (const void *src);
-
- Convert the FEALIST SRC (OS/2 1.2 format) to a FEA2LIST (OS/2 2.0 format).
- SRC must not be NULL. This function allocates memory with malloc() to
- hold the converted list. A pointer to the converted list is returned. If
- you no longer need the buffer allocated by this function, you should
- deallocate it with free(). If there is an error, errno is set and NULL is
- returned. SRC is of type PFEALIST, the return value is of type PFEA2LIST.
- To avoid having to include os2.h when including ead.h, void pointers are
- used instead.
-
- See also: _ead_fea2list_to_fealist()
-
-
- ΓòÉΓòÉΓòÉ 6.15. _ead_find() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_find (_ead ead, const char *name);
-
- Return the index of the extended attribute named NAME of the extended
- attributes descriptor EAD. NAME should be a null-terminated string. If
- there is no such extended attribute, errno is set to ENOENT and -1 is
- returned. Otherwise, a number between 1 and the number of extended
- attributes of EAD is returned. Note that OS/2 converts names of extended
- attributes to upper case when writing them to the disk. As _ead_find()
- does a case-sensitive compare, lower-case names are not found.
-
- See also: _ead_count() , _ead_get_name() , _ead_get_value() ,
- _nls_strupr()
-
-
- ΓòÉΓòÉΓòÉ 6.16. _ead_get_fea2list() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- const void *_ead_get_fea2list (_ead ead);
-
- Return a pointer to the FEA2LIST of the extended attributes descriptor
- EAD. You should cast the return value to PFEA2LIST. The return type of
- _ead_get_fea2list() is not PFEA2LIST to be able to include ead.h without
- having to include os2.h. The pointer points to memory allocated by the
- extended attributes functions -- do not use the pointer after calling
- _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(), _ead_destroy() or
- _ead_replace() and do not write to the buffer.
-
- See also: _ead_fea2list_size() , _ead_fea2list_to_fealist()
-
-
- ΓòÉΓòÉΓòÉ 6.17. _ead_get_flags() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_get_flags (_ead ead, int index);
-
- Return the flags byte of the extended attribute INDEX of the extended
- attributes descriptor EAD. INDEX must be a number between 1 and the
- number of extended attributes of EAD. On error, errno is set and -1 is
- returned.
-
- See also: _ead_count() , _ead_get_value()
-
-
- ΓòÉΓòÉΓòÉ 6.18. _ead_get_name() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- const char *_ead_get_name (_ead ead, int index);
-
- Return a pointer to the name of the extended attribute INDEX of the
- extended attributes descriptor EAD. INDEX must be a number between 1 and
- the number of extended attributes of EAD. The pointer points to memory
- allocated by the extended attributes functions -- do not use the pointer
- after calling _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(),
- _ead_destroy() or _ead_replace() and do not write to the buffer. On
- error, errno is set and NULL is returned.
-
- See also: _ead_count() , _ead_name_len()
-
-
- ΓòÉΓòÉΓòÉ 6.19. _ead_get_value() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- const void *_ead_get_value (_ead ead, int index);
-
- Return a pointer to the value of the extended attribute INDEX of the
- extended attributes descriptor EAD. INDEX must be a number between 1 and
- the number of extended attributes of EAD. The pointer points to memory
- allocated by the extended attributes functions -- do not use the pointer
- after calling _ead_add(), _ead_clear(), _ead_copy(), _ead_delete(),
- _ead_destroy() or _ead_replace() and do not write to the buffer. On
- error, errno is set and NULL is returned.
-
- See also: _ead_count() , _ead_find() , _ead_get_flags() ,
- _ead_value_size()
-
-
- ΓòÉΓòÉΓòÉ 6.20. _ead_name_len() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_name_len (_ead ead, int index);
-
- Return the length of the name of the extended attribute INDEX of the
- extended attributes descriptor EAD. If INDEX is 0, the total length of
- all the names is returned, not including the terminating null characters.
- Otherwise, INDEX must be a number between 1 and the number of extended
- attributes of EAD; the length of the name of the INDEXth extended
- attribute is returned. The terminating null character is not included in
- the length. On error, errno is set and -1 is returned.
-
- See also: _ead_count() , _ead_get_name()
-
-
- ΓòÉΓòÉΓòÉ 6.21. _ead_read() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- _ead _ead_read (_ead ead, const char *path, int handle, int flags);
-
- Copy the extended attributes of a file or directory to the extended
- attributes descriptor EAD. The extended attributes held previously by EAD
- are discarded. If PATH is not NULL, the extended attributes of that path
- name (file or directory) are copied to EAD. If PATH is NULL, the extended
- attributes of the file referred to by the file handle HANDLE are copied to
- EAD. FLAGS is not yet used and must be 0. If successful, _ead_read()
- returns zero. Otherwise, errno is set and a negative number is returned.
- _ead_read() calls _ead_clear(), reads all the extended attributes and
- stores them in memory. Use _ead_destroy() to deallocate that memory and
- invalidate EAD. When using a non-NULL PATH, _ead_read() does not lock the
- file while while reading the extended attributes. You might want to open
- a handle in deny-write mode and pass it in HANDLE to avoid problems due to
- other threads or processes modifying the extended attributes while
- _ead_read() is reading. This doesn't work with and isn't required for
- directories. _ead_read() can also be used under DOS though no extended
- attributes will be copied. Therefore, your program doesn't have to decide
- whether to use these functions or not.
-
- Use _ea_get() to retrieve extended attributes one by one.
-
- See also: _ea_get() , _ead_create() , _ead_destroy() , _ead_get_name()
- _ead_get_value()
-
-
- ΓòÉΓòÉΓòÉ 6.22. _ead_replace() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_replace (_ead ead, int index, int flags, const void *value, int size);
-
- Update the extended attribute INDEX of the extended attributes descriptor
- EAD with FLAGS and SIZE bytes of VALUE. INDEX must be a number between 1
- and the number of extended attributes of EAD. On success, _ead_replace()
- returns 0. On error, errno is set and a negative value is returned. The
- extended attributes on disk are not affected. After calling
- _ead_replace(), the pointers returned by previous invocations of
- _ead_get_fea2list(), _ead_get_name() and _ead_get_value() will be invalid.
-
- See also: _ead_add() , _ead_write()
-
-
- ΓòÉΓòÉΓòÉ 6.23. _ead_sort() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- void _ead_sort (_ead ead);
-
- Sort by name the extended attributes of the extended attributes descriptor
- EAD. Sorting is done in memory -- the extended attributes on disk are not
- affected. After calling _ead_sort(), index 1 refers to the extended
- attribute with the lexically smallest name. strcmp() is used for
- comparing names. _ead_sort() sorts the index, not the extended attributes
- proper. Therefore, all functions that modify the extended attributes of
- EAD undo the effect of _ead_sort().
-
- See also: _ead_create() , _ead_get_name() , _ead_read()
-
-
- ΓòÉΓòÉΓòÉ 6.24. _ead_use_fea2list() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_use_fea2list (_ead ead, const void *src);
-
- Copy all the extended attributes from the FEA2LIST SRC (OS/2 2.0 format)
- to the extended attributes descriptor EAD. All extended attributes
- previously held by EAD are discarded. The extended attributes on the disk
- are not affected. If successful, _ead_use_fea2list() returns 0.
- Otherwise, errno is set and a negative value is returned.
-
- See also: _ead_write()
-
-
- ΓòÉΓòÉΓòÉ 6.25. _ead_value_size() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_value_size (_ead ead, int index);
-
- Return the size of the extended attribute INDEX of the extended attributes
- descriptor EAD. If INDEX is 0, the total size of all the values of EAD is
- returned. Otherwise, INDEX must be a number between 1 and the number of
- extended attributes of EAD; the size of the INDEXth extended attribute is
- returned. On error, errno is set and -1 is returned.
-
- See also: _ead_count() , _ead_get_value()
-
-
- ΓòÉΓòÉΓòÉ 6.26. _ead_write() ΓòÉΓòÉΓòÉ
-
- #include <sys/ead.h> [emx]
-
- int _ead_write (_ead ead, const char *path, int handle, int flags);
-
- Write all the extended attributes of the extended attributes descriptor
- EAD to the file or directory PATH or HANDLE. The extended attributes
- previously attached to that file or directory are discarded and replaced
- by the extended attributes of EAD if FLAGS is 0. This is done by deleting
- the extended attributes of the file or directory which are not in EAD. If
- FLAGS is _EAD_MERGE, the extended attributes of the file or directory
- which are also present in EAD are replaced by those of EAD. Extended
- attributes of EAD which are not attached to the file or directory are
- added to the extended attributes of the file or directory. If PATH is
- non-NULL, the extended attributes are written to the file or directory
- specified by the path name PATH. If PATH is NULL, the extended attributes
- are written to the file referred to by the file handle HANDLE. The
- extended attributes of EAD are not modified. If _ead_write() is
- successful, 0 is returned. Otherwise, errno is set and a negative value is
- returned. Under DOS, _ead_write() does nothing and always returns 0.
-
- Use _ea_put() to add or update extended attributes one by one.
-
- See also: _ea_put() , _ead_clear() , _ead_read() , _ead_use_fea2list()
-
-
- ΓòÉΓòÉΓòÉ 6.27. _emx_16to32() ΓòÉΓòÉΓòÉ
-
- #include <os2.h> [emx]
-
- void *_emx_16to32 (_far16ptr ptr);
- _far16ptr _emx_32to16 (void *ptr);
-
- _emx_16to32 converts a 16-bit far pointer (16:16 format) to a 32-bit flat
- pointer.
-
- _emx_32to16 converts a 32-bit flat pointer to a 16-bit far pointer (16:16
- format).
-
- The type _far16ptr is used for 16-bit far pointers.
-
-
- ΓòÉΓòÉΓòÉ 6.28. _emx_32to16() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 6.29. _endthread() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- void _endthread (void);
-
- A thread that has been created by _beginthread() can call _endthread() to
- end its execution. A thread also ends when the function started with
- _beginthread() returns. Terminating the main thread (thread 1) of a
- process terminates the process (return value will be 0). Do not use
- DosExit to end a thread started by _beginthread().
-
- _endthread() is available only when using emxlibc.dll (-Zmt).
-
- See also: _beginthread ()
-
-
- ΓòÉΓòÉΓòÉ 6.30. eof() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
-
- int eof (int handle);
-
- Return 1 if the current position of HANDLE is at the end of the file,
- return 0 otherwise. On failure, -1 is returned.
-
-
- ΓòÉΓòÉΓòÉ 6.31. exec () ΓòÉΓòÉΓòÉ
-
- #include <process.h> [UNIX]
-
- /* exec () */
-
- int execl (const char *name, const char *arg0, ...);
- int execle (const char *name, const char *arg0, ...);
- int execlp (const char *name, const char *arg0, ...);
- int execlpe (const char *name, const char *arg0, ...);
- int execv (const char *name, const char * const *argv);
- int execve (const char *name, const char * const *argv,
- const char * const *envp);
- int execvp (const char *name, const char * const *argv);
- int execvpe(const char *name, const char * const *argv,
- const char * const *envp);
-
- Replace calling process with a new process. The calling process
- terminates after starting the new process. NAME is the name of the
- executable file to run. Use execl(), execle(), execlp() or execlpe() for
- passing a fixed number of arguments. ARG0 is the 0th argument which is
- the program name, by convention. Following ARG0, the arguments are given.
- After the last argument, a NULL pointer must be following. At least ARG0
- must be specified. Use execv(), execve(), execvp() or execvpe() for
- passing a variable number of arguments. ARGV points to an array of
- strings. The first entry is the program name, by convention. The last
- argument must be followed by a NULL pointer.
-
- execl(), execlp(), execv() and execvp() pass the environment of the
- current process to the child process. To pass a different environment to
- the child process pass a pointer to an array of strings after the NULL
- argument pointer of execle() and execlpe() or pass the pointer in the ENVP
- argument of execve() and execvpe(). The last environment string in the
- array must be followed by a NULL pointer.
-
- When the new process ends, the parent process is notified by SIGCLD and
- wait() will return the original process ID.
-
- Return value: the return value is -1 if an error occurs. On success,
- these functions do not return.
-
- Restrictions: Native DOS programs cannot be run. The new process gets a
- new process ID. All signals are reset to SIG_DFL in the new process.
-
- See also: spawn()
-
-
- ΓòÉΓòÉΓòÉ 6.32. exit() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void volatile exit (int ret);
-
- Flush streams, remove temporary files, call functions set by atexit() and
- terminate the current process. The return code RET is passed to the
- parent process. If RET is negative or greater than 255, 255 will be used
- instead to avoid returning 0 (success) for non-zero RET due to truncation
- to 8 bits.
-
- See also: abort() , atexit() , _exit()
-
-
- ΓòÉΓòÉΓòÉ 6.33. _exit() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- void volatile _exit (int ret);
-
- Exit without flushing streams, removing temporary files or calling
- functions set by atexit(). The return code RET is passed to the parent
- process. If RET is negative or greater than 255, 255 will be used instead
- to avoid returning 0 (success) for non-zero RET due to truncation to 8
- bits.
-
- See also: abort() , atexit() , exit()
-
-
- ΓòÉΓòÉΓòÉ 6.34. exp() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double exp (double x);
-
- exp() computes the exponential function of X, e^X is returned.
-
- On overflow, +#INF is returned and errno set to ERANGE.
-
- See also: log() , pow()
-
-
- ΓòÉΓòÉΓòÉ 6.35. _expand() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- void *_expand (void *mem, size_t new_size);
-
- Try to expand the memory block pointed to by MEM to the new size NEW_SIZE.
- If the block cannot be expanded, NULL is returned. Otherwise, MEM is
- returned. Please do not use this function -- use realloc() instead.
-
- See also: realloc()
-
-
- ΓòÉΓòÉΓòÉ 7. function f ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter f
-
-
- ΓòÉΓòÉΓòÉ 7.1. fabs() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double fabs (double x);
-
- Return the absolute value of X: If X is negative, -X is returned.
- Otherwise, X is returned.
-
- See also: abs() , labs()
-
-
- ΓòÉΓòÉΓòÉ 7.2. fclose() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fclose (FILE *stream);
-
- Close the open stream STREAM. Return 0 if successful, EOF otherwise.
-
- See also: fcloseall() , fflush() , fopen()
-
-
- ΓòÉΓòÉΓòÉ 7.3. fcloseall() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [PC]
-
- int fcloseall (void);
-
- Close all open streams. Return the number streams closed or EOF if an
- error occurs.
-
- See also: fclose() , flushall() , fopen()
-
-
- ΓòÉΓòÉΓòÉ 7.4. fcntl() ΓòÉΓòÉΓòÉ
-
- #include <fcntl.h> [*] [BSD]
-
- int fcntl (int handle, int request, int arg);
-
- File control. The following two REQUEST codes are implemented
- (partially):
-
- F_GETFL Return the file flags of the file specified by HANDLE.
- Currently, only two file flags are supported by fcntl:
- O_APPEND and O_NDELAY.
-
- F_SETFL Set the file flags of the file specified by HANDLE.
- Currently, only two file flags are supported by fcntl:
- O_APPEND and O_NDELAY. O_NDELAY has an effect only if
- HANDLE is 0 and HANDLE refers to the keyboard and the
- IDEFAULT and ICANON bits are not set. O_NDELAY also works
- for pipes created by emx programs and for named pipes. See
- `termio' and read().
-
- F_GETFD Return close-on-exec flag in bit 0 of return value. If the
- bit is set, HANDLE will not be inherited by child
- processes.
-
- F_SETFD Set close-on-exec flag from bit 0 of ARG. If the bit is
- set, HANDLE will not be inherited by child processes.
-
- Restrictions: F_GETFD and F_SETFD are not implemented under DOS. When
- using the system call library libsys.lib (-Zsys), O_NDELAY is not
- supported.
-
- See also: dup() , ioctl() , open()
-
-
- ΓòÉΓòÉΓòÉ 7.5. fdopen() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- FILE *fdopen (int handle, const char *mode);
-
- Create a stream for the low-level file handle HANDLE. The MODE flags
- should match the mode used for opening the file handle HANDLE. If `b' or
- `t' is used in MODE, the handle will be changed using setmode() to
- O_BINARY or O_TEXT mode, respectively. If neither `b' nor `t' is used,
- the translation mode is not changed. You should not rely on this
- behaviour: always specify the desired translation mode. A future release
- of the C library will have independent modes for low-level files and
- streams. If fdopen() fails, NULL is returned.
-
- See also: fopen() , open()
-
-
- ΓòÉΓòÉΓòÉ 7.6. feof() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 7.7. ferror() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int ferror (FILE *stream);
- int feof (FILE *stream);
-
- ferror() returns a non-zero value if the error indicator of STREAM is set.
- feof() returns a non-zero value if the end-of-file indicator of STREAM is
- set.
-
- See also: clearerr()
-
-
- ΓòÉΓòÉΓòÉ 7.8. fflush() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fflush (FILE *stream);
-
- Write the buffer of STREAM to its file if STREAM is open for writing.
- Clear the buffer of STREAM if STREAM is open for reading. The effect of
- ungetc() is undone.
-
- Return value:
-
- 0 success
-
- EOF failure
-
- See also: fclose()
-
-
- ΓòÉΓòÉΓòÉ 7.9. ffs() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- int ffs (int i);
-
- Find the first bit set in I and return the index of that bit. The least
- significant bit is numbered 1, the most significant bit is numbered 32.
- The smallest number n is returned for which bit n is set in I. If there
- are no bits set in I (that is, I is zero), zero is returned.
-
-
- ΓòÉΓòÉΓòÉ 7.10. fgetc() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fgetc (FILE *stream);
-
- Read a character from STREAM. The character is returned. If an error
- occurs or if the end of the file is reached, EOF is returned. fgetc() is
- a function.
-
- See also: fgetchar() , getc() , getchar()
-
-
- ΓòÉΓòÉΓòÉ 7.11. fgetchar() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [PC]
-
- int fgetchar (void);
-
- Read a character from stdin, respectively. The character is returned. If
- an error occurs or if the end of the file is reached, EOF is returned.
-
- fgetchar ()
-
- is equivalent to
-
- fgetc (stdin).
-
- fgetchar() is a function.
-
- See also: fgetc() , getchar()
-
-
- ΓòÉΓòÉΓòÉ 7.12. fgetpos() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fgetpos (FILE *stream, fpos_t *pos);
-
- Store the current position of the file pointer of the file STREAM in the
- variable pointed to by POS. fgetpos() currently does not work with
- text-mode files.
-
- See also: fsetpos() , ftell()
-
-
- ΓòÉΓòÉΓòÉ 7.13. fgets() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- char *fgets (char *buffer, int n, FILE *stream);
-
- Read a string from STREAM to BUFFER. Stop after reading N-1 characters or
- after a newline (LF) character has been read. A null character is
- appended. fgets() returns BUFFER. If an error occurs or the end of the
- file is reached, fgets() returns NULL.
-
- See also: gets() , scanf()
-
-
- ΓòÉΓòÉΓòÉ 7.14. filelength() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
-
- long filelength (int handle);
-
- Return the length in bytes of the file HANDLE. If there is an error, -1
- is returned.
-
- See also: chsize() , ftruncate() , lseek()
-
-
- ΓòÉΓòÉΓòÉ 7.15. fileno() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int fileno (FILE *stream);
-
- fileno() returns the file handle associated with STREAM.
-
- See also: fdopen()
-
-
- ΓòÉΓòÉΓòÉ 7.16. _filesys() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _filesys (const char *drive, char *name, size_t size);
-
- Copy the file system type of DRIVE to the buffer NAME. The size of the
- buffer is SIZE bytes. DRIVE must point to a drive letter followed by a
- colon. Examples for file system types are: FAT, LAN, HPFS, CDFS, NFS.
-
- Return value:
-
- 0 success. The file system type has been copied to NAME.
-
- -1 failure. errno contains the error number.
-
- Example:
-
- char drive[3] = "C:";
- char fsys[16];
-
- if (_filesys (drive, fsys, sizeof (fsys)) != 0)
- perror ("_filesys");
- else
- printf ("File system: %s\n", fsys);
-
- Typical output of the example:
-
- File system: FAT
-
- See also: _fnlwr()
-
-
- ΓòÉΓòÉΓòÉ 7.17. floor() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double floor (double x);
-
- Return as floating-point number the largest integer that is less than or
- equal to X (round down).
-
- See also: ceil() , rint() , trunc()
-
-
- ΓòÉΓòÉΓòÉ 7.18. flushall() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [PC]
-
- int flushall (void);
-
- Flush the buffers of all open streams. Write the buffers of streams open
- for writing to their files, clear the buffers of streams open for reading.
- The number of open streams is returned.
-
- See also: fflush()
-
-
- ΓòÉΓòÉΓòÉ 7.19. fmod() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double fmod (double x, double y);
-
- Compute remainder of X/Y. The return value z is calculated such that X =
- i * Y + z, where i is an integer, z has the same sign as X and |z| < |Y|.
- fmod (x, 0.0) returns 0.0.
-
-
- ΓòÉΓòÉΓòÉ 7.20. _fncmp() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _fncmp (const unsigned char *string1, const unsigned char *string2);
-
- _fncmp() compares the two file name strings STRING1 and STRING2 and
- returns zero if the two strings are identical after conversion to upper
- case. Otherwise, a non-zero value is returned which is negative if
- STRING1 is less than STRING2 and positive if STRING1 is greater than
- STRING2 after conversion to upper case. Conversion to upper case includes
- accented characters etc., depending on the current country code and code
- page. If _nls_init() has not yet been called, it is called by _fncmp().
-
- See also: _nls_init() , _nls_strupr() , strcmp()
-
-
- ΓòÉΓòÉΓòÉ 7.21. _fnexplode() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char **_fnexplode (const char *mask);
- void _fnexplodefree (char **list);
-
- Wildcard expansion of MASK. _fnexplode() returns a vector containing
- pointers to the file names. The list includes directories. Hidden and
- system files are omitted. The end of the list is marked by a NULL
- pointer. On error, NULL is returned. Memory is allocated with malloc().
-
- _fnlwr() is used to convert file names to lower case on upper-case-only
- file systems.
-
- Use _fnexplodefree() to free the memory allocated for a file name list.
-
- Example: /emx/test/eatool.c
-
- See also: _dt_read() , _fnlwr() , opendir() , _wildcard()
-
-
- ΓòÉΓòÉΓòÉ 7.22. _fnexplodefree() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 7.23. _fngetdrive() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char _fngetdrive (const char *src);
-
- Return as upper-case letter the drive name given in the path name SRC. If
- SRC does not contain a drive name, _fngetdrive() returns 0.
-
- Example:
-
- char *fname, drive;
-
- drive = _fngetdrive (fname);
- if (drive == 0)
- drive = _getdrive ();
-
-
- ΓòÉΓòÉΓòÉ 7.24. _fnisabs() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _fnisabs (const char *name);
-
- Return a non-zero value if NAME is an absolute file name. Otherwise,
- return 0. Absolute file names start with \ or /, optionally preceded by a
- drive name.
-
- See also: _abspath()
-
-
- ΓòÉΓòÉΓòÉ 7.25. _fnlwr() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- void _fnlwr (char *name);
- void _rfnlwr (void);
- void _sfnlwr (const char *name);
-
- _fnlwr() converts the file name NAME to lower case unless the file system
- is case preserving. Accented characters etc. are converted as well. If
- NAME does not contain a drive letter, it is assumed to refer to the drive
- set by _sfnlwr(). To save time, _fnlwr() caches information about file
- systems. If the file system of a drive changes or if the current drive
- changes, you should call _rfnlwr() to reset the cache. _sfnlwr() takes
- the drive name from NAME for future _fnlwr() calls. If _sfnlwr() hasn't
- been called since the last call to _rfnlwr() or if NAME does not contain a
- drive letter, _fnlwr() uses the current drive. If _nls_init() has not yet
- been called, it is called by _fnlwr().
-
- See also: _filesys() , _nls_init() , _nls_strlwr()
-
-
- ΓòÉΓòÉΓòÉ 7.26. fopen() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- FILE *fopen (const char *fname, const char *mode);
-
- Open a stream. FNAME is the name of the file, MODE is a string which
- specifies the file mode. The first character of MODE is `r' for reading,
- `w' for writing or `a' for appending. If a `+' character follows `a' or
- `w', the file will be also opened for reading. There are two additional
- MODE flags: `t' for text mode, `b' for binary mode. Text mode, which is
- the default, skips CR characters on input and converts LF characters to
- CR/LF pairs on output. Ctrl-Z on input indicates EOF. Binary mode
- disables these transformations.
-
- The file is opened in the sharing mode SH_DENYNO, see sopen(). If you
- want to use a different sharing mode, use _fsopen().
-
- See also: fclose() , fdopen() , freopen() , _fsopen() , sopen()
-
-
- ΓòÉΓòÉΓòÉ 7.27. fork() ΓòÉΓòÉΓòÉ
-
- #include <process.h> [*] [UNIX]
-
- int fork (void);
-
- Duplicate current process. A child process is created which is a copy of
- the calling process. Both the parent process and the child process resume
- at the point where fork() was called. The child process inherits the
- following attributes of the parent process:
-
- - environment
-
- - memory
-
- - signal settings (function address or SIG_DFL or SIG_IGN)
-
- - file handles (unless private, see fcntl())
-
- - current working directories
-
- - umask
-
- - break points. This is an OS/2 bug. When debugging a program
- containing fork(), set a breakpoint in the branch of execution that's
- executed only in the parent process
-
-
- The new process differs from the parent process in the following ways:
- ;li.the child process has a unique process ID
-
- - the child process has a different parent process ID (the process ID
- of the parent process)
-
- - the child process has copies of the file descriptors of the parent
- process. The file pointers are shared
-
- - termio is turned off in child process
-
- - all resources allocated using OS/2 calls are not inherited by the
- child process: semaphores, queues, threads, memory, file handles,
- etc.
-
- - the alarm clock is turned off
-
- - the CPU time (returned by clock()) is set to 0
-
-
- When the new process terminates, SIGCLD is raised in the process which
- forked that process.
-
- On error, -1 is returned. On success, the process ID of the new process
- is returned to the calling process, 0 to the new process.
-
- Restrictions: fork() is not implemented for DOS. fork() works only in
- programs linked by ld. It does not work in programs linked by LINK386.
- When using the system call library libsys.lib (-Zsys), fork() is not
- available. fork() is very inefficient for OS/2. To start a child
- process, use spawn() instead of fork() and exec(). Private file handles
- (see fcntl()) are not inherited by the child process. If the parent
- process uses termio for the keyboard, the child process cannot read from
- the keyboard using _read_kbd(), termio or the Kbd OS/2 API functions.
-
- See also: alarm() , fcntl() , spawn()
-
-
- ΓòÉΓòÉΓòÉ 7.28. fprintf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fprintf (FILE *stream, const char *format, ...);
-
- Formatted output to the stream STREAM. On success, the number of
- characters written to STREAM is returned. Otherwise, EOF is returned.
-
- See also: fscanf() , printf()
-
-
- ΓòÉΓòÉΓòÉ 7.29. fputc() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fputc (int c, FILE *stream);
-
- Write the character C to STREAM.
-
- The character written is returned. On failure, EOF is returned. fputc()
- is a functions.
-
- See also: fprintf() , fputchar() , fputs() , putc() , putchar()
-
-
- ΓòÉΓòÉΓòÉ 7.30. fputchar() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [PC]
-
- int fputchar (int c);
-
- Write the character C to stdout.
-
- fputchar (c)
-
- is equivalent to
-
- fputc (c, stdout).
-
- The character written is returned. On failure, EOF is returned.
- fputchar() is a function.
-
- See also: fputc() , putchar()
-
-
- ΓòÉΓòÉΓòÉ 7.31. fputs() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fputs (const char *string, FILE *stream);
-
- Write the string STRING to STREAM. On failure, EOF is returned.
- Otherwise, a non-negative value is returned. In contrast to puts(), a LF
- character is not appended automatically.
-
- See also: fgets() , fputc() , printf() , puts()
-
-
- ΓòÉΓòÉΓòÉ 7.32. fread() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- size_t fread (void *buffer, size_t size, size_t count, FILE *stream);
-
- Read COUNT objects of SIZE bytes each from STREAM to BUFFER. The file
- pointer is incremented by the number of bytes read. The number of
- complete objects read is returned which may be less than COUNT, for
- instance 0, if an error occurs or if the end of the file is reached. Use
- ferror() and feof() to distinguish between these two conditions. On
- failure, the position of the file pointer is undefined.
-
- If STREAM has been opened in text mode, CR/LF pairs are translated to LF
- characters. This translation does not affect the return value -- SIZE and
- COUNT are applied after translation.
-
- See also: fgetc() , fgets() , fwrite()
-
-
- ΓòÉΓòÉΓòÉ 7.33. free() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void free (void *mem);
-
- Deallocate a block of memory allocated by malloc(), calloc() or realloc().
- MEM points to the block of memory. MEM must have been returned by
- malloc(), calloc() or realloc(). Do not use MEM after calling free().
-
- See also: calloc() , malloc() , realloc()
-
-
- ΓòÉΓòÉΓòÉ 7.34. freopen() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- FILE *freopen (const char *fname, const char *mode, FILE *stream);
-
- Close and reopen STREAM. The file FNAME will be opened in mode MODE. See
- fopen() for details. If successful, a pointer to the new stream is
- returned. Otherwise, NULL is returned.
-
- See also: fclose() , fopen()
-
-
- ΓòÉΓòÉΓòÉ 7.35. frexp() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double frexp (double x, int *exp_ptr);
-
- Extract mantissa and exponent of X. The mantissa is returned, the
- exponent, an integer, is stored to *EXP_PTR. The following holds for the
- mantissa m: 0.5 <= |m| < 1.0. If X is zero, both the mantissa and the
- exponent are 0.
-
-
- ΓòÉΓòÉΓòÉ 7.36. fscanf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fscanf (FILE *stream, const char *format, ...);
-
- The stream STREAM is read and input is parsed according to the format
- string FORMAT. For each field in FORMAT there must be a pointer to the
- location receiving the value. The pointers are passed after the FORMAT
- argument. On success, the number of fields converted is returned.
- Otherwise, EOF is returned.
-
- See also: fprintf() , scanf()
-
-
- ΓòÉΓòÉΓòÉ 7.37. fseek() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fseek (FILE *stream, long offset, int origin);
-
- fseek() moves the file pointer of STREAM. The new position OFFSET is
- relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative to the
- beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is relative to the
- current position, if ORIGIN is SEEK_END, OFFSET is relative to the end of
- the file. The file pointer cannot be moved before the beginning of the
- file. fseek() does not work with text-mode files. On success, 0 is
- returned. On error, a non-zero value is returned.
-
- See also: fgetpos() , fsetpos() , ftell() , rewind()
-
-
- ΓòÉΓòÉΓòÉ 7.38. _fseek_hdr() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [emx]
-
- int _fseek_hdr (FILE *stream);
-
- Move the file pointer of STREAM to the a.out header of an executable file
- (a.out or bound .exe). _fseek_hdr() assumes that the file pointer points
- to the beginning of the header (ie, the beginning of the file). If there
- is an error, _fseek_hdr() sets errno and returns -1. If no header is
- found, the file pointer will be repositioned to the original position.
-
- See also: _seek_hdr()
-
-
- ΓòÉΓòÉΓòÉ 7.39. _fsetmode() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [emx]
-
- int _fsetmode (FILE *stream, const char *mode);
-
- Change the text/binary mode of a stream. MODE must be either "b" or "t".
- _fsetmode() returns 0 if successful. Otherwise, -1 is returned.
- _fsetmode() is usually used to put stdin or stdout to binary mode.
-
- See also: fopen()
-
-
- ΓòÉΓòÉΓòÉ 7.40. fsetpos() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int fsetpos (FILE *stream, const fpos_t *pos);
-
- Restore the position of the file pointer of the file STREAM to the
- position saved by fgetpos() in the variable pointed to by POS. fsetpos()
- currently does not work with text-mode files.
-
- See also: fgetpos() , fseek()
-
-
- ΓòÉΓòÉΓòÉ 7.41. _fsopen() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [PC]
- #include <share.h>
-
- FILE *_fsopen (const char *fname, const char *mode, int shflag);
-
- Open a stream. FNAME is the name of the file, MODE is a string which
- specifies the file mode. The first character of MODE is `r' for reading,
- `w' for writing or `a' for appending. If a `+' character follows `a' or
- `w', the file will be also opened for reading. There are two additional
- MODE flags: `t' for text mode, `b' for binary mode. Text mode, which is
- the default, skips CR characters on input and converts LF characters to
- CR/LF pairs on output. Ctrl-Z on input indicates EOF. Binary mode
- disables these transformations.
-
- The sharing mode of the file is given by SHFLAG. The following sharing
- modes are available:
-
- SH_DENYRW Deny read and write access
-
- SH_DENYRD Deny read access (permit write access)
-
- SH_DENYWR Deny write access (permit read access)
-
- SH_DENYNO Deny nothing (permit read and write access)
-
- See also: fopen() , sopen()
-
-
- ΓòÉΓòÉΓòÉ 7.42. fstat() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
- #include <sys/types.h>
- #include <sys/stat.h>
-
- int fstat (int handle, struct stat *buffer);
-
- Retrieve information about the open file HANDLE. fstat() will put the
- data into the structure pointed to by BUFFER.
-
- Restrictions: st_dev and st_rdev are set to zero. Each call to fstat()
- returns a different value for st_ino.
-
- See also: ioctl() , stat()
-
-
- ΓòÉΓòÉΓòÉ 7.43. fsync() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [BSD]
-
- int fsync (int handle);
-
- Flush the buffers associated with HANDLE and update the directory. fsync()
- returns 0 if successful, -1 otherwise.
-
- Restriction: fsync() is currently not implemented for DOS: errno is set to
- EMSDOS.
-
-
- ΓòÉΓòÉΓòÉ 7.44. ftell() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- long ftell (FILE *stream);
-
- ftell() returns the current position of the file pointer of STREAM. If
- there is an error, ftell() returns -1. ftell() currently does not work
- with text-mode files.
-
- See also: fgetpos() , fseek()
-
-
- ΓòÉΓòÉΓòÉ 7.45. ftime() ΓòÉΓòÉΓòÉ
-
- #include <sys/timeb.h> [SysV]
-
- void ftime (struct timeb *ptr);
-
- Get current time and store it to the structure pointed to by PTR. That
- structure has the following fields:
-
- dstflag Non-zero if daylight saving time is active for the local
- timezone. Currently, this field is always 0.
-
- millitm Milliseconds of current time.
-
- time Current time in seconds since 00:00 GMT 1-Jan-1970.
-
- timezone Difference between GMT and local time in minutes. Positive
- values are to the west of GMT.
-
- See also: gettimeofday() , time()
-
-
- ΓòÉΓòÉΓòÉ 7.46. ftruncate() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [BSD]
-
- int ftruncate (int handle, long length);
-
- Truncate the file associated with HANDLE to at most LENGTH bytes. The
- position of the file pointer is undefined after calling this function. If
- LENGTH is greater than the current length of the file, the length is not
- changed. HANDLE must be open for writing. If successful, 0 is returned.
- Otherwise, -1 is returned.
-
- See also: chsize() , truncate()
-
-
- ΓòÉΓòÉΓòÉ 7.47. ftw() ΓòÉΓòÉΓòÉ
-
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <ftw.h>
-
- int ftw (const char *path,
- int (*fn)(const char *name, const struct stat *stat_ptr, int flag),
- int depth);
-
- Call FN for all entries of the directory tree whose root is PATH.
- Directories are visited before the entries they contain. FN is not called
- for the directories `.' and `..'. The name of the entry is passed in
- NAME. Forward slashes are used to separate directories (backslashes in
- PATH are not converted to forward slashes). _fnlwr() is called to convert
- the file names to lower case on upper-case-only file systems. A structure
- filled in by stat() is pointed to by STAT_PTR. FLAG is one of the
- following:
-
- FTW_D NAME is a directory
-
- FTW_F NAME is a file
-
- FTW_NS stat() failed, the contents of structure pointed to by
- STAT_PTR are undefined
-
- FTW_DNR NAME is an unreadable directory (does not happen under DOS
- and OS/2)
-
- If FN returns 0, ftw() continues. Otherwise, ftw() terminates and returns
- the value returned by FN. On error, ftw() returns -1.
-
- The DEPTH argument is ignored by this implementation of ftw(). In other
- implementations, DEPTH is used to restrict the number of file handles used
- by ftw(): one file handle is required for each level. If DEPTH is less
- than the number of levels, ftw() will be slow.
-
- Example: /emx/test/ftwtest.c
-
- See also: _fnlwr() , opendir()
-
-
- ΓòÉΓòÉΓòÉ 7.48. _fullpath() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- int _fullpath (char *dst, const char *src, int size);
-
- Construct an absolute path name for the file name or directory name SRC.
- The absolute path name is put to DST. It is assumed that there are SIZE
- bytes available at DST, this includes the terminating 0 byte. If there is
- an error, -1 is returned. If _fullpath() succeeds, 0 is returned. If
- SIZE is too small, errno is set to ERANGE and -1 is returned. DST can be
- identical to SRC. Backslashes are translated into forward slashes. The
- absolute path name is not translated to lower case.
-
- _fullpath() accesses the appropriate drive. It fails if a directory does
- not exist unless the non-existing directory is the last member of the
- resulting path name.
-
- See also: _abspath()
-
-
- ΓòÉΓòÉΓòÉ 7.49. fwrite() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream);
-
- Write COUNT objects of SIZE bytes each from BUFFER to STREAM. The file
- pointer is incremented by the number of bytes written. The number of
- complete objects written is returned which may be less than COUNT, for
- instance 0, if an error occurs. On failure, the value of the file pointer
- is undefined. If STREAM has been opened in text mode, LF characters are
- translated to CR/LF pairs. This translation does not affect the return
- value -- SIZE and COUNT are applied before the translation.
-
- See also: fputc() , fputs() , fread() , printf()
-
-
- ΓòÉΓòÉΓòÉ 8. function g ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter g
-
-
- ΓòÉΓòÉΓòÉ 8.1. g_box() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_box (int x0, int y0, int x1, int y1, int color, int fill_flag);
-
- Draw a box which has the four vertices (X0,Y0), (X0,Y1), (X1, Y0) AND (X1,
- Y1). If FILL_FLAG is G_OUTLINE, the outline is drawn, that is, four lines
- between the vertices. If FILL_FLAG is G_FILL, the interior of the box is
- filled. The color COLOR is used for drawing.
-
- See also: g_clip()
-
-
- ΓòÉΓòÉΓòÉ 8.2. g_clear() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_clear (int color);
-
- Clear the screen (graphics mode, only). All pixels are set to the color
- COLOR. The clipping rectangle is ignored.
-
-
- ΓòÉΓòÉΓòÉ 8.3. g_clip() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_clip (int x0, int y0, int x1, int y1);
-
- Define the clipping rectangle. Only pixels with X coordinate between X0
- and X1 (inclusive) and Y0 and with Y coordinate between X1 and Y1
- (inclusive) are drawn. No drawing is performed outside that clipping
- rectangle. After switching to graphics mode with g_mode(), the clipping
- rectangle is set to the entire screen. This is equivalent to calling
-
- g_clip (0, 0, g_xsize-1, g_ysize-1)
-
- See also: g_mode() , g_xsize , g_ysize
-
-
- ΓòÉΓòÉΓòÉ 8.4. g_ellipse() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_ellipse (int cx, int cy, int rx, int ry, int color, int fill_flag);
-
- Draw an ellipse or a circle. One axis is horizontal, the other one
- vertical. The center of the ellipse is at (CX,CY). The horizontal radius
- is RX, the vertical radius is RY. It's impossible to draw an ellipse with
- even length of an axis. If FILL_FLAG is G_OUTLINE, the outline of the
- ellipse is drawn. If FILL_FLAG is G_FILL, the interior of the ellipse is
- filled. The color COLOR is used for drawing.
-
- See also: g_clip()
-
-
- ΓòÉΓòÉΓòÉ 8.5. g_get() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- int g_get (int x, int y);
-
- Return the color of the pixel at (X,Y). If (X,Y) is outside the clipping
- rectangle, -1 is returned.
-
- See also: g_clip() , g_set()
-
-
- ΓòÉΓòÉΓòÉ 8.6. g_hline() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_hline (int y, int x0, int x1, int color);
-
- Draw a horizontal line between (X0,Y) and (X1,Y). The color COLOR is used
- for drawing.
-
- See also: g_box() , g_clip() , g_line() , g_vline()
-
-
- ΓòÉΓòÉΓòÉ 8.7. g_line() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_line (int x0, int y0, int x1,int y1, int color);
-
- Draw a line of arbitrary slope between (X0,Y0) and (X1,Y1). The color
- COLOR is used for drawing. To draw horizontal or vertical lines, you
- should use g_hline() and g_vline(), respectively, which are specialized
- functions optimized for speed.
-
- See also: g_clip() , g_hline() , g_polygon() , g_triangle() , g_vline()
-
-
- ΓòÉΓòÉΓòÉ 8.8. g_lock() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_lock (void);
-
- Lock the screen. Under OS/2, the screen must be locked while access
- graphics memory. All the graphics drawing functions lock the screen,
- draw, and unlock the screen unless it's already locked. To avoid the
- overhead of locking and unlocking for each function call, you can lock and
- unlock the screen yourself when performing many successive drawing
- operations. Note that you should not lock the screen for more than a few
- seconds. g_lock() increments a counter, which is initialized to zero by
- g_mode(). The screen is locked while the counter is non-zero. g_unlock()
- decrements the counter and unlocks the screen if the counter reaches zero.
-
- See also: g_unlock()
-
-
- ΓòÉΓòÉΓòÉ 8.9. g_mode() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- int g_mode (int mode);
-
- Select graphics mode. If MODE is G_MODE_OFF, graphics mode is turned off
- and 0 is returned. If MODE is G_MODE_VGA_L, the 320x200 VGA mode with 256
- colors is chosen. If switching to graphics mode succeeds, 1 is returned.
- Otherwise, 0 is returned.
-
- The global variables g_xsize, g_ysize and g_colors are set. The clipping
- rectangle is set to the entire screen.
-
- General information about the graphics library: Programs using the
- graphics library work both under DOS and in OS/2 full-screen sessions.
- The coordinates of the screen are (0,0) (upper left) through
- (g_xsize-1,g_ysize-1) (lower right). You have to link with libgraph (use
- the -lgraph option). Under DOS, emx option -acm is required, see `Using
- emx options'.
-
- Restriction: Only G_MODE_VGA_L mode is currently implemented.
-
- Example: /emx/test/graph.c
-
- See also: g_clip() , g_modeset() , g_colors , g_xsize , g_ysize
-
-
- ΓòÉΓòÉΓòÉ 8.10. g_modeset() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- int g_modeset (int mode, int flag);
-
- Modify a graphics mode number. The mode number to be modified is passed
- in MODE, the value passed in FLAG specifies how to modify the mode number:
- G_SET_KEEP causes the mode number to be not modified. The new mode number
- is returned. On failure, G_MODE_OFF is returned.
-
- The global variables g_xsize, g_ysize and g_colors are set.
-
- Restriction: As only G_SET_KEEP is implemented, g_modeset() is useless.
- It's included for compatibility with existing programs.
-
- See also: g_mode() , g_colors , g_xsize , g_ysize
-
-
- ΓòÉΓòÉΓòÉ 8.11. g_polygon() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_polygon (const int *x, const int *y, int n, int color,
- int fill_flag);
-
- Draw a polygon. The N vertices are stored in the X and Y arrays:
- (X[i],Y[i]) for i = 0, ..., n-1. If FILL_FLAG is G_OUTLINE, the outline
- of the polygon is drawn, that is, a line from vertex 0 to vertex 1, from
- vertex 1 to vertex 2, ..., vertex n-2 to vertex n-1, vertex n-1 to vertex
- 0. If FILL_FLAG is G_FILL, the interior of the polygon is filled. A
- point is defined to be in the interior of the polygon, if an infinite line
- to any side of that pixel intersects the polygon an odd number of times.
- The color COLOR is used for drawing.
-
- See also: g_clip() , g_line() , g_triangle()
-
-
- ΓòÉΓòÉΓòÉ 8.12. g_set() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_set (int x, int y, int color);
-
- Set the pixel (X,Y) to the color COLOR.
-
- See also: g_clip() , g_get()
-
-
- ΓòÉΓòÉΓòÉ 8.13. g_triangle() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_triangle (int x0, int y0, int x1, int y1, int x2, int y2, int color,
- int fill_flag);
-
- Draw a triangle. The vertices are (X0,Y0), (X1,Y1) and (X2,Y2). If
- FILL_FLAG is G_OUTLINE, the outline of the triangle is drawn, that is, a
- line from (X0,Y0) to (X1,Y1), a line from (X1,Y1) to (X2,Y2) and a line
- from (X2,Y2) to (X0,Y0). If FILL_FLAG is G_FILL, the interior of the
- triangle is filled. The color COLOR is used for drawing.
-
- See also: g_clip() , g_line() , g_polygon()
-
-
- ΓòÉΓòÉΓòÉ 8.14. g_unlock() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_unlock (void);
- void g_unlockall (void);
-
- Unlock the screen. g_unlock() undoes one invocation of g_lock() by
- decrementing the counter incremented by g_lock(). If the counter reaches
- zero, the screen is unlocked. If the counter already was zero, the
- counter is not changed. g_unlockall() undoes all invocations of g_lock()
- by resetting the counter to zero and unlocking the screen if the counter
- was non-zero.
-
- See also: g_lock()
-
-
- ΓòÉΓòÉΓòÉ 8.15. g_unlockall() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 8.16. g_vgapal() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_vgapal (const char *pal, int first, int n, int wait_flag);
-
- Set the VGA palette. This function sets N (1 through 256) DAC registers
- starting with register FIRST (0 through 255). For each register, 3 bytes
- are taken from PAL: red, green, blue. Each byte should have a value
- between 0 and 63, inclusive. If WAIT_FLAG is non-zero, g_vgapal() waits
- for the vertical retrace to avoid snow on the screen, see g_waitv().
- Under DOS, emx option -ai is required, see `Using emx options'. Under
- OS/2, emxio.dll is required. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio) after
- libgraph (-lgraph). libemxio must not be used if the program should run
- under DOS.
-
- See also: g_waitv()
-
-
- ΓòÉΓòÉΓòÉ 8.17. g_vline() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_vline (int x, int y0, int y1, int color);
-
- Draw a vertical line between (X,Y0) and (X,Y1). The color COLOR is used
- for drawing.
-
- See also: g_box() , g_clip() , g_hline() , g_line()
-
-
- ΓòÉΓòÉΓòÉ 8.18. g_waitv() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_waitv (void);
-
- Wait for vertical retrace. Under DOS, emx option -ai is required, see
- `Using emx options'. Under OS/2, emxio.dll is required. When linking
- with LINK386 (-Zomf) or when using emxlibc.dll (-Zmt), you have to use
- libemxio (-lemxio) after libgraph (-lgraph). libemxio must not be used if
- the program should run under DOS. Note that this function eats lots of
- CPU time.
-
- See also: g_vgapal() , _wait01()
-
-
- ΓòÉΓòÉΓòÉ 8.19. g_wmode() ΓòÉΓòÉΓòÉ
-
- #include <graph.h> [emx]
-
- void g_wmode (int wmode);
-
- Select a `writing mode'. This is not yet implemented.
-
-
- ΓòÉΓòÉΓòÉ 8.20. getcwd() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- char *getcwd (char *buffer, int size);
-
- getcwd() retrieves the name of the current working directory (excluding
- the drive name) and stores it to BUFFER. It is assumed that there are
- SIZE bytes available at BUFFER. This includes the terminating 0. If SIZE
- is too small, getcwd() returns NULL and sets errno to ERANGE. If BUFFER
- is NULL, a buffer of suitable size, but at least SIZE bytes, is allocated
- with malloc(). If getcwd() succeeds, BUFFER is returned. getcwd()
- translates backslashes into forward slashes. It does not translate
- upper-case directory names to lower case.
-
- See also: chdir() , _getcwd1() , _getcwd2() , getwd()
-
-
- ΓòÉΓòÉΓòÉ 8.21. _getcwd1() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _getcwd1 (char *buffer, char drive);
-
- _getcwd1() retrieves the name of the current working directory (starting
- with a slash, excluding the drive name) of drive DRIVE and stores it to
- BUFFER. If DRIVE is 0, the currently selected drive is used. Otherwise,
- DRIVE must be in 'A' through 'Z'. It is assumed that there are enough
- bytes available at BUFFER. If _getcwd1() succeeds, 0 is returned.
- _getcwd1() translates backslashes into forward slashes. It does not
- translate upper-case directory names to lower case.
-
- See also: chdir() , getcwd() , _getcwd2()
-
-
- ΓòÉΓòÉΓòÉ 8.22. _getcwd2() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char *_getcwd2 (char *buffer, int size);
-
- _getcwd2() works like getcwd() but in addition it includes the drive name
- in BUFFER.
-
- See also: chdir() , getcwd() , _getcwd1()
-
-
- ΓòÉΓòÉΓòÉ 8.23. _getdrive() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- char _getdrive (void);
-
- Return as upper-case letter the currently selected drive.
-
- See also: _chdir2() , _chdrive() , _getcwd2()
-
-
- ΓòÉΓòÉΓòÉ 8.24. getenv() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- char *getenv (const char *name);
-
- Find NAME in the environment. If the variable is found, a pointer to the
- value is returned. Otherwise, NULL is returned.
-
- See also: environ , putenv()
-
-
- ΓòÉΓòÉΓòÉ 8.25. _getext() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char *_getext (const char *path);
-
- Return a pointer to the extension of the file name PATH. The pointer
- points to the dot character that starts the extension. If there is no
- extension, NULL is returned. If the last member of PATH starts with a dot
- ("/usr/mattes/.profile", for instance), NULL is returned.
-
- See also: _defext() , _getname() , _remext() , _splitpath()
-
-
- ΓòÉΓòÉΓòÉ 8.26. _getname() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char *_getname (const char *path);
-
- Return a pointer to the name part (last component, including the
- extension) of the file name PATH. The pointer points to the character
- after the last path separator (slash, backslash and colon). If there is
- no path separator, PATH is returned.
-
- See also: _getext() , _splitpath()
-
-
- ΓòÉΓòÉΓòÉ 8.27. getpagesize() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [BSD]
-
- int getpagesize (void);
-
- Return the page size, which is 4096 for the 386.
-
-
- ΓòÉΓòÉΓòÉ 8.28. getc() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int getc (FILE *stream);
- int getchar (void);
-
- Read a character from STREAM or stdin, respectively. The character is
- returned. If an error occurs or if the end of the file is reached, EOF is
- returned.
-
- getchar ()
-
- is equivalent to
-
- getc (stdin).
-
- getc() and getchar() are in-line functions or macros.
-
- See also: fgetc()
-
-
- ΓòÉΓòÉΓòÉ 8.29. getchar() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 8.30. getopt() ΓòÉΓòÉΓòÉ
-
- #include <getopt.h> [UNIX]
-
- int getopt (int argc, char **argv, const char *opt_str);
-
- Parse command line options. ARGC is the number of argument strings, ARGV
- is an array of argument strings, OPT_STR is a string describing the
- available options. Typically, the ARGC and ARGV arguments of main() are
- passed to getopt(). Each option is of one of the following types:
-
- - option without argument: the option letter is listed in OPT_STR;
-
- - option with mandatory argument: the option letter in OPT_STR is
- followed by a colon
-
- - option with optional argument: the option letter in OPT_STR is
- followed by two colons.
-
-
- For instance,
-
- c = getopt (argc, argv, "abc:d::v")
-
- defines five options: -a, -b, -c and -v don't take arguments, -c takes a
- mandatory argument, -d takes an optional argument.
-
- Before the first call to getopt(), the global variable optind must be set
- to 0 (that's the initial value, see also bugs below). Calling getopt()
- parses the next command line option. If there are no more command line
- options, getopt() returns EOF. After calling getopt(), optind is the
- index of the next command line argument. After calling getopt(), the
- global variable optarg points to the argument of the option. If there is
- no argument, optarg is NULL.
-
- There are three modes of operation, which are controlled by the global
- variable optmode:
-
- GETOPT_UNIX Options are at the start of the command line. When
- the first non-option is reached, parsing options stops
- and getopt() returns EOF. GETOPT_UNIX is the default.
-
- GETOPT_ANY Options may appear anywhere on the command line. ARGV
- is reordered to move the non-options to the end. When
- there are no more options, getopt() returns EOF. The
- remaining arguments are all the arguments of the
- command line which are not options.
-
- GETOPT_KEEP Options may appear anywhere on the command line. If
- the current argument is not an option, getopt()
- returns 0. optarg will point to the argument. The
- next call to getopt() examines the next command line
- argument.
-
- If the global variable opterr is non-zero (this is the default), getopt()
- writes an appropriate error message to stderr on failure and returns '?'.
- If opterr is zero, getopt() does not display an error message on failure
- and returns '?'.
-
- The global variable optswchar is a string of characters which start
- options. The default value is "-", that is, options are started by
- hyphens. You might want to assign "-/" or "/" to optswchar.
-
- If a command line argument consists of two equal switch characters (see
- optswchar), the remaining command line arguments are not treated as
- options.
-
- Options may be clustered, that is, if an option does not take an argument,
- getopt() treats the following character of the same command line argument
- as option. If an option takes a mandatory argument, the argument either
- follows immediately the option or is taken from the next command line
- argument. If an option takes an optional argument, the argument must
- immediately follow the option.
-
- getopt() returns the next option character. If there are no more command
- line options, EOF is returned. On failure, '?' is returned. If optmode
- is GETOPT_KEEP and the current command line argument is not an option, 0
- is returned.
-
- When writing portable programs, you should not use optmode, optswchar and
- options taking optional arguments. Only letters should be used as
- options.
-
- optmode must not be changed after the first call to getopt(). optswchar,
- however, may be changed at any time.
-
- Bugs: optind should be set to 1 (instead of 0) for parsing the first
- command line argument. As it is initialized to 0 by this implementation
- of getopt() and seems to be initialized to 1 by the BSD implementation,
- just do not initialize optind and everything will be OK.
-
- See also: main() , _swchar()
-
-
- ΓòÉΓòÉΓòÉ 8.31. getpid() ΓòÉΓòÉΓòÉ
-
- #include <process.h> [UNIX]
-
- int getpid (void);
-
- Return the process identification number of the calling process.
-
-
- ΓòÉΓòÉΓòÉ 8.32. getppid() ΓòÉΓòÉΓòÉ
-
- #include <process.h> [UNIX]
-
- int getppid (void);
-
- Return the process identification number of the parent process of the
- calling process.
-
-
- ΓòÉΓòÉΓòÉ 8.33. getpwent() ΓòÉΓòÉΓòÉ
-
- #include <pwd.h> [UNIX]
-
- struct passwd *getpwent (void);
- struct passwd *getpwuid (int uid);
- struct passwd *getpwnam (char *name);
- void setpwent (void);
- void endpwent (void);
-
- Dummy functions.
-
-
- ΓòÉΓòÉΓòÉ 8.34. gets() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- char *gets (char *buffer);
-
- Read a string from stdin to BUFFER. Stop after a newline (LF) character
- has been read. The newline character is replaced with a null character.
- gets() returns BUFFER. If an error occurs or the end of the file is
- reached, gets() returns NULL. Use fgets() instead as gets() doesn't know
- how big BUFFER is.
-
- See also: fgets() , scanf()
-
-
- ΓòÉΓòÉΓòÉ 8.35. getw() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int getw (FILE *stream);
-
- Read a word (int) from STREAM and return it. On failure, -1 is returned.
- As -1 is also a possible word value, you have to use ferror() to recognize
- an error condition.
-
- Avoid using this function.
-
- See also: putw() , fwrite()
-
-
- ΓòÉΓòÉΓòÉ 8.36. getwd() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h>
-
- char *getwd (char *buffer);
-
- getwd() retrieves the name of the current working directory (excluding the
- drive name) and stores it to BUFFER. It is assumed that there are
- MAXPATHLEN bytes available at BUFFER. This includes the terminating 0.
- MAXPATHLEN is defined in sys/param.h. If getwd() succeeds, BUFFER is
- returned. If getwd() fails, an error message is copied to BUFFER and NULL
- is returned. getwd() translates backslashes into forward slashes. It
- does not translate upper-case directory names to lower case.
-
- See also: getcwd()
-
-
- ΓòÉΓòÉΓòÉ 8.37. gettimeofday() ΓòÉΓòÉΓòÉ
-
- #include <sys/time.h> [BSD]
-
- int gettimeofday (struct timeval *tp, struct timezone *tzp);
-
- Obtain the current time and timezone. If TP is not NULL, the current
- Greenwich Mean Time, expressed in seconds and microseconds since 00:00
- 1-Jan-1970, is stored to *TP. If TZP is not NULL, information about the
- timezone is stored to *TZP.
-
- See also: ftime() , time()
-
-
- ΓòÉΓòÉΓòÉ 8.38. gmtime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- struct tm *gmtime (const time_t *t);
-
- Convert the number of seconds elapsed since 00:00 1-Jan-1970 (GMT) given
- by the variable pointed to by T to a time and date structure (GMT) and
- return a pointer to the structure. gmtime(), mktime() and localtime() use
- the same memory location, therefore the values are overwritten if one of
- these functions is called.
-
- See also: localtime()
-
-
- ΓòÉΓòÉΓòÉ 9. function h ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter h
-
-
- ΓòÉΓòÉΓòÉ 9.1. _heapchk() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- int _heapchk (void);
- int _heapset (unsigned fill);
-
- _heapchk() checks the heap and returns _HEAPBADBEGIN (if the pointers to
- the heap are corrupt), _HEAPBADNODE (if there is a corrupt entry in the
- heap), _HEAPEMPTY (if the heap is empty) or _HEAPOK (if the heap is ok).
-
- _heapset() fills unused areas of the heap with FILL. See _heapchk() for
- the return values. In fact, _heapchk() is a special variant of _heapset()
- which doesn't fill unused areas of the heap.
-
-
- ΓòÉΓòÉΓòÉ 9.2. _heapset() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 9.3. hypot() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [UNIX]
-
- double hypot (double x, double y);
-
- Compute and return sqrt (x*x + y*y). On overflow, #INF is returned and
- errno is set to ERANGE.
-
- See also: sqrt()
-
-
- ΓòÉΓòÉΓòÉ 10. function i ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter i
-
-
- ΓòÉΓòÉΓòÉ 10.1. index() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- char *index (const char *string, int c);
-
- Return a pointer to the first occurrence of the character C in the
- null-terminated string STRING. If there is no character C in STRING, NULL
- is returned. If C is 0, a pointer to the terminating zero of STRING is
- returned.
-
- See also: rindex() , strchr()
-
-
- ΓòÉΓòÉΓòÉ 10.2. _inp8() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [*] [emx]
-
- unsigned _inp8 (unsigned port);
- unsigned _inp16 (unsigned port);
- unsigned _inp32 (unsigned port);
-
- These functions read a single byte or word from a hardware port. _inp8()
- reads a byte from PORT, _inp16() reads a 16-bit word from PORT, _inp32()
- reads a 32-bit word from PORT.
-
- You have to call _portaccess() first to enable access to a range of ports.
- To make your program work under DOS, you have to use emx option -ai, see
- `Using emx options'. Under OS/2, your program requires emxio.dll in a
- directory listed in LIBPATH. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio). libemxio
- must not be used if the program should run under DOS.
-
- See also: _portaccess() , _inps8() , _outp8() , _wait0()
-
-
- ΓòÉΓòÉΓòÉ 10.3. _inp16() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.4. _inp32() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.5. _inps8() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [*] [emx]
-
- void _inps8 (unsigned port, unsigned char *dst, unsigned count);
- void _inps16 (unsigned port, unsigned short *dst, unsigned count);
- void _inps32 (unsigned port, unsigned long *dst, unsigned count);
-
- These functions read multiple bytes or words from a hardware port.
- _inps8() reads COUNT bytes from PORT to the buffer DST. _inps16() reads
- COUNT 16-bit words from PORT to the buffer DST.
-
- The COUNT argument of _inps8() must not exceed 65535.
-
- The DST pointer of _inps16() must be aligned on a 16-bit boundary, that
- is, the address must be even. COUNT must not exceed 32768.
-
- The DST pointer of _inps32() must be aligned on a 32-bit boundary, that
- is, the address must be a multiple of four. COUNT must not exceed 65536.
-
- You have to call _portaccess() first to enable access to a range of ports.
- To make your program work under DOS, you have to use emx option -ai, see
- `Using emx options'. Under OS/2, your program requires emxio.dll in a
- directory listed in LIBPATH. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio). libemxio
- must not be used if the program should run under DOS.
-
- See also: _portaccess() , _inp8() , _outps8()
-
-
- ΓòÉΓòÉΓòÉ 10.6. _inps16() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.7. _inps32() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.8. _int86() ΓòÉΓòÉΓòÉ
-
- #include <dos.h> [PC]
-
- int _int86 (int int_num, union REGS *inp_regs, union REGS *out_regs);
-
- Issue software interrupt under DOS. This function loads the processor
- registers EAX, EBX, ECX, EDX, ESI and EDI from INP_REGS, calls software
- interrupt INT_NUM and stores the processor registers EAX, EBX, ECX, EDX,
- ESI, EDI and the flags register to OUT_REGS. The value of EAX is
- returned.
-
- emx option -ac must be used to enable _int86(). If -ac is not used, a
- protection violation exception occurs when _int86() is called. See `Using
- emx options'.
-
- Restrictions: _int86() is not supported under OS/2 (there are no software
- interrupts under OS/2). The emx DOS extender currently supports only
- interrupts 0x10, 0x11, 0x14, 0x16, 0x17 and 0x21. Note that pointer
- conversion is done only for the subset of interrupt 0x21 services known by
- DOS 3.3. Pointer conversion is currently done for interrupt 0x21 only.
- Please note the following difference to DOS C compilers: the REGS union
- does not contain an X.CFLAG field. The complete flags register is stored
- to the E.EFLAGS field instead. The carry flag is available in bit 0 of
- the E.EFLAGS and X.FLAGS fields.
-
- Example: /emx/test/vmode.c
-
-
- ΓòÉΓòÉΓòÉ 10.9. ioctl() ΓòÉΓòÉΓòÉ
-
- #include <sys/ioctl.h> [*] [SysV]
-
- int ioctl (int handle, int request, int int_arg);
- int ioctl (int handle, int request, void *ptr_arg);
-
- Device control for HANDLE. REQUEST codes are:
-
- TCGETA see `termio'
-
- TCSETA see `termio'
-
- TCGETAF see `termio'
-
- TCGETAW see `termio'
-
- TCFLSH flush the buffers. If INT_ARG is 0, the input buffer is
- flushed; if INT_ARG is 1, the output buffer is flushed; if
- INT_ARG is 2, both the input and output buffers are
- flushed. Works only if HANDLE is 0 and HANDLE refers to
- the keyboard. Only flushing the keyboard buffer is
- implemented
-
- FIONREAD get number of available characters. The number of
- available characters is stored to the int pointed to by
- PTR_ARG. FIONREAD is implemented for the following types
- of handles:
-
- - stdin handles (keyboard) with IDEFAULT not set (DOS: handle 0
- only). Note that if ICANON is set, the number of characters in the
- keyboard buffer is returned which is not the number of characters
- available for read(), as at least one of the buffered characters
- (carriage return) is used for command line editing
-
- - named pipes
-
- - pipes created with pipe() by programs using emx.dll
-
- - all file handles under DOS (0 or 1 character available)
-
- FGETHTYPE get the handle type and store it to the int pointed to by
- PTR_ARG. See /emx/include/sys/ioctl.h for handle types
- (HT_FILE, for instance).
-
- If an error occurs, errno is set and -1 is returned.
-
- Restriction: When using the system call library libsys.lib (-Zsys), only
- the FGETHTYPE request is available.
-
- See also: fcntl() , open() , read()
-
-
- ΓòÉΓòÉΓòÉ 10.10. isascii() ΓòÉΓòÉΓòÉ
-
- #include <ctype.h> [UNIX]
-
- int isascii (int c);
-
- Return a non-zero value iff C is a valid ASCII character which can be used
- with isalnum() etc. isascii() can be applied to all integer values.
- isascii() is implemented both as macro and as function.
-
- See also: isalnum()
-
-
- ΓòÉΓòÉΓòÉ 10.11. isalnum() ΓòÉΓòÉΓòÉ
-
- #include <ctype.h> [ANSI]
-
- int isalnum (int c); /* alphanumeric character */
- int isalpha (int c); /* alphabetic character */
- int iscntrl (int c); /* control character */
- int isdigit (int c); /* decimal digit */
- int isgraph (int c); /* printable character but not space */
- int islower (int c); /* lower-case letter */
- int isprint (int c); /* printable character */
- int ispunct (int c); /* punctuation character */
- int isspace (int c); /* white-space character */
- int isupper (int c); /* upper-case letter */
- int isxdigit (int c); /* hexadecimal digit */
-
- These functions (or macros) return a non-zero value if the condition is
- true, or 0 if it is not true. C must be an ASCII character or EOF.
- Otherwise the result is unpredictable. Use isascii() to check for valid
- ASCII characters. These routines are implemented both as macros and as
- functions.
-
- See also: isascii() , tolower() , toupper() , _tolower() , _toupper()
-
-
- ΓòÉΓòÉΓòÉ 10.12. isalpha() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.13. isatty() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int isatty (int handle);
-
- Returns a non-zero value if HANDLE refers to a character device. Returns 0
- if HANDLE does not refer to a character file (file or pipe). If there is
- an error, errno is set and -1 is returned.
-
- See also: _isterm() , ioctl()
-
-
- ΓòÉΓòÉΓòÉ 10.14. iscntrl() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.15. isdigit() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.16. isgraph() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.17. islower() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.18. isprint() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.19. isspace() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.20. _isterm() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [emx]
-
- int _isterm (int handle);
-
- Returns a non-zero value if HANDLE refers to the stdin (keyboard) or
- stdout (screen) device. Otherwise, returns 0. If there is an error,
- errno is set and 0 is returned.
-
- Consider using ioctl (FGETHTYPE) instead.
-
- See also: _isterm() , ioctl()
-
-
- ΓòÉΓòÉΓòÉ 10.21. isupper() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.22. isxdigit() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 10.23. _itoa() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- char *_itoa (long value, char *string, int radix);
- char *_ltoa (int value, char *string, int radix);
- char *_ultoa (unsigned long value, char *string, int radix);
-
- Convert the number VALUE to a string using the number base RADIX (between
- 2 and 36). The string is stored to STRING. STRING is returned.
-
- See also: atoi() , _lltoa() , strtol()
-
-
- ΓòÉΓòÉΓòÉ 11. function k ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter k
-
-
- ΓòÉΓòÉΓòÉ 11.1. kill() ΓòÉΓòÉΓòÉ
-
- #include <signal.h> [*] [UNIX]
-
- int kill (int pid, int sig);
-
- Send the signal SIG to process PID. Only SIGINT and SIGBREAK can be sent
- to arbitrary child processes. A process can send the other signals only
- to itself, see raise(), or to other emx programs. If SIG is 0, kill()
- checks only if PID is valid or not. If PID is smaller than -1, the signal
- is sent to process -PID and its children. Some special cases are not
- implemented: pid=0, pid=1.
-
- If successful, kill() returns 0. Otherwise -1 is returned and errno set
- to one of the following values:
-
- EINVAL SIG is not a valid signal number
-
- ESRCH PID is not the process ID of a process or process PID is
- not a child process
-
- Restrictions: Special treatment of PID=0, PID=1 and PID=-1 is not
- implemented. Negative values of PID are implemented for OS/2 only and
- work only for direct children of the caller.
-
- When using the system call library libsys.lib (-Zsys), a process can send
- arbitrary signals to itself, only SIGINT and SIGBREAK can be sent to only
- child processes, negative values of PID are not allowed.
-
- See also: raise() , signal()
-
-
- ΓòÉΓòÉΓòÉ 12. function l ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter l
-
-
- ΓòÉΓòÉΓòÉ 12.1. labs() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> /* use this */ [ANSI]
- #include <math.h> /* or this */
-
- long labs (long n);
-
- Return the absolute value of N: If N is negative, -N is returned.
- Otherwise, N is returned. In-line code is generated for this function.
-
- See also: abs() , fabs()
-
-
- ΓòÉΓòÉΓòÉ 12.2. ldexp() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double ldexp (double x, int exp);
-
- Compute and return X * 2 ^ EXP. On overflow, #NAN is returned and errno
- is set to ERANGE.
-
-
- ΓòÉΓòÉΓòÉ 12.3. ldiv() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 12.4. _lldiv() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- _lldiv_t _lldiv (long long num, long long den);
- _uldiv_t _uldiv (unsigned long num, unsigned long den);
- _ulldiv_t _ulldiv (unsigned long long num, unsigned long long den);
-
- Perform an integer division, dividing NUM by DEN. The quotient and the
- remainder are returned in the quot and rem fields, respectively.
-
- The following table shows the signs of quot and rem depending on the signs
- of NUM and DEN for _lldiv():
-
- ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
- ΓöéNUM ΓöéDEN Γöéquot Γöérem Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé+ Γöé+ Γöé+ Γöé+ Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé+ Γöé- Γöé- Γöé+ Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé- Γöé+ Γöé- Γöé- Γöé
- Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
- Γöé- Γöé- Γöé+ Γöé- Γöé
- ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
-
- Note: Do not use the -fpcc-struct-return GCC option.
-
- See also: div() , ldiv()
-
-
- ΓòÉΓòÉΓòÉ 12.5. _lltoa() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char *_lltoa (long long value, char *string, int radix);
- char *_ulltoa (unsigned long long value, char *string, int radix);
-
- Convert the number VALUE to a string using the number base RADIX (between
- 2 and 36). The string is stored to STRING. STRING is returned.
-
- See also: atoi() , _itoa() , strtol()
-
-
- ΓòÉΓòÉΓòÉ 12.6. localeconv() ΓòÉΓòÉΓòÉ
-
- #include <locale.h> [ANSI]
-
- struct lconv *localeconv (void);
-
- Not implemented.
-
-
- ΓòÉΓòÉΓòÉ 12.7. localtime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- struct tm *localtime (const time_t *t);
-
- Convert the number of seconds elapsed since 00:00 GMT 1-Jan-1970 given by
- the variable pointed to by T to a time and date structure for the local
- timezone and return a pointer to the structure. gmtime(), mktime() and
- localtime() use the same memory location, therefore the values are
- overwritten if one of these functions is called.
-
- See also: gmtime()
-
-
- ΓòÉΓòÉΓòÉ 12.8. log() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double log (double x);
- double log10 (double x);
-
- log() returns the natural logarithm of X. log10() returns the base-10
- logarithm of X.
-
- If X is zero, -#INF is returned and errno set to EDOM. If X is negative,
- +#NAN is returned and errno set to EDOM.
-
- See also: exp() , pow()
-
-
- ΓòÉΓòÉΓòÉ 12.9. log10() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 12.10. longjmp() ΓòÉΓòÉΓòÉ
-
- #include <setjmp.h> [ANSI]
-
- void volatile longjmp (jmp_buf there, int n);
-
- Restore the context saved in THERE by setjmp(). longjmp() does a
- non-local `goto'. When calling longjmp() in a signal handler or in a
- function called by a signal handler (that is, while a signal handler is
- active), the signal handler will be unwound, that is, it is assumed that
- the signal handler doesn't return.
-
- See also: setjmp()
-
-
- ΓòÉΓòÉΓòÉ 12.11. lseek() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- long lseek (int handle, long offset, int origin);
-
- lseek() moves the file pointer of HANDLE. The new position OFFSET is
- relative to ORIGIN: If ORIGIN is SEEK_SET, OFFSET is relative to the
- beginning of the file, if ORIGIN is SEEK_CUR, OFFSET is relative to the
- current position, if ORIGIN is SEEK_END, OFFSET is relative to the end of
- the file. The file pointer cannot be moved before the beginning of the
- file. lseek() returns the new position relative to the beginning of the
- file. If there is an error, -1 is returned.
-
- See also: tell()
-
-
- ΓòÉΓòÉΓòÉ 12.12. _ltoa() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 13. function m ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter m
-
-
- ΓòÉΓòÉΓòÉ 13.1. main() ΓòÉΓòÉΓòÉ
-
- [ANSI]
-
- int main (void);
- int main (int argc, char *argv[]);
- int main (int argc, char *argv[], char *envp[]);
-
- This is the function called by the startup code to run your program. It
- is not a library function. ARGC is the number of command line arguments,
- including the program name. ARGV is an array of pointers to the command
- line arguments. ENVP is an array of pointers to the environment strings.
- The last entry of ARGV and ENVP is a NULL pointer. main() should always
- return a value. If main() returns, exit() is called using the return value
- of main() as argument. If main() ends without return() or calling exit(),
- the return code of the program is undefined. This should be avoided.
- After changing the environment with putenv(), you should use the environ
- global variable instead of the ENVP argument of main().
-
- See also: environ , exit() , _response() , _wildcard()
-
-
- ΓòÉΓòÉΓòÉ 13.2. malloc() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void *malloc (size_t size);
-
- Allocate a block of memory big enough for holding SIZE bytes. If there is
- an error, malloc() returns NULL. If SIZE is 0, zero bytes of memory are
- allocated, the return value will be unequal NULL.
-
- Restriction: The current malloc() implementation is not really suitable
- for virtual memory because the complete heap (including allocated blocks)
- is traversed for a free block. It's possible to use GNU malloc instead.
- Do not replace malloc() etc. when using emxlibc.dll as the functions in
- emxlibc.dll won't call your replacements.
-
- See also: calloc() , free() , realloc()
-
-
- ΓòÉΓòÉΓòÉ 13.3. matherr() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [PC]
-
- int matherr (struct exception *x);
-
- Exception handler for floating point math.
-
- Restriction: matherr() is not implemented.
-
-
- ΓòÉΓòÉΓòÉ 13.4. _memaccess() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [emx]
-
- void *_memaccess (unsigned first, unsigned last, int flag);
-
- Gain access to physical memory under DOS. To access memory which is
- outside the memory space of the current process, you have to call
- _memaccess(). emx option -am must be used to enable _memaccess(), see
- `Using emx options'.
-
- FIRST is the address of the first byte of the physical memory area, LAST
- is the address of the last byte of the physical memory area to be
- accessed. Both addresses are physical addresses. FIRST and LAST+1 must be
- page aligned: FIRST and LAST+1 must be integral multiples of 4096. That
- is, with using hexadecimal notation, FIRST must end with 000, LAST must
- end with fff. A pointer to virtual memory mapped to the physical memory
- area is returned. If FLAG is 0, read access is granted. If FLAG is 1,
- read and write access is granted. Write access can be granted if the
- address range of the physical memory area is entirely in the range 0xa0000
- to 0xbffff. If bytes outside this range are included in FIRST to LAST,
- emx option -aw must be used to enable write access, see `Using emx
- options'.
-
- If _memaccess() fails, NULL is returned and errno set to one of the
- following values:
-
- EACCES FIRST not page aligned; LAST+1 not page aligned; LAST not
- greater than FIRST; write access not allowed
-
- EINVAL FLAG is not 0 or 1
-
- ENOMEM not enough virtual memory for storing the paging tables;
- linear address space of process not big enough for the
- request
-
- Restriction: _memaccess() is not available under OS/2.
-
- Example: /emx/test/hw_mem.c
-
- See also: _portaccess()
-
-
- ΓòÉΓòÉΓòÉ 13.5. _memcount() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [emx]
- #include <memory.h> /* or this */
-
- size_t _memcount (void *mem, int c, size_t n);
-
- Return the number of bytes equal to C of the N bytes at address MEM.
-
-
- ΓòÉΓòÉΓòÉ 13.6. memccpy() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [PC]
- #include <memory.h> /* or this */
-
- void *memccpy (void *s1, const void *s2, int c, size_t n);
-
- Copy at most the first N bytes from S2 to S1, stopping after copying a
- byte equal to the lower 8 bits C. If memccpy() stops because a byte equal
- to C has been found, a pointer to the byte after the last destination byte
- (which is equal to C) is returned. If N bytes have been copied without
- finding a byte equal to C, NULL is returned.
-
- See also: memchr() , memcpy() , memmove() , strcpy() , strncpy()
-
-
- ΓòÉΓòÉΓòÉ 13.7. memchr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [ANSI]
- #include <memory.h> /* or this */
-
- void *memchr (const void *s, int c, size_t n);
-
- Search the first N bytes at S for a byte equal to the lower 8 bits of C.
- If a byte equal to C is found, a pointer to the first occurrence of C is
- returned. If there is no such byte, NULL is returned.
-
-
- ΓòÉΓòÉΓòÉ 13.8. memcmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [ANSI]
- #include <memory.h> /* or this */
-
- int memcmp (const void *s1, const void *s2, size_t n);
-
- Compare the first N bytes at S1 to the first N bytes at S2. If the two
- buffers are identical (or if N is zero), 0 is returned. Otherwise, a value
- is returned which indicates the relationship of the first differing byte:
- a negative value means buffer S1 is lexically less than buffer S2, a
- positive value means buffer S1 is lexically greater than buffer S2.
-
- See also: bcmp() , _memdif() , memicmp()
-
-
- ΓòÉΓòÉΓòÉ 13.9. _memcount() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [emx]
- #include <memory.h> /* or this */
-
- size_t _memcount (const void *mem, int c, size_t n);
-
- Count and return the number of occurrences of character C in the memory
- area of size N bytes at MEM.
-
-
- ΓòÉΓòÉΓòÉ 13.10. memcpy() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [ANSI]
- #include <memory.h> /* or this */
-
- void *memcpy (void *s1, const void *s2, size_t n);
-
- Copy memory. Copy N bytes from S2 to S1. The two regions must not
- overlap. memcpy() returns S1. GCC generates in-line code for special
- applications of memcpy(). Use memmove() instead of memcpy() to copy
- overlapping regions of memory.
-
- See also: bcopy() , memmove()
-
-
- ΓòÉΓòÉΓòÉ 13.11. _memdif() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [emx]
- #include <memory.h> /* or this */
-
- size_t _memdif (const void *mem1, const void *mem2, size_t n);
-
- Compare the first N bytes at MEM1 to the first N bytes at MEM2. If the two
- buffers are identical (or if N is zero), _MEMDIF_EQ is returned.
- Otherwise, the byte offset of the first difference is returned.
-
- See also: memcmp()
-
-
- ΓòÉΓòÉΓòÉ 13.12. memicmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [PC]
- #include <memory.h> /* or this */
-
- int memicmp (const void *s1, const void *s2, size_t n);
-
- Compare the first N bytes at S1 to the first N bytes at S2, ignoring
- letter case. If the two buffers are identical (or if N is zero), 0 is
- returned. Otherwise, a value is returned which indicates the relationship
- of the first differing byte: a negative value means buffer S1 is lexically
- less than buffer S2 (after conversion to lower case), a positive value
- means buffer S1 is lexically greater than buffer S2 (after conversion to
- lower case).
-
- See also: memcmp() , tolower()
-
-
- ΓòÉΓòÉΓòÉ 13.13. memmove() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [ANSI]
- #include <memory.h> /* or this */
-
- void *memmove (void *s1, const void *s2, size_t n);
-
- Copy memory. Copy N bytes from S2 to S1. The two regions may overlap.
- memmove() returns S1.
-
- See also: bcopy() , memcpy()
-
-
- ΓòÉΓòÉΓòÉ 13.14. memset() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [ANSI]
- #include <memory.h> /* or this */
-
- void *memset (void *s, int c, size_t n);
-
- Fill memory. Set N bytes at S to C. memset() returns S.
-
- See also: bzero()
-
-
- ΓòÉΓòÉΓòÉ 13.15. _memswap() ΓòÉΓòÉΓòÉ
-
- #include <string.h> /* use this */ [emx]
- #include <memory.h> /* or this */
-
- void _memswap (void *s1, void *s2, size_t n);
-
- Swap two areas of memory of N bytes each, pointed to by S1 and S2. The two
- areas must not overlap.
-
-
- ΓòÉΓòÉΓòÉ 13.16. mkdir() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [BSD]
-
- int mkdir (const char *name, long mode);
-
- Create a directory named NAME. Only one directory can be created in one
- step, therefore all but the last component of NAME must exist. MODE
- (containing the permission bits) is ignored.
-
- See also: chdir() , rmdir()
-
-
- ΓòÉΓòÉΓòÉ 13.17. mktemp() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- char *mktemp (char *template);
-
- Create a unique file name by modifying TEMPLATE. Trailing X characters of
- TEMPLATE are replaced by a letter followed by digits (the process ID).
- There should be 6 trailing X characters. Only 26 different file names per
- process can be created. On success, TEMPLATE is returned. On failure,
- NULL is returned. Note that the TEMPLATE string is modified, do not use a
- string constant!
-
- Example:
-
- char tmp[20];
-
- strcpy (tmp, "exXXXXXX");
- if (mktemp (tmp) != NULL)
- {
- /* ... */
- }
-
- See also: tempnam() , tmpfile() , tmpnam()
-
-
- ΓòÉΓòÉΓòÉ 13.18. mktime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- time_t mktime (struct tm *t);
-
- Return the number of seconds elapsed between 00:00 GMT 1-Jan-1970 and the
- moment defined by the structure pointed to by T. T is interpreted as
- local time. On error, -1 cast as time_t is returned.
-
- See also: gmtime() , localtime()
-
-
- ΓòÉΓòÉΓòÉ 13.19. modf() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double modf (double x, double *int_ptr);
-
- Split X into fractional part (which is returned) and integer part (which
- is stored to *INT_PTR). Both the fractional and the integer part have the
- same sign as X.
-
- See also: ceil() , floor() , frexp() , rint() , trunc()
-
-
- ΓòÉΓòÉΓòÉ 13.20. _msize() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- size_t _msize (const void *mem);
-
- Return the size of the memory block MEM which has been allocated by
- malloc(), realloc() or calloc(). MEM must be the pointer obtained by
- calling malloc(), realloc() or calloc().
-
- See also: _expand()
-
-
- ΓòÉΓòÉΓòÉ 14. function n ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter n
-
-
- ΓòÉΓòÉΓòÉ 14.1. _nls_init() ΓòÉΓòÉΓòÉ
-
- #include <sys/nls.h> [emx]
-
- void _nls_init (void);
-
- Initialize the global variables _nls_tolower_tab and _nls_toupper_tab
- which are used by _nls_tolower(), _nls_toupper(), _nls_strlwr() and
- _nls_strupr(). Before calling one of these functions, _nls_init() must be
- called. Moreover, _nls_init() should be called after changing the country
- or code page. The tables are initialized appropriately for the current
- country code and code page.
-
- See also: _fncmp() , _nls_tolower() , _nls_strlwr()
-
-
- ΓòÉΓòÉΓòÉ 14.2. _nls_strlwr() ΓòÉΓòÉΓòÉ
-
- #include <sys/nls.h> [emx]
-
- unsigned char *_nls_strlwr (unsigned char *string);
- unsigned char *_nls_strupr (unsigned char *string);
-
- These functions convert all the characters of the string STRING to lower
- case or upper case, respectively. Accented characters etc. are converted
- as well. STRING is returned. Before using one of these functions,
- _nls_init() must be called.
-
- See also: _nls_init() , _nls_tolower() , _nls_toupper()
-
-
- ΓòÉΓòÉΓòÉ 14.3. _nls_strupr() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 14.4. _nls_tolower() ΓòÉΓòÉΓòÉ
-
- #include <sys/nls.h> [emx]
-
- unsigned char _nls_tolower (unsigned char c);
- unsigned char _nls_toupper (unsigned char c);
-
- These routines convert the character C to lower case or upper case,
- respectively. Accented characters etc. are converted as well. Before
- using one of these routines, _nls_init() must be called. These routines
- are implemented as macros.
-
- See also: _nls_init() , _nls_strlwr() , _nls_strupr()
-
-
- ΓòÉΓòÉΓòÉ 14.5. _nls_toupper() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 15. function o ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter o
-
-
- ΓòÉΓòÉΓòÉ 15.1. open() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
- #include <fcntl.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-
- int open (const char *name, int oflag);
- int open (const char *name, int oflag, int pmode);
-
- Open a file or device. NAME is the name of the file or device. OFLAG
- contains one or more of the following values, combined by the | operator:
-
- O_RDONLY Open for reading. Writing is not allowed
-
- O_WRONLY Open for writing. Reading is not allowed
-
- O_RDWR Open for reading and writing
-
- O_APPEND Move the file pointer to the end of file before any write
- operation takes place. This is used for appending to a
- file
-
- O_CREAT Create the file if it does not exist
-
- O_TRUNC Truncate the size of the file to 0
-
- O_EXCL Fail if the O_CREAT is used and the file already exists
-
- O_NDELAY Currently ignored.
-
- O_BINARY Binary mode, no translation. See below
-
- O_TEXT Text mode, translate CR/LF to LF. See below
-
- If a new file is created, PMODE (modified by the umask value), is used to
- set the file permissions. S_IREAD grants read access, S_IWRITE grants
- write access. S_IREAD is ignored (DOS and OS/2 limitation). To grant
- both read and write access, use S_IREAD|S_IWRITE.
-
- There are two additional OFLAG flags: O_TEXT for text mode, O_BINARY for
- binary mode. Text mode, which is the default, translates each CR/LF pair
- to a LF character on input and translates LF characters to CR/LF pairs on
- output. If the last character of a file is Ctrl-Z, it is discarded on
- input. Binary mode disables these transformations.
-
- If the file or device cannot be opened, open() sets errno and returns -1.
- If open() succeeds, the file handle is returned. The file handle is
- always greater than -1.
-
- The mode O_TRUNC|O_RDONLY is not implemented. The mode O_TEXT|O_WRONLY
- does not overwrite a Ctrl-Z at the end of the file -- this causes problems
- when appending. Ctrl-Z at the end of the file is obsolete, anyway.
-
- The file is opened in the sharing mode SH_DENYNO, see sopen().
-
- See also: close() , fdopen() , sopen()
-
-
- ΓòÉΓòÉΓòÉ 15.2. opendir() ΓòÉΓòÉΓòÉ
-
- #include <sys/types.h> [BSD]
- #include <dirent.h> /* this is recommended */
- #include <sys/dir.h> /* this also works (for now) */
-
- DIR *opendir (char *name);
- int closedir (DIR *dirp);
- struct dirent *readdir (DIR *dirp);
- void seekdir (DIR *dirp, long off);
- long telldir (DIR *dirp);
- void rewinddir (DIR *dirp);
-
- Scan directories. opendir() opens the directory NAME for scanning. If
- there is an error, NULL is returned. Otherwise a value is returned which
- is used with the other functions to continue the scanning.
-
- closedir() ends the directory scan of DIRP. After closing DIRP, you must
- not use DIRP. You should close all handles created by opendir().
-
- readdir() retrieves the next directory entry for DIRP. If there are no
- more directory entries, NULL is returned.
-
- seekdir() moves to the specified directory entry of DIRP. If OFF is 0,
- the first directory entry will be read next. If OFF is 1, the second
- directory entry will be read next. And so on.
-
- telldir() returns the current position in DIRP. 0 is returned for the
- first directory entry.
-
- rewinddir() is equivalent to seekdir (0).
-
- These functions use _fnlwr() to convert the file names to lower case on
- upper-case-only file systems.
-
- See also: _fnlwr() , _wildcard()
-
-
- ΓòÉΓòÉΓòÉ 15.3. _outp16() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 15.4. _outp32() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 15.5. _outp8() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [*] [emx]
-
- void _outp8 (unsigned port, unsigned value);
- void _outp16 (unsigned port, unsigned value);
- void _outp32 (unsigned port, unsigned value);
-
- These functions write a single byte or word to a hardware port. _outp8()
- writes the byte VALUE to PORT, _outp16() writes the 16-bit word VALUE to
- PORT, _outp32() writes the 32-bit word VALUE to PORT.
-
- You have to call _portaccess() first to enable access to a range of ports.
- To make your program work under DOS, you have to use emx option -ai, see
- `Using emx options'. Under OS/2, your program requires emxio.dll in a
- directory listed in LIBPATH. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio). libemxio
- must not be used if the program should run under DOS.
-
- See also: _portaccess() , _inp8() , _outps8()
-
-
- ΓòÉΓòÉΓòÉ 15.6. _outps16() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 15.7. _outps32() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 15.8. _outps8() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [*] [emx]
-
- void _outps8 (unsigned port, const unsigned char *src, unsigned count);
- void _outps16 (unsigned port, const unsigned short *src, unsigned count);
- void _outps32 (unsigned port, const unsigned short *src, unsigned count);
- void _outps8dac (unsigned port, const unsigned char *src, unsigned count);
-
- These functions write multiple bytes or words to a hardware port.
- _outps8() writes COUNT bytes from SRC to PORT. _outps16() writes COUNT
- 16-bit words from SRC to PORT. _outps32() writes COUNT 32-bit words from
- SRC to PORT.
-
- The COUNT argument of _outps8() must not exceed 65535.
-
- The SRC pointer of _outps16() must be aligned on a 16-bit boundary, that
- is, the address must be even. COUNT must not exceed 32768.
-
- The SRC pointer of _outps32() must be aligned on a 32-bit boundary, that
- is, the address must be a multiple of four. COUNT must not exceed 65536.
-
- _outps8dac() is a slowed-down version of _outps8() suitable for writing to
- the VGA palette registers.
-
- You have to call _portaccess() first to enable access to a range of ports.
- To make your program work under DOS, you have to use emx option -ai, see
- `Using emx options'. Under OS/2, your program requires emxio.dll in a
- directory listed in LIBPATH. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio). libemxio
- must not be used if the program should run under DOS.
-
- See also: _portaccess() , _inps8() , _outp8()
-
-
- ΓòÉΓòÉΓòÉ 15.9. _outps8dac() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 16. function p ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter p
-
-
- ΓòÉΓòÉΓòÉ 16.1. _path() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- int _path (char *dst, const char *name);
-
- Find an executable file. If NAME contains a colon, a slash or a
- backslash, only that name will be tried. If NAME does not contain colons,
- slashes or backslashes, the file will be sought in the directories listed
- in the EMXPATH and PATH environment variables. If the file is not found,
- DST will be an empty string, errno will be ENOENT and -1 will be returned.
- If the file is found, the path name will be copied to DST and 0 will be
- returned. No default extension is used.
-
- See also: getenv() , _searchenv()
-
-
- ΓòÉΓòÉΓòÉ 16.2. pclose() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int pclose (FILE *stream);
-
- Close a pipe created by popen(). pclose() waits until the child process
- started by popen() ends and closes STREAM. The termination status of the
- child process is returned. See wait() for details about the return value.
- If there is an error, pclose() returns -1.
-
- Restriction: pclose() is not implemented under DOS.
-
- See also: popen()
-
-
- ΓòÉΓòÉΓòÉ 16.3. perror() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- void perror (const char *string);
-
- Print an appropriate error message for the current errno value to stderr.
- If STRING is NULL or is the empty string "", just the error message is
- printed. Otherwise, STRING and a colon precede the error message.
-
- See also: errno , strerror() , sys_errlist , sys_nerr
-
-
- ΓòÉΓòÉΓòÉ 16.4. pipe() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int pipe (int *two_handles);
-
- Create an unnamed pipe. The handle used for reading from the pipe is
- stored to TWO_HANDLES[0], the handle used for writing to the pipe is
- stored to TWO_HANDLES[1]. Both handles are in text mode; use setmode() if
- you want to switch to binary mode. pipe() returns 0 if successful, -1
- otherwise.
-
- Restrictions: pipe() is implemented for OS/2 only.
-
- See also: close() , dup() , popen() , setmode()
-
-
- ΓòÉΓòÉΓòÉ 16.5. popen() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- FILE *popen (const char *command, const char *mode);
-
- Start a child process and connect one end of a pipe to it. popen() runs
- the command COMMAND by starting a command processor. MODE must start with
- `r' or `w'. If it starts with `r', stdout of COMMAND will be redirected,
- you can get the output by reading from the stream returned by popen(). If
- MODE starts with `w', stdin of COMMAND will be redirected, you can send
- data to COMMAND by writing to the stream returned by popen(). Append `b'
- for binary mode or `t' for text mode to the MODE string. The default is
- text mode, see also fopen(). If an error occurs, popen() returns NULL.
- Otherwise, popen() returns a stream which is connected to the local end of
- the pipe. Use pclose() to close the stream.
-
- Restriction: popen() is not implemented under DOS.
-
- See also: pclose() , pipe() , _splitargs() , system()
-
-
- ΓòÉΓòÉΓòÉ 16.6. _portaccess() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [emx]
-
- int _portaccess (unsigned first, unsigned last);
-
- Gain access to hardware ports. To access hardware ports, you have to call
- _portaccess(). FIRST is the address of the first port, LAST is the
- address of the last port. emx option -ai must be used to enable
- _portaccess() under DOS, see `Using emx options'. On success, 0 is
- returned. On failure, -1 is returned.
-
- _portaccess() always succeeds under OS/2.
-
- Example: /emx/test/hw_io.c
-
- See also: _memaccess() , _inp8() , _outp8() , _wait0()
-
-
- ΓòÉΓòÉΓòÉ 16.7. pow() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double pow (double x, double y);
-
- Raise X to the power of Y and return the result. If pow() is undefined
- for a given pair of X and Y, #NAN is returned and errno is set to EDOM.
- On overflow, #INF is returned and errno is set to ERANGE.
-
- See also: cbrt() , exp() , log() , sqrt()
-
-
- ΓòÉΓòÉΓòÉ 16.8. printf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int printf (const char *format, ...);
-
- Formatted output to the stdout stream. On success, the number of
- characters written to stdout is returned. Otherwise, EOF is returned.
-
- Characters in FORMAT are copied unmodified to the destination unless a
- format specification is hit. A format specification has the following
- format:
-
- %[flags][width][.precision][size]type
-
- where items in brackets are optional. For each format specification an
- argument of the specified type is taken from the argument list, is
- formatted according to the format specification and written to the
- destination. To include one percent sign in the output, put two percent
- signs (%%) into the FORMAT string.
-
- The following FLAGS characters are available:
-
- - left-justify the converted value. Without this flag, the value
- is right-justified
-
- + always insert sign (+ or -) for a signed number
-
- (blank) insert a blank space if the conversion of a signed number
- doesn't start with a sign (+ or -). If both + and (blank) are
- given, (blank) is ignored.
-
- 0 pad with '0' characters instead of blanks. This flag is ignored
- for non-numeric conversions
-
- # use alternate conversion. See below
-
- If the length of the converted value is less than WIDTH, it is padded with
- blanks or '0' characters, depending on the 0 flag and the conversion type.
- Unless the - flag is used, the field is padded on the left. If the length
- of the converted value is greater than WIDTH, the field is not truncated.
- WIDTH is either a decimal number or a '*' character. In the latter case,
- the width is taken from the argument list.
-
- PRECISION specifies the number of decimal digits after the decimal point
- of a floating point number. For the s conversion, PRECISION specifies the
- maximum string length. PRECISION is either a decimal number or a '*'
- character. In the latter case, the precision is taken from the argument
- list.
-
- SIZE is either h for a `short' type or l for a `long' type. If SIZE is
- not specified, the default size is used. Use L or ll for a `long long'
- type.
-
- TYPE is one of the following characters:
-
- c character (char)
-
- d signed decimal number (int)
-
- e floating-point number (double), using e as exponent sign:
- -#.###e+##. There's exactly one digit before the decimal point.
- The number of digits after the decimal point is specified by
- PRECISION. If PRECISION is missing, 6 digits are printed
-
- E floating-point number (double), using E as exponent sign. See e
-
- f floating-point number (double) printed in fixed-point format.
- The number of digits after the decimal point is specified by
- PRECISION. If PRECISION is missing, 6 digits are printed. If
- PRECISION is specified as 0, no decimal point is printed
-
- g floating-point number (double). The number is printed using
- type d, e or f, depending on the number. If the number is an
- integer, type d is used. If the exponent (of f format output)
- is less than -4 or greater than PRECISION (default: 6), type e
- is used. Otherwise, type f is used
-
- G floating-point number (double), using E as exponent sign instead
- of e. See g
-
- i signed decimal number (int). Same as d
-
- n store the number of characters formatted up to this point in the
- FORMAT string (int *). No output
-
- o octal number (unsigned). The # flag prepends 0.
-
- p pointer (void *). The output format of a pointer is
- implementation-dependent. In this implementation, p is
- equivalent to x
-
- s string (char *). Print characters of the string until a null
- character is reached or PRECISION (if specified and non-zero) is
- exhausted
-
- u unsigned decimal number (unsigned)
-
- x hexadecimal number (unsigned), using lower-case letters. The #
- flag prepends 0x.
-
- X hexadecimal number (unsigned), using upper-case letters. The #
- flag prepends 0x
-
- Restriction: The output could be more accurate for floating point values.
- Some rather special cases are not implemented.
-
- See also: fopen() , fwrite() , scanf()
-
-
- ΓòÉΓòÉΓòÉ 16.9. ptrace() ΓòÉΓòÉΓòÉ
-
- #include <sys/ptrace.h> [*] [SysV]
-
- int ptrace (int request, int pid, int addr, int data);
-
- Debug child process. The child process is identified by PID. The
- following REQUEST codes are defined:
-
- PTRACE_TRACEME Not implemented -- use spawn (P_DEBUG) instead
-
- PTRACE_PEEKTEXT Read a 32-bit word from the text space of the
- child process. ADDR is the address of the word.
- The word at ADDR is returned.
-
- PTRACE_PEEKDATA See PTRACE_PEEKTEXT. On machines with separate
- data and text space, this request will read from
- the data space.
-
- PTRACE_PEEKUSER Read a 32-bit word from the process table of the
- child process. This can be used to read the
- registers of the child process. See sys/user.h
- for details.
-
- PTRACE_POKETEXT Write the 32-bit word DATA to address ADDR of the
- text space of the child process.
-
- PTRACE_POKEDATA See PTRACE_POKETEXT. On machines with separate
- data and text space, this request will write to
- the data space.
-
- PTRACE_POKEUSER Write a 32-bit word to the process table of the
- child process. This can be used to alter the
- registers of the child process. See sys/user.h
- for details. Not all registers can be modified.
-
- PTRACE_RESUME Resume the child process. The child process will
- run until a signal occurs.
-
- PTRACE_EXIT Kill the child process.
-
- PTRACE_STEP Execute the next instruction of the child
- process.
-
- PTRACE_SESSION If DATA is 0, select the session of the calling
- process. If DATA is 1, select the child session.
- If DATA is 2, the child session is automatically
- selected by the next PTRACE_STEP (on CALL
- instructions only) or PTRACE_RESUME command.
- This request is emx specific and is ignored under
- DOS.
-
- As -1 is a legal return value for the PTRACE_PEEK requests, you should set
- errno to 0 before calling ptrace() and check errno after the call.
-
- Restrictions: Currently, a process can debug only one child process.
- While debugging a child process, wait() cannot be used for waiting for
- another child. When using the system call library libsys.lib (-Zsys),
- ptrace() is not available.
-
- See also: spawn() , wait()
-
-
- ΓòÉΓòÉΓòÉ 16.10. putc() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int putc (int c, FILE *stream);
- int putchar (int c);
-
- Write the character C to STREAM or stdout, respectively.
-
- putchar (c)
-
- is equivalent to
-
- putc (c, stdout).
-
- The character written is returned. On failure, EOF is returned. putc()
- and putchar() are in-line functions or macros.
-
- See also: fprintf() , fputs() , fputc()
-
-
- ΓòÉΓòÉΓòÉ 16.11. putchar() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 16.12. putenv() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [BSD]
-
- int putenv (const char *string);
-
- Put STRING into the environment of the calling process. STRING is a
- pointer to a string of the form
-
- name=value
-
- where NAME is the name of the environment variable and VALUE is the value
- of the environment variable. If the environment variable NAME already
- exists, the current value is replaced by the new value, VALUE. If NAME is
- not already in the environment, STRING is put into the environment. Do
- not free or reuse STRING after calling putenv(). Using an auto variable
- is also a bad idea. After calling putenv(), do not use the ENVP argument
- of main(). Use environ instead. On success, 0 is returned. On failure,
- -1 is returned.
-
- See also: getenv()
-
-
- ΓòÉΓòÉΓòÉ 16.13. puts() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int puts (const char *string);
-
- Write the string STRING followed by a newline (LF) character (which is
- translated to CR/LF if stdout is in text mode) to the stdout stream. On
- failure, EOF is returned. Otherwise, a non-negative value is returned.
-
- See also: fputs() , fgets()
-
-
- ΓòÉΓòÉΓòÉ 16.14. putw() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int putw (int x, FILE *stream);
-
- Write the word (int) X to STREAM and return it. On failure, -1 is
- returned. As -1 is also a possible int value, you have to use ferror() to
- recognize an error condition.
-
- Avoid using this function.
-
- See also: getw() , fwrite()
-
-
- ΓòÉΓòÉΓòÉ 17. function q ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter q
-
-
- ΓòÉΓòÉΓòÉ 17.1. qsort() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> /* use this */ [ANSI]
- #include <search.h> /* or this */
-
- void qsort (void *base, size_t num, size_t width,
- int (*compare)(const void *x1, const void *x2));
-
- ort an array. BASE is a pointer to the beginning of the array. he array
- contains NUM elements of WIDTH bytes each. COMPARE is alled to compare
- the two elements pointed to by X1 and X2. OMPARE should return a negative
- value, if element X1 is less than lement X2, zero, if element X1 equals
- element X2, and a positive alue if element X1 is greater than element X2.
-
- sort() is not stable: the order of equal elements is undefined.
-
-
- ΓòÉΓòÉΓòÉ 18. function r ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter r
-
-
- ΓòÉΓòÉΓòÉ 18.1. raise() ΓòÉΓòÉΓòÉ
-
- #include <signal.h> [ANSI]
-
- int raise (int sig);
-
- Raise the signal SIG. This causes the program to end, if SIG_DFL is
- installed for that signal. If SIG_IGN is installed for that signal, the
- request is ignored. If a signal handler has been installed and the signal
- is not waiting for acknowledgement, the signal handler will be called. If
- SIGQUIT, SIGILL, SIGTRAP, SIGEMT, SIGFPE, SIGBUS, SIGSEGV or SIGSYS is
- raised and SIG_DFL is installed for that signal, a core dump file will be
- created unless the -c emx option is used (see `Using emx options').
-
- If successful, raise() returns 0. Otherwise -1 is returned and errno set
- to the following value:
-
- EINVAL SIG is not a valid signal number
-
- Restriction: Core dump files are not written if LINK386 was used for
- linking.
-
- See also: abort() , kill() , signal()
-
-
- ΓòÉΓòÉΓòÉ 18.2. rand() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- int rand (void);
- void srand (unsigned int seed);
-
- rand() returns a pseudo-random number in the range 0 through RAND_MAX
- (32767). RAND_MAX is defined in stdlib.h. srand() initializes the
- sequence of random numbers. The initial SEED value (without calling
- srand()) is 1.
-
- See also: libbsd (bsddev.doc)
-
-
- ΓòÉΓòÉΓòÉ 18.3. read() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int read (int handle, void *buf, size_t nbyte);
-
- Read up to NBYTE characters from file HANDLE to the buffer BUF. The number
- of characters read is returned. If there is an error, -1 is returned.
- The return value may be less than NBYTE. For instance, this happens if
- the end of the file is reached. See also `termio' below. If HANDLE is 0
- and HANDLE refers to the keyboard and O_NDELAY has been set with fcntl()
- for HANDLE and the IDEFAULT and ICANON bits have been reset with ioctl()
- for HANDLE, -1 is returned and errno is set to EAGAIN if the call to
- read() would block. Even if there is some data available, but not enough
- with respect to VMIN, -1 is returned.
-
- See also: open() , setmode() , write()
-
-
- ΓòÉΓòÉΓòÉ 18.4. readdir() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 18.5. _read_kbd() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [*] [emx]
- #include <sys/kbdscan.h> /* optional, for extended scan codes */
-
- int _read_kbd (int echo, int wait, int sig);
-
- Get a character from the keyboard. Extended codes are preceded by a null
- character (call _read_kbd() again!), the scan codes are defined in
- /emx/include/sys/kbdscan.h. If ECHO is non-zero, input will be echoed, if
- WAIT is non-zero, _read_kbd() will wait until a character is available, if
- WAIT is zero and no character is available, _read_kbd() will return -1, if
- SIG is zero, Ctrl-C will be ignored. Examples:
-
- #define getch() _read_kbd (0, 1, 0)
- #define getche() _read_kbd (1, 1, 0)
-
- Please use `termio' instead, see below. See also the termio.c test
- program.
-
- It's important to call _read_kbd() again if _read_kbd() returns 0. To see
- what happens if you don't, type Ctrl-S F10 under DOS.
-
- See also: ioctl() , read() , conio.h
-
-
- ΓòÉΓòÉΓòÉ 18.6. realloc() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- void *realloc (void *mem, size_t size);
-
- Reallocate the block of memory pointed to by MEM, making it big enough to
- hold SIZE bytes. If MEM is NULL, a new block of memory is allocated.
- Otherwise, MEM must be a pointer returned by calloc(), malloc() or
- realloc(); the size of MEM is adjusted. If MEM cannot be expanded
- in-place, it is moved. A pointer to the new, resized block of memory is
- returned. If there is not enough memory available, NULL is returned.
-
- MEM can also be a pointer to a block of memory freed by free() as long as
- calloc(), malloc() and realloc() have not been called since freeing the
- block. Using this feature is not recommended, it may be removed in future
- implementations of realloc().
-
- See also: malloc()
-
-
- ΓòÉΓòÉΓòÉ 18.7. _remext() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- void _remext (char *path);
-
- Remove the extension from the file name PATH. If the last member of PATH
- starts with a dot ("/usr/mattes/.profile", for instance) PATH isn't
- modified.
-
- See also: _defext() , _getext() , _splitpath()
-
-
- ΓòÉΓòÉΓòÉ 18.8. remove() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> /* use this */ [ANSI]
- #include <io.h> /* or this */
-
- int remove (const char *name);
-
- Delete the file NAME. 0 is returned if successful, -1 if not. Under OS/2
- and DOS, unlink() and remove() are equivalent.
-
- See also: unlink()
-
-
- ΓòÉΓòÉΓòÉ 18.9. rename() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> /* use this */ [ANSI]
- #include <io.h> /* or this */
-
- int rename (const char *old_name, const char *new_name);
-
- Rename the file or directory OLD_NAME to NEW_NAME. Moving a file to a
- different directory on the same drive is possible. 0 is returned if
- successful, -1 if not.
-
-
- ΓòÉΓòÉΓòÉ 18.10. _response() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- void _response (int *argcp, char ***argvp);
-
- Expand response files. If you want response files (@filename, filename
- contains a list of arguments one per line) to be expanded, call
-
- _response (&argc, &argv);
-
- at the beginning of main(). Response file arguments enclosed in double
- quotes won't be expanded. If a response file cannot be opened, the
- argument is kept unchanged.
-
- See also: main() , _wildcard()
-
-
- ΓòÉΓòÉΓòÉ 18.11. rewind() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- void rewind (FILE *stream);
-
- Move the file pointer of STREAM to the beginning of the file and clear the
- error and end-of-file indicators.
-
- See also: fseek()
-
-
- ΓòÉΓòÉΓòÉ 18.12. rewinddir() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 18.13. _rfnlwr() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 18.14. rindex() ΓòÉΓòÉΓòÉ
-
- #include <strings.h> [BSD]
-
- char *rindex (const char *string, int c);
-
- Return a pointer to the last occurrence of the character C in the
- null-terminated string STRING. If there is no character C in STRING, NULL
- is returned. If C is 0, a pointer to the terminating null character of
- STRING is returned.
-
- See also: index() , strrchr()
-
-
- ΓòÉΓòÉΓòÉ 18.15. rint() ΓòÉΓòÉΓòÉ
-
- #include <math.h>
-
- double rint (double x);
-
- Return as floating-point number the integer that is nearest to X. If
- there's a tie, that is, fabs(rint(x)-x) == 0.5, rint(x) is even.
-
- See also: ceil() , floor() , trunc()
-
-
- ΓòÉΓòÉΓòÉ 18.16. rmdir() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [BSD]
-
- int rmdir (const char *name);
-
- Remove the directory NAME. Only one directory is removed in one step. If
- NAME (or a subdirectory of NAME) is the current working directory of a
- process, it cannot be removed. On success, 0 is returned. On failure, -1
- is returned.
-
- See also: mkdir()
-
-
- ΓòÉΓòÉΓòÉ 18.17. _rmtmp() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int _rmtmp (void);
-
- Close and delete the files created by tmpfile() in the current working
- directory. It must be used only in the directory in which tmpfile()
- created the temporary files. The number of closed (and deleted) files is
- returned.
-
- See also: tmpfile()
-
-
- ΓòÉΓòÉΓòÉ 19. function s ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter s
-
-
- ΓòÉΓòÉΓòÉ 19.1. sbrk() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- void *sbrk (int incr);
-
- Change memory allocation by INCR bytes. If INCR is positive, the memory
- limit is increased. If INCR is negative, the memory limit is decreased
- (not yet completely implemented). On success, sbrk() returns the previous
- memory limit. Otherwise, -1 cast as pointer is returned and errno set to
- ENOMEM. Please don't use sbrk() -- use malloc() instead for memory
- allocation.
-
- See also: brk() , malloc()
-
-
- ΓòÉΓòÉΓòÉ 19.2. scanf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int scanf (const char *format, ...);
-
- The stream STREAM is read and input is parsed according to the format
- string FORMAT. For each field in FORMAT there must be a pointer to the
- location receiving the value. The pointers are passed after the FORMAT
- argument.
-
- Whitespace in FORMAT matches whitespace in the input. All other
- characters except for % are compared to the input. Parsing ends if a
- mismatch is encountered. %% in FORMAT matches % in the input. A % which
- is not followed by another % or the end of the string starts a field
- specification. The field in the input is interpreted according to the
- field specification. For most field types, whitespace is ignored at the
- start of a field. Field specifications have the format
-
- %[*][width][size]type
-
- where items in brackets are optional. If the * is present, the value is
- not assigned. No pointer will be fetched from the argument list.
-
- WIDTH is a positive integral decimal number specifying the maximum field
- width. At most this many characters are read for this field.
-
- SIZE is either h for a `short' type or l for a `long' type. If SIZE is
- omitted, the default size is used.
-
- TYPE is one of the following characters:
-
- c character. Whitespace is not skipped (char)
-
- d decimal integer (int)
-
- e f g floating-point value (float)
-
- E F G floating-point value (float)
-
- i decimal, octal or hexadecimal integer (int)
-
- n number of characters read so far (int). Doesn't take input
-
- o octal integer (int)
-
- s string (char *)
-
- x hexadecimal integer (int)
-
- [ string (char *) [...]
-
- Note: Use %lf for variables of type `double'.
-
- On success, the number of fields converted is returned. Otherwise, EOF is
- returned.
-
- See also: fgets() , fread() , fscanf() , printf() , sscanf() , vscanf()
-
-
- ΓòÉΓòÉΓòÉ 19.3. _scrsize() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [*] [emx]
-
- void _scrsize (int *dst);
-
- Retrieve the screen (window) size. The number of text columns (width) is
- stored to DST[0], the number of text rows (height) is stored to DST[1].
-
- Restriction: When using the system call library libsys.lib (-Zsys), this
- function always sets DST[0] to 80 and DST[1] to 25.
-
- See also: v_dimen()
-
-
- ΓòÉΓòÉΓòÉ 19.4. _searchenv() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- void _searchenv (const char *name, const char *var, char *path);
-
- Search a file in the directories listed in an environment variable.
- First, the file name NAME is tried as is. If that file does not exist,
- the directories listed in the environment variable VAR are searched. If
- the file is found, the constructed path name (either NAME or a directory
- plus NAME) will be copied to PATH. If the file is not found, PATH will be
- the empty string.
-
- See also: getenv() , _path()
-
-
- ΓòÉΓòÉΓòÉ 19.5. seekdir() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.6. _seek_hdr() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [emx]
-
- int _seek_hdr (int handle);
-
- Move the file pointer of HANDLE to the a.out header of an executable file
- (a.out or bound .exe). _seek_hdr() assumes that the file pointer points
- to the beginning of the header (ie, the beginning of the file). If there
- is an error, _seek_hdr() sets errno and returns -1. If no header is
- found, the file pointer will be repositioned to the original position.
-
- See also: _fseek_hdr()
-
-
- ΓòÉΓòÉΓòÉ 19.7. select() ΓòÉΓòÉΓòÉ
-
- #include <sys/types.h> [*] [BSD]
- #include <sys/time.h>
- #include <io.h>
-
- int select (int nfds, struct _fd_set *readfds, struct _fd_set *writefds,
- struct _fd_set *exceptfds, struct timeval *timeout);
-
- Wait for a file handle to become ready. select() returns as soon as
- there's data ready to be read from a handle in READFDS. If TIMEOUT is
- NULL, select() waits indefinitely. Otherwise, waiting terminates after
- the time-out value given by TIMEOUT. NFDS is the number of handles to be
- checked. select() returns the number of ready handles and updates READFDS
- to include only the ready handles. On time out, 0 is returned. On
- failure, -1 is returned.
-
- The following macros are available for handling the bitstrings used by
- select():
-
- FD_ZERO(s) clear all bits of S
-
- FD_SET(n,s) set bit N in S
-
- FD_CLR(n,s) clear bit N in S
-
- FD_ISSET(n,s) Return a non-zero value iff bit N is set in S
-
- select() is implemented for the following types of handles:
-
- - stdin handles (keyboard) with IDEFAULT not set (DOS: handle 0 only).
- Note that if ICANON is set, read() has to wait until the line is
- completed
-
- - named pipes
-
- - pipes created with pipe() by programs using emx.dll
-
- - all file handles under DOS
-
- Restrictions: WRITEFDS and EXCEPTFDS are ignored. When using the system
- call library libsys.lib (-Zsys), select() is not available.
-
- See also: ioctl() , pipe()
-
-
- ΓòÉΓòÉΓòÉ 19.8. setbuf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int setbuf (FILE *stream, char *buffer);
-
- Associate the buffer BUFFER (of size BUFSIZ) with STREAM. This must be
- done before the file has been read or written. If BUFFER is NULL, the
- file is unbuffered. You should use setvbuf() instead.
-
- BSD setbuf() seems to have an `int' return value, therefore emx setbuf()
- has an `int' return value. This should not break programs which expect
- `void setbuf()'.
-
- See also: setbuffer() , setvbuf()
-
-
- ΓòÉΓòÉΓòÉ 19.9. setbuffer() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- int setbuffer (FILE *stream, char *buffer, size_t size);
-
- Associate the buffer BUFFER (of size SIZE) with STREAM. This must be done
- before the file has been read or written. If BUFFER is NULL, the file is
- unbuffered. You should use setvbuf() instead.
-
- BSD setbuffer() seems to have an `int' return value, therefore emx
- setbuffer() has an `int' return value. This should not break programs
- which expect `void setbuffer()'.
-
- See also: setvbuf()
-
-
- ΓòÉΓòÉΓòÉ 19.10. setjmp() ΓòÉΓòÉΓòÉ
-
- #include <setjmp.h> [ANSI]
-
- int setjmp (jmp_buf here);
-
- Save the current stack context in HERE and return 0. Later, you can
- continue at this point by calling longjmp(). When execution continues at
- setjmp() after calling longjmp(), the second argument of longjmp() is
- returned, which is always non-zero.
-
- See also: longjmp()
-
-
- ΓòÉΓòÉΓòÉ 19.11. setlocale() ΓòÉΓòÉΓòÉ
-
- #include <locale.h> [ANSI]
-
- char *setlocale (int category, const char *locale);
-
- Not implemented.
-
-
- ΓòÉΓòÉΓòÉ 19.12. setmode() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
- #include <fcntl.h>
-
- int setmode (int handle, int mode);
-
- Change the text/binary mode of a file handle. MODE must be either
- O_BINARY or O_TEXT. If there's an error, setmode() returns -1 and sets
- errno to EBADF or EINVAL otherwise setmode() returns the previous mode,
- that is, O_BINARY or O_TEXT.
-
- Note: Use _fsetmode() to change the mode of a stream.
-
- See also: _fsetmode() , open()
-
-
- ΓòÉΓòÉΓòÉ 19.13. settimeofday() ΓòÉΓòÉΓòÉ
-
- #include <sys/time.h> [BSD]
-
- int settimeofday (const struct timeval *tp, const struct timezone *tzp);
-
- Not implemented.
-
-
- ΓòÉΓòÉΓòÉ 19.14. setvbuf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int setvbuf (FILE *stream, char *buffer, int mode, size_t size);
-
- Set the buffering mode of STREAM to MODE, using the buffer BUFFER of size
- SIZE bytes. Available modes are:
-
- _IONBF the file is unbuffered, BUFFER and SIZE are ignored
-
- _IOFBF the file is full buffered
-
- _IOLBF the file is line buffered
-
- The file must not have been read or written since it was opened.
-
- If BUFFER is NULL, a buffer of SIZE bytes is allocated by setvbuf() using
- malloc() unless MODE is _IONBF.
-
- When reading a file, _IOFBF and _IOLBF are equivalent. Each time a
- newline character is written to a line-buffered file, the buffer is
- flushed. The buffer is also flushed if it becomes full while writing.
- The buffer is filled by reading from the disk file (or device) if the
- buffer becomes empty while reading.
-
- On success, 0 is returned. On failure, a non-zero value is returned.
-
- See also: fflush()
-
-
- ΓòÉΓòÉΓòÉ 19.15. _sfnlwr() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.16. signal () ΓòÉΓòÉΓòÉ
-
- #include <signal.h> [ANSI]
-
- void (*signal (int sig, void (*handler)()))(int sig);
-
- Install the signal handler HANDLER for signal SIG. You can install the
- default signal handler by using SIG_DFL for HANDLER. You can cause the
- signal to be ignored by using SIG_IGN for HANDLER. SIG must not be
- SIGKILL. Some systems reset a signal to SIG_DFL before calling the signal
- handler. emx doesn't. SIG_ACK is used instead: Once a signal handler for
- a specific signal has been called, that signal is disabled until
- acknowledged. You can acknowledge a signal by calling
-
- signal (signal_number, SIG_ACK).
-
- Only one signal of any type may be pending. (May change in the future.)
- The default processing for all signals except for SIGCLD is to terminate
- the process. If a signal which isn't ignored (that is, SIG_DFL or handler
- installed) occurs while calling read() with `termio' enabled (see below),
- -1 will be returned by read() and errno will be set to EINTR. The buffer
- will flushed. Do not use floating point math in a signal handler if the
- signal handler will return to the interrupted code. File i/o in the
- signal handler is also dangerous because a file i/o function could have
- been interrupted by the signal.
-
- If successful, signal() returns the previous signal handler (includes
- SIG_IGN and SIG_DFL) defined for signal SIG. On failure, SIG_ERR is
- returned.
-
- Restrictions: SIGPIPE is not yet implemented. When using the system call
- library libsys.lib (-Zsys), SIGALRM and SIGCLD don't occur.
-
- See also: abort() , kill() , raise()
-
-
- ΓòÉΓòÉΓòÉ 19.17. sin() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.18. sinh() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.19. sleep() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- unsigned sleep (unsigned sec);
-
- Suspend the calling process for SEC seconds. Currently, sleep() doesn't
- get interrupted by SIGALRM and always returns 0. SEC should not exceed
- 4294967.
-
- See also: alarm() , _sleep2()
-
-
- ΓòÉΓòÉΓòÉ 19.20. _sleep2() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- unsigned _sleep2 (unsigned millisec);
-
- Suspend the calling process for MILLISEC milliseconds. Currently,
- _sleep2() doesn't get interrupted by SIGALRM and always returns 0. As the
- system clock is used for timing, the actual duration of the time interval
- depends on the granularity of the system clock. The time interval is
- rounded up to the next clock tick. Also note that calling _sleep2()
- involves an overhead.
-
- See also: alarm() , sleep()
-
-
- ΓòÉΓòÉΓòÉ 19.21. sopen() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
- #include <share.h>
-
- int sopen (const char *name, int oflag, int shflag, ...);
-
- Open a file or device with an explicit sharing mode. NAME is the name of
- the file or device. OFLAG contains one or more of the following values,
- combined by the | operator:
-
- O_RDONLY Open for reading. Writing is not allowed
-
- O_WRONLY Open for writing. Reading is not allowed
-
- O_RDWR Open for reading and writing
-
- O_APPEND Move the file pointer to the end of file before any write
- operation takes place. This is used for appending to a
- file
-
- O_CREAT Create the file if it does not exist
-
- O_TRUNC Truncate the size of the file to 0
-
- O_EXCL Fail if the O_CREAT is used and the file already exists
-
- O_NDELAY Currently ignored.
-
- O_BINARY Binary mode, no translation. See below
-
- O_TEXT Text mode, translate CR/LF to LF. See below
-
- If a new file is created, PMODE (modified by the umask value), is used to
- set the file permissions. S_IREAD grants read access, S_IWRITE grants
- write access. S_IREAD is ignored (DOS and OS/2 limitation).
-
- There are two additional OFLAG flags: O_TEXT for text mode, O_BINARY for
- binary mode. Text mode, which is the default, translates each CR/LF pair
- to a LF character on input and translates LF characters to CR/LF pairs on
- output. If the last character of a file is Ctrl-Z, it is discarded on
- input. Binary mode disables these transformations.
-
- If the file or device cannot be opened, open() sets errno and returns -1.
- If open() succeeds, the file handle is returned. The file handle is
- always greater than -1.
-
- The mode O_TRUNC|O_RDONLY is not implemented. The mode O_TEXT|O_WRONLY
- does not overwrite a Ctrl-Z at the end of the file -- this causes problems
- when appending. Ctrl-Z at the end of the file is obsolete, anyway.
-
- The sharing mode of the file is given by SHFLAG. The following sharing
- modes are available:
-
- SH_DENYRW Deny read and write access
- SH_DENYRD Deny read access (permit write access)
- SH_DENYWR Deny write access (permit read access)
- SH_DENYNO Deny nothing (permit read and write access)
-
- See also: close() , fdopen() , open()
-
-
- ΓòÉΓòÉΓòÉ 19.22. spawn() ΓòÉΓòÉΓòÉ
-
- #include <process.h> [*] [PC]
-
- /* spawn() */
-
- int spawnl (int mode, const char *name, const char *arg0, ...);
- int spawnle (int mode, const char *name, const char *arg0, ...);
- int spawnlp (int mode, const char *name, const char *arg0, ...);
- int spawnlpe (int mode, const char *name, const char *arg0, ...);
- int spawnv (int mode, const char *name, const char * const *argv);
- int spawnve (int mode, const char *name, const char * const *argv,
- const char * const *envp);
- int spawnvp (int mode, const char *name, const char * const *argv);
- int spawnvpe (int mode, const char *name, const char * const *argv,
- const char * const *envp);
-
- Run a process. NAME is the name of the executable file to run. Use
- spawnl(), spawnle(), spawnlp() or spawnlpe() for passing a fixed number of
- arguments. ARG0 is the 0th argument which is the program name, by
- convention. Following ARG0, the arguments are given. After the last
- argument, a NULL pointer must be following. At least ARG0 must be
- specified. Use spawnv(), spawnve(), spawnvp() or spawnvpe() for passing a
- variable number of arguments. ARGV points to an array of strings. The
- first entry is the program name, by convention. The last argument must be
- followed by a NULL pointer.
-
- spawnl(), spawnlp(), spawnv() and spawnvp() pass the environment of the
- current process to the child process. To pass a different environment to
- the child process pass a pointer to an array of strings after the NULL
- argument pointer of spawnle() and spawnlpe() or pass the pointer in the
- ENVP argument of spawnve() and spawnvpe(). The last environment string in
- the array must be followed by a NULL pointer.
-
- The MODE argument specifies how to run the child process. The following
- values are available:
-
- P_WAIT run the process synchronously, that is, control returns to
- the parent process after the child process finishes
-
- P_NOWAIT run the process asynchronously, that is in parallel with
- the parent process. P_NOWAIT is not implemented for DOS
-
- P_OVERLAY replace the parent process, that is, run the child process
- and terminate the parent process
-
- P_DEBUG run the process in debugging mode, that is, under control
- of the parent process. Use ptrace() to control the child
- process
-
- P_DETACH run the process detached, that is, without input and
- output. P_DETACH is not available under DOS
-
- P_SESSION run the process in a separate session. P_SESSION is not
- available under DOS.
-
- Additional flags are available for P_SESSION, which can be added by using
- the | operator. Use one of the following for selecting the session type:
-
- P_DEFAULT let the operating system choose the session type
-
- P_FULLSCREEN start a full-screen session
-
- P_WINDOWED start a windowed session
-
- These flags control the initial appearance of the window:
-
- P_MINIMIZE minimize the window
-
- P_MAXIMIZE maximize the window
-
- Additionally, you can use the following flags:
-
- P_BACKGROUND start the session in the background
-
- P_FOREGROUND start the session in the foreground. This works only if the
- calling session is in the foreground. P_FOREGROUND is the default
-
- P_NOCLOSE don't close the window automatically when the process ends
-
- When the new process terminates, SIGCLD is raised in the process which
- started that process. This does not apply to P_WAIT, P_OVERLAY and
- P_DETACH.
-
- Return value: the return value of the child process (P_WAIT) or the
- process ID of the child process (P_NOWAIT and P_DEBUG) if successful.
- Otherwise -1.
-
- Restrictions: When running a (native) DOS program, the environment of emx,
- not that of the process calling spawn() will be inherited. The command
- line length is restricted to 126 characters when running DOS programs.
- DOS programs can only be run in P_WAIT mode. P_NOWAIT is not implemented
- under DOS. The default extension is .exe; if you want to run a .com file,
- explicitly add .com. Currently, DOS seems to crash if you try to spawn a
- .COM file without using emx option -p, see `Using emx options'. (The
- machine crashes on the second attempt.) When using the system call
- library libsys.lib (-Zsys), only modes P_WAIT, P_NOWAIT and P_OVERLAY are
- currently available. SIGCLD is not implemented under DOS.
-
- See also: exit() , ptrace() , system() , wait()
-
-
- ΓòÉΓòÉΓòÉ 19.23. _splitargs() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char **_splitargs (char *string, int *count);
-
- Parse STRING like a command line and build a vector of pointers to the
- arguments. The vector is terminated by a NULL pointer. The number of
- arguments is stored to the variable pointed to by COUNT unless COUNT is
- NULL. STRING is modified by _splitargs(), the pointers in the resulting
- vector point into STRING. _splitargs() allocates the vector using
- malloc(). If you no longer need the vector, use free() to deallocate it.
- On error, _splitargs() sets errno and returns NULL.
-
- Arguments in STRING are separated by whitespace (one or more blanks, tabs
- and linefeeds). Whitespace at the start of STRING is skipped. To include
- blanks, tabs or linefeeds in an argument, the argument must be quoted
- using double quotation marks. To remove the special meaning of a double
- quote, precede it with a backslash. To remove the special meaning of a
- backslash in front of a double quote, precede the backslash with a
- backslash. The backslash character doesn't have a special meaning unless
- it precedes a double quote or any number of backslashes followed by a
- double quote.
-
- In other words: If there are n backslashes (\) immediately preceding a
- double quote character ("), floor(n/2) backslashes are put into the
- argument. If n is odd, the double quote character is put into the
- argument. If n is even (including zero), the double quote character is
- used for quoting, that is, spaces are not treated as argument delimiters
- until the next `quoting' double quote character (ie, a double quote
- character immediately preceded by an even number (including zero) of
- backslashes) is found. Backslashes not preceding a quote character are
- always read as backslashes.
-
- See also: popen() , system()
-
-
- ΓòÉΓòÉΓòÉ 19.24. _splitpath() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [PC]
-
- void _splitpath (const char *src, char *drive, char *dir, char *fname,
- char *ext);
-
- Split the path name SRC into its components. The drive name (including
- the colon) is stored to DRIVE. The directory (including the final slash
- or backslash) is copied to DIR, the file name without extension is copied
- to FNAME, the extension (including the dot) is copied to EXT. The buffers
- should be of size _MAX_DRIVE, _MAX_DIR, _MAX_FNAME and _MAX_EXT,
- respectively. These constants include the terminating null characters. If
- one of the pointers (except for SRC) is NULL, that component is not
- stored.
-
- Example:
-
- char drive[_MAX_DRIVE], dir[_MAX_DIR];
- char fname[_MAX_FNAME], ext[_MAX_EXT];
- char *path = "c:/files/more/test.file.c";
-
- _splitpath (path, drive, dir, fname, ext);
-
- Results of the example:
-
- drive = "c:"
- dir = "/files/more/"
- fname = "test.file"
- ext = ".c"
-
- See also: _fngetdrive() , _getext() , _getname()
-
-
- ΓòÉΓòÉΓòÉ 19.25. sprintf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int sprintf (char *buffer, const char *format, ...);
-
- Formatted output to the string BUFFER. The string must be big enough to
- hold the output. On success, the number of characters copied to BUFFER
- (excluding the terminating null character) is returned. Otherwise, EOF is
- returned.
-
- See also: printf() , sscanf()
-
-
- ΓòÉΓòÉΓòÉ 19.26. sqrt() ΓòÉΓòÉΓòÉ
-
- #include <math.h> [ANSI]
-
- double sqrt (double x);
-
- Compute and return the square root of X. If X is negative, +#NAN is
- returned and errno set to EDOM.
-
- See also: cbrt() , pow()
-
-
- ΓòÉΓòÉΓòÉ 19.27. srand() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.28. sscanf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int sscanf (const char *buffer, const char *format, ...);
-
- Parse BUFFER according to the format string FORMAT. For each field in
- FORMAT there must be a pointer to the location receiving the value. The
- pointers are passed after the FORMAT argument. On success, the number of
- fields converted is returned. Otherwise, EOF is returned.
-
- See also: scanf() , sprintf()
-
-
- ΓòÉΓòÉΓòÉ 19.29. stat() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
- #include <sys/types.h>
- #include <sys/stat.h>
-
- int stat (const char *name, struct stat *buffer);
-
- Retrieve information about the file or directory NAME. stat() will put
- the data into the structure pointed to by BUFFER.
-
- Restrictions: st_dev and st_rdev are set to zero. Each call to stat()
- returns a different value for st_ino.
-
- See also: fstat()
-
-
- ΓòÉΓòÉΓòÉ 19.30. strcat() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strcat (char *string1, const char *string2);
-
- Append the null-terminated string STRING2 to the null-terminated string
- STRING1 and return STRING1. The strings must not overlap.
-
- See also: strcpy()
-
-
- ΓòÉΓòÉΓòÉ 19.31. strchr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strchr (const char *string, int c);
-
- Return a pointer to the first occurrence of the character C in the
- null-terminated string STRING. If there is no character C in STRING, NULL
- is returned. If C is 0, a pointer to the terminating zero of STRING is
- returned.
-
- See also: index() , memchr() , strrchr() , strstr()
-
-
- ΓòÉΓòÉΓòÉ 19.32. strcmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- int strcmp (const char *string1, const char *string2);
-
- Compare the null-terminated strings STRING1 and STRING2. If STRING1 is
- less than STRING2, a negative value is returned. If STRING1 is equal to
- STRING2, zero is returned. If STRING1 is greater than STRING2, a positive
- value is returned.
-
- See also: memcmp() , stricmp() , strncmp()
-
-
- ΓòÉΓòÉΓòÉ 19.33. strcoll() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- int strcoll (const char *string1, const char *string2);
-
- Not implemented.
-
- See also: strcmp()
-
-
- ΓòÉΓòÉΓòÉ 19.34. strcpy() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strcpy (char *string1, const char *string2);
-
- Copy the null-terminated string STRING2 to STRING1 and return STRING1.
- The strings must not overlap.
-
- See also: memccpy() , memcpy() , strcat() , strncpy()
-
-
- ΓòÉΓòÉΓòÉ 19.35. strcspn() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- size_t strcspn (const char *string1, const char *string2);
-
- Return the length of the initial substring of STRING1 which consists of
- characters not in STRING2. That is, the index of the first character in
- STRING1 which also occurs in STRING2 is returned. If all characters of
- STRING1 are not in STRING2, the length of STRING1 is returned.
-
- See also: strpbrk() , strspn()
-
-
- ΓòÉΓòÉΓòÉ 19.36. strdup() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [UNIX]
-
- char *strdup (const char *string);
-
- Creates a duplicate of STRING by using malloc() to allocate storage and
- copying STRING. A pointer to the new string is returned. If there is not
- enough memory, NULL is returned.
-
- See also: malloc() , strcpy()
-
-
- ΓòÉΓòÉΓòÉ 19.37. strerror() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strerror (int errnum);
-
- Return a pointer to a an error message according to the error number
- ERRNO. You must not write to the string returned by strerror(). The
- string may get changed by the next call to strerror().
-
- See also: errno , perror() , sys_errlist
-
-
- ΓòÉΓòÉΓòÉ 19.38. strftime() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- size_t strftime (char *string, size_t size, const char *format,
- const struct tm *t);
-
- Format time. The output string is written to the buffer STRING of SIZE
- characters, including the terminating null character. Like sprintf(),
- strftime() copies FORMAT to STRING, replacing format specifications with
- formatted data from T. Ordinary characters are copied unmodified. The
- following format specifications are available:
-
- %% percent sign
-
- %a locale's abbreviated weekday name
-
- %A locale's full weekday name
-
- %b locale's abbreviated month name
-
- %B locale's full month name
-
- %c locale's date and time (this is currently equivalent to %a %b %d
- %H:%M:%S %Y)
-
- %d day of month (01-31)
-
- %D date, this is equivalent to %m/%d/%y
-
- %e day of month ( 1-31), blank padded
-
- %h locale's abbreviated month name
-
- %H hour (00-23)
-
- %I hour (01-12)
-
- %j day of year (001-366)
-
- %m month (01-12)
-
- %M minute (00-59)
-
- %n newline character
-
- %p locale's equivalent to AM or PM, as appropriate
-
- %r time in AM/PM notation, this is equivalent to %I:%M:%S %p
-
- %S second (00-59)
-
- %t TAB character
-
- %T time, this is equivalent to %H:%M:%S
-
- %U week number of the year, the first day of the week is Sunday
- (00-53)
-
- %w weekday, the first day of the week is Sunday (0-6)
-
- %W week number of the year, the first day of the week is Monday
- (00-53)
-
- %x locale's date representation (this is currently equivalent to
- %m/%d/%y)
-
- %X locale's time representation (this is currently equivalent to
- %H:%M:%S)
-
- %y year without century (00-99)
-
- %Y year with century (1970-2038)
-
- %Z timezone name (taken from the timezone variable, as the timezone
- isn't provided by T)
-
- If % is followed by a character not listed above, the results are
- undefined.
-
- On success, the number of characters copied to STRING, excluding the
- terminating null character, is returned. On failure (SIZE exceeded), 0 is
- returned.
-
- Restrictions: locales are not yet implemented.
-
- See also: asctime() , sprintf()
-
-
- ΓòÉΓòÉΓòÉ 19.39. stricmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- int stricmp (const char *string1, const char *string2);
-
- Compare STRING1 and STRING2, ignoring letter case. If the strings are
- equal, 0 is returned. Otherwise, a positive value is returned if STRING1
- is greater than STRING2 (after conversion to lower case). A negative
- value is returned if STRING1 is less than STRING2 (after conversion to
- lower case).
-
- See also: strcmp() , tolower()
-
-
- ΓòÉΓòÉΓòÉ 19.40. strlen() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- size_t strlen (const char *string);
-
- Returns the length (number of characters) of the string STRING. The length
- does not include the terminating null character.
-
- See also: strchr()
-
-
- ΓòÉΓòÉΓòÉ 19.41. strlwr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- char *strlwr (char *string);
-
- Converts the string STRING to lower case. The characters 'A' through 'Z'
- are mapped to the characters 'a' through 'z'. All other characters are
- not changed. The STRING argument is returned.
-
- See also: _fnlwr() , strupr()
-
-
- ΓòÉΓòÉΓòÉ 19.42. strncat() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strncat (char *string1, const char *string2, size_t count);
-
- Append the null-terminated string STRING2 to the null-terminated string
- STRING1. At most COUNT characters of STRING2 are appended to STRING1.
- strncat() terminates the new value of STRING1 with a null character.
- STRING1 is returned.
-
- See also: strcat() , strncpy()
-
-
- ΓòÉΓòÉΓòÉ 19.43. strncmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- int strncmp (const char *string1, const char *string2, size_t count);
-
- Compare the null-terminated strings STRING1 and STRING2. At most the
- first COUNT characters are compared. If STRING1 is less than STRING2, a
- negative value is returned. If STRING1 is equal to STRING2, zero is
- returned. If STRING1 is greater than STRING2, a positive value is
- returned.
-
- See also: memcmp() , strcmp() , strnicmp()
-
-
- ΓòÉΓòÉΓòÉ 19.44. strncpy() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strncpy (char *string1, const char *string2, size_t count);
-
- Copy the null-terminated string STRING2 to STRING1 and return STRING1.
- The strings must not overlap. At most the first COUNT characters of
- STRING2 are copied. If STRING2 is shorter than COUNT characters, STRING1
- is padded with null characters to COUNT characters. A terminating null
- character is always appended.
-
- See also: strcpy() , strncat()
-
-
- ΓòÉΓòÉΓòÉ 19.45. _strncpy() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [emx]
-
- char *_strncpy (char *string1, const char *string2, size_t size);
-
- Copy the null-terminated string STRING2 to STRING1 and return STRING1.
- The strings must not overlap. At most SIZE characters, including the
- terminating null character, are copied to STRING1. A terminating null
- character is always appended, even if STRING2 is too long.
-
- See also: strcpy() , strncpy()
-
-
- ΓòÉΓòÉΓòÉ 19.46. strnicmp() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- int strnicmp (const char *string1, const char *string2, size_t count);
-
- Compare the null-terminated strings STRING1 and STRING2 ignoring letter
- case. At most the first COUNT characters are compared. If STRING1 is
- equal to STRING2, zero is returned. If STRING1 is less than STRING2
- (after conversion to lower case), a negative value is returned. If
- STRING1 is greater than STRING2 (after conversion to lower case), a
- positive value is returned.
-
- See also: memicmp() , strcmp() , strncmp() , tolower()
-
-
- ΓòÉΓòÉΓòÉ 19.47. strnset() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- char *strnset (char *string, int c, size_t count);
-
- Set, at most, the first COUNT characters of STRING to the character C and
- return STRING. If the length of STRING is less than COUNT, strnset()
- stops at the terminating null character.
-
- See also: memset() , strset()
-
-
- ΓòÉΓòÉΓòÉ 19.48. strpbrk() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strpbrk (const char *string1, const char *string2);
-
- Return a pointer to the first occurrence in STRING1 of a character of
- STRING2. The terminating null character is not included in the search.
- If no character of STRING2 can be found in STRING1, NULL is returned.
-
- See also: strchr() , strcspn()
-
-
- ΓòÉΓòÉΓòÉ 19.49. strrchr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strrchr (const char *string, int c);
-
- Return a pointer to the last occurrence of the character C in the
- null-terminated string STRING. If there is no character C in STRING, NULL
- is returned. If C is 0, a pointer to the terminating null character of
- STRING is returned.
-
- See also: rindex() , strchr()
-
-
- ΓòÉΓòÉΓòÉ 19.50. strrev() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- char *strrev (char *string);
-
- Reverse the order of the characters in STRING return STRING. The
- terminating null character remains in place.
-
-
- ΓòÉΓòÉΓòÉ 19.51. strset() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- char *strset (char *string, int c);
-
- Replace all the characters of STRING with the character C. The
- terminating null character is not changed.
-
- See also: memset() , strnset()
-
-
- ΓòÉΓòÉΓòÉ 19.52. strspn() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- size_t strspn (const char *string1, const char *string2);
-
- Return the length of the initial substring of STRING1 which consists
- entirely of characters in STRING2. That is, the index of the first
- character in STRING1 which does not occur in STRING2 is returned. If all
- characters in STRING1 also occur in STRING2, the length of STRING1 is
- returned.
-
- See also: strcspn() , strpbrk()
-
-
- ΓòÉΓòÉΓòÉ 19.53. strstr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strstr (const char *string1, const char *string2);
-
- Return a pointer to the first occurrence of STRING2 in STRING1. If the
- length of STRING2 is zero, STRING1 is returned. If STRING2 is not a
- substring of STRING1, NULL is returned.
-
- See also: strchr()
-
-
- ΓòÉΓòÉΓòÉ 19.54. strtod() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- double strtod (const char *string, char **end_ptr);
-
- Convert ASCII representation of a number to a double. Leading white space
- is skipped. strtod() stops at the first character that cannot be
- converted. If END_PTR is not NULL, a pointer to that character is stored
- to *END_PTR. strtod() sets errno and returns 0.0 on failure, sets errno
- and returns +#NAN or -#NAN on overflow. The string pointed to by STRING
- is expected to have the following form:
-
- [whitespace] [+|-] [digits] [.digits] [[d|D|e|E] [+|-] digits]
-
- See also: sscanf()
-
-
- ΓòÉΓòÉΓòÉ 19.55. strtok() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [ANSI]
-
- char *strtok (char *string1, const char *string2);
-
- Return a pointer to the next token in STRING1. The characters of STRING2
- are the set of delimiting characters. Tokens in STRING1 are separated by
- one or more characters from STRING2.
-
- The first call to strtok() for STRING1 skips leading delimiters and
- returns a pointer to the first token. To get the next token of STRING1,
- call strtok() with a NULL argument for STRING1. STRING2, the set of
- delimiters, may be different on subsequent calls.
-
- strtok() modifies the string STRING1 by inserting null characters for
- terminating tokens. Thus, the pointer returned by strtok() points to a
- null-terminated token.
-
- If there are no more tokens, NULL is returned.
-
-
- ΓòÉΓòÉΓòÉ 19.56. strtol() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- long strtol (const char *string, char **end_ptr, int radix);
-
- Convert ASCII representation of a number to a signed long integer. Leading
- white space is skipped. RADIX is the number base used for conversion. It
- must either be between 2 and 36 or be zero. If RADIX is 0, the number
- base is derived from the format of the number. If the number starts with
- `0x', base 16 is used. If the number starts with `0' (not followed by
- `x'), base 8 used. If the number does not start with `0', base 10 is
- used. strtol() stops at the first character that cannot be converted. If
- END_PTR is not NULL, a pointer to that character is stored to *END_PTR.
- strtol() sets errno and returns 0 on failure, sets errno and returns
- LONG_MIN or LONG_MAX on overflow.
-
- See also: _ltoa() , strtoul() , sscanf()
-
-
- ΓòÉΓòÉΓòÉ 19.57. strtoul() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [ANSI]
-
- unsigned long strtoul (const char *string, char **end_ptr, int radix);
-
- Convert ASCII representation of a number to an unsigned long integer.
- Leading white space is skipped, a sign character is not allowed. RADIX is
- the number base used for conversion. It must either be between 2 and 36
- or be zero. If RADIX is 0, the number base is derived from the format of
- the number. If the number starts with `0x', base 16 is used. If the
- number starts with `0' (not followed by `x'), base 8 used. If the number
- does not start with `0', base 10 is used. strtoul() stops at the first
- character that cannot be converted. If END_PTR is not NULL, a pointer to
- that character is stored to *END_PTR. strtoul() sets errno and returns 0
- on failure, sets errno and returns ULONG_MAX on overflow.
-
- See also: _ultoa() , strtol() , sscanf()
-
-
- ΓòÉΓòÉΓòÉ 19.58. strupr() ΓòÉΓòÉΓòÉ
-
- #include <string.h> [PC]
-
- char *strupr (char *string);
-
- Converts the string STRING to upper case. The characters 'a' through 'z'
- are mapped to the characters 'A' through 'Z'. All other characters are
- not changed. The STRING argument is returned.
-
- See also: strlwr()
-
-
- ΓòÉΓòÉΓòÉ 19.59. swab() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [UNIX]
-
- void swab (const void *src, void *dst, size_t n);
-
- Copy N bytes from SRC to DST, swapping each pair of adjacent bytes. N
- must be even.
-
-
- ΓòÉΓòÉΓòÉ 19.60. _swchar() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- char _swchar (void);
-
- Retrieve the current switch character. If the switch character has been
- changed to '-', _swchar() returns '-'. Otherwise, _swchar() returns 0.
- In this case, you should use the standard switch character '/'.
-
- See also: getopt()
-
-
- ΓòÉΓòÉΓòÉ 19.61. _syserrno() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [*] [emx]
-
- int _syserrno (void);
-
- Return the OS/2 or DOS error code for the last system call of the current
- thread. If there was no error, 0 is returned. If the last system call
- hasn't called an OS/2 or DOS function, 0 is returned.
-
- Restrictions: Not implemented under DOS. When using the system call
- library libsys.lib (-Zsys), this function is not supported.
-
-
- ΓòÉΓòÉΓòÉ 19.62. system() ΓòÉΓòÉΓòÉ
-
- #include <process.h> [ANSI]
-
- int system (const char *name);
-
- Execute the command NAME by passing it to the command interpreter.
- system() uses the COMSPEC environment variable for locating cmd.exe or
- command.com, respectively. The PATH environment variable is not used for
- locating cmd.exe. If the argument is "", an interactive shell will be
- started. If the argument is NULL, system() only checks whether cmd.exe or
- command.com, respectively, can be found.
-
- When running a (native) DOS program, the environment of emx, not that of
- the process calling spawn() will be inherited. Because command.com is
- used under DOS, the command line is restricted to about 123 characters.
- If you don't need a command shell, use spawn() instead of system(). It's
- a bad idea to run emx programs using system() -- not tested. You must use
- the -p emx option when using system() under DOS, see `Using emx options'.
-
- If system() failed, errno is set and -1 is returned. If the argument is
- NULL and the command processor can be found, 0 is returned. In all other
- cases, the return code of the command processor is returned. The return
- code of the program run by the command processor is returned by cmd.exe
- but not by command.com. command.com always returns 0.
-
- See also: popen() , spawn() , _splitargs()
-
-
- ΓòÉΓòÉΓòÉ 19.63. tan() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 19.64. tanh() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 20. function t ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter t
-
-
- ΓòÉΓòÉΓòÉ 20.1. tell() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [PC]
-
- long tell (int handle);
-
- tell() returns the current position of the file pointer of HANDLE. If
- there is an error, tell() returns -1.
-
- See also: lseek()
-
-
- ΓòÉΓòÉΓòÉ 20.2. telldir() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 20.3. tempnam() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [UNIX]
-
- char *tempnam (const char *dir, const char *prefix);
-
- Generate the name suitable for a temporary file without overwriting an
- existing file. tempnam() returns a pointer to a string allocated by
- malloc(). If the TMP environment variable is set and the directory
- specified by TMP exists, that directory is used. Otherwise, the DIR
- argument is used. If DIR is NULL or the directory specified by DIR does
- not exist, P_tmpdir as defined in stdio.h is used. If even this fails,
- NULL is returned. The name of the file will start with PREFIX. PREFIX
- must not be longer than 5 characters.
-
- See also: tmpnam()
-
-
- ΓòÉΓòÉΓòÉ 20.4. time() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [ANSI]
-
- time_t time (time_t *ptr);
-
- Return the number of seconds elapsed since 00:00 GMT 1-Jan-1970. The
- system time is converted according to the local timezone. If PTR is not
- NULL, the result is also stored to the variable pointed to by PTR.
-
- See also: ftime() , gettimeofday()
-
-
- ΓòÉΓòÉΓòÉ 20.5. times() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [UNIX]
- #include <sys/times.h>
-
- long times (struct tms *buffer);
-
- Return the current time in CLK_TCK fractions of a second since 00:00 GMT
- 1-Jan-1970. Also sets the tms_utime field of BUFFER to the number of
- seconds the process has been running. The other fields are set to 0.
-
- Restriction: The return value is unusable due to overflow.
-
- See also: clock() , time()
-
-
- ΓòÉΓòÉΓòÉ 20.6. tmpfile() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- FILE *tmpfile (void);
-
- Create and open a temporary file. The name of the file is created with
- tmpnam(). The file is opened in "w+b" mode.
-
- On success, a stream pointer is returned. On failure, NULL is returned.
-
- See also: _rmtmp() , tmpnam()
-
-
- ΓòÉΓòÉΓòÉ 20.7. tmpnam() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- char *tmpnam (char *string);
-
- Create a unique file name and store it to STRING. There must be L_tmpnam
- bytes at STRING. If STRING is NULL, a static buffer is used which will be
- overwritten by subsequent calls. The file name is a concatenation of
- P_tmpdir and a sequence of digits.
-
- On success, a pointer to the new name is returned. On failure, NULL is
- returned.
-
- See also: tempnam() , tmpfile() , mktemp()
-
-
- ΓòÉΓòÉΓòÉ 20.8. tolower() ΓòÉΓòÉΓòÉ
-
- #include <ctype.h> [ANSI]
-
- int tolower (int c);
- int toupper (int c);
-
- tolower() converts the character C to lower case, if it is in the range
- 'A' ... 'Z'. toupper() converts the character C to upper case, if it is
- in the range 'a' ... 'z'.
-
- See also: stricmp() , strlwr() , strupr() , _tolower() , _toupper()
-
-
- ΓòÉΓòÉΓòÉ 20.9. _tolower() ΓòÉΓòÉΓòÉ
-
- #include <ctype.h> [UNIX]
-
- int _tolower (int c);
- int _toupper (int c);
-
- _tolower() converts the upper-case character C to lower case; C must be in
- the range 'A' through 'Z'. _toupper() converts the lower-case character C
- to upper case; C must be in the range 'a' through 'z'.
-
- See also: tolower() , toupper()
-
-
- ΓòÉΓòÉΓòÉ 20.10. toupper() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 20.11. _toupper() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 20.12. trunc() ΓòÉΓòÉΓòÉ
-
- #include <math.h>
-
- double trunc (double x);
-
- Return as floating-point number X chopped to an integer by truncating the
- fractional digits (rounding toward 0).
-
- See also: ceil() , floor() , modf() , rint()
-
-
- ΓòÉΓòÉΓòÉ 20.13. truncate() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [BSD]
-
- int truncate (char *name, long length);
-
- Truncate the file NAME to at most LENGTH bytes. If LENGTH is greater than
- the current length of the file, the length is not changed. If successful,
- 0 is returned. Otherwise, -1 is returned.
-
- See also: chsize() , ftruncate()
-
-
- ΓòÉΓòÉΓòÉ 20.14. tzset() ΓòÉΓòÉΓòÉ
-
- #include <time.h> [UNIX]
-
- void tzset (void);
-
- Set timezone according to the TZ environment variable. If you have a
- problem with a program interpreting TZ differently (for instance a program
- which supports day-light-saving time), set EMXTZ for emx programs. If
- EMXTZ is set, emx will use the value of EMXTZ instead of the value of TZ.
- The following global variables are set by tzset(): daylight, timezone,
- tzname. TZ has the following format:
-
- TZ1[offset][TZ2]
-
- Where TZ1 is the three-letter name of the local timezone, offset is the
- optional offset to GMT (hours; positive values are to the west of
- Greenwich) and TZ2 is the optional name of the day-light-saving timezone,
- which is currently ignored. Example: PST8PDT.
-
- If TZ is not set, GMT is used.
-
-
- ΓòÉΓòÉΓòÉ 20.15. _uldiv() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 21. function u ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter u
-
-
- ΓòÉΓòÉΓòÉ 21.1. ulimit() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [SysV]
-
- long ulimit (int request, long newlimit);
-
- Set or get process limits. The following REQUEST codes are implemented:
-
- 1 Return the maximum file size. Always returns 1 << 21.
-
- 2 Set the maximum file size to NEWLIMIT. Ignored. Returns
- NEWLIMIT.
-
- 3 Return the greatest possible break value
-
- 4 Return the number of files that can be open simultaneously per
- process. Always returns 40.
-
-
- ΓòÉΓòÉΓòÉ 21.2. _ulldiv() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 21.3. _ulltoa() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 21.4. _ultoa() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 21.5. umask() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int umask (int pmode);
-
- Set the file-permission mask of the current process to PMODE. The
- previous file-permission mask is returned. Only the S_IWRITE bit is used.
-
- Restrictions: The current file-permission mask is inherited by emx
- programs spawned under DOS. Under OS/2, the file-permission mask is not
- yet inherited. When spawning a non-emx program (such as command.com, see
- system()) which spawns an emx program, that program won't inherit the
- file-permission mask.
-
- See also: fopen() , open()
-
-
- ΓòÉΓòÉΓòÉ 21.6. uname() ΓòÉΓòÉΓòÉ
-
- #include <sys/utsname.h> [UNIX]
-
- int uname (struct utsname *name);
-
- Store information identifying the current system to the structure pointed
- to by NAME.
-
- This function returns 0 (always successful).
-
-
- ΓòÉΓòÉΓòÉ 21.7. ungetc() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int ungetc (int c, FILE *stream);
-
- Push back the character C onto STREAM and clear the end-of-file indicator.
- STREAM must be open for reading. The next read operation on STREAM starts
- with C. If C is EOF, nothing is done. Only one character can be pushed
- onto a stream. fflush(), fseek(), fsetpos() and rewind() undo ungetc().
- After a successful ungetc(), the value of the file pointer is undefined
- until the character has been read.
-
- On success, the character C is returned. On failure, EOF is returned.
-
- See also: fgetc() , fflush()
-
-
- ΓòÉΓòÉΓòÉ 21.8. unlink() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> /* use this */ [UNIX]
- #include <io.h> /* or this */
-
- int unlink (const char *name);
-
- Delete the file NAME. 0 is returned if successful, -1 if not.
-
- Under OS/2 and DOS, unlink() and remove() are equivalent.
-
- See also: remove()
-
-
- ΓòÉΓòÉΓòÉ 21.9. utime() ΓòÉΓòÉΓòÉ
-
- #include <sys/utime.h> [SysV]
-
- int utime (const char *name, const struct utimbuf *times);
-
- Set time stamp of file NAME to the access time and modification time given
- in TIMES. If TIMES is NULL, both the access time and the modification
- time are set to the current time.
-
- See also: stat() , utimes()
-
-
- ΓòÉΓòÉΓòÉ 21.10. utimes() ΓòÉΓòÉΓòÉ
-
- #include <sys/time.h> [BSD]
-
- int utimes (const char *name, const struct timeval *tvp);
-
- Set time stamp of file NAME to the access time given in TVP[0] and the
- modification time given in TVP[1]. If TVP is NULL, both the access time
- and the modification time are set to the current time.
-
- See also: stat() , utime()
-
-
- ΓòÉΓòÉΓòÉ 22. function v ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter v
-
-
- ΓòÉΓòÉΓòÉ 22.1. v_attrib() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_attrib (int a);
-
- Set the attributes (colors etc.) used by video library functions to A.
- You can make A by using the binary OR operator and the F_whatever,
- B_whatever, INTENSITY and BLINK constants.
-
- See also: v_init() , v_putc()
-
-
- ΓòÉΓòÉΓòÉ 22.2. v_backsp() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_backsp (int count);
-
- Backspace the cursor. The cursor is moved left by COUNT characters. If
- the cursor leaves the screen at the left edge, it is moved to the end of
- the previous line. The cursor cannot leave the screen at the top edge.
-
- See also: v_putc()
-
-
- ΓòÉΓòÉΓòÉ 22.3. v_clear() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_clear (void);
-
- Clear the screen using the current attributes.
-
- See also: v_attrib() , v_clreol()
-
-
- ΓòÉΓòÉΓòÉ 22.4. v_clreol() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_clreol (void);
-
- Clear the line from the current cursor position to the end of the current
- line using the current attributes.
-
- See also: v_attrib() , v_clear()
-
-
- ΓòÉΓòÉΓòÉ 22.5. v_ctype() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_ctype (int start, int end);
-
- Set the cursor type. START is the first row of the cursor, END is the
- last row of the cursor. Both values are zero-based. Use v_hardware() to
- determine the size of the character box.
-
- See also: v_getctype() , v_hardware() , v_hidecursor()
-
-
- ΓòÉΓòÉΓòÉ 22.6. v_delline() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_delline (int count);
-
- Delete COUNT lines at the current cursor position by moving up the lines
- below the current line. The current attributes are used for filling lines
- becoming empty at the bottom of the screen.
-
- See also: v_attrib() , v_insline() , v_scroll()
-
-
- ΓòÉΓòÉΓòÉ 22.7. v_dimen() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_dimen (int *width, int *height);
-
- Store the screen width (columns) to WIDTH, the screen height (lines) to
- HEIGHT.
-
- See also: _scrsize()
-
-
- ΓòÉΓòÉΓòÉ 22.8. vfprintf() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 22.9. vfscanf() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 22.10. v_getattr() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- int v_getattr (void);
-
- Return the current attributes.
-
- See also: v_attrib()
-
-
- ΓòÉΓòÉΓòÉ 22.11. v_getctype() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_getctype (int *start, int *end);
-
- Store the current cursor start and end rows to START and END.
-
- See also: v_ctype()
-
-
- ΓòÉΓòÉΓòÉ 22.12. v_getline() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_getline (char *dst, int x, int y, int count);
-
- Copy COUNT character/attributes pairs from the screen at position (X,Y) to
- DST. 2*COUNT bytes are copied. The cursor is not moved.
-
- See also: v_putline()
-
-
- ΓòÉΓòÉΓòÉ 22.13. v_getxy() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_getxy (int *x, int *y);
-
- Store the current cursor position to X (column) and Y (line).
-
- See also: v_gotoxy()
-
-
- ΓòÉΓòÉΓòÉ 22.14. v_gotoxy() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_gotoxy (int x, int y);
-
- Move the cursor to line Y, column X. Both values are zero-based. Line 0
- is the top line, column 0 is the left-most column.
-
- See also: v_getxy()
-
-
- ΓòÉΓòÉΓòÉ 22.15. v_hardware() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- int v_hardware (void);
-
- Return a value indicating the display adapter type. The following values
- are defined:
-
- V_MONOCHROME Monochrome display adapter
-
- V_COLOR_8 Color display adapter, the character box height is 8 scan
- lines
-
- V_COLOR_12 Color display adapter, the character box height is 12 scan
- lines
-
- See also: v_ctype()
-
-
- ΓòÉΓòÉΓòÉ 22.16. v_hidecursor() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_hidecursor (void);
-
- Turn off the cursor. Use v_ctype() to turn the cursor on.
-
- See also: v_ctype()
-
-
- ΓòÉΓòÉΓòÉ 22.17. v_init() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- int v_init (void);
-
- Initialize video library. You must call this function before calling any
- other video library function. The attributes are set to F_WHITE|B_BLACK.
-
- General information about the video library: The video library implements
- text-mode output to the screen. You have to link with libvideo (use the
- -lvideo option). Under DOS, emx option -acm is required, see `Using emx
- options'. See wm_init() for a higher-level interface.
-
- Example: /emx/test/video.c
-
- See also: v_attrib()
-
-
- ΓòÉΓòÉΓòÉ 22.18. v_insline() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_insline (int count);
-
- Insert COUNT empty lines at the current cursor position by moving down the
- line at the current cursor position and all lines below that line. The
- current attributes are used for filling the empty lines.
-
- See also: v_attrib() , v_delline() , v_scroll()
-
-
- ΓòÉΓòÉΓòÉ 22.19. v_printf() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- int v_printf (const char *fmt, ...);
-
- Formatted output to the screen at the current cursor position. The cursor
- is moved. See printf() for details on FMT. The number of output
- characters is returned.
-
- See also: v_attrib() , v_putc() , v_puts()
-
-
- ΓòÉΓòÉΓòÉ 22.20. v_putc() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_putc (char c);
-
- Display character C on the screen at the current cursor position, using
- the current attributes. The cursor is moved. If the cursor leaves the
- screen at the right edge, it will be moved to the start of the next line.
- If C is '\n', the cursor is moved to the start of the next line. If the
- cursor leaves the screen at the bottom edge, the screen is scrolled up.
-
- See also: v_attrib() , v_puts() , v_scrollup()
-
-
- ΓòÉΓòÉΓòÉ 22.21. v_putline() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_putline (const char *src, int x, int y, int count);
-
- Copy COUNT character/attributes pairs from SRC to the screen at position
- (X,Y). 2*COUNT bytes are copied. The cursor is not moved.
-
- See also: v_getline() , v_putmask() , v_putn()
-
-
- ΓòÉΓòÉΓòÉ 22.22. v_putm() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_putm (const char *str, int len);
-
- Display LEN characters of STR at the current cursor position using the
- current attributes. The cursor is not moved.
-
- See also: v_putline() , v_putn() , v_puts()
-
-
- ΓòÉΓòÉΓòÉ 22.23. v_putmask() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_putmask (const char *src, const char *mask, int x, int y, int count);
-
- Copy COUNT character/attributes pairs from SRC to the screen. A
- character/attributes pair at SRC[2*i] and SRC[2*i+1], is copied only if
- MASK[i] is non-zero. The cursor is not moved.
-
- See also: v_putline()
-
-
- ΓòÉΓòÉΓòÉ 22.24. v_putn() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_putn (char c, int count);
-
- Display character C at the current cursor position. COUNT is the number
- of times to display the character. The cursor is not moved.
-
- See also: v_attrib() , v_putc()
-
-
- ΓòÉΓòÉΓòÉ 22.25. v_puts() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_puts (const char *str);
-
- Display string STR at the current cursor position using the current
- attributes. The '\n' character moves the cursor to the start of the next
- line. Scrolling is performed when the cursor leaves the screen at the
- bottom edge.
-
- See also: v_attrib() , v_putc() , v_putm()
-
-
- ΓòÉΓòÉΓòÉ 22.26. v_scroll() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_scroll (int tl_x, int tl_y, int br_x, int br_y, int count, int flag);
-
- Scroll a rectangle of the screen by COUNT lines. The top left character
- cell is at (TL_X,TL_Y), the bottom right character cell is at (BR_X,BR_Y).
- If FLAG is V_SCROLL_UP, the rectangle is scrolled up, if FLAG is
- V_SCROLL_DOWN, the rectangle is scrolled down. If FLAG is V_SCROLL_CLEAR,
- the rectangle is filled with blanks. Lines becoming empty are filled with
- blanks using the current attributes.
-
- See also: v_attrib() , v_scrollup()
-
-
- ΓòÉΓòÉΓòÉ 22.27. v_scrollup() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- void v_scrollup (void);
-
- Scroll screen up by one line. The bottom line is filled with blanks,
- using the current attributes.
-
- See also: v_attrib() , v_putc()
-
-
- ΓòÉΓòÉΓòÉ 22.28. v_vprintf() ΓòÉΓòÉΓòÉ
-
- #include <sys/video.h> [emx]
-
- int v_vprintf (const char *fmt, va_list arg_ptr);
-
- Formatted output to the screen. Instead of a list of arguments, this
- function takes a pointer to the list of arguments. See v_printf() for
- details.
-
- See also: v_printf() , va_arg()
-
-
- ΓòÉΓòÉΓòÉ 22.29. va_arg() ΓòÉΓòÉΓòÉ
-
- #include <stdarg.h> [ANSI]
-
- type va_arg (va_list arg_ptr, type);
- void va_end (va_list arg_ptr);
- void va_start (va_list arg_ptr, type prev_arg);
-
- Access arguments of a function with variable number of arguments. You have
- to declare a variable of type va_list, for instance ARG_PTR. Use
-
- va_start (arg_ptr, prev_arg),
-
- where PREV_ARG is the argument preceding the variable arguments, to
- initialize ARG_PTR. Use
-
- va_arg (arg_ptr, type)
-
- to get the next argument, which is of type TYPE. Use va_end (arg_ptr) if
- you no longer need ARG_PTR.
-
- Restriction: PREV_ARG should not be of type `float' unless there's a
- prototype for the function, TYPE should not be `float'. Both problems are
- due to the fact that float is promoted to double.
-
- See also: vprintf()
-
-
- ΓòÉΓòÉΓòÉ 22.30. va_end() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 22.31. va_start() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 22.32. vprintf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [ANSI]
-
- int vprintf (const char *format, va_list arg_ptr);
- int vfprintf (FILE *stream, const char *format, va_list arg_ptr);
- int vsprintf (char *buffer, const char *format, va_list arg_ptr);
-
- Formatted output to stdout, to the stream STREAM or to the string BUFFER,
- respectively. Instead of a list of arguments, these functions take a
- pointer to the list of arguments. See printf() for details.
-
- See also: printf() , va_arg()
-
-
- ΓòÉΓòÉΓòÉ 22.33. vscanf() ΓòÉΓòÉΓòÉ
-
- #include <stdio.h> [emx]
-
- int vscanf (const char *format, va_list arg_ptr);
- int vfscanf (FILE *stream, const char *format, va_list arg_ptr);
- int vsscanf (const char *buffer, const char *format, va_list arg_ptr);
-
- Parse input from stdin, STREAM or BUFFER, respectively. Instead of a list
- of arguments, these functions take a pointer to the list of arguments.
- See scanf() for details.
-
- See also: scanf() , va_arg()
-
-
- ΓòÉΓòÉΓòÉ 22.34. vsprintf() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 22.35. vsscanf() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23. function w ΓòÉΓòÉΓòÉ
-
- This sections documents functions starting with the letter w
-
-
- ΓòÉΓòÉΓòÉ 23.1. wait() ΓòÉΓòÉΓòÉ
-
- #include <process.h> /* use this */ [UNIX]
- #include <sys/wait.h> /* or this */
-
- int wait (int *status);
-
- Wait until a child process terminates or if a child process which is being
- debugged gets a signal, for instance, SIGTRAP after a single step has been
- performed. If there are no child processes, wait() returns immediately,
- setting errno to ECHILD and returning -1. If STATUS is not NULL, the
- return code and the termination status are stored to the location pointed
- to by STATUS. The termination status is stored in the low-order byte, the
- return code is stored in the high-order byte. If the child process
- terminates normally, the low-order byte contains 0, the high-order byte
- contains the return code. If the child process has been stopped, the
- low-order byte contains 127, the high-order byte contains the signal
- number. This occurs only if the child process is being debugged. If the
- child process terminated due to a signal, the low-order byte contains the
- signal number, the high-order byte contains 0. See also the macros
- defined in sys/wait.h. [...] wait() returns the process ID of the child
- process. If an error occurs, wait() sets errno and returns -1. Example:
-
- int tc, pid;
-
- pid = wait (&tc);
- if (pid >= 0)
- {
- if ((tc & 0xff) == 0)
- printf ("Normal process termination, rc=%d\n", tc >> 8);
- else if ((tc & 0xff) == 127)
- printf ("Process stopped by signal %d\n", tc >> 8);
- else
- printf ("Process terminated by signal %d\n", tc & 0xff);
- }
-
- Restrictions: Under DOS wait() is currently implemented only for processes
- being debugged; see ptrace() and spawn(). Under OS/2, wait() works only
- for processes started with spawn() or exec(). It does not work for
- processes started with DosExecPgm or DosStartSession. If the processes
- found by wait() has been started as a session, only the return code is
- available, not the signal number. wait() is not interrupted by signals.
-
- See also: ptrace() , signal() , spawn() , waitpid()
-
-
- ΓòÉΓòÉΓòÉ 23.2. _wait0() ΓòÉΓòÉΓòÉ
-
- #include <sys/hw.h> [*] [emx]
-
- void _wait0 (unsigned port, unsigned mask);
- void _wait1 (unsigned port, unsigned mask);
- void _wait01 (unsigned port, unsigned mask);
- void _wait10 (unsigned port, unsigned mask);
-
- The _wait0() and _wait1() functions wait for the bit indicated by MASK of
- the 8-bit hardware port PORT being 0 or 1, respectively.
-
- The _wait01() and _wait10() functions wait for a 0->1 or 1->0 transition,
- respectively, of the bit indicated by MASK of the 8-bit hardware port
- PORT.
-
- If there are multiple bits set in MASK, `0' means all bits cleared, `1'
- means at least one bit set.
-
- You have to call _portaccess() first to enable access to a range of ports.
- To make your program work under DOS, you have to use emx option -ai, see
- `Using emx options'. Under OS/2, your program requires emxio.dll in a
- directory listed in LIBPATH. When linking with LINK386 (-Zomf) or when
- using emxlibc.dll (-Zmt), you have to use libemxio (-lemxio). libemxio
- must not be used if the program should run under DOS.
-
- Note that these functions eat lots of CPU time.
-
- See also: _portaccess() , _inp8()
-
-
- ΓòÉΓòÉΓòÉ 23.3. _wait01() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23.4. _wait1() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23.5. _wait10() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23.6. waitpid() ΓòÉΓòÉΓòÉ
-
- #include <sys/wait.h> [UNIX]
-
- int waitpid (int pid, int *status, int options);
-
- Wait until the child process PID terminates. If PID is -1, waitpid()
- waits for any child process, as does wait(). If there is no child process
- with process ID PID (or if PID is -1 and there is no child process), errno
- is set to ESRCH and -1 is returned. If STATUS is not NULL, the return code
- and the termination status are stored to the location pointed to by
- STATUS, see wait() for details. OPTIONS is currently ignored.
-
- Restrictions: waitpid() is not implemented for negative values of PID.
- OPTIONS is ignored. waitpid() is not implemented under DOS. waitpid()
- cannot be used with ptrace() -- wait() must be used instead.
-
- See also: wait()
-
-
- ΓòÉΓòÉΓòÉ 23.7. _wildcard() ΓòÉΓòÉΓòÉ
-
- #include <stdlib.h> [emx]
-
- void _wildcard (int *argcp, char ***argvp);
-
- Expand wildcards. If you want wildcards on the command line to be
- expanded, call
-
- _wildcard (&argc, &argv);
-
- at the beginning of main(). Wildcard arguments enclosed in double quotes
- won't be expanded. If the expansion of a wildcard argument is empty, the
- wildcard argument is kept unchanged. Directories are included in the
- expansion. Hidden and system files are omitted.
-
- _fnlwr() is used to convert file names to lower case on upper-case-only
- file systems.
-
- See also: _fnexplode() , main() , _response()
-
-
- ΓòÉΓòÉΓòÉ 23.8. wm_attrib() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_attrib (wm_handle wh, int a);
-
- Set the default attributes of window WH to A.
-
- See also: wm_create() , wm_get_attrib() , wm_putc()
-
-
- ΓòÉΓòÉΓòÉ 23.9. wm_attrib_all() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_attrib_all (wm_handle wh, int a);
-
- Change the attributes of all characters of window WH (except of the
- border) to A. The character codes are not changed.
-
- See also: wm_attrib() , wm_clear() , wm_create()
-
-
- ΓòÉΓòÉΓòÉ 23.10. wm_backsp() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_backsp (wm_handle wh, int count);
-
- Backspace the cursor of window WH. The cursor is moved left by COUNT
- characters. If the cursor leaves the window at the left edge, it is moved
- to the end of the previous line. The cursor cannot leave the window at
- the top edge.
-
- See also: wm_putc()
-
-
- ΓòÉΓòÉΓòÉ 23.11. wm_border() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_border (wm_handle wh, int bflag, int battr, const char *title,
- int tflag, int tattr);
-
- Change the border of window WH. The border type is set to BFLAG: 0 turns
- the border off, 1 uses a single line, 2 uses a double line, 3 and 4 use
- both single and double lines -- which is not recommended as most code
- pages do not contain the necessary symbols. All other values are used as
- characters for drawing the border. The attributes BATTR are used for
- drawing the border. TITLE is displayed centered in the top line of the
- border. If TFLAG is non-zero, vertical bars are used to separate the
- title text from the border. The attributes TATTR are used for displaying
- the title text.
-
- See also: wm_create()
-
-
- ΓòÉΓòÉΓòÉ 23.12. wm_bottom() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_bottom (wm_handle wh);
-
- Move window WH to the bottom of the window stack, that is, it will be
- moved below all other windows.
-
- See also: wm_top() , wm_up()
-
-
- ΓòÉΓòÉΓòÉ 23.13. wm_chide() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_chide (int flag);
-
- Set the cursor hide mode. If FLAG is non-zero, the cursor is hidden if
- the current cursor position is hidden by another window. If FLAG is zero,
- the cursor is visible even if the cursor position is hidden by another
- window. The initial value is non-zero.
-
- See also: wm_ctype() , wm_cursor()
-
-
- ΓòÉΓòÉΓòÉ 23.14. wm_clear() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_clear (wm_handle wh);
-
- Clear window WH by filling WH with blanks using the current attributes.
-
- See also: wm_attrib() , wm_attrib_all()
-
-
- ΓòÉΓòÉΓòÉ 23.15. wm_close() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_close (wm_handle wh);
-
- Close the window WH. After closing the window, it still exists but is not
- visible.
-
- See also: wm_open()
-
-
- ΓòÉΓòÉΓòÉ 23.16. wm_close_all() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_close_all (void);
-
- Close all the windows. wm_close_all() restores the original screen
- contents.
-
- See also: wm_close() , wm_open()
-
-
- ΓòÉΓòÉΓòÉ 23.17. wm_clr_eol() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_clr_eol (wm_handle wh, int x, int y);
-
- Clear from position (X,Y) of window WH to the end of that line of that
- window by displaying blanks. The current attributes are used.
-
- See also: wm_clear()
-
-
- ΓòÉΓòÉΓòÉ 23.18. wm_create() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- wm_handle wm_create (int x0, int y0, int x1, int y1, int border, int battr,
- int wattr);
-
- Create a window. The upper left character of the window interior is at
- (X0,Y0), the bottom right character of the window interior is at (X1,Y1).
- A window may be larger than the screen or partially or completely outside
- the screen. BORDER specifies the border type: 0 doesn't draw a border, 1
- uses a single line, 2 uses a double line, 3 and 4 use both single and
- double lines -- which is not recommended as most code pages do not contain
- the necessary symbols. All other values are used as characters for
- drawing the border. The attributes BATTR are used for drawing the border.
- The attributes for displaying text in the window are set to WATTR. After
- creating a window, it is invisible. Use wm_open() to show the window.
- wm_create() returns the handle of the window if successful. Otherwise,
- NULL is returned.
-
- See also: wm_attrib() , wm_border() , wm_delete() , wm_open()
-
-
- ΓòÉΓòÉΓòÉ 23.19. wm_ctype() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_ctype (wm_handle wh, int start, int end);
-
- Set the cursor type of window WH. START is the first row of the cursor,
- END is the last row of the cursor. Both values are zero-based. The
- cursor type set by wm_ctype() is used for displaying the cursor if it is
- connected to window WH. Use v_hardware() to determine the size of the
- character box.
-
- See also: v_hardware() , wm_chide() , wm_cursor()
-
-
- ΓòÉΓòÉΓòÉ 23.20. wm_cursor() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_cursor (wm_handle wh);
-
- Connect the screen cursor with the cursor of window WH. The cursor is
- displayed at the cursor position of window WH, using the cursor type of
- window WH. If WH is NULL, the screen cursor is not connected to any
- window and is invisible. Initially, the screen cursor is not connected to
- any window.
-
- See also: wm_chide() , wm_ctype() , wm_cvis()
-
-
- ΓòÉΓòÉΓòÉ 23.21. wm_cvis() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_cvis (wm_handle wh, int flag);
-
- Set the cursor status of window WH. If FLAG is non-zero, the cursor is
- enabled, if FLAG is zero, the cursor is disabled.
-
- See also: wm_chide() , wm_cursor()
-
-
- ΓòÉΓòÉΓòÉ 23.22. wm_del_char() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_del_char (wm_handle wh, int x, int y, int count);
-
- Delete COUNT characters at position (X,Y) of window WH. Characters to the
- right of that position are moved left, the positions becoming vacant at
- the right edge of the window are filled with blanks using the current
- attributes.
-
- See also: wm_attrib() , wm_del_line() , wm_ins_char()
-
-
- ΓòÉΓòÉΓòÉ 23.23. wm_del_line() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_del_line (wm_handle wh, int y, int count);
-
- Delete COUNT lines at line Y of window WH by moving up the lines below
- that line. The current attributes are used for filling lines becoming
- empty at the bottom of the window.
-
- See also: wm_attrib() , wm_del_char() , wm_ins_line() , wm_scroll()
-
-
- ΓòÉΓòÉΓòÉ 23.24. wm_delete() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_delete (wm_handle wh);
-
- Destroy the window WH. After calling wm_delete(), the window handle WH
- must no longer be used. The window is not closed.
-
- See also: wm_close() , wm_create()
-
-
- ΓòÉΓòÉΓòÉ 23.25. wm_dimen() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_dimen (wm_handle wh, int *width, int *height);
-
- Store the width of the window WH (columns) to WIDTH, the height (lines) to
- HEIGHT.
-
- See also: wm_create()
-
-
- ΓòÉΓòÉΓòÉ 23.26. wm_down() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_down (wm_handle wh);
-
- Move window WH down the window stack, that is, it will be covered by an
- additional window unless WH is already the bottom window.
-
- See also: wm_bottom() , wm_top() , wm_up()
-
-
- ΓòÉΓòÉΓòÉ 23.27. wm_exit() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_exit (void);
-
- Quit the window manager and release all memory allocated by the window
- manager. All window handles become invalid. The windows are not closed.
-
- See also: wm_close() , wm_delete()
-
-
- ΓòÉΓòÉΓòÉ 23.28. wm_find() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- wm_handle wm_find (int x, int y);
-
- Find the window which is visible at position (X,Y) of the screen. The
- window handle is returned if such a window exists. Otherwise, NULL is
- returned.
-
-
- ΓòÉΓòÉΓòÉ 23.29. wm_get_attrib() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- int wm_get_attrib (wm_handle wh);
-
- Return the current attributes of window WH.
-
- See also: wm_attrib()
-
-
- ΓòÉΓòÉΓòÉ 23.30. wm_get_cursor() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- wm_handle wm_get_cursor (void);
-
- Get the window to which the screen cursor is connected. The window handle
- is returned. If the cursor is not connected to any window, NULL is
- returned.
-
- See also: wm_cursor()
-
-
- ΓòÉΓòÉΓòÉ 23.31. wm_get_pos() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_get_pos (wm_handle wh, int *x, int *y);
-
- Store the screen coordinates of the upper left character of the interior
- of window WH to X and Y.
-
- See also: wm_create() , wm_move()
-
-
- ΓòÉΓòÉΓòÉ 23.32. wm_getx() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23.33. wm_getxy() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_getxy (wm_handle wh, int *x, int *y);
- int wm_getx (wm_handle wh);
- int wm_gety (wm_handle wh);
-
- wm_getxy() stores the cursor coordinates of window WH to X and Y.
- wm_getx() returns the horizontal position (column) of the cursor of window
- WH. wm_gety() returns the vertical position (line) of the cursor of
- window WH. The coordinates are zero-based and are relative to the upper
- left character of the interior of window WH.
-
- See also: wm_gotoxy()
-
-
- ΓòÉΓòÉΓòÉ 23.34. wm_gety() ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ 23.35. wm_gotoxy() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_gotoxy (wm_handle wh, int x, int y);
-
- Move the cursor of window WH to (X,Y). The coordinates are zero-based and
- are relative to the upper left character of the interior of window WH. If
- the screen cursor is connected to the cursor of window WH, the screen
- cursor is moved.
-
- See also: wm_cursor() , wm_getxy()
-
-
- ΓòÉΓòÉΓòÉ 23.36. wm_ins_char() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_ins_char (wm_handle wh, int x, int y, int count);
-
- Insert COUNT blank characters at position (X,Y) of window WH. Characters
- to the right of that position are moved right. The current attributes are
- used for displaying the blank characters.
-
- See also: wm_attrib() , wm_del_char() , wm_ins_line()
-
-
- ΓòÉΓòÉΓòÉ 23.37. wm_ins_line() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_ins_line (wm_handle wh, int y, int count);
-
- Insert COUNT empty lines at line Y of window WH by moving down that line
- and all lines below that line. The current attributes are used for
- filling the empty lines.
-
- See also: wm_attrib() , wm_del_line() , wm_scroll()
-
-
- ΓòÉΓòÉΓòÉ 23.38. wm_init() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- int wm_init (int n);
-
- Initialize the window manager and allocate memory for N windows. You must
- call this function before calling any other window manager function.
-
- General information about window manager functions: The window manager
- functions implement text-mode output to windows on the screen. You have
- to link with libvideo (use the -lvideo option). Under DOS, emx option -acm
- is required, see `Using emx options'.
-
- Example: /emx/test/wm_demo.c, /emx/test/wm_hello.c
-
- See also: wm_exit()
-
-
- ΓòÉΓòÉΓòÉ 23.39. wm_move() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_move (wm_handle wh, int x, int y);
-
- Move the window WH. The upper left character of the interior of the
- window will be at screen coordinates (X,Y).
-
- See also: wm_get_pos()
-
-
- ΓòÉΓòÉΓòÉ 23.40. wm_open() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_open (wm_handle wh);
-
- Open the window WH. The window will be showed on the screen unless it is
- covered by other windows or outside the screen.
-
- See also: wm_close()
-
-
- ΓòÉΓòÉΓòÉ 23.41. wm_printf() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- int wm_printf (wm_handle wh, const char *fmt, ...);
-
- Formatted output to window WH at the current cursor position of that
- window. The cursor is moved. See printf() for details on FMT. The
- number of output characters is returned.
-
- See also: wm_attrib() , wm_putc() , wm_puts()
-
-
- ΓòÉΓòÉΓòÉ 23.42. wm_puta_at() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_puta_at (wm_handle wh, int x, int y, int a, int count);
-
- Change to A the attributes of COUNT characters at position (X,Y) of window
- WH. All COUNT characters must be in one line of the window.
-
- See also: wm_attrib() , wm_putsa_at()
-
-
- ΓòÉΓòÉΓòÉ 23.43. wm_putc() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putc (wm_handle wh, char c);
-
- Display character C in window WH at the current cursor position of that
- window, using the current attributes of that window. The cursor of that
- window is moved. If the cursor leaves the window at the right edge, it
- will be moved to the start of the next line. If C is '\n', the cursor is
- moved to the start of the next line. If the cursor leaves the window at
- the bottom edge, the window is scrolled up.
-
- See also: wm_attrib() , wm_putc_at() , wm_putca() , wm_scroll() ,
- wm_wrap()
-
-
- ΓòÉΓòÉΓòÉ 23.44. wm_putc_at() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putc_at (wm_handle wh, int x, int y, char c);
-
- Display character C at position (X,Y) of window WH using the current
- attributes of that window. The cursor is not moved.
-
- See also: wm_attrib() , wm_gotoxy()
-
-
- ΓòÉΓòÉΓòÉ 23.45. wm_putca() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putca (wm_handle wh, char c, int a);
-
- Display character C in window WH at the current cursor position of that
- window, using the attributes A. The cursor of that window is moved. If
- the cursor leaves the window at the right edge, it will be moved to the
- start of the next line. If C is '\n', the cursor is moved to the start of
- the next line. If the cursor leaves the window at the bottom edge, the
- window is scrolled up.
-
- See also: wm_putc() , wm_putca_at() , wm_scroll() , wm_wrap()
-
-
- ΓòÉΓòÉΓòÉ 23.46. wm_putca_at() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putca_at (wm_handle wh, int x, int y, char c, int a);
-
- Display character C at position (X,Y) of window WH using the attributes A.
- The cursor is not moved.
-
-
- ΓòÉΓòÉΓòÉ 23.47. wm_puts() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_puts (wm_handle wh, const char *str);
-
- Display string STR in window WH at the current cursor position of that
- window using the current attributes of that window. The '\n' character
- moves the cursor to the start of the next line. Scrolling is performed
- when the cursor leaves the window at the bottom edge.
-
- See also: wm_attrib() , wm_putc() , wm_putsa() , wm_scroll() , wm_wrap()
-
-
- ΓòÉΓòÉΓòÉ 23.48. wm_puts_at() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_puts_at (wm_handle wh, int x, int y, const char *str);
-
- Display string STR in window WH at position (X,Y) using the current
- attributes of that window. The '\n' character is not interpreted, the
- cursor is not moved.
-
- See also: wm_attrib() , wm_puts()
-
-
- ΓòÉΓòÉΓòÉ 23.49. wm_putsa() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putsa (wm_handle wh, const char *str, int a);
-
- Display string STR in window WH at the current cursor position of that
- window using the attributes A. The '\n' character moves the cursor to the
- start of the next line. Scrolling is performed when the cursor leaves the
- window at the bottom edge.
-
- See also: wm_putca() , wm_puts() , wm_scroll() , wm_wrap()
-
-
- ΓòÉΓòÉΓòÉ 23.50. wm_putsa_at() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_putsa_at (wm_handle wh, int x, int y, const char *str, int a);
-
- Display string STR in window WH at position (X,Y) using the attributes A.
- The '\n' character is not interpreted, the cursor is not moved.
-
- See also: wm_putsa()
-
-
- ΓòÉΓòÉΓòÉ 23.51. wm_scroll() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_scroll (wm_handle wh, int count);
-
- Scroll the interior of window WH up by one line. The bottom line is
- filled with blanks, using the current attributes.
-
- See also: wm_attrib() , wm_del_line() , wm_ins_line() , wm_putc()
-
-
- ΓòÉΓòÉΓòÉ 23.52. wm_top() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_top (wm_handle wh);
-
- Move window WH to the top of the window stack, that is, it will cover all
- other windows.
-
- See also: wm_bottom() , wm_down()
-
-
- ΓòÉΓòÉΓòÉ 23.53. wm_up() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_up (wm_handle wh);
-
- Move window WH up the window stack, that is, it will cover an additional
- window unless WH is already the top window.
-
- See also: wm_bottom() , wm_down() , wm_top()
-
-
- ΓòÉΓòÉΓòÉ 23.54. wm_update() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_update (wm_handle wh, int flag);
-
- Set the update mode of window WH. If FLAG is non-zero (which is the
- default), the screen is updated immediately if window WH is changed. If
- FLAG is zero, changes to window WH are done in memory only. This can be
- done to improve speed. Each call to update() copies the window to the
- screen, regardless of the FLAG argument.
-
-
- ΓòÉΓòÉΓòÉ 23.55. wm_vprintf() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- int wm_vprintf (wm_handle wh, const char *fmt, va_list arg_ptr);
-
- Formatted output to window WH. Instead of a list of arguments, this
- function takes a pointer to the list of arguments. See wm_printf() for
- details.
-
- See also: wm_printf() , va_arg()
-
-
- ΓòÉΓòÉΓòÉ 23.56. wm_wrap() ΓòÉΓòÉΓòÉ
-
- #include <sys/winmgr.h> [emx]
-
- void wm_wrap (wm_handle wh, int wrap_flag);
-
- Set the end-of-line wrap mode of window WH. If FLAG is non-zero (which is
- the default), the cursor is moved to the next line if it reaches the end
- of a line. If FLAG is zero, the cursor stays at the end of the line.
- wm_wrap() applies to wm_putc(), wm_puts(), wm_printf(), etc.
-
- See also: wm_putc()
-
-
- ΓòÉΓòÉΓòÉ 23.57. write() ΓòÉΓòÉΓòÉ
-
- #include <io.h> [UNIX]
-
- int write (int handle, const void *buf, size_t nbyte);
-
- Write NBYTE characters from the buffer BUF to the file HANDLE. The number
- of characters written is returned. If there is an error, -1 is returned.
- Writing 0 characters is allowed -- the request will be ignored. In text
- mode, LF characters are translated to CR/LF pairs. This translation does
- not affect the return value.
-
- See also: open() , setmode() , read()
-
-