home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 13 / DJCRX201.ZIP / info / libc.inf (.txt)
GNU Info File  |  1996-10-31  |  601KB  |  18,370 lines

  1. This is Info file ../../info/libc.inf, produced by Makeinfo version
  2. 1.67 from the input file libc.tex.
  3. This is the reference manual for libc.a
  4. Copyright (c) 1996 DJ Delorie
  5. File: libc.inf,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  6. * Menu:
  7. * Introduction::
  8. * Functional Categories::  All public symbols listed by
  9.                            category
  10. * Alphabetical List::      All public symbols in alphabetical
  11.                            order
  12. * Index::
  13. File: libc.inf,  Node: Introduction,  Next: Functional Categories,  Prev: Top,  Up: Top
  14. Introduction
  15. ************
  16. The standard C library, `libc.a', is automatically linked into your
  17. programs by the `gcc' control program.  It provides many of the
  18. functions that are normally associated with C programs.  This document
  19. gives the proper usage information about each of the functions and
  20. variables found in `libc.a'.
  21. For each function or variable that the library provides, the definition
  22. of that symbol will include information on which header files to include
  23. in your source to obtain prototypes and type definitions relevent to the
  24. use of that symbol.
  25. Note that many of the functions in `libm.a' (the math library) are
  26. defined in `math.h' but are not present in libc.a.  Some are, which may
  27. get confusing, but the rule of thumb is this - the C library contains
  28. those functions that ANSI dictates must exist, so that you don't need
  29. the `-lm' if you only use ANSI functions.  These functions are,
  30. however, vastly simplified compared to the ANSI spec and the functions
  31. in `libm.a', which includes replacements.  For example, `libc.a''s
  32. `ldexp()' doesn't set `errno' on error, but `libm.a''s `ldexp()' does.
  33. File: libc.inf,  Node: Functional Categories,  Next: Alphabetical List,  Prev: Introduction,  Up: Top
  34. Functional Categories
  35. *********************
  36. * Menu:
  37. * bios functions::
  38. * conio functions::
  39. * cpu functions::
  40. * ctype functions::
  41. * dos functions::
  42. * dpmi functions::
  43. * environment functions::
  44. * file system functions::
  45. * go32 functions::
  46. * io functions::
  47. * locale functions::
  48. * math functions::
  49. * memory functions::
  50. * misc functions::
  51. * mono functions::
  52. * posix functions::
  53. * process functions::
  54. * random number functions::
  55. * shell functions::
  56. * signal functions::
  57. * sound functions::
  58. * startup functions::
  59. * stdio functions::
  60. * stdlib functions::
  61. * string functions::
  62. * termios functions::
  63. * time functions::
  64. * unix functions::
  65. File: libc.inf,  Node: bios functions,  Next: conio functions,  Up: Functional Categories
  66. bios functions
  67. ==============
  68. * Menu:
  69. * _bios_disk::
  70. * _bios_equiplist::
  71. * _bios_keybrd::
  72. * _bios_memsize::
  73. * _bios_printer::
  74. * _bios_serialcom::
  75. * _bios_timeofday::
  76. * bioscom::
  77. * biosdisk::
  78. * biosequip::
  79. * bioskey::
  80. * biosmemory::
  81. * biosprint::
  82. * biostime::
  83. * getkey::
  84. * getxkey::
  85. * kbhit::
  86. File: libc.inf,  Node: conio functions,  Next: cpu functions,  Prev: bios functions,  Up: Functional Categories
  87. conio functions
  88. ===============
  89. * Menu:
  90. * blinkvideo::
  91. * cgets::
  92. * clreol::
  93. * clrscr::
  94. * _conio_kbhit::
  95. * cprintf::
  96. * cputs::
  97. * cscanf::
  98. * delline::
  99. * getch::
  100. * getche::
  101. * gettext::
  102. * gettextinfo::
  103. * gotoxy::
  104. * gppconio_init::
  105. * highvideo::
  106. * insline::
  107. * intensevideo::
  108. * lowvideo::
  109. * movetext::
  110. * normvideo::
  111. * putch::
  112. * puttext::
  113. * Screen Variables::
  114. * ScreenClear::
  115. * ScreenCols::
  116. * ScreenGetChar::
  117. * ScreenGetCursor::
  118. * ScreenMode::
  119. * ScreenPutChar::
  120. * ScreenPutString::
  121. * ScreenRetrieve::
  122. * ScreenRows::
  123. * ScreenSetCursor::
  124. * ScreenUpdate::
  125. * ScreenUpdateLine::
  126. * ScreenVisualBell::
  127. * _set_screen_lines::
  128. * _setcursortype::
  129. * textattr::
  130. * textbackground::
  131. * textcolor::
  132. * textmode::
  133. * ungetch::
  134. * wherex::
  135. * wherey::
  136. * window::
  137. File: libc.inf,  Node: cpu functions,  Next: ctype functions,  Prev: conio functions,  Up: Functional Categories
  138. cpu functions
  139. =============
  140. * Menu:
  141. * _clear87::
  142. * _control87::
  143. * disable::
  144. * enable::
  145. * _fpreset::
  146. * htonl::
  147. * htons::
  148. * inb::
  149. * inp::
  150. * inportb::
  151. * inportl::
  152. * inportsb::
  153. * inportsl::
  154. * inportsw::
  155. * inportw::
  156. * inpw::
  157. * _my_cs::
  158. * _my_ds::
  159. * _my_ss::
  160. * ntohl::
  161. * ntohs::
  162. * outb::
  163. * outp::
  164. * outportb::
  165. * outportl::
  166. * outportsb::
  167. * outportsl::
  168. * outportsw::
  169. * outportw::
  170. * outpw::
  171. * _status87::
  172. File: libc.inf,  Node: ctype functions,  Next: dos functions,  Prev: cpu functions,  Up: Functional Categories
  173. ctype functions
  174. ===============
  175. * Menu:
  176. * isalnum::
  177. * isalpha::
  178. * isascii::
  179. * iscntrl::
  180. * isdigit::
  181. * isgraph::
  182. * islower::
  183. * isprint::
  184. * ispunct::
  185. * isspace::
  186. * isupper::
  187. * isxdigit::
  188. * toascii::
  189. * tolower::
  190. * toupper::
  191. File: libc.inf,  Node: dos functions,  Next: dpmi functions,  Prev: ctype functions,  Up: Functional Categories
  192. dos functions
  193. =============
  194. * Menu:
  195. * bdos::
  196. * bdosptr::
  197. * delay::
  198. * _dos_close::
  199. * _dos_commit::
  200. * _dos_creat::
  201. * _dos_creatnew::
  202. * _dos_findfirst::
  203. * _dos_findnext::
  204. * _dos_getdate::
  205. * _dos_getdiskfree::
  206. * _dos_getdrive::
  207. * _dos_getfileattr::
  208. * _dos_getftime::
  209. * _dos_gettime::
  210. * _dos_lock::
  211. * _dos_open::
  212. * _dos_read::
  213. * _dos_setdate::
  214. * _dos_setdrive::
  215. * _dos_setfileattr::
  216. * _dos_setftime::
  217. * _dos_settime::
  218. * _dos_unlock::
  219. * _dos_write::
  220. * dosexterr::
  221. * _flush_disk_cache::
  222. * getcbrk::
  223. * getdisk::
  224. * int386::
  225. * int386x::
  226. * int86::
  227. * int86x::
  228. * intdos::
  229. * intdosx::
  230. * setcbrk::
  231. * setdisk::
  232. File: libc.inf,  Node: dpmi functions,  Next: environment functions,  Prev: dos functions,  Up: Functional Categories
  233. dpmi functions
  234. ==============
  235. * Menu:
  236. * DPMI Overview::
  237. * DPMI Specification::
  238. * __dpmi_allocate_dos_memory::
  239. * __dpmi_allocate_ldt_descriptors::
  240. * __dpmi_allocate_linear_memory::
  241. * __dpmi_allocate_memory::
  242. * __dpmi_allocate_real_mode_callback::
  243. * __dpmi_allocate_shared_memory::
  244. * __dpmi_allocate_specific_ldt_descriptor::
  245. * __dpmi_clear_debug_watchpoint::
  246. * __dpmi_create_alias_descriptor::
  247. * __dpmi_discard_page_contents::
  248. * __dpmi_free_dos_memory::
  249. * __dpmi_free_ldt_descriptor::
  250. * __dpmi_free_memory::
  251. * __dpmi_free_physical_address_mapping::
  252. * __dpmi_free_real_mode_callback::
  253. * __dpmi_free_serialization_on_shared_memory::
  254. * __dpmi_free_shared_memory::
  255. * __dpmi_get_and_disable_virtual_interrupt_state::
  256. * __dpmi_get_and_enable_virtual_interrupt_state::
  257. * __dpmi_get_and_set_virtual_interrupt_state::
  258. * __dpmi_get_capabilities::
  259. * __dpmi_get_coprocessor_status::
  260. * __dpmi_get_descriptor::
  261. * __dpmi_get_descriptor_access_rights::
  262. * __dpmi_get_extended_exception_handler_vector_pm::
  263. * __dpmi_get_extended_exception_handler_vector_rm::
  264. * __dpmi_get_free_memory_information::
  265. * __dpmi_get_memory_block_size_and_base::
  266. * __dpmi_get_memory_information::
  267. * __dpmi_get_multiple_descriptors::
  268. * __dpmi_get_page_attributes::
  269. * __dpmi_get_page_size::
  270. * __dpmi_get_processor_exception_handler_vector::
  271. * __dpmi_get_protected_mode_interrupt_vector::
  272. * __dpmi_get_raw_mode_switch_addr::
  273. * __dpmi_get_real_mode_interrupt_vector::
  274. * __dpmi_get_segment_base_address::
  275. * __dpmi_get_segment_limit::
  276. * __dpmi_get_selector_increment_value::
  277. * __dpmi_get_state_of_debug_watchpoint::
  278. * __dpmi_get_state_save_restore_addr::
  279. * __dpmi_get_vendor_specific_api_entry_point::
  280. * __dpmi_get_version::
  281. * __dpmi_get_virtual_interrupt_state::
  282. * __dpmi_install_resident_service_provider_callback::
  283. * __dpmi_int::
  284. * __dpmi_lock_linear_region::
  285. * __dpmi_map_conventional_memory_in_memory_block::
  286. * __dpmi_map_device_in_memory_block::
  287. * __dpmi_mark_page_as_demand_paging_candidate::
  288. * __dpmi_mark_real_mode_region_as_pageable::
  289. * __dpmi_physical_address_mapping::
  290. * __dpmi_relock_real_mode_region::
  291. * __dpmi_reset_debug_watchpoint::
  292. * __dpmi_resize_dos_memory::
  293. * __dpmi_resize_linear_memory::
  294. * __dpmi_resize_memory::
  295. * __dpmi_segment_to_descriptor::
  296. * __dpmi_serialize_on_shared_memory::
  297. * __dpmi_set_coprocessor_emulation::
  298. * __dpmi_set_debug_watchpoint::
  299. * __dpmi_set_descriptor::
  300. * __dpmi_set_descriptor_access_rights::
  301. * __dpmi_set_extended_exception_handler_vector_pm::
  302. * __dpmi_set_extended_exception_handler_vector_rm::
  303. * __dpmi_set_multiple_descriptors::
  304. * __dpmi_set_page_attributes::
  305. * __dpmi_set_processor_exception_handler_vector::
  306. * __dpmi_set_protected_mode_interrupt_vector::
  307. * __dpmi_set_real_mode_interrupt_vector::
  308. * __dpmi_set_segment_base_address::
  309. * __dpmi_set_segment_limit::
  310. * __dpmi_simulate_real_mode_interrupt::
  311. * __dpmi_simulate_real_mode_procedure_iret::
  312. * __dpmi_simulate_real_mode_procedure_retf::
  313. * __dpmi_simulate_real_mode_procedure_retf_stack::
  314. * __dpmi_terminate_and_stay_resident::
  315. * __dpmi_unlock_linear_region::
  316. * __dpmi_yield::
  317. * _go32_dpmi_allocate_dos_memory::
  318. * _go32_dpmi_allocate_iret_wrapper::
  319. * _go32_dpmi_allocate_real_mode_callback_iret::
  320. * _go32_dpmi_allocate_real_mode_callback_retf::
  321. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  322. * _go32_dpmi_free_dos_memory::
  323. * _go32_dpmi_free_iret_wrapper::
  324. * _go32_dpmi_free_real_mode_callback::
  325. * _go32_dpmi_get_free_memory_information::
  326. * _go32_dpmi_get_protected_mode_interrupt_vector::
  327. * _go32_dpmi_get_real_mode_interrupt_vector::
  328. * _go32_dpmi_remaining_physical_memory::
  329. * _go32_dpmi_remaining_virtual_memory::
  330. * _go32_dpmi_resize_dos_memory::
  331. * _go32_dpmi_set_protected_mode_interrupt_vector::
  332. * _go32_dpmi_set_real_mode_interrupt_vector::
  333. * _go32_dpmi_simulate_fcall::
  334. * _go32_dpmi_simulate_fcall_iret::
  335. * _go32_dpmi_simulate_int::
  336. * _go32_info_block::
  337. File: libc.inf,  Node: environment functions,  Next: file system functions,  Prev: dpmi functions,  Up: Functional Categories
  338. environment functions
  339. =====================
  340. * Menu:
  341. * getenv::
  342. * putenv::
  343. File: libc.inf,  Node: file system functions,  Next: go32 functions,  Prev: environment functions,  Up: Functional Categories
  344. file system functions
  345. =====================
  346. * Menu:
  347. * access::
  348. * chdir::
  349. * chmod::
  350. * _chmod::
  351. * _close::
  352. * closedir::
  353. * _creat::
  354. * File System Extensions::
  355. * file_tree_walk::
  356. * findfirst::
  357. * findnext::
  358. * _fixpath::
  359. * fnmatch::
  360. * fnmerge::
  361. * fnsplit::
  362. * fpathconf::
  363. * __FSEXT_add_open_handler::
  364. * __FSEXT_alloc_fd::
  365. * __FSEXT_call_open_handlers::
  366. * __FSEXT_get_function::
  367. * __FSEXT_set_function::
  368. * ftw::
  369. * _get_volume_info::
  370. * getcwd::
  371. * getdfree::
  372. * getftime::
  373. * getwd::
  374. * _lfn_gen_short_fname::
  375. * _lfn_get_ftime::
  376. * mkdir::
  377. * mkstemp::
  378. * mktemp::
  379. * _open::
  380. * opendir::
  381. * _preserve_fncase::
  382. * _read::
  383. * readdir::
  384. * remove::
  385. * _rename::
  386. * rename::
  387. * rewinddir::
  388. * rmdir::
  389. * searchpath::
  390. * seekdir::
  391. * setftime::
  392. * statfs::
  393. * telldir::
  394. * umask::
  395. * unlink::
  396. * _use_lfn::
  397. * utime::
  398. * _write::
  399. File: libc.inf,  Node: go32 functions,  Next: io functions,  Prev: file system functions,  Up: Functional Categories
  400. go32 functions
  401. ==============
  402. * Menu:
  403. * _go32_conventional_mem_selector::
  404. * _go32_dpmi_lock_code::
  405. * _go32_dpmi_lock_data::
  406. * _go32_interrupt_stack_size::
  407. * _go32_my_cs::
  408. * _go32_my_ds::
  409. * _go32_my_ss::
  410. * _go32_rmcb_stack_size::
  411. * _go32_want_ctrl_break::
  412. * _go32_was_ctrl_break_hit::
  413. File: libc.inf,  Node: io functions,  Next: locale functions,  Prev: go32 functions,  Up: Functional Categories
  414. io functions
  415. ============
  416. * Menu:
  417. * chsize::
  418. * close::
  419. * creat::
  420. * crlf2nl::
  421. * dup::
  422. * dup2::
  423. * fcntl::
  424. * __file_exists::
  425. * filelength::
  426. * _get_dev_info::
  427. * ioctl (DOS)::
  428. * ioctl (General description)::
  429. * ioctl (UNIX)::
  430. * _is_executable::
  431. * link::
  432. * lock::
  433. * lseek::
  434. * open::
  435. * read::
  436. * setmode::
  437. * stat::
  438. * symlink::
  439. * tell::
  440. * truncate::
  441. * unlock::
  442. * write::
  443. File: libc.inf,  Node: locale functions,  Next: math functions,  Prev: io functions,  Up: Functional Categories
  444. locale functions
  445. ================
  446. * Menu:
  447. * localeconv::
  448. * mblen::
  449. * mbstowcs::
  450. * mbtowc::
  451. * setlocale::
  452. * strcoll::
  453. * strxfrm::
  454. * wcstombs::
  455. * wctomb::
  456. File: libc.inf,  Node: math functions,  Next: memory functions,  Prev: locale functions,  Up: Functional Categories
  457. math functions
  458. ==============
  459. * Menu:
  460. * abs::
  461. * acos::
  462. * acosh::
  463. * asin::
  464. * asinh::
  465. * atan::
  466. * atan2::
  467. * atanh::
  468. * ceil::
  469. * cos::
  470. * cosh::
  471. * div::
  472. * exp::
  473. * fabs::
  474. * floor::
  475. * fmod::
  476. * frexp::
  477. * hypot::
  478. * ldexp::
  479. * ldiv::
  480. * lldiv::
  481. * log::
  482. * log10::
  483. * log2::
  484. * modf::
  485. * modfl::
  486. * pow::
  487. * pow10::
  488. * pow2::
  489. * sin::
  490. * sinh::
  491. * sqrt::
  492. * tan::
  493. * tanh::
  494. File: libc.inf,  Node: memory functions,  Next: misc functions,  Prev: math functions,  Up: Functional Categories
  495. memory functions
  496. ================
  497. * Menu:
  498. * alloca::
  499. * bcmp::
  500. * bcopy::
  501. * brk::
  502. * bzero::
  503. * calloc::
  504. * cfree::
  505. * __djgpp_map_physical_memory::
  506. * __djgpp_memory_handle::
  507. * __djgpp_memory_handle_list::
  508. * __djgpp_nearptr_disable::
  509. * __djgpp_nearptr_enable::
  510. * __djgpp_set_page_attributes::
  511. * dosmemget::
  512. * dosmemgetb::
  513. * dosmemgetl::
  514. * dosmemgetw::
  515. * dosmemput::
  516. * dosmemputb::
  517. * dosmemputl::
  518. * dosmemputw::
  519. * _far*::
  520. * free::
  521. * malloc::
  522. * memccpy::
  523. * memchr::
  524. * memcmp::
  525. * memcpy::
  526. * memmove::
  527. * memset::
  528. * movedata::
  529. * movedatab::
  530. * movedatal::
  531. * movedataw::
  532. * mprotect::
  533. * realloc::
  534. * sbrk::
  535. * swab::
  536. * xfree::
  537. * xmalloc::
  538. * xrealloc::
  539. File: libc.inf,  Node: misc functions,  Next: mono functions,  Prev: memory functions,  Up: Functional Categories
  540. misc functions
  541. ==============
  542. * Menu:
  543. * assert::
  544. * bsearch::
  545. * _dxe_load::
  546. * _get_dos_version::
  547. * gethostname::
  548. * getlongpass::
  549. * getopt::
  550. * getpagesize::
  551. * getpass::
  552. * insque::
  553. * labs::
  554. * llabs::
  555. * longjmp::
  556. * qsort::
  557. * remque::
  558. * setjmp::
  559. * siglongjmp::
  560. * sigsetjmp::
  561. File: libc.inf,  Node: mono functions,  Next: posix functions,  Prev: misc functions,  Up: Functional Categories
  562. mono functions
  563. ==============
  564. * Menu:
  565. * _mono_clear::
  566. * _mono_printf::
  567. * _mono_putc::
  568. File: libc.inf,  Node: posix functions,  Next: process functions,  Prev: mono functions,  Up: Functional Categories
  569. posix functions
  570. ===============
  571. * Menu:
  572. * getdtablesize::
  573. * pathconf::
  574. * sysconf::
  575. File: libc.inf,  Node: process functions,  Next: random number functions,  Prev: posix functions,  Up: Functional Categories
  576. process functions
  577. =================
  578. * Menu:
  579. * abort::
  580. * alarm::
  581. * atexit::
  582. * exec*::
  583. * __exit::
  584. * _exit::
  585. * exit::
  586. * getitimer::
  587. * kill::
  588. * nice::
  589. * pause::
  590. * setitimer::
  591. * sleep::
  592. * spawn*::
  593. * system::
  594. * usleep::
  595. * wait::
  596. * waitpid::
  597. File: libc.inf,  Node: random number functions,  Next: shell functions,  Prev: process functions,  Up: Functional Categories
  598. random number functions
  599. =======================
  600. * Menu:
  601. * rand::
  602. * random::
  603. * srandom::
  604. File: libc.inf,  Node: shell functions,  Next: signal functions,  Prev: random number functions,  Up: Functional Categories
  605. shell functions
  606. ===============
  607. * Menu:
  608. * glob::
  609. * globfree::
  610. File: libc.inf,  Node: signal functions,  Next: sound functions,  Prev: shell functions,  Up: Functional Categories
  611. signal functions
  612. ================
  613. * Menu:
  614. * __djgpp_exception_toggle::
  615. * __djgpp_set_ctrl_c::
  616. * raise::
  617. * signal::
  618. File: libc.inf,  Node: sound functions,  Next: startup functions,  Prev: signal functions,  Up: Functional Categories
  619. sound functions
  620. ===============
  621. * Menu:
  622. * nosound::
  623. * sound::
  624. File: libc.inf,  Node: startup functions,  Next: stdio functions,  Prev: sound functions,  Up: Functional Categories
  625. startup functions
  626. =================
  627. * Menu:
  628. * __crt0_glob_function::
  629. * __crt0_load_environment_file::
  630. * __crt0_setup_arguments::
  631. * _crt0_startup_flags::
  632. * _stklen::
  633. File: libc.inf,  Node: stdio functions,  Next: stdlib functions,  Prev: startup functions,  Up: Functional Categories
  634. stdio functions
  635. ===============
  636. * Menu:
  637. * clearerr::
  638. * _djstat_describe_lossage::
  639. * _djstat_fail_bits::
  640. * _djstat_flags::
  641. * _doprnt::
  642. * _doscan::
  643. * errno::
  644. * fclose::
  645. * fdopen::
  646. * feof::
  647. * ferror::
  648. * fflush::
  649. * fgetc::
  650. * fgetpos::
  651. * fgets::
  652. * fileno::
  653. * _fmode::
  654. * fopen::
  655. * fprintf::
  656. * fpurge::
  657. * fputc::
  658. * fputs::
  659. * fread::
  660. * freopen::
  661. * fscanf::
  662. * fseek::
  663. * fsetpos::
  664. * fstat::
  665. * fsync::
  666. * ftell::
  667. * ftruncate::
  668. * _fwalk::
  669. * fwrite::
  670. * getc::
  671. * getchar::
  672. * gets::
  673. * getw::
  674. * perror::
  675. * printf::
  676. * putc::
  677. * putchar::
  678. * puts::
  679. * putw::
  680. * rewind::
  681. * scanf::
  682. * setbuf::
  683. * setbuffer::
  684. * setlinebuf::
  685. * setvbuf::
  686. * sprintf::
  687. * sscanf::
  688. * strerror::
  689. * sys_errlist::
  690. * sys_nerr::
  691. * tmpfile::
  692. * tmpnam::
  693. * _truename::
  694. * ungetc::
  695. * vfprintf::
  696. * vprintf::
  697. * vsprintf::
  698. File: libc.inf,  Node: stdlib functions,  Next: string functions,  Prev: stdio functions,  Up: Functional Categories
  699. stdlib functions
  700. ================
  701. * Menu:
  702. * setenv::
  703. File: libc.inf,  Node: string functions,  Next: termios functions,  Prev: stdlib functions,  Up: Functional Categories
  704. string functions
  705. ================
  706. * Menu:
  707. * atof::
  708. * atoi::
  709. * atol::
  710. * _atold::
  711. * ffs::
  712. * index::
  713. * itoa::
  714. * regcomp::
  715. * regerror::
  716. * regexec::
  717. * regfree::
  718. * rindex::
  719. * stpcpy::
  720. * strcase::
  721. * strcasecmp::
  722. * strcat::
  723. * strchr::
  724. * strcmp::
  725. * strcpy::
  726. * strcspn::
  727. * strdup::
  728. * stricmp::
  729. * strlen::
  730. * strlwr::
  731. * strncase::
  732. * strncasecmp::
  733. * strncat::
  734. * strncmp::
  735. * strncpy::
  736. * strnicmp::
  737. * strpbrk::
  738. * strrchr::
  739. * strsep::
  740. * strspn::
  741. * strstr::
  742. * strtod::
  743. * strtok::
  744. * strtol::
  745. * _strtold::
  746. * strtoll::
  747. * strtoul::
  748. * strtoull::
  749. * strupr::
  750. File: libc.inf,  Node: termios functions,  Next: time functions,  Prev: string functions,  Up: Functional Categories
  751. termios functions
  752. =================
  753. * Menu:
  754. * cfgetispeed::
  755. * cfgetospeed::
  756. * cfmakeraw::
  757. * cfsetispeed::
  758. * cfsetospeed::
  759. * cfsetspeed::
  760. * __libc_termios_init::
  761. * tcdrain::
  762. * tcflow::
  763. * tcflush::
  764. * tcgetattr::
  765. * tcsendbreak::
  766. * tcsetattr::
  767. File: libc.inf,  Node: time functions,  Next: unix functions,  Prev: termios functions,  Up: Functional Categories
  768. time functions
  769. ==============
  770. * Menu:
  771. * asctime::
  772. * clock::
  773. * ctime::
  774. * difftime::
  775. * ftime::
  776. * getdate::
  777. * gettime::
  778. * gettimeofday::
  779. * gmtime::
  780. * localtime::
  781. * mktime::
  782. * rawclock::
  783. * setdate::
  784. * settime::
  785. * settimeofday::
  786. * strftime::
  787. * time::
  788. * times::
  789. * uclock::
  790. * utimes::
  791. File: libc.inf,  Node: unix functions,  Prev: time functions,  Up: Functional Categories
  792. unix functions
  793. ==============
  794. * Menu:
  795. * addmntent::
  796. * chown::
  797. * endgrent::
  798. * endmntent::
  799. * endpwent::
  800. * fgetgrent::
  801. * fork::
  802. * getegid::
  803. * geteuid::
  804. * getgid::
  805. * getgrent::
  806. * getgrgid::
  807. * getgrnam::
  808. * getlogin::
  809. * getmntent::
  810. * getpgrp::
  811. * getpid::
  812. * getpwent::
  813. * getpwnam::
  814. * getpwuid::
  815. * getrlimit::
  816. * getrusage::
  817. * getuid::
  818. * hasmntopt::
  819. * isatty::
  820. * mkfifo::
  821. * mknod::
  822. * pclose::
  823. * pipe::
  824. * popen::
  825. * select::
  826. * setgrent::
  827. * setmntent::
  828. * setpgid::
  829. * setpwent::
  830. * setrlimit::
  831. * sync::
  832. * ttyname::
  833. * uname::
  834. File: libc.inf,  Node: Alphabetical List,  Prev: Functional Categories,  Up: Top
  835. Alphabetical List
  836. *****************
  837. * Menu:
  838. * abort::
  839. * abs::
  840. * access::
  841. * acos::
  842. * acosh::
  843. * addmntent::
  844. * alarm::
  845. * alloca::
  846. * asctime::
  847. * asin::
  848. * asinh::
  849. * assert::
  850. * atan::
  851. * atan2::
  852. * atanh::
  853. * atexit::
  854. * atof::
  855. * atoi::
  856. * atol::
  857. * _atold::
  858. * bcmp::
  859. * bcopy::
  860. * bdos::
  861. * bdosptr::
  862. * _bios_disk::
  863. * _bios_equiplist::
  864. * _bios_keybrd::
  865. * _bios_memsize::
  866. * _bios_printer::
  867. * _bios_serialcom::
  868. * _bios_timeofday::
  869. * bioscom::
  870. * biosdisk::
  871. * biosequip::
  872. * bioskey::
  873. * biosmemory::
  874. * biosprint::
  875. * biostime::
  876. * blinkvideo::
  877. * brk::
  878. * bsearch::
  879. * bzero::
  880. * calloc::
  881. * ceil::
  882. * cfgetispeed::
  883. * cfgetospeed::
  884. * cfmakeraw::
  885. * cfree::
  886. * cfsetispeed::
  887. * cfsetospeed::
  888. * cfsetspeed::
  889. * cgets::
  890. * chdir::
  891. * chmod::
  892. * _chmod::
  893. * chown::
  894. * chsize::
  895. * _clear87::
  896. * clearerr::
  897. * clock::
  898. * close::
  899. * _close::
  900. * closedir::
  901. * clreol::
  902. * clrscr::
  903. * _conio_kbhit::
  904. * _control87::
  905. * cos::
  906. * cosh::
  907. * cprintf::
  908. * cputs::
  909. * creat::
  910. * _creat::
  911. * crlf2nl::
  912. * __crt0_glob_function::
  913. * __crt0_load_environment_file::
  914. * __crt0_setup_arguments::
  915. * _crt0_startup_flags::
  916. * cscanf::
  917. * ctime::
  918. * delay::
  919. * delline::
  920. * difftime::
  921. * disable::
  922. * div::
  923. * __djgpp_exception_toggle::
  924. * __djgpp_map_physical_memory::
  925. * __djgpp_memory_handle::
  926. * __djgpp_memory_handle_list::
  927. * __djgpp_nearptr_disable::
  928. * __djgpp_nearptr_enable::
  929. * __djgpp_set_ctrl_c::
  930. * __djgpp_set_page_attributes::
  931. * _djstat_describe_lossage::
  932. * _djstat_fail_bits::
  933. * _djstat_flags::
  934. * _doprnt::
  935. * _dos_close::
  936. * _dos_commit::
  937. * _dos_creat::
  938. * _dos_creatnew::
  939. * _dos_findfirst::
  940. * _dos_findnext::
  941. * _dos_getdate::
  942. * _dos_getdiskfree::
  943. * _dos_getdrive::
  944. * _dos_getfileattr::
  945. * _dos_getftime::
  946. * _dos_gettime::
  947. * _dos_lock::
  948. * _dos_open::
  949. * _dos_read::
  950. * _dos_setdate::
  951. * _dos_setdrive::
  952. * _dos_setfileattr::
  953. * _dos_setftime::
  954. * _dos_settime::
  955. * _dos_unlock::
  956. * _dos_write::
  957. * _doscan::
  958. * dosexterr::
  959. * dosmemget::
  960. * dosmemgetb::
  961. * dosmemgetl::
  962. * dosmemgetw::
  963. * dosmemput::
  964. * dosmemputb::
  965. * dosmemputl::
  966. * dosmemputw::
  967. * DPMI Overview::
  968. * DPMI Specification::
  969. * __dpmi_allocate_dos_memory::
  970. * __dpmi_allocate_ldt_descriptors::
  971. * __dpmi_allocate_linear_memory::
  972. * __dpmi_allocate_memory::
  973. * __dpmi_allocate_real_mode_callback::
  974. * __dpmi_allocate_shared_memory::
  975. * __dpmi_allocate_specific_ldt_descriptor::
  976. * __dpmi_clear_debug_watchpoint::
  977. * __dpmi_create_alias_descriptor::
  978. * __dpmi_discard_page_contents::
  979. * __dpmi_free_dos_memory::
  980. * __dpmi_free_ldt_descriptor::
  981. * __dpmi_free_memory::
  982. * __dpmi_free_physical_address_mapping::
  983. * __dpmi_free_real_mode_callback::
  984. * __dpmi_free_serialization_on_shared_memory::
  985. * __dpmi_free_shared_memory::
  986. * __dpmi_get_and_disable_virtual_interrupt_state::
  987. * __dpmi_get_and_enable_virtual_interrupt_state::
  988. * __dpmi_get_and_set_virtual_interrupt_state::
  989. * __dpmi_get_capabilities::
  990. * __dpmi_get_coprocessor_status::
  991. * __dpmi_get_descriptor::
  992. * __dpmi_get_descriptor_access_rights::
  993. * __dpmi_get_extended_exception_handler_vector_pm::
  994. * __dpmi_get_extended_exception_handler_vector_rm::
  995. * __dpmi_get_free_memory_information::
  996. * __dpmi_get_memory_block_size_and_base::
  997. * __dpmi_get_memory_information::
  998. * __dpmi_get_multiple_descriptors::
  999. * __dpmi_get_page_attributes::
  1000. * __dpmi_get_page_size::
  1001. * __dpmi_get_processor_exception_handler_vector::
  1002. * __dpmi_get_protected_mode_interrupt_vector::
  1003. * __dpmi_get_raw_mode_switch_addr::
  1004. * __dpmi_get_real_mode_interrupt_vector::
  1005. * __dpmi_get_segment_base_address::
  1006. * __dpmi_get_segment_limit::
  1007. * __dpmi_get_selector_increment_value::
  1008. * __dpmi_get_state_of_debug_watchpoint::
  1009. * __dpmi_get_state_save_restore_addr::
  1010. * __dpmi_get_vendor_specific_api_entry_point::
  1011. * __dpmi_get_version::
  1012. * __dpmi_get_virtual_interrupt_state::
  1013. * __dpmi_install_resident_service_provider_callback::
  1014. * __dpmi_int::
  1015. * __dpmi_lock_linear_region::
  1016. * __dpmi_map_conventional_memory_in_memory_block::
  1017. * __dpmi_map_device_in_memory_block::
  1018. * __dpmi_mark_page_as_demand_paging_candidate::
  1019. * __dpmi_mark_real_mode_region_as_pageable::
  1020. * __dpmi_physical_address_mapping::
  1021. * __dpmi_relock_real_mode_region::
  1022. * __dpmi_reset_debug_watchpoint::
  1023. * __dpmi_resize_dos_memory::
  1024. * __dpmi_resize_linear_memory::
  1025. * __dpmi_resize_memory::
  1026. * __dpmi_segment_to_descriptor::
  1027. * __dpmi_serialize_on_shared_memory::
  1028. * __dpmi_set_coprocessor_emulation::
  1029. * __dpmi_set_debug_watchpoint::
  1030. * __dpmi_set_descriptor::
  1031. * __dpmi_set_descriptor_access_rights::
  1032. * __dpmi_set_extended_exception_handler_vector_pm::
  1033. * __dpmi_set_extended_exception_handler_vector_rm::
  1034. * __dpmi_set_multiple_descriptors::
  1035. * __dpmi_set_page_attributes::
  1036. * __dpmi_set_processor_exception_handler_vector::
  1037. * __dpmi_set_protected_mode_interrupt_vector::
  1038. * __dpmi_set_real_mode_interrupt_vector::
  1039. * __dpmi_set_segment_base_address::
  1040. * __dpmi_set_segment_limit::
  1041. * __dpmi_simulate_real_mode_interrupt::
  1042. * __dpmi_simulate_real_mode_procedure_iret::
  1043. * __dpmi_simulate_real_mode_procedure_retf::
  1044. * __dpmi_simulate_real_mode_procedure_retf_stack::
  1045. * __dpmi_terminate_and_stay_resident::
  1046. * __dpmi_unlock_linear_region::
  1047. * __dpmi_yield::
  1048. * dup::
  1049. * dup2::
  1050. * _dxe_load::
  1051. * enable::
  1052. * endgrent::
  1053. * endmntent::
  1054. * endpwent::
  1055. * errno::
  1056. * exec*::
  1057. * __exit::
  1058. * _exit::
  1059. * exit::
  1060. * exp::
  1061. * fabs::
  1062. * _far*::
  1063. * fclose::
  1064. * fcntl::
  1065. * fdopen::
  1066. * feof::
  1067. * ferror::
  1068. * fflush::
  1069. * ffs::
  1070. * fgetc::
  1071. * fgetgrent::
  1072. * fgetpos::
  1073. * fgets::
  1074. * File System Extensions::
  1075. * __file_exists::
  1076. * file_tree_walk::
  1077. * filelength::
  1078. * fileno::
  1079. * findfirst::
  1080. * findnext::
  1081. * _fixpath::
  1082. * floor::
  1083. * _flush_disk_cache::
  1084. * fmod::
  1085. * _fmode::
  1086. * fnmatch::
  1087. * fnmerge::
  1088. * fnsplit::
  1089. * fopen::
  1090. * fork::
  1091. * fpathconf::
  1092. * _fpreset::
  1093. * fprintf::
  1094. * fpurge::
  1095. * fputc::
  1096. * fputs::
  1097. * fread::
  1098. * free::
  1099. * freopen::
  1100. * frexp::
  1101. * fscanf::
  1102. * fseek::
  1103. * fsetpos::
  1104. * __FSEXT_add_open_handler::
  1105. * __FSEXT_alloc_fd::
  1106. * __FSEXT_call_open_handlers::
  1107. * __FSEXT_get_function::
  1108. * __FSEXT_set_function::
  1109. * fstat::
  1110. * fsync::
  1111. * ftell::
  1112. * ftime::
  1113. * ftruncate::
  1114. * ftw::
  1115. * _fwalk::
  1116. * fwrite::
  1117. * _get_dev_info::
  1118. * _get_dos_version::
  1119. * _get_volume_info::
  1120. * getc::
  1121. * getcbrk::
  1122. * getch::
  1123. * getchar::
  1124. * getche::
  1125. * getcwd::
  1126. * getdate::
  1127. * getdfree::
  1128. * getdisk::
  1129. * getdtablesize::
  1130. * getegid::
  1131. * getenv::
  1132. * geteuid::
  1133. * getftime::
  1134. * getgid::
  1135. * getgrent::
  1136. * getgrgid::
  1137. * getgrnam::
  1138. * gethostname::
  1139. * getitimer::
  1140. * getkey::
  1141. * getlogin::
  1142. * getlongpass::
  1143. * getmntent::
  1144. * getopt::
  1145. * getpagesize::
  1146. * getpass::
  1147. * getpgrp::
  1148. * getpid::
  1149. * getpwent::
  1150. * getpwnam::
  1151. * getpwuid::
  1152. * getrlimit::
  1153. * getrusage::
  1154. * gets::
  1155. * gettext::
  1156. * gettextinfo::
  1157. * gettime::
  1158. * gettimeofday::
  1159. * getuid::
  1160. * getw::
  1161. * getwd::
  1162. * getxkey::
  1163. * glob::
  1164. * globfree::
  1165. * gmtime::
  1166. * _go32_conventional_mem_selector::
  1167. * _go32_dpmi_allocate_dos_memory::
  1168. * _go32_dpmi_allocate_iret_wrapper::
  1169. * _go32_dpmi_allocate_real_mode_callback_iret::
  1170. * _go32_dpmi_allocate_real_mode_callback_retf::
  1171. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  1172. * _go32_dpmi_free_dos_memory::
  1173. * _go32_dpmi_free_iret_wrapper::
  1174. * _go32_dpmi_free_real_mode_callback::
  1175. * _go32_dpmi_get_free_memory_information::
  1176. * _go32_dpmi_get_protected_mode_interrupt_vector::
  1177. * _go32_dpmi_get_real_mode_interrupt_vector::
  1178. * _go32_dpmi_lock_code::
  1179. * _go32_dpmi_lock_data::
  1180. * _go32_dpmi_remaining_physical_memory::
  1181. * _go32_dpmi_remaining_virtual_memory::
  1182. * _go32_dpmi_resize_dos_memory::
  1183. * _go32_dpmi_set_protected_mode_interrupt_vector::
  1184. * _go32_dpmi_set_real_mode_interrupt_vector::
  1185. * _go32_dpmi_simulate_fcall::
  1186. * _go32_dpmi_simulate_fcall_iret::
  1187. * _go32_dpmi_simulate_int::
  1188. * _go32_info_block::
  1189. * _go32_interrupt_stack_size::
  1190. * _go32_my_cs::
  1191. * _go32_my_ds::
  1192. * _go32_my_ss::
  1193. * _go32_rmcb_stack_size::
  1194. * _go32_want_ctrl_break::
  1195. * _go32_was_ctrl_break_hit::
  1196. * gotoxy::
  1197. * gppconio_init::
  1198. * hasmntopt::
  1199. * highvideo::
  1200. * htonl::
  1201. * htons::
  1202. * hypot::
  1203. * inb::
  1204. * index::
  1205. * inp::
  1206. * inportb::
  1207. * inportl::
  1208. * inportsb::
  1209. * inportsl::
  1210. * inportsw::
  1211. * inportw::
  1212. * inpw::
  1213. * insline::
  1214. * insque::
  1215. * int386::
  1216. * int386x::
  1217. * int86::
  1218. * int86x::
  1219. * intdos::
  1220. * intdosx::
  1221. * intensevideo::
  1222. * ioctl (DOS)::
  1223. * ioctl (General description)::
  1224. * ioctl (UNIX)::
  1225. * _is_executable::
  1226. * isalnum::
  1227. * isalpha::
  1228. * isascii::
  1229. * isatty::
  1230. * iscntrl::
  1231. * isdigit::
  1232. * isgraph::
  1233. * islower::
  1234. * isprint::
  1235. * ispunct::
  1236. * isspace::
  1237. * isupper::
  1238. * isxdigit::
  1239. * itoa::
  1240. * kbhit::
  1241. * kill::
  1242. * labs::
  1243. * ldexp::
  1244. * ldiv::
  1245. * _lfn_gen_short_fname::
  1246. * _lfn_get_ftime::
  1247. * __libc_termios_init::
  1248. * link::
  1249. * llabs::
  1250. * lldiv::
  1251. * localeconv::
  1252. * localtime::
  1253. * lock::
  1254. * log::
  1255. * log10::
  1256. * log2::
  1257. * longjmp::
  1258. * lowvideo::
  1259. * lseek::
  1260. * malloc::
  1261. * mblen::
  1262. * mbstowcs::
  1263. * mbtowc::
  1264. * memccpy::
  1265. * memchr::
  1266. * memcmp::
  1267. * memcpy::
  1268. * memmove::
  1269. * memset::
  1270. * mkdir::
  1271. * mkfifo::
  1272. * mknod::
  1273. * mkstemp::
  1274. * mktemp::
  1275. * mktime::
  1276. * modf::
  1277. * modfl::
  1278. * _mono_clear::
  1279. * _mono_printf::
  1280. * _mono_putc::
  1281. * movedata::
  1282. * movedatab::
  1283. * movedatal::
  1284. * movedataw::
  1285. * movetext::
  1286. * mprotect::
  1287. * _my_cs::
  1288. * _my_ds::
  1289. * _my_ss::
  1290. * nice::
  1291. * normvideo::
  1292. * nosound::
  1293. * ntohl::
  1294. * ntohs::
  1295. * open::
  1296. * _open::
  1297. * opendir::
  1298. * outb::
  1299. * outp::
  1300. * outportb::
  1301. * outportl::
  1302. * outportsb::
  1303. * outportsl::
  1304. * outportsw::
  1305. * outportw::
  1306. * outpw::
  1307. * pathconf::
  1308. * pause::
  1309. * pclose::
  1310. * perror::
  1311. * pipe::
  1312. * popen::
  1313. * pow::
  1314. * pow10::
  1315. * pow2::
  1316. * _preserve_fncase::
  1317. * printf::
  1318. * putc::
  1319. * putch::
  1320. * putchar::
  1321. * putenv::
  1322. * puts::
  1323. * puttext::
  1324. * putw::
  1325. * qsort::
  1326. * raise::
  1327. * rand::
  1328. * random::
  1329. * rawclock::
  1330. * read::
  1331. * _read::
  1332. * readdir::
  1333. * realloc::
  1334. * regcomp::
  1335. * regerror::
  1336. * regexec::
  1337. * regfree::
  1338. * remove::
  1339. * remque::
  1340. * _rename::
  1341. * rename::
  1342. * rewind::
  1343. * rewinddir::
  1344. * rindex::
  1345. * rmdir::
  1346. * sbrk::
  1347. * scanf::
  1348. * Screen Variables::
  1349. * ScreenClear::
  1350. * ScreenCols::
  1351. * ScreenGetChar::
  1352. * ScreenGetCursor::
  1353. * ScreenMode::
  1354. * ScreenPutChar::
  1355. * ScreenPutString::
  1356. * ScreenRetrieve::
  1357. * ScreenRows::
  1358. * ScreenSetCursor::
  1359. * ScreenUpdate::
  1360. * ScreenUpdateLine::
  1361. * ScreenVisualBell::
  1362. * searchpath::
  1363. * seekdir::
  1364. * select::
  1365. * _set_screen_lines::
  1366. * setbuf::
  1367. * setbuffer::
  1368. * setcbrk::
  1369. * _setcursortype::
  1370. * setdate::
  1371. * setdisk::
  1372. * setenv::
  1373. * setftime::
  1374. * setgrent::
  1375. * setitimer::
  1376. * setjmp::
  1377. * setlinebuf::
  1378. * setlocale::
  1379. * setmntent::
  1380. * setmode::
  1381. * setpgid::
  1382. * setpwent::
  1383. * setrlimit::
  1384. * settime::
  1385. * settimeofday::
  1386. * setvbuf::
  1387. * siglongjmp::
  1388. * signal::
  1389. * sigsetjmp::
  1390. * sin::
  1391. * sinh::
  1392. * sleep::
  1393. * sound::
  1394. * spawn*::
  1395. * sprintf::
  1396. * sqrt::
  1397. * srandom::
  1398. * sscanf::
  1399. * stat::
  1400. * statfs::
  1401. * _status87::
  1402. * _stklen::
  1403. * stpcpy::
  1404. * strcase::
  1405. * strcasecmp::
  1406. * strcat::
  1407. * strchr::
  1408. * strcmp::
  1409. * strcoll::
  1410. * strcpy::
  1411. * strcspn::
  1412. * strdup::
  1413. * strerror::
  1414. * strftime::
  1415. * stricmp::
  1416. * strlen::
  1417. * strlwr::
  1418. * strncase::
  1419. * strncasecmp::
  1420. * strncat::
  1421. * strncmp::
  1422. * strncpy::
  1423. * strnicmp::
  1424. * strpbrk::
  1425. * strrchr::
  1426. * strsep::
  1427. * strspn::
  1428. * strstr::
  1429. * strtod::
  1430. * strtok::
  1431. * strtol::
  1432. * _strtold::
  1433. * strtoll::
  1434. * strtoul::
  1435. * strtoull::
  1436. * strupr::
  1437. * strxfrm::
  1438. * swab::
  1439. * symlink::
  1440. * sync::
  1441. * sys_errlist::
  1442. * sys_nerr::
  1443. * sysconf::
  1444. * system::
  1445. * tan::
  1446. * tanh::
  1447. * tcdrain::
  1448. * tcflow::
  1449. * tcflush::
  1450. * tcgetattr::
  1451. * tcsendbreak::
  1452. * tcsetattr::
  1453. * tell::
  1454. * telldir::
  1455. * textattr::
  1456. * textbackground::
  1457. * textcolor::
  1458. * textmode::
  1459. * time::
  1460. * times::
  1461. * tmpfile::
  1462. * tmpnam::
  1463. * toascii::
  1464. * tolower::
  1465. * toupper::
  1466. * _truename::
  1467. * truncate::
  1468. * ttyname::
  1469. * uclock::
  1470. * umask::
  1471. * uname::
  1472. * ungetc::
  1473. * ungetch::
  1474. * unlink::
  1475. * unlock::
  1476. * _use_lfn::
  1477. * usleep::
  1478. * utime::
  1479. * utimes::
  1480. * vfprintf::
  1481. * vprintf::
  1482. * vsprintf::
  1483. * wait::
  1484. * waitpid::
  1485. * wcstombs::
  1486. * wctomb::
  1487. * wherex::
  1488. * wherey::
  1489. * window::
  1490. * write::
  1491. * _write::
  1492. * xfree::
  1493. * xmalloc::
  1494. * xrealloc::
  1495. File: libc.inf,  Node: abort,  Next: abs,  Up: Alphabetical List
  1496. abort
  1497. =====
  1498. Syntax
  1499. ------
  1500.      #include <stdlib.h>
  1501.      
  1502.      void abort(void);
  1503. Description
  1504. -----------
  1505. When you call `abort', the message "Abort!" is printed on stdout and
  1506. the program exits with an exit code of one.
  1507. Return Value
  1508. ------------
  1509. This function does not return.
  1510. Example
  1511. -------
  1512.      if ((q = malloc(100)) == NULL)
  1513.        abort();
  1514. File: libc.inf,  Node: abs,  Next: access,  Prev: abort,  Up: Alphabetical List
  1515. Syntax
  1516. ------
  1517.      #include <stdlib.h>
  1518.      
  1519.      int abs(int value);
  1520. Return Value
  1521. ------------
  1522. The absolute value of `value' is returned.
  1523. Example
  1524. -------
  1525.      int sq = 7;
  1526.      sq = sq * abs(sq) + 1;
  1527. File: libc.inf,  Node: access,  Next: acos,  Prev: abs,  Up: Alphabetical List
  1528. access
  1529. ======
  1530. Syntax
  1531. ------
  1532.      #include <unistd.h>
  1533.      
  1534.      int access(const char *filename, int flags);
  1535. Description
  1536. -----------
  1537. This function determines what kind of access modes a given file allows.
  1538. The parameter FLAGS is the logical `or' of one or more of the following
  1539. flags:
  1540. `R_OK'
  1541.      Request if the file is readable.  Since all files are readable
  1542.      under MS-DOS, this access mode always exists.
  1543. `W_OK'
  1544.      Request if the file is writable.
  1545. `X_OK'
  1546.      Request if the file is executable.
  1547. `F_OK'
  1548.      Request if the file exists.
  1549. `D_OK'
  1550.      Request if the file is really a directory.
  1551. Return Value
  1552. ------------
  1553. Zero if the requested access mode is allowed, nonzero if not.
  1554. Example
  1555. -------
  1556.      if (access("file.ext", W_OK))
  1557.        return ERROR_CANNOT_WRITE;
  1558.      open("file.ext", O_RDWR);
  1559. File: libc.inf,  Node: acos,  Next: acosh,  Prev: access,  Up: Alphabetical List
  1560. Syntax
  1561. ------
  1562.      #include <math.h>
  1563.      
  1564.      double acos(double x);
  1565. Return Value
  1566. ------------
  1567. The arc cosine of X.
  1568. File: libc.inf,  Node: acosh,  Next: addmntent,  Prev: acos,  Up: Alphabetical List
  1569. acosh
  1570. =====
  1571. Syntax
  1572. ------
  1573.      #include <math.h>
  1574.      
  1575.      double acosh(double x);
  1576. Return Value
  1577. ------------
  1578. The arc hyperbolic cosine of X.
  1579. File: libc.inf,  Node: addmntent,  Next: alarm,  Prev: acosh,  Up: Alphabetical List
  1580. addmntent
  1581. =========
  1582. Syntax
  1583. ------
  1584.      #include <mntent.h>
  1585.      
  1586.      int addmntent(FILE *filep, const struct mntent *mnt);
  1587. Description
  1588. -----------
  1589. This function is a no-op for MS-DOS, but is provided to assist in Unix
  1590. ports.  *Note getmntent::.
  1591. Return Value
  1592. ------------
  1593. This function always returns nonzero to signify an error.
  1594. File: libc.inf,  Node: alarm,  Next: alloca,  Prev: addmntent,  Up: Alphabetical List
  1595. alarm
  1596. =====
  1597. Syntax
  1598. ------
  1599.      #include <unistd.h>
  1600.      
  1601.      unsigned alarm(unsigned seconds);
  1602. Description
  1603. -----------
  1604. This function causes the signal SIGALRM to be raised in SECONDS seconds.
  1605. A value of zero for SECONDS cancels any pending alarm.  If an alarm has
  1606. previously been set, the new alarm delay will superceed the prior call.
  1607. Return Value
  1608. ------------
  1609. The number of seconds remaining on the timer (i.e. always SECONDS).
  1610. Example
  1611. -------
  1612.      signal(SIGALRM,my_alarm_routine);
  1613.      alarm(5);
  1614. File: libc.inf,  Node: alloca,  Next: asctime,  Prev: alarm,  Up: Alphabetical List
  1615. alloca
  1616. ======
  1617. Syntax
  1618. ------
  1619.      #include <stdlib.h>
  1620.      
  1621.      void *alloca(size_t _size)
  1622. Description
  1623. -----------
  1624. Allocate memory that will be automatically released when the current
  1625. procedure exits.  Note that, when compiling with gcc, alloca is a
  1626. built-in function and not a library call.
  1627. Return Value
  1628. ------------
  1629. A pointer to the memory, else NULL.
  1630. Example
  1631. -------
  1632.      q = alloca(strlen(x)+1);
  1633.      strcpy(q, x);
  1634. File: libc.inf,  Node: asctime,  Next: asin,  Prev: alloca,  Up: Alphabetical List
  1635. asctime
  1636. =======
  1637. Syntax
  1638. ------
  1639.      #include <time.h>
  1640.      
  1641.      char *asctime(const struct tm *tptr);
  1642. Description
  1643. -----------
  1644. This function returns an ASCII representation of the time represented by
  1645. TPTR.  The string returned is always 26 characters and has this format:
  1646.      Sun Jan 01 12:34:56 1993\n\0
  1647. The string pointed to is in a static buffer and will be overridden with
  1648. each call to asctime.  The data should be copied if it needs to be
  1649. preserved.
  1650. Return Value
  1651. ------------
  1652. A pointer to the string.
  1653. Example
  1654. -------
  1655.      time_t now;
  1656.      time(&now);
  1657.      printf("The current time is %s", asctime(localtime(&now)));
  1658. File: libc.inf,  Node: asin,  Next: asinh,  Prev: asctime,  Up: Alphabetical List
  1659. Syntax
  1660. ------
  1661.      #include <math.h>
  1662.      
  1663.      double asin(double x);
  1664. Return Value
  1665. ------------
  1666. The arc sine of X.
  1667. File: libc.inf,  Node: asinh,  Next: assert,  Prev: asin,  Up: Alphabetical List
  1668. asinh
  1669. =====
  1670. Syntax
  1671. ------
  1672.      #include <math.h>
  1673.      
  1674.      double asinh(double x);
  1675. Return Value
  1676. ------------
  1677. The arc hyperbolic sine of X.
  1678. File: libc.inf,  Node: assert,  Next: atan,  Prev: asinh,  Up: Alphabetical List
  1679. assert
  1680. ======
  1681. Syntax
  1682. ------
  1683.      #define NDEBUG
  1684.      #include <assert.h>
  1685.      
  1686.      assert(expression);
  1687.      assertval(expression);
  1688. Description
  1689. -----------
  1690. These macros are used to assist in debugging.  The source code includes
  1691. references to assert and assertval, passing them expressions that should
  1692. be true (or non-zero).  When the expression equals zero, a diagnostic
  1693. message is printed to stderr and the program aborts.
  1694. If you define the macro `NDEBUG' before including `assert.h', then the
  1695. macros expand to nothing to reduce code size after debugging is done.
  1696. Return Value
  1697. ------------
  1698. `assert' returns one if it passes, else it aborts.
  1699. `assertval' returns the value of the expression if nonzero, else it
  1700. aborts.
  1701. Example
  1702. -------
  1703.      int strdup(char *s)
  1704.      {
  1705.        assert(s != 0);
  1706. File: libc.inf,  Node: atan,  Next: atan2,  Prev: assert,  Up: Alphabetical List
  1707. Syntax
  1708. ------
  1709.      #include <math.h>
  1710.      
  1711.      double atan(double x);
  1712. Return Value
  1713. ------------
  1714. The arc tangent of X.
  1715. File: libc.inf,  Node: atan2,  Next: atanh,  Prev: atan,  Up: Alphabetical List
  1716. atan2
  1717. =====
  1718. Syntax
  1719. ------
  1720.      #include <math.h>
  1721.      
  1722.      double atan2(double y, double x);
  1723. Return Value
  1724. ------------
  1725. The arc tangent of Y/X, with appropriate return values for Y=0 or X=0.
  1726. File: libc.inf,  Node: atanh,  Next: atexit,  Prev: atan2,  Up: Alphabetical List
  1727. atanh
  1728. =====
  1729. Syntax
  1730. ------
  1731.      #include <math.h>
  1732.      
  1733.      double atanh(double x);
  1734. Return Value
  1735. ------------
  1736. The arc hyperbolic tangent of X.
  1737. File: libc.inf,  Node: atexit,  Next: atof,  Prev: atanh,  Up: Alphabetical List
  1738. atexit
  1739. ======
  1740. Syntax
  1741. ------
  1742.      #include <stdlib.h>
  1743.      
  1744.      int atexit(void (*func)(void));
  1745. Description
  1746. -----------
  1747. This function places the specified function FUNC on a list of functions
  1748. to be called when `exit' is called.  These functions are called as if a
  1749. last-in-first-out queue is used, that is, the last function registered
  1750. with `atexit' will be the first function called by `exit'.
  1751. At least 32 functions can be registered this way.
  1752. Return Value
  1753. ------------
  1754. Zero on success, non-zero on error.
  1755. Example
  1756. -------
  1757.      void exit_func()
  1758.      {
  1759.        remove("file.tmp");
  1760.      }
  1761.      
  1762.      ...
  1763.      atexit(exit_func);
  1764.      ...
  1765. File: libc.inf,  Node: atof,  Next: atoi,  Prev: atexit,  Up: Alphabetical List
  1766. Syntax
  1767. ------
  1768.      #include <stdlib.h>
  1769.      
  1770.      double atof(const char *string);
  1771. Description
  1772. -----------
  1773. Convert as much of the string as possible to an equivalent double
  1774. precision real number.
  1775. This function is almost like `strtod(string, NULL)' (*note strtod::.).
  1776. Return Value
  1777. ------------
  1778. The equivalent value, or zero if the string does not represent a number.
  1779. Example
  1780. -------
  1781.      main(int argc, char **argv)
  1782.      {
  1783.        double d = atof(argv[1]);
  1784.        ...
  1785. File: libc.inf,  Node: atoi,  Next: atol,  Prev: atof,  Up: Alphabetical List
  1786. Syntax
  1787. ------
  1788.      #include <stdlib.h>
  1789.      
  1790.      int atoi(const char *string);
  1791. Description
  1792. -----------
  1793. Convert as much of the string as possible to an equivalent integer
  1794. value.
  1795. This function is almost like `(int)strtol(string, NULL, 10)' (*note
  1796. strtol::.).
  1797. Return Value
  1798. ------------
  1799. The equivalent value, or zero if the string does not represent a number.
  1800. Example
  1801. -------
  1802.      main(int argc, char **argv)
  1803.      {
  1804.        int i = atoi(argv[1]);
  1805.        ...
  1806. File: libc.inf,  Node: atol,  Next: _atold,  Prev: atoi,  Up: Alphabetical List
  1807. Syntax
  1808. ------
  1809.      #include <stdlib.h>
  1810.      
  1811.      long atol(const char *string);
  1812. Description
  1813. -----------
  1814. Convert as much of the string as possible to an equivalent long integer
  1815. value.
  1816. This function is almost like `strtol(string, NULL, 10)' (*note
  1817. strtol::.).
  1818. Return Value
  1819. ------------
  1820. The equivalent value, or zero if the string does not represent a number.
  1821. Example
  1822. -------
  1823.      main(int argc, char **argv)
  1824.      {
  1825.        long l = atol(argv[1]);
  1826.        ...
  1827. File: libc.inf,  Node: _atold,  Next: bcmp,  Prev: atol,  Up: Alphabetical List
  1828. _atold
  1829. ======
  1830. Syntax
  1831. ------
  1832.      #include <stdlib.h>
  1833.      
  1834.      long double _atold(const char *string);
  1835. Description
  1836. -----------
  1837. Convert as much of the string as possible to an equivalent long double
  1838. precision real number.
  1839. This function is almost like `_strtold(string, NULL)' (*note
  1840. _strtold::.).
  1841. Return Value
  1842. ------------
  1843. The equivalent value, or zero if the string does not represent a number.
  1844. Example
  1845. -------
  1846.      main(int argc, char **argv)
  1847.      {
  1848.        long double d = _atold(argv[1]);
  1849.        ...
  1850. File: libc.inf,  Node: bcmp,  Next: bcopy,  Prev: _atold,  Up: Alphabetical List
  1851. Syntax
  1852. ------
  1853.      #include <string.h>
  1854.      
  1855.      int bcmp(const void *ptr1, const void *ptr2, int length);
  1856. Description
  1857. -----------
  1858. Compare memory pointed to by PTR1 and PTR2 for at most LENGTH bytes.
  1859. Return Value
  1860. ------------
  1861. The number of bytes remaining when the first mismatch occurred, or zero
  1862. if all bytes were equal.
  1863. Example
  1864. -------
  1865.      void f(char *s1, char *s2)
  1866.      {
  1867.        int l = bcmp(s1, s2, strlen(s1));
  1868.        printf("Difference: %s, %s\n", s1+strlen(s1)-l, s2+strlen(s1)-l);
  1869.      }
  1870. File: libc.inf,  Node: bcopy,  Next: bdos,  Prev: bcmp,  Up: Alphabetical List
  1871. bcopy
  1872. =====
  1873. Syntax
  1874. ------
  1875.      #include <string.h>
  1876.      
  1877.      void bcopy(const void *source, void *dest, int length);
  1878. Description
  1879. -----------
  1880. Copy LENGTH bytes from SOURCE to DEST.  Overlapping regions are handled
  1881. properly, although this behavior is not portable.
  1882. Return Value
  1883. ------------
  1884. No value is returned.
  1885. Example
  1886. -------
  1887.      struct s a, b;
  1888.      bcopy(a, b, sizeof(struct s));
  1889. File: libc.inf,  Node: bdos,  Next: bdosptr,  Prev: bcopy,  Up: Alphabetical List
  1890. Syntax
  1891. ------
  1892.      #include <dos.h>
  1893.      
  1894.      int bdos(int func, unsigned dx, unsigned al);
  1895. Description
  1896. -----------
  1897. Calls function FUNC of the software interrupt 0x21, passing it AL as
  1898. the subfunction and (the lower 16 bit of) DX in the `DX' register.
  1899. This function will only work for a subset of DOS functions which
  1900. require no arguments at all, or take non-pointer arguments in the `AL'
  1901. and `DX' registers only.  For functions which require a pointer in the
  1902. `DX' register, use `bdosptr' (*note bdosptr::.).
  1903. Return Value
  1904. ------------
  1905. Whatever the called function returns in the AX register.
  1906. Example
  1907. -------
  1908.      /* read a character */
  1909.      int ch = bdos(1, 0, 0) & 0xff;
  1910. File: libc.inf,  Node: bdosptr,  Next: _bios_disk,  Prev: bdos,  Up: Alphabetical List
  1911. bdosptr
  1912. =======
  1913. Syntax
  1914. ------
  1915.      #include <dos.h>
  1916.      
  1917.      int bdosptr(int func, void *ptr, unsigned al);
  1918. Description
  1919. -----------
  1920. Calls function FUNC of the software interrupt 0x21, passing it AL as
  1921. the subfunction and a pointer to a copy of the buffer contents whose
  1922. address is in PTR through the `DX' register.  This function will only
  1923. work for a subset of DOS which require an argument in the `AL' register
  1924. and a pointer in `DX' register.  For functions which require
  1925. non-pointer arguments in the `DX' register, use `bdos' (*note bdos::.).
  1926. To make the contents of PTR available to DOS, `bdosptr' copies it to
  1927. the transfer buffer located in the low (below 1 Meg mark) memory.
  1928. Currently, some of the functions which take a pointer to a buffer in
  1929. `DX' are *NOT* supported (notably, most of the FCB-based functions).
  1930. *Note int86:: for the list of supported functions.
  1931. Return Value
  1932. ------------
  1933. Whatever the called function returns in the AX register.
  1934. Example
  1935. -------
  1936.      /* print a string */
  1937.      bdos(9, "Hello, there$", 0);
  1938. File: libc.inf,  Node: _bios_disk,  Next: _bios_equiplist,  Prev: bdosptr,  Up: Alphabetical List
  1939. _bios_disk
  1940. ==========
  1941. Syntax
  1942. ------
  1943.      #include <bios.h>
  1944.      
  1945.      unsigned _bios_disk(unsigned cmd, struct diskinfo_t *di)
  1946. Description
  1947. -----------
  1948. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  1949. The parameter CMD select the corresponding disk service and the
  1950. structure DI holds the disk parameters.
  1951.      struct diskinfo_t {
  1952.        unsigned drive;       /* Drive number. */
  1953.        unsigned head;        /* Head number. */
  1954.        unsigned track;       /* Track number. */
  1955.        unsigned sector;      /* Sector number. */
  1956.        unsigned nsectors;    /* Number of sectors to read/write/verify. */
  1957.        void    *buffer;      /* Buffer for reading/writing/verifying. */
  1958.      }
  1959. The following services are available based on value of CMD:
  1960. `_DISK_RESET'
  1961.      Forces the disk controller to do a hard reset, preparing for
  1962.      floppy-disk I/O. This is useful after an error occurs in another
  1963.      operation, such as a read. If this service is specified, the DI
  1964.      argument is ignored. Status is returned in the 8 high-order bits
  1965.      (AH) of the return value. If there is an error, the high-order
  1966.      byte will contain a set of status flags, as defined below under
  1967.      Return Value.
  1968. `_DISK_STATUS'
  1969.      Obtains the status of the last disk operation. If this service is
  1970.      specified, the <diskinfo> argument is ignored. Status is returned
  1971.      in the 8 low-order bits (AL) of the return value. If there is an
  1972.      error, the low-order byte (AL) will contain a set of status flags,
  1973.      as defined below under Return Value.
  1974. `_DISK_READ'
  1975.      Reads one or more disk sectors into memory. This service uses all
  1976.      fields of the structure pointed to by DISKINFO. If no error
  1977.      occurs, the function returns 0 in the high-order byte and the
  1978.      number of sectors read in the low-order byte. If there is an
  1979.      error, the high-order byte (AH) will contain a set of status
  1980.      flags, as defined below under Return Value.
  1981. `_DISK_WRITE'
  1982.      Writes data from memory to one or more disk sectors. This service
  1983.      uses all fields of the structure pointed to by <diskinfo>. If no
  1984.      error occurs, the function returns 0 in the high-order byte (AH)
  1985.      and the number of sectors written in the low-order byte (AL). If
  1986.      there is an error, the high-order byte will contain a set of
  1987.      status flags, as defined below under Return Value.
  1988. `_DISK_FORMAT'
  1989.      Formats the track specified by DISKINFO. The HEAD and TRACK fields
  1990.      indicate the track to format. Only one track can be formatted in a
  1991.      single call. The BUFFER field points to a set of sector markers.
  1992.      The format of the markers depends on the type of disk drive (see a
  1993.      technical reference to the PC BIOS to determine the marker
  1994.      format). The high-order byte (AH) of the return value contains the
  1995.      status of the call; 0 equals success. If there is an error, the
  1996.      high-order byte will contain a set of status flags, as defined
  1997.      below under Return Value.
  1998. `_DISK_VERIFY'
  1999.      Checks the disk to be sure the specified sectors exist and can be
  2000.      read.  It also runs a CRC (cyclic redundancy check) test. This
  2001.      service uses all fields (except BUFFER) of the structure pointed
  2002.      to by DISKINFO.  If no error occurs, the function returns 0 in the
  2003.      high-order byte (AH) and the number of sectors compared in the
  2004.      low-order byte (AL), as defined below under Return Value.
  2005. Return Value
  2006. ------------
  2007. Return value of AX register. The meaning of high-order byte (AH):
  2008.      0x00  No error
  2009.      0x01  Invalid request or a bad command
  2010.      0x02  Address mark not found
  2011.      0x03  Disk write protected
  2012.      0x04  Sector not found
  2013.      0x05  Reset failed
  2014.      0x06  Floppy disk removed
  2015.      0x07  Drive parameter activity failed
  2016.      0x08  Direct Memory Access (DMA) overrun
  2017.      0x09  DMA crossed 64K boundary
  2018.      0x0A  Bad sector flag detected
  2019.      0x0B  Bad track flag detected
  2020.      0x0C  Media type not found
  2021.      0x0D  Invalid number of sectors on format
  2022.      0x0E  Control data access mark detected
  2023.      0x0F  DMA arbitration level out of range
  2024.      0x10  Data read (CRC or ECC) error
  2025.      0x11  Corrected data read (ECC) error
  2026.      0x20  Controller failure
  2027.      0x40  Seek error
  2028.      0x80  Disk timed out or failed to respond
  2029.      0xAA  Drive not ready
  2030.      0xBB  Undefined error
  2031.      0xCC  Write fault on drive
  2032.      0xE0  Status error
  2033.      0xFF  Sense operation failed
  2034. Example
  2035. -------
  2036.      char record_buffer[512];
  2037.      struct diskinfo_t di;
  2038.      
  2039.      di.drive    = 0x80;
  2040.      di.head     = 0;
  2041.      di.track    = 0;
  2042.      di.sector   = 0;
  2043.      di.nsectors = 1;
  2044.      di.buffer   = &record_buffer;
  2045.      if ( _bios_disk(_DISK_READ, &di) )
  2046.        puts("Disk error.");
  2047. File: libc.inf,  Node: _bios_equiplist,  Next: _bios_keybrd,  Prev: _bios_disk,  Up: Alphabetical List
  2048. _bios_equiplist
  2049. ===============
  2050. Syntax
  2051. ------
  2052.      #include <bios.h>
  2053.      
  2054.      unsigned _bios_equiplist(void)
  2055. Description
  2056. -----------
  2057. This function returns the equipment word from BIOS request 0x11.  The
  2058. bits correspond to the following values:
  2059.      Bits  Meaning
  2060.      0     True (1) if disk drive(s) installed
  2061.      1     True (1) if math coprocessor installed
  2062.      2-3   System RAM in 16K blocks (16-64K)
  2063.      4-5   Initial video mode:
  2064.                 00 = Reserved
  2065.                 01 = 40 x 25 color
  2066.                 10 = 80 x 25 color
  2067.                 11 = 80 x 25 monochrome
  2068.      6-7   Number of floppy-disk drives installed
  2069.            (00 = 1, 01 = 2, etc.)
  2070.      8     False (0) if and only if a Direct Memory Access (DMA)
  2071.            chip is installed
  2072.      9-11  Number of RS232 serial ports installed
  2073.      12    True (1) if and only if a game adapter is installed
  2074.      13    True (1) if and only if an internal modem is installed
  2075.      14-15 Number of printers installed
  2076. Return Value
  2077. ------------
  2078. The equipment word.
  2079. Example
  2080. -------
  2081.      if ( _bios_equip() & 0xc000 )
  2082.        do_printing();
  2083. File: libc.inf,  Node: _bios_keybrd,  Next: _bios_memsize,  Prev: _bios_equiplist,  Up: Alphabetical List
  2084. _bios_keybrd
  2085. ============
  2086. Syntax
  2087. ------
  2088.      #include <bios.h>
  2089.      
  2090.      unsigned _bios_keybrd(unsigned cmd);
  2091. Description
  2092. -----------
  2093. The _bios_keybrd routine uses INT 0x16 to access the keyboard services.
  2094. The CMD argument can be any of the following manifest constants:
  2095. `_KEYBRD_READ'
  2096.      Read the next key pressed
  2097. `_NKEYBRD_READ'
  2098.      Read the next extended key pressed
  2099. `_KEYBRD_READY'
  2100.      Check if the next key in the keyboard buffer
  2101. `_NKEYBRD_READY'
  2102.      Check if the next extended key in the keyboard buffer
  2103. `_KEYBRD_SHIFTSTATUS'
  2104.      Read keyboard shift state (0x0040:0x0017 byte):
  2105.           7654 3210  Meaning
  2106.           ---- ---X  Right SHIFT is pressed
  2107.           ---- --X-  Left SHIFT is pressed
  2108.           ---- -X--  CTRL is pressed
  2109.           ---- X---  ALT is pressed
  2110.           ---X ----  Scroll Lock locked
  2111.           --X- ----  Num Lock locked
  2112.           -X-- ----  Caps Lock locked
  2113.           X--- ----  Insert locked
  2114. `_NKEYBRD_SHIFTSTATUS'
  2115.      Read keyboard shift and extended shift state (0x0040:0x0017 word):
  2116.           FEDC BA98  7654 3210  Meaning
  2117.           ---- ----  ---- ---X  Right SHIFT is pressed
  2118.           ---- ----  ---- --X-  Left SHIFT is pressed
  2119.           ---- ----  ---- -X--  CTRL is pressed
  2120.           ---- ----  ---- X---  ALT is pressed
  2121.           ---- ----  ---X ----  Scroll Lock locked
  2122.           ---- ----  --X- ----  Num Lock locked
  2123.           ---- ----  -X-- ----  Caps Lock locked
  2124.           ---- ----  X--- ----  Insert locked
  2125.           
  2126.           ---- ---X  ---- ----  Left CTRL is pressed
  2127.           ---- --X-  ---- ----  Left ALT is pressed
  2128.           ---- -X--  ---- ----  Right CTRL is pressed
  2129.           ---- X---  ---- ----  Right ALT is pressed
  2130.           ---X ----  ---- ----  Scroll Lock is pressed
  2131.           --X- ----  ---- ----  Num Lock is pressed
  2132.           -X-- ----  ---- ----  Caps Lock is pressed
  2133.           X--- ----  ---- ----  SysReq is pressed
  2134. Return Value
  2135. With the ???_READ and ???_SHIFTSTATUS arguments, the _bios_keybrd
  2136. function returns the contents of the AX register after the BIOS call.
  2137. With the ???_READY argument, _bios_keybrd returns 0 if there is no key.
  2138. If there is a key, _bios_keybrd returns the key waiting to be read
  2139. (that is, the same value as _KEYBRD_READ).
  2140. With the ???_READ and ???_READY arguments, the _bios_keybrd function
  2141. returns -1 if CTRL+BREAK has been pressed and is the next keystroke to
  2142. be read.
  2143. Example
  2144. -------
  2145.      while( !_bios_keybrd(_KEYBRD_READY) )
  2146.        try_to_do_something();
  2147. File: libc.inf,  Node: _bios_memsize,  Next: _bios_printer,  Prev: _bios_keybrd,  Up: Alphabetical List
  2148. _bios_memsize
  2149. =============
  2150. Syntax
  2151. ------
  2152.      #include <bios.h>
  2153.      
  2154.      unsigned _bios_memsize(void);
  2155. Description
  2156. -----------
  2157. This function returns the amount of system memory in 1K blocks (up to
  2158. 640K).
  2159. Return Value
  2160. ------------
  2161. Size of memory (in K).
  2162. Example
  2163. -------
  2164.      printf("This system has %d bytes of memory\n", _bios_memsize() * 1024);
  2165. File: libc.inf,  Node: _bios_printer,  Next: _bios_serialcom,  Prev: _bios_memsize,  Up: Alphabetical List
  2166. _bios_printer
  2167. =============
  2168. Syntax
  2169. ------
  2170.      #include <bios.h>
  2171.      
  2172.      unsigned _bios_printer(unsigned cmd, unsigned printer, unsigned data);
  2173. Description
  2174. -----------
  2175. The _bios_printer routine uses INT 0x17 to perform printer output
  2176. services for parallel printers. The PRINTER argument specifies the
  2177. affected printer, where 0 is LPT1, 1 is LPT2, and so on.  The CMD
  2178. argument can be any of the following manifest constants:
  2179. `_PRINTER_INIT'
  2180. `Reset and initialize the specified printer port'
  2181. `_PRINTER_STATUS'
  2182.      Return the status of the specified printer port
  2183. `_PRINTER_WRITE'
  2184.      Print the DATA argument to the specified printer port
  2185. Return Value
  2186. ------------
  2187. The _bios_printer function returns the value in the AX register after
  2188. the BIOS interrupt. The high-order byte (AH) of the return value
  2189. indicates the printer status after the operation, as defined below:
  2190.      Bit     Meaning if True
  2191.      
  2192.      0       Printer timed out
  2193.      1       Not used
  2194.      2       Not used
  2195.      3       I/O error
  2196.      4       Printer selected
  2197.      5       Out of paper
  2198.      6       Acknowledge
  2199.      7       Printer not busy
  2200. Example
  2201. -------
  2202.      while (*c)
  2203.        _bios_printer(_PRINTER_WRITE, *c++, 0);
  2204. File: libc.inf,  Node: _bios_serialcom,  Next: _bios_timeofday,  Prev: _bios_printer,  Up: Alphabetical List
  2205. _bios_serialcom
  2206. ===============
  2207. Syntax
  2208. ------
  2209.      #include <bios.h>
  2210.      
  2211.      unsigned _bios_serialcom(unsigned cmd, unsingned serialport, unsigned data);
  2212. Description
  2213. -----------
  2214. The _bios_serialcom routine uses INT 0x14 to provide serial
  2215. communications services. The SERIALPORT argument is set to 0 for COM1,
  2216. to 1 for COM2, and so on. The CMD argument can be set to one of the
  2217. following manifest constants:
  2218. `_COM_INIT'
  2219.      Initialize com port (DATA is the settings)
  2220. `_COM_RECEIVE'
  2221.      Read a byte from port
  2222. `_COM_SEND'
  2223.      Write a byte to port
  2224. `_COM_STATUS'
  2225.      Get the port status
  2226. The DATA argument is ignored if CMD is set to _COM_RECEIVE or
  2227. _COM_STATUS. The DATA argument for _COM_INIT is created by combining
  2228. one or more of the following constants (with the OR operator):
  2229.      _COM_CHR7         7 bits/character
  2230.      _COM_CHR8         8 bits/character
  2231.      _COM_STOP1        1 stop bit
  2232.      _COM_STOP2        2 stop bits
  2233.      _COM_NOPARITY     no parity
  2234.      _COM_EVENPARITY   even parity
  2235.      _COM_ODDPARITY    odd parity
  2236.      _COM_110          110 baud
  2237.      _COM_150          150 baud
  2238.      _COM_300          300 baud
  2239.      _COM_600          600 baud
  2240.      _COM_1200         1200 baud
  2241.      _COM_2400         2400 baud
  2242.      _COM_4800         4800 baud
  2243.      _COM_9600         9600 baud
  2244. The default value of DATA is 1 stop bit, no parity, and 110 baud.
  2245. Return Value
  2246. ------------
  2247. The function returns a 16-bit integer whose high-order byte contains
  2248. status bits. The meaning of the low-order byte varies, depending on the
  2249. CMD value. The high-order bits are as follows:
  2250.      Bit     Meaning if Set
  2251.      
  2252.      15      Timed out
  2253.      14      Transmission-shift register empty
  2254.      13      Transmission-hold register empty
  2255.      12      Break detected
  2256.      11      Framing error
  2257.      10      Parity error
  2258.       9      Overrun error
  2259.       8      Data ready
  2260. When service is _COM_SEND, bit 15 is set if data cannot be sent.
  2261. When service is _COM_RECEIVE, the byte read is returned in the
  2262. low-order bits if the call is successful. If an error occurs, any of
  2263. the bits 9, 10, 11, or 15 is set.
  2264. When service is _COM_INIT or _COM_STATUS, the low-order bits are
  2265. defined as follows:
  2266.      Bit     Meaning if Set
  2267.      
  2268.      7       Receive-line signal detected
  2269.      6       Ring indicator
  2270.      5       Data-set-ready
  2271.      4       Clear-to-send
  2272.      3       Change in receive-line signal detected
  2273.      2       Trailing-edge ring indicator
  2274.      1       Change in data-set-ready status
  2275.      0       Change in clear-to-send status
  2276. Example
  2277. -------
  2278.      /* 9600 baud, no parity, one stop, 8 bits */
  2279.      _bios_serialcom(_COM_INIT, 0, _COM_9600|_COM_NOPARITY|_COM_STOP1|_COM_CHR8);
  2280.      for(i=0; buf[i]; i++)
  2281.        _bios_serialcom(_COM_SEND, 0, buf[i]);
  2282. File: libc.inf,  Node: _bios_timeofday,  Next: bioscom,  Prev: _bios_serialcom,  Up: Alphabetical List
  2283. _bios_timeofday
  2284. ===============
  2285. Syntax
  2286. ------
  2287.      #include <bios.h>
  2288.      
  2289.      unsigned _bios_timeofday(unsigned cmd, unsigned long *timeval);
  2290. Description
  2291. -----------
  2292. The _bios_timeofday routine uses INT 0x1A to get or set the clock count
  2293. (which is the number of 18.2 Hz ticks since midnight). The CMD argument
  2294. can be either the _TIME_GETCLOCK or _TIME_SETCLOCK manifest constant.
  2295. Return Value
  2296. ------------
  2297. If the argument is _TIME_GETCLOCK, the routine returns a nonzero value
  2298. if midnight was passed since last read, or zero if midnight was not
  2299. passed. If the argument is _TIME_SETCLOCK, the return value is
  2300. undefined.
  2301. Example
  2302. -------
  2303.      unsigned hour, min, sec, hsec;
  2304.      unsigned long ticks;
  2305.      ...
  2306.      ticks = (unsigned long)(hour * 65543.33) + (min * 1092.38) +
  2307.              (sec * 18.21) + (hsec * 0.182);
  2308.      _bios_timeofday(_TIME_SETCLOCK, &ticks);
  2309. File: libc.inf,  Node: bioscom,  Next: biosdisk,  Prev: _bios_timeofday,  Up: Alphabetical List
  2310. bioscom
  2311. =======
  2312. Syntax
  2313. ------
  2314.      #include <bios.h>
  2315.      
  2316.      int bioscom(int cmd, char data, int port);
  2317. Description
  2318. -----------
  2319. This function accesses the BIOS interrupt 0x14 function, serial
  2320. communication services.  The valid values of cmd are:
  2321. 0 - initialize com port (DATA is the settings)
  2322. 1 - write byte to port
  2323. 2 - read byte from port
  2324. 3 - get port status
  2325. For initialization, the byte is made up of the following bits:
  2326.      0000 0000
  2327.      7654 3210  Meaning
  2328.      
  2329.      ---- --10  7 bits/character
  2330.      ---- --11  8 bits/character
  2331.      ---- -0--  1 stop bit
  2332.      ---- -1--  2 stop bits
  2333.      ---X 0---  no parity
  2334.      ---0 1---  odd parity
  2335.      ---1 1---  even parity
  2336.      000- ----  110 baud
  2337.      001- ----  150 baud
  2338.      010- ----  300 baud
  2339.      011- ----  600 baud
  2340.      100- ----  1200 baud
  2341.      101- ----  2400 baud
  2342.      110- ----  4800 baud
  2343.      111- ----  9600 baud
  2344. Return Value
  2345. ------------
  2346. The return value is a sequence of bits that indicate the port status
  2347. and, for cmd=0 and 3, the modem status.  For read/write operations, the
  2348. lower eight bits are the character read.
  2349.      1111 1100 0000 0000
  2350.      5432 1098 7654 3210  Meaning
  2351.      
  2352.      ---- ---- ---- ---1  CTS change
  2353.      ---- ---- ---- --1-  DSR change
  2354.      ---- ---- ---- -1--  ring change
  2355.      ---- ---- ---- 1---  carrier detect change
  2356.      ---- ---- ---1 ----  CTS present
  2357.      ---- ---- --1- ----  DSR present
  2358.      ---- ---- -1-- ----  ring present
  2359.      ---- ---- 1--- ----  carrier detect
  2360.      ---- ---1 ---- ----  data ready
  2361.      ---- --1- ---- ----  overrun error
  2362.      ---- -1-- ---- ----  parity error
  2363.      ---- 1--- ---- ----  framing error
  2364.      ---1 ---- ---- ----  break detected
  2365.      --1- ---- ---- ----  transmit holding register empty
  2366.      -1-- ---- ---- ----  transmit shift register empty
  2367.      1--- ---- ---- ----  time out (=1 if error present for cmd=1,2)
  2368. Example
  2369. -------
  2370.      bioscom(0, 0xe3); /* 9600 baud, no parity, one stop, 8 bits */
  2371.      for (i=0; buf[i]; i++)
  2372.        bioscom(1, buf[i]);
  2373. File: libc.inf,  Node: biosdisk,  Next: biosequip,  Prev: bioscom,  Up: Alphabetical List
  2374. biosdisk
  2375. ========
  2376. Syntax
  2377. ------
  2378.      #include <bios.h>
  2379.      
  2380.      int biosdisk(int cmd, int drive, int head, int track,
  2381.               int sector, int nsects, void *buffer);
  2382. Description
  2383. -----------
  2384. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2385. Please refer to a BIOS reference manual for detailed information about
  2386. the parameters of this call.  All known calls are supported.  A sector
  2387. size of 512 bytes is assumed.
  2388. 0 - reset disk subsystem
  2389. 1 - get disk subsystem status
  2390. 2 - read one or more sectors
  2391. 3 - write one or more sectors
  2392. 5 - format a track
  2393. 6 - format back track
  2394. 7 - format drive
  2395. 8 - get drive parameters
  2396. 9 - initialize drive parameters
  2397. 10 - read long sectors
  2398. 11 - write long sectors
  2399. 12 - seek to cylinder
  2400. 13 - alternate fixed disk reset
  2401. 14 - read test buffer
  2402. 15 - write test buffer
  2403. 16 - test for drive ready
  2404. 17 - recalibrate drive
  2405. 18 - controller RAM diagnostic
  2406. 19 - controller drive diagnostic
  2407. 20 - controller internal diagnostic
  2408. 15 - read fixed disk type
  2409. 22 - read disk change line status
  2410. 23 - set DASD type (pass dasd in NSECTS)
  2411. 24 - set media type for format
  2412. The first request with more sectors than will fit in the transfer
  2413. buffer will cause a DOS buffer to be allocated.  This buffer is
  2414. automatically freed when your application exits.  Since this buffer is
  2415. big enough to hold 18 sectors, requests for more sectors than that will
  2416. fail.
  2417. Request eight returns values in buffer as follows:
  2418. byte 0 = sectors per track (bits 0..5) and top two bits of cylinder (in bits 6..7)
  2419. byte 1 = cyliders (bits 0..7)
  2420. byte 2 = number of drives
  2421. byte 3 = number of heads
  2422. Return Value
  2423. ------------
  2424. The value of AH returned by the BIOS.
  2425. Example
  2426. -------
  2427.      char buffer[512];
  2428.      if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
  2429.        error("disk");
  2430. File: libc.inf,  Node: biosequip,  Next: bioskey,  Prev: biosdisk,  Up: Alphabetical List
  2431. biosequip
  2432. =========
  2433. Syntax
  2434. ------
  2435.      #include <bios.h>
  2436.      
  2437.      int biosequip(void);
  2438. Description
  2439. -----------
  2440. This function returns the equipment word from BIOS request 0x11.  The
  2441. bits correspond to the following values:
  2442.      1111 1100 0000 0000
  2443.      5432 1098 7654 3210  Meaning
  2444.      
  2445.      ---- ---- ---- ---X  1 = disk drive(s) installed
  2446.      ---- ---- ---- --X-  1 = math coprocessor installed
  2447.      ---- ---- ---- XX--  System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
  2448.      ---- ---- ---- -X--  1 = pointing device installed (PS/2)
  2449.      ---- ---- ---- X---  not used on PS/2
  2450.      ---- ---- --XX ----  initial video mode: 01=CO40 10=CO80 11=MONO
  2451.      ---- ---- XX-- ----  disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
  2452.      ---- ---X ---- ----  1 = no DMA available
  2453.      ---- XXX- ---- ----  number of serial ports installed (000=0 001=1 etc)
  2454.      ---X ---- ---- ----  1 = game port adapter installed
  2455.      --X- ---- ---- ----  1 = internal modem installed (PS/2)
  2456.      --X- ---- ---- ----  1 = serial printer attached (non PS/2)
  2457.      XX-- ---- ---- ----  number of printers installed (00=0 01=1 10=2 11=3)
  2458. Return Value
  2459. ------------
  2460. The equipment word.
  2461. Example
  2462. -------
  2463.      if (biosequip() & 0xc000)
  2464.        do_printing();
  2465. File: libc.inf,  Node: bioskey,  Next: biosmemory,  Prev: biosequip,  Up: Alphabetical List
  2466. bioskey
  2467. =======
  2468. Syntax
  2469. ------
  2470.      #include <bios.h>
  2471.      
  2472.      int bioskey(int command)
  2473. Description
  2474. -----------
  2475. COMMAND = 0
  2476.      Returns the next key pressed
  2477. COMMAND = 1
  2478.      Checks the keyboard, returns zero if no key pressed, else the key.
  2479.      Does not dequeue the key.
  2480. COMMAND = 2
  2481.      Returns the shift state:
  2482.           7654 3210  Meaning
  2483.           
  2484.           ---- ---X  Right shift key down
  2485.           ---- --X-  Left shift key down
  2486.           ---- -X--  Ctrl key down
  2487.           ---- X---  Alt key down
  2488.           ---X ----  Scroll lock on
  2489.           --X- ----  Num lock on
  2490.           -X-- ----  Caps lock on
  2491.           X--- ----  Insert on
  2492. Return Value
  2493. ------------
  2494. Depends on COMMAND.
  2495. Example
  2496. -------
  2497.      while (!bioskey(1))
  2498.        do_stuff();
  2499. File: libc.inf,  Node: biosmemory,  Next: biosprint,  Prev: bioskey,  Up: Alphabetical List
  2500. biosmemory
  2501. ==========
  2502. Syntax
  2503. ------
  2504.      #include <bios.h>
  2505.      
  2506.      unsigned biosmemory(void);
  2507. Description
  2508. -----------
  2509. This function returns the amount of system memory in 1k blocks.
  2510. Note that this function will return 65535 if the system has more than
  2511. 64M of memory.  This is a limitation of the BIOS.
  2512. Return Value
  2513. ------------
  2514. Bytes of memory / 1024.
  2515. Example
  2516. -------
  2517.      printf("This system has %d bytes of memory\n", biosmemory()*1024);
  2518. File: libc.inf,  Node: biosprint,  Next: biostime,  Prev: biosmemory,  Up: Alphabetical List
  2519. biosprint
  2520. =========
  2521. Syntax
  2522. ------
  2523.      #include <stdio.h>
  2524.      
  2525.      int biosprint(int cmd, int byte, int port)
  2526. Description
  2527. -----------
  2528. COMMAND = 0
  2529.      `byte' is sent to parallel port PORT.
  2530. COMMAND = 1
  2531.      Parallel port PORT is reset and initialized.
  2532. COMMAND = 2
  2533.      The status of parallel port PORT is returned.
  2534.           7654 3210  Meaning
  2535.           
  2536.           ---- ---X  Timeout
  2537.           ---- -XX-  Unused
  2538.           ---- X---  I/O Error
  2539.           ---X ----  Selected
  2540.           --X- ----  Out of paper
  2541.           -X-- ----  Acknowledged
  2542.           X--- ----  Idle
  2543. Return Value
  2544. ------------
  2545. The printer status.
  2546. Example
  2547. -------
  2548.      while (*c)
  2549.        biosprint(0, *c++, 0);
  2550. File: libc.inf,  Node: biostime,  Next: blinkvideo,  Prev: biosprint,  Up: Alphabetical List
  2551. biostime
  2552. ========
  2553. Syntax
  2554. ------
  2555.      #include <bios.h>
  2556.      
  2557.      long biostime(int cmd, long newtime);
  2558. Description
  2559. -----------
  2560. This function reads (CMD=0) or sets (CMD=1) the internal tick counter,
  2561. which is the number of 18.2 Hz ticks since midnight.
  2562. Return Value
  2563. ------------
  2564. When reading, the number of ticks since midnight.
  2565. Example
  2566. -------
  2567.      long ticks = biostime(0, 0);
  2568. File: libc.inf,  Node: blinkvideo,  Next: brk,  Prev: biostime,  Up: Alphabetical List
  2569. blinkvideo
  2570. ==========
  2571. Syntax
  2572. ------
  2573.      #include <conio.h>
  2574.      void blinkvideo(void);
  2575. Description
  2576. -----------
  2577. Bit 7 (`MSB') of the character attribute byte has two possible effects
  2578. on EGA and VGA displays: it can either make the character blink or
  2579. change the background color to bright (thus allowing for 16 background
  2580. colors as opposed to the usual 8).  This function sets that bit to
  2581. display blinking characters.  After a call to this function, every
  2582. character written to the screen with bit 7 of the attribute byte set,
  2583. will blink.  The companion function `intensevideo' (*note
  2584. intensevideo::.) has the opposite effect.
  2585. Note that there is no BIOS function to get the current status of this
  2586. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  2587. the current state: if it's 1 (the default), blinking characters will be
  2588. displayed.
  2589. File: libc.inf,  Node: brk,  Next: bsearch,  Prev: blinkvideo,  Up: Alphabetical List
  2590. Syntax
  2591. ------
  2592.      #include <stdlib.h>
  2593.      
  2594.      int brk(void *ptr);
  2595. Description
  2596. -----------
  2597. This function changes the *break* for the program.  This is the first
  2598. address that, if referenced, will cause a fault to occur.  The program
  2599. asks for more memory by specifying larger values for PTR.  Normally,
  2600. this is done transparently through the `malloc' function.
  2601. Return Value
  2602. ------------
  2603. zero if the break was changed, -1 if not.  ERRNO is set to the error.
  2604. Example
  2605. -------
  2606.      if (brk(old_brk+1000))
  2607.        printf("no memory\n");
  2608. File: libc.inf,  Node: bsearch,  Next: bzero,  Prev: brk,  Up: Alphabetical List
  2609. bsearch
  2610. =======
  2611. Syntax
  2612. ------
  2613.      #include <stdlib.h>
  2614.      
  2615.      void *bsearch (const void *key, const void *base, size_t num,
  2616.        size_t size, int (*ptf)(const void *ckey, const void *celem));
  2617. Description
  2618. -----------
  2619. Given an array of values, perform a binary search on the values looking
  2620. for value that "matches" the given key.  A match is determined by
  2621. calling the provided function PTF and passing it the key as CKEY and a
  2622. pointer to one of the elements of the array as CELEM.  This function
  2623. must return a negative number if the key is closer than the element to
  2624. the beginning of the array, positive if it is closer to the end, and
  2625. zero if the element matches the key.
  2626. The array begins at address BASE and contains NUM elements, each of
  2627. size SIZE.
  2628. Return Value
  2629. ------------
  2630. Returns a pointer to the element that matches the key, else NULL.
  2631. Example
  2632. -------
  2633.      typedef struct {
  2634.        int a, b;
  2635.      } q;
  2636.      
  2637.      int compare(void *key, void *elem)
  2638.      {
  2639.        return *(int *)key - ((q *)elem)->a;
  2640.      }
  2641.      
  2642.      q qlist[100];
  2643.      
  2644.      ...
  2645.      q *match = bsearch(4, qlist, 100, sizeof(q), compare);
  2646.      printf("4->%d=n", match->b);
  2647.      ...
  2648. File: libc.inf,  Node: bzero,  Next: calloc,  Prev: bsearch,  Up: Alphabetical List
  2649. bzero
  2650. =====
  2651. Syntax
  2652. ------
  2653.      #include <string.h>
  2654.      
  2655.      void bzero(void *pointer, int length);
  2656. Description
  2657. -----------
  2658. The data at POINTER is filled with LENGTH zeros.
  2659. Return Value
  2660. ------------
  2661. None.
  2662. Example
  2663. -------
  2664.      char foo[100];
  2665.      bzero(foo,100);
  2666. File: libc.inf,  Node: calloc,  Next: ceil,  Prev: bzero,  Up: Alphabetical List
  2667. calloc
  2668. ======
  2669. Syntax
  2670. ------
  2671.      #include <malloc.h>
  2672.      
  2673.      void *calloc(size_t num_elements, size_t size);
  2674. Description
  2675. -----------
  2676. This function allocates enough memory for NUM_ELEMENTS objects of size
  2677. SIZE.  The memory returned is initialized to all zeros.  The pointer
  2678. returned should later be passed to free (*note free::.) so that the
  2679. memory can be returned to the heap.
  2680. You may use cfree (*note xfree::.) to free the pointer also; it just
  2681. calls free.
  2682. Return Value
  2683. ------------
  2684. A pointer to the memory, or `NULL' if no more memory is available.
  2685. Example
  2686. -------
  2687.      Complex *x = calloc(12, sizeof(Complex));
  2688.      cfree(x);
  2689. File: libc.inf,  Node: ceil,  Next: cfgetispeed,  Prev: calloc,  Up: Alphabetical List
  2690. Syntax
  2691. ------
  2692.      #include <math.h>
  2693.      
  2694.      double ceil(double x);
  2695. Return Value
  2696. ------------
  2697. The smallest integer value greater than or equal to X.
  2698. File: libc.inf,  Node: cfgetispeed,  Next: cfgetospeed,  Prev: ceil,  Up: Alphabetical List
  2699. cfgetispeed
  2700. ===========
  2701. Syntax
  2702. ------
  2703.      #include <termios.h>
  2704.      
  2705.      speed_t cfgetispeed (const struct termios *termiosp);
  2706. Description
  2707. -----------
  2708. This function gets the input line speed stored in the structure
  2709. TERMIOSP.  It is provided for compatibility only.  Note that the
  2710. termios emulation handles console only.
  2711. Return Value
  2712. ------------
  2713. The input line speed on success, (speed_t) -1 for error.
  2714. File: libc.inf,  Node: cfgetospeed,  Next: cfmakeraw,  Prev: cfgetispeed,  Up: Alphabetical List
  2715. cfgetospeed
  2716. ===========
  2717. Syntax
  2718. ------
  2719.      #include <termios.h>
  2720.      
  2721.      speed_t cfgetospeed (const struct termios *termiosp);
  2722. Description
  2723. -----------
  2724. This function gets the output line speed stored in the structure
  2725. TERMIOSP.  It is provided for compatibility only.  Note that the
  2726. termios emulation handles console only.
  2727. Return Value
  2728. ------------
  2729. The output line speed on success, (speed_t) -1 for error.
  2730. File: libc.inf,  Node: cfmakeraw,  Next: cfree,  Prev: cfgetospeed,  Up: Alphabetical List
  2731. cfmakeraw
  2732. =========
  2733. Syntax
  2734. ------
  2735.      #include <termios.h>
  2736.      
  2737.      void cfmakeraw (struct termios *termiosp);
  2738. Description
  2739. -----------
  2740. This function sets the structure specified by TERMIOSP for raw mode.
  2741. It is provided for compatibility only.  Note that the termios emulation
  2742. handles console only.
  2743. Return Value
  2744. ------------
  2745. Zero on success, nonzero on failure.
  2746. File: libc.inf,  Node: cfree,  Next: cfsetispeed,  Prev: cfmakeraw,  Up: Alphabetical List
  2747. cfree
  2748. =====
  2749. Syntax
  2750. ------
  2751.      #include <stdlib.h>
  2752.      
  2753.      void cfree(void *pointer);
  2754. Description
  2755. -----------
  2756. This function returns the memory allocated by calloc (*note calloc::.)
  2757. to the heap.
  2758. Return Value
  2759. ------------
  2760. None.
  2761. Example
  2762. -------
  2763.      Complex *x = calloc(12, sizeof(Complex));
  2764.      cfree(x);
  2765. File: libc.inf,  Node: cfsetispeed,  Next: cfsetospeed,  Prev: cfree,  Up: Alphabetical List
  2766. cfsetispeed
  2767. ===========
  2768. Syntax
  2769. ------
  2770.      #include <termios.h>
  2771.      
  2772.      int cfsetispeed (struct termios *termiosp, speed_t speed);
  2773. Description
  2774. -----------
  2775. This function sets the input line speed stored in the structure
  2776. TERMIOSP to SPEED.  It is provided for compatibility only.  Note that
  2777. the termios emulation handles console only.
  2778. Return Value
  2779. ------------
  2780. Zero on success, nonzero on failure.
  2781. File: libc.inf,  Node: cfsetospeed,  Next: cfsetspeed,  Prev: cfsetispeed,  Up: Alphabetical List
  2782. cfsetospeed
  2783. ===========
  2784. Syntax
  2785. ------
  2786.      #include <termios.h>
  2787.      
  2788.      int cfsetospeed (struct termios *termiosp, speed_t speed);
  2789. Description
  2790. -----------
  2791. This function sets the output line speed stored in the structure
  2792. TERMIOSP to SPEED.  It is provided for compatibility only.  Note that
  2793. the termios emulation handles console only.
  2794. Return Value
  2795. ------------
  2796. Zero on success, nonzero on failure.
  2797. File: libc.inf,  Node: cfsetspeed,  Next: cgets,  Prev: cfsetospeed,  Up: Alphabetical List
  2798. cfsetspeed
  2799. ==========
  2800. Syntax
  2801. ------
  2802.      #include <termios.h>
  2803.      
  2804.      int cfsetspeed (struct termios *termiosp, speed_t speed);
  2805. Description
  2806. -----------
  2807. This function sets the input and output line speed stored in the
  2808. structure TERMIOSP to SPEED.  It is provided for compatibility only.
  2809. Note that the termios emulation handles console only.
  2810. Return Value
  2811. ------------
  2812. Zero on success, nonzero on failure.
  2813. File: libc.inf,  Node: cgets,  Next: chdir,  Prev: cfsetspeed,  Up: Alphabetical List
  2814. cgets
  2815. =====
  2816. Syntax
  2817. ------
  2818.      #include <conio.h>
  2819.      
  2820.      char *cgets(char *_str);
  2821. Description
  2822. -----------
  2823. Get a string from the console.  This will take advantage of any
  2824. command-line editing TSRs.  To use, you must pre-fill the first
  2825. character of the buffer.  The first character is the size of the
  2826. buffer.  On return, the second character is the number of characters
  2827. read.  The third character is the first character read.
  2828. Return Value
  2829. ------------
  2830. A pointer to the first character read.
  2831. File: libc.inf,  Node: chdir,  Next: chmod,  Prev: cgets,  Up: Alphabetical List
  2832. chdir
  2833. =====
  2834. Syntax
  2835. ------
  2836.      #include <unistd.h>
  2837.      
  2838.      int chdir(const char *new_directory);
  2839. Description
  2840. -----------
  2841. This function changes the current directory to NEW_DIRECTORY.  If a
  2842. drive letter is specified, the current directory for that drive is
  2843. changed and the current disk is set to that drive, else the current
  2844. directory for the current drive is changed.
  2845. Return Value
  2846. ------------
  2847. Zero if the new directory exists, else nonzero and ERRNO set if error.
  2848. Example
  2849. -------
  2850.      if (chdir("/tmp"))
  2851.        perror("/tmp");
  2852. File: libc.inf,  Node: chmod,  Next: _chmod,  Prev: chdir,  Up: Alphabetical List
  2853. chmod
  2854. =====
  2855. Syntax
  2856. ------
  2857.      #include <sys/stat.h>
  2858.      
  2859.      int chmod(const char *path, mode_t mode);
  2860. Description
  2861. -----------
  2862. This function changes the mode (writable or write-only) of the specified
  2863. file.  The value of MODE can be a combination of one or more of the
  2864. following:
  2865. `S_IRUSR'
  2866.      Make the file readable
  2867. `S_IWUSR'
  2868.      Make the file writable
  2869. Other `S_I*' values could be included, but they will be ignored.
  2870. Return Value
  2871. ------------
  2872. Zero if the file exists and the mode was changed, else nonzero.
  2873. Example
  2874. -------
  2875.      chmod("/tmp/dj.dat", S_IWUSR|S_IRUSR);
  2876. File: libc.inf,  Node: _chmod,  Next: chown,  Prev: chmod,  Up: Alphabetical List
  2877. _chmod
  2878. ======
  2879. Syntax
  2880. ------
  2881.      #include <io.h>
  2882.      
  2883.      int _chmod(const char *filename, int func, mode_t mode);
  2884. Description
  2885. -----------
  2886. This is a direct connection to the MS-DOS chmod function call, int
  2887. 0x21, %ax = 0x4300/0x4301.  If FUNC is 0, then DOS is called with AX =
  2888. 0x4300, which returns an attribute byte of a file.  If FUNC is 1, then
  2889. the attributes of a file are set as specified in MODE.  Note that the
  2890. directory and volume attribute bits must always be 0 when `_chmod()' is
  2891. called with FUNC = 1, or else the call will fail.  The third argument
  2892. is optional when getting attributes.  The attribute bits are defined as
  2893. follows:
  2894.        Bit       Meaning
  2895.      76543210
  2896.      .......1    Read-only
  2897.      ......1.    Hidden
  2898.      .....1..    System
  2899.      ....1...    Volume Label
  2900.      ...1....    Directory
  2901.      ..1.....    Archive
  2902.      xx......    Reserved (used by some network redirectors)
  2903. Return Value
  2904. ------------
  2905. If the file exists, `_chmod()' returns its attribute byte in case it
  2906. succeded, or -1 in case of failure.
  2907. File: libc.inf,  Node: chown,  Next: chsize,  Prev: _chmod,  Up: Alphabetical List
  2908. chown
  2909. =====
  2910. Syntax
  2911. ------
  2912.      #include <unistd.h>
  2913.      
  2914.      int chown(const char *file, int owner, int group);
  2915. Description
  2916. -----------
  2917. This function does nothing under MS-DOS
  2918. Return Value
  2919. ------------
  2920. This function always returns zero if the file exists, else it returns
  2921. -1 and sets ERRNO to `ENOENT'.
  2922. File: libc.inf,  Node: chsize,  Next: _clear87,  Prev: chown,  Up: Alphabetical List
  2923. chsize
  2924. ======
  2925. Syntax
  2926. ------
  2927.      #include <io.h>
  2928.      
  2929.      int chsize(int handle, long size);
  2930. Description
  2931. -----------
  2932. Just calls ftruncate (*note ftruncate::.).
  2933. Return Value
  2934. ------------
  2935. Zero on success, -1 on failure.
  2936. File: libc.inf,  Node: _clear87,  Next: clearerr,  Prev: chsize,  Up: Alphabetical List
  2937. _clear87
  2938. ========
  2939. Syntax
  2940. ------
  2941.      #include <float.h>
  2942.      
  2943.      unsigned int _clear87(void);
  2944. Description
  2945. -----------
  2946. Clears the floating point processor's exception flags.
  2947. Return Value
  2948. ------------
  2949. The previous status word.
  2950. File: libc.inf,  Node: clearerr,  Next: clock,  Prev: _clear87,  Up: Alphabetical List
  2951. clearerr
  2952. ========
  2953. Syntax
  2954. ------
  2955.      #include <stdio.h>
  2956.      
  2957.      void clearerr(FILE *stream);
  2958. Description
  2959. -----------
  2960. This function clears the EOF and error indicators for the file STREAM.
  2961. Return Value
  2962. ------------
  2963. None.
  2964. Example
  2965. -------
  2966.      clearerr(stdout);
  2967. File: libc.inf,  Node: clock,  Next: close,  Prev: clearerr,  Up: Alphabetical List
  2968. clock
  2969. =====
  2970. Syntax
  2971. ------
  2972.      #include <time.h>
  2973.      
  2974.      clock_t clock(void);
  2975. Description
  2976. -----------
  2977. This function returns the number of clock ticks since an arbitrary time,
  2978. actually, since the first call to `clock', which itself returns zero.
  2979. The number of tics per second is CLOCKS_PER_SEC.
  2980. Return Value
  2981. ------------
  2982. The number of tics.
  2983. Example
  2984. -------
  2985.      printf("%d seconds have elapsed\n", clock()/CLOCKS_PER_SEC);
  2986. File: libc.inf,  Node: close,  Next: _close,  Prev: clock,  Up: Alphabetical List
  2987. close
  2988. =====
  2989. Syntax
  2990. ------
  2991.      #include <unistd.h>
  2992.      
  2993.      int close(int fd);
  2994. Description
  2995. -----------
  2996. The open file associated with FD is closed.
  2997. Return Value
  2998. ------------
  2999. Zero if the file was closed, nonzero if FD was invalid or already
  3000. closed.
  3001. Example
  3002. -------
  3003.      int fd = open("data", O_RDONLY);
  3004.      close(fd);
  3005. File: libc.inf,  Node: _close,  Next: closedir,  Prev: close,  Up: Alphabetical List
  3006. _close
  3007. ======
  3008. Syntax
  3009. ------
  3010.      #include <io.h>
  3011.      
  3012.      int _close(int fd);
  3013. Description
  3014. -----------
  3015. This is a direct connection to the MS-DOS close function call, int
  3016. 0x21, %ah = 0x3e.
  3017. Return Value
  3018. ------------
  3019. Zero if the file was closed, else nonzero.
  3020. File: libc.inf,  Node: closedir,  Next: clreol,  Prev: _close,  Up: Alphabetical List
  3021. closedir
  3022. ========
  3023. Syntax
  3024. ------
  3025.      #include <dirent.h>
  3026.      
  3027.      int closedir(DIR *dir);
  3028. Description
  3029. -----------
  3030. This function closes a directory opened by opendir (*note opendir::.).
  3031. Return Value
  3032. ------------
  3033. Zero on success, nonzero if DIR is invalid.
  3034. File: libc.inf,  Node: clreol,  Next: clrscr,  Prev: closedir,  Up: Alphabetical List
  3035. clreol
  3036. ======
  3037. Syntax
  3038. ------
  3039.      #include <conio.h>
  3040.      
  3041.      void clreol(void);
  3042. Description
  3043. -----------
  3044. Clear to end of line.
  3045. Return Value
  3046. ------------
  3047. None.
  3048. File: libc.inf,  Node: clrscr,  Next: _conio_kbhit,  Prev: clreol,  Up: Alphabetical List
  3049. clrscr
  3050. ======
  3051. Syntax
  3052. ------
  3053.      #include <conio.h>
  3054.      
  3055.      void clrscr(void);
  3056. Description
  3057. -----------
  3058. Clear the entire screen.
  3059. File: libc.inf,  Node: _conio_kbhit,  Next: _control87,  Prev: clrscr,  Up: Alphabetical List
  3060. _conio_kbhit
  3061. ============
  3062. Syntax
  3063. ------
  3064.      #include <conio.h>
  3065.      
  3066.      int _conio_kbhit(void);
  3067. Description
  3068. -----------
  3069. Determines whether or not a character is waiting at the keyboard.  If
  3070. there is an ungetch'd character, this function returns true.  Note that
  3071. if you include `conio.h', the *Note kbhit:: function is redefined to be
  3072. this function instead.
  3073. Return Value
  3074. ------------
  3075. Nonzero if a key is waiting, else zero.
  3076. File: libc.inf,  Node: _control87,  Next: cos,  Prev: _conio_kbhit,  Up: Alphabetical List
  3077. _control87
  3078. ==========
  3079. Syntax
  3080. ------
  3081.      #include <float.h>
  3082.      
  3083.      unsigned int _control87(unsigned int newcw, unsigned int mask);
  3084. Description
  3085. -----------
  3086. Sets or resets bits in the FPU's control register.  The bits are
  3087. defined by macros in float.h, and by this table:
  3088.      ---- ---- --XX XXXX = MCW_EM - exception masks (1=handle exception internally, 0=fault)
  3089.      ---- ---- ---- ---X = EM_INVALID - invalid operation
  3090.      ---- ---- ---- --X- = EM_DENORMAL - denormal operand
  3091.      ---- ---- ---- -X-- = EM_ZERODIVIDE - divide by zero
  3092.      ---- ---- ---- X--- = EM_OVERFLOW - overflow
  3093.      ---- ---- ---X ---- = EM_UNDERFLOW - underflow
  3094.      ---- ---- --X- ---- = EM_INEXACT - rounding was required
  3095.      ---- --XX ---- ---- = MCW_PC - precision control
  3096.      ---- --00 ---- ---- = PC_24 - single precision
  3097.      ---- --10 ---- ---- = PC_53 - double precision
  3098.      ---- --11 ---- ---- = PC_64 - extended precision
  3099.      ---- XX-- ---- ---- = MCW_RC - rounding control
  3100.      ---- 00-- ---- ---- = RC_NEAR - round to nearest
  3101.      ---- 01-- ---- ---- = RC_DOWN - round towards -Inf
  3102.      ---- 10-- ---- ---- = RC_UP - round towards +Inf
  3103.      ---- 11-- ---- ---- = RC_CHOP - round towards zero
  3104.      ---X ---- ---- ---- = MCW_IC - infinity control (obsolete, always affine)
  3105.      ---0 ---- ---- ---- = IC_AFFINE - -Inf < +Inf
  3106.      ---1 ---- ---- ---- = IC_PROJECTIVE - -Inf == +Inf
  3107. Return Value
  3108. ------------
  3109. The previous control word.
  3110. File: libc.inf,  Node: cos,  Next: cosh,  Prev: _control87,  Up: Alphabetical List
  3111. Syntax
  3112. ------
  3113.      #include <math.h>
  3114.      
  3115.      double cos(double x);
  3116. Return Value
  3117. ------------
  3118. The cosine of X.
  3119. File: libc.inf,  Node: cosh,  Next: cprintf,  Prev: cos,  Up: Alphabetical List
  3120. Syntax
  3121. ------
  3122.      #include <math.h>
  3123.      
  3124.      double cosh(double x);
  3125. Return Value
  3126. ------------
  3127. The hyperbolic cosine of X.
  3128. File: libc.inf,  Node: cprintf,  Next: cputs,  Prev: cosh,  Up: Alphabetical List
  3129. cprintf
  3130. =======
  3131. Syntax
  3132. ------
  3133.      #include <conio.h>
  3134.      
  3135.      int cprintf(const char *_format, ...);
  3136. Description
  3137. -----------
  3138. Like `printf' (*note printf::.), but prints through the console, taking
  3139. into consideration window borders and text attributes.  There is
  3140. currently a 2048-byte limit on the size of each individual cprintf call.
  3141. Return Value
  3142. ------------
  3143. The number of characters written.
  3144. File: libc.inf,  Node: cputs,  Next: creat,  Prev: cprintf,  Up: Alphabetical List
  3145. cputs
  3146. =====
  3147. Syntax
  3148. ------
  3149.      #include <conio.h>
  3150.      
  3151.      int cputs(const char *_str);
  3152. Description
  3153. -----------
  3154. Puts the string onto the console.  The cursor position is updated.
  3155. Return Value
  3156. ------------
  3157. zero on success.
  3158. File: libc.inf,  Node: creat,  Next: _creat,  Prev: cputs,  Up: Alphabetical List
  3159. creat
  3160. =====
  3161. Syntax
  3162. ------
  3163.      #include <fcntl.h>
  3164.      #include <sys/stat.h> /* for mode definitions */
  3165.      
  3166.      int creat(const char *filename, mode_t mode);
  3167. Description
  3168. -----------
  3169. This function creates the given file and opens it for writing.  If the
  3170. file exists, it is truncated to zero size, unless it is read-only, in
  3171. which case the function fails.  If the file does not exist, it will be
  3172. created read-only if MODE does not have `S_IWUSR' set.
  3173. Return Value
  3174. ------------
  3175. A file descriptor >= 0, or a negative number on error.
  3176. Example
  3177. -------
  3178.      int fd = creat("data", S_IRUSR|S_IWUSR);
  3179.      write(fd, buf, 1024);
  3180.      close(fd);
  3181. File: libc.inf,  Node: _creat,  Next: crlf2nl,  Prev: creat,  Up: Alphabetical List
  3182. _creat
  3183. ======
  3184. Syntax
  3185. ------
  3186.      #include <io.h>
  3187.      
  3188.      int _creat(const char *path, int attrib);
  3189. Description
  3190. -----------
  3191. This is a direct connection to the MS-DOS creat function call, int
  3192. 0x21, %ah = 0x3c.  The file is set to binary mode.
  3193. Return Value
  3194. ------------
  3195. The new file descriptor, else -1 on error.
  3196. File: libc.inf,  Node: crlf2nl,  Next: __crt0_glob_function,  Prev: _creat,  Up: Alphabetical List
  3197. crlf2nl
  3198. =======
  3199. Syntax
  3200. ------
  3201.      size_t crlf2nl(char *buf, ssize_t len);
  3202. Description
  3203. -----------
  3204. This function removes Ctrl-M characters from the given BUF.
  3205. Return Value
  3206. ------------
  3207. The number of characters remaining in the buffer are returned.
  3208. File: libc.inf,  Node: __crt0_glob_function,  Next: __crt0_load_environment_file,  Prev: crlf2nl,  Up: Alphabetical List
  3209. __crt0_glob_function
  3210. ====================
  3211. Syntax
  3212. ------
  3213.      #include <crt0.h>
  3214.      
  3215.      char **__crt0_glob_function(char *_argument);
  3216. Description
  3217. -----------
  3218. If the application wishes to provide a wildcard expansion function, it
  3219. should define a `__crt0_glob_function' function.  It should return a
  3220. list of the expanded values, or 0 if no expansion will occur.  The
  3221. startup code will free the returned pointer if it is nonzero.
  3222. If no expander function is provided, wildcards will be expanded in the
  3223. POSIX.1 style by the default `__crt0_glob_function' from the C library.
  3224. To disable expansion, provide a `__crt0_glob_function' that always
  3225. returns 0.
  3226. File: libc.inf,  Node: __crt0_load_environment_file,  Next: __crt0_setup_arguments,  Prev: __crt0_glob_function,  Up: Alphabetical List
  3227. __crt0_load_environment_file
  3228. ============================
  3229. Syntax
  3230. ------
  3231.      #include <crt0.h>
  3232.      
  3233.      void   __crt0_load_environment_file(char *_app_name);
  3234. Description
  3235. -----------
  3236. This function, provided by libc.a, does all the work required to load
  3237. additional environment variables from the file $DJGPP.  If the
  3238. application does not use environment variables, the programmer can
  3239. reduce the size of the program image by providing a version of this
  3240. function that does nothing.
  3241. *Note __crt0_setup_arguments::.
  3242. File: libc.inf,  Node: __crt0_setup_arguments,  Next: _crt0_startup_flags,  Prev: __crt0_load_environment_file,  Up: Alphabetical List
  3243. __crt0_setup_arguments
  3244. ======================
  3245. Syntax
  3246. ------
  3247.      #include <crt0.h>
  3248.      
  3249.      void   __crt0_setup_arguments(void);
  3250. Description
  3251. -----------
  3252. This function, provided by libc.a, does all the work required to
  3253. provide the two arguments passed to main() (usually `argc' and `argv').
  3254. If main() does not use these arguments, the programmer can reduce the
  3255. size of the program image by providing a version of this function that
  3256. does nothing.
  3257. Note that since the default `__crt0_setup_arguments_function' will
  3258. *not* expand wildcards inside quotes (`"' or `''), but you can quote a
  3259. part of the argument that doesn't include wildcards and still have them
  3260. expanded.  This is so you could use wildcard expansion with filenames
  3261. which have embedded whitespace (on LFN filesystems).
  3262. *Note __crt0_load_environment_file::.
  3263. File: libc.inf,  Node: _crt0_startup_flags,  Next: cscanf,  Prev: __crt0_setup_arguments,  Up: Alphabetical List
  3264. _crt0_startup_flags
  3265. ===================
  3266. Syntax
  3267. ------
  3268.      #include <crt0.h>
  3269.      
  3270.      int _crt0_startup_flags = ...;
  3271. Description
  3272. -----------
  3273. This variable can be used to determine what the startup code will (or
  3274. will not) do when the program begins.  This can be used to tailor the
  3275. startup environment to a particular program.
  3276. `_CRT0_FLAG_PRESERVE_UPPER_CASE'
  3277.      If set, argv[0] is left in whatever case it was.  If not set, all
  3278.      characters are mapped to lower case.  Note that if the argv0 field
  3279.      in the stubinfo structure is present, the case of that part of
  3280.      argv0 is not affected.
  3281. `_CRT0_FLAG_USE_DOS_SLASHES'
  3282.      If set, reverse slashes (dos-style) are preserved in argv[0].  If
  3283.      not set, all reverse slashes are replaced with unix-style slashes.
  3284. `_CRT0_FLAG_DROP_EXE_SUFFIX'
  3285.      If set, the .EXE suffix is removed from the file name component of
  3286.      argv[0].  If not set, the suffix remains.
  3287. `_CRT0_FLAG_DROP_DRIVE_SPECIFIER'
  3288.      If set, the drive specifier (ex: `C:') is removed from the
  3289.      beginning of argv[0] (if present).  If not set, the drive
  3290.      specifier remains.
  3291. `_CRT0_FLAG_DISALLOW_RESPONSE_FILES'
  3292.      If set, response files (ex: @gcc.rf) are not expanded.  If not
  3293.      set, the contents of the response files are used to create
  3294.      arguments.  Note that if the file does not exist, that argument
  3295.      remains unexpanded.
  3296. `_CRT0_FLAG_FILL_SBRK_MEMORY'
  3297.      If set, fill sbrk()'d memory with a constant value.  If not, memory
  3298.      gets whatever happens to have been in there, which breaks some
  3299.      applications.
  3300. `_CRT0_FLAG_FILL_DEADBEEF'
  3301.      If set, fill memory (above) with 0xdeadbeef, else fill with zero.
  3302.      This is especially useful for debugging uninitialized memory
  3303.      problems.
  3304. `_CRT0_FLAG_NEARPTR'
  3305.      If set, set DS limit to 4GB which allows use of near pointers to
  3306.      DOS (and other) memory.  WARNING, disables memory protection and
  3307.      bad pointers may crash the machine or wipe out your data.
  3308. `_CRT0_FLAG_NULLOK'
  3309.      If set, disable NULL pointer protection (if it can be controlled
  3310.      at all).
  3311. `_CRT0_FLAG_NMI_SIGNAL'
  3312.      If set, enabled capture of NMI in exception code.  This may cause
  3313.      problems with laptops and "green" boxes which use it to wake up.
  3314.      Default is to leave NMIs alone and pass through to real mode code.
  3315.      You decide.
  3316. `_CRT0_FLAG_NO_LFN'
  3317.      If set, disable usage of long file name functions even on systems
  3318.      (such as Win95) which support them.  This might be needed to work
  3319.      around program assumptions on file name format on programs written
  3320.      specifically for DOS.  Note that this flag overrides the value of
  3321.      the environment variable `LFN'.
  3322. `_CRT0_FLAG_NONMOVE_SBRK'
  3323.      If set, the sbrk() algorithm used used multiple DPMI memory blocks
  3324.      which makes sure the base of CS/DS/SS does not change.  This may
  3325.      cause problems with sbrk(0) values and programs with other
  3326.      assumptions about sbrk behavior.  This flag is useful with near
  3327.      pointers, since a constant pointer to DOS/Video memory can be
  3328.      computed without needing to reload it after any routine which
  3329.      might call sbrk().
  3330. `_CRT0_FLAG_UNIX_SBRK'
  3331.      If set, the sbrk() algorithm used resizes memory blocks so that
  3332.      the layout of memory is set up to be the most compatible with unix
  3333.      sbrk() expectations.  This mode should not be used with hardware
  3334.      interrupts, near pointers, and may cause problems with QDPMI
  3335.      virtual memory.  If your program requires a specific sbrk()
  3336.      behavior, you should set one of these flags, since the default may
  3337.      change in different libc releases.
  3338. `_CRT0_FLAG_LOCK_MEMORY'
  3339.      If set, locks all memory as it is allocated.  This effectively
  3340.      disables virtual memory, and may be useful if using extensive
  3341.      hardware interrupt codes in a relatively small image size.  The
  3342.      memory is locked after it is sbrk()ed, so the locking may fail.
  3343.      This bit may be set or cleared during execution.  When sbrk() uses
  3344.      multiple memory zones, it can be difficult to lock all memory
  3345.      since the memory block size and location is impossible to
  3346.      determine.
  3347. `_CRT0_FLAG_PRESERVE_FILENAME_CASE'
  3348.      If set, disables all filename letter-case conversions in functions
  3349.      that traverse directories (except findfirst/findnext which always
  3350.      return the filenames exactly as found in the directory entry).
  3351.      When reset, all filenames on 8+3 MSDOS filesystems and DOS-style
  3352.      8+3 filenames on LFN systems are converted to lower-case by
  3353.      functions such as `readdir', `getcwd', `_fixpath' and others.
  3354.      Note that when this flag is set, ALL filenames on MSDOS systems
  3355.      will appear in upper-case, which is both ugly and will break many
  3356.      Unix-born programs.  Use only if you know exactly what you are
  3357.      doing!
  3358.      This flag overrides the value of the environment variable `FNCASE',
  3359.      *Note _preserve_fncase::.
  3360. File: libc.inf,  Node: cscanf,  Next: ctime,  Prev: _crt0_startup_flags,  Up: Alphabetical List
  3361. cscanf
  3362. ======
  3363. Syntax
  3364. ------
  3365.      #include <conio.h>
  3366.      
  3367.      int cscanf(const char *_format, ...);
  3368. Description
  3369. -----------
  3370. Like `scanf' (*note scanf::.), but it reads from the keyboard directly.
  3371. Return Value
  3372. ------------
  3373. The number of fields stored.
  3374. File: libc.inf,  Node: ctime,  Next: delay,  Prev: cscanf,  Up: Alphabetical List
  3375. ctime
  3376. =====
  3377. Syntax
  3378. ------
  3379.      #include <time.h>
  3380.      
  3381.      char *ctime(const time_t *cal);
  3382. Description
  3383. -----------
  3384. This function returns an ASCII representation of the time in CAL.  This
  3385. is equivalent to `asctime(localtime(cal))'.  *Note asctime::.  *Note
  3386. localtime::.
  3387. Return Value
  3388. ------------
  3389. The ascii representation of the time.
  3390. File: libc.inf,  Node: delay,  Next: delline,  Prev: ctime,  Up: Alphabetical List
  3391. delay
  3392. =====
  3393. Syntax
  3394. ------
  3395.      void delay(unsigned msec);
  3396. Description
  3397. -----------
  3398. This function causes the program to pause for MSEC milliseconds.  It
  3399. uses the `int 15h' delay function to relinquish the CPU to other
  3400. programs that might need it.
  3401. Return Value
  3402. ------------
  3403. None.
  3404. Example
  3405. -------
  3406.      delay(200); /* delay for 1/5 second */
  3407. File: libc.inf,  Node: delline,  Next: difftime,  Prev: delay,  Up: Alphabetical List
  3408. delline
  3409. =======
  3410. Syntax
  3411. ------
  3412.      #include <conio.h>
  3413.      
  3414.      void    delline(void);
  3415. Description
  3416. -----------
  3417. The line the cursor is on is deleted; lines below it scroll up.
  3418. File: libc.inf,  Node: difftime,  Next: disable,  Prev: delline,  Up: Alphabetical List
  3419. difftime
  3420. ========
  3421. Syntax
  3422. ------
  3423.      #include <time.h>
  3424.      
  3425.      double difftime(time_t t1, time_t t0);
  3426. Description
  3427. -----------
  3428. This function returns the difference in time, in seconds, from T0 to T1.
  3429. Return Value
  3430. ------------
  3431. The number of seconds.
  3432. Example
  3433. -------
  3434.      time_t t1, t0;
  3435.      double elapsed;
  3436.      time(&t0);
  3437.      do_something();
  3438.      time(&t1);
  3439.      elapsed = difftime(t1, t0);
  3440. File: libc.inf,  Node: disable,  Next: div,  Prev: difftime,  Up: Alphabetical List
  3441. disable
  3442. =======
  3443. Syntax
  3444. ------
  3445.      #include <dos.h>
  3446.      
  3447.      int disable(void);
  3448. Description
  3449. -----------
  3450. This function disables interrupts.
  3451. *Note enable::.
  3452. Return Value
  3453. ------------
  3454. Returns nonzero if the interrupts had been enabled before this call,
  3455. zero if they were already disabled.
  3456. Example
  3457. -------
  3458.      int ints_were_enabled;
  3459.      
  3460.      ints_were_enabled = disable();
  3461.      . . . do some stuff . . .
  3462.      if (ints_were_enabled)
  3463.        enable();
  3464. File: libc.inf,  Node: div,  Next: __djgpp_exception_toggle,  Prev: disable,  Up: Alphabetical List
  3465. Syntax
  3466. ------
  3467.      #include <stdlib.h>
  3468.      
  3469.      div_t div(int numberator, int denomonator);
  3470. Description
  3471. -----------
  3472. Returns the quotient and remainder of the division NUMBERATOR divided
  3473. by DENOMONATOR.  The return type is as follows:
  3474.      typedef struct {
  3475.        int quot;
  3476.        int rem;
  3477.      } div_t;
  3478. Return Value
  3479. ------------
  3480. The results of the division are returned.
  3481. Example
  3482. -------
  3483.      div_t d = div(42, 3);
  3484.      printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  3485.      
  3486.      div(+40, +3) = { +13, +1 }
  3487.      div(+40, -3) = { -13, -1 }
  3488.      div(-40, +3) = { -13, -1 }
  3489.      div(-40, -3) = { +13, -1 }
  3490. File: libc.inf,  Node: __djgpp_exception_toggle,  Next: __djgpp_map_physical_memory,  Prev: div,  Up: Alphabetical List
  3491. __djgpp_exception_toggle
  3492. ========================
  3493. Syntax
  3494. ------
  3495.      #include <sys/exceptn.h>
  3496.      
  3497.      void __djgpp_exception_toggle(void);
  3498. Description
  3499. -----------
  3500. This function is automatically called when the program exits, to restore
  3501. handling of all the exceptions to their normal state.  You may also call
  3502. it from your program, around the code fragments where you need to
  3503. temporarily restore *all* the exceptions to their default handling.
  3504. One example of such case might be a call to a library functions that
  3505. spawn child programs, when you don't want to handle signals generated
  3506. while the child runs (by default, those signals are also passed to the
  3507. parent).
  3508. Example
  3509. -------
  3510.        __djgpp_exception_toggle();
  3511.        system("myprog");
  3512.        __djgpp_exception_toggle();
  3513. File: libc.inf,  Node: __djgpp_map_physical_memory,  Next: __djgpp_memory_handle,  Prev: __djgpp_exception_toggle,  Up: Alphabetical List
  3514. __djgpp_map_physical_memory
  3515. ===========================
  3516. Syntax
  3517. ------
  3518.      #include <dpmi.h>
  3519.      
  3520.      int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
  3521.                          unsigned long phys_addr);
  3522. Description
  3523. -----------
  3524. This function attempts to map a range of physical memory over the
  3525. specified addresses.  One common use of this routine is to map device
  3526. memory, such as a linear frame buffer, into the address space of the
  3527. calling program.  OUR_ADDR, NUM_BYTES, and PHYS_ADDR must be
  3528. page-aligned.  If they are not page-aligned, ERRNO will be set to
  3529. `EINVAL' and the routine will fail.
  3530. This routine properly handles memory ranges that span multiple DPMI
  3531. handles, while `__dpmi_map_device_in_memory_block' does not.
  3532. Consult DPMI documentation on function 0508H for details on how this
  3533. function works.  Note: since 0508H is a DPMI service new with DPMI 1.0,
  3534. this call will fail on most DPMI 0.9 servers.  For your program to work
  3535. on a wide range of systems, you should not assume this call will
  3536. succeed.
  3537. Even on failure, this routine may affect a subset of the pages
  3538. specified.
  3539. Return Value
  3540. ------------
  3541. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  3542. for illegal input parameters, or `EACCES' if the DPMI server rejected
  3543. the mapping request.
  3544. Example
  3545. -------
  3546.      if (__djgpp_map_physical_memory (my_page_aligned_memory, 16384, 0x40000000))
  3547.        printf ("Failed to map physical addresses!\n");
  3548. File: libc.inf,  Node: __djgpp_memory_handle,  Next: __djgpp_memory_handle_list,  Prev: __djgpp_map_physical_memory,  Up: Alphabetical List
  3549. __djgpp_memory_handle
  3550. =====================
  3551. Syntax
  3552. ------
  3553.      #include <crt0.h>
  3554.      
  3555.      __djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
  3556. Description
  3557. -----------
  3558. This function returns a pointer to a structure containing the memory
  3559. handle and program relative offset associated with the address passed.
  3560. It is just a convenient way to process the __djgpp_memory_handle_list.
  3561. Return Value
  3562. ------------
  3563. A pointer to the __djgpp_sbrk_handle associated with a particular
  3564. address.
  3565. File: libc.inf,  Node: __djgpp_memory_handle_list,  Next: __djgpp_nearptr_disable,  Prev: __djgpp_memory_handle,  Up: Alphabetical List
  3566. __djgpp_memory_handle_list
  3567. ==========================
  3568. Syntax
  3569. ------
  3570.      #include <crt0.h>
  3571.      
  3572.      extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
  3573. Description
  3574. -----------
  3575. This array contains a list of memory handles and program relative
  3576. offsets allocated by sbrk() in addition to the handle allocated by the
  3577. stub.  These values are normally not needed unless you are doing
  3578. low-level DPMI page protection or memory mapping.
  3579. File: libc.inf,  Node: __djgpp_nearptr_disable,  Next: __djgpp_nearptr_enable,  Prev: __djgpp_memory_handle_list,  Up: Alphabetical List
  3580. __djgpp_nearptr_disable
  3581. =======================
  3582. Syntax
  3583. ------
  3584.      #include <sys/nearptr.h>
  3585.      
  3586.      void __djgpp_nearptr_disable(void);
  3587. Description
  3588. -----------
  3589. This function disables near pointers, and re-enables protection.  *Note
  3590. __djgpp_nearptr_enable::.
  3591. File: libc.inf,  Node: __djgpp_nearptr_enable,  Next: __djgpp_set_ctrl_c,  Prev: __djgpp_nearptr_disable,  Up: Alphabetical List
  3592. __djgpp_nearptr_enable
  3593. ======================
  3594. Syntax
  3595. ------
  3596.      #include <sys/nearptr.h>
  3597.      
  3598.      int __djgpp_nearptr_enable(void);
  3599. Description
  3600. -----------
  3601. This function enables "near pointers" to be used to access the DOS
  3602. memory arena.  Sort of.  When you call this function, it will return
  3603. nonzero if it has successfully enabled near pointers.  If so, you must
  3604. add the value `__djgpp_conventional_base' to the linear address of the
  3605. physical memory.  For example:
  3606.      if (__djgpp_nearptr_enable())
  3607.      {
  3608.        short *screen = (short *)(__djgpp_conventional_base + 0xb8000);
  3609.        for (i=0; i<80*24*2; i++)
  3610.          screen[i] = 0x0720;
  3611.        __djgpp_nearptr_disable();
  3612.      }
  3613. The variable `__djgpp_base_address' contains the linear base address of
  3614. the application's data segment.  You can subtract this value from other
  3615. linear addresses that DPMI functions might return in order to obtain a
  3616. near pointer to those linear regions as well.
  3617. If using the Unix-like sbrk algorithm, near pointers are only valid
  3618. until the next `malloc', `system', `spawn*', or `exec*' function call,
  3619. since the linear base address of the application may be changed by
  3620. these calls.
  3621. WARNING: When you enable near pointers, you disable all the protection
  3622. that the system is providing.  If you are not careful, your application
  3623. may destroy the data in your computer.  USE AT YOUR OWN RISK!
  3624. Return Value
  3625. ------------
  3626. Returns 0 if near pointers are not available, or nonzero if they are.
  3627. File: libc.inf,  Node: __djgpp_set_ctrl_c,  Next: __djgpp_set_page_attributes,  Prev: __djgpp_nearptr_enable,  Up: Alphabetical List
  3628. __djgpp_set_ctrl_c
  3629. ==================
  3630. Syntax
  3631. ------
  3632.      #include <sys/exceptn.h>
  3633.      
  3634.      int __djgpp_set_ctrl_c(int enable);
  3635. Description
  3636. -----------
  3637. This function sets and resets the bit which controls whether `SIGINT'
  3638. (*note SIGINT: signal.) will be raised when you press `Ctrl-C'.  By
  3639. default `Ctrl-C' generates an interrupt signal which, if uncaught by a
  3640. signal handler, will abort your program.  However, when you call the
  3641. `setmode' library function to switch the console reads to binary mode,
  3642. or open the console in binary mode for reading, this generation of
  3643. interrupt signal is turned off, because some programs want to get the
  3644. `^C' characters as any other character and handle them by themselves.
  3645. `__djgpp_set_ctrl_c' lets you explicitly determine the effect of
  3646. `Ctrl-C'.  When called with non-zero value of ENABLE, it arranges for
  3647. `Ctrl-C' to generate an interrupt; if you call it with a zero in
  3648. ENABLE, `Ctrl-C' are treated as normal characters.
  3649. Note that the effect of `Ctrl-Break' key is unaffected by this
  3650. function; use the `_go32_want_ctrl_break' library function to control
  3651. Also note that in DJGPP, the effect of the interrupt signal will only be
  3652. seen when the program is in protected mode (*Note Signal Mechanism:
  3653. signal, for more details).  Thus, if you press `Ctrl-C' while your
  3654. program calls DOS (e.g., when reading from the console), the `SIGINT'
  3655. signal handler will only be called after that call returns.
  3656. Return Value
  3657. ------------
  3658. The previous state of the `Ctrl-C' effect: 0 if the generation of
  3659. `SIGINT' by `Ctrl-C' was disabled, 1 if it was enabled.
  3660. Example
  3661. -------
  3662.        setmode(fileno(stdin), O_BINARY);
  3663.        if (isatty(fileno(stdin)));
  3664.          __djgpp_set_ctrl_c(1);
  3665. File: libc.inf,  Node: __djgpp_set_page_attributes,  Next: _djstat_describe_lossage,  Prev: __djgpp_set_ctrl_c,  Up: Alphabetical List
  3666. __djgpp_set_page_attributes
  3667. ===========================
  3668. Syntax
  3669. ------
  3670.      #include <dpmi.h>
  3671.      
  3672.      int __djgpp_set_page_attributes(void *our_addr, unsigned long num_bytes,
  3673.                          unsigned short attributes);
  3674. Description
  3675. -----------
  3676. This function sets the DPMI page attributes for the pages in a range of
  3677. memory.  OUR_ADDR and NUM_BYTES must be page-aligned.  If they are not
  3678. page-aligned, ERRNO will be set to `EINVAL' and the routine will fail.
  3679. Consult DPMI documentation on function 0507H for the meaning of the
  3680. ATTRIBUTES argument.  Note: since 0507H is a DPMI service new with DPMI
  3681. 1.0, this call will fail on most DPMI 0.9 servers.  For your program to
  3682. work on a wide range of systems, you should not assume this call will
  3683. succeed.
  3684. Even on failure, this routine may affect a subset of the pages
  3685. specified.
  3686. Return Value
  3687. ------------
  3688. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  3689. for illegal input parameters, or `EACCES' if the DPMI server rejected
  3690. the attribute setting.
  3691. Example
  3692. -------
  3693.      if (__djgpp_set_page_attributes (my_page_aligned_memory, 16384, 0))
  3694.        printf ("Failed to make pages uncommitted!\n");
  3695. File: libc.inf,  Node: _djstat_describe_lossage,  Next: _djstat_fail_bits,  Prev: __djgpp_set_page_attributes,  Up: Alphabetical List
  3696. _djstat_describe_lossage
  3697. ========================
  3698. Syntax
  3699. ------
  3700.      #include <stdio.h>
  3701.      
  3702.      void _djstat_describe_lossage(FILE *fp);
  3703. Description
  3704. -----------
  3705. Accesses the global variable *Note _djstat_fail_bits:: and prints to the
  3706. stream given by FP a human-readable description of the undocumented DOS
  3707. features which the last call to `stat()' or `fstat()' failed to use.
  3708. (If FP is zero, the function prints to stderr.)  If the last call to
  3709. `f?stat()' didn't set any failure bits, an "all's well" message is
  3710. printed.  This function is designed to help in debugging these
  3711. functions in hostile environments (like DOS clones) and in adapting
  3712. them to the future DOS versions.  If you ever have any strange results
  3713. returned by `f?stat()', please call this function and post the
  3714. diagnostics it printed to the DJGPP mailing list.
  3715. The diagnostic messages this function prints are almost
  3716. self-explanatory.  Some explanations of terminology and abbreviations
  3717. used by the printed messages will further clarify them.
  3718. SDA (Swappable DOS Area) - this is an internal DOS structure.  `stat()'
  3719. uses it to get the full directory entry (including the starting cluster
  3720. number) of a file.  The pointer to SDA found by `stat()' is trusted
  3721. only if we find the pathname of our file at a specific offset in that
  3722. SFT (System File Table) - another internal DOS structure, used in file
  3723. operations.  `fstat()' uses it to get full information on a file given
  3724. its handle.  An SFT entry which is found by `fstat()' is only trusted
  3725. if it contains files size and time stamp like those returned by DOS
  3726. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  3727. such a way they never get to SFT, so some failure messages refer
  3728. specifically to Novell.
  3729. Hashing - the fall-back method of returning a unique inode number for
  3730. each file.  It is used whenever the starting cluster of a file couldn't
  3731. be reliably determined.
  3732. Return Value
  3733. ------------
  3734. None.
  3735. Example
  3736. -------
  3737.        if (stat(path, &stat_buf))
  3738.          _djstat_describe_lossage((FILE *)0);
  3739. File: libc.inf,  Node: _djstat_fail_bits,  Next: _djstat_flags,  Prev: _djstat_describe_lossage,  Up: Alphabetical List
  3740. _djstat_fail_bits
  3741. =================
  3742. Syntax
  3743. ------
  3744.      #include <sys/stat.h>
  3745.      
  3746.      extern unsigned short   _djstat_fail_bits;
  3747. As proper operation of *Note stat:: and *Note fstat:: depend on
  3748. undocumented DOS features, they could fail in some incompatible
  3749. environment or a future DOS version.  If they do, the
  3750. `_djstat_fail_bits' variable will have some of its bits set.  Each bit
  3751. describes a single feature which was used and failed.  The function
  3752. *Note _djstat_describe_lossage:: may be called to print a
  3753. human-readable description of the bits which were set by the last call
  3754. to `f?stat()'.  This should make debugging `f?stat()' failures in an
  3755. unanticipated environment a lot easier.
  3756. The following bits are currently defined:
  3757. `_STFAIL_SDA'
  3758.      Indicates that Get SDA call failed.
  3759. `_STFAIL_OSVER'
  3760.      Indicates an unsupported DOS version (less than 3.10 for `stat()'
  3761.      or less than 2.0 for `fstat()').
  3762. `_STFAIL_BADSDA'
  3763.      The pointer to SDA was found to be bogus.
  3764. `_STFAIL_TRUENAME'
  3765.      Indicates that *Note _truename:: function call failed.
  3766. `_STFAIL_HASH'
  3767.      Indicates that the starting cluster of the file is unavailable,
  3768.      and inode number was computed by hashing its name.
  3769. `_STFAIL_LABEL'
  3770.      The application requested the time stamp of a root dir, but no
  3771.      volume label was found.
  3772. `_STFAIL_DCOUNT'
  3773.      The number of SDA reported is ridiculously large (probbaly an
  3774.      unsupported DOS clone).
  3775. `_STFAIL_WRITEBIT'
  3776.      `fstat()' was asked to get write access bit of a file, but
  3777.      couldn't.
  3778. `_STFAIL_DEVNO'
  3779.      `fstat()' failed to get device number.
  3780. `_STFAIL_BADSFT'
  3781.      An SFT entry for this file was found by `fstat()', but its contents
  3782.      can't be trusted because it didn't match file size and time stamp
  3783.      as reported by DOS.
  3784. `_STFAIL_SFTIDX'
  3785.      The SFT index in Job File Table in program's PSP is negative.
  3786. `_STFAIL_SFTNF'
  3787.      The file entry was not found in the SFT array.
  3788. Below are some explanations of terminology and abbreviations used by the
  3789. printed messages, which will further clarify the meaning of the above
  3790. bits and their descriptions printed by *Note _djstat_describe_lossage::.
  3791. SDA (Swappable Data Area) - this is an internal DOS structure.
  3792. `stat()' uses it to get the full directory entry (including the
  3793. starting cluster number) of a file.  The pointer to SDA found by
  3794. `stat()' is trusted only if we find the pathname of our file at a
  3795. specific offset in that SDA.
  3796. SFT (System File Table) - another internal DOS structure, used in file
  3797. operations.  `fstat()' uses it to get full information on a file given
  3798. its handle.  An SFT entry which is found by `fstat()' is only trusted
  3799. if it contains files size and time stamp like those returned by DOS
  3800. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  3801. such a way they never get to SFT, so some failure messages refer
  3802. specifically to Novell.
  3803. Hashing - the fall-back method of returning a unique inode number for
  3804. each file.  It is used whenever the starting cluster of a file couldn't
  3805. be reliably determined.  The full pathname of the file is looked up in a
  3806. table of files seen earlier (hashing is used to speed the lookup
  3807. process).  If found, the inode from the table is returned; this ensures
  3808. that a given file will get the same inode number.  Otherwise a new inode
  3809. number is invented, recorded in the table and returned to caller.
  3810. File: libc.inf,  Node: _djstat_flags,  Next: _doprnt,  Prev: _djstat_fail_bits,  Up: Alphabetical List
  3811. _djstat_flags
  3812. =============
  3813. Syntax
  3814. ------
  3815.      #include <sys/stat.h>
  3816.      
  3817.      extern unsigned short   _djstat_flags;
  3818. This variable contains bits for some fields of struct stat which are
  3819. expensive to compute under DOS.  Any such computation is only done by
  3820. *Note stat:: or *Note fstat:: if the corresponding bit in
  3821. `_djstat_flags' is *cleared*.  By default, all the bits are cleared, so
  3822. applications which don't care, automagically get a full version,
  3823. possibly at a price of performance.  To get the fastest possible
  3824. `f?stat()' for your application, clear only the bits which you need and
  3825. set all the others.
  3826. The following bits are currently defined:
  3827. `_STAT_INODE'
  3828.      Causes `f?stat()' to compute the `st_ino' (inode number) field.
  3829. `_STAT_EXEC_EXT'
  3830.      Tells `f?stat()' to compute the execute access bit from extension.
  3831. `_STAT_EXEC_MAGIC'
  3832.      Tells `f?stat()' to compute the execute access bit from magic
  3833.      signature (the first two bytes of the file, see *Note
  3834.      _is_executable::.  Note that if _STAT_EXEC_MAGIC is set, but
  3835.      _STAT_EXEC_EXT is not, some files which shouldn't be flagged as
  3836.      executables (e.g., COFF *.o object files) will have their execute
  3837.      bit set, because they have the magic number signature at their
  3838.      beginning.  Therefore, only use the above combination if you want
  3839.      to debug the list of extensions provided in is_exec.c file.
  3840. `_STAT_DIRSIZE'
  3841.      Causes `stat' to compute directory size by counting the number of
  3842.      its entries (unless some friendly network redirector brought a
  3843.      true directory size with it).  Also computes the number of
  3844.      subdirectories and sets the number of links `st_nlink' field.
  3845. `_STAT_ROOT_TIME'
  3846.      Causes `stat()' to try to get time stamp of root directory from its
  3847.      volume label entry, if there is one.
  3848. `_STAT_WRITEBIT'
  3849.      Tells `fstat()' that file's write access bit is required (this
  3850.      could be a problem only under some versions of Novell Netware).
  3851. Note that if you set a bit, some failure bits in *Note
  3852. _djstat_fail_bits:: might not be set, because some computations which
  3853. report failures are only done when they are required.
  3854. File: libc.inf,  Node: _doprnt,  Next: _dos_close,  Prev: _djstat_flags,  Up: Alphabetical List
  3855. _doprnt
  3856. =======
  3857. Syntax
  3858. ------
  3859.      #include <stdio.h>
  3860.      
  3861.      int _doprnt(const char *format, void *params, FILE *file);
  3862. Description
  3863. -----------
  3864. This is an internal function that is used by all the `printf' style
  3865. functions, which simply pass their format, arguments, and stream to this
  3866. function.
  3867. *Note printf:: for a discussion of the allowed formats and arguments.
  3868. Return Value
  3869. ------------
  3870. The number of characters generated is returned.
  3871. Example
  3872. -------
  3873.      int args[] = { 1, 2, 3, 66 };
  3874.      _doprnt("%d %d %d %c\n", args, stdout);
  3875. File: libc.inf,  Node: _dos_close,  Next: _dos_commit,  Prev: _doprnt,  Up: Alphabetical List
  3876. _dos_close
  3877. ==========
  3878. Syntax
  3879. ------
  3880.      #include <dos.h>
  3881.      
  3882.      unsigned int _dos_close(int handle);
  3883. Description
  3884. -----------
  3885. This is a direct connection to the MS-DOS close function call (%ah =
  3886. 0x3E).  This function closes the specified file.
  3887. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  3888. _dos_read::. *Note _dos_write::.
  3889. Return Value
  3890. ------------
  3891. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  3892. Example
  3893. -------
  3894.      int handle;
  3895.      
  3896.      _dos_creat("FOO.DAT", _A_ARCH, &handle);
  3897.      ...
  3898.      _dos_close(handle);
  3899. File: libc.inf,  Node: _dos_commit,  Next: _dos_creat,  Prev: _dos_close,  Up: Alphabetical List
  3900. _dos_commit
  3901. ===========
  3902. Syntax
  3903. ------
  3904.      #include <dos.h>
  3905.      
  3906.      unsigned int _dos_commit(int handle);
  3907. Description
  3908. -----------
  3909. This is a direct connection to the MS-DOS commit function call (%ah =
  3910. 0x68).  This function flushes DOS internal file buffers to disk.
  3911. Return Value
  3912. ------------
  3913. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  3914. Example
  3915. -------
  3916.      _dos_write(handle, buffer, 1000, &result);
  3917.      _dos_commit(handle);
  3918.      _dos_close(handle);
  3919. File: libc.inf,  Node: _dos_creat,  Next: _dos_creatnew,  Prev: _dos_commit,  Up: Alphabetical List
  3920. _dos_creat
  3921. ==========
  3922. Syntax
  3923. ------
  3924.      #include <dos.h>
  3925.      
  3926.      unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);
  3927. Description
  3928. -----------
  3929. This is a direct connection to the MS-DOS creat function call (%ah =
  3930. 0x3C).  This function creates the given file with the given attribute
  3931. and puts file handle into HANDLE if creating is successful. If the file
  3932. already exists it truncates the file to zero length. Meaning of ATTR
  3933. parameter is the following:
  3934. `_A_NORMAL (0x00)'
  3935.      Normal file (no read/write restrictions)
  3936. `_A_RDONLY (0x01)'
  3937.      Read only file
  3938. `_A_HIDDEN (0x02)'
  3939.      Hidden file
  3940. `_A_SYSTEM (0x04)'
  3941.      System file
  3942. `_A_ARCH (0x20)'
  3943.      Archive file
  3944. *Note _dos_open::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  3945. _dos_write::. *Note _dos_close::
  3946. Return Value
  3947. ------------
  3948. Returns 0 if successful or DOS error code on error (and sets ERRNO)
  3949. Example
  3950. -------
  3951.      int handle;
  3952.      
  3953.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  3954.         puts("Creating was successful !");
  3955. File: libc.inf,  Node: _dos_creatnew,  Next: _dos_findfirst,  Prev: _dos_creat,  Up: Alphabetical List
  3956. _dos_creatnew
  3957. =============
  3958. Syntax
  3959. ------
  3960.      #include <dos.h>
  3961.      
  3962.      unsigned int _dos_creatnew(const char *filename, unsigned short attr, int *handle);
  3963. Description
  3964. -----------
  3965. This is a direct connection to the MS-DOS create unique function call
  3966. (%ah = 0x5B). This function creates the given file with the given
  3967. attribute and puts file handle into HANDLE if creating is successful.
  3968. This function will fail if the specified file exists. Meaning of ATTR
  3969. parameter is the following:
  3970. `_A_NORMAL (0x00)'
  3971.      Normal file (no read/write restrictions)
  3972. `_A_RDONLY (0x01)'
  3973.      Read only file
  3974. `_A_HIDDEN (0x02)'
  3975.      Hidden file
  3976. `_A_SYSTEM (0x04)'
  3977.      System file
  3978. `_A_ARCH (0x20)'
  3979.      Archive file
  3980. *Note _dos_open::. *Note _dos_creat::. *Note _dos_read::.  *Note
  3981. _dos_write::. *Note _dos_close::
  3982. Return Value
  3983. ------------
  3984. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  3985. Example
  3986. -------
  3987.      int handle;
  3988.      
  3989.      if ( !_dos_creatnew("FOO.DAT", _A_NORMAL, &handle) )
  3990.         puts("Creating was successful !");
  3991. File: libc.inf,  Node: _dos_findfirst,  Next: _dos_findnext,  Prev: _dos_creatnew,  Up: Alphabetical List
  3992. _dos_findfirst
  3993. ==============
  3994. Syntax
  3995. ------
  3996.      #include <dos.h>
  3997.      
  3998.      unsigned int _dos_findfirst(char *name, unsigned int attr, struct find_t *result);
  3999. Description
  4000. -----------
  4001. This function and the related `_dos_findnext' (*note _dos_findnext::.)
  4002. are used to scan directories for the list of files therein. The NAME is
  4003. a wildcard that specifies the directory and files to search. RESULT is
  4004. a structure to hold the results and state of the search, and ATTR is a
  4005. combination of the following:
  4006. `_A_NORMAL (0x00)'
  4007.      Normal file (no read/write restrictions)
  4008. `_A_RDONLY (0x01)'
  4009.      Read only file
  4010. `_A_HIDDEN (0x02)'
  4011.      Hidden file
  4012. `_A_SYSTEM (0x04)'
  4013.      System file
  4014. `_A_VOLID (0x08)'
  4015.      Volume ID file
  4016. `_A_SUBDIR (0x10)'
  4017.      Subdirectory
  4018. `_A_ARCH (0x20)'
  4019.      Archive file
  4020. *Note _dos_findnext::.
  4021. Return Value
  4022. ------------
  4023. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  4024. Example
  4025. -------
  4026.      struct find_t f;
  4027.      
  4028.      if ( !_dos_findfirst("*.DAT", &result, _A_ARCH | _A_RDONLY) )
  4029.      {
  4030.        do
  4031.        {
  4032.          printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
  4033.                 f.name,
  4034.                 f.size,
  4035.                 (f.wr_time >> 11) & 0x1f,
  4036.                 (f.wr_time >>  5) & 0x3f,
  4037.                 (f.wr_time & 0x1f) * 2,
  4038.                 (f.wr_date >>  5) & 0x0f,
  4039.                 (f.wr_date & 0x1f),
  4040.                 ((f.wr_date >> 9) & 0x7f) + 1980,
  4041.        } while( !_dos_findnext(&f) );
  4042.      }
  4043. File: libc.inf,  Node: _dos_findnext,  Next: _dos_getdate,  Prev: _dos_findfirst,  Up: Alphabetical List
  4044. _dos_findnext
  4045. =============
  4046. Syntax
  4047. ------
  4048.      #include <dos.h>
  4049.      
  4050.      unsigned int _dos_findnext(struct _find_t *result);
  4051. Description
  4052. -----------
  4053. This finds the next file in the search started by `_dos_findfirst'.
  4054. *Note _dos_findfirst::.
  4055. Return Value
  4056. ------------
  4057. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  4058. File: libc.inf,  Node: _dos_getdate,  Next: _dos_getdiskfree,  Prev: _dos_findnext,  Up: Alphabetical List
  4059. _dos_getdate
  4060. ============
  4061. Syntax
  4062. ------
  4063.      #include <dos.h>
  4064.      
  4065.      void _dos_getdate(struct dosdate_t *date);
  4066. Description
  4067. -----------
  4068. This function gets the current date and fills the DATE structure with
  4069. these values.
  4070.      struct dosdate_t {
  4071.        unsigned char  day;       /* 1-31          */
  4072.        unsigned char  month;     /* 1-12          */
  4073.        unsigned short year;      /* 1980-2099     */
  4074.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  4075.      };
  4076. *Note _dos_setdate::. *Note _dos_gettime::. *Note _dos_settime::.
  4077. Return Value
  4078. ------------
  4079. None.
  4080. Example
  4081. -------
  4082.      struct dosdate_t date;
  4083.      
  4084.      _dos_getdate(&date);
  4085. File: libc.inf,  Node: _dos_getdiskfree,  Next: _dos_getdrive,  Prev: _dos_getdate,  Up: Alphabetical List
  4086. _dos_getdiskfree
  4087. ================
  4088. `_dos_getdiskfree'
  4089. ==================
  4090. Syntax
  4091. ------
  4092.      #include <dos.h>
  4093.      
  4094.      unsigned int _dos_getdiskfree(unsigned int drive, struct diskfree_t *diskspace);
  4095. Description
  4096. -----------
  4097. This function determines the free space on DRIVE drive (0=default,
  4098. 1=A:, 2=B:, etc.) and fills DISKSPACE structure.
  4099. Return Value
  4100. ------------
  4101. Returns with 0 if successful and non-zero on error (sets ERRNO=EINVAL).
  4102. Example
  4103. -------
  4104.      struct diskfree_t df;
  4105.      unsigned long freebytes;
  4106.      
  4107.      if ( !_dos_getdiskfree(0, &df) )
  4108.      {
  4109.        freebytes = (unsigned long)df.avail_clusters *
  4110.                    (unsigned long)df.bytes_per_sector *
  4111.                    (unsigned long)df.sectors_per_cluster;
  4112.        printf("There is %lu free bytes on the current drive.\n", freebytes);
  4113.      }
  4114.      else
  4115.        printf("Unable to get free disk space.\n");
  4116. File: libc.inf,  Node: _dos_getdrive,  Next: _dos_getfileattr,  Prev: _dos_getdiskfree,  Up: Alphabetical List
  4117. _dos_getdrive
  4118. =============
  4119. `_dos_getdrive'
  4120. ===============
  4121. Syntax
  4122. ------
  4123.      #include <dos.h>
  4124.      
  4125.      void _dos_getdrive(unsigned int *p_drive);
  4126. Description
  4127. -----------
  4128. This function determine the current default drive and writes this value
  4129. into P_DRIVE (1=A:, 2=B:, etc.).
  4130. *Note _dos_setdrive::.
  4131. Return Value
  4132. ------------
  4133. None.
  4134. Example
  4135. -------
  4136.      unsigned int drive;
  4137.      
  4138.      _dos_getdrive(&drive);
  4139.      printf("The current drive is %c:.\n", 'A' - 1 + drive);
  4140. File: libc.inf,  Node: _dos_getfileattr,  Next: _dos_getftime,  Prev: _dos_getdrive,  Up: Alphabetical List
  4141. _dos_getfileattr
  4142. ================
  4143. `_dos_getfileattr'
  4144. ==================
  4145. Syntax
  4146. ------
  4147.      #include <dos.h>
  4148.      
  4149.      unsigned int _dos_getfileattr(const char *filename, unsigned int *p_attr);
  4150. Description
  4151. -----------
  4152. This function determines the attributes of given file and fills ATTR
  4153. with it. Use the following constans (in DOS.H) to check this value.
  4154. `_A_NORMAL (0x00)'
  4155.      Normal file (no read/write restrictions)
  4156. `_A_RDONLY (0x01)'
  4157.      Read only file
  4158. `_A_HIDDEN (0x02)'
  4159.      Hidden file
  4160. `_A_SYSTEM (0x04)'
  4161.      System file
  4162. `_A_VOLID (0x08)'
  4163.      Volume ID file
  4164. `_A_SUBDIR (0x10)'
  4165.      Subdirectory
  4166. `_A_ARCH (0x20)'
  4167.      Archive file
  4168. *Note _dos_setfileattr::.
  4169. Return Value
  4170. ------------
  4171. Returns with 0 if successful and DOS error value on error (and sets
  4172. ERRNO=ENOENT).
  4173. Example
  4174. -------
  4175.      unsigned int attr;
  4176.      
  4177.      if ( !_dos_getfileattr("FOO.DAT", &attr) )
  4178.      {
  4179.        puts("FOO.DAT attributes are:");
  4180.        if ( attr & _A_ARCH )   puts("Archive");
  4181.        if ( attr & _A_RDONLY ) puts("Read only");
  4182.        if ( attr & _A_HIDDEN ) puts("Hidden");
  4183.        if ( attr & _A_SYSTEM ) puts("Is it part of DOS ?");
  4184.        if ( attr & _A_VOLID )  puts("Volume ID");
  4185.        if ( attr & _A_SUBDIR ) puts("Directory");
  4186.      }
  4187.      else
  4188.        puts("Unable to get FOO.DAT attributes.");
  4189. File: libc.inf,  Node: _dos_getftime,  Next: _dos_gettime,  Prev: _dos_getfileattr,  Up: Alphabetical List
  4190. _dos_getftime
  4191. =============
  4192. Syntax
  4193. ------
  4194.      #include <dos.h>
  4195.      
  4196.      unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time);
  4197. Description
  4198. -----------
  4199. This function gets the date and time of the given file and puts these
  4200. values into P_DATE and P_TIME variable. The meaning of DOS date in the
  4201. P_DATE variable is the following:
  4202.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0  (bits)
  4203.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  4204.      *-----------------------*   *-----------*   *---------------*
  4205.              year                    month              day
  4206.      
  4207.      year  = 0-119 (relative to 1980)
  4208.      month = 1-12
  4209.      day   = 1-31
  4210. The meaning of DOS time in the P_TIME variable is the following:
  4211.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0
  4212.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  4213.      *---------------*   *-------------------*   *---------------*
  4214.            hours              minutes                seconds
  4215.      
  4216.      hours   = 0-23
  4217.      minutes = 0-59
  4218.      seconds = 0-29 in two-second intervals
  4219. *Note _dos_setftime::.
  4220. Return Value
  4221. ------------
  4222. Returns 0 if successful and return DOS error on error (and sets
  4223. ERRNO=EBADF).
  4224. Example
  4225. -------
  4226.      unsigned int handle, date, time;
  4227.      
  4228.      _dos_open("FOO.DAT", O_RDWR, &handle);
  4229.      _dos_gettime(handle, &date, &time);
  4230.      _dos_close(handle);
  4231.      printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n",
  4232.             /*       year                      month              day    */
  4233.             ((date >> 9) & 0x7F) + 1980U, (date >>  5) & 0x0F, date & 0x1F,
  4234.             /*       hour                minute           second         */
  4235.             (time >> 11) & 0x1F, (time >>  5) & 0x3F, (time & 0x1F) * 2);
  4236. File: libc.inf,  Node: _dos_gettime,  Next: _dos_lock,  Prev: _dos_getftime,  Up: Alphabetical List
  4237. _dos_gettime
  4238. ============
  4239. Syntax
  4240. ------
  4241.      #include <dos.h>
  4242.      
  4243.      void _dos_gettime(struct dostime_t *time);
  4244. Description
  4245. -----------
  4246. This function gets the current time and fills the TIME structure with
  4247. these values.
  4248.      struct dostime_t {
  4249.        unsigned char hour;     /* 0-23 */
  4250.        unsigned char minute;   /* 0-59 */
  4251.        unsigned char second;   /* 0-59 */
  4252.        unsigned char hsecond;  /* 0-99 */
  4253.      };
  4254. *Note _dos_settime::. *Note _dos_getdate::. *Note _dos_setdate::.
  4255. Return Value
  4256. ------------
  4257. None.
  4258. Example
  4259. -------
  4260.      struct dostime_t time;
  4261.      
  4262.      _dos_gettime(&time);
  4263. File: libc.inf,  Node: _dos_lock,  Next: _dos_open,  Prev: _dos_gettime,  Up: Alphabetical List
  4264. _dos_lock
  4265. =========
  4266. Syntax
  4267. ------
  4268.      #include <io.h>
  4269.      
  4270.      _dos_lock(int _fd, long _offset, long _length)
  4271. Description
  4272. -----------
  4273. Adds an advisory lock to the specified region of the file.
  4274. Return Value
  4275. ------------
  4276. Zero if the lock was added, nonzero otherwise.
  4277. File: libc.inf,  Node: _dos_open,  Next: _dos_read,  Prev: _dos_lock,  Up: Alphabetical List
  4278. _dos_open
  4279. =========
  4280. Syntax
  4281. ------
  4282.      #include <fcntl.h>
  4283.      #include <share.h>
  4284.      #include <dos.h>
  4285.      
  4286.      unsigned int _dos_open(const char *filename, unsigned short mode, int *handle);
  4287. Description
  4288. -----------
  4289. This is a direct connection to the MS-DOS open function call (%ah =
  4290. 0x3D).  This function opens the given file with the given mode and puts
  4291. handle of file into HANDLE if openning is successful.  Meaning of MODE
  4292. parameter is the following:
  4293. Access mode bits (in FCNTL.H):
  4294. `O_RDONLY (_O_RDONLY) 0x00'
  4295.      Open for read only
  4296. `O_WRONLY (_O_WRONLY) 0x01'
  4297.      Open for write only
  4298. `O_RDWR (_O_RDWR) 0x02'
  4299.      Open for read and write
  4300. Sharing mode bits (in SHARE.H):
  4301. `SH_COMPAT (_SH_COMPAT) 0x00'
  4302.      Compatibility mode
  4303. `SH_DENYRW (_SH_DENYRW) 0x10'
  4304.      Deny read/write mode
  4305. `SH_DENYWR (_SH_DENYWR) 0x20'
  4306.      Deny write mode
  4307. `SH_DENYRD (_SH_DENYRD) 0x30'
  4308.      Deny read mode
  4309. `SH_DENYNO (_SH_DENYNO) 0x40'
  4310.      Deny none mode
  4311. Inheritance bits (in FCNTL.H):
  4312. `O_NOINHERIT (_O_NOINHERIT) 0x80'
  4313.      File is not inherited by child process
  4314. *Note _dos_creat::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  4315. _dos_write::. *Note _dos_close::
  4316. Return Value
  4317. ------------
  4318. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  4319. EACCES, EINVAL, EMFILE or ENOENT).
  4320. Example
  4321. -------
  4322.      int handle;
  4323.      
  4324.      if ( !_dos_open("FOO.DAT", O_RDWR, &handle) )
  4325.         puts("Wow, file opening was successful !");
  4326. File: libc.inf,  Node: _dos_read,  Next: _dos_setdate,  Prev: _dos_open,  Up: Alphabetical List
  4327. _dos_read
  4328. =========
  4329. Syntax
  4330. ------
  4331.      #include <dos.h>
  4332.      
  4333.      unsigned int _dos_read(int handle, void *buffer, unsigned int count, unsigned int *result);
  4334. Description
  4335. -----------
  4336. This is a direct connection to the MS-DOS read function call (%ah =
  4337. 0x3F).  No conversion is done on the data; it is read as raw binary
  4338. data. This function reads from HANDLE into BUFFER COUNT bytes.  COUNT
  4339. value may be arbitrary size (for example > 64KB). It puts number of
  4340. bytes read into RESULT if reading is successful.
  4341. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  4342. _dos_write::. *Note _dos_close::
  4343. Return Value
  4344. ------------
  4345. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  4346. EACCES or EBADF)
  4347. Example
  4348. -------
  4349.      int handle;
  4350.      unsigned int result;
  4351.      char *filebuffer;
  4352.      
  4353.      if ( !_dos_open("FOO.DAT", O_RDONLY, &handle) )
  4354.      {
  4355.         puts("FOO.DAT openning was successful.");
  4356.         if ( (filebuffer = malloc(130000)) != NULL )
  4357.         {
  4358.           if ( !_dos_read(handle, buffer, 130000, &result) )
  4359.             printf("%u bytes read from FOO.DAT.\n", result);
  4360.           else
  4361.             puts("Reading error.");
  4362.           ...
  4363.           /* Do something with filebuffer. */
  4364.           ...
  4365.         }
  4366.         _dos_close(handle);
  4367.      }
  4368. File: libc.inf,  Node: _dos_setdate,  Next: _dos_setdrive,  Prev: _dos_read,  Up: Alphabetical List
  4369. _dos_setdate
  4370. ============
  4371. Syntax
  4372. ------
  4373.      #include <dos.h>
  4374.      
  4375.      unsigned int _dos_setdate(struct dosdate_t *date);
  4376. Description
  4377. -----------
  4378. This function sets the current date. The DOSDATE_T structure is as
  4379. follows:
  4380.      struct dosdate_t {
  4381.        unsigned char  day;       /* 1-31          */
  4382.        unsigned char  month;     /* 1-12          */
  4383.        unsigned short year;      /* 1980-2099     */
  4384.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  4385.      };
  4386. DAYOFWEEK field has no effect at this function call.
  4387. *Note _dos_getdate::. *Note _dos_gettime::. *Note _dos_settime::.
  4388. Return Value
  4389. ------------
  4390. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  4391. Example
  4392. -------
  4393.      struct dosdate_t date;
  4394.      
  4395.      date->year  = 1999;
  4396.      date->month = 12;
  4397.      date->day   = 31;
  4398.      if ( !_dos_setdate(&date) )
  4399.        puts("It was a valid date.");
  4400. File: libc.inf,  Node: _dos_setdrive,  Next: _dos_setfileattr,  Prev: _dos_setdate,  Up: Alphabetical List
  4401. _dos_setdrive
  4402. =============
  4403. `_dos_setdrive'
  4404. ===============
  4405. Syntax
  4406. ------
  4407.      #include <dos.h>
  4408.      
  4409.      void _dos_setdrive(unsigned int drive, unsigned int *p_drives);
  4410. Description
  4411. -----------
  4412. This function set the current default drive based on DRIVE (1=A:, 2=B:,
  4413. etc.) and determines the number of available logical drives and fills
  4414. P_DRIVES with it.
  4415. *Note _dos_getdrive::.
  4416. Return Value
  4417. ------------
  4418. None.
  4419. Example
  4420. -------
  4421.      unsigned int available_drives;
  4422.      
  4423.      /* The current drive will be A: */
  4424.      _dos_setdrive(1, &available_drives);
  4425.      printf("Number of available logical drives %u.\n", available_drives);
  4426. File: libc.inf,  Node: _dos_setfileattr,  Next: _dos_setftime,  Prev: _dos_setdrive,  Up: Alphabetical List
  4427. _dos_setfileattr
  4428. ================
  4429. `_dos_setfileattr'
  4430. ==================
  4431. Syntax
  4432. ------
  4433.      #include <dos.h>
  4434.      
  4435.      unsigned int _dos_setfileattr(const char *filename, unsigned int attr);
  4436. Description
  4437. -----------
  4438. This function sets the attributes of given file. Use the following
  4439. constans in DOS.H to create ATTR parameter:
  4440. `_A_NORMAL (0x00)'
  4441.      Normal file (no read/write restrictions)
  4442. `_A_RDONLY (0x01)'
  4443.      Read only file
  4444. `_A_HIDDEN (0x02)'
  4445.      Hidden file
  4446. `_A_SYSTEM (0x04)'
  4447.      System file
  4448. `_A_VOLID (0x08)'
  4449.      Volume ID file
  4450. `_A_SUBDIR (0x10)'
  4451.      Subdirectory
  4452. `_A_ARCH (0x20)'
  4453.      Archive file
  4454. *Note _dos_getfileattr::.
  4455. Return Value
  4456. ------------
  4457. Returns with 0 if successful and DOS error value on error (and sets
  4458. ERRNO to ENOENT or EACCES).
  4459. Example
  4460. -------
  4461.      if ( !_dos_setfileattr("FOO.DAT", _A_RDONLY | _A_HIDDEN) )
  4462.         puts("FOO.DAT is hidden now.");
  4463. File: libc.inf,  Node: _dos_setftime,  Next: _dos_settime,  Prev: _dos_setfileattr,  Up: Alphabetical List
  4464. _dos_setftime
  4465. =============
  4466. Syntax
  4467. ------
  4468.      #include <dos.h>
  4469.      
  4470.      unsigned int _dos_setftime(int handle, unsigned int date, unsigned time);
  4471. Description
  4472. -----------
  4473. This function sets the date and time of the given file. The meaning of
  4474. DOS date in the DATE variable is the following:
  4475.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  4476.      x x x x x x x x x x x x x x x x
  4477.      *-----------* *-----* *-------*
  4478.          year       month     day
  4479.      
  4480.      year  = 0-119 (relative to 1980)
  4481.      month = 1-12
  4482.      day   = 1-31
  4483. The meaning of DOS time in the TIME variable is the following:
  4484.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  4485.      x x x x x x x x x x x x x x x x
  4486.      *-------* *---------* *-------*
  4487.        hours     minutes    seconds
  4488.      
  4489.      hours   = 0-23
  4490.      minutes = 0-59
  4491.      seconds = 0-29 in two-second intervals
  4492. *Note _dos_getftime::.
  4493. Return Value
  4494. ------------
  4495. Returns 0 if successful and return DOS error on error (and sets
  4496. ERRNO=EBADF).
  4497. Example
  4498. -------
  4499.      struct dosdate_t d;
  4500.      struct dostime_t t;
  4501.      unsigned int handle, date, time;
  4502.      
  4503.      _dos_open("FOO.DAT", O_RDWR, &handle);
  4504.      _dos_getdate(&d);
  4505.      _dos_gettime(&t);
  4506.      date = ((d.year - 1980) << 9) | (d.month << 5) | d.day;
  4507.      time = (t.hour << 11) | (t.minute << 5) | (t.second / 2);
  4508.      _dos_settime(handle, date, time);
  4509.      _dos_close(handle);
  4510. File: libc.inf,  Node: _dos_settime,  Next: _dos_unlock,  Prev: _dos_setftime,  Up: Alphabetical List
  4511. _dos_settime
  4512. ============
  4513. Syntax
  4514. ------
  4515.      #include <dos.h>
  4516.      
  4517.      void _dos_settime(struct dostime_t *time);
  4518. Description
  4519. -----------
  4520. This function sets the current time. The TIME structure is as follows:
  4521.      struct dostime_t {
  4522.        unsigned char hour;     /* 0-23 */
  4523.        unsigned char minute;   /* 0-59 */
  4524.        unsigned char second;   /* 0-59 */
  4525.        unsigned char hsecond;  /* 0-99 */
  4526.      };
  4527. *Note _dos_gettime::. *Note _dos_getdate::. *Note _dos_setdate::.
  4528. Return Value
  4529. ------------
  4530. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  4531. Example
  4532. -------
  4533.      struct dostime_t time;
  4534.      
  4535.      time->hour    = 23;
  4536.      time->minute  = 59;
  4537.      time->second  = 59;
  4538.      time->hsecond = 99;
  4539.      if ( !_dos_settime(&time) )
  4540.        puts("It was a valid time.");
  4541. File: libc.inf,  Node: _dos_unlock,  Next: _dos_write,  Prev: _dos_settime,  Up: Alphabetical List
  4542. _dos_unlock
  4543. ===========
  4544. Syntax
  4545. ------
  4546.      #include <io.h>
  4547.      
  4548.      _dos_unlock(int _fd, long _offset, long _length)
  4549. Description
  4550. -----------
  4551. Removes an advisory lock to the specified region of the file.
  4552. Return Value
  4553. ------------
  4554. Zero if the lock was removed, nonzero otherwise.
  4555. File: libc.inf,  Node: _dos_write,  Next: _doscan,  Prev: _dos_unlock,  Up: Alphabetical List
  4556. _dos_write
  4557. ==========
  4558. Syntax
  4559. ------
  4560.      #include <dos.h>
  4561.      
  4562.      unsigned int _dos_write(int handle, const void *buffer, unsigned int count,
  4563.                              unsigned int *result);
  4564. Description
  4565. -----------
  4566. This is a direct connection to the MS-DOS write function call (%ah =
  4567. 0x40).  No conversion is done on the data; it is written as raw binary
  4568. data. This function writes COUNT bytes from BUFFER to HANDLE.  COUNT
  4569. value may be arbitrary size (e.g. > 64KB). It puts number of bytes
  4570. written into RESULT if writing is successful.
  4571. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  4572. _dos_read::. *Note _dos_close::
  4573. Return Value
  4574. ------------
  4575. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  4576. EACCES or EBADF)
  4577. Example
  4578. -------
  4579.      int handle;
  4580.      unsigned int result;
  4581.      char *filebuffer;
  4582.      
  4583.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  4584.      {
  4585.         puts("FOO.DAT creating was successful.");
  4586.         if ( (filebuffer = malloc(130000)) != NULL )
  4587.         {
  4588.           ...
  4589.           /* Put something into filebuffer. */
  4590.           ...
  4591.           if ( !_dos_write(handle, buffer, 130000, &result) )
  4592.             printf("%u bytes written into FOO.DAT.", result);
  4593.           else
  4594.             puts("Writing error.");
  4595.         }
  4596.         _dos_close(handle);
  4597.      }
  4598. File: libc.inf,  Node: _doscan,  Next: dosexterr,  Prev: _dos_write,  Up: Alphabetical List
  4599. _doscan
  4600. =======
  4601. Syntax
  4602. ------
  4603.      #include <stdio.h>
  4604.      
  4605.      int _doscan(FILE *file, const char *format, void **ptrs_to_args);
  4606. Description
  4607. -----------
  4608. This is an internal function that is used by all the `scanf' style
  4609. functions, which simply pass their format, arguments, and stream to this
  4610. function.
  4611. *Note scanf:: for a discussion of the allowed formats and arguments.
  4612. Return Value
  4613. ------------
  4614. The number of characters successfully scanned is returned, or -1 on
  4615. error.
  4616. Example
  4617. -------
  4618.      int x, y;
  4619.      int *args[2];
  4620.      args[0] = &x;
  4621.      args[1] = &y;
  4622.      _doscan(stdin, "%d %d", args);
  4623. File: libc.inf,  Node: dosexterr,  Next: dosmemget,  Prev: _doscan,  Up: Alphabetical List
  4624. dosexterr
  4625. =========
  4626. Syntax
  4627. ------
  4628.      #include <dos.h>
  4629.      
  4630.      int dosexterr(struct DOSERROR *p_error);
  4631. Description
  4632. -----------
  4633. This function reads extended error information from DOS and fills
  4634. P_ERROR structure.
  4635.      struct _DOSERROR {
  4636.        int  exterror;
  4637.        char class;
  4638.        char action;
  4639.        char locus;
  4640.      };
  4641. Values for extended error code (EXTERROR field):
  4642.      00h (0)   no error
  4643.      01h (1)   function number invalid
  4644.      02h (2)   file not found
  4645.      03h (3)   path not found
  4646.      04h (4)   too many open files (no handles available)
  4647.      05h (5)   access denied
  4648.      06h (6)   invalid handle
  4649.      07h (7)   memory control block destroyed
  4650.      08h (8)   insufficient memory
  4651.      09h (9)   memory block address invalid
  4652.      0Ah (10)  environment invalid (usually >32K in length)
  4653.      0Bh (11)  format invalid
  4654.      0Ch (12)  access code invalid
  4655.      0Dh (13)  data invalid
  4656.      0Eh (14)  reserved
  4657.      0Fh (15)  invalid drive
  4658.      10h (16)  attempted to remove current directory
  4659.      11h (17)  not same device
  4660.      12h (18)  no more files
  4661.      13h (19)  disk write-protected
  4662.      14h (20)  unknown unit
  4663.      15h (21)  drive not ready
  4664.      16h (22)  unknown command
  4665.      17h (23)  data error (CRC)
  4666.      18h (24)  bad request structure length
  4667.      19h (25)  seek error
  4668.      1Ah (26)  unknown media type (non-DOS disk)
  4669.      1Bh (27)  sector not found
  4670.      1Ch (28)  printer out of paper
  4671.      1Dh (29)  write fault
  4672.      1Eh (30)  read fault
  4673.      1Fh (31)  general failure
  4674.      20h (32)  sharing violation
  4675.      21h (33)  lock violation
  4676.      22h (34)  disk change invalid (ES:DI -> media ID structure)(see below)
  4677.      23h (35)  FCB unavailable
  4678.      24h (36)  sharing buffer overflow
  4679.      25h (37)  (DOS 4+) code page mismatch
  4680.      26h (38)  (DOS 4+) cannot complete file operation (out of input)
  4681.      27h (39)  (DOS 4+) insufficient disk space
  4682.      28h-31h   reserved
  4683.      32h (50)  network request not supported
  4684.      33h (51)  remote computer not listening
  4685.      34h (52)  duplicate name on network
  4686.      35h (53)  network name not found
  4687.      36h (54)  network busy
  4688.      37h (55)  network device no longer exists
  4689.      38h (56)  network BIOS command limit exceeded
  4690.      39h (57)  network adapter hardware error
  4691.      3Ah (58)  incorrect response from network
  4692.      3Bh (59)  unexpected network error
  4693.      3Ch (60)  incompatible remote adapter
  4694.      3Dh (61)  print queue full
  4695.      3Eh (62)  queue not full
  4696.      3Fh (63)  not enough space to print file
  4697.      40h (64)  network name was deleted
  4698.      41h (65)  network: Access denied
  4699.      42h (66)  network device type incorrect
  4700.      43h (67)  network name not found
  4701.      44h (68)  network name limit exceeded
  4702.      45h (69)  network BIOS session limit exceeded
  4703.      46h (70)  temporarily paused
  4704.      47h (71)  network request not accepted
  4705.      48h (72)  network print/disk redirection paused
  4706.      49h (73)  network software not installed
  4707.                (LANtastic) invalid network version
  4708.      4Ah (74)  unexpected adapter close
  4709.                (LANtastic) account expired
  4710.      4Bh (75)  (LANtastic) password expired
  4711.      4Ch (76)  (LANtastic) login attempt invalid at this time
  4712.      4Dh (77)  (LANtastic v3+) disk limit exceeded on network node
  4713.      4Eh (78)  (LANtastic v3+) not logged in to network node
  4714.      4Fh (79)  reserved
  4715.      50h (80)  file exists
  4716.      51h (81)  reserved
  4717.      52h (82)  cannot make directory
  4718.      53h (83)  fail on INT 24h
  4719.      54h (84)  (DOS 3.3+) too many redirections
  4720.      55h (85)  (DOS 3.3+) duplicate redirection
  4721.      56h (86)  (DOS 3.3+) invalid password
  4722.      57h (87)  (DOS 3.3+) invalid parameter
  4723.      58h (88)  (DOS 3.3+) network write fault
  4724.      59h (89)  (DOS 4+) function not supported on network
  4725.      5Ah (90)  (DOS 4+) required system component not installed
  4726.      64h (100) (MSCDEX) unknown error
  4727.      65h (101) (MSCDEX) not ready
  4728.      66h (102) (MSCDEX) EMS memory no longer valid
  4729.      67h (103) (MSCDEX) not High Sierra or ISO-9660 format
  4730.      68h (104) (MSCDEX) door open
  4731. Values for error class (CLASS field):
  4732.      01h  out of resource (storage space or I/O channels)
  4733.      02h  temporary situation (file or record lock)
  4734.      03h  authorization (denied access)
  4735.      04h  internal (system software bug)
  4736.      05h  hardware failure
  4737.      06h  system failure (configuration file missing or incorrect)
  4738.      07h  application program error
  4739.      08h  not found
  4740.      09h  bad format
  4741.      0Ah  locked
  4742.      0Bh  media error
  4743.      0Ch  already exists
  4744.      0Dh  unknown
  4745. Values for suggested action (ACTION field):
  4746.      01h  retry
  4747.      02h  delayed retry
  4748.      03h  prompt user to reenter input
  4749.      04h  abort after cleanup
  4750.      05h  immediate abort
  4751.      06h  ignore
  4752.      07h  retry after user intervention
  4753. Values for error locus (LOCUS field):
  4754.      01h  unknown or not appropriate
  4755.      02h  block device (disk error)
  4756.      03h  network related
  4757.      04h  serial device (timeout)
  4758.      05h  memory related
  4759. Return Value
  4760. ------------
  4761. Returns with the extended error code.
  4762. Example
  4763. -------
  4764.      #include <stdio.h>
  4765.      #include <dos.h>
  4766.      
  4767.      void main(void)
  4768.      {
  4769.        FILE *fp;
  4770.        struct _DOSERROR de;
  4771.      
  4772.        fp = fopen("EXAMPLE.DAT","r");
  4773.        if ( fp == NULL )
  4774.        {
  4775.          puts("Unable to open file for reading.");
  4776.          _dosexterr(&de);
  4777.          printf("Extended DOS error information:\n");
  4778.          printf("Extended error: %i\n",de.exterror);
  4779.          printf("Class:          %x\n",de.class);
  4780.          printf("Action:         %x\n",de.action);
  4781.          printf("Error Locus:    %x\n",de.locus);
  4782.        }
  4783.      }
  4784. File: libc.inf,  Node: dosmemget,  Next: dosmemgetb,  Prev: dosexterr,  Up: Alphabetical List
  4785. dosmemget
  4786. =========
  4787. Syntax
  4788. ------
  4789.      #include <sys/movedata.h>
  4790.      
  4791.      void dosmemget(int offset, int length, void *buffer);
  4792. Description
  4793. -----------
  4794. This function transfers data from MS-DOS's conventional memory space to
  4795. the program's virtual address space.  The OFFSET is a physical address,
  4796. which can be computed from a real-mode segment/offset pair as follows:
  4797.      offset = segment * 16 + offset;
  4798. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  4799. to somewhere in your virtual address space (such as memory obtained
  4800. from `malloc') where the data will go.
  4801. Return Value
  4802. ------------
  4803. None.
  4804. Example
  4805. -------
  4806.      unsigned short shift_state;
  4807.      dosmemget(0x417, 2, &shift_state);
  4808.      if (shift_state & 0x0004)
  4809.        /* Ctrl key pressed */;
  4810. File: libc.inf,  Node: dosmemgetb,  Next: dosmemgetl,  Prev: dosmemget,  Up: Alphabetical List
  4811. dosmemgetb
  4812. ==========
  4813. Syntax
  4814. ------
  4815.      #include <sys/movedata.h>
  4816.      
  4817.      void _dosmemgetb(unsigned long offset, size_t xfers, void *buffer);
  4818. Description
  4819. -----------
  4820. This function transfers data from MS-DOS's conventional memory space to
  4821. the program's virtual address space, using only byte transfers.  The
  4822. OFFSET is a physical address, which can be computed from a real-mode
  4823. segment/offset pair as follows:
  4824.      offset = segment * 16 + offset;
  4825. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  4826. to somewhere in your virtual address space (such as memory obtained
  4827. from `malloc') where the data will go.
  4828. Return Value
  4829. ------------
  4830. None.
  4831. Example
  4832. -------
  4833.      unsigned short shift_state;
  4834.      dosmemgetb(0x417, 2, &shift_state);
  4835.      if (shift_state & 0x0004)
  4836.        /* Ctrl key pressed */;
  4837. File: libc.inf,  Node: dosmemgetl,  Next: dosmemgetw,  Prev: dosmemgetb,  Up: Alphabetical List
  4838. dosmemgetl
  4839. ==========
  4840. Syntax
  4841. ------
  4842.      #include <sys/movedata.h>
  4843.      
  4844.      void _dosmemgetl(unsigned long offset, size_t xfers, void *buffer);
  4845. Description
  4846. -----------
  4847. This function transfers data from MS-DOS's conventional memory space to
  4848. the program's virtual address space, using only long-word (32-bit)
  4849. transfers.  The OFFSET is a physical address, which can be computed
  4850. from a real-mode segment/offset pair as follows:
  4851.      offset = segment * 16 + offset;
  4852. The COUNT is the number of long-words to transfer, and BUFFER is a
  4853. pointer to somewhere in your virtual address space (such as memory
  4854. obtained from `malloc') where the data will go.
  4855. Return Value
  4856. ------------
  4857. None.
  4858. Example
  4859. -------
  4860.      unsigned long shift_state;
  4861.      dosmemgetl(0x417, 1, &shift_state);
  4862.      if (shift_state & 0x0004)
  4863.        /* Ctrl key pressed */;
  4864. File: libc.inf,  Node: dosmemgetw,  Next: dosmemput,  Prev: dosmemgetl,  Up: Alphabetical List
  4865. dosmemgetw
  4866. ==========
  4867. Syntax
  4868. ------
  4869.      #include <sys/movedata.h>
  4870.      
  4871.      void _dosmemgetw(unsigned long offset, size_t xfers, void *buffer);
  4872. Description
  4873. -----------
  4874. This function transfers data from MS-DOS's conventional memory space to
  4875. the program's virtual address space, using only short-word (16-bit)
  4876. transfers.  The OFFSET is a physical address, which can be computed
  4877. from a real-mode segment/offset pair as follows:
  4878.      offset = segment * 16 + offset;
  4879. The XFERS is the number of words to transfer, and BUFFER is a pointer
  4880. to somewhere in your virtual address space (such as memory obtained
  4881. from `malloc') where the data will go.
  4882. Return Value
  4883. ------------
  4884. None.
  4885. Example
  4886. -------
  4887.      unsigned short shift_state;
  4888.      dosmemgetw(0x417, 1, &shift_state);
  4889.      if (shift_state & 0x0004)
  4890.        /* Ctrl key pressed */;
  4891. File: libc.inf,  Node: dosmemput,  Next: dosmemputb,  Prev: dosmemgetw,  Up: Alphabetical List
  4892. dosmemput
  4893. =========
  4894. Syntax
  4895. ------
  4896.      #include <sys/movedata.h>
  4897.      
  4898.      void dosmemput(const void *buffer, int length, int offset);
  4899. Description
  4900. -----------
  4901. This function transfers data from the program's virtual address space to
  4902. MS-DOS's conventional memory space.  The OFFSET is a physical address,
  4903. which can be computed from a real-mode segment/offset pair as follows:
  4904.      offset = segment * 16 + offset;
  4905. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  4906. to somewhere in your virtual address space (such as memory obtained
  4907. from `malloc') where the data will come from.
  4908. Return Value
  4909. ------------
  4910. None.
  4911. Example
  4912. -------
  4913.      unsigned short save_screen[25][80];
  4914.      dosmemput(save_screen, 80*2*25, 0xb8000);
  4915. File: libc.inf,  Node: dosmemputb,  Next: dosmemputl,  Prev: dosmemput,  Up: Alphabetical List
  4916. dosmemputb
  4917. ==========
  4918. Syntax
  4919. ------
  4920.      #include <sys/movedata.h>
  4921.      
  4922.      void _dosmemputb(const void *buffer, size_t xfers, unsigned long offset);
  4923. Description
  4924. -----------
  4925. This function transfers data from the program's virtual address space
  4926. to MS-DOS's conventional memory space, using only byte (8-bit)
  4927. transfers.  The OFFSET is a physical address, which can be computed
  4928. from a real-mode segment/offset pair as follows:
  4929.      offset = segment * 16 + offset;
  4930. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  4931. to somewhere in your virtual address space (such as memory obtained
  4932. from `malloc') where the data will come from.
  4933. Return Value
  4934. ------------
  4935. None.
  4936. Example
  4937. -------
  4938.      unsigned short save_screen[25][80];
  4939.      dosmemputb(save_screen, 0xb8000, 80*2*25);
  4940. File: libc.inf,  Node: dosmemputl,  Next: dosmemputw,  Prev: dosmemputb,  Up: Alphabetical List
  4941. dosmemputl
  4942. ==========
  4943. Syntax
  4944. ------
  4945.      #include <sys/movedata.h>
  4946.      
  4947.      void _dosmemputl(const void *buffer, size_t xfers unsigned long offset);
  4948. Description
  4949. -----------
  4950. This function transfers data from the program's virtual address space
  4951. to MS-DOS's conventional memory space, using only long-word (32-bit)
  4952. transfers.  The OFFSET is a physical address, which can be computed
  4953. from a real-mode segment/offset pair as follows:
  4954.      offset = segment * 16 + offset;
  4955. The XFERS is the number of long-words to transfer, and BUFFER is a
  4956. pointer to somewhere in your virtual address space (such as memory
  4957. obtained from `malloc') where the data will come from.
  4958. Return Value
  4959. ------------
  4960. None.
  4961. Example
  4962. -------
  4963.      unsigned short save_screen[25][80];
  4964.      dosmemputl(save_screen, 0xb8000, 40*25);
  4965. File: libc.inf,  Node: dosmemputw,  Next: DPMI Overview,  Prev: dosmemputl,  Up: Alphabetical List
  4966. dosmemputw
  4967. ==========
  4968. Syntax
  4969. ------
  4970.      #include <sys/movedata.h>
  4971.      
  4972.      void _dosmemputw(const void *buffer, size_t xfers, unsigned long offset);
  4973. Description
  4974. -----------
  4975. This function transfers data from the program's virtual address space
  4976. to MS-DOS's conventional memory space, using only short-word (16-bit)
  4977. transfers.  The OFFSET is a physical address, which can be computed
  4978. from a real-mode segment/offset pair as follows:
  4979.      offset = segment * 16 + offset;
  4980. The XFERS is the number of short-words to transfer, and BUFFER is a
  4981. pointer to somewhere in your virtual address space (such as memory
  4982. obtained from `malloc') where the data will come from.
  4983. Return Value
  4984. ------------
  4985. None.
  4986. Example
  4987. -------
  4988.      unsigned short save_screen[25][80];
  4989.      dosmemputw(save_screen, 0xb8000, 80*25);
  4990. File: libc.inf,  Node: DPMI Overview,  Next: DPMI Specification,  Prev: dosmemputw,  Up: Alphabetical List
  4991. DPMI Overview
  4992. =============
  4993.      extern unsigned short __dpmi_error;
  4994. For most functions, the error returned from the DPMI server is stored
  4995. in this variable.
  4996.      typedef struct {
  4997.        unsigned short offset16;
  4998.        unsigned short segment;
  4999.      } __dpmi_raddr;
  5000. This structure is used to hold a real-mode address, which consists of a
  5001. segment:offset pair.
  5002.      typedef struct {
  5003.        unsigned long  offset32;
  5004.        unsigned short selector;
  5005.      } __dpmi_paddr;
  5006. This structure is used to hold a protected-mode address, which consists
  5007. of a selector:offset pair.
  5008.      typedef struct {
  5009.        unsigned long handle;            /* 0, 2 */
  5010.        unsigned long size;     /* or count */    /* 4, 6 */
  5011.        unsigned long address;        /* 8, 10 */
  5012.      } __dpmi_meminfo;
  5013. This structure is used by many functions that need to refer to blocks
  5014. of 32-bit memory.  The `size' field doubles as a count for those
  5015. operations that want a count of something, or return a count.
  5016.      typedef union {
  5017.        struct {
  5018.          unsigned long edi;
  5019.          unsigned long esi;
  5020.          unsigned long ebp;
  5021.          unsigned long res;
  5022.          unsigned long ebx;
  5023.          unsigned long edx;
  5024.          unsigned long ecx;
  5025.          unsigned long eax;
  5026.        } d;
  5027.        struct {
  5028.          unsigned short di, di_hi;
  5029.          unsigned short si, si_hi;
  5030.          unsigned short bp, bp_hi;
  5031.          unsigned short res, res_hi;
  5032.          unsigned short bx, bx_hi;
  5033.          unsigned short dx, dx_hi;
  5034.          unsigned short cx, cx_hi;
  5035.          unsigned short ax, ax_hi;
  5036.          unsigned short flags;
  5037.          unsigned short es;
  5038.          unsigned short ds;
  5039.          unsigned short fs;
  5040.          unsigned short gs;
  5041.          unsigned short ip;
  5042.          unsigned short cs;
  5043.          unsigned short sp;
  5044.          unsigned short ss;
  5045.        } x;
  5046.        struct {
  5047.          unsigned char edi[4];
  5048.          unsigned char esi[4];
  5049.          unsigned char ebp[4];
  5050.          unsigned char res[4];
  5051.          unsigned char bl, bh, ebx_b2, ebx_b3;
  5052.          unsigned char dl, dh, edx_b2, edx_b3;
  5053.          unsigned char cl, ch, ecx_b2, ecx_b3;
  5054.          unsigned char al, ah, eax_b2, eax_b3;
  5055.        } h;
  5056.      } __dpmi_regs;
  5057. This structure is used by functions that pass register information,
  5058. such as simulating real-mode calls.
  5059.      typedef struct {
  5060.        unsigned char  major;
  5061.        unsigned char  minor;
  5062.        unsigned short flags;
  5063.        unsigned char  cpu;
  5064.        unsigned char  master_pic;
  5065.        unsigned char  slave_pic;
  5066.      } __dpmi_version_ret;
  5067. This structure is used to return version information to the program.
  5068.      typedef struct {
  5069.        unsigned long largest_available_free_block_in_bytes;
  5070.        unsigned long maximum_unlocked_page_allocation_in_pages;
  5071.        unsigned long maximum_locked_page_allocation_in_pages;
  5072.        unsigned long linear_address_space_size_in_pages;
  5073.        unsigned long total_number_of_unlocked_pages;
  5074.        unsigned long total_number_of_free_pages;
  5075.        unsigned long total_number_of_physical_pages;
  5076.        unsigned long free_linear_address_space_in_pages;
  5077.        unsigned long size_of_paging_file_partition_in_pages;
  5078.        unsigned long reserved[3];
  5079.      } __dpmi_free_mem_info;
  5080. This structure is used to return information about the state of virtual
  5081. memory in the system.
  5082.      typedef struct {
  5083.        unsigned long total_allocated_bytes_of_physical_memory_host;
  5084.        unsigned long total_allocated_bytes_of_virtual_memory_host;
  5085.        unsigned long total_available_bytes_of_virtual_memory_host;
  5086.        unsigned long total_allocated_bytes_of_virtual_memory_vcpu;
  5087.        unsigned long total_available_bytes_of_virtual_memory_vcpu;
  5088.        unsigned long total_allocated_bytes_of_virtual_memory_client;
  5089.        unsigned long total_available_bytes_of_virtual_memory_client;
  5090.        unsigned long total_locked_bytes_of_memory_client;
  5091.        unsigned long max_locked_bytes_of_memory_client;
  5092.        unsigned long highest_linear_address_available_to_client;
  5093.        unsigned long size_in_bytes_of_largest_free_memory_block;
  5094.        unsigned long size_of_minimum_allocation_unit_in_bytes;
  5095.        unsigned long size_of_allocation_alignmentunit_in_bytes;
  5096.        unsigned long reserved[19];
  5097.      } __dpmi_memory_info;
  5098. This is also used to return memory information, but by a different
  5099. function.
  5100.      typedef struct {
  5101.        unsigned long data16[2];
  5102.        unsigned long code16[2];
  5103.        unsigned short ip;
  5104.        unsigned short reserved;
  5105.        unsigned long data32[2];
  5106.        unsigned long code32[2];
  5107.        unsigned long eip;
  5108.      } __dpmi_callback_info;
  5109. This structure is used to install TSR programs.
  5110.      typedef struct {
  5111.        unsigned long size_requested;
  5112.        unsigned long size;
  5113.        unsigned long handle;
  5114.        unsigned long address;
  5115.        unsigned long name_offset;
  5116.        unsigned short name_selector;
  5117.        unsigned short reserved1;
  5118.        unsigned long reserved2;
  5119.      } __dpmi_shminfo;
  5120. This structure is used to manipulate shared memory regions.
  5121. File: libc.inf,  Node: DPMI Specification,  Next: __dpmi_allocate_dos_memory,  Prev: DPMI Overview,  Up: Alphabetical List
  5122. DPMI Specification
  5123. ==================
  5124. To obtain the DPMI specification, Contact Intel and order document
  5125. number 240977-001.  Also, try ftp.qdeck.com:/pub/memory/dpmi* and
  5126. http://www.delorie.com/djgpp/doc/dpmi/.
  5127. File: libc.inf,  Node: __dpmi_allocate_dos_memory,  Next: __dpmi_allocate_ldt_descriptors,  Prev: DPMI Specification,  Up: Alphabetical List
  5128. __dpmi_allocate_dos_memory
  5129. ==========================
  5130. Syntax
  5131. ------
  5132.      #include <dpmi.h>
  5133.      
  5134.      int __dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);
  5135. Description
  5136. -----------
  5137. Please refer to *Note DPMI Specification:: for details on DPMI function
  5138. call operation.  Also see *Note DPMI Overview:: for general information.
  5139. DPMI function AX = 0x0100
  5140. This function allocates DOS memory.  You pass it the number of
  5141. paragraphs ((bytes+15)>>4) to allocate.  If it succeeds, it returns a
  5142. segment (dos-style) and fills in _RET_SELECTOR_OR_MAX with a selector
  5143. (protected-mode) that you can use to reference the same memory.  Note
  5144. that it's the selector you use to free the block, not the segment.
  5145. Return Value
  5146. ------------
  5147. -1 on error, else the segment [0000..FFFF].
  5148. File: libc.inf,  Node: __dpmi_allocate_ldt_descriptors,  Next: __dpmi_allocate_linear_memory,  Prev: __dpmi_allocate_dos_memory,  Up: Alphabetical List
  5149. __dpmi_allocate_ldt_descriptors
  5150. ===============================
  5151. Syntax
  5152. ------
  5153.      #include <dpmi.h>
  5154.      
  5155.      int __dpmi_allocate_ldt_descriptors(int count);
  5156. Description
  5157. -----------
  5158. Please refer to *Note DPMI Specification:: for details on DPMI function
  5159. call operation.  Also see *Note DPMI Overview:: for general information.
  5160. DPMI function AX = 0x0000
  5161. Allocates COUNT descriptors.
  5162. Return Value
  5163. ------------
  5164. -1 on error, else the first descriptor.  Use *Note
  5165. __dpmi_get_selector_increment_value:: to figure out the remaining
  5166. selectors.
  5167. Example
  5168. -------
  5169.      short sel = __dpmi_allocate_ldt_descriptors(1);
  5170. File: libc.inf,  Node: __dpmi_allocate_linear_memory,  Next: __dpmi_allocate_memory,  Prev: __dpmi_allocate_ldt_descriptors,  Up: Alphabetical List
  5171. __dpmi_allocate_linear_memory
  5172. =============================
  5173. Syntax
  5174. ------
  5175.      #include <dpmi.h>
  5176.      
  5177.      int __dpmi_allocate_linear_memory
  5178. Description
  5179. -----------
  5180. Please refer to *Note DPMI Specification:: for details on DPMI function
  5181. call operation.  Also see *Note DPMI Overview:: for general information.
  5182. DPMI function AX = 0x0504 (DPMI 1.0 only)
  5183. This allocates a block of page-aligned linear address space.  Pass a
  5184. desired address (or zero for any) and a size.  _COMMIT is 1 for
  5185. committed pages, else they are uncommitted.  It returns a handle and
  5186. the actual address.
  5187. Return Value
  5188. ------------
  5189. -1 on error, else zero.
  5190. File: libc.inf,  Node: __dpmi_allocate_memory,  Next: __dpmi_allocate_real_mode_callback,  Prev: __dpmi_allocate_linear_memory,  Up: Alphabetical List
  5191. __dpmi_allocate_memory
  5192. ======================
  5193. Syntax
  5194. ------
  5195.      #include <dpmi.h>
  5196.      
  5197.      int __dpmi_allocate_memory(__dpmi_meminfo *_info);
  5198. Description
  5199. -----------
  5200. Please refer to *Note DPMI Specification:: for details on DPMI function
  5201. call operation.  Also see *Note DPMI Overview:: for general information.
  5202. DPMI function AX = 0x0501
  5203. This allocates virtual memory.  Fill in size, returns handle and
  5204. address.
  5205. Return Value
  5206. ------------
  5207. -1 on error, else zero.
  5208. File: libc.inf,  Node: __dpmi_allocate_real_mode_callback,  Next: __dpmi_allocate_shared_memory,  Prev: __dpmi_allocate_memory,  Up: Alphabetical List
  5209. __dpmi_allocate_real_mode_callback
  5210. ==================================
  5211. Syntax
  5212. ------
  5213.      #include <dpmi.h>
  5214.      
  5215.      int __dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret);
  5216. Description
  5217. -----------
  5218. Please refer to *Note DPMI Specification:: for details on DPMI function
  5219. call operation.  Also see *Note DPMI Overview:: for general information.
  5220. DPMI function AX = 0x0303
  5221. This function gives you a real-mode address to pass to TSRs that gets
  5222. reflected to your protected-mode handler.  You pass it a register block
  5223. to use; it gets filled in with the real-mode registers when your
  5224. handler is called, and the registers are set from it when the handler
  5225. returns.
  5226. Return Value
  5227. ------------
  5228. -1 on error, else zero.
  5229. File: libc.inf,  Node: __dpmi_allocate_shared_memory,  Next: __dpmi_allocate_specific_ldt_descriptor,  Prev: __dpmi_allocate_real_mode_callback,  Up: Alphabetical List
  5230. __dpmi_allocate_shared_memory
  5231. =============================
  5232. Syntax
  5233. ------
  5234.      #include <dpmi.h>
  5235.      
  5236.      int __dpmi_allocate_shared_memory(__dpmi_shminfo *_info);
  5237. Description
  5238. -----------
  5239. Please refer to *Note DPMI Specification:: for details on DPMI function
  5240. call operation.  Also see *Note DPMI Overview:: for general information.
  5241. DPMI function AX = 0x0d00 (DPMI 1.0 only)
  5242. See the spec.
  5243. Return Value
  5244. ------------
  5245. -1 on error, else zero.
  5246. File: libc.inf,  Node: __dpmi_allocate_specific_ldt_descriptor,  Next: __dpmi_clear_debug_watchpoint,  Prev: __dpmi_allocate_shared_memory,  Up: Alphabetical List
  5247. __dpmi_allocate_specific_ldt_descriptor
  5248. =======================================
  5249. Syntax
  5250. ------
  5251.      #include <dpmi.h>
  5252.      
  5253.      int __dpmi_allocate_specific_ldt_descriptor(int _selector);
  5254. Description
  5255. -----------
  5256. Please refer to *Note DPMI Specification:: for details on DPMI function
  5257. call operation.  Also see *Note DPMI Overview:: for general information.
  5258. DPMI function AX = 0x000d
  5259. This allocates the specific selector given.
  5260. Return Value
  5261. ------------
  5262. -1 on error, else zero.
  5263. File: libc.inf,  Node: __dpmi_clear_debug_watchpoint,  Next: __dpmi_create_alias_descriptor,  Prev: __dpmi_allocate_specific_ldt_descriptor,  Up: Alphabetical List
  5264. __dpmi_clear_debug_watchpoint
  5265. =============================
  5266. Syntax
  5267. ------
  5268.      #include <dpmi.h>
  5269.      
  5270.      int __dpmi_clear_debug_watchpoint(unsigned long _handle);
  5271. Description
  5272. -----------
  5273. Please refer to *Note DPMI Specification:: for details on DPMI function
  5274. call operation.  Also see *Note DPMI Overview:: for general information.
  5275. DPMI function AX = 0x0b01
  5276. Clear a debug watchpoint.
  5277. Return Value
  5278. ------------
  5279. -1 on error, else zero.
  5280. File: libc.inf,  Node: __dpmi_create_alias_descriptor,  Next: __dpmi_discard_page_contents,  Prev: __dpmi_clear_debug_watchpoint,  Up: Alphabetical List
  5281. __dpmi_create_alias_descriptor
  5282. ==============================
  5283. Syntax
  5284. ------
  5285.      #include <dpmi.h>
  5286.      
  5287.      int __dpmi_create_alias_descriptor(int _selector);
  5288. Description
  5289. -----------
  5290. Please refer to *Note DPMI Specification:: for details on DPMI function
  5291. call operation.  Also see *Note DPMI Overview:: for general information.
  5292. DPMI function AX = 0x000a
  5293. Create a new selector with the same parameters as the given one.
  5294. Return Value
  5295. ------------
  5296. -1 on error, else the new selector.
  5297. File: libc.inf,  Node: __dpmi_discard_page_contents,  Next: __dpmi_free_dos_memory,  Prev: __dpmi_create_alias_descriptor,  Up: Alphabetical List
  5298. __dpmi_discard_page_contents
  5299. ============================
  5300. Syntax
  5301. ------
  5302.      #include <dpmi.h>
  5303.      
  5304.      int __dpmi_discard_page_contents(__dpmi_meminfo *_info);
  5305. Description
  5306. -----------
  5307. Please refer to *Note DPMI Specification:: for details on DPMI function
  5308. call operation.  Also see *Note DPMI Overview:: for general information.
  5309. DPMI function AX = 0x0703
  5310. Advises the server that the given pages are no longer needed and may be
  5311. reclaimed.  Fill in address and size (in bytes).
  5312. Return Value
  5313. ------------
  5314. -1 on error, else zero.
  5315. File: libc.inf,  Node: __dpmi_free_dos_memory,  Next: __dpmi_free_ldt_descriptor,  Prev: __dpmi_discard_page_contents,  Up: Alphabetical List
  5316. __dpmi_free_dos_memory
  5317. ======================
  5318. Syntax
  5319. ------
  5320.      #include <dpmi.h>
  5321.      
  5322.      int __dpmi_free_dos_memory(int _selector);
  5323. Description
  5324. -----------
  5325. Please refer to *Note DPMI Specification:: for details on DPMI function
  5326. call operation.  Also see *Note DPMI Overview:: for general information.
  5327. DPMI function AX = 0x0101
  5328. This function frees the dos memory allocated by *Note
  5329. __dpmi_allocate_dos_memory::.  Remember to pass the selector and not
  5330. the segment.
  5331. Return Value
  5332. ------------
  5333. -1 on error, else zero.
  5334. File: libc.inf,  Node: __dpmi_free_ldt_descriptor,  Next: __dpmi_free_memory,  Prev: __dpmi_free_dos_memory,  Up: Alphabetical List
  5335. __dpmi_free_ldt_descriptor
  5336. ==========================
  5337. Syntax
  5338. ------
  5339.      #include <dpmi.h>
  5340.      
  5341.      int __dpmi_free_ldt_descriptor(int descriptor);
  5342. Description
  5343. -----------
  5344. Please refer to *Note DPMI Specification:: for details on DPMI function
  5345. call operation.  Also see *Note DPMI Overview:: for general information.
  5346. DPMI function AX = 0x0001
  5347. This function frees a single descriptor, even if it was allocated as
  5348. one of many.
  5349. Return Value
  5350. ------------
  5351. -1 on error, else zero.
  5352. Example
  5353. -------
  5354.      __dpmi_free_ldt_descriptor(sel);
  5355. File: libc.inf,  Node: __dpmi_free_memory,  Next: __dpmi_free_physical_address_mapping,  Prev: __dpmi_free_ldt_descriptor,  Up: Alphabetical List
  5356. __dpmi_free_memory
  5357. ==================
  5358. Syntax
  5359. ------
  5360.      #include <dpmi.h>
  5361.      
  5362.      int __dpmi_free_memory(unsigned long _handle);
  5363. Description
  5364. -----------
  5365. Please refer to *Note DPMI Specification:: for details on DPMI function
  5366. call operation.  Also see *Note DPMI Overview:: for general information.
  5367. DPMI function AX = 0x0502
  5368. This frees a block of virtual memory.
  5369. Return Value
  5370. ------------
  5371. -1 on error, else zero.
  5372. File: libc.inf,  Node: __dpmi_free_physical_address_mapping,  Next: __dpmi_free_real_mode_callback,  Prev: __dpmi_free_memory,  Up: Alphabetical List
  5373. __dpmi_free_physical_address_mapping
  5374. ====================================
  5375. Syntax
  5376. ------
  5377.      #include <dpmi.h>
  5378.      
  5379.      int __dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);
  5380. Description
  5381. -----------
  5382. Please refer to *Note DPMI Specification:: for details on DPMI function
  5383. call operation.  Also see *Note DPMI Overview:: for general information.
  5384. DPMI function AX = 0x0801
  5385. This function unmaps a physical device mapped with *Note
  5386. __dpmi_physical_address_mapping::.  Fill in the linear address.
  5387. Return Value
  5388. ------------
  5389. -1 on error, else zero.
  5390. File: libc.inf,  Node: __dpmi_free_real_mode_callback,  Next: __dpmi_free_serialization_on_shared_memory,  Prev: __dpmi_free_physical_address_mapping,  Up: Alphabetical List
  5391. __dpmi_free_real_mode_callback
  5392. ==============================
  5393. Syntax
  5394. ------
  5395.      #include <dpmi.h>
  5396.      
  5397.      int __dpmi_free_real_mode_callback(__dpmi_raddr *_addr);
  5398. Description
  5399. -----------
  5400. Please refer to *Note DPMI Specification:: for details on DPMI function
  5401. call operation.  Also see *Note DPMI Overview:: for general information.
  5402. DPMI function AX = 0x0303
  5403. This function frees the real-mode callback address.
  5404. Return Value
  5405. ------------
  5406. -1 on error, else zero.
  5407. File: libc.inf,  Node: __dpmi_free_serialization_on_shared_memory,  Next: __dpmi_free_shared_memory,  Prev: __dpmi_free_real_mode_callback,  Up: Alphabetical List
  5408. __dpmi_free_serialization_on_shared_memory
  5409. ==========================================
  5410. Syntax
  5411. ------
  5412.      #include <dpmi.h>
  5413.      
  5414.      int __dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);
  5415. Description
  5416. -----------
  5417. Please refer to *Note DPMI Specification:: for details on DPMI function
  5418. call operation.  Also see *Note DPMI Overview:: for general information.
  5419. DPMI function AX = 0x0d03 (DPMI 1.0 only)
  5420. See the spec.
  5421. Return Value
  5422. ------------
  5423. -1 on error, else zero.
  5424. File: libc.inf,  Node: __dpmi_free_shared_memory,  Next: __dpmi_get_and_disable_virtual_interrupt_state,  Prev: __dpmi_free_serialization_on_shared_memory,  Up: Alphabetical List
  5425. __dpmi_free_shared_memory
  5426. =========================
  5427. Syntax
  5428. ------
  5429.      #include <dpmi.h>
  5430.      
  5431.      int __dpmi_free_shared_memory(unsigned long _handle);
  5432. Description
  5433. -----------
  5434. Please refer to *Note DPMI Specification:: for details on DPMI function
  5435. call operation.  Also see *Note DPMI Overview:: for general information.
  5436. DPMI function AX = 0x0d01 (DPMI 1.0 only)
  5437. See the spec.
  5438. Return Value
  5439. ------------
  5440. -1 on error, else zero.
  5441. File: libc.inf,  Node: __dpmi_get_and_disable_virtual_interrupt_state,  Next: __dpmi_get_and_enable_virtual_interrupt_state,  Prev: __dpmi_free_shared_memory,  Up: Alphabetical List
  5442. __dpmi_get_and_disable_virtual_interrupt_state
  5443. ==============================================
  5444. Syntax
  5445. ------
  5446.      #include <dpmi.h>
  5447.      
  5448.      int __dpmi_get_and_disable_virtual_interrupt_state
  5449. Description
  5450. -----------
  5451. Please refer to *Note DPMI Specification:: for details on DPMI function
  5452. call operation.  Also see *Note DPMI Overview:: for general information.
  5453. DPMI function AX = 0x0900
  5454. This function disables interrupts, and returns the previous setting.
  5455. Return Value
  5456. ------------
  5457. The previous setting.
  5458. File: libc.inf,  Node: __dpmi_get_and_enable_virtual_interrupt_state,  Next: __dpmi_get_and_set_virtual_interrupt_state,  Prev: __dpmi_get_and_disable_virtual_interrupt_state,  Up: Alphabetical List
  5459. __dpmi_get_and_enable_virtual_interrupt_state
  5460. =============================================
  5461. Syntax
  5462. ------
  5463.      #include <dpmi.h>
  5464.      
  5465.      int __dpmi_get_and_enable_virtual_interrupt_state(void);
  5466. Description
  5467. -----------
  5468. Please refer to *Note DPMI Specification:: for details on DPMI function
  5469. call operation.  Also see *Note DPMI Overview:: for general information.
  5470. DPMI function AX = 0x0901
  5471. This function enables interrupts, and returns the previous setting.
  5472. Return Value
  5473. ------------
  5474. The previous setting.
  5475. File: libc.inf,  Node: __dpmi_get_and_set_virtual_interrupt_state,  Next: __dpmi_get_capabilities,  Prev: __dpmi_get_and_enable_virtual_interrupt_state,  Up: Alphabetical List
  5476. __dpmi_get_and_set_virtual_interrupt_state
  5477. ==========================================
  5478. Syntax
  5479. ------
  5480.      #include <dpmi.h>
  5481.      
  5482.      int __dpmi_get_and_set_virtual_interrupt_state(int _old_state);
  5483. Description
  5484. -----------
  5485. Please refer to *Note DPMI Specification:: for details on DPMI function
  5486. call operation.  Also see *Note DPMI Overview:: for general information.
  5487. DPMI function AH = 0x09
  5488. This function restores the interrupt state from a previous call to
  5489. *Note __dpmi_get_and_disable_virtual_interrupt_state:: or *Note
  5490. __dpmi_get_and_enable_virtual_interrupt_state::.
  5491. Return Value
  5492. ------------
  5493. The previous setting.
  5494. File: libc.inf,  Node: __dpmi_get_capabilities,  Next: __dpmi_get_coprocessor_status,  Prev: __dpmi_get_and_set_virtual_interrupt_state,  Up: Alphabetical List
  5495. __dpmi_get_capabilities
  5496. =======================
  5497. Syntax
  5498. ------
  5499.      #include <dpmi.h>
  5500.      
  5501.      int __dpmi_get_capabilities(int *_flags, char *vendor_info);
  5502. Description
  5503. -----------
  5504. Please refer to *Note DPMI Specification:: for details on DPMI function
  5505. call operation.  Also see *Note DPMI Overview:: for general information.
  5506. DPMI function AX = 0x0401 (DPMI 1.0 only)
  5507. Gets the capabilities of the server.  The flags are as follows:
  5508.      ---- ---X = 1="page accessed/dirty" supported
  5509.      ---- --X- = 1="exceptions restartble" supported
  5510.      ---- -X-- = 1="device mapping" supported
  5511.      ---- X--- = 1="map conventional memory" supported
  5512.      ---X ---- = 1="demand zero-fill" supported
  5513.      --X- ---- = 1="write-protect client" supported
  5514.      -X-- ---- = 1="write-protect host" supported
  5515. The vendor info is a 128-byte buffer:
  5516.      [0] host major number
  5517.      [1] host minor number
  5518.      [2..127] vendor name
  5519. Return Value
  5520. ------------
  5521. !-1 on error, else zero.
  5522. File: libc.inf,  Node: __dpmi_get_coprocessor_status,  Next: __dpmi_get_descriptor,  Prev: __dpmi_get_capabilities,  Up: Alphabetical List
  5523. __dpmi_get_coprocessor_status
  5524. =============================
  5525. Syntax
  5526. ------
  5527.      #include <dpmi.h>
  5528.      
  5529.      int __dpmi_get_coprocessor_status(void);
  5530. Description
  5531. -----------
  5532. Please refer to *Note DPMI Specification:: for details on DPMI function
  5533. call operation.  Also see *Note DPMI Overview:: for general information.
  5534. DPMI function AX = 0x0e00 (DPMI 1.0 only)
  5535. Return Value
  5536. ------------
  5537. -1 on error, else returns the processor status flags
  5538. File: libc.inf,  Node: __dpmi_get_descriptor,  Next: __dpmi_get_descriptor_access_rights,  Prev: __dpmi_get_coprocessor_status,  Up: Alphabetical List
  5539. __dpmi_get_descriptor
  5540. =====================
  5541. Syntax
  5542. ------
  5543.      #include <dpmi.h>
  5544.      
  5545.      int __dpmi_get_descriptor(int _selector, void *_buffer);
  5546. Description
  5547. -----------
  5548. Please refer to *Note DPMI Specification:: for details on DPMI function
  5549. call operation.  Also see *Note DPMI Overview:: for general information.
  5550. DPMI function AX = 0x000b
  5551. This function fills a 8-byte buffer with the parameters of the
  5552. descriptor.  The data has the following format:
  5553.      [0] XXXX XXXX = segment limit [7:0]
  5554.      [1] XXXX XXXX = segment limit [15:8]
  5555.      [2] XXXX XXXX = base address [7:0]
  5556.      [3] XXXX XXXX = base address [15:8]
  5557.      [4] XXXX XXXX = base address [23:16]
  5558.      [5] ---- XXXX = type
  5559.      [5] ---X ---- = 0=system, 1=application
  5560.      [5] -XX- ---- = priviledge level
  5561.      [5] X--- ---- = 0=absent, 1=present
  5562.      [6] ---- XXXX = segment limit [19:16]
  5563.      [6] ---X ---- = available for user
  5564.      [6] --0- ---- = must be zero
  5565.      [6] -X-- ---- = 0=16-bit 1=32-bit (cs only)
  5566.      [6] X--- ---- = 0=byte-granular (small) 1=page-granular (big)
  5567.      [7] XXXX XXXX = base address [31:24]
  5568. Return Value
  5569. ------------
  5570. -1 on error, else zero.
  5571. File: libc.inf,  Node: __dpmi_get_descriptor_access_rights,  Next: __dpmi_get_extended_exception_handler_vector_pm,  Prev: __dpmi_get_descriptor,  Up: Alphabetical List
  5572. __dpmi_get_descriptor_access_rights
  5573. ===================================
  5574. Syntax
  5575. ------
  5576.      #include <dpmi.h>
  5577.      
  5578.      int __dpmi_get_descriptor_access_rights(int _selector);
  5579. Description
  5580. -----------
  5581. Please refer to *Note DPMI Specification:: for details on DPMI function
  5582. call operation.  Also see *Note DPMI Overview:: for general information.
  5583. This function returns the access rights byte from the `lar' opcode.
  5584. Return Value
  5585. ------------
  5586. The access byte.  See an Intel programming manual for the list of
  5587. access information.
  5588. File: libc.inf,  Node: __dpmi_get_extended_exception_handler_vector_pm,  Next: __dpmi_get_extended_exception_handler_vector_rm,  Prev: __dpmi_get_descriptor_access_rights,  Up: Alphabetical List
  5589. __dpmi_get_extended_exception_handler_vector_pm
  5590. ===============================================
  5591. Syntax
  5592. ------
  5593.      #include <dpmi.h>
  5594.      
  5595.      int __dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  5596. Description
  5597. -----------
  5598. Please refer to *Note DPMI Specification:: for details on DPMI function
  5599. call operation.  Also see *Note DPMI Overview:: for general information.
  5600. DPMI function AX = 0x0210 (DPMI 1.0 only)
  5601. This gets the function that handles protected mode exceptions.
  5602. Return Value
  5603. ------------
  5604. -1 on error, else zero.
  5605. File: libc.inf,  Node: __dpmi_get_extended_exception_handler_vector_rm,  Next: __dpmi_get_free_memory_information,  Prev: __dpmi_get_extended_exception_handler_vector_pm,  Up: Alphabetical List
  5606. __dpmi_get_extended_exception_handler_vector_rm
  5607. ===============================================
  5608. Syntax
  5609. ------
  5610.      #include <dpmi.h>
  5611.      
  5612.      int __dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  5613. Description
  5614. -----------
  5615. Please refer to *Note DPMI Specification:: for details on DPMI function
  5616. call operation.  Also see *Note DPMI Overview:: for general information.
  5617. DPMI function AX = 0x0211 (DPMI 1.0 only)
  5618. This function gets the handler for real-mode exceptions.
  5619. Return Value
  5620. ------------
  5621. -1 on error, else zero.
  5622. File: libc.inf,  Node: __dpmi_get_free_memory_information,  Next: __dpmi_get_memory_block_size_and_base,  Prev: __dpmi_get_extended_exception_handler_vector_rm,  Up: Alphabetical List
  5623. __dpmi_get_free_memory_information
  5624. ==================================
  5625. Syntax
  5626. ------
  5627.      #include <dpmi.h>
  5628.      
  5629.      int __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);
  5630. Description
  5631. -----------
  5632. Please refer to *Note DPMI Specification:: for details on DPMI function
  5633. call operation.  Also see *Note DPMI Overview:: for general information.
  5634. DPMI function AX = 0x0500
  5635. This function returns information about available memory.  Unsupported
  5636. fields will have -1 (0xfffffff) in them.
  5637. Return Value
  5638. ------------
  5639. Zero.  This always works.
  5640. File: libc.inf,  Node: __dpmi_get_memory_block_size_and_base,  Next: __dpmi_get_memory_information,  Prev: __dpmi_get_free_memory_information,  Up: Alphabetical List
  5641. __dpmi_get_memory_block_size_and_base
  5642. =====================================
  5643. Syntax
  5644. ------
  5645.      #include <dpmi.h>
  5646.      
  5647.      int __dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);
  5648. Description
  5649. -----------
  5650. Please refer to *Note DPMI Specification:: for details on DPMI function
  5651. call operation.  Also see *Note DPMI Overview:: for general information.
  5652. DPMI function AX = 0x050a (DPMI 1.0 only)
  5653. Pass the handle.  It fills in the address and size.
  5654. Return Value
  5655. ------------
  5656. -1 on error, else zero.
  5657. File: libc.inf,  Node: __dpmi_get_memory_information,  Next: __dpmi_get_multiple_descriptors,  Prev: __dpmi_get_memory_block_size_and_base,  Up: Alphabetical List
  5658. __dpmi_get_memory_information
  5659. =============================
  5660. Syntax
  5661. ------
  5662.      #include <dpmi.h>
  5663.      
  5664.      int __dpmi_get_memory_information(__dpmi_memory_info *_buffer);
  5665. Description
  5666. -----------
  5667. Please refer to *Note DPMI Specification:: for details on DPMI function
  5668. call operation.  Also see *Note DPMI Overview:: for general information.
  5669. DPMI function AX = 0x050b (DPMI 1.0 only)
  5670. This function returns virtual memory information.
  5671. Return Value
  5672. ------------
  5673. -1 on error, else zero.
  5674. File: libc.inf,  Node: __dpmi_get_multiple_descriptors,  Next: __dpmi_get_page_attributes,  Prev: __dpmi_get_memory_information,  Up: Alphabetical List
  5675. __dpmi_get_multiple_descriptors
  5676. ===============================
  5677. Syntax
  5678. ------
  5679.      #include <dpmi.h>
  5680.      
  5681.      int __dpmi_get_multiple_descriptors(int _count, void *_buffer);
  5682. Description
  5683. -----------
  5684. Please refer to *Note DPMI Specification:: for details on DPMI function
  5685. call operation.  Also see *Note DPMI Overview:: for general information.
  5686. DPMI function AX = 0x000e (DPMI 1.0 only)
  5687. This function gets a list of selectors' parameters.  The buffer must be
  5688. prefilled with selector values, and will contain the parameters on
  5689. return:
  5690.      [0x00:2] selector #1 (pass)
  5691.      [0x02:8] parameters #1 (returned)
  5692.      [0x0a:2] selector #2 (pass)
  5693.      [0x0c:8] parameters #2 (returned)
  5694.      ...
  5695. Return Value
  5696. ------------
  5697. Returns _count if successful, the negative of # descriptors copied if
  5698. failure.
  5699. File: libc.inf,  Node: __dpmi_get_page_attributes,  Next: __dpmi_get_page_size,  Prev: __dpmi_get_multiple_descriptors,  Up: Alphabetical List
  5700. __dpmi_get_page_attributes
  5701. ==========================
  5702. Syntax
  5703. ------
  5704.      #include <dpmi.h>
  5705.      
  5706.      int __dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  5707. Description
  5708. -----------
  5709. Please refer to *Note DPMI Specification:: for details on DPMI function
  5710. call operation.  Also see *Note DPMI Overview:: for general information.
  5711. DPMI function AX = 0x0506 (DPMI 1.0 only)
  5712. Pass the handle, offset of first page (relative to start of block) in
  5713. .address, and number of pages in .count.  Buffer gets filled in with
  5714. the attributes (see spec).
  5715. Return Value
  5716. ------------
  5717. -1 on error, else zero.
  5718. File: libc.inf,  Node: __dpmi_get_page_size,  Next: __dpmi_get_processor_exception_handler_vector,  Prev: __dpmi_get_page_attributes,  Up: Alphabetical List
  5719. __dpmi_get_page_size
  5720. ====================
  5721. Syntax
  5722. ------
  5723.      #include <dpmi.h>
  5724.      
  5725.      int __dpmi_get_page_size(unsigned long *_size);
  5726. Description
  5727. -----------
  5728. Please refer to *Note DPMI Specification:: for details on DPMI function
  5729. call operation.  Also see *Note DPMI Overview:: for general information.
  5730. DPMI function AX = 0x0604
  5731. Fills in the page size.
  5732. Return Value
  5733. ------------
  5734. -1 on error (16-bit host), else zero.
  5735. File: libc.inf,  Node: __dpmi_get_processor_exception_handler_vector,  Next: __dpmi_get_protected_mode_interrupt_vector,  Prev: __dpmi_get_page_size,  Up: Alphabetical List
  5736. __dpmi_get_processor_exception_handler_vector
  5737. =============================================
  5738. Syntax
  5739. ------
  5740.      #include <dpmi.h>
  5741.      
  5742.      int __dpmi_get_processor_exception_handler_vector
  5743. Description
  5744. -----------
  5745. Please refer to *Note DPMI Specification:: for details on DPMI function
  5746. call operation.  Also see *Note DPMI Overview:: for general information.
  5747. DPMI function AX = 0x0202
  5748. This function gets the current protected-mode exception handler (not
  5749. interrupts).  It will return a selector:offset pair.
  5750. Return Value
  5751. ------------
  5752. -1 on error (invalid vector), else zero.
  5753. File: libc.inf,  Node: __dpmi_get_protected_mode_interrupt_vector,  Next: __dpmi_get_raw_mode_switch_addr,  Prev: __dpmi_get_processor_exception_handler_vector,  Up: Alphabetical List
  5754. __dpmi_get_protected_mode_interrupt_vector
  5755. ==========================================
  5756. Syntax
  5757. ------
  5758.      #include <dpmi.h>
  5759.      
  5760.      int __dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  5761. Description
  5762. -----------
  5763. Please refer to *Note DPMI Specification:: for details on DPMI function
  5764. call operation.  Also see *Note DPMI Overview:: for general information.
  5765. DPMI function AX = 0x0204
  5766. This function gets the address of the current protected mode interrupt
  5767. (not exception) handler.  It returns a selector:offset pair.
  5768. Return Value
  5769. ------------
  5770. Zero.  This always works.
  5771. File: libc.inf,  Node: __dpmi_get_raw_mode_switch_addr,  Next: __dpmi_get_real_mode_interrupt_vector,  Prev: __dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  5772. __dpmi_get_raw_mode_switch_addr
  5773. ===============================
  5774. Syntax
  5775. ------
  5776.      #include <dpmi.h>
  5777.      
  5778.      int __dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  5779. Description
  5780. -----------
  5781. Please refer to *Note DPMI Specification:: for details on DPMI function
  5782. call operation.  Also see *Note DPMI Overview:: for general information.
  5783. DPMI function AX = 0x0306
  5784. Read the spec for more info.
  5785. Return Value
  5786. ------------
  5787. Zero.  This always works.
  5788. File: libc.inf,  Node: __dpmi_get_real_mode_interrupt_vector,  Next: __dpmi_get_segment_base_address,  Prev: __dpmi_get_raw_mode_switch_addr,  Up: Alphabetical List
  5789. __dpmi_get_real_mode_interrupt_vector
  5790. =====================================
  5791. Syntax
  5792. ------
  5793.      #include <dpmi.h>
  5794.      
  5795.      int __dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  5796. Description
  5797. -----------
  5798. Please refer to *Note DPMI Specification:: for details on DPMI function
  5799. call operation.  Also see *Note DPMI Overview:: for general information.
  5800. DPMI function AX = 0x0200
  5801. This function stores the real-mode interrupt vector address in
  5802. _ADDRESS. This is the same as the DOS get vector call, and returns a
  5803. real-mode segment:offset pair.
  5804. Bits [31:8] in the vector number are silently ignored.
  5805. Return Value
  5806. ------------
  5807. Zero.  This function always works.
  5808. File: libc.inf,  Node: __dpmi_get_segment_base_address,  Next: __dpmi_get_segment_limit,  Prev: __dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  5809. __dpmi_get_segment_base_address
  5810. ===============================
  5811. Syntax
  5812. ------
  5813.      #include <dpmi.h>
  5814.      
  5815.      int __dpmi_get_segment_base_address(int _selector, unsigned long *_addr);
  5816. Description
  5817. -----------
  5818. Please refer to *Note DPMI Specification:: for details on DPMI function
  5819. call operation.  Also see *Note DPMI Overview:: for general information.
  5820. DPMI function AX = 0x0006
  5821. The physical base address of the selector is stored in *ADDR.
  5822. Return Value
  5823. ------------
  5824. -1 on error, else zero.
  5825. Example
  5826. -------
  5827.      unsigned long addr;
  5828.      if (__dpmi_get_segment_base_address(selector, &addr))
  5829.        ...
  5830. File: libc.inf,  Node: __dpmi_get_segment_limit,  Next: __dpmi_get_selector_increment_value,  Prev: __dpmi_get_segment_base_address,  Up: Alphabetical List
  5831. __dpmi_get_segment_limit
  5832. ========================
  5833. Syntax
  5834. ------
  5835.      #include <dpmi.h>
  5836.      
  5837.      unsigned __dpmi_get_segment_limit(int _selector);
  5838. Description
  5839. -----------
  5840. Please refer to *Note DPMI Specification:: for details on DPMI function
  5841. call operation.  Also see *Note DPMI Overview:: for general information.
  5842. Return Value
  5843. ------------
  5844. The limit of the segment, as returned by the `lsl' opcode.
  5845. File: libc.inf,  Node: __dpmi_get_selector_increment_value,  Next: __dpmi_get_state_of_debug_watchpoint,  Prev: __dpmi_get_segment_limit,  Up: Alphabetical List
  5846. __dpmi_get_selector_increment_value
  5847. ===================================
  5848. Syntax
  5849. ------
  5850.      #include <dpmi.h>
  5851.      
  5852.      int __dpmi_get_selector_increment_value(void);
  5853. Description
  5854. -----------
  5855. Please refer to *Note DPMI Specification:: for details on DPMI function
  5856. call operation.  Also see *Note DPMI Overview:: for general information.
  5857. DPMI function AX = 0x0003
  5858. Return Value
  5859. ------------
  5860. The value to return to each selector allocated by
  5861. __dpmi_allocate_ldt_descriptors to get the next one.
  5862. File: libc.inf,  Node: __dpmi_get_state_of_debug_watchpoint,  Next: __dpmi_get_state_save_restore_addr,  Prev: __dpmi_get_selector_increment_value,  Up: Alphabetical List
  5863. __dpmi_get_state_of_debug_watchpoint
  5864. ====================================
  5865. Syntax
  5866. ------
  5867.      #include <dpmi.h>
  5868.      
  5869.      int __dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);
  5870. Description
  5871. -----------
  5872. Please refer to *Note DPMI Specification:: for details on DPMI function
  5873. call operation.  Also see *Note DPMI Overview:: for general information.
  5874. DPMI function AX = 0x0b02
  5875. Gets the state of the watchpoint.  Pass handle, fills in status (0=not
  5876. encountered, 1=encountered).
  5877. Return Value
  5878. ------------
  5879. -1 on error, else zero.
  5880. File: libc.inf,  Node: __dpmi_get_state_save_restore_addr,  Next: __dpmi_get_vendor_specific_api_entry_point,  Prev: __dpmi_get_state_of_debug_watchpoint,  Up: Alphabetical List
  5881. __dpmi_get_state_save_restore_addr
  5882. ==================================
  5883. Syntax
  5884. ------
  5885.      #include <dpmi.h>
  5886.      
  5887.      int __dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  5888. Description
  5889. -----------
  5890. Please refer to *Note DPMI Specification:: for details on DPMI function
  5891. call operation.  Also see *Note DPMI Overview:: for general information.
  5892. DPMI function AX = 0x0305
  5893. Read the spec for info.
  5894. Return Value
  5895. ------------
  5896. The number of bytes required to save state.
  5897. File: libc.inf,  Node: __dpmi_get_vendor_specific_api_entry_point,  Next: __dpmi_get_version,  Prev: __dpmi_get_state_save_restore_addr,  Up: Alphabetical List
  5898. __dpmi_get_vendor_specific_api_entry_point
  5899. ==========================================
  5900. Syntax
  5901. ------
  5902.      #include <dpmi.h>
  5903.      
  5904.      int __dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);
  5905. Description
  5906. -----------
  5907. Please refer to *Note DPMI Specification:: for details on DPMI function
  5908. call operation.  Also see *Note DPMI Overview:: for general information.
  5909. DPMI function AX = 0x0a00
  5910. Look up a vendor-specific function, given the *name* of the function.
  5911. Return Value
  5912. ------------
  5913. -1 on error, else zero.
  5914. File: libc.inf,  Node: __dpmi_get_version,  Next: __dpmi_get_virtual_interrupt_state,  Prev: __dpmi_get_vendor_specific_api_entry_point,  Up: Alphabetical List
  5915. __dpmi_get_version
  5916. ==================
  5917. Syntax
  5918. ------
  5919.      #include <dpmi.h>
  5920.      
  5921.      int __dpmi_get_version(__dpmi_version_ret *_ret);
  5922. Description
  5923. -----------
  5924. Please refer to *Note DPMI Specification:: for details on DPMI function
  5925. call operation.  Also see *Note DPMI Overview:: for general information.
  5926. DPMI function AX = 0x0400
  5927. Fills in version information.  The flags are as follows:
  5928.      ---- ---X = 0=16-bit host  1=32-bit host
  5929.      ---- --X- = 0=V86 used for reflected ints, 1=real mode
  5930.      ---- -X-- = 0=no virtual memory, 1=virtual memory supported
  5931. The cpu is 2=80286, 3=80386, 4=80486, etc.
  5932. DPMI 0.9 returns major=0 and minor=0x5a.
  5933. Return Value
  5934. ------------
  5935. Zero.  This always works.
  5936. File: libc.inf,  Node: __dpmi_get_virtual_interrupt_state,  Next: __dpmi_install_resident_service_provider_callback,  Prev: __dpmi_get_version,  Up: Alphabetical List
  5937. __dpmi_get_virtual_interrupt_state
  5938. ==================================
  5939. Syntax
  5940. ------
  5941.      #include <dpmi.h>
  5942.      
  5943.      int __dpmi_get_virtual_interrupt_state(void);
  5944. Description
  5945. -----------
  5946. Please refer to *Note DPMI Specification:: for details on DPMI function
  5947. call operation.  Also see *Note DPMI Overview:: for general information.
  5948. DPMI function AX = 0x0902
  5949. Return Value
  5950. ------------
  5951. This function returns the current interrupt flag (1=enabled).
  5952. File: libc.inf,  Node: __dpmi_install_resident_service_provider_callback,  Next: __dpmi_int,  Prev: __dpmi_get_virtual_interrupt_state,  Up: Alphabetical List
  5953. __dpmi_install_resident_service_provider_callback
  5954. =================================================
  5955. Syntax
  5956. ------
  5957.      #include <dpmi.h>
  5958.      
  5959.      int __dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);
  5960. Description
  5961. -----------
  5962. Please refer to *Note DPMI Specification:: for details on DPMI function
  5963. call operation.  Also see *Note DPMI Overview:: for general information.
  5964. DPMI function AX = 0x0c00 (DPMI 1.0 only)
  5965. See the spec.
  5966. Return Value
  5967. ------------
  5968. -1 on error, else zero.
  5969. File: libc.inf,  Node: __dpmi_int,  Next: __dpmi_lock_linear_region,  Prev: __dpmi_install_resident_service_provider_callback,  Up: Alphabetical List
  5970. __dpmi_int
  5971. ==========
  5972. Syntax
  5973. ------
  5974.      #include <dpmi.h>
  5975.      
  5976.      int __dpmi_int(int _vector, __dpmi_regs *_regs);
  5977. Description
  5978. -----------
  5979. Please refer to *Note DPMI Specification:: for details on DPMI function
  5980. call operation.  Also see *Note DPMI Overview:: for general information.
  5981. DPMI function AX = 0x0300
  5982. This function performs a software interrupt in real mode after filling
  5983. in *most* the registers from the given structure.  %ss, %esp, and
  5984. %eflags are automatically taken care of, unlike *Note
  5985. __dpmi_simulate_real_mode_interrupt::.
  5986. The following variables can be used to tune this function.  By default,
  5987. these variables are all zero.
  5988. `__dpmi_int_ss'
  5989. `__dpmi_int_sp'
  5990. `__dpmi_int_flags'
  5991.      These hold the values stored in the appropriate field in the
  5992.      `__dpmi_regs' structure.
  5993. Return Value
  5994. ------------
  5995. -1 on error, else zero.
  5996. File: libc.inf,  Node: __dpmi_lock_linear_region,  Next: __dpmi_map_conventional_memory_in_memory_block,  Prev: __dpmi_int,  Up: Alphabetical List
  5997. __dpmi_lock_linear_region
  5998. =========================
  5999. Syntax
  6000. ------
  6001.      #include <dpmi.h>
  6002.      
  6003.      int __dpmi_lock_linear_region(__dpmi_meminfo *_info);
  6004. Description
  6005. -----------
  6006. Please refer to *Note DPMI Specification:: for details on DPMI function
  6007. call operation.  Also see *Note DPMI Overview:: for general information.
  6008. DPMI function AX = 0x0600
  6009. This function locks virtual memory, to prevent page faults during
  6010. hardware interrupts.  Pass address and size (in bytes).
  6011. Return Value
  6012. ------------
  6013. -1 on error, else zero.
  6014. File: libc.inf,  Node: __dpmi_map_conventional_memory_in_memory_block,  Next: __dpmi_map_device_in_memory_block,  Prev: __dpmi_lock_linear_region,  Up: Alphabetical List
  6015. __dpmi_map_conventional_memory_in_memory_block
  6016. ==============================================
  6017. Syntax
  6018. ------
  6019.      #include <dpmi.h>
  6020.      
  6021.      int __dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);
  6022. Description
  6023. -----------
  6024. Please refer to *Note DPMI Specification:: for details on DPMI function
  6025. call operation.  Also see *Note DPMI Overview:: for general information.
  6026. DPMI function AX = 0x0509 (DPMI 1.0 only)
  6027. This function maps conventional memory (even when virtualized) to
  6028. virtual memory.  Pass the handle, offset, and number of pages.
  6029. Return Value
  6030. ------------
  6031. -1 on error, else zero.
  6032. File: libc.inf,  Node: __dpmi_map_device_in_memory_block,  Next: __dpmi_mark_page_as_demand_paging_candidate,  Prev: __dpmi_map_conventional_memory_in_memory_block,  Up: Alphabetical List
  6033. __dpmi_map_device_in_memory_block
  6034. =================================
  6035. Syntax
  6036. ------
  6037.      #include <dpmi.h>
  6038.      
  6039.      int __dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long *_physaddr);
  6040. Description
  6041. -----------
  6042. Please refer to *Note DPMI Specification:: for details on DPMI function
  6043. call operation.  Also see *Note DPMI Overview:: for general information.
  6044. DPMI function AX = 0x0508 (DPMI 1.0 only)
  6045. This function maps a physical address range to virtual memory.  Pass
  6046. the handle, offset relative to the start of the block, and number of
  6047. pages to map.
  6048. Return Value
  6049. ------------
  6050. -1 on error, else zero.
  6051. File: libc.inf,  Node: __dpmi_mark_page_as_demand_paging_candidate,  Next: __dpmi_mark_real_mode_region_as_pageable,  Prev: __dpmi_map_device_in_memory_block,  Up: Alphabetical List
  6052. __dpmi_mark_page_as_demand_paging_candidate
  6053. ===========================================
  6054. Syntax
  6055. ------
  6056.      #include <dpmi.h>
  6057.      
  6058.      int __dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);
  6059. Description
  6060. -----------
  6061. Please refer to *Note DPMI Specification:: for details on DPMI function
  6062. call operation.  Also see *Note DPMI Overview:: for general information.
  6063. DPMI function AX = 0x0702
  6064. Advises the server that certain pages are unlikely to be used soon.
  6065. Set address and size (in bytes).
  6066. Return Value
  6067. ------------
  6068. -1 on error, else zero.
  6069. File: libc.inf,  Node: __dpmi_mark_real_mode_region_as_pageable,  Next: __dpmi_physical_address_mapping,  Prev: __dpmi_mark_page_as_demand_paging_candidate,  Up: Alphabetical List
  6070. __dpmi_mark_real_mode_region_as_pageable
  6071. ========================================
  6072. Syntax
  6073. ------
  6074.      #include <dpmi.h>
  6075.      
  6076.      int __dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);
  6077. Description
  6078. -----------
  6079. Please refer to *Note DPMI Specification:: for details on DPMI function
  6080. call operation.  Also see *Note DPMI Overview:: for general information.
  6081. DPMI function AX = 0x0602
  6082. This function advises the host that the given pages are suitable for
  6083. page-out.  Pass address and size (in bytes).
  6084. Return Value
  6085. ------------
  6086. -1 on error, else zero.
  6087. File: libc.inf,  Node: __dpmi_physical_address_mapping,  Next: __dpmi_relock_real_mode_region,  Prev: __dpmi_mark_real_mode_region_as_pageable,  Up: Alphabetical List
  6088. __dpmi_physical_address_mapping
  6089. ===============================
  6090. Syntax
  6091. ------
  6092.      #include <dpmi.h>
  6093.      
  6094.      int __dpmi_physical_address_mapping(__dpmi_meminfo *_info);
  6095. Description
  6096. -----------
  6097. Please refer to *Note DPMI Specification:: for details on DPMI function
  6098. call operation.  Also see *Note DPMI Overview:: for general information.
  6099. DPMI function AX = 0x0800
  6100. Maps a physical device (like a graphics buffer) to linear memory.  Fill
  6101. in the physical address and size (in bytes).  On return, the address is
  6102. the linear address to use.
  6103. Return Value
  6104. ------------
  6105. -1 on error, else zero.
  6106. File: libc.inf,  Node: __dpmi_relock_real_mode_region,  Next: __dpmi_reset_debug_watchpoint,  Prev: __dpmi_physical_address_mapping,  Up: Alphabetical List
  6107. __dpmi_relock_real_mode_region
  6108. ==============================
  6109. Syntax
  6110. ------
  6111.      #include <dpmi.h>
  6112.      
  6113.      int __dpmi_relock_real_mode_region(__dpmi_meminfo *_info);
  6114. Description
  6115. -----------
  6116. Please refer to *Note DPMI Specification:: for details on DPMI function
  6117. call operation.  Also see *Note DPMI Overview:: for general information.
  6118. DPMI function AX = 0x0603
  6119. This function relocks the pages unlocked with *Note
  6120. __dpmi_mark_real_mode_region_as_pageable::.  Pass address and size (in
  6121. bytes).
  6122. Return Value
  6123. ------------
  6124. -1 on error, else zero.
  6125. File: libc.inf,  Node: __dpmi_reset_debug_watchpoint,  Next: __dpmi_resize_dos_memory,  Prev: __dpmi_relock_real_mode_region,  Up: Alphabetical List
  6126. __dpmi_reset_debug_watchpoint
  6127. =============================
  6128. Syntax
  6129. ------
  6130.      #include <dpmi.h>
  6131.      
  6132.      int __dpmi_reset_debug_watchpoint
  6133. Description
  6134. -----------
  6135. Please refer to *Note DPMI Specification:: for details on DPMI function
  6136. call operation.  Also see *Note DPMI Overview:: for general information.
  6137. DPMI function AX = 0x0b03
  6138. Resets a watchpoint.
  6139. Return Value
  6140. ------------
  6141. -1 on error, else zero.
  6142. File: libc.inf,  Node: __dpmi_resize_dos_memory,  Next: __dpmi_resize_linear_memory,  Prev: __dpmi_reset_debug_watchpoint,  Up: Alphabetical List
  6143. __dpmi_resize_dos_memory
  6144. ========================
  6145. Syntax
  6146. ------
  6147.      #include <dpmi.h>
  6148.      
  6149.      int __dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);
  6150. Description
  6151. -----------
  6152. Please refer to *Note DPMI Specification:: for details on DPMI function
  6153. call operation.  Also see *Note DPMI Overview:: for general information.
  6154. DPMI function AX = 0x0102
  6155. This function resizes a dos memory block.  Remember to pass the
  6156. selector, and not the segment.  If this call fails, _RET_MAX contains
  6157. the largest number of paragraphs available.
  6158. Return Value
  6159. ------------
  6160. -1 on error, else zero.
  6161. File: libc.inf,  Node: __dpmi_resize_linear_memory,  Next: __dpmi_resize_memory,  Prev: __dpmi_resize_dos_memory,  Up: Alphabetical List
  6162. __dpmi_resize_linear_memory
  6163. ===========================
  6164. Syntax
  6165. ------
  6166.      #include <dpmi.h>
  6167.      
  6168.      int __dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);
  6169. Description
  6170. -----------
  6171. Please refer to *Note DPMI Specification:: for details on DPMI function
  6172. call operation.  Also see *Note DPMI Overview:: for general information.
  6173. DPMI function AX = 0x0505 (DPMI 1.0 only)
  6174. This function resizes a memory block.  Pass the handle and new size.
  6175. Bit 0 of _commit is 1 for committed pages; bit 1 is 1 to automatically
  6176. update descriptors.  It returns a new handle and base address.
  6177. Return Value
  6178. ------------
  6179. -1 on error, else zero.
  6180. File: libc.inf,  Node: __dpmi_resize_memory,  Next: __dpmi_segment_to_descriptor,  Prev: __dpmi_resize_linear_memory,  Up: Alphabetical List
  6181. __dpmi_resize_memory
  6182. ====================
  6183. Syntax
  6184. ------
  6185.      #include <dpmi.h>
  6186.      
  6187.      int __dpmi_resize_memory
  6188. Description
  6189. -----------
  6190. Please refer to *Note DPMI Specification:: for details on DPMI function
  6191. call operation.  Also see *Note DPMI Overview:: for general information.
  6192. DPMI function AX = 0x0503
  6193. This function changes the size of a virtual memory block.  You must
  6194. pass the handle and size fields.  It may change the base address also;
  6195. beware of debugging breakpoints and locked memory.  It will return a
  6196. new handle.
  6197. Return Value
  6198. ------------
  6199. -1 on error, else zero.
  6200. File: libc.inf,  Node: __dpmi_segment_to_descriptor,  Next: __dpmi_serialize_on_shared_memory,  Prev: __dpmi_resize_memory,  Up: Alphabetical List
  6201. __dpmi_segment_to_descriptor
  6202. ============================
  6203. Syntax
  6204. ------
  6205.      #include <dpmi.h>
  6206.      
  6207.      int __dpmi_segment_to_descriptor
  6208. Description
  6209. -----------
  6210. Please refer to *Note DPMI Specification:: for details on DPMI function
  6211. call operation.  Also see *Note DPMI Overview:: for general information.
  6212. DPMI function AX = 0x0002
  6213. This function returns a selector that maps to what the real-mode
  6214. segment provided would have referenced.  Warning: this is a scarce
  6215. resource.
  6216. Return Value
  6217. ------------
  6218. -1 on error, else the selector.
  6219. Example
  6220. -------
  6221.      short video = __dpmi_segment_to_descriptor(0xa000);
  6222.      movedata(_my_ds(), buffer, video, 0, 320*200);
  6223. File: libc.inf,  Node: __dpmi_serialize_on_shared_memory,  Next: __dpmi_set_coprocessor_emulation,  Prev: __dpmi_segment_to_descriptor,  Up: Alphabetical List
  6224. __dpmi_serialize_on_shared_memory
  6225. =================================
  6226. Syntax
  6227. ------
  6228.      #include <dpmi.h>
  6229.      
  6230.      int __dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);
  6231. Description
  6232. -----------
  6233. Please refer to *Note DPMI Specification:: for details on DPMI function
  6234. call operation.  Also see *Note DPMI Overview:: for general information.
  6235. DPMI function AX = 0x0d02 (DPMI 1.0 only)
  6236. See the spec.
  6237. Return Value
  6238. ------------
  6239. -1 on error, else zero.
  6240. File: libc.inf,  Node: __dpmi_set_coprocessor_emulation,  Next: __dpmi_set_debug_watchpoint,  Prev: __dpmi_serialize_on_shared_memory,  Up: Alphabetical List
  6241. __dpmi_set_coprocessor_emulation
  6242. ================================
  6243. Syntax
  6244. ------
  6245.      #include <dpmi.h>
  6246.      
  6247.      int __dpmi_set_coprocessor_emulation(int _flags);
  6248. Description
  6249. -----------
  6250. Please refer to *Note DPMI Specification:: for details on DPMI function
  6251. call operation.  Also see *Note DPMI Overview:: for general information.
  6252. DPMI function AX = 0x0e01 (DPMI 1.0 only)
  6253. Return Value
  6254. ------------
  6255. -1 on errors, else zero.
  6256. File: libc.inf,  Node: __dpmi_set_debug_watchpoint,  Next: __dpmi_set_descriptor,  Prev: __dpmi_set_coprocessor_emulation,  Up: Alphabetical List
  6257. __dpmi_set_debug_watchpoint
  6258. ===========================
  6259. Syntax
  6260. ------
  6261.      #include <dpmi.h>
  6262.      
  6263.      int __dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);
  6264. Description
  6265. -----------
  6266. Please refer to *Note DPMI Specification:: for details on DPMI function
  6267. call operation.  Also see *Note DPMI Overview:: for general information.
  6268. DPMI function AX = 0x0b00
  6269. Set a debug breakpoint.  Type is 0 for execute, 1 for write, and 2 for
  6270. access.  Fill in address and size (1,2,4 bytes).  Server fills in
  6271. handle.
  6272. Return Value
  6273. ------------
  6274. -1 on error, else zero.
  6275. File: libc.inf,  Node: __dpmi_set_descriptor,  Next: __dpmi_set_descriptor_access_rights,  Prev: __dpmi_set_debug_watchpoint,  Up: Alphabetical List
  6276. __dpmi_set_descriptor
  6277. =====================
  6278. Syntax
  6279. ------
  6280.      #include <dpmi.h>
  6281.      
  6282.      int __dpmi_set_descriptor(int _selector, void *_buffer);
  6283. Description
  6284. -----------
  6285. Please refer to *Note DPMI Specification:: for details on DPMI function
  6286. call operation.  Also see *Note DPMI Overview:: for general information.
  6287. DPMI function AX = 0x000c
  6288. This function sets the selector's parameters.  *Note
  6289. __dpmi_get_descriptor::.
  6290. Return Value
  6291. ------------
  6292. -1 on error, else zero.
  6293. File: libc.inf,  Node: __dpmi_set_descriptor_access_rights,  Next: __dpmi_set_extended_exception_handler_vector_pm,  Prev: __dpmi_set_descriptor,  Up: Alphabetical List
  6294. __dpmi_set_descriptor_access_rights
  6295. ===================================
  6296. Syntax
  6297. ------
  6298.      #include <dpmi.h>
  6299.      
  6300.      int __dpmi_set_descriptor_access_rights(int _selector, int _rights);
  6301. Description
  6302. -----------
  6303. Please refer to *Note DPMI Specification:: for details on DPMI function
  6304. call operation.  Also see *Note DPMI Overview:: for general information.
  6305. DPMI function AX = 0x0009
  6306. This sets the rights of _SELECTOR to _RIGHTS.
  6307.      ---- ---- ---- ---X = 0=not accessed, 1=accessed
  6308.      ---- ---- ---- --X- = data: 0=read, 1=r/w; code: 1=readable
  6309.      ---- ---- ---- -X-- = data: 0=expand-up, 1=expand-down; code: 0=non-conforming
  6310.      ---- ---- ---- X--- = 0=data, 1=code
  6311.      ---- ---- ---1 ---- = must be 1
  6312.      ---- ---- -XX- ---- = priviledge level (must equal CPL)
  6313.      ---- ---- X--- ---- = 0=absent, 1=present
  6314.      ---X ---- ---- ---- = available for the user
  6315.      --0- ---- ---- ---- = must be 0
  6316.      -X-- ---- ---- ---- = 0=16-bit 1=32-bit
  6317.      X--- ---- ---- ---- = 0=byte granular (small) 1=page-granular (big)
  6318. Return Value
  6319. ------------
  6320. -1 on error, else zero.
  6321. File: libc.inf,  Node: __dpmi_set_extended_exception_handler_vector_pm,  Next: __dpmi_set_extended_exception_handler_vector_rm,  Prev: __dpmi_set_descriptor_access_rights,  Up: Alphabetical List
  6322. __dpmi_set_extended_exception_handler_vector_pm
  6323. ===============================================
  6324. Syntax
  6325. ------
  6326.      #include <dpmi.h>
  6327.      
  6328.      int __dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  6329. Description
  6330. -----------
  6331. Please refer to *Note DPMI Specification:: for details on DPMI function
  6332. call operation.  Also see *Note DPMI Overview:: for general information.
  6333. DPMI function AX = 0x0212 (DPMI 1.0 only)
  6334. This function installs a handler for protected-mode exceptions.
  6335. Return Value
  6336. ------------
  6337. -1 on error, else zero.
  6338. File: libc.inf,  Node: __dpmi_set_extended_exception_handler_vector_rm,  Next: __dpmi_set_multiple_descriptors,  Prev: __dpmi_set_extended_exception_handler_vector_pm,  Up: Alphabetical List
  6339. __dpmi_set_extended_exception_handler_vector_rm
  6340. ===============================================
  6341. Syntax
  6342. ------
  6343.      #include <dpmi.h>
  6344.      
  6345.      int __dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  6346. Description
  6347. -----------
  6348. Please refer to *Note DPMI Specification:: for details on DPMI function
  6349. call operation.  Also see *Note DPMI Overview:: for general information.
  6350. DPMI function AX = 0x0213 (DPMI 1.0 only)
  6351. This function installs a handler for real-mode exceptions.
  6352. Return Value
  6353. ------------
  6354. -1 on error, else zero.
  6355. File: libc.inf,  Node: __dpmi_set_multiple_descriptors,  Next: __dpmi_set_page_attributes,  Prev: __dpmi_set_extended_exception_handler_vector_rm,  Up: Alphabetical List
  6356. __dpmi_set_multiple_descriptors
  6357. ===============================
  6358. Syntax
  6359. ------
  6360.      #include <dpmi.h>
  6361.      
  6362.      int __dpmi_set_multiple_descriptors(int _count, void *_buffer);
  6363. Description
  6364. -----------
  6365. Please refer to *Note DPMI Specification:: for details on DPMI function
  6366. call operation.  Also see *Note DPMI Overview:: for general information.
  6367. DPMI function AX = 0x000f (DPMI 1.0 only)
  6368. This function sets multiple descriptors.  Buffer usage is like *Note
  6369. __dpmi_get_multiple_descriptors::, but the caller fills in everything
  6370. before calling.
  6371. Return Value
  6372. ------------
  6373. Returns _count if successful, the negative of # descriptors set if
  6374. failure.
  6375. File: libc.inf,  Node: __dpmi_set_page_attributes,  Next: __dpmi_set_processor_exception_handler_vector,  Prev: __dpmi_set_multiple_descriptors,  Up: Alphabetical List
  6376. __dpmi_set_page_attributes
  6377. ==========================
  6378. Syntax
  6379. ------
  6380.      #include <dpmi.h>
  6381.      
  6382.      int __dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  6383. Description
  6384. -----------
  6385. Please refer to *Note DPMI Specification:: for details on DPMI function
  6386. call operation.  Also see *Note DPMI Overview:: for general information.
  6387. DPMI function AX = 0x0507 (DPMI 1.0 only)
  6388. Sets page attributes.  Pass handle, offset within block in .address,
  6389. and number of pages in .count.  Buffer points to new attributes (see
  6390. spec).
  6391. Return Value
  6392. ------------
  6393. -1 on error, else zero.
  6394. File: libc.inf,  Node: __dpmi_set_processor_exception_handler_vector,  Next: __dpmi_set_protected_mode_interrupt_vector,  Prev: __dpmi_set_page_attributes,  Up: Alphabetical List
  6395. __dpmi_set_processor_exception_handler_vector
  6396. =============================================
  6397. Syntax
  6398. ------
  6399.      #include <dpmi.h>
  6400.      
  6401.      int __dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);
  6402. Description
  6403. -----------
  6404. Please refer to *Note DPMI Specification:: for details on DPMI function
  6405. call operation.  Also see *Note DPMI Overview:: for general information.
  6406. DPMI function AX = 0x0203
  6407. This function installs a handler for protected mode exceptions (not
  6408. interrupts).  You must pass a selector:offset pair.
  6409. Return Value
  6410. ------------
  6411. -1 on error, else zero.
  6412. File: libc.inf,  Node: __dpmi_set_protected_mode_interrupt_vector,  Next: __dpmi_set_real_mode_interrupt_vector,  Prev: __dpmi_set_processor_exception_handler_vector,  Up: Alphabetical List
  6413. __dpmi_set_protected_mode_interrupt_vector
  6414. ==========================================
  6415. Syntax
  6416. ------
  6417.      #include <dpmi.h>
  6418.      
  6419.      int __dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  6420. Description
  6421. -----------
  6422. Please refer to *Note DPMI Specification:: for details on DPMI function
  6423. call operation.  Also see *Note DPMI Overview:: for general information.
  6424. DPMI function AX = 0x0205
  6425. This function installs a protected-mode interrupt (not exception)
  6426. handler.  You must pass a selector:offset pair.  Hardware interrupts
  6427. will always be reflected to protected mode if you install a handler.
  6428. You must explicitely `sti' before `iret' because `iret' won't always
  6429. restore interrupts in a virtual environment.
  6430. Return Value
  6431. ------------
  6432. -1 on error, else zero.
  6433. File: libc.inf,  Node: __dpmi_set_real_mode_interrupt_vector,  Next: __dpmi_set_segment_base_address,  Prev: __dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  6434. __dpmi_set_real_mode_interrupt_vector
  6435. =====================================
  6436. Syntax
  6437. ------
  6438.      #include <dpmi.h>
  6439.      
  6440.      int __dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  6441. Description
  6442. -----------
  6443. Please refer to *Note DPMI Specification:: for details on DPMI function
  6444. call operation.  Also see *Note DPMI Overview:: for general information.
  6445. DPMI function AX = 0x0201
  6446. This function sets a real-mode interrupt vector.  You must pass a
  6447. segment:offset pair, not a selector.
  6448. Bits [31:8] in the vector number are silently ignored.
  6449. Return Value
  6450. ------------
  6451. Zero.  This function always works.
  6452. File: libc.inf,  Node: __dpmi_set_segment_base_address,  Next: __dpmi_set_segment_limit,  Prev: __dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  6453. __dpmi_set_segment_base_address
  6454. ===============================
  6455. Syntax
  6456. ------
  6457.      #include <dpmi.h>
  6458.      
  6459.      int __dpmi_set_segment_base_address(int _selector, unsigned _address);
  6460. Description
  6461. -----------
  6462. Please refer to *Note DPMI Specification:: for details on DPMI function
  6463. call operation.  Also see *Note DPMI Overview:: for general information.
  6464. DPMI function AX = 0x0007
  6465. This function sets the base address of the _SELECTOR to _ADDRESS.
  6466. Return Value
  6467. ------------
  6468. -1 on error, else zero.
  6469. File: libc.inf,  Node: __dpmi_set_segment_limit,  Next: __dpmi_simulate_real_mode_interrupt,  Prev: __dpmi_set_segment_base_address,  Up: Alphabetical List
  6470. __dpmi_set_segment_limit
  6471. ========================
  6472. Syntax
  6473. ------
  6474.      #include <dpmi.h>
  6475.      
  6476.      int __dpmi_set_segment_limit(int _selector, unsigned _address);
  6477. Description
  6478. -----------
  6479. Please refer to *Note DPMI Specification:: for details on DPMI function
  6480. call operation.  Also see *Note DPMI Overview:: for general information.
  6481. DPMI function AX = 0x0008
  6482. This function sets the highest valid address in the segment referenced
  6483. by _SELECTOR.  For example, if you pass 0xfffff, the highest valid
  6484. address is 0xfffff.  Note: if you pass a number <= 64K, the segment
  6485. changes to "non-big", and may cause unexpected problems.
  6486. Return Value
  6487. ------------
  6488. -1 on error, else zero.
  6489. File: libc.inf,  Node: __dpmi_simulate_real_mode_interrupt,  Next: __dpmi_simulate_real_mode_procedure_iret,  Prev: __dpmi_set_segment_limit,  Up: Alphabetical List
  6490. __dpmi_simulate_real_mode_interrupt
  6491. ===================================
  6492. Syntax
  6493. ------
  6494.      #include <dpmi.h>
  6495.      
  6496.      int __dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);
  6497. Description
  6498. -----------
  6499. Please refer to *Note DPMI Specification:: for details on DPMI function
  6500. call operation.  Also see *Note DPMI Overview:: for general information.
  6501. DPMI function AX = 0x0300
  6502. This function performs a software interrupt in real mode after filling
  6503. in *all* the registers from the given structure.  You *must* set %ss,
  6504. %esp, and %eflags to valid real-mode values or zero, unlike *Note
  6505. __dpmi_int::.
  6506. Return Value
  6507. ------------
  6508. -1 on error, else zero.
  6509. File: libc.inf,  Node: __dpmi_simulate_real_mode_procedure_iret,  Next: __dpmi_simulate_real_mode_procedure_retf,  Prev: __dpmi_simulate_real_mode_interrupt,  Up: Alphabetical List
  6510. __dpmi_simulate_real_mode_procedure_iret
  6511. ========================================
  6512. Syntax
  6513. ------
  6514.      #include <dpmi.h>
  6515.      
  6516.      int __dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);
  6517. Description
  6518. -----------
  6519. Please refer to *Note DPMI Specification:: for details on DPMI function
  6520. call operation.  Also see *Note DPMI Overview:: for general information.
  6521. DPMI function AX = 0x0303
  6522. This function switches to real mode, filling in *all* the registers
  6523. from the structure.  ss:sp and flags must be valid or zero.  The called
  6524. function must return with an `iret'.
  6525. Return Value
  6526. ------------
  6527. -1 on error, else zero.
  6528. File: libc.inf,  Node: __dpmi_simulate_real_mode_procedure_retf,  Next: __dpmi_simulate_real_mode_procedure_retf_stack,  Prev: __dpmi_simulate_real_mode_procedure_iret,  Up: Alphabetical List
  6529. __dpmi_simulate_real_mode_procedure_retf
  6530. ========================================
  6531. Syntax
  6532. ------
  6533.      #include <dpmi.h>
  6534.      
  6535.      int __dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);
  6536. Description
  6537. -----------
  6538. Please refer to *Note DPMI Specification:: for details on DPMI function
  6539. call operation.  Also see *Note DPMI Overview:: for general information.
  6540. DPMI function AX = 0x0301
  6541. This function switches to real mode with *all* the registers set from
  6542. the structure, including cs:ip.  The function called should return with
  6543. a `retf'.  ss:sp and flags must be set to valid values or zero.
  6544. Return Value
  6545. ------------
  6546. -1 on error, else zero.
  6547. File: libc.inf,  Node: __dpmi_simulate_real_mode_procedure_retf_stack,  Next: __dpmi_terminate_and_stay_resident,  Prev: __dpmi_simulate_real_mode_procedure_retf,  Up: Alphabetical List
  6548. __dpmi_simulate_real_mode_procedure_retf_stack
  6549. ==============================================
  6550. Syntax
  6551. ------
  6552.      #include <dpmi.h>
  6553.      
  6554.      int    __dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_bytes_to_copy, const void *stack_bytes);
  6555. Description
  6556. -----------
  6557. Please refer to *Note DPMI Specification:: for details on DPMI function
  6558. call operation.  Also see *Note DPMI Overview:: for general information.
  6559. DPMI function AX = 0x0301
  6560. This function switches to real mode with *all* the registers set from
  6561. the structure, including cs:ip.  The function called should return with
  6562. a `retf'.  ss:sp and flags must be set to valid values or zero.
  6563. You may optionally specify bytes to be copied to the real mode stack,
  6564. to pass arguments to real-mode procedures with stack-based calling
  6565. conventions.  If you don't want to copy bytes to the real mode stack,
  6566. pass 0 for stack_bytes_to_copy, and NULL for stack_bytes.
  6567. Return Value
  6568. ------------
  6569. -1 on error, else zero.
  6570. File: libc.inf,  Node: __dpmi_terminate_and_stay_resident,  Next: __dpmi_unlock_linear_region,  Prev: __dpmi_simulate_real_mode_procedure_retf_stack,  Up: Alphabetical List
  6571. __dpmi_terminate_and_stay_resident
  6572. ==================================
  6573. Syntax
  6574. ------
  6575.      #include <dpmi.h>
  6576.      
  6577.      int __dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);
  6578. Description
  6579. -----------
  6580. Please refer to *Note DPMI Specification:: for details on DPMI function
  6581. call operation.  Also see *Note DPMI Overview:: for general information.
  6582. DPMI function AX = 0x0c01 (DPMI 1.0 only)
  6583. See the spec.
  6584. Return Value
  6585. ------------
  6586. This call does not return.
  6587. File: libc.inf,  Node: __dpmi_unlock_linear_region,  Next: __dpmi_yield,  Prev: __dpmi_terminate_and_stay_resident,  Up: Alphabetical List
  6588. __dpmi_unlock_linear_region
  6589. ===========================
  6590. Syntax
  6591. ------
  6592.      #include <dpmi.h>
  6593.      
  6594.      int __dpmi_unlock_linear_region(__dpmi_meminfo *_info);
  6595. Description
  6596. -----------
  6597. Please refer to *Note DPMI Specification:: for details on DPMI function
  6598. call operation.  Also see *Note DPMI Overview:: for general information.
  6599. DPMI function AX = 0x0601
  6600. This function unlocks virtual memory.  Pass address and size (in bytes).
  6601. Return Value
  6602. ------------
  6603. -1 on error, else zero.
  6604. File: libc.inf,  Node: __dpmi_yield,  Next: dup,  Prev: __dpmi_unlock_linear_region,  Up: Alphabetical List
  6605. __dpmi_yield
  6606. ============
  6607. Syntax
  6608. ------
  6609.      #include <dpmi.h>
  6610.      
  6611.      int __dpmi_yield(void);
  6612. Description
  6613. -----------
  6614. Please refer to *Note DPMI Specification:: for details on DPMI function
  6615. call operation.  Also see *Note DPMI Overview:: for general information.
  6616. INT 0x2f, AX = 0x1680
  6617. This function yields the CPU to the next process.  This should be
  6618. called in busy-wait loops.
  6619. Return Value
  6620. ------------
  6621. None.
  6622. File: libc.inf,  Node: dup,  Next: dup2,  Prev: __dpmi_yield,  Up: Alphabetical List
  6623. Syntax
  6624. ------
  6625.      #include <unistd.h>
  6626.      
  6627.      int dup(int old_handle);
  6628. Description
  6629. -----------
  6630. This function duplicates the given file handle.  Both handles refer to
  6631. the same file and file pointer.
  6632. Return Value
  6633. ------------
  6634. The new file handle, or -1 if error.
  6635. Example
  6636. -------
  6637.      do_file(dup(fileno(stdin)));
  6638. File: libc.inf,  Node: dup2,  Next: _dxe_load,  Prev: dup,  Up: Alphabetical List
  6639. Syntax
  6640. ------
  6641.      #include <unistd.h>
  6642.      
  6643.      int dup2(int existing_handle, int new_handle);
  6644. Description
  6645. -----------
  6646. This call causes NEW_HANDLE to refer to the same file and file pointer
  6647. as EXISTING_HANDLE.  If NEW_HANDLE is an open file, it is closed.
  6648. Return Value
  6649. ------------
  6650. The new handle, or -1 on error.
  6651. Example
  6652. -------
  6653.      /* copy new file to stdin stream */
  6654.      close(0);
  6655.      dup2(new_stdin, 0);
  6656.      close(new_stdin);
  6657. File: libc.inf,  Node: _dxe_load,  Next: enable,  Prev: dup2,  Up: Alphabetical List
  6658. _dxe_load
  6659. =========
  6660. Syntax
  6661. ------
  6662.      #include <sys/dxe.h>
  6663.      
  6664.      void *_dxe_load(char *dxe_filename);
  6665.      
  6666.        static int (*add)(int a, int b);
  6667.      
  6668.        add = _dxe_load("add.dxe");
  6669.        if (add == 0)
  6670.          printf("Cannot load add.dxe\n");
  6671.        else
  6672.          printf("Okay, 3 + 4 = %d\n", add(3,4));
  6673. Description
  6674. -----------
  6675. This function loads a dynamic executable image into memory and returns
  6676. the entry point for the symbol associated with the image.  The symbol
  6677. may point to a structure or a function.
  6678. Return Value
  6679. ------------
  6680. 0 on failure, the address of the loaded symbol on success.
  6681. File: libc.inf,  Node: enable,  Next: endgrent,  Prev: _dxe_load,  Up: Alphabetical List
  6682. enable
  6683. ======
  6684. Syntax
  6685. ------
  6686.      #include <dos.h>
  6687.      
  6688.      int enable(void);
  6689. Description
  6690. -----------
  6691. This function enables interrupts.
  6692. *Note disable::.
  6693. Return Value
  6694. ------------
  6695. Returns nonzero if the interrupts were already enabled, zero if they
  6696. had been disabled before this call.
  6697. Example
  6698. -------
  6699.      int ints_were_enabled;
  6700.      
  6701.      ints_were_enabled = enable();
  6702.      . . . do some stuff . . .
  6703.      if (!ints_were_enabled)
  6704.        disable();
  6705. File: libc.inf,  Node: endgrent,  Next: endmntent,  Prev: enable,  Up: Alphabetical List
  6706. endgrent
  6707. ========
  6708. Syntax
  6709. ------
  6710.      #include <grp.h>
  6711.      
  6712.      void endgrent(void);
  6713. Description
  6714. -----------
  6715. This function should be called after all calls to `getgrent',
  6716. `getgrgid', or `getgrnam'.
  6717. Return Value
  6718. ------------
  6719. None.
  6720. Example
  6721. -------
  6722. *Note getgrent::.
  6723. File: libc.inf,  Node: endmntent,  Next: endpwent,  Prev: endgrent,  Up: Alphabetical List
  6724. endmntent
  6725. =========
  6726. Syntax
  6727. ------
  6728.      #include <mntent.h>
  6729.      
  6730.      int endmntent(FILE *filep);
  6731. Description
  6732. -----------
  6733. This function should be called after the last call to getmntent (*note
  6734. getmntent::.).
  6735. Return Value
  6736. ------------
  6737. This function always returns one.
  6738. File: libc.inf,  Node: endpwent,  Next: errno,  Prev: endmntent,  Up: Alphabetical List
  6739. endpwent
  6740. ========
  6741. Syntax
  6742. ------
  6743.      #include <pwd.h>
  6744.      
  6745.      void endpwent(void);
  6746. Description
  6747. -----------
  6748. This function should be called after the last call to getpwent (*note
  6749. getpwent::.).
  6750. Return Value
  6751. ------------
  6752. None.
  6753. File: libc.inf,  Node: errno,  Next: exec*,  Prev: endpwent,  Up: Alphabetical List
  6754. errno
  6755. =====
  6756. Syntax
  6757. ------
  6758.      #include <errno.h>
  6759.      
  6760.      extern int errno;
  6761. Description
  6762. -----------
  6763. This variable is used to hold the value of the error of the last
  6764. function call.  The value might be one of the following:
  6765.      No Error
  6766.      EDOM - Input to function out of range
  6767.      ERANGE - Output of function out of range
  6768.      E2BIG - Argument list too long
  6769.      EACCES - Permission denied
  6770.      EAGAIN - Resource temporarily unavailable
  6771.      EBADF - Bad file descriptor
  6772.      EBUSY - Resource busy
  6773.      ECHILD - No child processes
  6774.      EDEADLK - Resource deadlock avoided
  6775.      EEXIST - File exists
  6776.      EFAULT - Bad address
  6777.      EFBIG - File too large
  6778.      EINTR - Interrupted system call
  6779.      EINVAL - Invalid argument
  6780.      EIO - Input or output
  6781.      EISDIR - Is a directory
  6782.      EMFILE - Too many open files
  6783.      EMLINK - Too many links
  6784.      ENAMETOOLONG - File name too long
  6785.      ENFILE - Too many open files in system
  6786.      ENODEV - No such device
  6787.      ENOENT - No such file or directory
  6788.      ENOEXEC - Unable to execute file
  6789.      ENOLCK - No locks available
  6790.      ENOMEM - Not enough memory
  6791.      ENOSPC - No space left on drive
  6792.      ENOSYS - Function not implemented
  6793.      ENOTDIR - Not a directory
  6794.      ENOTEMPTY - Directory not empty
  6795.      ENOTTY - Inappropriate I/O control operation
  6796.      ENXIO - No such device or address
  6797.      EPERM - Operation not permitted
  6798.      EPIPE - Broken pipe
  6799.      EROFS - Read-only file system
  6800.      ESPIPE - Invalid seek
  6801.      ESRCH - No such process
  6802.      EXDEV - Improper link
  6803.      ENMFILE - No more files
  6804. *Note perror::.
  6805. File: libc.inf,  Node: exec*,  Next: __exit,  Prev: errno,  Up: Alphabetical List
  6806. exec*
  6807. =====
  6808. Syntax
  6809. ------
  6810.      #include <unistd.h>
  6811.      
  6812.      int execl(const char *path, const char *argv0, ...);
  6813.      int execle(const char *path, const char *argv0, ... /*, char *const envp[] */);
  6814.      int execlp(const char *path, const char *argv0, ...);
  6815.      int execlpe(const char *path, const char *argv0, ... /*, char *const envp[] */);
  6816.      
  6817.      int execv(const char *path, char *const argv[]);
  6818.      int execve(const char *path, char *const argv[], char *const envp[]);
  6819.      int execvp(const char *path, char *const argv[]);
  6820.      int execvpe(const char *path, char *const argv[], char *const envp[]);
  6821. Description
  6822. -----------
  6823. These functions operate by calling `spawn*' with a type of `P_OVERLAY'.
  6824. Refer to *Note spawn*:: for a full description.
  6825. Return Value
  6826. ------------
  6827. If successful, these functions do not return.  If there is an error,
  6828. these functions return -1 and set `errno' to indicate the error.
  6829. Example
  6830. -------
  6831.      execlp("gcc", "gcc", "-v", "hello.c", 0);
  6832. File: libc.inf,  Node: __exit,  Next: _exit,  Prev: exec*,  Up: Alphabetical List
  6833. __exit
  6834. ======
  6835. Syntax
  6836. ------
  6837.      #include <stdlib.h>
  6838.      
  6839.      void __exit(int exit_code);
  6840. Description
  6841. -----------
  6842. This is an internal library function which exits the program, returning
  6843. EXIT_CODE to the calling process.  No additional processing is done,
  6844. and any `atexit' functions are not called.  Since hardware interrupts
  6845. are not unhooked, this can cause crashes after the program exits. This
  6846. function is normally called only by `_exit'; do *not* call it directly.
  6847. Return Value
  6848. ------------
  6849. This function does not return.
  6850. File: libc.inf,  Node: _exit,  Next: exit,  Prev: __exit,  Up: Alphabetical List
  6851. _exit
  6852. =====
  6853. Syntax
  6854. ------
  6855.      #include <stdlib.h>
  6856.      
  6857.      void _exit(int exit_code);
  6858. Description
  6859. -----------
  6860. This function exits the program, returning EXIT_CODE to the calling
  6861. process.  No additional processing (such as closing file descriptors or
  6862. calls to the static destructor functions) is done, and any `atexit'
  6863. functions are not called; only the hardware interrupt handlers are
  6864. unhooked, to prevent system crashes e.g. after a call to `abort'.  This
  6865. function is normally called only by `exit' and `abort'.
  6866. Return Value
  6867. ------------
  6868. This function does not return.
  6869. File: libc.inf,  Node: exit,  Next: exp,  Prev: _exit,  Up: Alphabetical List
  6870. Syntax
  6871. ------
  6872.      #include <stdlib.h>
  6873.      
  6874.      void exit(int exit_code);
  6875. Description
  6876. -----------
  6877. This function exits the program, returning EXIT_CODE to the calling
  6878. process.  Before exiting, all open files are closed and all `atexit'
  6879. and `on_exit' requests are processed.
  6880. Return Value
  6881. ------------
  6882. This function does not return.
  6883. Example
  6884. -------
  6885.      if (argc < 4)
  6886.      {
  6887.        print_usage();
  6888.        exit(1);
  6889.      }
  6890. File: libc.inf,  Node: exp,  Next: fabs,  Prev: exit,  Up: Alphabetical List
  6891. Syntax
  6892. ------
  6893.      #include <math.h>
  6894.      
  6895.      double exp(double x);
  6896. Return Value
  6897. ------------
  6898. e to the X power.
  6899. File: libc.inf,  Node: fabs,  Next: _far*,  Prev: exp,  Up: Alphabetical List
  6900. Syntax
  6901. ------
  6902.      #include <math.h>
  6903.      
  6904.      double fabs(double x);
  6905. Return Value
  6906. ------------
  6907. X if X is positive, else -X.  Note that in this context, +0.0 is
  6908. positive and -0.0 is negative.
  6909. File: libc.inf,  Node: _far*,  Next: fclose,  Prev: fabs,  Up: Alphabetical List
  6910. _far*
  6911. =====
  6912. Syntax
  6913. ------
  6914.      #include <sys/farptr.h>
  6915.      
  6916.      unsigned char _farpeekb(unsigned short selector, unsigned long offset);
  6917.      unsigned short _farpeekw(unsigned short selector, unsigned long offset);
  6918.      unsigned long _farpeekl(unsigned short selector, unsigned long offset);
  6919.      
  6920.      void _farpokeb(unsigned short sel, unsigned long off, unsigned char val);
  6921.      void _farpokew(unsigned short sel, unsigned long off, unsigned short val);
  6922.      void _farpokel(unsigned short sel, unsigned long off, unsigned long val);
  6923.      
  6924.      void _farsetsel(unsigned short selector);
  6925.      unsigned short _fargetsel(void);
  6926.      
  6927.      void _farnspokeb(unsigned long offset, unsigned char value);
  6928.      void _farnspokew(unsigned long offset, unsigned short value);
  6929.      void _farnspokel(unsigned long offset, unsigned long value);
  6930.      
  6931.      unsigned char _farnspeekb(unsigned long offset);
  6932.      unsigned short _farnspeekw(unsigned long offset);
  6933.      unsigned long _farnspeekl(unsigned long offset);
  6934. Description
  6935. -----------
  6936. These functions provide the equivalent functionality of "far pointers"
  6937. to peek or poke an absolute memory addresses, even though gcc doesn't
  6938. understand the keyword "far".  They come in handy when you need to
  6939. access memory-mapped devices (like VGA) or some address in lower memory
  6940. returned by a real-mode service.  These functions are provided as
  6941. inline assembler functions, so when you optimize your program they
  6942. reduce to only a few opcodes (only one more than a regular memory
  6943. access), resulting in very optimal code.
  6944. The first two groups of functions take a SELECTOR and an OFFSET.  This
  6945. selector is *not* a dos segment.  If you want to access dos memory,
  6946. pass _go32_info_block.selector_for_linear_memory (or just _dos_ds) as
  6947. the selector, and seg*16+ofs as the offset.  For functions which poke
  6948. the memory, you should also provide the VALUE to put there.
  6949. The last two groups assume that you've used `_farsetsel' to specify the
  6950. selector.  You should avoid making any function calls between
  6951. `_farsetsel' and using these other functions, unless you're absolutely
  6952. sure that they won't modify that selector.  This allows you to optimize
  6953. loops by setting the selector once outside the loop, and using the
  6954. shorter functions within the loop.  You can use `_fargetsel' if you
  6955. want to temporary change the selector with `_farsetsel' and restore it
  6956. afterwards.
  6957. Return Value
  6958. ------------
  6959. Functions which peek the address return the value at given address.
  6960. `_fargetsel' returns the current selector.
  6961. File: libc.inf,  Node: fclose,  Next: fcntl,  Prev: _far*,  Up: Alphabetical List
  6962. fclose
  6963. ======
  6964. Syntax
  6965. ------
  6966.      #include <stdio.h>
  6967.      
  6968.      int fclose(FILE *file);
  6969. Description
  6970. -----------
  6971. This function closes the given FILE.
  6972. Return Value
  6973. ------------
  6974. Zero on success, else `EOF'.
  6975. Example
  6976. -------
  6977.      FILE *f = fopen("data", "r");
  6978.      fprintf(f, "Hello\n");
  6979.      fclose(f);
  6980. File: libc.inf,  Node: fcntl,  Next: fdopen,  Prev: fclose,  Up: Alphabetical List
  6981. fcntl
  6982. =====
  6983. Syntax
  6984. ------
  6985.      #include <fcntl.h>
  6986.      
  6987.      int fcntl (int fd, int cmd, ...);
  6988. Description
  6989. -----------
  6990. This function performs the operation specified by CMD on FD.  Note that
  6991. it only supports `F_DUPFD' which acts like `dup(fd)' (*note dup::.) but
  6992. searches empty descriptor from additional argument.
  6993. Return Value
  6994. ------------
  6995. If invalid CMD or FD was passed, it returns -1.  In case F_DUPFD, it
  6996. returns new descriptor or -1 for error.
  6997. File: libc.inf,  Node: fdopen,  Next: feof,  Prev: fcntl,  Up: Alphabetical List
  6998. fdopen
  6999. ======
  7000. Syntax
  7001. ------
  7002.      #include <stdio.h>
  7003.      
  7004.      FILE *fdopen(int fd, const char *mode);
  7005. Description
  7006. -----------
  7007. This function opens a stream-type file that uses the given FD file,
  7008. which must already be open.  The file is opened with the modes
  7009. specified by MODE, which is the same as for `fopen'.  *Note fopen::.
  7010. Return Value
  7011. ------------
  7012. The newly created `FILE *', or `NULL' on error.
  7013. Example
  7014. -------
  7015.      FILE *stdprn = fdopen(4, "w");
  7016. File: libc.inf,  Node: feof,  Next: ferror,  Prev: fdopen,  Up: Alphabetical List
  7017. Syntax
  7018. ------
  7019.      #include <stdio.h>
  7020.      
  7021.      int feof(FILE *file);
  7022. Description
  7023. -----------
  7024. This function can be used to indicate if the given FILE is at the
  7025. end-of-file or not.
  7026. Return Value
  7027. ------------
  7028. Nonzero at end-of-file, zero otherwise.
  7029. Example
  7030. -------
  7031.      while (!feof(stdin))
  7032.        gets(line);
  7033. File: libc.inf,  Node: ferror,  Next: fflush,  Prev: feof,  Up: Alphabetical List
  7034. ferror
  7035. ======
  7036. Syntax
  7037. ------
  7038.      #include <stdio.h>
  7039.      
  7040.      int ferror(FILE *file);
  7041. Description
  7042. -----------
  7043. This function can be used to indicate if the given FILE has encountered
  7044. an error or not.  *Note clearerr::.
  7045. Return Value
  7046. ------------
  7047. Nonzero for an error, zero otherwize.
  7048. Example
  7049. -------
  7050.      if (ferror(stdin))
  7051.        exit(1);
  7052. File: libc.inf,  Node: fflush,  Next: ffs,  Prev: ferror,  Up: Alphabetical List
  7053. fflush
  7054. ======
  7055. Syntax
  7056. ------
  7057.      #include <stdio.h>
  7058.      
  7059.      int fflush(FILE *file);
  7060. Description
  7061. -----------
  7062. This function causes any unwritten buffered data to be written out to
  7063. the given FILE.  This is useful in cases where the output is line
  7064. buffered and you want to write a partial line.
  7065. Return Value
  7066. ------------
  7067. Zero on success, -1 on error.
  7068. Example
  7069. -------
  7070.      printf("Enter value : ");
  7071.      fflush(stdout);
  7072.      scanf(result);
  7073. File: libc.inf,  Node: ffs,  Next: fgetc,  Prev: fflush,  Up: Alphabetical List
  7074. Syntax
  7075. ------
  7076.      #include <string.h>
  7077.      
  7078.      int ffs(int _mask);
  7079. Description
  7080. -----------
  7081. This function find the first (least significant) bit set in the input
  7082. value.
  7083. Return Value
  7084. ------------
  7085. Bit position (1..32) of the least significant set bit, or zero if the
  7086. input value is zero.
  7087. Example
  7088. -------
  7089.      ffs(0) = 0
  7090.      ffs(1) = 1
  7091.      ffs(5) = 1
  7092.      ffs(96) = 6
  7093. File: libc.inf,  Node: fgetc,  Next: fgetgrent,  Prev: ffs,  Up: Alphabetical List
  7094. fgetc
  7095. =====
  7096. Syntax
  7097. ------
  7098.      #include <stdio.h>
  7099.      
  7100.      int fgetc(FILE *file);
  7101. Description
  7102. -----------
  7103. Returns the next character in the given FILE as an unsigned char.
  7104. Return Value
  7105. ------------
  7106. The given char (value 0..255) or `EOF' at end-of-file.
  7107. Example
  7108. -------
  7109.      int c;
  7110.      while((c=fgetc(stdin)) != EOF)
  7111.        fputc(c, stdout);
  7112. File: libc.inf,  Node: fgetgrent,  Next: fgetpos,  Prev: fgetc,  Up: Alphabetical List
  7113. fgetgrent
  7114. =========
  7115. Syntax
  7116. ------
  7117.      #include <grp.h>
  7118.      
  7119.      struct group *fgetgrent(FILE *file);
  7120. Description
  7121. -----------
  7122. This function, in MS-DOS, is exactly the same as `getgrent' (*note
  7123. getgrent::.).
  7124. File: libc.inf,  Node: fgetpos,  Next: fgets,  Prev: fgetgrent,  Up: Alphabetical List
  7125. fgetpos
  7126. =======
  7127. Syntax
  7128. ------
  7129.      #include <stdio.h>
  7130.      
  7131.      int fgetpos(FILE *file, fpos_t *offset);
  7132. Description
  7133. -----------
  7134. This function records the current file pointer for FILE, for later use
  7135. by `fsetpos'.
  7136. *Note fsetpos::.  *Note ftell::.
  7137. Return Value
  7138. ------------
  7139. Zero if successful, nonzero if not.
  7140. File: libc.inf,  Node: fgets,  Next: File System Extensions,  Prev: fgetpos,  Up: Alphabetical List
  7141. fgets
  7142. =====
  7143. Syntax
  7144. ------
  7145.      #include <stdio.h>
  7146.      
  7147.      char *fgets(char *buffer, int maxlength, FILE *file);
  7148. Description
  7149. -----------
  7150. This function reads as much of a line from a file as possible, stopping
  7151. when the buffer is full (MAXLENGTH-1 characters), an end-of-line is
  7152. detected, or `EOF' or an error is detected.  It then stores a `NULL' to
  7153. terminate the string.
  7154. Return Value
  7155. ------------
  7156. The address of the buffer is returned on success, if `EOF' is
  7157. encountered before any characters are stored, or if an error is
  7158. detected, `NULL' is returned instead.
  7159. Example
  7160. -------
  7161.      char buf[100];
  7162.      while (fgets(buf, 100, stdin))
  7163.        fputs(buf, stdout);
  7164. File: libc.inf,  Node: File System Extensions,  Next: __file_exists,  Prev: fgets,  Up: Alphabetical List
  7165. File System Extensions
  7166. ======================
  7167. Description
  7168. -----------
  7169. The File System Extensions are a part of the lowest level of I/O
  7170. operations in the C runtime library of DJGPP.  These extensions are
  7171. provided to allow for cases where Unix uses a file descriptor to access
  7172. such items as serial ports, memory, and the network, but DOS does not.
  7173. It allows a set of functions (called an extension) to gain control when
  7174. one of these low-level functions is called on a file descriptor set up
  7175. by the extension.
  7176. Each extension must provide one or two handler functions.  All handler
  7177. functions take the same arguments:
  7178.        int function(__FSEXT_Fnumber func_number, int *rv, va_list args);
  7179. The FUNC_NUMBER identifies which function is to be emulated.  The file
  7180. `<sys/fsext.h>' defines the function numbers as follows:
  7181. `__FSEXT_nop'
  7182.      A no-op.  This is currently unused by the library functions.
  7183. `__FSEXT_open'
  7184.      An open handler.  This is called just before the library is about
  7185.      to issue the DOS OpenFile call on behalf of your program.
  7186. `__FSEXT_creat'
  7187.      A create handler.  Called when a file needs to be created.  Note
  7188.      that the handler should both create the "file" and open it.
  7189. `__FSEXT_read'
  7190.      A read handler.  Called when data should be read from a "file".
  7191. `__FSEXT_write'
  7192.      A write handler.  Called to write data to a "file".
  7193. `__FSEXT_read'
  7194.      A ready handler.  It is called by `select' library function (*note
  7195.      select::.) when it needs to know whether a handle used to
  7196.      reference the "file" is ready for reading or writing, or has an
  7197.      error condition set.  The handler should return an OR'ed bit mask
  7198.      of the following bits (defined on `<sys/fsext.h>'):
  7199.     `__FSEXT_ready_read'
  7200.           The "file" is ready for reading.
  7201.     `__FSEXT_ready_write'
  7202.           The "file" is ready for writing.
  7203.     `__FSEXT_ready_error'
  7204.           The "file" has an error condition set.
  7205. `__FSEXT_close'
  7206.      A close handler.  Called when the "file" should be closed.
  7207. RV points to a temporary return value pointer.  If the function is
  7208. emulated by the handler, the return value should be stored here, and the
  7209. handler should return a nonzero value.  If the handler returns zero, it
  7210. is assumed to have not emulated the call, and the regular DOS I/O
  7211. function will happen.  The ARGS represent the arguments passed to the
  7212. original function; these point to the actual arguments on the stack, so
  7213. the emulation may choose to modify them and return zero to the regular
  7214. function, which will then act on the modified arguments.
  7215. A normal extension would provide these parts:
  7216.    *  Some function to create a connection to the extension.  This may
  7217.      be a custom function (such as `socket' for networking) or an
  7218.      extension to open (such as for `/dev/null' emulation).
  7219.    *  Initialization code that adds the open handler, if any.
  7220.    *  Overrides for the basic I/O functions, such as `read' and
  7221.      `write'.  This is a single function in the extension that uses the
  7222.      function number parameter to select an extension function.
  7223.    *  The core functionality of the extension, if any.
  7224. File: libc.inf,  Node: __file_exists,  Next: file_tree_walk,  Prev: File System Extensions,  Up: Alphabetical List
  7225. __file_exists
  7226. =============
  7227. Syntax
  7228. ------
  7229.      #include <unistd.h>
  7230.      
  7231.      int __file_exists(const char *_fn);
  7232. Description
  7233. -----------
  7234. This function provides a fast way to ask if a given file exists.
  7235. Unlike access(), this function does not cause other objects to get
  7236. linked in with your program, so is used primarily by the startup code
  7237. to keep minimum code size small.
  7238. Return Value
  7239. ------------
  7240. Zero if the file does not exist, nonzero if it does.  Note that this is
  7241. the opposite of what access() returns.
  7242. Example
  7243. -------
  7244.      if (__file_exists(fname))
  7245.        process_file(fname);
  7246. File: libc.inf,  Node: file_tree_walk,  Next: filelength,  Prev: __file_exists,  Up: Alphabetical List
  7247. file_tree_walk
  7248. ==============
  7249. Syntax
  7250. ------
  7251.      #include <dir.h>
  7252.      
  7253.      int __file_tree_walk(const char *dir,
  7254.                         int (*func)(const char *path, const struct ffblk *ff));
  7255. Description
  7256. -----------
  7257. This function recursively descends the directory hierarchy which starts
  7258. with DIR.  For each file in the hierarchy, `__file_tree_walk' calls the
  7259. user-defined function FUNC which is passed a pointer to a
  7260. `NULL'-terminated character array in PATH holding the full pathname of
  7261. the file, a pointer to a `ffblk' structure (*note findfirst::.) FFF
  7262. with a DOS filesystem information about that file.
  7263. This function always visits a directory before any of its siblings.  The
  7264. argument DIR must be a directory, or `__file_tree_walk' will fail and
  7265. set ERRNO to `ENOTDIR'.  The directory DIR itself is never passed to
  7266. FUNC.
  7267. The tree traversal continues until one of the following events:
  7268. (1)  The tree is exhausted (i.e., all descendants of DIR are
  7269. processed).  In this case, `__file_tree_walk' returns 0, meaning a
  7270. success.
  7271. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  7272. `__file_tree_walk' stops the tree traversal and returns whatever FUNC
  7273. returned.
  7274. (3)  An error is detected within `__file_tree_walk'.  In that case,
  7275. `ftw' returns -1 and sets ERRNO (*note errno::.) to a suitable value.
  7276. Return Value
  7277. ------------
  7278. Zero in case the entire tree was successfully traversed, -1 if
  7279. `__file_tree_walk' detected some error during its operation, or any
  7280. other non-zero value which was returned by the user-defined function
  7281. FUNC.
  7282. Example
  7283. -------
  7284.      #include <stdlib.h>
  7285.      
  7286.      int
  7287.      ff_walker(const char *path, const struct ffblk *ff)
  7288.      {
  7289.        printf("%s:\t%lu\t", path, ff->ff_fsize);
  7290.        if (ff->ff_attrib & 1)
  7291.          printf("R");
  7292.        if (ff->ff_attrib & 2)
  7293.          printf("H");
  7294.        if (ff->ff_attrib & 4)
  7295.          printf("S");
  7296.        if (ff->ff_attrib & 8)
  7297.          printf("V");
  7298.        if (ff->ff_attrib & 0x10)
  7299.          printf("D");
  7300.        if (ff->ff_attrib & 0x20)
  7301.          printf("A");
  7302.        printf("\n");
  7303.      
  7304.        if (strcmp(ff->ff_name, "XXXXX") == 0)
  7305.          return 42;
  7306.        return 0;
  7307.      }
  7308.      
  7309.      int
  7310.      main(int argc, char *argv[])
  7311.      {
  7312.        if (argc > 1)
  7313.          {
  7314.            char msg[80];
  7315.      
  7316.            sprintf(msg, "__file_tree_walk: %d",
  7317.                         __file_tree_walk(argv[1], ff_walker));
  7318.            if (errno)
  7319.              perror(msg);
  7320.            else
  7321.              puts(msg);
  7322.          }
  7323.        else
  7324.          printf("Usage: %s dir\n", argv[0]);
  7325.      
  7326.        return 0;
  7327.      }
  7328. File: libc.inf,  Node: filelength,  Next: fileno,  Prev: file_tree_walk,  Up: Alphabetical List
  7329. filelength
  7330. ==========
  7331. Syntax
  7332. ------
  7333.      #include <io.h>
  7334.      
  7335.      long filelength(int fhandle);
  7336. Description
  7337. -----------
  7338. This function returns the size, in bytes, of a file whose handle is
  7339. specified in the argument FHANDLE.  To get the handle of a file opened
  7340. by *Note fopen:: or *Note freopen::, you can use *Note fileno:: macro.
  7341. Return Value
  7342. ------------
  7343. The size of the file in bytes, or (if any error occured) -1L and ERRNO
  7344. set to a value describing the cause of the failure.
  7345. Example
  7346. -------
  7347.        printf("Size of file to which STDIN is redirected is %ld\n",
  7348.                filelength(0));
  7349. File: libc.inf,  Node: fileno,  Next: findfirst,  Prev: filelength,  Up: Alphabetical List
  7350. fileno
  7351. ======
  7352. Syntax
  7353. ------
  7354.      #include <stdio.h>
  7355.      
  7356.      int fileno(FILE *file);
  7357. Description
  7358. -----------
  7359. This function returns the raw file descriptor number that FILE uses for
  7360. Return Value
  7361. ------------
  7362. The file descriptor number.
  7363. File: libc.inf,  Node: findfirst,  Next: findnext,  Prev: fileno,  Up: Alphabetical List
  7364. findfirst
  7365. =========
  7366. Syntax
  7367. ------
  7368.      #include <dir.h>
  7369.      
  7370.      int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
  7371. Description
  7372. -----------
  7373. This function and the related `findnext' (*note findnext::.) are used
  7374. to scan directories for the list of files therein.  The PATHNAME is a
  7375. wildcard that specifies the directory and files to search for (such as
  7376. `subdir/*.c'), FFBLK is a structure to hold the results and state of
  7377. the search, and ATTRIB is a combination of the following:
  7378. `FA_RDONLY'
  7379.      Include read-only files in the search
  7380. `FA_HIDDEN'
  7381.      Include hidden files in the search
  7382. `FA_SYSTEM'
  7383.      Include system files in the search
  7384. `FA_LABEL'
  7385.      Include the volume label in the search
  7386. `FA_DIREC'
  7387.      Include subdirectories in the search
  7388. `FA_ARCH'
  7389.      Include modified files in the search
  7390. Any file that doesn't have any flag bits that aren't specified is
  7391. selected for the search.  Thus, if you specified `FA_DIREC' and
  7392. `FA_LABEL', you would get all subdirectories, the volume label, and any
  7393. file that is neither read-only or modified.
  7394. The results of the search are stored in FFBLK:
  7395.      struct ffblk {
  7396.        char ff_reserved[21];     /* used to hold the state of the search */
  7397.        unsigned char ff_attrib;  /* actual attributes of the file found */
  7398.        unsigned short ff_ftime;  /* hours:5, minutes:6, (seconds/2):5 */
  7399.        unsigned short ff_fdate;  /* (year-1980):7, month:4, day:5 */
  7400.        unsigned long ff_fsize;   /* size of file */
  7401.        char ff_name[16];         /* name of file as ASCIIZ string */
  7402.      }
  7403. Return Value
  7404. ------------
  7405. Zero if a match is found, nonzero if none found.
  7406. Example
  7407. -------
  7408.      struct ffblk f;
  7409.      int done = findfirst("*.exe", &f, FA_ARCH|FA_RDONLY);
  7410.      while (!done)
  7411.      {
  7412.        printf("%10u %2u:%02u:%02u %2u/%02u/%4u %s\n",
  7413.          f.ff_fsize,
  7414.          (f.ff_ftime >> 11) & 0x1f,
  7415.          (f.ff_ftime >>  5) & 0x3f,
  7416.          (f.ff_ftime & 0x1f) * 2,
  7417.          (f.ff_fdate >>  5) & 0x0f,
  7418.          (f.ff_fdate & 0x1f),
  7419.          ((f.ff_fdate >> 9) & 0x7f) + 1980,
  7420.          f.ff_name);
  7421.        done = findnext(&f);
  7422.      }
  7423. File: libc.inf,  Node: findnext,  Next: _fixpath,  Prev: findfirst,  Up: Alphabetical List
  7424. findnext
  7425. ========
  7426. Syntax
  7427. ------
  7428.      #include <dir.h>
  7429.      
  7430.      int findnext(struct ffblk *ffblk);
  7431. Description
  7432. -----------
  7433. This finds the next file in the search started by `findfirst'.  *Note
  7434. findfirst::.
  7435. Return Value
  7436. ------------
  7437. Zero if there was a match, else nonzero.
  7438. File: libc.inf,  Node: _fixpath,  Next: floor,  Prev: findnext,  Up: Alphabetical List
  7439. _fixpath
  7440. ========
  7441. Syntax
  7442. ------
  7443.      #include <sys/stat.h>
  7444.      
  7445.      void _fixpath(const char *in_path, char *out_path);
  7446. Description
  7447. -----------
  7448. This function canonicalizes the input path IN_PATH and stores the
  7449. result in the buffer pointed to by OUT_PATH.
  7450. The path is fixed by removing consecutive and trailing slashes, making
  7451. the path absolute if it's relative, removing "." components, collapsing
  7452. ".." components, adding a drive specifier if needed, and converting all
  7453. slashes to '/'.  DOS-style 8+3 names of directories which are part of
  7454. the pathname, as well as its final filename part, are returned
  7455. lower-cased in OUT_PATH, but long filenames are left intact.  *Note
  7456. _preserve_fncase::, for more details on letter-case conversions in
  7457. filenames.
  7458. Return Value
  7459. ------------
  7460. None.
  7461. Example
  7462. -------
  7463.      char oldpath[100], newpath[100];
  7464.      scanf(oldpath);
  7465.      _fixpath(oldpath, newpath);
  7466.      printf("that really is %s\n", newpath);
  7467. File: libc.inf,  Node: floor,  Next: _flush_disk_cache,  Prev: _fixpath,  Up: Alphabetical List
  7468. floor
  7469. =====
  7470. Syntax
  7471. ------
  7472.      #include <math.h>
  7473.      
  7474.      double floor(double x);
  7475. Return Value
  7476. ------------
  7477. The largest integer value less than or equal to X.
  7478. File: libc.inf,  Node: _flush_disk_cache,  Next: fmod,  Prev: floor,  Up: Alphabetical List
  7479. _flush_disk_cache
  7480. =================
  7481. Syntax
  7482. ------
  7483.      #include <io.h>
  7484.      
  7485.      void _flush_disk_cache (void);
  7486. Description
  7487. -----------
  7488. Attempts to update the disk with the data cached in the write-behind
  7489. disk cache.
  7490. Return Value
  7491. ------------
  7492. None.
  7493. File: libc.inf,  Node: fmod,  Next: _fmode,  Prev: _flush_disk_cache,  Up: Alphabetical List
  7494. Syntax
  7495. ------
  7496.      #include <math.h>
  7497.      
  7498.      double fmod(double x, double y);
  7499. Return Value
  7500. ------------
  7501. The remainder of X/Y.
  7502. File: libc.inf,  Node: _fmode,  Next: fnmatch,  Prev: fmod,  Up: Alphabetical List
  7503. _fmode
  7504. ======
  7505. Syntax
  7506. ------
  7507.      #include <fcntl.h>
  7508.      
  7509.      extern int _fmode;
  7510. Description
  7511. -----------
  7512. This variable may be set to `O_TEXT' or `O_BINARY' to specify the mode
  7513. that newly opened files should be opened in if the open call did not
  7514. specify.  *Note open::. *Note fopen::.
  7515. The default value is `O_TEXT'.
  7516. Example
  7517. -------
  7518.      _fmode = O_BINARY;
  7519. File: libc.inf,  Node: fnmatch,  Next: fnmerge,  Prev: _fmode,  Up: Alphabetical List
  7520. fnmatch
  7521. =======
  7522. Syntax
  7523. ------
  7524.      #include <fnmatch.h>
  7525.      
  7526.      int fnmatch(const char *pattern, const char *string, int flags);
  7527. Description
  7528. -----------
  7529. This function indicates if STRING matches the PATTERN.  The pattern may
  7530. include the following special characters:
  7531.      Matches zero of more characters.
  7532.      Matches exactly one character
  7533. `[...]'
  7534.      Matches one character if it's in a range of characters.  If the
  7535.      first character is `!', matches if the character is not in the
  7536.      range.  Between the brackets, the range is specified by listing
  7537.      the characters that are in the range, or two characters separated
  7538.      by `-' to indicate all characters in that range.  For example,
  7539.      `[a-d]' matches `a', `b', `c', or `d'.
  7540.      Causes the next character to not be treated as a wildcard.  For
  7541.      example, `\*' matches an asterisk.  This is only available if FLAGS
  7542.      includes `FNM_QUOTE'.
  7543. The value of FLAGS is a combination of zero of more of the following:
  7544. `FNM_PATHNAME'
  7545.      This means that the string should be treated as a pathname, in
  7546.      that the slash character `/' never matches any of the wildcards.
  7547. `FNM_QUOTE'
  7548.      This means that the backslash `\\' may be used for quoting special
  7549.      characters in the pattern.
  7550. Return Value
  7551. ------------
  7552. Zero if the string matches, FNM_NOMATCH if it does not.
  7553. Example
  7554. -------
  7555.      if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
  7556.        do_source_file(filename);
  7557. File: libc.inf,  Node: fnmerge,  Next: fnsplit,  Prev: fnmatch,  Up: Alphabetical List
  7558. fnmerge
  7559. =======
  7560. Syntax
  7561. ------
  7562.      #include <dir.h>
  7563.      
  7564.      void fnmerge (char *path, const char *drive, const char *dir,
  7565.              const char *name, const char *ext);
  7566. Description
  7567. -----------
  7568. This function constructs a file PATH from its components DRIVE, DIR,
  7569. NAME, and EXT.  If any of these is a `NULL' pointer, it won't be used.
  7570. Usually, the DRIVE string should include the trailing colon ``:'', the
  7571. DIR string should include the trailing slash ``/'' or backslash ``\'',
  7572. and the EXT string should include the leading dot ``.''.  However, if
  7573. any of these isn't present, `fnmerge' will add them.
  7574. *Note fnsplit::.
  7575. Return Value
  7576. ------------
  7577. None.
  7578. Example
  7579. -------
  7580.      char buf[MAXPATH];
  7581.      fnmerge(buf, "d:", "/foo/", "data", ".txt");
  7582. File: libc.inf,  Node: fnsplit,  Next: fopen,  Prev: fnmerge,  Up: Alphabetical List
  7583. fnsplit
  7584. =======
  7585. Syntax
  7586. ------
  7587.      #include <dir.h>
  7588.      
  7589.      int fnsplit (const char *path, char *drive, char *dir,
  7590.              char *name, char *ext);
  7591. Description
  7592. -----------
  7593. This function decomposes a PATH into its components.  It is smart
  7594. enough to know that `.' and `..' are directories.  The DRIVE, DIR, NAME
  7595. and EXT arguments should all be passed, but some or even all of them
  7596. might be `NULL' pointers.  Those of them which are non-`NULL' should
  7597. point to buffers which have enough room for the strings they would
  7598. hold.  The constants `MAXDRIVE', `MAXDIR', `MAXFILE' and `MAXEXT',
  7599. defined on dir.h, define the maximum length of these buffers.
  7600. *Note fnmerge::.
  7601. Return Value
  7602. ------------
  7603. A flag that indicates which components were found:
  7604. `DRIVE'
  7605.      The drive letter was found.
  7606. `DIRECTORY'
  7607.      A directory or subdirectories was found.
  7608. `FILENAME'
  7609.      A filename was found.
  7610. `EXTENSION'
  7611.      An extension was found.
  7612. `WILDCARDS'
  7613.      The path included `*' or `?'.
  7614. Example
  7615. -------
  7616.      char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  7617.      int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  7618.      d = "d:"
  7619.      p = "/djgpp/bin/"
  7620.      f = "gcc"
  7621.      e = ".exe"
  7622. File: libc.inf,  Node: fopen,  Next: fork,  Prev: fnsplit,  Up: Alphabetical List
  7623. fopen
  7624. =====
  7625. Syntax
  7626. ------
  7627.      #include <stdio.h>
  7628.      FILE *fopen(const char *filename, const char *mode);
  7629. Description
  7630. -----------
  7631. This function opens a stream corresponding to the named FILENAME with
  7632. the given MODE.  The mode can be one of the following:
  7633.      Open an existing file for reading.
  7634.      Create a new file (or truncate an existing file) and open it for
  7635.      writing.
  7636.      Open an existing file (or create a new one) for writing.  The file
  7637.      pointer is positioned to the end of the file before every write.
  7638. Followed by any of these characters:
  7639.      Force the file to be open in binary mode instead of the default
  7640.      mode.
  7641.      When called to open the console in binary mode, `fopen' will
  7642.      disable the generation of `SIGINT' when you press `Ctrl-C'
  7643.      (`Ctrl-Break' will still cause `SIGINT'), because many programs
  7644.      that use binary reads from the console will also want to get the
  7645.      `^C' characters.  You can use the `__djgpp_set_ctrl_c' library
  7646.      function (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to
  7647.      generate interrupts while console is read in binary mode.
  7648.      Force the file to be open in text mode instead of the default mode.
  7649.      Open the file as with `O_RDWR' so that both reads and writes can
  7650.      be done to the same file.
  7651. If the file is open for both reading and writing, you must call
  7652. `fflush', `fseek', or `rewind' before switching from read to write or
  7653. from write to read.
  7654. The open file is set to line buffered if the underlying object is a
  7655. device (stdin, stdout, etc), or is fully buffered if the underlying
  7656. object is a disk file (data.c, etc).
  7657. If `b' or `t' is not specified in MODE, the file type is chosen by the
  7658. value of `fmode' (*note _fmode::.).
  7659. Return Value
  7660. ------------
  7661. A pointer to the `FILE' object, or `NULL' if there was an error.
  7662. Example
  7663. -------
  7664.      FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
  7665. File: libc.inf,  Node: fork,  Next: fpathconf,  Prev: fopen,  Up: Alphabetical List
  7666. Description
  7667. -----------
  7668. This function always returns -1 and sets `errno' to ENOMEM, as MS-DOS
  7669. does not support multiple processes.  It exists only to assist in
  7670. porting Unix programs.
  7671. File: libc.inf,  Node: fpathconf,  Next: _fpreset,  Prev: fork,  Up: Alphabetical List
  7672. fpathconf
  7673. =========
  7674. Syntax
  7675. ------
  7676.      #include <unistd.h>
  7677.      
  7678.      long fpathconf(int fd, int name);
  7679. Description
  7680. -----------
  7681. Returns configuration information on the filesystem that the open file
  7682. resides on.  *Note pathconf::.
  7683. Return Value
  7684. ------------
  7685. The configuration value, which are currently independent of the
  7686. filesystem that the file is on.
  7687. File: libc.inf,  Node: _fpreset,  Next: fprintf,  Prev: fpathconf,  Up: Alphabetical List
  7688. _fpreset
  7689. ========
  7690. Syntax
  7691. ------
  7692.      #include <float.h>
  7693.      
  7694.      void _fpreset(void);
  7695. Description
  7696. -----------
  7697. Resets the FPU completely.
  7698. File: libc.inf,  Node: fprintf,  Next: fpurge,  Prev: _fpreset,  Up: Alphabetical List
  7699. fprintf
  7700. =======
  7701. Syntax
  7702. ------
  7703.      #include <stdio.h>
  7704.      
  7705.      int fprintf(FILE *file, const char *format, ...);
  7706. Description
  7707. -----------
  7708. Prints formatted output to the named file.  *Note printf::.
  7709. Return Value
  7710. ------------
  7711. The number of characters written.
  7712. File: libc.inf,  Node: fpurge,  Next: fputc,  Prev: fprintf,  Up: Alphabetical List
  7713. fpurge
  7714. ======
  7715. Syntax
  7716. ------
  7717.      #include <stdio.h>
  7718.      
  7719.      int fpurge(FILE *file);
  7720. Description
  7721. -----------
  7722. This function purges the buffer for FILE without writing it to disk.
  7723. Return Value
  7724. ------------
  7725. Zero on success, -1 on failure.
  7726. File: libc.inf,  Node: fputc,  Next: fputs,  Prev: fpurge,  Up: Alphabetical List
  7727. fputc
  7728. =====
  7729. Syntax
  7730. ------
  7731.      #include <stdio.h>
  7732.      
  7733.      int fputc(int character, FILE *file);
  7734. Description
  7735. -----------
  7736. This function writes the given CHARACTER to the given `file'.
  7737. Return Value
  7738. ------------
  7739. The given character [0..255] or `EOF'.
  7740. Example
  7741. -------
  7742.      fputc('\n', stdout);
  7743. File: libc.inf,  Node: fputs,  Next: fread,  Prev: fputc,  Up: Alphabetical List
  7744. fputs
  7745. =====
  7746. Syntax
  7747. ------
  7748.      #include <stdio.h>
  7749.      
  7750.      int fputs(const char *string, FILE *file);
  7751. Description
  7752. -----------
  7753. This function all the characters of STRING (except the trailing `NULL')
  7754. to the given FILE.
  7755. Return Value
  7756. ------------
  7757. A nonnegative number on success, `EOF' on error.
  7758. Example
  7759. -------
  7760.      fputs("Hello\n", stdout);
  7761. File: libc.inf,  Node: fread,  Next: free,  Prev: fputs,  Up: Alphabetical List
  7762. fread
  7763. =====
  7764. Syntax
  7765. ------
  7766.      #include <stdio.h>
  7767.      
  7768.      size_t fread(void *buffer, size_t size, size_t number, FILE *file);
  7769. Description
  7770. -----------
  7771. This function reads SIZE*NUMBER characters from FILE to BUFFER.
  7772. Return Value
  7773. ------------
  7774. The number of items of size SIZE read, or -1 on error.
  7775. Example
  7776. -------
  7777.      int foo[10];
  7778.      fread(foo, sizeof(int), 10, stdin);
  7779. File: libc.inf,  Node: free,  Next: freopen,  Prev: fread,  Up: Alphabetical List
  7780. Syntax
  7781. ------
  7782.      #include <stdio.h>
  7783.      
  7784.      void free(void *ptr);
  7785. Description
  7786. -----------
  7787. Returns the allocated memory to the heap (*note malloc::.).  If the PTR
  7788. is `NULL', it does nothing.
  7789. Return Value
  7790. ------------
  7791. None.
  7792. Example
  7793. -------
  7794.      char *q = (char *)malloc(20);
  7795.      free(q);
  7796. File: libc.inf,  Node: freopen,  Next: frexp,  Prev: free,  Up: Alphabetical List
  7797. freopen
  7798. =======
  7799. Syntax
  7800. ------
  7801.      #include <stdio.h>
  7802.      
  7803.      FILE *freopen(const char *filename, const char *mode, FILE *file);
  7804. Description
  7805. -----------
  7806. This function closes FILE if it was open, then opens a new file like
  7807. `fopen(filename, mode)' but it reuses FILE.
  7808. This is useful to, for example, associate `stdout' with a new file.
  7809. Return Value
  7810. ------------
  7811. The new file, or `NULL' on error.
  7812. Example
  7813. -------
  7814.      freopen("/tmp/stdout.dat", "wb", stdout);
  7815. File: libc.inf,  Node: frexp,  Next: fscanf,  Prev: freopen,  Up: Alphabetical List
  7816. frexp
  7817. =====
  7818. Syntax
  7819. ------
  7820.      #include <math.h>
  7821.      
  7822.      double frexp(double x, int *pexp);
  7823. Description
  7824. -----------
  7825. This function separates the given value X into a mantissa [0.5,1) and
  7826. an exponent *PEXP, such that m * 2 ^ e = x.  As an exception, when X is
  7827. zero, *PEXP and the return value are also both zero.
  7828. Return Value
  7829. ------------
  7830. The mantissa.
  7831. File: libc.inf,  Node: fscanf,  Next: fseek,  Prev: frexp,  Up: Alphabetical List
  7832. fscanf
  7833. ======
  7834. Syntax
  7835. ------
  7836.      #include <stdio.h>
  7837.      
  7838.      int fscanf(FILE *file, const char *format, ...);
  7839. Description
  7840. -----------
  7841. This function scans formatted text from FILE and stores it in the
  7842. variables pointed to by the arguments.  *Note scanf::.
  7843. Return Value
  7844. ------------
  7845. The number of items successfully scanned.
  7846. File: libc.inf,  Node: fseek,  Next: fsetpos,  Prev: fscanf,  Up: Alphabetical List
  7847. fseek
  7848. =====
  7849. Syntax
  7850. ------
  7851.      #include <stdio.h>
  7852.      
  7853.      int fseek(FILE *file, long offset, int mode);
  7854. Description
  7855. -----------
  7856. This function moves the file pointer for FILE according to MODE:
  7857. `SEEK_SET'
  7858.      The file pointer is moved to the offset specified.
  7859. `SEEK_CUR'
  7860.      The file pointer is moved relative to its current position.
  7861. `SEEK_END'
  7862.      The file pointer is moved to a position OFFSET bytes from the end
  7863.      of the file.  The offset is usually nonpositive in this case.
  7864. *Warning!* The ANSI standard only allows values of zero for OFFSET when
  7865. WHENCE is not `SEEK_SET' and the file has been opened as a text file.
  7866. Although this restriction is not enforced, beware that there is not a
  7867. one-to-one correspondence between file characters and text characters
  7868. under MS-DOS, so some `fseek' operations may not do exactly what you
  7869. expect.
  7870. Return Value
  7871. ------------
  7872. Zero if successful, nonzero if not.
  7873. Example
  7874. -------
  7875.      fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
  7876. File: libc.inf,  Node: fsetpos,  Next: __FSEXT_add_open_handler,  Prev: fseek,  Up: Alphabetical List
  7877. fsetpos
  7878. =======
  7879. Syntax
  7880. ------
  7881.      #include <stdio.h>
  7882.      
  7883.      int fsetpos(FILE *file, const fpos_t *offset);
  7884. Description
  7885. -----------
  7886. This function moves the file pointer for FILE to position OFFSET, as
  7887. recorded by `fgetpos'.
  7888. *Note fgetpos::.  *Note fseek::.
  7889. Return Value
  7890. ------------
  7891. Zero if successful, nonzero if not.
  7892. File: libc.inf,  Node: __FSEXT_add_open_handler,  Next: __FSEXT_alloc_fd,  Prev: fsetpos,  Up: Alphabetical List
  7893. __FSEXT_add_open_handler
  7894. ========================
  7895. Syntax
  7896. ------
  7897.      #include <sys/fsext.h>
  7898.      
  7899.      int __FSEXT_add_open_handler(__FSEXT_Function *_function);
  7900. Description
  7901. -----------
  7902. This function is part of the *Note File System Extensions::.  It is used
  7903. to add a handler for functions that do not get passed descriptors, such
  7904. as `_open' and `_creat'.
  7905. Example
  7906. -------
  7907.      static int
  7908.      _my_handler(__FSEXT_Fnumber n, int *rv, va_list args)
  7909.      {
  7910.        . . .
  7911.      }
  7912.      
  7913.      int main()
  7914.      {
  7915.        __FSEXT_add_open_handler(_my_handler);
  7916.      }
  7917. File: libc.inf,  Node: __FSEXT_alloc_fd,  Next: __FSEXT_call_open_handlers,  Prev: __FSEXT_add_open_handler,  Up: Alphabetical List
  7918. __FSEXT_alloc_fd
  7919. ================
  7920. Syntax
  7921. ------
  7922.      #include <sys/fsext.h>
  7923.      
  7924.      int __FSEXT_alloc_fd(__FSEXT_Function *_function);
  7925. Description
  7926. -----------
  7927. This function is part of the *Note File System Extensions::.  It is used
  7928. by extensions that fully emulate the I/O functions, and thus don't have
  7929. a corresponding DOS file handle.  This function opens DOS's `NUL'
  7930. device, so as to allocate a handle that DOS won't then reuse.  It also
  7931. assigns the handler function for that descriptor.
  7932. The module is responsible for calling `_close' on the descriptor after
  7933. setting the handler function to zero in the extended close handler.
  7934. Example
  7935. -------
  7936.      int socket()
  7937.      {
  7938.        int fd = __FSEXT_alloc_fd(socket_handler);
  7939.        init_socket(fd);
  7940.        return fd;
  7941.      }
  7942. File: libc.inf,  Node: __FSEXT_call_open_handlers,  Next: __FSEXT_get_function,  Prev: __FSEXT_alloc_fd,  Up: Alphabetical List
  7943. __FSEXT_call_open_handlers
  7944. ==========================
  7945. Syntax
  7946. ------
  7947.      #include <sys/fsext.h>
  7948.      
  7949.      int __FSEXT_call_open_handlers(__FSEXT_Fnumber _function_number,
  7950.                         int *rv, va_list _args);
  7951. Description
  7952. -----------
  7953. This function is part of the *Note File System Extensions::.  It is used
  7954. internally to libc.a to allow extensions to get an opportunity to
  7955. override the `_open' and `_creat' functions.
  7956. File: libc.inf,  Node: __FSEXT_get_function,  Next: __FSEXT_set_function,  Prev: __FSEXT_call_open_handlers,  Up: Alphabetical List
  7957. __FSEXT_get_function
  7958. ====================
  7959. Syntax
  7960. ------
  7961.      #include <sys/fsext.h>
  7962.      
  7963.      __FSEXT_Function *__FSEXT_get_function(int _fd);
  7964. This function is part of the *Note File System Extensions::.  It is used
  7965. internal to libc.a to redirect I/O requests to the appropriate
  7966. extensions.
  7967. Example
  7968. -------
  7969.      _read(int fd, void *buf, int len)
  7970.      {
  7971.        __FSEXT_Function *func = __FSEXT_get_function(fd);
  7972.        if (func)
  7973.        {
  7974.          int rv;
  7975.          if (func(__FSEXT_read, &rv, &fd))
  7976.            return rv;
  7977.        }
  7978.        /* rest of read() */
  7979.      }
  7980. File: libc.inf,  Node: __FSEXT_set_function,  Next: fstat,  Prev: __FSEXT_get_function,  Up: Alphabetical List
  7981. __FSEXT_set_function
  7982. ====================
  7983. Syntax
  7984. ------
  7985.      #include <sys/fsext.h>
  7986.      
  7987.      int __FSEXT_set_function(int _fd, __FSEXT_Function *_function);
  7988. Description
  7989. -----------
  7990. This function is part of the *Note File System Extensions::.  It is used
  7991. to set the handler function for those extensions that use DOS files for
  7992. I/O.  One situation where you might need this is when you must catch
  7993. output to the terminal and play some tricks with it, like colorize it or
  7994. redirect it to another device.
  7995. Return Value
  7996. ------------
  7997. Zero in case of success, non-zero in case of failure (like if _FD is
  7998. negative).
  7999. Example
  8000. -------
  8001.      #include <sys/fsext.h>
  8002.      #include <conio.h>
  8003.      
  8004.      /* A simple example of a write handler which converts DOS I/O to the
  8005.         screen into direct writes to video RAM.  */
  8006.      static int
  8007.      my_screen_write (__FSEXT_Fnumber func, int *retval, va_list rest_args)
  8008.      {
  8009.        char *buf, *mybuf;
  8010.        size_t buflen;
  8011.        int fd = va_arg (rest_args, int);
  8012.      
  8013.        if (func != __FSEXT_write || !isatty (fd))
  8014.          return 0;  /* and the usual DOS call will be issued */
  8015.      
  8016.        buf = va_arg (rest_args, char *);
  8017.        buflen = va_arg (rest_args, size_t);
  8018.        mybuf = alloca (buflen + 1);
  8019.        memcpy (mybuf, buf, buflen);
  8020.        mybuf[buflen] = '\0';
  8021.        cputs (mybuf);
  8022.        *retval = buflen;
  8023.        return 1;  /* meaning that we handled the call */
  8024.      }
  8025.      
  8026.      /* Install our handler.  The `attribute constructor' causes this
  8027.         function to be called by the startup code.  */
  8028.      static void __attribute__((constructor))
  8029.      install_screen_write_handler (void)
  8030.      {
  8031.        __FSEXT_set_function (fileno (stdout), my_screen_write);
  8032.      }
  8033. File: libc.inf,  Node: fstat,  Next: fsync,  Prev: __FSEXT_set_function,  Up: Alphabetical List
  8034. fstat
  8035. =====
  8036. Syntax
  8037. ------
  8038.      #include <sys/stat.h>
  8039.      
  8040.      int fstat(int file, struct stat *sbuf);
  8041. Description
  8042. -----------
  8043. This function obtains the status of the open file FILE and stores it in
  8044. SBUF.  *Note stat:: for the description of `struct stat' fields.
  8045. Return Value
  8046. ------------
  8047. Zero on success, nonzero on failure (and ERRNO set).
  8048. Example
  8049. -------
  8050.      struct stat s;
  8051.      fstat(fileno(stdin), &s);
  8052.      if (S_ISREG(s.st_mode))
  8053.        puts("STDIN is a redirected disk file");
  8054.      else if (S_ISCHR(s.st_mode))
  8055.        puts("STDIN is a character device");
  8056. If a file was open in write-only mode, its execute mode bits might be
  8057. incorrectly reported as if the file were non-executable.  This is
  8058. because some executables are only recognized by reading their first two
  8059. bytes, which cannot be done for files open in write-only mode.
  8060. For `fstat()' to return valid info, you should make sure that all the
  8061. data written to the file has been delivered to the operating system,
  8062. e.g. by calling `fflush()'.  Otherwise, the buffering of the library
  8063. I/O functions might cause stale info to be returned.
  8064. Implementation Notes
  8065. --------------------
  8066. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  8067. implementation nightmare.  The following notes describe some of the
  8068. obscure points specific to their behavior in DJGPP.
  8069. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  8070. is returned as -1.  For drives networked by Novell Netware, it is
  8071. returned as -2.
  8072. 2. The starting cluster number of a file serves as its inode number.
  8073. For files whose starting cluster number is inaccessible (empty files,
  8074. files on networked drives, etc.) the `st_inode' field will be `invented'
  8075. in a way which guarantees that no two different files will get the same
  8076. inode number (thus it is unique).  This invented inode will also be
  8077. different from any real cluster number of any local file.  However, only
  8078. for local, non-empty files/directories the inode is guaranteed to be
  8079. consistent between `stat()' and `fstat()' function calls.
  8080. 3. The WRITE access mode bit is set only for the user (unless the file
  8081. is read-only, hidden or system).  EXECUTE bit is set for directories,
  8082. files which can be executed from the DOS prompt (batch files, .com,
  8083. .dll and .exe executables) or run by go32 extender.  For files which
  8084. reside on networked drives under Novell Netware, this can sometimes
  8085. fail, in which case only the read access bit is set.
  8086. 4. Size of directories is reported as the number of its files (sans `.'
  8087. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  8088. 5. Time stamp for root directories is taken from the volume label entry,
  8089. if that's available; otherwise, it is reported as 1-Jan-1980.
  8090. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  8091. of `struct stat' are needed by the application.
  8092. File: libc.inf,  Node: fsync,  Next: ftell,  Prev: fstat,  Up: Alphabetical List
  8093. fsync
  8094. =====
  8095. Syntax
  8096. ------
  8097.      #include <unistd.h>
  8098.      
  8099.      int fsync(int file);
  8100. Description
  8101. -----------
  8102. Forces all information about the file to be synchronized with the disk
  8103. image.
  8104. Return Value
  8105. ------------
  8106. Zero on success, nonzero on failure.
  8107. Example
  8108. -------
  8109.      fsync(fileno(stdout));
  8110. File: libc.inf,  Node: ftell,  Next: ftime,  Prev: fsync,  Up: Alphabetical List
  8111. ftell
  8112. =====
  8113. Syntax
  8114. ------
  8115.      #include <stdio.h>
  8116.      
  8117.      long ftell(FILE *file);
  8118. Description
  8119. -----------
  8120. Returns the current file position for `file'.  This is suitable for a
  8121. future call to `fseek'.
  8122. Return Value
  8123. ------------
  8124. The file position, or -1 on error.
  8125. Example
  8126. -------
  8127.      long p = ftell(stdout);
  8128. File: libc.inf,  Node: ftime,  Next: ftruncate,  Prev: ftell,  Up: Alphabetical List
  8129. ftime
  8130. =====
  8131. Syntax
  8132. ------
  8133.      #include <sys/timeb.h>
  8134.      
  8135.      int ftime(struct timeb *buf);
  8136. Description
  8137. -----------
  8138. This function stores the current time in the structure BUF.  The format
  8139. of `struct timeb' is:
  8140.      struct timeb {
  8141.        time_t         time;     /* seconds since 00:00:00 GMT 1/1/1970 */
  8142.        unsigned short millitm;  /* milliseconds */
  8143.        short          timezone; /* difference between GMT and local, minutes */
  8144.        short          dstflag;  /* set if daylight savings time in affect */
  8145.      };
  8146. Return Value
  8147. ------------
  8148. Zero on success, nonzero on error.
  8149. Example
  8150. -------
  8151.      struct timeb t;
  8152.      ftime(&t);
  8153. File: libc.inf,  Node: ftruncate,  Next: ftw,  Prev: ftime,  Up: Alphabetical List
  8154. ftruncate
  8155. =========
  8156. Syntax
  8157. ------
  8158.      #include <unistd.h>
  8159.      
  8160.      int ftruncate(int file, off_t where);
  8161. Description
  8162. -----------
  8163. This function truncates FILE at WHERE length.  This only works if the
  8164. file is closed right after this call.
  8165. Return Value
  8166. ------------
  8167. Zero for success, nonzero for failure.
  8168. Example
  8169. -------
  8170.      int x = open("data", O_WRONLY);
  8171.      ftruncate(x, 1000);
  8172.      close(x);
  8173. File: libc.inf,  Node: ftw,  Next: _fwalk,  Prev: ftruncate,  Up: Alphabetical List
  8174. Syntax
  8175. ------
  8176.      #include <ftw.h>
  8177.      
  8178.      int ftw(const char *dir,
  8179.              int (*func)(const char *path, struct stat *stbuf, int flag),
  8180.              int depth);
  8181. Description
  8182. -----------
  8183. This function recursively descends the directory hierarchy which starts
  8184. with DIR.  For each file in the hierarchy, `ftw' calls the user-defined
  8185. function FUNC which is passed a pointer to a `NULL'-terminated
  8186. character array in PATH holding the full pathname of the file, a
  8187. pointer to a `stat' structure (*note stat::.) STBUF with a filesystem
  8188. information about that file, and an integer FLAG.  Possible values of
  8189. FLAG are:
  8190. `FTW_F'
  8191.      This is a regular file.
  8192. `FTW_D'
  8193.      This is a directory.
  8194. `FTW_VL'
  8195.      This is a volume label.
  8196. `FTW_DNR'
  8197.      This is a directory which cannot be read with `readdir()'.  (This
  8198.      will never happen in DJGPP.)
  8199. `FTW_NS'
  8200.      This file exists, but `stat' fails for it.
  8201. If FLAG is `FTW_DNR', the descendants of that directory won't be
  8202. processed.  If FLAG is `FTW_NS', then STBUF will be garbled.
  8203. This function always visits a directory before any of its siblings.  The
  8204. argument DIR must be a directory, or `ftw' will fail and set ERRNO to
  8205. `ENOTDIR'.  The function FUNC is called with DIR as its argument before
  8206. the recursive descent begins.
  8207. The DEPTH argument has no meaning in the DJGPP implementation and is
  8208. always ignored.
  8209. The tree traversal continues until one of the following events:
  8210. (1)  The tree is exhausted (i.e., all descendants of DIR are
  8211. processed).  In this case, `ftw' returns 0, meaning a success.
  8212. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  8213. `ftw' stops the tree traversal and returns whatever FUNC returned.
  8214. (3)  An error is detected within `ftw'.  In that case, `ftw' returns -1
  8215. and sets ERRNO (*note errno::.) to a suitable value.
  8216. Return Value
  8217. ------------
  8218. Zero in case the entire tree was successfully traversed, -1 if `ftw'
  8219. detected some error during its operation, or any other non-zero value
  8220. which was returned by the user-defined function FUNC.
  8221. Implementation Notes
  8222. --------------------
  8223. This function uses `malloc' (*note malloc::.) for dynamic memory
  8224. allocation during its operation.  If FUNC disrupts the normal flow of
  8225. code execution by e.g. calling `longjump' or if an interrupt handler
  8226. which never returns is executed, this memory will remain permanently
  8227. allocated.
  8228. This function calls `opendir()' and `readdir()' functions to read the
  8229. directory entries.  Therefore, you can control what files will your
  8230. FUNC get by setting the appropriate bits in the external variable
  8231. __OPENDIR_FLAGS.  *Note opendir::, for description of these bits.
  8232. This function also calls `stat' for every directory entry it passes to
  8233. FUNC.  If your application only needs some part of the information
  8234. returned in the `stat' structure, you can make your application
  8235. significantly faster by setting bits in the external variable
  8236. _DJSTAT_FLAGS (*note _djstat_flags::. for details).  The most expensive
  8237. `stat' features are `_STAT_EXEC_MAGIC' and `_STAT_DIRSIZE'.
  8238. Example
  8239. -------
  8240.      #include <stdlib.h>
  8241.      
  8242.      int
  8243.      file_walker(const char *path, struct stat *sb, int flag)
  8244.      {
  8245.        char *base;
  8246.      
  8247.        printf("%s:\t%u\t", path, sb->st_size);
  8248.        if (S_ISLABEL(sb->st_mode))
  8249.          printf("V");
  8250.        if (S_ISDIR(sb->st_mode))
  8251.          printf("D");
  8252.        if (S_ISCHR(sb->st_mode))
  8253.          printf("C");
  8254.        if (sb->st_mode & S_IRUSR)
  8255.          printf("r");
  8256.        if (sb->st_mode & S_IWUSR)
  8257.          printf("w");
  8258.        if (sb->st_mode & S_IXUSR)
  8259.          printf("x");
  8260.      
  8261.        if (flag == FTW_NS)
  8262.          printf("  !!no_stat!!");
  8263.        printf("\n");
  8264.      
  8265.        base = strrchr(path, '/');
  8266.        if (base == 0)
  8267.          base = strrchr(path, '\\');
  8268.        if (base == 0)
  8269.          base = strrchr(path, ':');
  8270.        if (strcmp(base == 0 ? path : base + 1, "xxxxx") == 0)
  8271.          return 42;
  8272.        return 0;
  8273.      }
  8274.      
  8275.      int
  8276.      main(int argc, char *argv[])
  8277.      {
  8278.        if (argc > 1)
  8279.          {
  8280.            char msg[80];
  8281.      
  8282.            sprintf(msg, "file_tree_walk: %d",
  8283.                         ftw(argv[1], file_walker, 0));
  8284.            if (errno)
  8285.              perror(msg);
  8286.            else
  8287.              puts(msg);
  8288.          }
  8289.        else
  8290.          printf("Usage: %s dir\n", argv[0]);
  8291.      
  8292.        return 0;
  8293.      }
  8294. File: libc.inf,  Node: _fwalk,  Next: fwrite,  Prev: ftw,  Up: Alphabetical List
  8295. _fwalk
  8296. ======
  8297. Syntax
  8298. ------
  8299.      void _fwalk(void (*function)(FILE *file));
  8300. Description
  8301. -----------
  8302. For each open file in the system, the given FUNCTION is called, passing
  8303. the file pointer as it's only argument
  8304. Return Value
  8305. ------------
  8306. None.
  8307. Example
  8308. -------
  8309.      void pfile(FILE *x)
  8310.      { printf("FILE at %p\n", x); }
  8311.      
  8312.      _fwalk(pfile);
  8313. File: libc.inf,  Node: fwrite,  Next: _get_dev_info,  Prev: _fwalk,  Up: Alphabetical List
  8314. fwrite
  8315. ======
  8316. Syntax
  8317. ------
  8318.      #include <stdio.h>
  8319.      
  8320.      size_t fwrite(void *buffer, size_t size, size_t number, FILE *file);
  8321. Description
  8322. -----------
  8323. This function writes SIZE*NUMBER characters from BUFFER to FILE.
  8324. Return Value
  8325. ------------
  8326. The number of items of size SIZE written, or -1 on error.
  8327. Example
  8328. -------
  8329.      int foo[10];
  8330.      fwrite(foo, sizeof(int), 10, stdin);
  8331. File: libc.inf,  Node: _get_dev_info,  Next: _get_dos_version,  Prev: fwrite,  Up: Alphabetical List
  8332. _get_dev_info
  8333. =============
  8334. Syntax
  8335. ------
  8336.      #include <io.h>
  8337.      
  8338.      short _get_dev_info(int arg);
  8339. Description
  8340. -----------
  8341. Given drive_number (A: = 0, B: = 1, etc.) or a file handle in ARG, this
  8342. function returns the device info word which is returned by DOS IOCTL
  8343. function 0 (Int 21h/AX=4400h).  In case of error, -1 is returned and
  8344. ERRNO is set.
  8345. File: libc.inf,  Node: _get_dos_version,  Next: _get_volume_info,  Prev: _get_dev_info,  Up: Alphabetical List
  8346. _get_dos_version
  8347. ================
  8348. Syntax
  8349. ------
  8350.      #include <dos.h>
  8351.      
  8352.      extern unsigned short   _osmajor, _osminor;
  8353.      extern const    char  * _os_flavor;
  8354.      
  8355.      unsigned short _get_dos_version(int true_version);
  8356. Description
  8357. -----------
  8358. This function gets the host OS version and flavor.  If the argument
  8359. TRUE_VERSION is non-zero, it will return a `true' version number, which
  8360. is unaffected by possible tinkering with SETVER TSR program.  (This is
  8361. only available in DOS 5.0 or later.)
  8362. The external variables `_osmajor' and `_osminor' will always be set to
  8363. the major and minor parts of the `advertised' version number, possibly
  8364. changed by SETVER, even if TRUE_VERSION is non-zero.  You typically
  8365. need the true version when you need an intimate knowledge of the host
  8366. OS internals, like when using undocumented features.  Note that some
  8367. DOS clones (notably, DR-DOS) do not support DOS function required to
  8368. report the true DOS version; for these, the version reported might be
  8369. affected by SETVER even if TRUE_VERSION is non-zero.
  8370. The external variable `_os_flavor' will point to a string which
  8371. describes the OEM name of the host OS variety.
  8372. Return Value
  8373. ------------
  8374. `_get_dos_version()' returns the version number (true version number,
  8375. if TRUE_VERSION is non-zero) as a 16-bit number: the major part of the
  8376. version in the upper 8 bits, the minor part in the lower 8 bits.  For
  8377. instance, DOS version 6.20 will be returned as 0x0614.
  8378. Example
  8379. -------
  8380.        unsigned short true_dos_version = _get_dos_version(1);
  8381.      
  8382.        if (true_dos_version < 0x0614)   /* require DOS 6.20 or later */
  8383.          puts("This program needs DOS 6.20 or later to run");
  8384.        else
  8385.          printf("You are running %s variety of DOS\n", _os_flavor);
  8386. File: libc.inf,  Node: _get_volume_info,  Next: getc,  Prev: _get_dos_version,  Up: Alphabetical List
  8387. _get_volume_info
  8388. ================
  8389. Syntax
  8390. ------
  8391.      #include <fcntl.h>
  8392.      
  8393.      unsigned _get_volume_info (const char *path,
  8394.                                 int *max_file_len, int *max_path_len,
  8395.                                 char *fsystype);
  8396. Description
  8397. -----------
  8398. This function returns filesystem information about the volume where
  8399. PATH resides.  Only the root directory name part is actually used; if
  8400. PATH does not specify the drive explicitly, or is a `NULL' pointer, the
  8401. current drive is used.  Upon return, the variable pointed to by
  8402. *MAX_FILE_LEN contains the maximum length of a filename (including the
  8403. terminating zero), the variable pointed to by *MAX_PATH_LEN contains
  8404. the maximum length of a pathname (including the terminating zero), and
  8405. a string that identifies the filesystem type (e.g., "FAT", "NTFS" etc.)
  8406. is placed into the buffer pointed to by *FSYSTYPE, which should be long
  8407. enough (32 bytes are usually enough).  If any of these pointers is a
  8408. `NULL' pointer, it will be ignored.  The function returns various flags
  8409. that describe features supported by the given filesystem as a
  8410. bit-mapped number.  The following bits are currently defined:
  8411. `_FILESYS_CASE_SENSITIVE'
  8412.      Specifies that file searches are case-sensitive.
  8413. `_FILESYS_CASE_PRESERVED'
  8414.      Filename letter-case is preserved in directory entries.
  8415. `_FILESYS_UNICODE'
  8416.      Filesystem uses Unicode characters in file and directory names.
  8417. `_FILESYS_LFN_SUPPORTED'
  8418.      Filesystem supports the "Long File Name" (LFN) API.
  8419. `_FILESYS_VOL_COMPRESSED'
  8420.      This volume is compressed.
  8421. Return value
  8422. ------------
  8423. A combination of the above bits.
  8424. File: libc.inf,  Node: getc,  Next: getcbrk,  Prev: _get_volume_info,  Up: Alphabetical List
  8425. Syntax
  8426. ------
  8427.      #include <stdio.h>
  8428.      
  8429.      int getc(FILE *file);
  8430. Description
  8431. -----------
  8432. Get one character from FILE.
  8433. Return Value
  8434. ------------
  8435. The character ([0..255]) or `EOF' if eof or error.
  8436. Example
  8437. -------
  8438.      int c;
  8439.      while ((c=getc(stdin)) != EOF)
  8440.        putc(c, stdout);
  8441. File: libc.inf,  Node: getcbrk,  Next: getch,  Prev: getc,  Up: Alphabetical List
  8442. getcbrk
  8443. =======
  8444. Syntax
  8445. ------
  8446.      #include <dos.h>
  8447.      
  8448.      int getcbrk(void);
  8449. Description
  8450. -----------
  8451. Get the setting of the Ctrl-C checking flag in MS-DOS.
  8452. *Note setcbrk::.
  8453. Return Value
  8454. ------------
  8455. 0 if not checking, 1 if checking.
  8456. File: libc.inf,  Node: getch,  Next: getchar,  Prev: getcbrk,  Up: Alphabetical List
  8457. getch
  8458. =====
  8459. Syntax
  8460. ------
  8461.      #include <conio.h>
  8462.      
  8463.      int     getch(void);
  8464. Description
  8465. -----------
  8466. A single character from the console (stdin) is returned.  The input is
  8467. not line-buffered.  If there is a character pending from *Note
  8468. ungetch::, it is returned instead.  The character is not echoed to the
  8469. screen.
  8470. Return Value
  8471. ------------
  8472. The character.
  8473. File: libc.inf,  Node: getchar,  Next: getche,  Prev: getch,  Up: Alphabetical List
  8474. getchar
  8475. =======
  8476. Syntax
  8477. ------
  8478.      #include <stdio.h>
  8479.      
  8480.      int getchar(void);
  8481. Description
  8482. -----------
  8483. The same as `fgetc(stdin)' (*note fgetc::.).
  8484. Return Value
  8485. ------------
  8486. The character, or `EOF'.
  8487. File: libc.inf,  Node: getche,  Next: getcwd,  Prev: getchar,  Up: Alphabetical List
  8488. getche
  8489. ======
  8490. Syntax
  8491. ------
  8492.      #include <conio.h>
  8493.      
  8494.      int getche(void);
  8495. Description
  8496. -----------
  8497. A single character from the console (stdin) is returned.  The input is
  8498. not line-buffered.  If there is a character pending from *Note
  8499. ungetch::, it is returned instead.  The character is echoed to the
  8500. screen.
  8501. Return Value
  8502. ------------
  8503. The character.
  8504. File: libc.inf,  Node: getcwd,  Next: getdate,  Prev: getche,  Up: Alphabetical List
  8505. getcwd
  8506. ======
  8507. Syntax
  8508. ------
  8509.      #include <unistd.h>
  8510.      
  8511.      char *getcwd(char *buffer, int max);
  8512. Description
  8513. -----------
  8514. Get the current directory.  The return value includes the drive
  8515. specifier.  If BUFFER is `NULL', `getcwd' allocates memory with
  8516. `malloc'.  This call fails if more than MAX characters are required to
  8517. specify the current directory.
  8518. Return Value
  8519. ------------
  8520. The buffer, either BUFFER or a newly-allocated buffer, or `NULL' on
  8521. error.
  8522. Example
  8523. -------
  8524.      char *buf = (char *)malloc(PATH_MAX);
  8525.      if (buf && getcwd(buf, PATH_MAX))
  8526.      {
  8527.        printf("cwd is %s\n", buf);
  8528.        free(buf);
  8529.      }
  8530. File: libc.inf,  Node: getdate,  Next: getdfree,  Prev: getcwd,  Up: Alphabetical List
  8531. getdate
  8532. =======
  8533. Syntax
  8534. ------
  8535.      #include <dos.h>
  8536.      
  8537.      void getdate(struct date *);
  8538. Description
  8539. -----------
  8540. This function gets the current date.  The return structure is as
  8541. follows:
  8542.      struct date {
  8543.        short da_year;
  8544.        char  da_day;
  8545.        char  da_mon;
  8546.      };
  8547. *Note setdate::. *Note gettime::.
  8548. Return Value
  8549. ------------
  8550. None.
  8551. Example
  8552. -------
  8553.      struct date d;
  8554.      getdate(&d);
  8555. File: libc.inf,  Node: getdfree,  Next: getdisk,  Prev: getdate,  Up: Alphabetical List
  8556. getdfree
  8557. ========
  8558. Syntax
  8559. ------
  8560.      #include <dos.h>
  8561.      
  8562.      void getdfree(unsigned char drive, struct dfree *ptr);
  8563. Description
  8564. -----------
  8565. This function gets information about the size and fullness of the given
  8566. drive (0=default, 1=A:, etc).  The return structure is as follows:
  8567.      struct dfree {
  8568.        unsigned df_avail; /* number of available clusters */
  8569.        unsigned df_total; /* total number of clusters */
  8570.        unsigned df_bsec;  /* bytes per sector */
  8571.        unsigned df_sclus; /* sectors per cluster */
  8572.      };
  8573. Return Value
  8574. ------------
  8575. None.
  8576. Example
  8577. -------
  8578.      struct dfree d;
  8579.      getdfree(3, &d); /* drive C: */
  8580. File: libc.inf,  Node: getdisk,  Next: getdtablesize,  Prev: getdfree,  Up: Alphabetical List
  8581. getdisk
  8582. =======
  8583. Syntax
  8584. ------
  8585.      #include <dir.h>
  8586.      
  8587.      int getdisk(void);
  8588. Description
  8589. -----------
  8590. Gets the current disk (0=A).
  8591. *Note setdisk::.
  8592. Return Value
  8593. ------------
  8594. The current disk number.
  8595. Example
  8596. -------
  8597.      printf("This drive is %c:\n", getdisk() + 'A');
  8598. File: libc.inf,  Node: getdtablesize,  Next: getegid,  Prev: getdisk,  Up: Alphabetical List
  8599. getdtablesize
  8600. =============
  8601. Syntax
  8602. ------
  8603.      #include <unistd.h>
  8604.      
  8605.      int getdtablesize(void);
  8606. Description
  8607. -----------
  8608. Get the maximum number of open file descriptors the system supports.
  8609. Return Value
  8610. ------------
  8611. File: libc.inf,  Node: getegid,  Next: getenv,  Prev: getdtablesize,  Up: Alphabetical List
  8612. getegid
  8613. =======
  8614. Syntax
  8615. ------
  8616.      #include <unistd.h>
  8617.      
  8618.      int getegid(void);
  8619. Description
  8620. -----------
  8621. Get the effective group id.
  8622. Return Value
  8623. ------------
  8624. File: libc.inf,  Node: getenv,  Next: geteuid,  Prev: getegid,  Up: Alphabetical List
  8625. getenv
  8626. ======
  8627. Syntax
  8628. ------
  8629.      #include <stdlib.h>
  8630.      
  8631.      char *getenv(const char *name);
  8632. Description
  8633. -----------
  8634. Get the setting of the environment variable NAME.  Do not alter or free
  8635. the returned value.
  8636. Return Value
  8637. ------------
  8638. The value, or `NULL' if that variable does not exist.
  8639. Example
  8640. -------
  8641.      char *term = getenv("TERM");
  8642. File: libc.inf,  Node: geteuid,  Next: getftime,  Prev: getenv,  Up: Alphabetical List
  8643. geteuid
  8644. =======
  8645. Syntax
  8646. ------
  8647.      #include <unistd.h>
  8648.      
  8649.      int geteuid(void);
  8650. Description
  8651. -----------
  8652. Gets the effective UID.
  8653. Return Value
  8654. ------------
  8655. File: libc.inf,  Node: getftime,  Next: getgid,  Prev: geteuid,  Up: Alphabetical List
  8656. getftime
  8657. ========
  8658. Syntax
  8659. ------
  8660.      #include <dos.h>
  8661.      
  8662.      int getftime(int handle, struct ftime *ptr);
  8663. Description
  8664. -----------
  8665. Get the timestamp for the given file handle.  The return structure is as
  8666. follows:
  8667.      struct ftime {
  8668.        unsigned ft_tsec:5;    /* 0-29, double to get real seconds */
  8669.        unsigned ft_min:6;    /* 0-59 */
  8670.        unsigned ft_hour:5;    /* 0-23 */
  8671.        unsigned ft_day:5;    /* 1-31 */
  8672.        unsigned ft_month:4;    /* 1-12 */
  8673.        unsigned ft_year:7;    /* since 1980 */
  8674.      }
  8675. Return Value
  8676. ------------
  8677. Zero on success, nonzero on failure.
  8678. Example
  8679. -------
  8680.      struct ftime t;
  8681.      getftime(fd, &t);
  8682. File: libc.inf,  Node: getgid,  Next: getgrent,  Prev: getftime,  Up: Alphabetical List
  8683. getgid
  8684. ======
  8685. Syntax
  8686. ------
  8687.      #include <unistd.h>
  8688.      
  8689.      int getgid(void);
  8690. Description
  8691. -----------
  8692. Get the current group id.
  8693. Return Value
  8694. ------------
  8695. File: libc.inf,  Node: getgrent,  Next: getgrgid,  Prev: getgid,  Up: Alphabetical List
  8696. getgrent
  8697. ========
  8698. Syntax
  8699. ------
  8700.      #include <grp.h>
  8701.      
  8702.      struct group *getgrent(void);
  8703. Description
  8704. -----------
  8705. This function returns the next available group entry.  Note that for
  8706. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  8707. that is the name of the only group returned, else the only group is
  8708. "dos".  Thus, under DOS, `getgrent' will always fail on the second and
  8709. subsequent calls.
  8710. The return type of this and related function is as follows:
  8711.      struct group {
  8712.        gid_t    gr_gid;    /* result of getgid() */
  8713.        char  ** gr_mem;    /* gr_mem[0] points to
  8714.                                getenv("USER"/"LOGNAME") or "user" */
  8715.        char  *  gr_name;   /* getenv("GROUP") or "dos" */
  8716.      };
  8717. Return Value
  8718. ------------
  8719. The next structure, or `NULL' at the end of the list.
  8720. Example
  8721. -------
  8722.      struct group *g;
  8723.      setgrent();
  8724.      while ((g = getgrent()) != NULL)
  8725.      {
  8726.        printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  8727.      }
  8728.      endgrent();
  8729. File: libc.inf,  Node: getgrgid,  Next: getgrnam,  Prev: getgrent,  Up: Alphabetical List
  8730. getgrgid
  8731. ========
  8732. Syntax
  8733. ------
  8734.      #include <grp.h>
  8735.      
  8736.      extern struct group *getgrgid(int gid);
  8737. Description
  8738. -----------
  8739. This function returns the group entry that matches GID.  *Note
  8740. getgrent::, for the description of `struct group'.
  8741. Return Value
  8742. ------------
  8743. The matching group, or `NULL' if none match.
  8744. File: libc.inf,  Node: getgrnam,  Next: gethostname,  Prev: getgrgid,  Up: Alphabetical List
  8745. getgrnam
  8746. ========
  8747. Syntax
  8748. ------
  8749.      #include <grp.h>
  8750.      
  8751.      struct group *getgrnam(char *name);
  8752. Description
  8753. -----------
  8754. This function returns the group entry for the group named NAME.  *Note
  8755. getgrent:: for the description of `struct group'.
  8756. Return Value
  8757. ------------
  8758. The matching group, or `NULL' if none match.
  8759. File: libc.inf,  Node: gethostname,  Next: getitimer,  Prev: getgrnam,  Up: Alphabetical List
  8760. gethostname
  8761. ===========
  8762. Syntax
  8763. ------
  8764.      #include <unistd.h>
  8765.      #include <sys/param.h>
  8766.      
  8767.      int gethostname (char *buf, int size);
  8768. Description
  8769. -----------
  8770. Get the name of the host the program is executing on.  This name is
  8771. obtained from the network software, if present, otherwise from the
  8772. `"HOSTNAME"' environment variable, if present, finally defaulting to
  8773. `"pc"'.
  8774. The call fails if more than SIZE characters are required to specify the
  8775. host name.  A buffer size of `MAXGETHOSTNAME' is guaranteed to be
  8776. enough.
  8777. Return Value
  8778. ------------
  8779. Zero on success, nonzero on failure.
  8780. Example
  8781. -------
  8782.      char *buf = (char *) malloc (MAXGETHOSTNAME);
  8783.      if (buf && 0 == gethostname (buf, MAXGETHOSTNAME))
  8784.        printf ("We're on %s\n", buf);
  8785.      if (buf) free(buf);
  8786. File: libc.inf,  Node: getitimer,  Next: getkey,  Prev: gethostname,  Up: Alphabetical List
  8787. getitimer
  8788. =========
  8789. Syntax
  8790. ------
  8791.      #include <sys/time.h>
  8792.      
  8793.      int getitimer(int which, struct itimerval *value);
  8794. Description
  8795. -----------
  8796. This function gets the current value of the interval timer specified by
  8797. WHICH into structure VALUE.  Variable WHICH can have the value of
  8798. ITIMER_REAL or ITIMER_PROF. *Note setitimer::.
  8799. Return Value
  8800. ------------
  8801. Returns 0 on success, -1 on failure (and sets errno).
  8802. File: libc.inf,  Node: getkey,  Next: getlogin,  Prev: getitimer,  Up: Alphabetical List
  8803. getkey
  8804. ======
  8805. Syntax
  8806. ------
  8807.      #include <pc.h>
  8808.      #include <keys.h>
  8809.      
  8810.      int getkey(void);
  8811. Description
  8812. -----------
  8813. Waits for the user to press one key, then returns that key.  Alt-key
  8814. combinations have 0x100 added to them.  Extended keys return their
  8815. non-extended codes.
  8816. The file `keys.h' has symbolic names for many of the keys.
  8817. *Note getxkey::.
  8818. Return Value
  8819. ------------
  8820. The key pressed.
  8821. Example
  8822. -------
  8823.      while (getkey() != K_Alt_3)
  8824.        do_something();
  8825. File: libc.inf,  Node: getlogin,  Next: getlongpass,  Prev: getkey,  Up: Alphabetical List
  8826. getlogin
  8827. ========
  8828. Syntax
  8829. ------
  8830.      #include <unistd.h>
  8831.      
  8832.      char *getlogin(void);
  8833. Description
  8834. -----------
  8835. Get the login ID of the user.
  8836. Return Value
  8837. ------------
  8838. Returns the value of the `USER' environment variable, else the
  8839. `LOGNAME' environment variable, else `"dosuser"'.
  8840. Example
  8841. -------
  8842.      printf("I am %s\n", getlogin());
  8843. File: libc.inf,  Node: getlongpass,  Next: getmntent,  Prev: getlogin,  Up: Alphabetical List
  8844. getlongpass
  8845. ===========
  8846. Syntax
  8847. ------
  8848.      #include <stdlib.h>
  8849.      
  8850.      int  getlongpass(const char *prompt, char *password, int max_length)
  8851. Description
  8852. -----------
  8853. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  8854. from the standard input, without an echo, after prompting with a
  8855. null-terminated string PROMPT.  It puts a null-terminated string of at
  8856. most MAX_LENGTH - 1 first characters typed by the user into a buffer
  8857. pointed to by PASSWORD.  Pressing Ctrl-C or Ctrl-Break will cause the
  8858. calling program to `exit(1)'.
  8859. Return Value
  8860. ------------
  8861. Zero if successfull, -1 on error (and ERRNO is set to and appropriate
  8862. value.
  8863. Example
  8864. -------
  8865.      char password[MAX_PASS];
  8866.      
  8867.      (void)getlongpass("Password: ", password, MAX_PASS);
  8868. File: libc.inf,  Node: getmntent,  Next: getopt,  Prev: getlongpass,  Up: Alphabetical List
  8869. getmntent
  8870. =========
  8871. Syntax
  8872. ------
  8873.      #include <mntent.h>
  8874.      
  8875.      struct mntent *getmntent(FILE *filep);
  8876. Description
  8877. -----------
  8878. This function returns information about the various drives that are
  8879. available to your program.  Beginning with drive `A:', information is
  8880. retrieved for successive drives with successive calls to `getmntent'.
  8881. Note that drives `A:' and `B:' will only be returned if there is an
  8882. MS-DOS formatted disk in the drive; empty drives are skipped.  For
  8883. systems with a single floppy drive, it is returned as if it were
  8884. mounted on A:/ or B:/, depending on how it was last referenced (and if
  8885. there is a disk in the drive).
  8886. For each drive scanned, a pointer to a static structure of the following
  8887. type is returned:
  8888.      struct mntent
  8889.      {
  8890.          char * mnt_fsname;  /* The name of this file system */
  8891.          char * mnt_dir;     /* The root directory of this file system */
  8892.          char * mnt_type;    /* Filesystem type */
  8893.          char * mnt_opts;    /* Options, see below */
  8894.          int    mnt_freq;    /* -1 */
  8895.          int    mnt_passno;  /* -1 */
  8896.          long   mnt_time;    /* -1 */
  8897.      };
  8898. DJGPP implementation returns the following in the first 4 fields of
  8899. `struct mntent':
  8900. `mnt_fsname'
  8901.      For networked and CD-ROM drives, the name of root directory in the
  8902.      form "\\HOST\PATH" (this is called a UNC name).
  8903.      For drives compressed with DoubleSpace, the string
  8904.      "X:\DBLSPACE.NNN", where "X" is the drive letter of the host drive
  8905.      and "NNN" is the sequence number of the Compressed Volume File.
  8906.      For drives compressed with Stacker, the string "X:\STACVOL.NNN",
  8907.      where "X" and "NNN" are as for DoubleSpace drives.
  8908.      For drives compressed with Jam (a shareware disk compression
  8909.      software), the full name of the Jam archive file.
  8910.      For SUBSTed drives, the actual directory name that that was
  8911.      SUBSTed to emulate a drive.
  8912.      JOINed drives get their name as if they were NOT JOINed (i.e.,
  8913.      either the label name or the default "Drive X:").
  8914.      For drives with a volume label, the name of the label; otherwise
  8915.      the string "Drive X:", where "X" is the drive letter.
  8916. `mnt_dir'
  8917.      For most drives, the name of its root directory "X:/" (where "X" is
  8918.      the drive letter), except that JOINed drives get this as the name
  8919.      of the directory to which they were JOINed.
  8920.      For systems with a single floppy drive (which can be referenced as
  8921.      either "a:/" or "b:/"), the mount directory will be returned as
  8922.      one of these, depending on which drive letter was last used to
  8923.      reference that drive.
  8924. `mnt_type'
  8925.            "fd"     for floppy disks
  8926.            "hd"     for hard disks
  8927.            "dblsp"  for disks compressed with DoubleSpace
  8928.            "stac"   for disks compressed with Stacker
  8929.            "jam"    for disks compressed with Jam
  8930.            "cdrom"  for CD-ROM drives
  8931.            "ram"    for RAM disks
  8932.            "subst"  for SUBSTed directories
  8933.            "join"   for JOINed disks
  8934.            "net"    for networked drives
  8935. `mnt_opts'
  8936.      The string "ro,dev=XX" for CD-ROM drives, "rw,dev=XX" for all the
  8937.      others, where "XX" is the hexadecimal drive number of the REAL
  8938.      drive on which this filesystem resides.  That is, if you call
  8939.      `stat' on MNT_FSNAME, you will get the numeric equivalent of XX in
  8940.      `st_dev' field of `struct stat'.  E.g., for drive C: you will get
  8941.      "rw,dev=02".  Note that SUBSTed and JOINed drives get the drive
  8942.      numbers as if SUBST and JOIN were NOT in effect.
  8943. Return Value
  8944. ------------
  8945. This function returns a pointer to an `struct' `mntent', or NULL if
  8946. there are no more drives to report on.
  8947. Example
  8948. -------
  8949.      struct mntent *m;
  8950.      FILE *f;
  8951.      f = setmntent("/etc/mnttab", "r");
  8952.      while ((m = getmntent(f)))
  8953.        printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
  8954.      endmntent(f);
  8955. File: libc.inf,  Node: getopt,  Next: getpagesize,  Prev: getmntent,  Up: Alphabetical List
  8956. getopt
  8957. ======
  8958. Syntax
  8959. ------
  8960.      int getopt(int argc, char * const *argv, const char *options);
  8961.      extern char *optarg;
  8962.      extern int optind, opterr;
  8963.      extern char optopt;
  8964. Description
  8965. -----------
  8966. Parse options from the command line.  The OPTIONS are a string of valid
  8967. option characters.  If a given option takes a parameter, that character
  8968. should be followed by a colon.
  8969. For each valid switch, this function sets `optarg' to the argument (if
  8970. the switch takes one), sets `optind' to the index in ARGV that it is
  8971. using, sets `optopt' to the option letter found, and returns the option
  8972. letter found.
  8973. If an unexpected option is found, `getopt' will return `?', and if
  8974. `opterr' is nonzero, will print an error message to stderr.
  8975. The special option `--' indicates that no more options follow on the
  8976. command line, and cause `getopt' to stop looking.
  8977. Return Value
  8978. ------------
  8979. The option found, or -1 if no more options.
  8980. Example
  8981. -------
  8982.      int c;
  8983.      opterr = 0;
  8984.      while ((c=getopt(argc, argv, "vbf:")) != -1)
  8985.      {
  8986.        switch (c)
  8987.        {
  8988.          case 'v':
  8989.            verbose_flag ++;
  8990.            break;
  8991.          case 'b':
  8992.            binary_flag ++;
  8993.            break;
  8994.          case 'f':
  8995.            output_filename = optarg;
  8996.            break;
  8997.          case '?':
  8998.            printf("Unknown option %c\n", c);
  8999.            usage();
  9000.            exit(1);
  9001.        }
  9002.      }
  9003. File: libc.inf,  Node: getpagesize,  Next: getpass,  Prev: getopt,  Up: Alphabetical List
  9004. getpagesize
  9005. ===========
  9006. Syntax
  9007. ------
  9008.      #include <unistd.h>
  9009.      
  9010.      int getpagesize(void);
  9011. Description
  9012. -----------
  9013. Return the size of the native virtual memory page size.
  9014. Return Value
  9015. ------------
  9016. 4096 for the i386 and higher processors.
  9017. File: libc.inf,  Node: getpass,  Next: getpgrp,  Prev: getpagesize,  Up: Alphabetical List
  9018. getpass
  9019. =======
  9020. Syntax
  9021. ------
  9022.      #include <stdlib.h>
  9023.      
  9024.      char * getpass(const char *prompt)
  9025. Description
  9026. -----------
  9027. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  9028. from the standard input, without an echo, after prompting with a
  9029. null-terminated string PROMPT.  It returns the string of at most 8
  9030. characters typed by the user.  Pressing Ctrl-C or Ctrl-Break will cause
  9031. the calling program to `exit(1)'.
  9032. Return Value
  9033. ------------
  9034. A pointer to a static buffer which holds the user's response.  The
  9035. buffer will be overwritten by each new call.  In case of any error in
  9036. the lower I/O routines, a NULL pointer will be returned.
  9037. Example
  9038. -------
  9039.      char *password = getpass("Password: ");
  9040. File: libc.inf,  Node: getpgrp,  Next: getpid,  Prev: getpass,  Up: Alphabetical List
  9041. getpgrp
  9042. =======
  9043. Syntax
  9044. ------
  9045.      #include <unistd.h>
  9046.      
  9047.      int getpgrp(void);
  9048. Description
  9049. -----------
  9050. Gets the process group, which is currently the same as the pid.
  9051. Return Value
  9052. ------------
  9053. The process group.
  9054. File: libc.inf,  Node: getpid,  Next: getpwent,  Prev: getpgrp,  Up: Alphabetical List
  9055. getpid
  9056. ======
  9057. Syntax
  9058. ------
  9059.      #include <unistd.h>
  9060.      
  9061.      int getpid(void);
  9062. Description
  9063. -----------
  9064. Get the process ID, which uniquely identifies each program running on
  9065. the system.
  9066. Return Value
  9067. ------------
  9068. The process ID.
  9069. File: libc.inf,  Node: getpwent,  Next: getpwnam,  Prev: getpid,  Up: Alphabetical List
  9070. getpwent
  9071. ========
  9072. Syntax
  9073. ------
  9074.      #include <pwd.h>
  9075.      
  9076.      struct passwd *getpwent(void);
  9077. Description
  9078. -----------
  9079. This function retrieves the next available password file entry.  For
  9080. MS-DOS, this is simulated by providing exactly one entry:
  9081.      struct passwd {
  9082.        char * pw_name;    /* getlogin() */
  9083.        int    pw_uid;     /* getuid() */
  9084.        int    pw_gid;     /* getgid() */
  9085.        char * pw_dir;     /* "/" or getenv("HOME") */
  9086.        char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  9087.      };
  9088. Return Value
  9089. ------------
  9090. The next passwd entry, or `NULL' if there are no more.
  9091. Example
  9092. -------
  9093.      struct passwd *p;
  9094.      setpwent();
  9095.      while ((p = getpwent()) != NULL)
  9096.      {
  9097.        printf("user %s name %s\n", p->pw_name, p->pw_gecos);
  9098.      }
  9099.      endpwent();
  9100. File: libc.inf,  Node: getpwnam,  Next: getpwuid,  Prev: getpwent,  Up: Alphabetical List
  9101. getpwnam
  9102. ========
  9103. Syntax
  9104. ------
  9105.      #include <pwd.h>
  9106.      
  9107.      struct passwd *getpwnam(const char *name);
  9108. Description
  9109. -----------
  9110. This function gets the password file entry matching NAME.  *Note
  9111. getpwent::.
  9112. Return Value
  9113. ------------
  9114. The matching record, or `NULL' if none match.
  9115. File: libc.inf,  Node: getpwuid,  Next: getrlimit,  Prev: getpwnam,  Up: Alphabetical List
  9116. getpwuid
  9117. ========
  9118. Syntax
  9119. ------
  9120.      #include <pwd.h>
  9121.      
  9122.      struct passwd *getpwuid(uid_t uid);
  9123. Description
  9124. -----------
  9125. This function gets the password file entry matching UID.  *Note
  9126. getpwent::.
  9127. Return Value
  9128. ------------
  9129. The matching record, or `NULL' if none match.
  9130. File: libc.inf,  Node: getrlimit,  Next: getrusage,  Prev: getpwuid,  Up: Alphabetical List
  9131. getrlimit
  9132. =========
  9133. Syntax
  9134. ------
  9135.      #include <sys/resource.h>
  9136.      
  9137.      int getrlimit (int rltype, struct rlimit *rlimitp);
  9138. Description
  9139. -----------
  9140. This function gets the resource limit specified by RLTYPE and stores it
  9141. in the buffer pointed to by RLIMITP.
  9142. Return Value
  9143. ------------
  9144. Zero on success, nonzero on failure.
  9145. Example
  9146. -------
  9147.      struct rlimit rlimitbuf;
  9148.      int rc = getrlimit (RLIMIT_STACK, &rlimitbuf);
  9149. File: libc.inf,  Node: getrusage,  Next: gets,  Prev: getrlimit,  Up: Alphabetical List
  9150. getrusage
  9151. =========
  9152. Syntax
  9153. ------
  9154.      #include <sys/time.h>
  9155.      #include <sys/resource.h
  9156.      
  9157.      int getrusage(int who, struct rusage *rusage);
  9158. Description
  9159. -----------
  9160. This function returns information about the running process.  Currently,
  9161. the only field that is computed is this:
  9162.      struct rusage {
  9163.        struct timeval ru_utime;  /* total time used by process */
  9164.      };
  9165. The remainder of the fields are set to zero.
  9166. The WHO parameter must be `RUSAGE_SELF' or `RUSAGE_CHILDREN'.
  9167. Return Value
  9168. ------------
  9169. Zero on success, nonzero on failure.
  9170. Example
  9171. -------
  9172.      struct rusage r;
  9173.      getrusage(RUSAGE_SELF, &r);
  9174. File: libc.inf,  Node: gets,  Next: gettext,  Prev: getrusage,  Up: Alphabetical List
  9175. Syntax
  9176. ------
  9177.      #include <stdio.h>
  9178.      
  9179.      char *gets(char *buffer);
  9180. Description
  9181. -----------
  9182. Reads characters from `stdin', storing them in BUFFER, until either end
  9183. of file or a newline is encountered.  If any characters were stored,
  9184. the BUFFER is then `NULL' terminated and its address is returned, else
  9185. `NULL' is returned.
  9186. Return Value
  9187. ------------
  9188. The address of the buffer, or `NULL'.
  9189. Example
  9190. -------
  9191.      char buf[1000];
  9192.      while (gets(buf))
  9193.        puts(buf);
  9194. File: libc.inf,  Node: gettext,  Next: gettextinfo,  Prev: gets,  Up: Alphabetical List
  9195. gettext
  9196. =======
  9197. Syntax
  9198. ------
  9199.      #include <conio.h>
  9200.      
  9201.      int     gettext(int _left, int _top, int _right, int _bottom, void *_destin);
  9202. Description
  9203. -----------
  9204. Retrieve a block of screen characters into a buffer.
  9205. Return Value
  9206. ------------
  9207. File: libc.inf,  Node: gettextinfo,  Next: gettime,  Prev: gettext,  Up: Alphabetical List
  9208. gettextinfo
  9209. ===========
  9210. Syntax
  9211. ------
  9212.      #include <conio.h>
  9213.      
  9214.      void    gettextinfo(struct text_info *_r);
  9215. Description
  9216. -----------
  9217. This function returns the parameters of the current window on the
  9218. screen.  The return structure is this:
  9219.      struct text_info {
  9220.          unsigned char winleft;
  9221.          unsigned char wintop;
  9222.          unsigned char winright;
  9223.          unsigned char winbottom;
  9224.          unsigned char attribute;
  9225.          unsigned char normattr;
  9226.          unsigned char currmode;
  9227.          unsigned char screenheight;
  9228.          unsigned char screenwidth;
  9229.          unsigned char curx;
  9230.          unsigned char cury;
  9231.      };
  9232. The `normattr' field is the text attribute which was in effect before
  9233. the program started.
  9234. File: libc.inf,  Node: gettime,  Next: gettimeofday,  Prev: gettextinfo,  Up: Alphabetical List
  9235. gettime
  9236. =======
  9237. Syntax
  9238. ------
  9239.      #include <dos.h>
  9240.      
  9241.      void gettime(struct time *);
  9242. Description
  9243. -----------
  9244. This function gets the current time.  The return structure is as
  9245. follows:
  9246.      struct time {
  9247.        unsigned char ti_min;
  9248.        unsigned char ti_hour;
  9249.        unsigned char ti_hund;
  9250.        unsigned char ti_sec;
  9251.      };
  9252. *Note settime::. *Note getdate::.
  9253. Return Value
  9254. ------------
  9255. None.
  9256. Example
  9257. -------
  9258.      struct time t;
  9259.      gettime(&t);
  9260. File: libc.inf,  Node: gettimeofday,  Next: getuid,  Prev: gettime,  Up: Alphabetical List
  9261. gettimeofday
  9262. ============
  9263. Syntax
  9264. ------
  9265.      #include <sys/time.h>
  9266.      
  9267.      int gettimeofday(struct timeval *tp, struct timezone *tzp);
  9268. Description
  9269. -----------
  9270. Gets the current GMT time and the local timezone information.  The
  9271. return structures are as follows:
  9272.      struct timeval {
  9273.        long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  9274.        long tv_usec; /* microseconds */
  9275.      };
  9276.      struct timezone {
  9277.        int tz_minuteswest; /* west of GMT */
  9278.        int tz_dsttime;     /* set if daylight saving time in affect */
  9279.      };
  9280. If either TP or TZP are `NULL', that information is not provided.
  9281. *Note settimeofday::.
  9282. Return Value
  9283. ------------
  9284. Zero on success, nonzero on failure.
  9285. File: libc.inf,  Node: getuid,  Next: getw,  Prev: gettimeofday,  Up: Alphabetical List
  9286. getuid
  9287. ======
  9288. Syntax
  9289. ------
  9290.      #include <unistd.h>
  9291.      
  9292.      int getuid(void);
  9293. Description
  9294. -----------
  9295. Returns the user ID.
  9296. Return Value
  9297. ------------
  9298. File: libc.inf,  Node: getw,  Next: getwd,  Prev: getuid,  Up: Alphabetical List
  9299. Syntax
  9300. ------
  9301.      #include <stdio.h>
  9302.      
  9303.      int getw(FILE *file);
  9304. Description
  9305. -----------
  9306. Reads a single binary word in native format from FILE.
  9307. *Note putw::.
  9308. Return Value
  9309. ------------
  9310. The value read, or `EOF' for end-of-file or error.  Since `EOF' is a
  9311. valid integer, you should use `feof' or `ferror' to detect this
  9312. situation.
  9313. Example
  9314. -------
  9315.      int i = getw(stdin);
  9316. File: libc.inf,  Node: getwd,  Next: getxkey,  Prev: getw,  Up: Alphabetical List
  9317. getwd
  9318. =====
  9319. Syntax
  9320. ------
  9321.      #include <unistd.h>
  9322.      
  9323.      char *getwd(char *buffer);
  9324. Description
  9325. -----------
  9326. Get the current directory and put it in BUFFER.  The return value
  9327. includes the drive specifier.
  9328. Return Value
  9329. ------------
  9330. BUFFER is returned.
  9331. Example
  9332. -------
  9333.      char buf[PATH_MAX];
  9334.      getwd(buf);
  9335. File: libc.inf,  Node: getxkey,  Next: glob,  Prev: getwd,  Up: Alphabetical List
  9336. getxkey
  9337. =======
  9338. Syntax
  9339. ------
  9340.      #include <pc.h>
  9341.      #include <keys.h>
  9342.      
  9343.      int getxkey(void);
  9344. Description
  9345. -----------
  9346. Waits for the user to press one key, then returns that key.  Alt-key
  9347. combinations have 0x100 added to them, and extended keys have 0x200
  9348. added to them.
  9349. The file `keys.h' has symbolic names for many of the keys.
  9350. *Note getkey::.
  9351. Return Value
  9352. ------------
  9353. The key pressed.
  9354. Example
  9355. -------
  9356.      while (getxkey() != K_EEnd)
  9357.        do_something();
  9358. File: libc.inf,  Node: glob,  Next: globfree,  Prev: getxkey,  Up: Alphabetical List
  9359. Syntax
  9360. ------
  9361.      #include <glob.h>
  9362.      
  9363.      int  glob(const char *pattern, int flags,
  9364.                int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);
  9365. Description
  9366. -----------
  9367. This function expands a filename wildcard which is passed as PATTERN.
  9368. The pattern may include these special characters:
  9369.      Matches zero of more characters.
  9370.      Matches exactly one character (any character).
  9371. `[...]'
  9372.      Matches one character from a group of characters.  If the first
  9373.      character is `!', matches any character *not* in the group.  A
  9374.      group is defined as a list of characters between the brackets,
  9375.      e.g. `[dkl_]', or by two characters separated by `-' to indicate
  9376.      all characters between and including these two.  For example,
  9377.      `[a-d]' matches `a', `b', `c', or `d', and `[!a-zA-Z0-9]' matches
  9378.      any character that is not alphanumeric.
  9379. `...'
  9380.      Matches all the subdirectories, recursively (VMS aficionados,
  9381.      rejoice!).
  9382.      Causes the next character to not be treated as special.  For
  9383.      example, `\[' matches a literal `['.  If FLAGS includes
  9384.      `GLOB_NOESCAPE', this quoting is disabled and `\' is handled as a
  9385.      simple character.
  9386. The variable FLAGS controls certain options of the expansion process.
  9387. Possible values for _FLAGS are as follows:
  9388. `GLOB_APPEND'
  9389.      Append the matches to those already present in the array
  9390.      `pglob->gl_pathv'.  By default, `glob' discards all previous
  9391.      contents of `pglob->gl_pathv' and allocates a new memory block for
  9392.      it.  If you use `GLOB_APPEND', `pglob' should point to a structure
  9393.      returned by a previous call to `glob'.
  9394. `GLOB_DOOFFS'
  9395.      Skip `pglob->gl_offs' entries in `gl_pathv' and put new matches
  9396.      after that point.  By default, `glob' puts the new matches
  9397.      beginning at `pglob->gl_pathv[0]'.  You can use this flag both with
  9398.      `GLOB_APPEND' (in which case the new matches will be put after the
  9399.      first `pglob->gl_offs' matches from previous call to `glob'), or
  9400.      without it (in which case the first `pglob->gl_offs' entries in
  9401.      `pglob->gl_pathv' will be filled by `NULL' pointers).
  9402. `GLOB_ERR'
  9403.      Stop when an unreadable directory is encountered and call
  9404.      user-defined function ERRFUNC.  This cannot happen under DOS (and
  9405.      thus ERRFUNC is never used).
  9406. `GLOB_MARK'
  9407.      Append a slash to each pathname that is a directory.
  9408. `GLOB_NOCHECK'
  9409.      If no matches are found, return the pattern itself as the only
  9410.      match.  By default, `glob' doesn't change `pglob' if no matches are
  9411.      found.
  9412. `GLOB_NOESCAPE'
  9413.      Disable blackslash as an escape character.  By default, backslash
  9414.      quotes special meta-characters in wildcards described above.
  9415. `GLOB_NOSORT'
  9416.      Do not sort the returned list.  By default, the list is sorted
  9417.      alphabetically.  This flag causes the files to be returned in the
  9418.      order they were found in the directory.
  9419. Given the pattern and the flags, `glob' expands the pattern and returns
  9420. a list of files that match the pattern in a structure a pointer to
  9421. which is passed via PGLOB.  This structure is like this:
  9422.      typedef struct {
  9423.        size_t gl_pathc;
  9424.        char **gl_pathv;
  9425.        size_t gl_offs;
  9426.      } glob_t;
  9427. In the structure, the `gl_pathc' field holds the number of filenames in
  9428. `gl_pathv' list; this includes the filenames produced by this call,
  9429. plus any previous filenames if `GLOB_APPEND' or `GLOB_DOOFFS' were set
  9430. in FLAGS.  The list of matches is returned as an array of pointers to
  9431. the filenames; `gl_pathv' holds the address of the array.  Thus, the
  9432. filenames which match the pattern can be accessed as `gl_pathv[0]',
  9433. `gl_pathv[1]', etc.  If `GLOB_DOOFFS' was set in FLAGS, the new matches
  9434. begin at offset given by `gl_offs'.
  9435. Return Value
  9436. ------------
  9437. Zero on success, or one of these codes:
  9438. `GLOB_ABORTED'
  9439.      Not used in DJGPP implementation.
  9440. `GLOB_NOMATCH'
  9441.      No files matched the given pattern.
  9442. `GLOB_NOSPACE'
  9443.      Not enough memory to accomodate expanded filenames.
  9444. `GLOB_ERR'
  9445.      Never happens on MSDOS, see above.
  9446. Notes
  9447. -----
  9448. `glob' will not match names of volume labels.
  9449. On MSDOS, filenames are always matched case-insensitively.  On
  9450. filesystems that preserve letter-case in filenames (such as Windows 9x),
  9451. matches are case-insensitive unless the pattern includes uppercase
  9452. characters.
  9453. On MSDOS, the list of expanded filenames will be returned in lower case,
  9454. if all the characters of the pattern (except those between brackets
  9455. [...]) are lower-case; if some of them are upper-case, the expanded
  9456. filenames will be also in upper case.  On filesystems that preserve
  9457. letter-case in filenames, long filenames are returned as they are found
  9458. in the directory entry; DOS-style 8+3 filenames are returned as on MSDOS
  9459. (in lower case if the pattern doesn't include any upper-case letters, in
  9460. upper case otherwise).
  9461. When the environment variable `LFN' is set to `n', `glob' behaves on
  9462. Windows 9x exactly as it does on MSDOS.
  9463. Setting the environment variable `FNCASE' to `y', or setting the
  9464. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  9465. variable (*note _crt0_startup_flags::.) suppresses any letter-case
  9466. conversions in filenames and forces case-sensitive filename matching.
  9467. *Note _preserve_fncase::.
  9468. Example
  9469. -------
  9470.      #include <stdlib.h>
  9471.      #include <string.h>
  9472.      #include <glob.h>
  9473.      
  9474.      /* Convert a wildcard pattern into a list of blank-separated
  9475.         filenames which match the wildcard.  */
  9476.      
  9477.      char * glob_pattern(char *wildcard)
  9478.      {
  9479.        char *gfilename;
  9480.        size_t cnt, length;
  9481.        glob_t glob_results;
  9482.        char **p;
  9483.      
  9484.        glob(wildcard, GLOB_NOCHECK, 0, &glob_results);
  9485.      
  9486.        /* How much space do we need?  */
  9487.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  9488.             cnt; p++, cnt--)
  9489.          length += strlen(*p) + 1;
  9490.      
  9491.        /* Allocate the space and generate the list.  */
  9492.        gfilename = (char *) calloc(length, sizeof(char));
  9493.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  9494.             cnt; p++, cnt--)
  9495.          {
  9496.            strcat(gfilename, *p);
  9497.            if (cnt > 1)
  9498.              strcat(gfilename, " ");
  9499.          }
  9500.      
  9501.        globfree(&glob_results);
  9502.        return gfilename;
  9503.      }
  9504. File: libc.inf,  Node: globfree,  Next: gmtime,  Prev: glob,  Up: Alphabetical List
  9505. globfree
  9506. ========
  9507. Syntax
  9508. ------
  9509.      #include <glob.h>
  9510.      
  9511.      void globfree(glob_t *_pglob);
  9512. Description
  9513. -----------
  9514. Frees the memory associated with `_pglob'.
  9515. File: libc.inf,  Node: gmtime,  Next: _go32_conventional_mem_selector,  Prev: globfree,  Up: Alphabetical List
  9516. gmtime
  9517. ======
  9518. Syntax
  9519. ------
  9520.      #include <time.h>
  9521.      
  9522.      struct tm *gmtime(const time_t *tod);
  9523. Description
  9524. -----------
  9525. Converts the time represented by TOD into a structure.
  9526. The return structure has this format:
  9527.      struct tm {
  9528.        int    tm_sec;    /* seconds after the minute [0-60] */
  9529.        int    tm_min;    /* minutes after the hour [0-59] */
  9530.        int    tm_hour;   /* hours since midnight [0-23] */
  9531.        int    tm_mday;   /* day of the month [1-31] */
  9532.        int    tm_mon;    /* months since January [0-11] */
  9533.        int    tm_year;   /* years since 1900 */
  9534.        int    tm_wday;   /* days since Sunday [0-6] */
  9535.        int    tm_yday;   /* days since January 1 [0-365] */
  9536.        int    tm_isdst;  /* Daylight Savings Time flag */
  9537.        long   tm_gmtoff; /* offset from GMT in seconds */
  9538.        char * tm_zone;   /* timezone abbreviation */
  9539.      };
  9540. Return Value
  9541. ------------
  9542. A pointer to a static structure which is overridden with each call.
  9543. Example
  9544. -------
  9545.      time_t x;
  9546.      struct tm *t;
  9547.      time(&x);
  9548.      t = gmtime(&t);
  9549. File: libc.inf,  Node: _go32_conventional_mem_selector,  Next: _go32_dpmi_allocate_dos_memory,  Prev: gmtime,  Up: Alphabetical List
  9550. _go32_conventional_mem_selector
  9551. ===============================
  9552. Syntax
  9553. ------
  9554.      #include <go32.h>
  9555.      
  9556.      u_short _go32_conventional_mem_selector();
  9557. Description
  9558. -----------
  9559. This function returns a selector which has a physical base address
  9560. corresponding to the beginning of conventional memory.  This selector
  9561. can be used as a parameter to `movedata' (*note movedata::.) to
  9562. manipulate memory in the conventional address space.
  9563. Return Value
  9564. ------------
  9565. The selector.
  9566. Example
  9567. -------
  9568.      short blank_row_buf[ScreenCols()];
  9569.      /* scroll screen */
  9570.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  9571.               _go32_conventional_mem_selector(), 0xb8000,
  9572.               ScreenCols() * (ScreenRows()-1) * 2);
  9573.      /* fill last row */
  9574.      movedata(_go32_my_ds, (int)blank_row_buf,
  9575.               _go32_conventional_mem_selector(),
  9576.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  9577.                ScreenCols() * 2);
  9578. File: libc.inf,  Node: _go32_dpmi_allocate_dos_memory,  Next: _go32_dpmi_allocate_iret_wrapper,  Prev: _go32_conventional_mem_selector,  Up: Alphabetical List
  9579. _go32_dpmi_allocate_dos_memory
  9580. ==============================
  9581. Syntax
  9582. ------
  9583.      #include <dpmi.h>
  9584.      
  9585.      int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
  9586. Description
  9587. -----------
  9588. *Note DPMI Overview::
  9589. Allocate a part of the conventional memory area (the first 640K).  Set
  9590. the `size' field of INFO to the number of paragraphs requested (this is
  9591. (size in bytes + 15)/16), then call.  The `rm_segment' field of INFO
  9592. contains the segment of the allocated memory.
  9593. The memory may be resized with `_go32_dpmi_resize_dos_memory' and must
  9594. be freed with `_go32_dpmi_free_dos_memory'.
  9595. If there isn't enough memory in the system, the `size' field of INFO
  9596. has the largest available size, and an error is returned.
  9597. *Note dosmemput:: *Note dosmemget::
  9598. Return Value
  9599. ------------
  9600. Zero on success, nonzero on failure.
  9601. Example
  9602. -------
  9603.      _go32_dpmi_seginfo info;
  9604.      info.size = (want_size+15) / 16;
  9605.      _go32_dpmi_allocate_dos_memory(&info);
  9606.      dosmemput(buffer, want_size, info.rm_segment*16);
  9607.      _go32_dpmi_free_dos_memory(&info);
  9608. File: libc.inf,  Node: _go32_dpmi_allocate_iret_wrapper,  Next: _go32_dpmi_allocate_real_mode_callback_iret,  Prev: _go32_dpmi_allocate_dos_memory,  Up: Alphabetical List
  9609. _go32_dpmi_allocate_iret_wrapper
  9610. ================================
  9611. Syntax
  9612. ------
  9613.      #include <dpmi.h>
  9614.      
  9615.      int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
  9616. Description
  9617. -----------
  9618. *Note DPMI Overview::
  9619. This function creates a small assembler function that handles the
  9620. overhead of servicing an interrupt.  To use, put the address of your
  9621. servicing function in the `pm_offset' field of INFO and call this
  9622. function.  The `pm_field' will get replaced with the address of the
  9623. wrapper function, which you pass to both
  9624. `_go32_dpmi_set_protected_mode_interrupt_vector' and
  9625. `_go32_dpmi_free_iret_wrapper'.
  9626. *Note _go32_dpmi_set_protected_mode_interrupt_vector:: *Note
  9627. _go32_dpmi_free_iret_wrapper::
  9628. Return Value
  9629. ------------
  9630. Zero on success, nonzero on failure.
  9631. Example
  9632. -------
  9633.      _go32_dpmi_seginfo info;
  9634.      info.pm_offset = my_handler;
  9635.      _go32_dpmi_allocate_iret_wrapper(&info);
  9636.      _go32_dpmi_set_protected_mode_interrupt_handler(0x75, &info);
  9637.      ...
  9638.      _go32_dpmi_free_iret_wrapper(&info);
  9639. File: libc.inf,  Node: _go32_dpmi_allocate_real_mode_callback_iret,  Next: _go32_dpmi_allocate_real_mode_callback_retf,  Prev: _go32_dpmi_allocate_iret_wrapper,  Up: Alphabetical List
  9640. _go32_dpmi_allocate_real_mode_callback_iret
  9641. ===========================================
  9642. Syntax
  9643. ------
  9644.      #include <dpmi.h>
  9645.      
  9646.      int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  9647. Description
  9648. -----------
  9649. *Note DPMI Overview::
  9650. This function allocates a "real-mode callback".  Fill in the
  9651. `pm_offset' field of INFO and call this function.  It will fill in the
  9652. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  9653. calls the real-mode address, your function gets called.  The registers
  9654. in affect will be stored in REGS, which should be a global, and will be
  9655. passed to your function.  Any changes in REGS will be reflected back
  9656. into real mode.  A wrapper will be added to your function to simulate
  9657. the effects of an `iret' instruction, so this function is useful for
  9658. trapping real-mode software interrupts (like 0x1b - `Ctrl-Break' hit).
  9659. Return Value
  9660. ------------
  9661. Zero on success, nonzero on failure.
  9662. Example
  9663. -------
  9664.      _go32_dpmi_registers regs;
  9665.      
  9666.      my_handler(_go32_dpmi_registers *r)
  9667.      {
  9668.        r.d.eax = 4;
  9669.      }
  9670.      
  9671.      setup()
  9672.      {
  9673.        _go32_dpmi_seginfo info;
  9674.        _go32_dpmi_seginfo old_vector;
  9675.        _go32_dpmi_get_real_mode_interrupt_vector(0x84, &old_vector);
  9676.        info.pm_offset = my_handler;
  9677.        _go32_dpmi_allocate_real_mode_callback_iret(&info, ®s);
  9678.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &info);
  9679.        do_stuff();
  9680.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &old_vector);
  9681.        _go32_dpmi_free_real_mode_callback(&info);
  9682.      }
  9683. File: libc.inf,  Node: _go32_dpmi_allocate_real_mode_callback_retf,  Next: _go32_dpmi_chain_protected_mode_interrupt_vector,  Prev: _go32_dpmi_allocate_real_mode_callback_iret,  Up: Alphabetical List
  9684. _go32_dpmi_allocate_real_mode_callback_retf
  9685. ===========================================
  9686. Syntax
  9687. ------
  9688.      #include <dpmi.h>
  9689.      
  9690.      int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  9691. Description
  9692. -----------
  9693. *Note DPMI Overview::
  9694. This function allocates a "real-mode callback".  Fill in the
  9695. `pm_offset' field of INFO and call this function.  It will fill in the
  9696. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  9697. calls the real-mode address, your function gets called.  The registers
  9698. in affect will be stored in REGS, which should be a global, and will be
  9699. passed to your function.  Any changes in REGS will be reflected back
  9700. into real mode.  A wrapper will be added to your function to simulate
  9701. the effects of a far return, such as the callback for the packet driver
  9702. receiver.
  9703. Return Value
  9704. ------------
  9705. Zero on success, nonzero on failure.
  9706. Example
  9707. -------
  9708. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  9709. File: libc.inf,  Node: _go32_dpmi_chain_protected_mode_interrupt_vector,  Next: _go32_dpmi_free_dos_memory,  Prev: _go32_dpmi_allocate_real_mode_callback_retf,  Up: Alphabetical List
  9710. _go32_dpmi_chain_protected_mode_interrupt_vector
  9711. ================================================
  9712. Syntax
  9713. ------
  9714.      #include <dpmi.h>
  9715.      
  9716.      int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  9717. Description
  9718. -----------
  9719. *Note DPMI Overview::
  9720. This function is used to chain a protected mode interrupt.  It will
  9721. build a suitable wrapper that will call your function and then jump to
  9722. the next handler.  Your function need not perform any special handling.
  9723. *Warning!* Because of the way DPMI works, you may *not* `longjmp' out
  9724. of an interrupt handler or perform any system calls (such as `printf')
  9725. from within an interrupt handler.
  9726. Return Value
  9727. ------------
  9728. Zero on success, nonzero on failure.
  9729. Example
  9730. -------
  9731. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  9732. File: libc.inf,  Node: _go32_dpmi_free_dos_memory,  Next: _go32_dpmi_free_iret_wrapper,  Prev: _go32_dpmi_chain_protected_mode_interrupt_vector,  Up: Alphabetical List
  9733. _go32_dpmi_free_dos_memory
  9734. ==========================
  9735. Syntax
  9736. ------
  9737.      #include <dpmi.h>
  9738.      
  9739.      int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
  9740. Description
  9741. -----------
  9742. *Note DPMI Overview::
  9743. This function frees the conventional memory allocated by
  9744. `_go32_dpmi_allocate_real_mode_memory'.  You should pass it the same
  9745. structure as was used to allocate it.
  9746. Return Value
  9747. ------------
  9748. Zero on success, nonzero on failure.
  9749. Example
  9750. -------
  9751.      _go32_dpmi_seginfo info;
  9752.      info.size = 100;
  9753.      _go32_dpmi_allocate_dos_memory(&info);
  9754.      _go32_dpmi_free_dos_memory(&info);
  9755. File: libc.inf,  Node: _go32_dpmi_free_iret_wrapper,  Next: _go32_dpmi_free_real_mode_callback,  Prev: _go32_dpmi_free_dos_memory,  Up: Alphabetical List
  9756. _go32_dpmi_free_iret_wrapper
  9757. ============================
  9758. Syntax
  9759. ------
  9760.      #include <dpmi.h>
  9761.      
  9762.      int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
  9763. Description
  9764. -----------
  9765. *Note DPMI Overview::
  9766. This function frees the memory used by the wrapper created by
  9767. `_go32_dpmi_allocate_iret_wrapper'.  You should not free a wrapper that
  9768. is still in use.
  9769. Return Value
  9770. ------------
  9771. Zero on success, nonzero on failure.
  9772. Example
  9773. -------
  9774. *Note _go32_dpmi_allocate_iret_wrapper::
  9775. File: libc.inf,  Node: _go32_dpmi_free_real_mode_callback,  Next: _go32_dpmi_get_free_memory_information,  Prev: _go32_dpmi_free_iret_wrapper,  Up: Alphabetical List
  9776. _go32_dpmi_free_real_mode_callback
  9777. ==================================
  9778. Syntax
  9779. ------
  9780.      #include <dpmi.h>
  9781.      
  9782.      int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
  9783. Description
  9784. -----------
  9785. *Note DPMI Overview::
  9786. This function frees the real-mode callbacks and wrappers allocated by
  9787. `_go32_dpmi_allocate_real_mode_callback_iret' and
  9788. `_go32_dpmi_allocate_real_mode_callback_retf'.
  9789. Return Value
  9790. ------------
  9791. Zero on success, nonzero on failure.
  9792. Example
  9793. -------
  9794. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  9795. File: libc.inf,  Node: _go32_dpmi_get_free_memory_information,  Next: _go32_dpmi_get_protected_mode_interrupt_vector,  Prev: _go32_dpmi_free_real_mode_callback,  Up: Alphabetical List
  9796. _go32_dpmi_get_free_memory_information
  9797. ======================================
  9798. Syntax
  9799. ------
  9800.      #include <dpmi.h
  9801.      
  9802.      int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
  9803. Description
  9804. -----------
  9805. This function fills in the following structure:
  9806.      typedef struct {
  9807.        u_long available_memory;
  9808.        u_long available_pages;
  9809.        u_long available_lockable_pages;
  9810.        u_long linear_space;
  9811.        u_long unlocked_pages;
  9812.        u_long available_physical_pages;
  9813.        u_long total_physical_pages;
  9814.        u_long free_linear_space;
  9815.        u_long max_pages_in_paging_file;
  9816.        u_long reserved[3];
  9817.      } _go32_dpmi_meminfo;
  9818. The only field that is guaranteed to have useful data is
  9819. `available_memory'.  Any unavailable field has -1 in it.
  9820. Return Value
  9821. ------------
  9822. Zero on success, nonzero on failure.
  9823. Example
  9824. -------
  9825.      int phys_mem_left()
  9826.      {
  9827.        _go32_dpmi_meminfo info;
  9828.        _go32_dpmi_get_free_memory_information(&info);
  9829.        if (info.available_physical_pages != -1)
  9830.          return info.available_physical_pages * 4096;
  9831.        return info.available_memory;
  9832.      }
  9833. File: libc.inf,  Node: _go32_dpmi_get_protected_mode_interrupt_vector,  Next: _go32_dpmi_get_real_mode_interrupt_vector,  Prev: _go32_dpmi_get_free_memory_information,  Up: Alphabetical List
  9834. _go32_dpmi_get_protected_mode_interrupt_vector
  9835. ==============================================
  9836. Syntax
  9837. ------
  9838.      #include <dpmi.h>
  9839.      
  9840.      int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  9841. Description
  9842. -----------
  9843. *Note DPMI Overview::
  9844. This function puts the selector and offset of the specified interrupt
  9845. vector into the `pm_selector' and `pm_offset' fields of INFO.  This
  9846. structure can be saved and later passed to
  9847. `_go32_dpmi_get_protected_mode_interrupt_vector' to restore a vector.
  9848. Return Value
  9849. ------------
  9850. Zero on success, nonzero on failure.
  9851. Example
  9852. -------
  9853. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  9854. File: libc.inf,  Node: _go32_dpmi_get_real_mode_interrupt_vector,  Next: _go32_dpmi_lock_code,  Prev: _go32_dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  9855. _go32_dpmi_get_real_mode_interrupt_vector
  9856. =========================================
  9857. Syntax
  9858. ------
  9859.      #include <dpmi.h>
  9860.      
  9861.      int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  9862. Description
  9863. -----------
  9864. *Note DPMI Overview::
  9865. This function gets the real-mode interrupt vector specified into the
  9866. address in the `rm_segment' and `rm_offset' fields in INFO.
  9867. Return Value
  9868. ------------
  9869. Zero on success, nonzero on failure.
  9870. Example
  9871. -------
  9872. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  9873. File: libc.inf,  Node: _go32_dpmi_lock_code,  Next: _go32_dpmi_lock_data,  Prev: _go32_dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  9874. _go32_dpmi_lock_code
  9875. ====================
  9876. Syntax
  9877. ------
  9878.      #include <dpmi.h>
  9879.      
  9880.      int _go32_dpmi_lock_code( void *lockaddr, unsigned long locksize);
  9881. Description
  9882. -----------
  9883. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  9884. bytes.  LOCKADDR is a regular pointer in your program, such as the
  9885. address of a function.
  9886. Example
  9887. -------
  9888.      void my_handler()
  9889.      {
  9890.      }
  9891.      
  9892.      void lock_my_handler()
  9893.      {
  9894.        _go32_dpmi_lock_code(my_handler, (unsigned long)(lock_my_handler - my_handler));
  9895.      }
  9896. File: libc.inf,  Node: _go32_dpmi_lock_data,  Next: _go32_dpmi_remaining_physical_memory,  Prev: _go32_dpmi_lock_code,  Up: Alphabetical List
  9897. _go32_dpmi_lock_data
  9898. ====================
  9899. Syntax
  9900. ------
  9901.      #include <dpmi.h>
  9902.      
  9903.      int _go32_dpmi_lock_data( void *lockaddr, unsigned long locksize);
  9904. Description
  9905. -----------
  9906. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  9907. bytes.  LOCKADDR is a regular pointer in your program, such as the
  9908. address of a variable.
  9909. Example
  9910. -------
  9911.      int semaphore=0;
  9912.      
  9913.      void lock_my_handler()
  9914.      {
  9915.        _go32_dpmi_lock_data(&semaphore, 4);
  9916.      }
  9917. File: libc.inf,  Node: _go32_dpmi_remaining_physical_memory,  Next: _go32_dpmi_remaining_virtual_memory,  Prev: _go32_dpmi_lock_data,  Up: Alphabetical List
  9918. _go32_dpmi_remaining_physical_memory
  9919. ====================================
  9920. Syntax
  9921. ------
  9922.      #include <dpmi.h>
  9923.      
  9924.      unsigned long _go32_dpmi_remaining_physical_memory(void);
  9925. Description
  9926. -----------
  9927. Returns the amount of physical memory that is still available in the
  9928. system.
  9929. Return Value
  9930. ------------
  9931. The amount in bytes.
  9932. File: libc.inf,  Node: _go32_dpmi_remaining_virtual_memory,  Next: _go32_dpmi_resize_dos_memory,  Prev: _go32_dpmi_remaining_physical_memory,  Up: Alphabetical List
  9933. _go32_dpmi_remaining_virtual_memory
  9934. ===================================
  9935. Syntax
  9936. ------
  9937.      #include <dpmi.h>
  9938.      
  9939.      unsigned long _go32_dpmi_remaining_virtual_memory(void);
  9940. Description
  9941. -----------
  9942. Returns the amount of virtual memory that is still available in the
  9943. system.
  9944. Return Value
  9945. ------------
  9946. The amount in bytes.
  9947. File: libc.inf,  Node: _go32_dpmi_resize_dos_memory,  Next: _go32_dpmi_set_protected_mode_interrupt_vector,  Prev: _go32_dpmi_remaining_virtual_memory,  Up: Alphabetical List
  9948. _go32_dpmi_resize_dos_memory
  9949. ============================
  9950. Syntax
  9951. ------
  9952.      #include <dpmi.h>
  9953.      
  9954.      int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
  9955. Description
  9956. -----------
  9957. *Note DPMI Overview::
  9958. The INFO structure is the same one used to allocate the memory.  Fill
  9959. in a new value for `size' and call this function.  If there is not
  9960. enough memory to satisfy the request, the largest size is filled in to
  9961. the `size' field, the memory is not resized, and this function fails.
  9962. Return Value
  9963. ------------
  9964. Zero on success, nonzero on failure.
  9965. Example
  9966. -------
  9967.      _go32_dpmi_seginfo info;
  9968.      info.size = 10;
  9969.      _go32_dpmi_allocate_dos_memory(&info);
  9970.      info.size = 20;
  9971.      _go32_dpmi_resize_dos_memory(&info);
  9972.      _go32_dpmi_free_dos_memory(&info);
  9973. File: libc.inf,  Node: _go32_dpmi_set_protected_mode_interrupt_vector,  Next: _go32_dpmi_set_real_mode_interrupt_vector,  Prev: _go32_dpmi_resize_dos_memory,  Up: Alphabetical List
  9974. _go32_dpmi_set_protected_mode_interrupt_vector
  9975. ==============================================
  9976. Syntax
  9977. ------
  9978.      #include <dpmi.h>
  9979.      
  9980.      int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  9981. Description
  9982. -----------
  9983. *Note DPMI Overview::
  9984. This function sets the protected mode interrupt vector specified to
  9985. point to the given function.  The `pm_offset' and `pm_selector' fields
  9986. of INFO must be filled in (*note _go32_my_cs::.).  The following should
  9987. be noted:
  9988.    *  You may not `longjmp' out of an interrupt handler.
  9989.    *  You may not make any function calls that require system calls,
  9990.      such as `printf'.
  9991.    *  This function will not wrap the handler for you.  The
  9992.      `_go32_dpmi_allocate_iret_wrapper' and
  9993.      `_go32_dpmi_chain_protected_mode_interrupt_vector' functions can
  9994.      wrap your function if you want.
  9995.    *  You must set the pm_selector field of INFO.  Use `_go32_my_cs' to
  9996.      get a selector valid for your functions.
  9997. Return Value
  9998. ------------
  9999. Zero on success, nonzero on failure.
  10000. Example
  10001. -------
  10002.      volatile int tics = 0;
  10003.      
  10004.      timer_handler()
  10005.      {
  10006.        tics++;
  10007.      }
  10008.      
  10009.      int main()
  10010.      {
  10011.        _go32_dpmi_seginfo old_handler, new_handler;
  10012.      
  10013.        printf("grabbing timer interrupt\n");
  10014.        _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  10015.      
  10016.        new_handler.pm_offset = (int)tic_handler;
  10017.        new_handler.pm_selector = _go32_my_cs();
  10018.        _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  10019.      
  10020.        getkey();
  10021.      
  10022.        printf("releasing timer interrupt\n");
  10023.        _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  10024.      
  10025.        return 0;
  10026.      }
  10027. File: libc.inf,  Node: _go32_dpmi_set_real_mode_interrupt_vector,  Next: _go32_dpmi_simulate_fcall,  Prev: _go32_dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  10028. _go32_dpmi_set_real_mode_interrupt_vector
  10029. =========================================
  10030. Syntax
  10031. ------
  10032.      #include <dpmi.h>
  10033.      
  10034.      int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  10035. Description
  10036. -----------
  10037. *Note DPMI Overview::
  10038. This function sets the real-mode interrupt vector specified to point to
  10039. the address in the `rm_segment' and `rm_offset' fields in INFO.
  10040. Return Value
  10041. ------------
  10042. Zero on success, nonzero on failure.
  10043. Example
  10044. -------
  10045. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  10046. File: libc.inf,  Node: _go32_dpmi_simulate_fcall,  Next: _go32_dpmi_simulate_fcall_iret,  Prev: _go32_dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  10047. _go32_dpmi_simulate_fcall
  10048. =========================
  10049. Syntax
  10050. ------
  10051.      #include <dpmi.h>
  10052.      
  10053.      int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
  10054. Description
  10055. -----------
  10056. *Note DPMI Overview::
  10057. This function simulates a real-mode far call to a function that returns
  10058. with a far return.  The registers are set up from REGS, including `CS'
  10059. and `IP', which indicate the address of the call.  Any registers the
  10060. function modifies are reflected in REGS on return.
  10061. If `SS' and `SP' are both zero, a small temporary stack is used when in
  10062. real mode.  If not, they are used AS IS.  It's a good idea to use
  10063. `memset' to initialize the register structure before using it.
  10064. Return Value
  10065. ------------
  10066. Zero on success, nonzero on failure.
  10067. Example
  10068. -------
  10069.      _go32_dpmi_registers r;
  10070.      r.x.ax = 47;
  10071.      r.x.cs = some_segment;
  10072.      r.x.ip = some_offset;
  10073.      r.x.ss = r.x.sp = 0;
  10074.      _go32_dpmi_simulate_fcall(&r);
  10075.      printf("returns %d\n", r.x.ax);
  10076. File: libc.inf,  Node: _go32_dpmi_simulate_fcall_iret,  Next: _go32_dpmi_simulate_int,  Prev: _go32_dpmi_simulate_fcall,  Up: Alphabetical List
  10077. _go32_dpmi_simulate_fcall_iret
  10078. ==============================
  10079. Syntax
  10080. ------
  10081.      #include <dpmi.h>
  10082.      
  10083.      int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
  10084. Description
  10085. -----------
  10086. *Note DPMI Overview::
  10087. This function simulates a real-mode far call to a function that returns
  10088. with an `iret' instruction.  The registers are set up from REGS,
  10089. including `CS' and `IP', which indicate the address of the call.  Any
  10090. registers the function modifies are reflected in REGS on return.
  10091. If `SS' and `SP' are both zero, a small temporary stack is used when in
  10092. real mode.  If not, they are used AS IS.  It's a good idea to use
  10093. `memset' to initialize the register structure before using it.
  10094. Return Value
  10095. ------------
  10096. Zero on success, nonzero on failure.
  10097. Example
  10098. -------
  10099.      _go32_dpmi_registers r;
  10100.      r.x.ax = 47;
  10101.      r.x.cs = some_segment;
  10102.      r.x.ip = some_offset;
  10103.      r.x.ss = r.x.sp = 0;
  10104.      _go32_dpmi_simulate_fcall_iret(&r);
  10105.      printf("returns %d\n", r.x.ax);
  10106. File: libc.inf,  Node: _go32_dpmi_simulate_int,  Next: _go32_info_block,  Prev: _go32_dpmi_simulate_fcall_iret,  Up: Alphabetical List
  10107. _go32_dpmi_simulate_int
  10108. =======================
  10109. Syntax
  10110. ------
  10111.      #include <dpmi.h>
  10112.      
  10113.      int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
  10114. Description
  10115. -----------
  10116. *Note DPMI Overview::
  10117. This function simulates a real-mode interrup.  The registers are set up
  10118. from REGS, including `CS' and `IP', which indicate the address of the
  10119. call.  Any registers the function modifies are reflected in REGS on
  10120. return.
  10121. If `SS' and `SP' are both zero, a small temporary stack is used when in
  10122. real mode.  If not, they are used AS IS.  It's a good idea to use
  10123. `memset' to initialize the register structure before using it.
  10124. Return Value
  10125. ------------
  10126. Zero on success, nonzero on failure.
  10127. Example
  10128. -------
  10129.      _go32_dpmi_registers r;
  10130.      r.h.ah = 0x08;
  10131.      r.h.dl = 0x80; /* drive C: */
  10132.      r.x.ss = r.x.sp = 0;
  10133.      _go32_dpmi_simulate_int(0x13, &r);
  10134.      printf("disk is %d cyl, %d head, %d sect\n",
  10135.             r.h.ch | ((r.x.cl<<2)&0x300),
  10136.             r.h.dh, r.h.cl & 0x3f));
  10137. File: libc.inf,  Node: _go32_info_block,  Next: _go32_interrupt_stack_size,  Prev: _go32_dpmi_simulate_int,  Up: Alphabetical List
  10138. _go32_info_block
  10139. ================
  10140. Syntax
  10141. ------
  10142.      #include <go32.h>
  10143.      
  10144.      extern __Go32_Info_Block _go32_info_block;
  10145. Description
  10146. -----------
  10147. The go32 information block is a mechanism for `go32' to pass
  10148. information to the application.  Some of this information is generally
  10149. useful, such as the pid or the transfer buffer, while some is used
  10150. internally to `libc.a' only.
  10151. The structure has this format:
  10152.      typedef struct {
  10153.        unsigned long  size_of_this_structure_in_bytes;
  10154.        unsigned long  linear_address_of_primary_screen;
  10155.        unsigned long  linear_address_of_secondary_screen;
  10156.        unsigned long  linear_address_of_transfer_buffer;
  10157.        unsigned long  size_of_transfer_buffer;
  10158.        unsigned long  pid;
  10159.        unsigned char  master_interrupt_controller_base;
  10160.        unsigned char  slave_interrupt_controller_base;
  10161.        unsigned short selector_for_linear_memory;
  10162.        unsigned long  linear_address_of_stub_info_structure;
  10163.        unsigned long  linear_address_of_original_psp;
  10164.        unsigned short run_mode;
  10165.        unsigned short run_mode_info;
  10166.      } Go32_Info_Block;
  10167. The linear address fields provide values that are suitable for
  10168. `dosmemget', `dosmemput', and `movedata'.  The
  10169. selector_for_linear_memory is suitable for `<sys/farptr.h>' selector
  10170. parameters.
  10171. Due to the length of these fields, and their popularity, the following
  10172. macros are available:
  10173. `_dos_ds'
  10174.      This expands to _go32_info_block.selector_for_linear_memory
  10175. `__tb'
  10176.      This expands to _go32_info_block.linear_address_of_transfer_buffer
  10177. The `run_mode' field indicates the mode that the program is running in.
  10178. The following modes are defined:
  10179. `_GO32_RUN_MODE_UNDEF'
  10180.      This indicates that the extender did not (or could not) determine
  10181.      or provide the mode information.  The most probable reason is that
  10182.      it's an older extender that does not support this field.  The
  10183.      program should not assume anything about the run mode if it is
  10184.      this value.
  10185. `_GO32_RUN_MODE_RAW'
  10186.      This indicates that no CPU manager is being used, and no XMS
  10187.      manager is present.  The CPU is being managed directly from the
  10188.      extender, and memory was allocated from the extended memory pool.
  10189. `_GO32_RUN_MODE_XMS'
  10190.      This indicates that the extender is managing the CPU, but an XMS
  10191.      driver is managing the memory pool.
  10192. `_GO32_RUN_MODE_VCPI'
  10193.      This indicates that a VCPI server (like `emm386' or `qemm') is
  10194.      managing both the CPU and the memory.
  10195. `_GO32_RUN_MODE_DPMI'
  10196.      This indicates that a DPMI server (like `qdpmi' or Windows) is
  10197.      managing both the CPU and memory.  Programs may rely on this value
  10198.      to determine if it is safe to use DPMI 0.9 functions.
  10199.      If this value is set, the `run_mode_info' field has the DPMI
  10200.      specification version, in hex, shifted eight bits.  For example,
  10201.      DPMI 0.9 has 0x005A in the `run_mode_info' field.
  10202. Note that the program should not assume that the value will be one of
  10203. the listed values.  If the program is running with an extender that
  10204. provides some other mode (say, a newly released extender) then the
  10205. program should be able to handle that case gracefully.
  10206. Example
  10207. -------
  10208.      dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
  10209. File: libc.inf,  Node: _go32_interrupt_stack_size,  Next: _go32_my_cs,  Prev: _go32_info_block,  Up: Alphabetical List
  10210. _go32_interrupt_stack_size
  10211. ==========================
  10212. Syntax
  10213. ------
  10214.      #include <dpmi.h>
  10215.      
  10216.      extern unsigned long _go32_interrupt_stack_size;
  10217. Description
  10218. -----------
  10219. The default size of the interrupt handler's stack.  Defaults to 32k.
  10220. File: libc.inf,  Node: _go32_my_cs,  Next: _go32_my_ds,  Prev: _go32_interrupt_stack_size,  Up: Alphabetical List
  10221. _go32_my_cs
  10222. ===========
  10223. Syntax
  10224. ------
  10225.      #include <go32.h>
  10226.      
  10227.      u_short _go32_my_cs();
  10228. Description
  10229. -----------
  10230. Returns the current `CS'.  This is useful for setting up interrupt
  10231. vectors and such.
  10232. Return Value
  10233. ------------
  10234. File: libc.inf,  Node: _go32_my_ds,  Next: _go32_my_ss,  Prev: _go32_my_cs,  Up: Alphabetical List
  10235. _go32_my_ds
  10236. ===========
  10237. Syntax
  10238. ------
  10239.      #include <go32.h>
  10240.      
  10241.      u_short _go32_my_ds();
  10242. Description
  10243. -----------
  10244. Returns the current `DS'.  This is useful for moving memory and such.
  10245. Return Value
  10246. ------------
  10247. File: libc.inf,  Node: _go32_my_ss,  Next: _go32_rmcb_stack_size,  Prev: _go32_my_ds,  Up: Alphabetical List
  10248. _go32_my_ss
  10249. ===========
  10250. Syntax
  10251. ------
  10252.      #include <go32.h>
  10253.      
  10254.      u_short _go32_my_ss();
  10255. Description
  10256. -----------
  10257. Returns the current `SS'.  This is useful for moving memory and such.
  10258. Return Value
  10259. ------------
  10260. File: libc.inf,  Node: _go32_rmcb_stack_size,  Next: _go32_want_ctrl_break,  Prev: _go32_my_ss,  Up: Alphabetical List
  10261. _go32_rmcb_stack_size
  10262. =====================
  10263. Syntax
  10264. ------
  10265.      #include <dpmi.h>
  10266.      
  10267.      extern unsigned long _go32_rmcb_stack_size;
  10268. Description
  10269. -----------
  10270. The default size of the real mode callback handler's stack.  Defaults
  10271. to 32k.
  10272. File: libc.inf,  Node: _go32_want_ctrl_break,  Next: _go32_was_ctrl_break_hit,  Prev: _go32_rmcb_stack_size,  Up: Alphabetical List
  10273. _go32_want_ctrl_break
  10274. =====================
  10275. Syntax
  10276. ------
  10277.      #include <go32.h>
  10278.      
  10279.      void   _go32_want_ctrl_break(int yes);
  10280. Description
  10281. -----------
  10282. This function tells go32 whether or not it wants `Ctrl-Break' to be an
  10283. exception or passed to the application.  If you pass a nonzero value
  10284. for YES, pressing `Ctrl-Break' will set a flag that can be detected
  10285. with `_go32_was_ctrl_break_hit' (*note _go32_was_ctrl_break_hit::.).
  10286. If you pass zero for YES, When you press `Ctrl-Break' the program will
  10287. be terminated.
  10288. Note that if you call `_go32_was_ctrl_break_hit', this function
  10289. automatically gets called to ask for `Ctrl-Break' events.
  10290. Return Value
  10291. ------------
  10292. None.
  10293. Example
  10294. -------
  10295.      _g32_want_ctrl_break(1);
  10296.      do_something_long();
  10297.      _g32_want_ctrl_break(0);
  10298. File: libc.inf,  Node: _go32_was_ctrl_break_hit,  Next: gotoxy,  Prev: _go32_want_ctrl_break,  Up: Alphabetical List
  10299. _go32_was_ctrl_break_hit
  10300. ========================
  10301. Syntax
  10302. ------
  10303.      #include <go32.h>
  10304.      
  10305.      unsigned _go32_was_ctrl_break_hit(void);
  10306. Description
  10307. -----------
  10308. This function returns the number of times that `Ctrl-Break' was hit
  10309. since the last call to this function or `_go32_want_ctrl_break' (*note
  10310. _go32_want_ctrl_break::.).
  10311. Return Value
  10312. ------------
  10313. Zero if `Ctrl-Break' hasn't been hit, nonzero to indicate how many
  10314. times if it has been hit.
  10315. Note that `_go32_want_ctrl_break' is automatically called to request
  10316. these events, so you don't have to set up for this call.
  10317. Example
  10318. -------
  10319.      while (!_go32_was_ctrl_break_hit())
  10320.        do_something();
  10321. File: libc.inf,  Node: gotoxy,  Next: gppconio_init,  Prev: _go32_was_ctrl_break_hit,  Up: Alphabetical List
  10322. gotoxy
  10323. ======
  10324. Syntax
  10325. ------
  10326.      #include <conio.h>
  10327.      
  10328.      void gotoxy(int x, int y);
  10329. Description
  10330. -----------
  10331. Move the cursor to row y, column x.  The upper left corner of the
  10332. current window is (1,1).
  10333. File: libc.inf,  Node: gppconio_init,  Next: hasmntopt,  Prev: gotoxy,  Up: Alphabetical List
  10334. gppconio_init
  10335. =============
  10336. Syntax
  10337. ------
  10338.      #include <conio.h>
  10339.      
  10340.      void gppconio_init(void);
  10341. Description
  10342. -----------
  10343. Initialize the screen.  This is called automatically at program start-up
  10344. if you use any of the `conio' functions, but there may be times when
  10345. you need to call it again, typically after calling some video BIOS
  10346. function which affects screen parameters.
  10347. File: libc.inf,  Node: hasmntopt,  Next: highvideo,  Prev: gppconio_init,  Up: Alphabetical List
  10348. hasmntopt
  10349. =========
  10350. Syntax
  10351. ------
  10352.      #include <mntent.h>
  10353.      
  10354.      char *hasmntopt(const struct mntent *mnt, const char *opt);
  10355. Description
  10356. -----------
  10357. This function scans the `mnt_opts' field of the `mntent' structure MNT
  10358. for a substring that matches OPT.  *Note getmntent::.
  10359. Return Value
  10360. ------------
  10361. This function returns the address of the substring if a match is found,
  10362. or `NULL' otherwise.
  10363. File: libc.inf,  Node: highvideo,  Next: htonl,  Prev: hasmntopt,  Up: Alphabetical List
  10364. highvideo
  10365. =========
  10366. Syntax
  10367. ------
  10368.      #include <conio.h>
  10369.      
  10370.      void highvideo(void);
  10371. Description
  10372. -----------
  10373. Causes any new characters put on the screen to be bright.
  10374. File: libc.inf,  Node: htonl,  Next: htons,  Prev: highvideo,  Up: Alphabetical List
  10375. htonl
  10376. =====
  10377. Syntax
  10378. ------
  10379.      #include <netinet/in.h>
  10380.      
  10381.      unsigned long htonl(unsigned long val);
  10382. Description
  10383. -----------
  10384. This function converts from host formatted longs to network formatted
  10385. longs.  For the i386 and higher processors, this means that the bytes
  10386. are swapped from 1234 order to 4321 order.
  10387. Return Value
  10388. ------------
  10389. The network-order value.
  10390. Example
  10391. -------
  10392.      packet.ipaddr = htonl(ip);
  10393. File: libc.inf,  Node: htons,  Next: hypot,  Prev: htonl,  Up: Alphabetical List
  10394. htons
  10395. =====
  10396. Syntax
  10397. ------
  10398.      #include <netinet/in.h>
  10399.      
  10400.      unsigned short htons(unsigned short val);
  10401. Description
  10402. -----------
  10403. This function converts from host formatted shorts to network formatted
  10404. shorts.  For the i386 and higher processors, this means that the bytes
  10405. are swapped from 12 order to 21 order.
  10406. Return Value
  10407. ------------
  10408. The network-order value.
  10409. Example
  10410. -------
  10411.      tcp.port = htons(port);
  10412. File: libc.inf,  Node: hypot,  Next: inb,  Prev: htons,  Up: Alphabetical List
  10413. hypot
  10414. =====
  10415. Syntax
  10416. ------
  10417.      #include <math.h>
  10418.      
  10419.      double hypot(double x, double y);
  10420. Return Value
  10421. ------------
  10422. The length of a hypotenuse of a right triangle whose shorter sides are
  10423. X and Y.  In other words, the distance between (0,0) and (X,Y).
  10424. File: libc.inf,  Node: inb,  Next: index,  Prev: hypot,  Up: Alphabetical List
  10425. Syntax
  10426. ------
  10427.      #include <pc.h>
  10428.      
  10429.      unsigned char inb(unsigned short _port);
  10430. Description
  10431. -----------
  10432. Calls *Note inportb::. Provided only for compatibility.
  10433. File: libc.inf,  Node: index,  Next: inp,  Prev: inb,  Up: Alphabetical List
  10434. index
  10435. =====
  10436. Syntax
  10437. ------
  10438.      #include <strings.h>
  10439.      
  10440.      char *index(const char *string, int ch);
  10441. Description
  10442. -----------
  10443. Returns a pointer to the first occurrence of CH in STRING.  Note that
  10444. the `NULL' character counts, so if you pass zero as CH you'll get a
  10445. pointer to the end of the string back.
  10446. Return Value
  10447. ------------
  10448. A pointer to the character, or `NULL' if it wasn't found.
  10449. Example
  10450. -------
  10451.      if (index(path, '*'))
  10452.        do_wildcards(path);
  10453. File: libc.inf,  Node: inp,  Next: inportb,  Prev: index,  Up: Alphabetical List
  10454. Syntax
  10455. ------
  10456.      #include <pc.h>
  10457.      
  10458.      unsigned char inp(unsigned short _port);
  10459. Description
  10460. -----------
  10461. Calls *Note inportb::.  Provided only for compatibility.
  10462. File: libc.inf,  Node: inportb,  Next: inportl,  Prev: inp,  Up: Alphabetical List
  10463. inportb
  10464. =======
  10465. Syntax
  10466. ------
  10467.      #include <pc.h>
  10468.      
  10469.      unsigned char inportb(unsigned short _port);
  10470. Description
  10471. -----------
  10472. Read a single 8-bit I/O port.
  10473. This function is provided as an inline assembler macro, and will be
  10474. optimized down to a single opcode when you optimize your program.
  10475. Return Value
  10476. ------------
  10477. The value returned through the port.
  10478. File: libc.inf,  Node: inportl,  Next: inportsb,  Prev: inportb,  Up: Alphabetical List
  10479. inportl
  10480. =======
  10481. Syntax
  10482. ------
  10483.      #include <pc.h>
  10484.      
  10485.      unsigned long inportl(unsigned short _port);
  10486. Description
  10487. -----------
  10488. This function reads a single 32-bit I/O port.
  10489. This function is provided as an inline assembler macro, and will be
  10490. optimized down to a single opcode when you optimize your program.
  10491. Return Value
  10492. ------------
  10493. The value returned from the port.
  10494. File: libc.inf,  Node: inportsb,  Next: inportsl,  Prev: inportl,  Up: Alphabetical List
  10495. inportsb
  10496. ========
  10497. Syntax
  10498. ------
  10499.      #include <pc.h>
  10500.      
  10501.      void inportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  10502. Description
  10503. -----------
  10504. Reads the 8-bit _PORT _LEN times, and stores the bytes in BUF.
  10505. File: libc.inf,  Node: inportsl,  Next: inportsw,  Prev: inportsb,  Up: Alphabetical List
  10506. inportsl
  10507. ========
  10508. Syntax
  10509. ------
  10510.      #include <pc.h>
  10511.      
  10512.      void inportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  10513. Description
  10514. -----------
  10515. Reads the 32-bit _PORT _LEN times, and stores the bytes in BUF.
  10516. File: libc.inf,  Node: inportsw,  Next: inportw,  Prev: inportsl,  Up: Alphabetical List
  10517. inportsw
  10518. ========
  10519. Syntax
  10520. ------
  10521.      #include <pc.h>
  10522.      
  10523.      void inportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  10524. Description
  10525. -----------
  10526. Reads the 16-bit _PORT _LEN times, and stores the bytes in BUF.
  10527. File: libc.inf,  Node: inportw,  Next: inpw,  Prev: inportsw,  Up: Alphabetical List
  10528. inportw
  10529. =======
  10530. Syntax
  10531. ------
  10532.      #include <pc.h>
  10533.      
  10534.      unsigned short inportw(unsigned short _port);
  10535. Description
  10536. -----------
  10537. Read a single 16-bit I/O port.
  10538. This function is provided as an inline assembler macro, and will be
  10539. optimized down to a single opcode when you optimize your program.
  10540. Return Value
  10541. ------------
  10542. The value returned through the port.
  10543. File: libc.inf,  Node: inpw,  Next: insline,  Prev: inportw,  Up: Alphabetical List
  10544. Syntax
  10545. ------
  10546.      #include <pc.h>
  10547.      
  10548.      unsigned short inpw(unsigned short _port);
  10549. Description
  10550. -----------
  10551. Calls *Note inportw::.  Provided only for compatibility.
  10552. File: libc.inf,  Node: insline,  Next: insque,  Prev: inpw,  Up: Alphabetical List
  10553. insline
  10554. =======
  10555. Syntax
  10556. ------
  10557.      #include <conio.h>
  10558.      
  10559.      void insline(void);
  10560. Description
  10561. -----------
  10562. A blank line is inserted at the current cursor position.  The previous
  10563. line and lines below it scroll down.
  10564. File: libc.inf,  Node: insque,  Next: int386,  Prev: insline,  Up: Alphabetical List
  10565. insque
  10566. ======
  10567. Syntax
  10568. ------
  10569.      #include <search.h>
  10570.      
  10571.      void insque(struct qelem *elem, struct qelem *pred);
  10572. Description
  10573. -----------
  10574. This function manipulates queues built from doubly linked lists.  Each
  10575. element in the queue must be in the form of `struct qelem' which is
  10576. defined thus:
  10577.      struct qelem {
  10578.        struct qelem *q_forw;
  10579.        struct qelem *q_back;
  10580.        char q_data[0];
  10581.      }
  10582. This function inserts ELEM in a queue immediately after PRED.
  10583. Return Value
  10584. ------------
  10585. None.
  10586. File: libc.inf,  Node: int386,  Next: int386x,  Prev: insque,  Up: Alphabetical List
  10587. int386
  10588. ======
  10589. Syntax
  10590. ------
  10591.      #include <dos.h>
  10592.      
  10593.      int int386(int ivec, union REGS *in, union REGS *out);
  10594. Description
  10595. -----------
  10596. This function is equal to `int86' function.  See *Note int86:: for
  10597. further description.
  10598. Return Value
  10599. ------------
  10600. The returned value of `EAX'.
  10601. File: libc.inf,  Node: int386x,  Next: int86,  Prev: int386,  Up: Alphabetical List
  10602. int386x
  10603. =======
  10604. Syntax
  10605. ------
  10606.      #include <dos.h>
  10607.      
  10608.      int int386x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  10609. Description
  10610. -----------
  10611. This function is equal to `int86x'.  See *Note int86:: for further
  10612. description.
  10613. Return Value
  10614. ------------
  10615. The value of `EAX' is returned.
  10616. File: libc.inf,  Node: int86,  Next: int86x,  Prev: int386x,  Up: Alphabetical List
  10617. int86
  10618. =====
  10619. Syntax
  10620. ------
  10621.      #include <dos.h>
  10622.      
  10623.      int int86(int ivec, union REGS *in, union REGS *out);
  10624. Description
  10625. -----------
  10626. Note: The `.x.' branch is a problem generator.  Most code expects the
  10627. `.x.' branch to have e.g. "`.x.ax'" members, and that they are 16-bit.
  10628. If you know you want 32-bit values, use the `.d.eax' members.  If you
  10629. know you want 16-bit values, use the `.w.ax' members.  The `.x.'
  10630. members behave according to `#defines', as follows:
  10631. `default'
  10632.      If you specify no `#define', the `.x.' branch has "`ax'" members
  10633.      and is 32-bit.  This is compatible with previous versions of djgpp.
  10634. `_NAIVE_DOS_REGS'
  10635.      This define gives you `.x.ax', but they are 16-bit.  This is
  10636.      probably what most programs ported from 16-bit dos compilers will
  10637.      want.
  10638. `_BORLAND_DOS_REGS'
  10639.      This define gives you `.x.eax' which are 32-bit.  This is
  10640.      compatible with Borland's 32-bit compilers.
  10641. This function simulates a software interrupt.  Note that, unlike the
  10642. `__dpmi_int' function, requests that go through `int86' and similar
  10643. functions are specially processed to make them suitable for invoking
  10644. real-mode interrupts from protected-mode programs.  For example, if a
  10645. particular routine takes a pointer in `BX', `int86' expects you to put
  10646. a (protected-mode) pointer in `EBX'.  Therefore, `int86' should have
  10647. specific support for every interrupt and function you invoke this way.
  10648. Currently, it supports only a subset of all available interrupts and
  10649. functions:
  10650. 1) All functions of any interrupt which expects only scalar arguments
  10651. registers (i.e., no pointers to buffers).
  10652. 2) In addition, the following functions of interrupt 21h are supported:
  10653. 9, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Fh, 40h, 41h, 43h, 47h, 56h.
  10654. When the interrupt is invoked, the CPU registers are copied from IN.
  10655. After the interrupt, the CPU registers are copied to OUT.
  10656. This function is just like `int86x' (*note int86x::.) except that
  10657. suitable default values are used for the segment registers.
  10658. *Note int86x::. *Note intdos::. *Note bdos::.
  10659. Return Value
  10660. ------------
  10661. The returned value of `EAX'.
  10662. Example
  10663. -------
  10664.      union REGS r;
  10665.      r.x.ax = 0x0100;
  10666.      r.h.dl = 'c';
  10667.      int86(0x21, &r, &r);
  10668. File: libc.inf,  Node: int86x,  Next: intdos,  Prev: int86,  Up: Alphabetical List
  10669. int86x
  10670. ======
  10671. Syntax
  10672. ------
  10673.      #include <dos.h>
  10674.      
  10675.      int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  10676. Description
  10677. -----------
  10678. This function is just like `int86' (*note int86::.) except that values
  10679. you pass in SREGS are used for the segment registers instead of the
  10680. defaults.
  10681. *Note int86::. *Note intdos::. *Note bdos::.
  10682. Return Value
  10683. ------------
  10684. The value of `EAX' is returned.
  10685. Example
  10686. -------
  10687.      union REGS r;
  10688.      struct SREGS s;
  10689.      r.h.ah = 0x31;
  10690.      r.h.dl = 'c';
  10691.      r.x.si = si_val;
  10692.      s.ds = ds_val;
  10693.      int86x(0x21, &r, &r, &s);
  10694. File: libc.inf,  Node: intdos,  Next: intdosx,  Prev: int86x,  Up: Alphabetical List
  10695. intdos
  10696. ======
  10697. Syntax
  10698. ------
  10699.      #include <dos.h>
  10700.      
  10701.      int intdos(union REGS *in, union REGS *out);
  10702. Description
  10703. -----------
  10704. This function is just like `int86' (*note int86x::.) except that the
  10705. interrupt vector is 0x21.
  10706. Return Value
  10707. ------------
  10708. `EAX'
  10709. File: libc.inf,  Node: intdosx,  Next: intensevideo,  Prev: intdos,  Up: Alphabetical List
  10710. intdosx
  10711. =======
  10712. Syntax
  10713. ------
  10714.      #include <dos.h>
  10715.      
  10716.      int intdosx(union REGS *in, union REGS *out, struct SREGS *s);
  10717. Description
  10718. -----------
  10719. This function is just like `int86x' (*note int86x::.) except that the
  10720. interrupt vector is 0x21.
  10721. Return Value
  10722. ------------
  10723. `EAX'
  10724. File: libc.inf,  Node: intensevideo,  Next: ioctl (DOS),  Prev: intdosx,  Up: Alphabetical List
  10725. intensevideo
  10726. ============
  10727. Syntax
  10728. ------
  10729.      #include <conio.h>
  10730.      void intensevideo(void);
  10731. Description
  10732. -----------
  10733. Bit 7 (`MSB') of the character attribute byte has two possible effects
  10734. on EGA and VGA displays: it can either make the character blink or
  10735. change the background color to bright (thus allowing for 16 background
  10736. colors as opposed to the usual 8).  This function sets that bit to
  10737. display bright background colors.  After a call to this function, every
  10738. character written to the screen with bit 7 of the attribute byte set,
  10739. will have a bright background color.  The companion function
  10740. `blinkvideo' (*note blinkvideo::.) has the opposite effect.
  10741. Note that there is no BIOS function to get the current status of this
  10742. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  10743. the current state: if it's 1 (the default), blinking characters will be
  10744. displayed.
  10745. File: libc.inf,  Node: ioctl (DOS),  Next: ioctl (General description),  Prev: intensevideo,  Up: Alphabetical List
  10746. ioctl (DOS)
  10747. ===========
  10748. The DOSish version of `ioctl' performs an interrupt 0x21, function
  10749. 0x44. It takes care of supplying transfer buffers in low address
  10750. regions, if they are needed. For an exhaustive description of the
  10751. various commands and subcommands, see Ralph Browns interrupt list.
  10752. It is highly recommended to use only the DOS_* functions listed in
  10753. `sys/ioctl.h'.
  10754. Syntax
  10755. ------
  10756. ioctl(fd, cmd, ... );
  10757.      #include <sys/ioctl.h>
  10758.      int main(int argc, char **argv){
  10759.         char buf[6];
  10760.         short *s;
  10761.      
  10762.         open(fd,"EMMQXXX0",O_RDONLY);
  10763.         mybuf[0] = '\0';
  10764.         s = mybuf;
  10765.         ioctl(fd,DOS_SNDDATA,6, (int) &mybuf);
  10766.         if(*s ==0x25 )printf("EMM386 >= 4.45\n");
  10767.         mybuf[0]='\x02';
  10768.         ioctl(fd,DOS_SNDDATA,2,(int )&mybuf);
  10769.         printf("EMM Version %d.%d\n",(int )mybuf[0],(int) mybuf[1]);
  10770.         close(fd);
  10771.      }
  10772. Description
  10773. -----------
  10774. The parameter `fd' must refer to a file descriptor for character device
  10775. functions, or the number of a block device (usually current=0, A:=1,
  10776. ...).
  10777. The following constants can be used for the `cmd' parameter:
  10778. `DOS_GETDEVDATA'
  10779.      Get device information. Returns the device information word from
  10780.      `DX'.
  10781. `DOS_SETDEVDATA'
  10782.      Set device information. Returns the new device information word
  10783.      form `DX' or -1
  10784. `DOS_RCVDATA'
  10785.      Read from character device control channel. After `cmd' must
  10786.      follow the number of requested bytes to read and a pointer to a
  10787.      buffer. Returns the number of bytes actually read or -1 on error.
  10788. `DOS_SNDDATA'
  10789.      Write to character device control channel. After `cmd' must follow
  10790.      the number of bytes to write and a pointer to a buffer holding the
  10791.      data.  Returns the number of bytes actually written.
  10792. `DOS_RCVCTLDATA'
  10793.      Read from block device control channel. See `DOS_RCVDATA'.
  10794. `DOS_SNDCTLDATA'
  10795.      Write to block device control channel. See `DOS_SNDDATA'.
  10796. `DOS_CHKINSTAT'
  10797.      Check the input status of a file. Returns 0 if not ready of at
  10798.      EOF, `0xff' if file is ready.
  10799. `DOS_CHKOUTSTAT'
  10800.      Check the output status of a file. Returns 0 if not ready of at
  10801.      EOF, `0xff' if file is ready.
  10802. `DOS_ISCHANGEABLE'
  10803.      Check if a block device is changeable. Returns 0 for removable or
  10804.      1 for fixed.
  10805. `DOS_ISREDIRBLK'
  10806.      Check if a block device is remote o local.
  10807. `DOS_ISREDIRHND'
  10808.      Check if a file handle refers to a local or remote device.
  10809. `DOS_SETRETRY'
  10810.      Set the sharing retry count. the first extra parameter specifies
  10811.      the pause between retries, the second number of retries.
  10812. `DOS_GENCHARREQ'
  10813.      Generic character device request.
  10814. `DOS_GENBLKREQ'
  10815.      Generic block device request.
  10816. `DOS_GLDRVMAP'
  10817.      Get logical drive map.
  10818. `DOS_SLDRVMAP'
  10819.      Set logical drive map.
  10820. `DOS_QGIOCTLCAPH'
  10821.      Query generic ioctl capability (handle). Test if a handle supports
  10822.      ioctl functions beyond those in the standard DOS 3.2 set.
  10823. `DOS_QGIOCTLCAPD'
  10824.      Query generic ioctl capability (drive). Test if a drive supports
  10825.      ioctl functions beyond those in the standard DOS 3.2 set.
  10826. If your specific device driver requires different commands, they must
  10827. be or'ed together with the flags listed in `ioctl.h' to tell the drive
  10828. about transfer buffers and what to return.
  10829. Return Value
  10830. ------------
  10831. See description above.
  10832. Device information word
  10833. -----------------------
  10834. The bits of the device information word have the following meaning:\\
  10835. Character device:
  10836.      14  Device driver can process IOCTL request
  10837.      13  output until busy supported
  10838.      11  driver supports OPEN/CLOSE calls
  10839.      7   set (indicates device)
  10840.      6   EOF on input
  10841.      5   raw (binary) mode
  10842.      4   device is special (uses INT 29)
  10843.      3   clock device
  10844.      2   NUL device
  10845.      1   standard output
  10846.      0   standard input
  10847. Disk file:
  10848.      15  file is remote (DOS 3.0+)
  10849.      14  don't set file date/time on closing (DOS 3.0+)
  10850.      11  media not removable
  10851.      8   (DOS 4 only) generate INT 24 if no disk space on write or read
  10852.      past end of file
  10853.      7   clear (indicates file)
  10854.      6   file has not been written
  10855.      5-0 drive number (0 = A:)
  10856. File: libc.inf,  Node: ioctl (General description),  Next: ioctl (UNIX),  Prev: ioctl (DOS),  Up: Alphabetical List
  10857. ioctl (General description)
  10858. ===========================
  10859. `ioctl' performs low level calls to communicate with device drivers. As
  10860. there are lots of different device drivers, no really general
  10861. description is possible.
  10862. The DJGPP version tries to cope two different flavors of `ioctl', a
  10863. DOSish and a UNIXish way. To distinguish between DOS-like and UNIX-like
  10864. calls, all valid DOS commands have the 3 MSB set to 0, the UNIX command
  10865. have at least one of the 3 MSB set.
  10866. File: libc.inf,  Node: ioctl (UNIX),  Next: _is_executable,  Prev: ioctl (General description),  Up: Alphabetical List
  10867. ioctl (UNIX)
  10868. ============
  10869. The UNIX version first checks if an FSE handler is associated to the
  10870. file descriptor. If so, it calls the handler in the usual way *Note
  10871. File System Extensions::. Otherwise it sets ERRNO to `ENOTTY' and
  10872. returns -1.
  10873. As this part is still under development, it should not be used
  10874. exhaustively.
  10875. File: libc.inf,  Node: _is_executable,  Next: isalnum,  Prev: ioctl (UNIX),  Up: Alphabetical List
  10876. _is_executable
  10877. ==============
  10878. Syntax
  10879. ------
  10880.      #include <sys/stat.h>
  10881.      
  10882.      int _is_executable(const char *path, int fhandle, const char *extension);
  10883. Description
  10884. -----------
  10885. This function determines if a file is executable under DOS/DJGPP
  10886. environment.  The file may be given either by its PATH or its file
  10887. handle FHANDLE.  If EXTENSION is non-NULL and non-empty, it is used
  10888. first to look up in a list of known extensions which determine whether
  10889. the file is executable.  (If the _STAT_EXEC_EXT bit of the *Note
  10890. _djstat_flags:: global variable is not set, this step is skipped.) If
  10891. EXTENSION is unavailable or not enough to determine the result, the
  10892. first 2 bytes of the file are checked to contain one of the known
  10893. `magic numbers' identifying the file as executable.  If the file's 2
  10894. first bytes need to be read but the read fails, 0 is returned and errno
  10895. is set.  (The file is only searched for magic number if the
  10896. _STAT_EXEC_MAGIC bit of the *Note _djstat_flags:: variable is set.)
  10897. Note that if _STAT_EXEC_MAGIC is set, but _STAT_EXEC_EXT is not, some
  10898. files which shouldn't be flagged as executables (e.g., COFF *.o object
  10899. files) will have their execute bit set, because they have the magic
  10900. number signature at their beginning.  Therefore, only use the above
  10901. combination if you want to debug the list of extensions provided in
  10902. is_exec.c file.
  10903. If the file passed by its handle was open as write-only, and the
  10904. extension alone isn't enough to determine whether the file is
  10905. executable, then this function returns 0, because it cannot look at the
  10906. `magic number'.
  10907. This function is used internally by `f?stat()'; you are not supposed to
  10908. call it directly.
  10909. Return Value
  10910. ------------
  10911. 1 for executable file, 0 otherwise (including in case of errors in
  10912. accessing the file).
  10913. File: libc.inf,  Node: isalnum,  Next: isalpha,  Prev: _is_executable,  Up: Alphabetical List
  10914. isalnum
  10915. =======
  10916. Syntax
  10917. ------
  10918.      #include <ctype.h>
  10919.      
  10920.      int isalnum(int c);
  10921. Description
  10922. -----------
  10923. Tells if C is any letter or digit.
  10924. Return Value
  10925. ------------
  10926. Nonzero if C is a letter or digit, else zero.
  10927. Example
  10928. -------
  10929. File: libc.inf,  Node: isalpha,  Next: isascii,  Prev: isalnum,  Up: Alphabetical List
  10930. isalpha
  10931. =======
  10932. Syntax
  10933. ------
  10934.      #include <ctype.h>
  10935.      
  10936.      int isalpha(int c);
  10937. Description
  10938. -----------
  10939. Tells if C is a letter.
  10940. Return Value
  10941. ------------
  10942. Nonzero if C is a letter, else zero.
  10943. File: libc.inf,  Node: isascii,  Next: isatty,  Prev: isalpha,  Up: Alphabetical List
  10944. isascii
  10945. =======
  10946. Syntax
  10947. ------
  10948.      #include <ctype.h>
  10949.      
  10950.      int isascii(int c);
  10951. Description
  10952. -----------
  10953. Tells if C is an ASCII character (0x00 to 0x7f).
  10954. Return Value
  10955. ------------
  10956. Nonzero if C is ASCII, else zero.
  10957. File: libc.inf,  Node: isatty,  Next: iscntrl,  Prev: isascii,  Up: Alphabetical List
  10958. isatty
  10959. ======
  10960. Syntax
  10961. ------
  10962.      #include <unistd.h>
  10963.      
  10964.      int isatty(int fd);
  10965. Description
  10966. -----------
  10967. Tells if the file descriptor refers to a terminal device or not.
  10968. Return Value
  10969. ------------
  10970. Nonzero if FD is a terminal device, zero  otherwise.
  10971. Example
  10972. -------
  10973.      if (isatty(1))
  10974.        fflush(stdout);
  10975. File: libc.inf,  Node: iscntrl,  Next: isdigit,  Prev: isatty,  Up: Alphabetical List
  10976. iscntrl
  10977. =======
  10978. Syntax
  10979. ------
  10980.      #include <ctype.h>
  10981.      
  10982.      int iscntrl(int c);
  10983. Description
  10984. -----------
  10985. Tells if C is a control character.
  10986. Return Value
  10987. ------------
  10988. Nonzero if C is a control character, else zero.
  10989. File: libc.inf,  Node: isdigit,  Next: isgraph,  Prev: iscntrl,  Up: Alphabetical List
  10990. isdigit
  10991. =======
  10992. Syntax
  10993. ------
  10994.      #include <ctype.h>
  10995.      
  10996.      int isdigit(int c);
  10997. Description
  10998. -----------
  10999. Tells if C is a digit.
  11000. Return Value
  11001. ------------
  11002. Nonzero if C is a digit, else zero.
  11003. File: libc.inf,  Node: isgraph,  Next: islower,  Prev: isdigit,  Up: Alphabetical List
  11004. isgraph
  11005. =======
  11006. Syntax
  11007. ------
  11008.      #include <ctype.h>
  11009.      
  11010.      int isgraph(int c);
  11011. Description
  11012. -----------
  11013. Tells if C is a visible printing character.  Space is not included.
  11014. Return Value
  11015. ------------
  11016. Nonzero if C is a visible printing character, else zero.
  11017. File: libc.inf,  Node: islower,  Next: isprint,  Prev: isgraph,  Up: Alphabetical List
  11018. islower
  11019. =======
  11020. Syntax
  11021. ------
  11022.      #include <ctype.h>
  11023.      
  11024.      int islower(int c);
  11025. Description
  11026. -----------
  11027. Tells if C is lower case or not.
  11028. Return Value
  11029. ------------
  11030. Nonzero if C is lower case, else zero.
  11031. File: libc.inf,  Node: isprint,  Next: ispunct,  Prev: islower,  Up: Alphabetical List
  11032. isprint
  11033. =======
  11034. Syntax
  11035. ------
  11036.      #include <ctype.h>
  11037.      
  11038.      int isprint(int c);
  11039. Description
  11040. -----------
  11041. Tells if C is a printing character, which includes the space character.
  11042. Return Value
  11043. ------------
  11044. Nonzero if C is a printing character, else zero.
  11045. File: libc.inf,  Node: ispunct,  Next: isspace,  Prev: isprint,  Up: Alphabetical List
  11046. ispunct
  11047. =======
  11048. Syntax
  11049. ------
  11050.      #include <ctype.h>
  11051.      
  11052.      int ispunct(int c);
  11053. Description
  11054. -----------
  11055. Tells if C is any printing character except space and those indicated
  11056. by `isalnum'.
  11057. Return Value
  11058. ------------
  11059. Nonzero if C is punctuation, else zero.
  11060. File: libc.inf,  Node: isspace,  Next: isupper,  Prev: ispunct,  Up: Alphabetical List
  11061. isspace
  11062. =======
  11063. Syntax
  11064. ------
  11065.      #include <ctype.h>
  11066.      
  11067.      int isspace(int c);
  11068. Description
  11069. -----------
  11070. Tells if C is whitespace, that is, carriage return, newline, form feed,
  11071. tab, vertical tab, or space.
  11072. Return Value
  11073. ------------
  11074. Nonzero if C is whitespace, else zero.
  11075. File: libc.inf,  Node: isupper,  Next: isxdigit,  Prev: isspace,  Up: Alphabetical List
  11076. isupper
  11077. =======
  11078. Syntax
  11079. ------
  11080.      #include <ctype.h>
  11081.      
  11082.      int isupper(int c);
  11083. Description
  11084. -----------
  11085. Tells if C is an upper case character or not.
  11086. Return Value
  11087. ------------
  11088. Nonzero if C is upper case, else zero.
  11089. File: libc.inf,  Node: isxdigit,  Next: itoa,  Prev: isupper,  Up: Alphabetical List
  11090. isxdigit
  11091. ========
  11092. Syntax
  11093. ------
  11094.      #include <ctype.h>
  11095.      
  11096.      int isxdigit(int c);
  11097. Description
  11098. -----------
  11099. Tells if C is a valid hexidecimal digit or not.  This includes
  11100. `[0-9a-fA-F]'.
  11101. Return Value
  11102. ------------
  11103. Nonzero if C is a hex digit, else zero.
  11104. File: libc.inf,  Node: itoa,  Next: kbhit,  Prev: isxdigit,  Up: Alphabetical List
  11105. Syntax
  11106. ------
  11107.      #include <stdlib.h>
  11108.      
  11109.      char * itoa(int value, char *string, int radix)
  11110. Description
  11111. -----------
  11112. This function converts its argument VALUE into a null-terminated
  11113. character string using RADIX as the base of the number system.  The
  11114. resulting string with a length of upto 33 bytes (including the optional
  11115. sign and the terminating `NULL' is put into the buffer whose address is
  11116. given by STRING.  For radixes other than 10, VALUE is treated as an
  11117. unsigned int (i.e., the sign bit is not interpreted as such).  The
  11118. argument RADIX should specify the base, between 2 and 36, in which the
  11119. string reprsentation of VALUE is requested.
  11120. Return Value
  11121. ------------
  11122. A pointer to STRING.
  11123. Example
  11124. -------
  11125.      char binary_str[33];
  11126.      
  11127.      (void)itoa(num, binary_str, 2);
  11128. File: libc.inf,  Node: kbhit,  Next: kill,  Prev: itoa,  Up: Alphabetical List
  11129. kbhit
  11130. =====
  11131. Syntax
  11132. ------
  11133.      #include <pc.h>
  11134.      
  11135.      int kbhit(void);
  11136. Description
  11137. -----------
  11138. If the user has hit a key, this function will detect it.  This function
  11139. is very fast when there is no key waiting, so it may be used inside
  11140. loops as needed.
  11141. If you test shift/alt/ctrl status with bios calls (e.g., using `bioskey
  11142. (2)' or `bioskey (0x12)') then you should also use bios calls for
  11143. testing for keys.  This can be done with by `bioskey (1)' or `bioskey
  11144. (0x11)'.  Failing to do so can cause trouble in multitasking
  11145. environments like DESQview/X.
  11146. Return Value
  11147. ------------
  11148. Nonzero if a key has been hit, else zero.
  11149. Example
  11150. -------
  11151.      while (!kbhit())
  11152.        do_stuff();
  11153. File: libc.inf,  Node: kill,  Next: labs,  Prev: kbhit,  Up: Alphabetical List
  11154.      #include <signal.h>
  11155.      
  11156.      int    kill(pid_t _pid, int _sig);
  11157. Description
  11158. -----------
  11159. If _PID is the current `getpid()', the given _SIG is raised with *Note
  11160. raise::.
  11161. Return Value
  11162. ------------
  11163. -1 on error, else zero.
  11164. File: libc.inf,  Node: labs,  Next: ldexp,  Prev: kill,  Up: Alphabetical List
  11165. Syntax
  11166. ------
  11167.      #include <stdlib.h>
  11168.      
  11169.      long labs(long x);
  11170. Description
  11171. -----------
  11172. This function takes the absolute value of X.  *Note abs::.
  11173. Return Value
  11174. ------------
  11175. File: libc.inf,  Node: ldexp,  Next: ldiv,  Prev: labs,  Up: Alphabetical List
  11176. ldexp
  11177. =====
  11178. Syntax
  11179. ------
  11180.      #include <math.h>
  11181.      
  11182.      double ldexp(double val, int exp);
  11183. Return Value
  11184. ------------
  11185. This function returns VAL * 2 ** EXP.
  11186. Example
  11187. -------
  11188.      ldexp(3.5,4) == 3.5 * 16 == 56.0
  11189. File: libc.inf,  Node: ldiv,  Next: _lfn_gen_short_fname,  Prev: ldexp,  Up: Alphabetical List
  11190. Syntax
  11191. ------
  11192.      #include <stdlib.h>
  11193.      
  11194.      ldiv_t ldiv(long numerator, long denomonator);
  11195. Description
  11196. -----------
  11197. Returns the quotient and remainder of the division NUMBERATOR divided
  11198. by DENOMONATOR.  The return type is as follows:
  11199.      typedef struct {
  11200.        long quot;
  11201.        long rem;
  11202.      } ldiv_t;
  11203. Return Value
  11204. ------------
  11205. The results of the division are returned.
  11206. Example
  11207. -------
  11208.      ldiv_t l = ldiv(42, 3);
  11209.      printf("42 = %ld x 3 + %ld\n", l.quot, l.rem);
  11210.      
  11211.      ldiv(+40, +3) = { +13, +1 }
  11212.      ldiv(+40, -3) = { -13, -1 }
  11213.      ldiv(-40, +3) = { -13, -1 }
  11214.      ldiv(-40, -3) = { +13, -1 }
  11215. File: libc.inf,  Node: _lfn_gen_short_fname,  Next: _lfn_get_ftime,  Prev: ldiv,  Up: Alphabetical List
  11216. _lfn_gen_short_fname
  11217. ====================
  11218. Syntax
  11219. ------
  11220.      #include <fcntl.h>
  11221.      
  11222.      char _lfn_gen_short_fname (const char *long_fname, char *short_fname);
  11223. Description
  11224. -----------
  11225. This function generates a short (8+3) filename alias for the long
  11226. filename pointed to by LONG_FNAME and puts it into the buffer pointed
  11227. to by SHORT_FNAME.  It uses the same algorithm that Windows 9x uses,
  11228. with the exception that the returned short name will never have a
  11229. numeric tail, because this function doesn't check the directory to see
  11230. whether the generated short name will collide with any other file in
  11231. the directory.  Note that LONG_FNAME must contain only the name part of
  11232. a file; elements of a full pathname (like `:' or `/' are not allowed
  11233. (they will cause the function to fail).  SHORT_FNAME will be returned
  11234. upper-cased, since that is how 8+3 filenames are stored in directory
  11235. entries.
  11236. When the LFN API is not supported (*note _use_lfn::.), the function
  11237. simply converts up to 12 characters of LONG_FNAME to upper-case and
  11238. returns that.  It will do the same if LONG_FNAME includes any
  11239. characters illegal in a filename.
  11240. You might need to call this function if you want to know whether a given
  11241. filename is valid on MSDOS: if a case-sensitive string comparison
  11242. function such as `strcmp' (*note strcmp::.) returns a 0 when it
  11243. compares the original long filename with the short one returned by
  11244. `_lfn_gen_short_fname', then the filename is a valid DOS name.  (Note
  11245. that if LONG_FNAME is in lower case, it might not compare equal with
  11246. SHORT_FNAME because of the case difference.)
  11247. Return value
  11248. ------------
  11249. The function returns a pointer to SHORT_FNAME.
  11250. Example
  11251. -------
  11252.      #include <stdio.h>
  11253.      #include <string.h>
  11254.      #include <fcntl.h>
  11255.      
  11256.      int dos_check (char *fname)
  11257.      {
  11258.        char fshort[13];
  11259.        int retval;
  11260.      
  11261.        if (stricmp (_lfn_gen_short_fname (fname, fshort), fname) == 0)
  11262.        {
  11263.          printf ("%s is a valid MSDOS 8+3 filename\n", fname);
  11264.          retval = 1;
  11265.        }
  11266.        else
  11267.        {
  11268.          printf ("%s will have to be changed for MSDOS\n", fname);
  11269.          retval = 0;
  11270.        }
  11271.        return retval;
  11272.      }
  11273. File: libc.inf,  Node: _lfn_get_ftime,  Next: __libc_termios_init,  Prev: _lfn_gen_short_fname,  Up: Alphabetical List
  11274. _lfn_get_ftime
  11275. ==============
  11276. Syntax
  11277. ------
  11278.      #include <fcntl.h>
  11279.      
  11280.      char _lfn_get_ftime (int fhandle, int flag);
  11281. Description
  11282. -----------
  11283. This function returns creation and access time for files that reside on
  11284. a filesystem which supports long filenames (such as Windows 95).  Files
  11285. which reside on native FAT filesystems will cause this function to fail.
  11286. The FHANDLE parameter is the file handle as returned by one of the
  11287. functions which open or create files.  The FLAG parameter determines
  11288. which time (creation or access) is returned.  It can be set to one of
  11289. the following:
  11290. `_LFN_ATIME'
  11291.      Causes `_lfn_get_ftime' to return the time when the file was last
  11292.      accessed.  (Currently, it actually only returns the *date* of last
  11293.      access; the time bits are all zeroed.)
  11294. `_LFN_CTIME'
  11295.      Causes `_lfn_get_ftime' to return the time when the file was
  11296.      created.  Note that if the file was created by a program which
  11297.      doesn't support long filenames, this time will be zero.
  11298. Return value
  11299. ------------
  11300. The file time stamp, as a packed unsigned int value:
  11301. `Bits 0-4'
  11302.      seconds divided by 2
  11303. `Bits 5-10'
  11304.      minutes (0-59)
  11305. `Bits 11-15'
  11306.      hours (0-23)
  11307. `Bits 16-20'
  11308.      day of the month (1-31)
  11309. `Bits 21-24'
  11310.      month (1 = January)
  11311. `Bits 25-31'
  11312.      year offset from 1980 (add 1980 to get the actual year)
  11313. If the underlying system calls fail, the function will return 0 and set
  11314. `errno' to an appropriate value.
  11315. Example
  11316. -------
  11317.       unsigned file_stamp = _lfn_get_ftime (handle, _LFN_CTIME);
  11318. File: libc.inf,  Node: __libc_termios_init,  Next: link,  Prev: _lfn_get_ftime,  Up: Alphabetical List
  11319. __libc_termios_init
  11320. ===================
  11321. Syntax
  11322. ------
  11323.      #include <libc/ttyprvt.h>
  11324.      
  11325.      void __libc_termios_init (void);
  11326. Description
  11327. -----------
  11328. This function sets read/write hooks for the termios emulation and
  11329. import parameters. Currently importing parameters is not supported, the
  11330. emulation is resolved by only internal(static) parameters.  Note that
  11331. this function is called by tcXXX function automatically.
  11332. File: libc.inf,  Node: link,  Next: llabs,  Prev: __libc_termios_init,  Up: Alphabetical List
  11333. Syntax
  11334. ------
  11335.      #include <unistd.h>
  11336.      
  11337.      int link(const char *exists, const char *new);
  11338. Description
  11339. -----------
  11340. Because of limitations of MS-DOS, this function doesn't really link two
  11341. files together.  However, it simulates a real `link' by copying the
  11342. file at EXISTS to NEW.
  11343. Return Value
  11344. ------------
  11345. Zero on success, nonzero on failure.
  11346. Example
  11347. -------
  11348.      link("foo.c", "foo.bak");
  11349. File: libc.inf,  Node: llabs,  Next: lldiv,  Prev: link,  Up: Alphabetical List
  11350. llabs
  11351. =====
  11352. Syntax
  11353. ------
  11354.      #include <stdlib.h>
  11355.      
  11356.      long long llabs(long long x);
  11357. Description
  11358. -----------
  11359. This function takes the absolute value of X.  *Note abs::.
  11360. Return Value
  11361. ------------
  11362. File: libc.inf,  Node: lldiv,  Next: localeconv,  Prev: llabs,  Up: Alphabetical List
  11363. lldiv
  11364. =====
  11365. Syntax
  11366. ------
  11367.      #include <stdlib.h>
  11368.      
  11369.      lldiv_t lldiv(long long numerator, long long denomonator);
  11370. Description
  11371. -----------
  11372. Returns the quotient and remainder of the division NUMBERATOR divided
  11373. by DENOMONATOR.  The return type is as follows:
  11374.      typedef struct {
  11375.        long long quot;
  11376.        long long rem;
  11377.      } lldiv_t;
  11378. Return Value
  11379. ------------
  11380. The results of the division are returned.
  11381. Example
  11382. -------
  11383.      lldiv_t l = lldiv(42, 3);
  11384.      printf("42 = %lld x 3 + %lld\n", l.quot, l.rem);
  11385.      
  11386.      lldiv(+40, +3) = { +13, +1 }
  11387.      lldiv(+40, -3) = { -13, -1 }
  11388.      lldiv(-40, +3) = { -13, -1 }
  11389.      lldiv(-40, -3) = { +13, -1 }
  11390. File: libc.inf,  Node: localeconv,  Next: localtime,  Prev: lldiv,  Up: Alphabetical List
  11391. localeconv
  11392. ==========
  11393. Syntax
  11394. ------
  11395.      #include <locale.h>
  11396.      
  11397.      struct lconv *localeconv(void);
  11398. Description
  11399. -----------
  11400. This function returns a pointer to a static structure that contains
  11401. information about the current locale.  The structure contains these
  11402. fields:
  11403. `char *currency_symbol'
  11404.      A string that should be used when printing local currency.
  11405. `char *decimal_point'
  11406.      A string that is used to separate the integer and fractional
  11407.      portions of real numbers in `printf'.  Currently, only the first
  11408.      character is significant.
  11409. `char *grouping'
  11410.      An array of numbers indicating the size of groupings for
  11411.      non-monetary values to the left of the decimal point.  The first
  11412.      number is the size of the grouping just before the decimal point.
  11413.      A number of zero means to repeat the previous number indefinitely.
  11414.      A number of `CHAR_MAX' means to group the remainder of the digits
  11415.      together.
  11416. `char *int_curr_symbol'
  11417.      A string that should be used when formatting monetary values for
  11418.      local currency when the result will be used internationally.
  11419. `char *mon_decimal_point'
  11420.      A string that separates the interger and fractional parts of
  11421.      monetary values.
  11422. `char *mon_grouping'
  11423.      Same as grouping, but for monetary values.
  11424. `char *negative_sign'
  11425.      A string that is used to represent negative monetary values.
  11426. `char *positive_sign'
  11427.      A string that is used to represent positive monetary values.
  11428. `char *thousands_sep'
  11429.      The grouping separator for non-monetary values.
  11430. `char frac_digits'
  11431.      The number of digits to the right of the decimal point for monetary
  11432.      values.
  11433. `char int_frac_digits'
  11434.      Like frac_digits, but when formatting for international use.
  11435. `char n_cs_precedes'
  11436.      If nonzero, the currency string should precede the monetary value
  11437.      if the monetary value is negative.
  11438. `char n_sep_by_space'
  11439.      If nonzero, the currency string and the monetary value should be
  11440.      separated by a space if the monetary value is negative.
  11441. `char n_sign_posn'
  11442.      Determines the placement of the negative indication string if the
  11443.      monetary value is negative.
  11444.     0
  11445.           ($value), (value$)
  11446.     1
  11447.           -$value, -value$
  11448.     2
  11449.           $value-, value$-
  11450.     3
  11451.           -$value, value-$
  11452.     4
  11453.           $-value, value$-
  11454. `char p_cs_precedes'
  11455. `char p_sep_by_space'
  11456. `char p_sign_posn'
  11457.      These are the same as n_*, but for when the monetary value is
  11458.      positive.
  11459. Note that any numeric field may have a value of `CHAR_MAX', which
  11460. indicates that no information is available.
  11461. Return Value
  11462. ------------
  11463. A pointer to the `struct lconv' structure.
  11464. Example
  11465. -------
  11466.      struct lconv *l = localeconv;
  11467.      printf("%s%d\n", l->negative_sign, value);
  11468. File: libc.inf,  Node: localtime,  Next: lock,  Prev: localeconv,  Up: Alphabetical List
  11469. localtime
  11470. =========
  11471. Syntax
  11472. ------
  11473.      #include <time.h>
  11474.      
  11475.      struct tm *localtime(const time_t *tod);
  11476. Description
  11477. -----------
  11478. Converts the time represented by TOD into a structure, correcting for
  11479. the local timezone.  *Note gmtime::.
  11480. Return Value
  11481. ------------
  11482. A pointer to a static structure which is overridden with each call.
  11483. File: libc.inf,  Node: lock,  Next: log,  Prev: localtime,  Up: Alphabetical List
  11484. Syntax
  11485. ------
  11486.      #include <io.h>
  11487.      
  11488.      int lock(int fd, long offset, long length);
  11489. Description
  11490. -----------
  11491. Locks a region in file FD using MS-DOS file sharing interface.  The
  11492. region of LENGTH bytes, starting from OFFSET, will become entirely
  11493. inaccessible to other processes. If multiple locks are used on a single
  11494. file they must be non-overlapping. The lock must be removed before the
  11495. file is closed.
  11496. This function will fail unless SHARE, or a network software providing
  11497. similar interface, is installed. This function is compatible with
  11498. Borland C++ function of the same name.
  11499. *Note unlock::.
  11500. Return Value
  11501. ------------
  11502. Zero if successful, nonzero if not.
  11503. File: libc.inf,  Node: log,  Next: log10,  Prev: lock,  Up: Alphabetical List
  11504. Syntax
  11505. ------
  11506.      #include <math.h>
  11507.      
  11508.      double log(double x);
  11509. Return Value
  11510. ------------
  11511. The natural logarithm of X.
  11512. File: libc.inf,  Node: log10,  Next: log2,  Prev: log,  Up: Alphabetical List
  11513. log10
  11514. =====
  11515. Syntax
  11516. ------
  11517.      #include <math.h>
  11518.      
  11519.      double log10(double x);
  11520. Return Value
  11521. ------------
  11522. The logarithm base 10 of X.
  11523. File: libc.inf,  Node: log2,  Next: longjmp,  Prev: log10,  Up: Alphabetical List
  11524. Syntax
  11525. ------
  11526.      #include <math.h>
  11527.      
  11528.      double log2(double x);
  11529. Return Value
  11530. ------------
  11531. The logarithm base 2 of X.
  11532. File: libc.inf,  Node: longjmp,  Next: lowvideo,  Prev: log2,  Up: Alphabetical List
  11533. longjmp
  11534. =======
  11535. Syntax
  11536. ------
  11537.      #include <setjmp.h>
  11538.      
  11539.      void longjmp(jmp_buf env, int val);
  11540. Description
  11541. -----------
  11542. This function reverts back to a CPU state that was stored in ENV by
  11543. `setjmp' (*note setjmp::.).  The state includes all CPU registers, so
  11544. any variable in a register when `setjmp' was called will be preserved,
  11545. and all else will be indeterminate.
  11546. The value passed as VAL will be the return value of `setjmp' when it
  11547. resumes processing there.  If VAL is zero, the return value will be one.
  11548. Return Value
  11549. ------------
  11550. This function does not return.
  11551. Example
  11552. -------
  11553.      jmp_buf j;
  11554.      if (setjmp(j))
  11555.        return;
  11556.      do_something();
  11557.      longjmp(j);
  11558. File: libc.inf,  Node: lowvideo,  Next: lseek,  Prev: longjmp,  Up: Alphabetical List
  11559. lowvideo
  11560. ========
  11561. Syntax
  11562. ------
  11563.      #include <conio.h>
  11564.      
  11565.      void    lowvideo(void);
  11566. Description
  11567. -----------
  11568. Causes any new characters put on the screen to be dim.
  11569. File: libc.inf,  Node: lseek,  Next: malloc,  Prev: lowvideo,  Up: Alphabetical List
  11570. lseek
  11571. =====
  11572. Syntax
  11573. ------
  11574.      #include <unistd.h>
  11575.      
  11576.      off_t lseek(int fd, off_t offset, int whence);
  11577. Description
  11578. -----------
  11579. This function moves the file pointer for FD according to MODE:
  11580. `SEEK_SET'
  11581.      The file pointer is moved to the offset specified.
  11582. `SEEK_CUR'
  11583.      The file pointer is moved relative to its current position.
  11584. `SEEK_END'
  11585.      The file pointer is moved to a position OFFSET bytes from the end
  11586.      of the file.  The offset is usually nonpositive in this case.
  11587. Return Value
  11588. ------------
  11589. The new offset is returned.
  11590. Example
  11591. -------
  11592.      lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */
  11593. File: libc.inf,  Node: malloc,  Next: mblen,  Prev: lseek,  Up: Alphabetical List
  11594. malloc
  11595. ======
  11596. Syntax
  11597. ------
  11598.      #include <stdlib.h>
  11599.      
  11600.      void *malloc(size_t size);
  11601. Description
  11602. -----------
  11603. This function allocates a chunk of memory from the heap large enough to
  11604. hold any object that is SIZE bytes in length.  This memory must be
  11605. returned to the heap with `free' (*note free::.).
  11606. Return Value
  11607. ------------
  11608. A pointer to the allocated memory, or `NULL' if there isn't enough free
  11609. memory to satisfy the request.
  11610. Example
  11611. -------
  11612.      char *c = (char *)malloc(100);
  11613. File: libc.inf,  Node: mblen,  Next: mbstowcs,  Prev: malloc,  Up: Alphabetical List
  11614. mblen
  11615. =====
  11616. Syntax
  11617. ------
  11618.      #include <stdlib.h>
  11619.      
  11620.      int mblen(const char *s, size_t n);
  11621. Description
  11622. -----------
  11623. This function returns the number of characters of string S that make up
  11624. the next multibyte character.  No more than N characters are checked.
  11625. If S is `NULL', the internal shift state is reset.
  11626. Return Value
  11627. ------------
  11628. The number of characters that comprise the next multibyte character.
  11629. Example
  11630. -------
  11631.      int n = mblen(string, INT_MAX);
  11632.      string += n;
  11633. File: libc.inf,  Node: mbstowcs,  Next: mbtowc,  Prev: mblen,  Up: Alphabetical List
  11634. mbstowcs
  11635. ========
  11636. Syntax
  11637. ------
  11638.      #include <stdlib.h>
  11639.      
  11640.      size_t mbstowcs(wchar_t *wcs, const char *s, size_t n);
  11641. Description
  11642. -----------
  11643. Converts a multibyte string to a wide character string.  The result
  11644. will be no more than N wide characters.
  11645. Return Value
  11646. ------------
  11647. The number of wide characters stored.
  11648. Example
  11649. -------
  11650.      int wlen = mbtowcs(wbuf, string, sizeof(wbuf)/sizeof(wchar_t));
  11651. File: libc.inf,  Node: mbtowc,  Next: memccpy,  Prev: mbstowcs,  Up: Alphabetical List
  11652. mbtowc
  11653. ======
  11654. Syntax
  11655. ------
  11656.      #include <stdlib.h>
  11657.      
  11658.      int mbtowc(wchar_t *pwc, const char *s, size_t n);
  11659. Description
  11660. -----------
  11661. Convert the first multibyte sequence in S to a wide character.  At most
  11662. N characters are checked.  If PWC is not `NULL', the result is stored
  11663. there.  If S is null, the internal shift state is reset.
  11664. Return Value
  11665. ------------
  11666. The number of characters used by the multibyte sequence.
  11667. Example
  11668. -------
  11669.      string += mbtowc(&wc, string, strlen(string));
  11670. File: libc.inf,  Node: memccpy,  Next: memchr,  Prev: mbtowc,  Up: Alphabetical List
  11671. memccpy
  11672. =======
  11673. Syntax
  11674. ------
  11675.      #include <string.h>
  11676.      
  11677.      void * memccpy(void *to, const void *from, int ch, size_t nbytes)
  11678. Description
  11679. -----------
  11680. This function copies characters from memory area FROM into TO, stopping
  11681. after the first occurrence of character CH has been copied, or after
  11682. NBYTES characters have been copied, whichever comes first.  The buffers
  11683. should not overlap.
  11684. Return Value
  11685. ------------
  11686. A pointer to the character after the copy of CH in TO, or a `NULL'
  11687. pointer if CH was not found in the first NBYTES characters of FROM.
  11688. Example
  11689. -------
  11690.      char inpbuf[256], dest[81];
  11691.      
  11692.      printf("Enter a path: ");
  11693.      fflush(stdout);
  11694.      gets(inpbuf);
  11695.      memset(dest, 0, sizeof(dest));
  11696.      if (memccpy(dest, inpbuf, '\\', 80))
  11697.        printf("The first directory in path is %s\n", dest);
  11698.      else
  11699.        printf("No explicit directory in path\n");
  11700. File: libc.inf,  Node: memchr,  Next: memcmp,  Prev: memccpy,  Up: Alphabetical List
  11701. memchr
  11702. ======
  11703. Syntax
  11704. ------
  11705.      #include <string.h>
  11706.      
  11707.      void *memchr(const void *string, int ch, size_t num);
  11708. Description
  11709. -----------
  11710. This function searches NUM bytes starting at STRING, looking for the
  11711. first occurence of CH.
  11712. Return Value
  11713. ------------
  11714. A pointer to the first match, or `NULL' if it wasn't found.
  11715. Example
  11716. -------
  11717.      if (memchr(path, '/', strlen(path))
  11718.        do_slash();
  11719. File: libc.inf,  Node: memcmp,  Next: memcpy,  Prev: memchr,  Up: Alphabetical List
  11720. memcmp
  11721. ======
  11722. Syntax
  11723. ------
  11724.      #include <string.h>
  11725.      
  11726.      int memcmp(const void *s1, const void *s2, size_t num);
  11727. Description
  11728. -----------
  11729. This function compares two regions of memory, at S1 and S2, for NUM
  11730. bytes.
  11731. Return Value
  11732. ------------
  11733.      s1 == s2
  11734. positive
  11735.      s1 > s2
  11736. negative
  11737.      s1 < s2
  11738. File: libc.inf,  Node: memcpy,  Next: memmove,  Prev: memcmp,  Up: Alphabetical List
  11739. memcpy
  11740. ======
  11741. Syntax
  11742. ------
  11743.      #include <string.h>
  11744.      
  11745.      void *memcpy(void *dest, const void *src, int num);
  11746. Description
  11747. -----------
  11748. This function copies NUM bytes from SOURCE to DEST.
  11749. Return Value
  11750. ------------
  11751. Example
  11752. -------
  11753.      memcpy(buffer, temp_buffer, BUF_MAX);
  11754. File: libc.inf,  Node: memmove,  Next: memset,  Prev: memcpy,  Up: Alphabetical List
  11755. memmove
  11756. =======
  11757. Syntax
  11758. ------
  11759.      #include <string.h>
  11760.      
  11761.      void *memmove(void *dest, const void *source, int num);
  11762. Description
  11763. -----------
  11764. This function copies NUM bytes from SOURCE to DEST.  The copy is done
  11765. in such a way that if the two regions overlap, the source is always
  11766. read before that byte is changed by writing to the destination.
  11767. Return Value
  11768. ------------
  11769. Example
  11770. -------
  11771.      memmove(buf+1, buf, 99);
  11772.      memmove(buf, buf+1, 99);
  11773. File: libc.inf,  Node: memset,  Next: mkdir,  Prev: memmove,  Up: Alphabetical List
  11774. memset
  11775. ======
  11776. Syntax
  11777. ------
  11778.      #include <string.h>
  11779.      
  11780.      void *memset(void *buffer, int ch, size_t num);
  11781. Description
  11782. -----------
  11783. This function stores NUM copies of CH, starting at BUFFER.  This is
  11784. often used to initialize objects to a known value.
  11785. Return Value
  11786. ------------
  11787. BUFFER
  11788. Example
  11789. -------
  11790.      struct tm t;
  11791.      memset(&t, 0, sizeof(t));
  11792. File: libc.inf,  Node: mkdir,  Next: mkfifo,  Prev: memset,  Up: Alphabetical List
  11793. mkdir
  11794. =====
  11795. Syntax
  11796. ------
  11797.      #include <sys/stat.h>
  11798.      
  11799.      int mkdir(const char *path, mode_t mode);
  11800. Description
  11801. -----------
  11802. This function creates a subdirectory.  The MODE field is ignored under
  11803. MS-DOS.
  11804. Return Value
  11805. ------------
  11806. Zero if the subdirectory was created, nonzero on failure.
  11807. Example
  11808. -------
  11809.      mkdir("/usr/tmp", S_IWUSR);
  11810. File: libc.inf,  Node: mkfifo,  Next: mknod,  Prev: mkdir,  Up: Alphabetical List
  11811. mkfifo
  11812. ======
  11813. Description
  11814. -----------
  11815. This function is provided only to assist in porting from Unix.  It
  11816. always returns an error condition.
  11817. File: libc.inf,  Node: mknod,  Next: mkstemp,  Prev: mkfifo,  Up: Alphabetical List
  11818. mknod
  11819. =====
  11820. Description
  11821. -----------
  11822. This function is provided only to assist in porting from Unix.  It
  11823. always returns an error condition.
  11824. File: libc.inf,  Node: mkstemp,  Next: mktemp,  Prev: mknod,  Up: Alphabetical List
  11825. mkstemp
  11826. =======
  11827. Syntax
  11828. ------
  11829.      #include <stdio.h>
  11830.      
  11831.      int mkstemp(char *template);
  11832. Description
  11833. -----------
  11834. TEMPLATE is a file specification that ends with six trailing `X'
  11835. characters.  This function replaces the `XXXXXX' with a set of
  11836. characters such that the resulting file name names a nonexisting file.
  11837. It then creates and opens the file.
  11838. Note that since MS-DOS is limited to eight characters for the file name,
  11839. and since none of the `X''s get replaced by a dot, you can only have
  11840. two additional characters before the `X''s.
  11841. Return Value
  11842. ------------
  11843. The open file descriptor.
  11844. Example
  11845. -------
  11846.      int fd = mkstemp("/tmp/ccXXXXXX");
  11847. File: libc.inf,  Node: mktemp,  Next: mktime,  Prev: mkstemp,  Up: Alphabetical List
  11848. mktemp
  11849. ======
  11850. Syntax
  11851. ------
  11852.      #include <stdio.h>
  11853.      
  11854.      char *mktemp(char *template);
  11855. Description
  11856. -----------
  11857. TEMPLATE is a file specification that ends with six trailing `X'
  11858. characters.  This function replaces the `XXXXXX' with a set of
  11859. characters such that the resulting file name names a nonexisting file.
  11860. Note that since MS-DOS is limited to eight characters for the file name,
  11861. and since none of the `X''s get replaced by a dot, you can only have
  11862. two additional characters before the `X''s.
  11863. Return Value
  11864. ------------
  11865. The resulting filename.
  11866. Example
  11867. -------
  11868.      char template[] = "/tmp/ccXXXXXX";
  11869.      mktemp(template);
  11870.      FILE *q = fopen(template, "w");
  11871. File: libc.inf,  Node: mktime,  Next: modf,  Prev: mktemp,  Up: Alphabetical List
  11872. mktime
  11873. ======
  11874. Syntax
  11875. ------
  11876.      #include <time.h>
  11877.      
  11878.      time_t mktime(struct tm *tptr);
  11879. Description
  11880. -----------
  11881. This function converts a time structure into the number of seconds since
  11882. 00:00:00 GMT 1/1/1970.  It also attempts to normalize the fields of
  11883. TPTR.
  11884. Return Value
  11885. ------------
  11886. The resulting time, or -1 if the time in TPTR cannot be described in
  11887. that format.
  11888. File: libc.inf,  Node: modf,  Next: modfl,  Prev: mktime,  Up: Alphabetical List
  11889. Syntax
  11890. ------
  11891.      #include <math.h>
  11892.      
  11893.      double modf(double x, double *pint);
  11894. Description
  11895. -----------
  11896. `modf' breaks down X into its integer portion (which it stores in
  11897. *PINT) and the remaining fractional portion, which it returns.
  11898. Return Value
  11899. ------------
  11900. The fractional portion.
  11901. File: libc.inf,  Node: modfl,  Next: _mono_clear,  Prev: modf,  Up: Alphabetical List
  11902. modfl
  11903. =====
  11904. Syntax
  11905. ------
  11906.      #include <math.h>
  11907.      
  11908.      long double modf(long double x, long double *pint);
  11909. Description
  11910. -----------
  11911. `modfl' breaks down X into its integer portion (which it stores in
  11912. *PINT) and the remaining fractional portion, which it returns.
  11913. Return Value
  11914. ------------
  11915. The fractional portion.
  11916. File: libc.inf,  Node: _mono_clear,  Next: _mono_printf,  Prev: modfl,  Up: Alphabetical List
  11917. _mono_clear
  11918. ===========
  11919. Syntax
  11920. ------
  11921.      #include <sys/mono.h>
  11922.      
  11923.      void _mono_clear(void);
  11924. Description
  11925. -----------
  11926. Clears the monochrome monitor.
  11927. File: libc.inf,  Node: _mono_printf,  Next: _mono_putc,  Prev: _mono_clear,  Up: Alphabetical List
  11928. _mono_printf
  11929. ============
  11930. Syntax
  11931. ------
  11932.      #include <sys/mono.h>
  11933.      
  11934.      void _mono_printf(const char *fmt, ...);
  11935. Description
  11936. -----------
  11937. Like *Note printf::, but prints to the monochrome monitor.
  11938. File: libc.inf,  Node: _mono_putc,  Next: movedata,  Prev: _mono_printf,  Up: Alphabetical List
  11939. _mono_putc
  11940. ==========
  11941. Syntax
  11942. ------
  11943.      #include <mono.h>
  11944.      
  11945.      void _mono_putc(int c);
  11946. Description
  11947. -----------
  11948. Prints a single character to the monochrome monitor.
  11949. File: libc.inf,  Node: movedata,  Next: movedatab,  Prev: _mono_putc,  Up: Alphabetical List
  11950. movedata
  11951. ========
  11952. Syntax
  11953. ------
  11954.      #include <sys/movedata.h>
  11955.      
  11956.      void movedata(unsigned source_selector, unsigned source_offset,
  11957.                    unsigned dest_selector, unsigned dest_offset,
  11958.                    size_t length);
  11959. Description
  11960. -----------
  11961. This function allows the caller to directly transfer information
  11962. between conventional and linear memory, and among each as well.  The
  11963. selectors passed are *not* segment values like in DOS.  They are
  11964. protected mode selectors that can be obtained by the `_my_ds' and
  11965. `_go32_info_block.selector_for_linear_memory' (or just `_dos_ds')
  11966. functions (*Note _my_ds::, *Note _go32_info_block::).  The offsets are
  11967. linear offsets.  If the selector is for the program's data area, this
  11968. offset corresponds to the address of a buffer (like `(int)&something').
  11969. If the selector is for the conventional memory area, the offset is the
  11970. physical address of the memory, which can be computed from a
  11971. traditional segment/offset pair as `segment'*16+`offset'.  For example,
  11972. the color text screen buffer is at offset 0xb8000.
  11973. Return Value
  11974. ------------
  11975. None.
  11976. Example
  11977. -------
  11978.      short blank_row_buf[ScreenCols()];
  11979.      /* scroll screen */
  11980.      movedata(_dos_ds, 0xb8000 + ScreenCols()*2,
  11981.               _dos_ds, 0xb8000,
  11982.               ScreenCols() * (ScreenRows()-1) * 2);
  11983.      /* fill last row */
  11984.      movedata(_my_ds(), (int)blank_row_buf,
  11985.               _dos_ds, 0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  11986.                ScreenCols() * 2);
  11987. File: libc.inf,  Node: movedatab,  Next: movedatal,  Prev: movedata,  Up: Alphabetical List
  11988. movedatab
  11989. =========
  11990. Syntax
  11991. ------
  11992.      #include <sys/movedata.h>
  11993.      
  11994.      void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t);
  11995. Description
  11996. -----------
  11997. Just like *Note movedata::, but all transfers are always 8-bit
  11998. transfers.
  11999. File: libc.inf,  Node: movedatal,  Next: movedataw,  Prev: movedatab,  Up: Alphabetical List
  12000. movedatal
  12001. =========
  12002. Syntax
  12003. ------
  12004.      #include <sys/movedata.h>
  12005.      
  12006.      void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t);
  12007. Description
  12008. -----------
  12009. Just like *Note movedata::, but all transfers are always 32-bit
  12010. transfers, and the count is a count of transfers, not bytes.
  12011. File: libc.inf,  Node: movedataw,  Next: movetext,  Prev: movedatal,  Up: Alphabetical List
  12012. movedataw
  12013. =========
  12014. Syntax
  12015. ------
  12016.      #include <sys/movedata.h>
  12017.      
  12018.      void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t);
  12019. Description
  12020. -----------
  12021. Just like *Note movedata::, but all transfers are always 16-bit
  12022. transfers, and the count is a count of transfers, not bytes.
  12023. File: libc.inf,  Node: movetext,  Next: mprotect,  Prev: movedataw,  Up: Alphabetical List
  12024. movetext
  12025. ========
  12026. Syntax
  12027. ------
  12028.      #include <conio.h>
  12029.      
  12030.      int movetext(int _left, int _top, int _right, int _bottom,
  12031.                   int _destleft, int _desttop);
  12032. Description
  12033. -----------
  12034. Moves a block of text on the screen.
  12035. Return Value
  12036. ------------
  12037. 1 on success, zero on error.
  12038. File: libc.inf,  Node: mprotect,  Next: _my_cs,  Prev: movetext,  Up: Alphabetical List
  12039. mprotect
  12040. ========
  12041. Syntax
  12042. ------
  12043.      #include <sys/types.h>
  12044.      #include <sys/mman.h>
  12045.      
  12046.      int mprotect(void *addr, size_t len, int prot);
  12047. Description
  12048. -----------
  12049. This function modifies the access protection of a memory region.
  12050. Protection occurs in 4Kbyte regions (pages) aligned on 4Kbyte
  12051. boundaries.  All pages in the region will be changed, so ADDR and LEN
  12052. should be multiples of 4096.
  12053. The protection PROT for each page is specified with the values:
  12054. PROT_NONE  Region can not be touched (if or'ed is ignored).
  12055. PROT_READ  Region can be read (can be or'ed with PROT_WRITE).
  12056. PROT_WRITE Region can be written (implies read access).
  12057. This function is only supported on DPMI hosts which provide some V1.0
  12058. extensions on V0.9 memory blocks.
  12059. Return Value
  12060. ------------
  12061. The function returns 0 if successful and the value -1 if all the pages
  12062. could not be set.
  12063. Example
  12064. -------
  12065.      mprotect(readonly_buffer,8192,PROT_READ);
  12066.      mprotect(guard_area,4096,PROT_NONE);
  12067.      mprotect(NULL,4096,PROT_WRITE);    /* Let NULL pointers not generate exceptions */
  12068. File: libc.inf,  Node: _my_cs,  Next: _my_ds,  Prev: mprotect,  Up: Alphabetical List
  12069. _my_cs
  12070. ======
  12071. Syntax
  12072. ------
  12073.      #include <sys/segments.h>
  12074.      
  12075.      unsigned short _my_cs();
  12076. Description
  12077. -----------
  12078. Returns the current `CS'.  This is useful for setting up interrupt
  12079. vectors and such.
  12080. Return Value
  12081. ------------
  12082. File: libc.inf,  Node: _my_ds,  Next: _my_ss,  Prev: _my_cs,  Up: Alphabetical List
  12083. _my_ds
  12084. ======
  12085. Syntax
  12086. ------
  12087.      #include <sys/segments.h>
  12088.      
  12089.      unsigned short _my_ds();
  12090. Description
  12091. -----------
  12092. Returns the current `DS'.  This is useful for setting up interrupt
  12093. vectors and such.
  12094. Return Value
  12095. ------------
  12096. File: libc.inf,  Node: _my_ss,  Next: nice,  Prev: _my_ds,  Up: Alphabetical List
  12097. _my_ss
  12098. ======
  12099. Syntax
  12100. ------
  12101.      #include <sys/segments.h>
  12102.      
  12103.      unsigned short _my_ss();
  12104. Description
  12105. -----------
  12106. Returns the current `SS'.  This is useful for setting up interrupt
  12107. vectors and such.
  12108. Return Value
  12109. ------------
  12110. File: libc.inf,  Node: nice,  Next: normvideo,  Prev: _my_ss,  Up: Alphabetical List
  12111. Syntax
  12112. ------
  12113.      #include <unistd.h>
  12114.      
  12115.      int nice(int _increment);
  12116. Description
  12117. -----------
  12118. Adjusts the priority of the process.  Provided for Unix compatibility
  12119. only.
  12120. Return Value
  12121. ------------
  12122. The new nice value.
  12123. File: libc.inf,  Node: normvideo,  Next: nosound,  Prev: nice,  Up: Alphabetical List
  12124. normvideo
  12125. =========
  12126. Syntax
  12127. ------
  12128.      #include <conio.h>
  12129.      
  12130.      void normvideo(void);
  12131. Description
  12132. -----------
  12133. Resets the text attribute to what it was before the program started.
  12134. File: libc.inf,  Node: nosound,  Next: ntohl,  Prev: normvideo,  Up: Alphabetical List
  12135. nosound
  12136. =======
  12137. Syntax
  12138. ------
  12139.      #include <pc.h>
  12140.      
  12141.      void nosound(void);
  12142. Description
  12143. -----------
  12144. Disable the PC speaker.
  12145. File: libc.inf,  Node: ntohl,  Next: ntohs,  Prev: nosound,  Up: Alphabetical List
  12146. ntohl
  12147. =====
  12148. Syntax
  12149. ------
  12150.      #include <netinet/in.h>
  12151.      
  12152.      unsigned long ntohl(unsigned long val);
  12153. Description
  12154. -----------
  12155. This function converts from network formatted longs to host formatted
  12156. longs.  For the i386 and higher processors, this means that the bytes
  12157. are swapped from 1234 order to 4321 order.
  12158. Return Value
  12159. ------------
  12160. The host-order value.
  12161. Example
  12162. -------
  12163.      ip = htonl(packet.ipaddr);
  12164. File: libc.inf,  Node: ntohs,  Next: open,  Prev: ntohl,  Up: Alphabetical List
  12165. ntohs
  12166. =====
  12167. Syntax
  12168. ------
  12169.      #include <netinet/in.h>
  12170.      
  12171.      unsigned short ntohs(unsigned short val);
  12172. Description
  12173. -----------
  12174. This function converts from network formatted shorts to host formatted
  12175. shorts.  For the i386 and higher processors, this means that the bytes
  12176. are swapped from 12 order to 21 order.
  12177. Return Value
  12178. ------------
  12179. The host-order value.
  12180. Example
  12181. -------
  12182.      port = htons(tcp.port);
  12183. File: libc.inf,  Node: open,  Next: _open,  Prev: ntohs,  Up: Alphabetical List
  12184. Syntax
  12185. ------
  12186.      #include <fcntl.h>
  12187.      #include <sys/stat.h> /* for mode definitions */
  12188.      
  12189.      int open(const char *file, int mode /*, int permissions */);
  12190. Description
  12191. -----------
  12192. This function opens the named FILE in the given MODE, which is any
  12193. combination of the following:
  12194. `O_RDONLY'
  12195.      The file is opened for reading.
  12196. `O_WRONLY'
  12197.      The file is opened for writing.
  12198. `O_RDWR'
  12199.      The file is opened for both reading and writing.
  12200. `O_CREAT'
  12201.      If the file does not exist, it is created. *Note creat::.
  12202. `O_TRUNC'
  12203.      If the file does exist, it is truncated to zero bytes.
  12204. `O_EXCL'
  12205.      If the file exists, and `O_CREAT' is also specified, the `open'
  12206.      call will fail.
  12207. `O_APPEND'
  12208.      The file pointer is positioned at the end of the file before each
  12209.      write.
  12210. `O_TEXT'
  12211.      The file is opened in text mode, meaning that Ctrl-M characters are
  12212.      stripped on reading and added on writing as needed.  The default
  12213.      mode is specified by the `_fmode' variable *Note _fmode::.
  12214. `O_BINARY'
  12215.      The file is opened in binary mode.
  12216.      When called to open the console in binary mode, `open' will disable
  12217.      the generation of `SIGINT' when you press `Ctrl-C' (`Ctrl-Break'
  12218.      will still cause `SIGINT'), because many programs that use binary
  12219.      reads from the console will also want to get the `^C' characters.
  12220.      You can use the `__djgpp_set_ctrl_c' library function (*note
  12221.      __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to generate interrupts
  12222.      while console is read in binary mode.
  12223. If the file is created by this call, it will be given the read/write
  12224. permissions specified by PERMISSIONS, which may be any combination of
  12225. these values:
  12226. `S_IRUSR'
  12227.      The file is readable.  This is always true for MS-DOS
  12228. `S_IWUSR'
  12229.      The file is writable.
  12230. Other `S_I*' values may be included, but they will be ignored.
  12231. Return Value
  12232. ------------
  12233. If successful, the file descriptor is returned.  On error, a negative
  12234. number is returned and `errno' is set to indicate the error.
  12235. Example
  12236. -------
  12237.      int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
  12238. File: libc.inf,  Node: _open,  Next: opendir,  Prev: open,  Up: Alphabetical List
  12239. _open
  12240. =====
  12241. Syntax
  12242. ------
  12243.      #include <io.h>
  12244.      
  12245.      int _open(const char *path, int attrib);
  12246. Description
  12247. -----------
  12248. This is a direct connection to the MS-DOS open function call, int 0x21,
  12249. %ah = 0x3d.  The file is set to binary mode.
  12250. Return Value
  12251. ------------
  12252. The new file descriptor, else -1 on error.
  12253. File: libc.inf,  Node: opendir,  Next: outb,  Prev: _open,  Up: Alphabetical List
  12254. opendir
  12255. =======
  12256. Syntax
  12257. ------
  12258.      #include <dirent.h>
  12259.      
  12260.      extern int __opendir_flags;
  12261.      
  12262.      DIR *opendir(char *name);
  12263. Description
  12264. -----------
  12265. This function "opens" a directory so that you can read the list of file
  12266. names in it.  The pointer returned must be passed to `closedir' when
  12267. you are done with it.  *Note readdir::.
  12268. The global variable `__opendir_flags' can be set to include the
  12269. following values to control the operation of `opendir':
  12270. `__OPENDIR_PRESERVE_CASE'
  12271.      Do not change the case of files to lower case.  Just in case
  12272.      Micros*ft decides to support case-sensitive file systems some day.
  12273. `__OPENDIR_FIND_HIDDEN'
  12274.      Include hidden files and directories in the search.  By default,
  12275.      these are skipped.
  12276. You can simply put "int __opendir_flags = ...;" in your code.  The
  12277. default is to let it get set to zero as an uninitialized variable.
  12278. Return Value
  12279. ------------
  12280. The open directory structure, or `NULL' on error.
  12281. Example
  12282. -------
  12283.      DIR *d = opendir(".");
  12284.      closedir(d);
  12285. File: libc.inf,  Node: outb,  Next: outp,  Prev: opendir,  Up: Alphabetical List
  12286. Syntax
  12287. ------
  12288.      #include <pc.h>
  12289.      
  12290.      void outb(unsigned short _port, unsigned char _data);
  12291. Description
  12292. -----------
  12293. Calls *Note outportb::. Provided only for compatibility.
  12294. File: libc.inf,  Node: outp,  Next: outportb,  Prev: outb,  Up: Alphabetical List
  12295. Syntax
  12296. ------
  12297.      #include <pc.h>
  12298.      
  12299.      void outp(unsigned short _port, unsigned char  _data);
  12300. Description
  12301. -----------
  12302. Calls *Note outportb::. Provided only for compatibility.
  12303. File: libc.inf,  Node: outportb,  Next: outportl,  Prev: outp,  Up: Alphabetical List
  12304. outportb
  12305. ========
  12306. Syntax
  12307. ------
  12308.      #include <pc.h>
  12309.      
  12310.      void outportb(unsigned short _port, unsigned char  _data);
  12311. Description
  12312. -----------
  12313. Write a single byte to an 8-bit port.
  12314. This function is provided as an inline assembler macro, and will be
  12315. optimized down to a single opcode when you optimize your program.
  12316. File: libc.inf,  Node: outportl,  Next: outportsb,  Prev: outportb,  Up: Alphabetical List
  12317. outportl
  12318. ========
  12319. Syntax
  12320. ------
  12321.      #include <pc.h>
  12322.      
  12323.      void outportl(unsigned short _port, unsigned long _data);
  12324. Description
  12325. -----------
  12326. Write a single long to an 32-bit port.
  12327. This function is provided as an inline assembler macro, and will be
  12328. optimized down to a single opcode when you optimize your program.
  12329. File: libc.inf,  Node: outportsb,  Next: outportsl,  Prev: outportl,  Up: Alphabetical List
  12330. outportsb
  12331. =========
  12332. Syntax
  12333. ------
  12334.      #include <pc.h>
  12335.      
  12336.      void outportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  12337. Description
  12338. -----------
  12339. Writes the _LEN bytes in _BUF to the 8-bit _PORT.
  12340. File: libc.inf,  Node: outportsl,  Next: outportsw,  Prev: outportsb,  Up: Alphabetical List
  12341. outportsl
  12342. =========
  12343. Syntax
  12344. ------
  12345.      #include <pc.h>
  12346.      
  12347.      void outportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  12348. Description
  12349. -----------
  12350. Writes the _LEN longs in _BUF to the 32-bit _PORT.
  12351. File: libc.inf,  Node: outportsw,  Next: outportw,  Prev: outportsl,  Up: Alphabetical List
  12352. outportsw
  12353. =========
  12354. Syntax
  12355. ------
  12356.      #include <pc.h>
  12357.      
  12358.      void outportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  12359. Description
  12360. -----------
  12361. Writes the _LEN shorts in _BUF to the 16-bit _PORT.
  12362. File: libc.inf,  Node: outportw,  Next: outpw,  Prev: outportsw,  Up: Alphabetical List
  12363. outportw
  12364. ========
  12365. Syntax
  12366. ------
  12367.      #include <pc.h>
  12368.      
  12369.      void outportw(unsigned short _port, unsigned short _data);
  12370. Description
  12371. -----------
  12372. Write a single short to an 16-bit port.
  12373. This function is provided as an inline assembler macro, and will be
  12374. optimized down to a single opcode when you optimize your program.
  12375. File: libc.inf,  Node: outpw,  Next: pathconf,  Prev: outportw,  Up: Alphabetical List
  12376. outpw
  12377. =====
  12378. Syntax
  12379. ------
  12380.      #include <pc.h>
  12381.      
  12382.      void outpw(unsigned short _port, unsigned short _data);
  12383. Description
  12384. -----------
  12385. Calls *Note outportw::. Provided only for compatibility.
  12386. File: libc.inf,  Node: pathconf,  Next: pause,  Prev: outpw,  Up: Alphabetical List
  12387. pathconf
  12388. ========
  12389. Syntax
  12390. ------
  12391.      #include <unistd.h>
  12392.      
  12393.      long pathconf(const char *filename, int name);
  12394. Description
  12395. -----------
  12396. This function returns various system-dependent configuration values.
  12397. The NAME is one of the following:
  12398. `_PC_LINK_MAX'
  12399.      The maximum number of directory entries that can refer to a single
  12400.      real file.
  12401. `_PC_MAX_CANON'
  12402.      The maximum number of bytes in an editable input line.
  12403. `_PC_MAX_INPUT'
  12404.      The maximum number of bytes in a non-editable input line.
  12405. `_PC_NAME_MAX'
  12406.      The maximum length of an individual file name.
  12407. `_PC_PATH_MAX'
  12408.      The maximum length of a complete path name.
  12409. `_PC_PIPE_BUF'
  12410.      The size of a pipe's internal buffer.
  12411. `_PC_CHOWN_RESTRICTED'
  12412.      If non-zero, only privileged user can chown() files, otherwise
  12413.      anyone may give away files.
  12414. `_PC_NO_TRUNC'
  12415.      If false filenames longer than `_PC_NAME_MAX' are truncated,
  12416.      otherwise an error occurs if you use longer names.
  12417. `_PC_VDISABLE'
  12418.      A character to use to disable tty special characters.
  12419. Return Value
  12420. ------------
  12421. The selected configuration value is returned.
  12422. Example
  12423. -------
  12424.      char *buf = malloc(pathconf("c:/", _PC_MAX_PATH)+1);
  12425. File: libc.inf,  Node: pause,  Next: pclose,  Prev: pathconf,  Up: Alphabetical List
  12426. pause
  12427. =====
  12428. Syntax
  12429. ------
  12430.      #include <unistd.h>
  12431.      
  12432.      int pause(void);
  12433. Description
  12434. -----------
  12435. This function just calls `__dpmi_yield()' (*note __dpmi_yield::.) to
  12436. give up a slice of the CPU.
  12437. Return Value
  12438. ------------
  12439. Zero.
  12440. File: libc.inf,  Node: pclose,  Next: perror,  Prev: pause,  Up: Alphabetical List
  12441. pclose
  12442. ======
  12443. Syntax
  12444. ------
  12445.      #include <stdio.h>
  12446.      
  12447.      int pclose(FILE *pipe);
  12448. Description
  12449. -----------
  12450. This function closes a pipe opened with `popen' (*note popen::.).  Note
  12451. that since MS-DOS is not multitasking, this function will actually run
  12452. the program specified in `popen' if the pipe was opened for writing.
  12453. Return Value
  12454. ------------
  12455. Zero on success, nonzero on failure.
  12456. Example
  12457. -------
  12458.      FILE *f = popen("sort", "w");
  12459.      write_to_pipe(f);
  12460.      pclose(f);
  12461. File: libc.inf,  Node: perror,  Next: pipe,  Prev: pclose,  Up: Alphabetical List
  12462. perror
  12463. ======
  12464. Syntax
  12465. ------
  12466.      #include <stdio.h>
  12467.      
  12468.      void perror(const char *string);
  12469. Description
  12470. -----------
  12471. This function formats an error message and prints it to `stderr'.  The
  12472. message is the STRING, a colon, and a message suitable for the error
  12473. condition indicated by `errno'.
  12474. Return Value
  12475. ------------
  12476. None.
  12477. Example
  12478. -------
  12479.      int x = open("foo", O_RDONLY);
  12480.      if (x < 0)
  12481.      {
  12482.        perror("foo");
  12483.        exit(1);
  12484.      }
  12485. File: libc.inf,  Node: pipe,  Next: popen,  Prev: perror,  Up: Alphabetical List
  12486. Description
  12487. -----------
  12488. This function is provided only to assist in porting from Unix.  It
  12489. always returns an error condition.
  12490. File: libc.inf,  Node: popen,  Next: pow,  Prev: pipe,  Up: Alphabetical List
  12491. popen
  12492. =====
  12493. Syntax
  12494. ------
  12495.      #include <stdio.h>
  12496.      
  12497.      FILE *popen(const char *program, const char *mode);
  12498. Description
  12499. -----------
  12500. This function executes the named `program' and attaches either its
  12501. input stream or its output stream to the returned file.  While the file
  12502. is open, the calling program can write to the program (if the program
  12503. was open for writing) or read the program's output (if the program was
  12504. opened for reading).  When the program is done, or if you have no more
  12505. input for it, pass the file pointer to `pclose' (*note pclose::.),
  12506. which terminates the program.
  12507. Since MS-DOS does not support multitasking, this function actually runs
  12508. the entire program when the program is opened for reading, and stores
  12509. the output in a temporary file.  `pclose' then removes that file.
  12510. Similarly, when you open a program for writing, a temp file holds the
  12511. data and `pclose' runs the entire program.
  12512. The MODE is the same as for `fopen' (*note fopen::.).
  12513. Return Value
  12514. ------------
  12515. An open file which can be used to read the program's output or write to
  12516. the program's input.
  12517. Example
  12518. -------
  12519.      FILE *p = popen("dir", "r");
  12520.      read_program(p);
  12521.      pclose(p);
  12522. File: libc.inf,  Node: pow,  Next: pow10,  Prev: popen,  Up: Alphabetical List
  12523. Syntax
  12524. ------
  12525.      #include <math.h>
  12526.      
  12527.      double pow(double x, double y);
  12528. Return Value
  12529. ------------
  12530. X raised to the Y power.
  12531. File: libc.inf,  Node: pow10,  Next: pow2,  Prev: pow,  Up: Alphabetical List
  12532. pow10
  12533. =====
  12534. Syntax
  12535. ------
  12536.      #include <math.h>
  12537.      
  12538.      double pow10(double x);
  12539. Return Value
  12540. ------------
  12541. 10 raised to the X power.
  12542. File: libc.inf,  Node: pow2,  Next: _preserve_fncase,  Prev: pow10,  Up: Alphabetical List
  12543. Syntax
  12544. ------
  12545.      #include <math.h>
  12546.      
  12547.      double pow2(double x);
  12548. Return Value
  12549. ------------
  12550. 2 raised to the X power.
  12551. File: libc.inf,  Node: _preserve_fncase,  Next: printf,  Prev: pow2,  Up: Alphabetical List
  12552. _preserve_fncase
  12553. ================
  12554. Syntax
  12555. ------
  12556.      #include <fcntl.h>
  12557.      
  12558.      char _preserve_fncase (void);
  12559. Description
  12560. -----------
  12561. This function returns a non-zero value if letter-case in filenames
  12562. should be preserved.  It is used by library functions that get filenames
  12563. from the operating system (like `readdir', `_fixpath' and others).  The
  12564. usual behavior of these functions (when `_preserve_fncase' returns
  12565. zero) is to down-case 8+3 DOS-style filenames, but leave alone the
  12566. letter-case in long filenames when these are supported (*note
  12567. _use_lfn::.).  This can be changed by either setting
  12568. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  12569. variable (*note _crt0_startup_flags::.), or by setting the `FNCASE'
  12570. environment variable to `Y' at run time.  You might need such a setup
  12571. e.g. on Windows 95 if you want to see files with names like `README'
  12572. and `FAQ' listed in upper-case (for this to work, you will have to
  12573. manually rename all the other files with 8+3 DOS-style names to
  12574. lower-case names).  When the case in filenames is preserved, all
  12575. filenames will be returned in upper case on MSDOS (and other systems
  12576. that don't support long filenames), or if the environment variable
  12577. `LFN' is set to `N' on systems that support LFN.  That is because this
  12578. is how filenames are stored in the DOS directory entries.
  12579. Return value
  12580. ------------
  12581. Zero when 8+3 filenames should be converted to lower-case, non-zero
  12582. otherwise.
  12583. File: libc.inf,  Node: printf,  Next: putc,  Prev: _preserve_fncase,  Up: Alphabetical List
  12584. printf
  12585. ======
  12586. Syntax
  12587. ------
  12588.      #include <stdio.h>
  12589.      
  12590.      int printf(const char *format, ...);
  12591. Description
  12592. -----------
  12593. Sends formatted output from the arguments (...) to `stdout'.
  12594. The format string contains regular characters to print, as well as
  12595. conversion specifiers, which begin with a percent symbol.  Each
  12596. conversion speficier contains the following fields:
  12597.    *  an optional flag, which may alter the conversion:
  12598.     `-'
  12599.           left-justify the field.
  12600.     `+'
  12601.           Force a `+' sign on positive numbers.
  12602.     `space'
  12603.           To leave a blank space where a plus or minus sign would have
  12604.           been.
  12605.     `#'
  12606.           Alternate conversion - prefix octal numbers with `0',
  12607.           hexadecimal numbers with `0x' or `0X', or force a trailing
  12608.           decimal point if a floating point conversion would have
  12609.           omitted it.
  12610.     `0'
  12611.           To pad numbers with leading zeros.
  12612.    *  A field width specifier, which specifies the minimum width of the
  12613.      field.  This may also be an asterisk (`*'), which means that the
  12614.      actual width will be obtained from the next argument.  If the
  12615.      argument is negative, it supplies a `-' flag and a positive width.
  12616.    *  An optional decimal point and a precision.  This may also be an
  12617.      asterisk, but a negative argument for it indicates a precision of
  12618.      zero.  The precision specifies the minimum number of digits to
  12619.      print for an integer, the number of fraction digits for a floating
  12620.      point number (max for `g' or `G', actual for others), or the
  12621.      maximum number of characters for a string.
  12622.    *  An optional conversion qualifier, which may be `h' to specify
  12623.      `short', `l' to specify long ints, or `L' to specify long doubles.
  12624.      Long long type can be specified by `L' or `ll'.
  12625.    *  The conversion type specifier:
  12626.     `c'
  12627.           A single character
  12628.     `d'
  12629.           A signed integer
  12630.     `D'
  12631.           A signed long integer
  12632.     `e'
  12633.     `E'
  12634.           A floating point number (double or long double).  The
  12635.           exponent case matches the specifier case.  The representation
  12636.           always has an exponent.
  12637.     `f'
  12638.           A floating point number (double or long double).  The
  12639.           representation never has an exponent.
  12640.     `g'
  12641.     `G'
  12642.           A floating point number (double or long double).  The
  12643.           exponent case matches the specifier case.  The representation
  12644.           has an exponent if it needs one.
  12645.     `i'
  12646.           A signed integer.
  12647.     `n'
  12648.           The next argument is a pointer to an integer, and the number
  12649.           of characters generated so far is stored in that integer.
  12650.     `o'
  12651.           A unsigned integer, printed in base 8 instead of base 10.
  12652.     `p'
  12653.           A pointer.  This is printed with an `x' specifier.
  12654.     `s'
  12655.           A `NULL'-terminated string.
  12656.     `u'
  12657.           An unsigned integer.
  12658.     `U'
  12659.           An unsigned long integer.
  12660.     `x'
  12661.     `X'
  12662.           An unsigned integer, printed in base 16 instead of base 10.
  12663.           The case of the letters used matches the specifier case.
  12664.     `%'
  12665.           A single percent symbol is printed.
  12666. Return Value
  12667. ------------
  12668. The number of characters written.
  12669. Example
  12670. -------
  12671.      printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
  12672. File: libc.inf,  Node: putc,  Next: putch,  Prev: printf,  Up: Alphabetical List
  12673. Syntax
  12674. ------
  12675.      #include <stdio.h>
  12676.      
  12677.      int putc(int c, FILE *file);
  12678. Description
  12679. -----------
  12680. This function writes one character to the given FILE.
  12681. Return Value
  12682. ------------
  12683. The character written.
  12684. Example
  12685. -------
  12686.      while ((c=getc(stdin)) != EOF)
  12687.        putc(c, stdout);
  12688. File: libc.inf,  Node: putch,  Next: putchar,  Prev: putc,  Up: Alphabetical List
  12689. putch
  12690. =====
  12691. Syntax
  12692. ------
  12693.      #include <conio.h>
  12694.      
  12695.      int putch(int _c);
  12696. Description
  12697. -----------
  12698. Put the character _C on the screen at the current cursor position.  The
  12699. special characters return, linefeed, bell, and backspace are handled
  12700. properly, as is line wrap and scrolling.  The cursor position is
  12701. updated.
  12702. Return Value
  12703. ------------
  12704. The character is returned.
  12705. File: libc.inf,  Node: putchar,  Next: putenv,  Prev: putch,  Up: Alphabetical List
  12706. putchar
  12707. =======
  12708. Syntax
  12709. ------
  12710.      #include <stdio.h>
  12711.      
  12712.      int putchar(int c);
  12713. Description
  12714. -----------
  12715. This is the same as `fputc(c, stdout)'.  *Note fputc::.
  12716. Return Value
  12717. ------------
  12718. The character written.
  12719. Example
  12720. -------
  12721.      while ((c = getchar()) != EOF)
  12722.        putchar(c);
  12723. File: libc.inf,  Node: putenv,  Next: puts,  Prev: putchar,  Up: Alphabetical List
  12724. putenv
  12725. ======
  12726. Syntax
  12727. ------
  12728.      #include <stdlib.h>
  12729.      
  12730.      int putenv(const char *env);
  12731. Description
  12732. -----------
  12733. This function adds an entry to the program's environment.  The string
  12734. passed must be of the form `NAME'=`VALUE'.  Any existing value for the
  12735. environment variable is gone.
  12736. `putenv' will copy the string passed to it, and will automatically free
  12737. any existing string already in the environment.  Keep this in mind if
  12738. you alter the environment yourself.  The string you pass is still your
  12739. responsibility to free.  Note that most implementations will not let
  12740. you free the string you pass, resulting in memory leaks.
  12741. Return Value
  12742. ------------
  12743. Zero on success, nonzero on failure.
  12744. Example
  12745. -------
  12746.      putenv("SHELL=ksh.exe");
  12747. File: libc.inf,  Node: puts,  Next: puttext,  Prev: putenv,  Up: Alphabetical List
  12748. Syntax
  12749. ------
  12750.      #include <stdio.h>
  12751.      
  12752.      int puts(const char *string);
  12753. Description
  12754. -----------
  12755. This function writes STRING to `stdout', and then writes a newline
  12756. character.
  12757. Return Value
  12758. ------------
  12759. Nonnegative for success, or `EOF' on error.
  12760. Example
  12761. -------
  12762.      puts("Hello, there");
  12763. File: libc.inf,  Node: puttext,  Next: putw,  Prev: puts,  Up: Alphabetical List
  12764. puttext
  12765. =======
  12766. Syntax
  12767. ------
  12768.      #include <conio.h>
  12769.      
  12770.      int puttext(int _left, int _top, int _right, int _bottom, void *_source);
  12771. Description
  12772. -----------
  12773. The opposite of *Note gettext::.
  12774. Return Value
  12775. ------------
  12776. 1 on success, zero on error.
  12777. File: libc.inf,  Node: putw,  Next: qsort,  Prev: puttext,  Up: Alphabetical List
  12778. Syntax
  12779. ------
  12780.      #include <stdio.h>
  12781.      
  12782.      int putw(int x, FILE *file);
  12783. Description
  12784. -----------
  12785. Writes a single binary word in native format to FILE.
  12786. Return Value
  12787. ------------
  12788. The value written, or `EOF' for end-of-file or error.  Since `EOF' is a
  12789. valid integer, you should use `feof' or `ferror' to detect this
  12790. situation.
  12791. Example
  12792. -------
  12793.      putw(12, stdout);
  12794. File: libc.inf,  Node: qsort,  Next: raise,  Prev: putw,  Up: Alphabetical List
  12795. qsort
  12796. =====
  12797. Syntax
  12798. ------
  12799.      #include <stdlib.h>
  12800.      
  12801.      void qsort(void *base, size_t numelem, size_t size,
  12802.                 int (*cmp)(const void *e1, const void *e2));
  12803. Description
  12804. -----------
  12805. This function sorts the given array in place.  BASE is the address of
  12806. the first of NUMELEM array entries, each of size SIZE bytes.  `qsort'
  12807. uses the supplied function CMP to determine the sort order for any two
  12808. elements by passing the address of the two elements and using the
  12809. function's return address.
  12810. The return address of the function indicates the sort order:
  12811. Negative
  12812.      Element E1 should come before element E2 in the resulting array.
  12813. Positive
  12814.      Element E1 should come after element E2 in the resulting array.
  12815.      It doesn't matter which element comes first in the resulting array.
  12816. Return Value
  12817. ------------
  12818. None.
  12819. Example
  12820. -------
  12821.      typedef struct {
  12822.        int size;
  12823.        int sequence;
  12824.      } Item;
  12825.      
  12826.      int qsort_helper_by_size(void *e1, void *e2)
  12827.      {
  12828.        return ((Item *)e2)->size - ((Item *)e1)->size;
  12829.      }
  12830.      
  12831.      Item list[100];
  12832.      
  12833.      qsort(list, 100, sizeof(Item), qsort_helper_by_size);
  12834.      
  12835.      int qsort_stringlist(void *e1, void *e2)
  12836.      {
  12837.        return strcmp(*(char **)e1, *(char **)e2);
  12838.      }
  12839.      
  12840.      char *slist[10];
  12841.      
  12842.      /* alphabetical order */
  12843.      qsort(slist, 10, sizeof(char *), qsort_stringlist);
  12844. File: libc.inf,  Node: raise,  Next: rand,  Prev: qsort,  Up: Alphabetical List
  12845. raise
  12846. =====
  12847. Syntax
  12848. ------
  12849.      #include <signal.h>
  12850.      
  12851.      int    raise(int sig);
  12852. Description
  12853. -----------
  12854. This function raises the given signal SIG.  *Note the list of possible
  12855. signals: signal.
  12856. Return Value
  12857. ------------
  12858. 0 on success, -1 for illegal value of SIG.
  12859. File: libc.inf,  Node: rand,  Next: random,  Prev: raise,  Up: Alphabetical List
  12860. Syntax
  12861. ------
  12862.      #include <stdlib.h>
  12863.      
  12864.      int rand(void);
  12865. Description
  12866. -----------
  12867. Returns a pseudo-random number from zero to `RAND_MAX'.
  12868. Return Value
  12869. ------------
  12870. The number.
  12871. Example
  12872. -------
  12873.      /* random pause */
  12874.      for (i=rand(); i; i--);
  12875. File: libc.inf,  Node: random,  Next: rawclock,  Prev: rand,  Up: Alphabetical List
  12876. random
  12877. ======
  12878. Syntax
  12879. ------
  12880.      #include <stdlib.h>
  12881.      
  12882.      long random(void);
  12883. Description
  12884. -----------
  12885. Returns a random number in the range 0..MAXINT.
  12886. Return Value
  12887. ------------
  12888. 0 .. MAXINT
  12889. File: libc.inf,  Node: rawclock,  Next: read,  Prev: random,  Up: Alphabetical List
  12890. rawclock
  12891. ========
  12892. Syntax
  12893. ------
  12894.      #include <time.h>
  12895.      
  12896.      unsigned long rawclock(void);
  12897. Description
  12898. -----------
  12899. Returns the number of clock tics (18.2 per second) since midnight.
  12900. Return Value
  12901. ------------
  12902. The number of tics.
  12903. Example
  12904. -------
  12905.      /* wait 1/4 second */
  12906.      int i = rawclock()+5;
  12907.      while (rawclock()<i);
  12908. File: libc.inf,  Node: read,  Next: _read,  Prev: rawclock,  Up: Alphabetical List
  12909. Syntax
  12910. ------
  12911.      #include <unistd.h>
  12912.      
  12913.      ssize_t read(int fd, void *buffer, size_t length);
  12914. Description
  12915. -----------
  12916. This function reads at most LENGTH bytes from file FD into BUFFER.
  12917. Note that in some cases, such as end-of-file conditions and text files,
  12918. it may read less than the requested number of bytes.  At end-of-file,
  12919. `read' will read exactly zero bytes.
  12920. Return Value
  12921. ------------
  12922. The number of bytes read, zero meaning end-of-file, or -1 for an error.
  12923. Example
  12924. -------
  12925.      char buf[10];
  12926.      int r = read(0, buf, 10);
  12927. File: libc.inf,  Node: _read,  Next: readdir,  Prev: read,  Up: Alphabetical List
  12928. _read
  12929. =====
  12930. Syntax
  12931. ------
  12932.      #include <io.h>
  12933.      
  12934.      ssize_t _read(int fildes, void *buf, size_t nbyte);
  12935. Description
  12936. -----------
  12937. This is a direct connection to the MS-DOS read function call, int 0x21,
  12938. %ah = 0x3f.  No conversion is done on the data; it is read as raw
  12939. binary data.
  12940. Return Value
  12941. ------------
  12942. The number of bytes read.
  12943. File: libc.inf,  Node: readdir,  Next: realloc,  Prev: _read,  Up: Alphabetical List
  12944. readdir
  12945. =======
  12946. Syntax
  12947. ------
  12948.      #include <dirent.h>
  12949.      
  12950.      struct dirent *readdir(DIR *dir);
  12951. Description
  12952. -----------
  12953. This function reads entries from a directory opened by `opendir' (*note
  12954. opendir::.).  It returns the information in a static buffer with this
  12955. format:
  12956.      struct dirent {
  12957.        unsigned short d_namlen;  /* The length of the name (like strlen) */
  12958.        char d_name[MAXNAMLEN+1]; /* The name */
  12959.      };
  12960. Return Value
  12961. ------------
  12962. A pointer to a static buffer that is overridden with each call.
  12963. Example
  12964. -------
  12965.      DIR *d = opendir(".");
  12966.      struct dirent *de;
  12967.      while (de = readdir(d))
  12968.        puts(de->d_name);
  12969.      closedir(d);
  12970. File: libc.inf,  Node: realloc,  Next: regcomp,  Prev: readdir,  Up: Alphabetical List
  12971. realloc
  12972. =======
  12973. Syntax
  12974. ------
  12975.      #include <stdlib.h>
  12976.      
  12977.      void *realloc(void *ptr, size_t size);
  12978. Description
  12979. -----------
  12980. This function changes the size of the region pointed to by PTR.  If it
  12981. can, it will reuse the same memory space, but it may have to allocate a
  12982. new memory space to satisfy the request.  In either case, it will
  12983. return the pointer that you should use to refer to the (possibly new)
  12984. memory area.  The pointer passed may be `NULL', in which case this
  12985. function acts just like `malloc' (*note malloc::.).
  12986. Return Value
  12987. ------------
  12988. A pointer to the memory you should now refer to.
  12989. Example
  12990. -------
  12991.      if (now+new > max)
  12992.      {
  12993.        max = now+new;
  12994.        p = realloc(p, max);
  12995.      }
  12996. File: libc.inf,  Node: regcomp,  Next: regerror,  Prev: realloc,  Up: Alphabetical List
  12997. regcomp
  12998. =======
  12999. Syntax
  13000. ------
  13001.      #include <sys/types.h>
  13002.      #include <regex.h>
  13003.      
  13004.      int regcomp(regex_t *preg, const char *pattern, int cflags);
  13005. Description
  13006. -----------
  13007. This function is part of the implementation of POSIX 1003.2 regular
  13008. expressions ("RE"s).
  13009. `regcomp' compiles the regular expression contained in the PATTERN
  13010. string, subject to the flags in CFLAGS, and places the results in the
  13011. `regex_t' structure pointed to by PREG.  (The regular expression
  13012. syntax, as defined by POSIX 1003.2, is described below.)
  13013. The parameter CFLAGS is the bitwise OR of zero or more of the following
  13014. flags:
  13015. `REG_EXTENDED'
  13016.      Compile modern ("extended") REs, rather than the obsolete
  13017.      ("basic") REs that are the default.
  13018. `REG_BASIC'
  13019.      This is a synonym for 0, provided as a counterpart to
  13020.      `REG_EXTENDED' to improve readability.
  13021. `REG_NOSPEC'
  13022.      Compile with recognition of all special characters turned off.  All
  13023.      characters are thus considered ordinary, so the RE in PATTERN is a
  13024.      literal string.  This is an extension, compatible with but not
  13025.      specified by POSIX 1003.2, and should be used with caution in
  13026.      software intended to be portable to other systems.  `REG_EXTENDED'
  13027.      and `REG_NOSPEC' may not be used in the same call to `regcomp'.
  13028. `REG_ICASE'
  13029.      Compile for matching that ignores upper/lower case distinctions.
  13030.      See the description of regular expressions below for details of
  13031.      case-independent matching.
  13032. `REG_NOSUB'
  13033.      Compile for matching that need only report success or failure, not
  13034.      what was matched.
  13035. `REG_NEWLINE'
  13036.      Compile for newline-sensitive matching.  By default, newline is a
  13037.      completely ordinary character with no special meaning in either
  13038.      REs or strings.  With this flag, `[^' bracket expressions and `.'
  13039.      never match newline, a `^' anchor matches the null string after any
  13040.      newline in the string in addition to its normal function, and the
  13041.      `$' anchor matches the null string before any newline in the string
  13042.      in addition to its normal function.
  13043. `REG_PEND'
  13044.      The regular expression ends, not at the first NUL, but just before
  13045.      the character pointed to by the `re_endp' member of the structure
  13046.      pointed to by PREG.  The `re_endp' member is of type `const char
  13047.      *'.  This flag permits inclusion of NULs in the RE; they are
  13048.      considered ordinary characters.  This is an extension, compatible
  13049.      with but not specified by POSIX 1003.2, and should be used with
  13050.      caution in software intended to be portable to other systems.
  13051. When successful, `regcomp' returns 0 and fills in the structure pointed
  13052. to by PREG.  One member of that structure (other than `re_endp') is
  13053. publicized: `re_nsub', of type `size_t', contains the number of
  13054. parenthesized subexpressions within the RE (except that the value of
  13055. this member is undefined if the `REG_NOSUB' flag was used).
  13056. Note that the length of the RE does matter; in particular, there is a
  13057. strong speed bonus for keeping RE length under about 30 characters,
  13058. with most special characters counting roughly double.
  13059. Return Value
  13060. ------------
  13061. If `regcomp' succeeds, it returns zero; if it fails, it returns a
  13062. non-zero error code, which is one of these:
  13063. `REG_BADPAT'
  13064.      invalid regular expression
  13065. `REG_ECOLLATE'
  13066.      invalid collating element
  13067. `REG_ECTYPE'
  13068.      invalid character class
  13069. `REG_EESCAPE'
  13070.      `\' applied to unescapable character
  13071. `REG_ESUBREG'
  13072.      invalid backreference number (e.g., larger than the number of
  13073.      parenthesized subexpressions in the RE)
  13074. `REG_EBRACK'
  13075.      brackets [ ] not balanced
  13076. `REG_EPAREN'
  13077.      parentheses ( ) not balanced
  13078. `REG_EBRACE'
  13079.      braces { } not balanced
  13080. `REG_BADBR'
  13081.      invalid repetition count(s) in { }
  13082. `REG_ERANGE'
  13083.      invalid character range in [ ]
  13084. `REG_ESPACE'
  13085.      ran out of memory (an RE like, say,
  13086.      `((((a{1,100}){1,100}){1,100}){1,100}){1,100}'' will eventually
  13087.      run almost any existing machine out of swap space)
  13088. `REG_BADRPT'
  13089.      ?, *, or + operand invalid
  13090. `REG_EMPTY'
  13091.      empty (sub)expression
  13092. `REG_ASSERT'
  13093.      "can't happen" (you found a bug in `regcomp')
  13094. `REG_INVARG'
  13095.      invalid argument (e.g. a negative-length string)
  13096. Regular Expressions' Syntax
  13097. ---------------------------
  13098. Regular expressions ("RE"s), as defined in POSIX 1003.2, come in two
  13099. forms: modern REs (roughly those of `egrep'; 1003.2 calls these
  13100. *extended* REs) and obsolete REs (roughly those of `ed'; 1003.2 *basic*
  13101. REs).  Obsolete REs mostly exist for backward compatibility in some old
  13102. programs; they will be discussed at the end.  1003.2 leaves some
  13103. aspects of RE syntax and semantics open; `(*)' marks decisions on these
  13104. aspects that may not be fully portable to other 1003.2 implementations.
  13105. A (modern) RE is one(*) or more non-empty(*) *branches*, separated by
  13106. `|'.  It matches anything that matches one of the branches.
  13107. A branch is one(*) or more *pieces*, concatenated.  It matches a match
  13108. for the first, followed by a match for the second, etc.
  13109. A piece is an *atom* possibly followed by a single(*) `*', `+', `?', or
  13110. *bound*.  An atom followed by `*' matches a sequence of 0 or more
  13111. matches of the atom.  An atom followed by `+' matches a sequence of 1
  13112. or more matches of the atom.  An atom followed by `?' matches a
  13113. sequence of 0 or 1 matches of the atom.
  13114. A *bound* is `{' followed by an unsigned decimal integer, possibly
  13115. followed by `,' possibly followed by another unsigned decimal integer,
  13116. always followed by `}'.  The integers must lie between 0 and
  13117. `RE_DUP_MAX' (255(*)) inclusive, and if there are two of them, the
  13118. first may not exceed the second.  An atom followed by a bound containing
  13119. one integer `i' and no comma matches a sequence of exactly `i' matches
  13120. of the atom.  An atom followed by a bound containing one integer `i'
  13121. and a comma matches a sequence of `i' or more matches of the atom.  An
  13122. atom followed by a bound containing two integers `i' and `j' matches a
  13123. sequence of `i' through `j' (inclusive) matches of the atom.
  13124. An atom is a regular expression enclosed in `()' (matching a match for
  13125. the regular expression), an empty set of `()' (matching the null
  13126. string(*)), a *bracket expression* (see below), `.' (matching any single
  13127. character), `^' (matching the null string at the beginning of a line),
  13128. `$' (matching the null string at the end of a line), a `\\' followed by
  13129. one of the characters `^.[$()|*+?{\\' (matching that character taken as
  13130. an ordinary character), a `\\' followed by any other character(*)
  13131. (matching that character taken as an ordinary character, as if the `\\'
  13132. had not been present(*)), or a single character with no other
  13133. significance (matching that character).  A `{' followed by a character
  13134. other than a digit is an ordinary character, not the beginning of a
  13135. bound(*).  It is illegal to end an RE with `\\'.
  13136. A *bracket expression* is a list of characters enclosed in `[]'.  It
  13137. normally matches any single character from the list (but see below).
  13138. If the list begins with `^', it matches any single character (but see
  13139. below) *not* from the rest of the list.  If two characters in the list
  13140. are separated by `-', this is shorthand for the full *range* of
  13141. characters between those two (inclusive) in the collating sequence,
  13142. e.g. `[0-9]' in ASCII matches any decimal digit.  It is illegal(*) for
  13143. two ranges to share an endpoint, e.g. `a-c-e'.  Ranges are very
  13144. collating-sequence-dependent, and portable programs should avoid relying
  13145. on them.
  13146. To include a literal `]' in the list, make it the first character
  13147. (following a possible `^').  To include a literal `-', make it the
  13148. first or last character, or the second endpoint of a range.  To use a
  13149. literal `-' as the first endpoint of a range, enclose it in `[.' and
  13150. `.]' to make it a collating element (see below).  With the exception of
  13151. these and some combinations using `[' (see next paragraphs), all other
  13152. special characters, including `\\', lose their special significance
  13153. within a bracket expression.
  13154. Within a bracket expression, a collating element (a character, a
  13155. multi-character sequence that collates as if it were a single character,
  13156. or a collating-sequence name for either) enclosed in `[.' and `.]'
  13157. stands for the sequence of characters of that collating element.  The
  13158. sequence is a single element of the bracket expression's list.  A
  13159. bracket expression containing a multi-character collating element can
  13160. thus match more than one character, e.g. if the collating sequence
  13161. includes a `ch' collating element, then the RE `[[.ch.]]*c' matches the
  13162. first five characters of "chchcc".
  13163. Within a bracket expression, a collating element enclosed in `[=' and
  13164. `=]' is an equivalence class, standing for the sequences of characters
  13165. of all collating elements equivalent to that one, including itself.
  13166. (If there are no other equivalent collating elements, the treatment is
  13167. as if the enclosing delimiters were `[.' and `.]'.)  For example, if o
  13168. and \o'o^' are the members of an equivalence class, then `[[=o=]]',
  13169. `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.  An equivalence
  13170. class may not\(dg be an endpoint of a range.
  13171. Within a bracket expression, the name of a *character class* enclosed
  13172. in `[:' and `:]' stands for the list of all characters belonging to
  13173. that class.  Standard character class names are:
  13174.      alnum    digit    punct
  13175.      alpha    graph    space
  13176.      blank    lower    upper
  13177.      cntrl    print    xdigit
  13178. These stand for the character classes defined by `isalnum' (*note
  13179. isalnum::.), `isdigit' (*note isdigit::.), `ispunct' (*note
  13180. ispunct::.), `isalpha' (*note isalpha::.), `isgraph' (*note
  13181. isgraph::.), `isspace' (*note isspace::.) (`blank' is the same as
  13182. `space'), `islower' (*note islower::.), `isupper' (*note isupper::.),
  13183. `iscntrl' (*note iscntrl::.), `isprint' (*note isprint::.), and
  13184. `isxdigit' (*note isxdigit::.), respectively.  A locale may provide
  13185. others.  A character class may not be used as an endpoint of a range.
  13186. There are two special cases(*) of bracket expressions: the bracket
  13187. expressions `[[:<:]]' and `[[:>:]]' match the null string at the
  13188. beginning and end of a word respectively.  A word is defined as a
  13189. sequence of word characters which is neither preceded nor followed by
  13190. word characters.  A word character is an `alnum' character (as defined
  13191. by `isalnum' library function) or an underscore.  This is an extension,
  13192. compatible with but not specified by POSIX 1003.2, and should be used
  13193. with caution in software intended to be portable to other systems.
  13194. In the event that an RE could match more than one substring of a given
  13195. string, the RE matches the one starting earliest in the string.  If the
  13196. RE could match more than one substring starting at that point, it
  13197. matches the longest.  Subexpressions also match the longest possible
  13198. substrings, subject to the constraint that the whole match be as long as
  13199. possible, with subexpressions starting earlier in the RE taking priority
  13200. over ones starting later.  Note that higher-level subexpressions thus
  13201. take priority over their lower-level component subexpressions.
  13202. Match lengths are measured in characters, not collating elements.  A
  13203. null string is considered longer than no match at all.  For example,
  13204. `bb*' matches the three middle characters of `abbbc',
  13205. `(wee|week)(knights|nights)' matches all ten characters of
  13206. `weeknights', when `(.*).*' is matched against `abc' the parenthesized
  13207. subexpression matches all three characters, and when `(a*)*' is matched
  13208. against `bc' both the whole RE and the parenthesized subexpression
  13209. match the null string.
  13210. If case-independent matching is specified, the effect is much as if all
  13211. case distinctions had vanished from the alphabet.  When an alphabetic
  13212. that exists in multiple cases appears as an ordinary character outside a
  13213. bracket expression, it is effectively transformed into a bracket
  13214. expression containing both cases, e.g. `x' becomes `[xX]'.  When it
  13215. appears inside a bracket expression, all case counterparts of it are
  13216. added to the bracket expression, so that (e.g.) `[x]' becomes `[xX]' and
  13217. `[^x]' becomes `[^xX]'.
  13218. No particular limit is imposed on the length of REs(*).  Programs
  13219. intended to be portable should not employ REs longer than 256 bytes, as
  13220. an implementation can refuse to accept such REs and remain
  13221. POSIX-compliant.
  13222. Obsolete (*basic*) regular expressions differ in several respects.
  13223. `|', `+', and `?' are ordinary characters and there is no equivalent
  13224. for their functionality.  The delimiters for bounds are `\\{' and
  13225. `\\}', with `{' and `}' by themselves ordinary characters.  The
  13226. parentheses for nested subexpressions are `\(' and `\)', with `(' and
  13227. `)' by themselves ordinary characters.  `^' is an ordinary character
  13228. except at the beginning of the RE or(*) the beginning of a parenthesized
  13229. subexpression, `$' is an ordinary character except at the end of the RE
  13230. or(*) the end of a parenthesized subexpression, and `*' is an ordinary
  13231. character if it appears at the beginning of the RE or the beginning of a
  13232. parenthesized subexpression (after a possible leading `^').  Finally,
  13233. there is one new type of atom, a *back reference*: `\\' followed by a
  13234. non-zero decimal digit *d* matches the same sequence of characters
  13235. matched by the *d*th parenthesized subexpression (numbering
  13236. subexpressions by the positions of their opening parentheses, left to
  13237. right), so that (e.g.) `\\([bc]\\)\\1' matches `bb' or `cc' but not
  13238. `bc'.
  13239. File: libc.inf,  Node: regerror,  Next: regexec,  Prev: regcomp,  Up: Alphabetical List
  13240. regerror
  13241. ========
  13242. Syntax
  13243. ------
  13244.      #include <sys/types.h>
  13245.      #include <regex.h>
  13246.      
  13247.      size_t regerror(int errcode, const regex_t *preg,
  13248.                      char *errbuf, size_t errbuf_size);
  13249. Description
  13250. -----------
  13251. `regerror' maps a non-zero value of ERRCODE from either `regcomp'
  13252. (Return Value, *note regcomp::.) or `regexec' (Return Value, *note
  13253. regexec::.) to a human-readable, printable message.
  13254. If PREG is non-`NULL', the error code should have arisen from use of
  13255. the variable of the type `regex_t' pointed to by PREG, and if the error
  13256. code came from `regcomp', it should have been the result from the most
  13257. recent `regcomp' using that `regex_t' variable.  (`regerror' may be
  13258. able to supply a more detailed message using information from the
  13259. `regex_t' than from ERRCODE alone.)  `regerror' places the
  13260. `NUL'-terminated message into the buffer pointed to by ERRBUF, limiting
  13261. the length (including the `NUL') to at most ERRBUF_SIZE bytes.  If the
  13262. whole message won't fit, as much of it as will fit before the
  13263. terminating `NUL' is supplied.  In any case, the returned value is the
  13264. size of buffer needed to hold the whole message (including terminating
  13265. `NUL').  If ERRBUF_SIZE is 0, ERRBUF is ignored but the return value is
  13266. still correct.
  13267. If the ERRCODE given to `regerror' is first ORed with `REG_ITOA', the
  13268. "message" that results is the printable name of the error code, e.g.
  13269. "REG_NOMATCH", rather than an explanation thereof.  If ERRCODE is
  13270. `REG_ATOI', then PREG shall be non-NULL and the `re_endp' member of the
  13271. structure it points to must point to the printable name of an error code
  13272. (e.g. "REG_ECOLLATE"); in this case, the result in ERRBUF is the
  13273. decimal representation of the numeric value of the error code (0 if the
  13274. name is not recognized).  `REG_ITOA' and `REG_ATOI' are intended
  13275. primarily as debugging facilities; they are extensions, compatible with
  13276. but not specified by POSIX 1003.2, and should be used with caution in
  13277. software intended to be portable to other systems.  Be warned also that
  13278. they are considered experimental and changes are possible.
  13279. Return Value
  13280. ------------
  13281. The size of buffer needed to hold the message (including terminating
  13282. `NUL') is always returned, even if ERRBUF_SIZE is zero.
  13283. File: libc.inf,  Node: regexec,  Next: regfree,  Prev: regerror,  Up: Alphabetical List
  13284. regexec
  13285. =======
  13286. Syntax
  13287. ------
  13288.      #include <sys/types.h>
  13289.      #include <regex.h>
  13290.      
  13291.      int regexec(const regex_t *preg, const char *string,
  13292.                  size_t nmatch, regmatch_t pmatch[], int eflags);
  13293. Description
  13294. -----------
  13295. `regexec' matches the compiled RE pointed to by PREG against the
  13296. STRING, subject to the flags in EFLAGS, and reports results using
  13297. NMATCH, PMATCH, and the returned value.  The RE must have been compiled
  13298. by a previous invocation of `regcomp' (*note regcomp::.).  The compiled
  13299. form is not altered during execution of `regexec', so a single compiled
  13300. RE can be used simultaneously by multiple threads.
  13301. By default, the NUL-terminated string pointed to by STRING is
  13302. considered to be the text of an entire line, minus any terminating
  13303. newline.
  13304. The EFLAGS argument is the bitwise OR of zero or more of the following
  13305. flags:
  13306. `REG_NOTBOL'
  13307.      The first character of the string is not the beginning of a line,
  13308.      so the `^' anchor should not match before it.  This does not
  13309.      affect the behavior of newlines under `REG_NEWLINE' (REG_NEWLINE,
  13310.      *note regcomp::.).
  13311. `REG_NOTEOL'
  13312.      The NUL terminating the string does not end a line, so the `$'
  13313.      anchor should not match before it.  This does not affect the
  13314.      behavior of newlines under `REG_NEWLINE' (REG_NEWLINE, *note
  13315.      regcomp::.).
  13316. `REG_STARTEND'
  13317.      The string is considered to start at STRING + PMATCH[0].RM_SO and
  13318.      to have a terminating `NUL' located at STRING + PMATCH[0].RM_EO
  13319.      (there need not actually be a `NUL' at that location), regardless
  13320.      of the value of NMATCH.  See below for the definition of PMATCH
  13321.      and NMATCH.  This is an extension, compatible with but not
  13322.      specified by POSIX 1003.2, and should be used with caution in
  13323.      software intended to be portable to other systems.  Note that a
  13324.      non-zero `rm_so' does not imply `REG_NOTBOL'; `REG_STARTEND'
  13325.      affects only the location of the string, not how it is matched.
  13326. `REG_TRACE'
  13327.      trace execution (printed to stdout)
  13328. `REG_LARGE'
  13329.      force large representation
  13330. `REG_BACKR'
  13331.      force use of backref code
  13332. Regular Expressions' Syntax, *Note regcomp::, for a discussion of what
  13333. is matched in situations where an RE or a portion thereof could match
  13334. any of several substrings of STRING.
  13335. If `REG_NOSUB' was specified in the compilation of the RE (REG_NOSUB,
  13336. *note regcomp::.), or if NMATCH is 0, `regexec' ignores the PMATCH
  13337. argument (but see below for the case where `REG_STARTEND' is
  13338. specified).  Otherwise, PMATCH should point to an array of NMATCH
  13339. structures of type `regmatch_t'.  Such a structure has at least the
  13340. members `rm_so' and `rm_eo', both of type `regoff_t' (a signed
  13341. arithmetic type at least as large as an `off_t' and a `ssize_t',
  13342. containing respectively the offset of the first character of a
  13343. substring and the offset of the first character after the end of the
  13344. substring.  Offsets are measured from the beginning of the STRING
  13345. argument given to `regexec'.  An empty substring is denoted by equal
  13346. offsets, both indicating the character following the empty substring.
  13347. When `regexec' returns, the 0th member of the PMATCH array is filled in
  13348. to indicate what substring of STRING was matched by the entire RE.
  13349. Remaining members report what substring was matched by parenthesized
  13350. subexpressions within the RE; member `i' reports subexpression `i',
  13351. with subexpressions counted (starting at 1) by the order of their
  13352. opening parentheses in the RE, left to right.  Unused entries in the
  13353. array--corresponding either to subexpressions that did not participate
  13354. in the match at all, or to subexpressions that do not exist in the RE
  13355. (that is, `i > preg->re_nsub'--have both `rm_so' and `rm_eo' set to
  13356. `-1'.  If a subexpression participated in the match several times, the
  13357. reported substring is the last one it matched.  (Note, as an example in
  13358. particular, that when the RE `(b*)+' matches `bbb', the parenthesized
  13359. subexpression matches each of the three `b's and then an infinite
  13360. number of empty strings following the last `b', so the reported
  13361. substring is one of the empties.)
  13362. If `REG_STARTEND' is specified in EFLAGS, PMATCH must point to at least
  13363. one `regmatch_t' variable (even if NMATCH is 0 or `REG_NOSUB' was
  13364. specified in the compilation of the RE, REG_NOSUB, *note regcomp::.),
  13365. to hold the input offsets for `REG_STARTEND'.  Use for output is still
  13366. entirely controlled by NMATCH; if NMATCH is 0 or `REG_NOSUB' was
  13367. specified, the value of `pmatch[0]' will not be changed by a successful
  13368. `regexec'.
  13369. NMATCH exceeding 0 is expensive; NMATCH exceeding 1 is worse.  Back
  13370. references are massively expensive.
  13371. Return Value
  13372. ------------
  13373. Normally, `regexec' returns 0 for success and the non-zero code
  13374. `REG_NOMATCH' for failure.  Other non-zero error codes may be returned
  13375. in exceptional situations.  The list of possible error return values is
  13376. below:
  13377. `REG_ESPACE'
  13378.      ran out of memory
  13379. `REG_BADPAT'
  13380.      the passed argument PREG doesn't point to an RE compiled by
  13381.      `regcomp'
  13382. `REG_INVARG'
  13383.      invalid argument(s) (e.g., STRING + PMATCH[0].RM_EO is less than
  13384.      STRING + PMATCH[0].RM_SO)
  13385. File: libc.inf,  Node: regfree,  Next: remove,  Prev: regexec,  Up: Alphabetical List
  13386. regfree
  13387. =======
  13388. Syntax
  13389. ------
  13390.      #include <sys/types.h>
  13391.      #include <regex.h>
  13392.      
  13393.      void regfree(regex_t *preg);
  13394. Description
  13395. -----------
  13396. `regfree' frees any dynamically-allocated storage associated with the
  13397. compiled RE pointed to by PREG.  The remaining `regex_t' is no longer a
  13398. valid compiled RE and the effect of supplying it to `regexec' or
  13399. `regerror' is undefined.
  13400. File: libc.inf,  Node: remove,  Next: remque,  Prev: regfree,  Up: Alphabetical List
  13401. remove
  13402. ======
  13403. Syntax
  13404. ------
  13405.      #include <stdio.h>
  13406.      
  13407.      int remove(const char *file);
  13408. Description
  13409. -----------
  13410. This function removes the named FILE from the file system.  Unless you
  13411. have an un-erase program, the file and its contents are gone for good.
  13412. Return Value
  13413. ------------
  13414. Zero on success, nonzero on failure.
  13415. Example
  13416. -------
  13417.      remove("/tmp/data.tmp");
  13418. File: libc.inf,  Node: remque,  Next: _rename,  Prev: remove,  Up: Alphabetical List
  13419. remque
  13420. ======
  13421. Syntax
  13422. ------
  13423.      #include <search.h>
  13424.      
  13425.      void putenv(struct qelem *elem);
  13426. Description
  13427. -----------
  13428. This function manipulates queues built from doubly linked lists.  Each
  13429. element in the queue must be in the form of `struct qelem' which is
  13430. defined thus:
  13431.      struct qelem {
  13432.        struct qelem *q_forw;
  13433.        struct qelem *q_back;
  13434.        char q_data[0];
  13435.      }
  13436. This function removes the entry ELEM from a queue.
  13437. Return Value
  13438. ------------
  13439. None.
  13440. File: libc.inf,  Node: _rename,  Next: rename,  Prev: remque,  Up: Alphabetical List
  13441. _rename
  13442. =======
  13443. Syntax
  13444. ------
  13445.      #include <stdio.h>
  13446.      
  13447.      int _rename(const char *oldname, const char *newname);
  13448. Description
  13449. -----------
  13450. This function renames an existing file or directory OLDNAME to NEWNAME.
  13451. It is much smaller that `rename' (*note rename::.), but it can only
  13452. rename a directory so it stays under the same perent, it cannot move
  13453. directories between different branches of the directory tree.  This
  13454. means that in the following example, the first call will succeed, while
  13455. the second will fail:
  13456.      _rename("c:/path1/mydir", "c:/path1/yourdir");
  13457.      _rename("c:/path1/mydir", "c:/path2");
  13458. On systems that support long filenames (*note _use_lfn::.), `_rename'
  13459. can also move directories (so that both calls in the above example
  13460. succeed there), unless the `LFN' environment variable is set to `n', or
  13461. the `_CRT0_FLAG_NO_LFN' is set in the `_crt0_startup_flags' variable,
  13462. *Note _crt0_startup_flags::.
  13463. If you don't need the extra functionality offered by `rename' (which
  13464. usually is only expected by Unix-born programs), you can use `_rename'
  13465. instead and thus make your program a lot smaller.
  13466. Return Value
  13467. ------------
  13468. Zero on success, nonzero on failure.
  13469. File: libc.inf,  Node: rename,  Next: rewind,  Prev: _rename,  Up: Alphabetical List
  13470. rename
  13471. ======
  13472. Syntax
  13473. ------
  13474.      #include <stdio.h>
  13475.      
  13476.      int rename(const char *oldname, const char *newname);
  13477. Description
  13478. -----------
  13479. This function renames an existing file or directory OLDNAME to NEWNAME.
  13480. If NEWNAME exists, then it is first removed.  If NEWNAME is a
  13481. directory, it must be empty (or else ERRNO will be set to `ENOTEMPTY'),
  13482. and must not include OLDNAME in its path prefix (otherwise, ERRNO will
  13483. be set to `EINVAL').  If NEWNAME exists, both OLDNAME and NEWNAME must
  13484. be of the same type (both directories or both regular files) (or else
  13485. ERRNO will be set to `ENOTDIR' or `EISDIR'), and must reside on the
  13486. same logical device (otherwise, ERRNO will be set to `EXDEV').
  13487. Wildcards are not allowed in either OLDNAME or NEWNAME.  DOS won't
  13488. allow renaming a current directory even on a non-default drive (you
  13489. will get the `EBUSY' or `EINVAL' in ERRNO).  `ENAMETOOLONG' will be
  13490. returned for pathnames which are longer than the limit imposed by DOS.
  13491. If OLDNAME doesn't exist, ERRNO will be set to `ENOENT'.  For most of
  13492. the other calamities, DOS will usually set ERRNO to `EACCES'.
  13493. If anything goes wrong during the operation of `rename()', the function
  13494. tries very hard to leave the things as ther were before it was invoked,
  13495. but it might not always succeed.
  13496. Return Value
  13497. ------------
  13498. Zero on success, nonzero on failure.
  13499. Example
  13500. -------
  13501.      rename("c:/mydir/some.doc", "c:/yourdir/some.sav");
  13502.      rename("c:/path1/mydir", "c:/path2");
  13503. File: libc.inf,  Node: rewind,  Next: rewinddir,  Prev: rename,  Up: Alphabetical List
  13504. rewind
  13505. ======
  13506. Syntax
  13507. ------
  13508.      #include <stdio.h>
  13509.      
  13510.      void rewind(FILE *file);
  13511. Description
  13512. -----------
  13513. This function repositions the file pointer to the beginning of the file
  13514. and clears the error indicator.
  13515. Return Value
  13516. ------------
  13517. None.
  13518. Example
  13519. -------
  13520.      rewind(stdin);
  13521. File: libc.inf,  Node: rewinddir,  Next: rindex,  Prev: rewind,  Up: Alphabetical List
  13522. rewinddir
  13523. =========
  13524. Syntax
  13525. ------
  13526.      #include <dirent.h>
  13527.      
  13528.      void rewinddir(DIR *dir);
  13529. Description
  13530. -----------
  13531. This function resets the position of the DIR so that the next call to
  13532. `readdir' (*note readdir::.) starts at the beginning again.
  13533. Return Value
  13534. ------------
  13535. None.
  13536. Example
  13537. -------
  13538.      DIR *d = opendir(".");
  13539.      rewinddir(d);
  13540. File: libc.inf,  Node: rindex,  Next: rmdir,  Prev: rewinddir,  Up: Alphabetical List
  13541. rindex
  13542. ======
  13543. Syntax
  13544. ------
  13545.      #include <strings.h>
  13546.      
  13547.      char *rindex(const char *string, int ch);
  13548. Description
  13549. -----------
  13550. Returns a pointer to the last occurrence of CH in STRING.  Note that
  13551. the `NULL' character counts, so if you pass zero as CH you'll get a
  13552. pointer to the end of the string back.
  13553. Return Value
  13554. ------------
  13555. A pointer to the character, or `NULL' if it wasn't found.
  13556. Example
  13557. -------
  13558.      char *last_slash = rindex(filename, '/');
  13559. File: libc.inf,  Node: rmdir,  Next: sbrk,  Prev: rindex,  Up: Alphabetical List
  13560. rmdir
  13561. =====
  13562. Syntax
  13563. ------
  13564.      #include <unistd.h>
  13565.      
  13566.      int rmdir(const char *dirname);
  13567. Description
  13568. -----------
  13569. This function removes directory DIRNAME.  The directory must be empty.
  13570. Return Value
  13571. ------------
  13572. Zero if the directory was removed, nonzero on failure.
  13573. Example
  13574. -------
  13575.      rmdir("/tmp/datadir");
  13576. File: libc.inf,  Node: sbrk,  Next: scanf,  Prev: rmdir,  Up: Alphabetical List
  13577. Syntax
  13578. ------
  13579.      #include <unistd.h>
  13580.      
  13581.      void *sbrk(int delta)
  13582. Description
  13583. -----------
  13584. This function changes the "break" of the program by adding DELTA to it.
  13585. This is the highest address that your program can access without
  13586. causing a violation.  Since the heap is the region under the break, you
  13587. can expand the heap (where `malloc' gets memory from) by increasing the
  13588. break.
  13589. This function is normally accessed only bu `malloc' (*note malloc::.).
  13590. Return Value
  13591. ------------
  13592. The address of the first byte outside of the previous valid address
  13593. range, or -1 if no more memory could be accessed.  In other words, a
  13594. pointer to the chunk of heap you just allocated, if you had passed a
  13595. positive number.
  13596. Example
  13597. -------
  13598.      char *buf;
  13599.      buf = sbrk(1000); /* allocate space */
  13600. File: libc.inf,  Node: scanf,  Next: Screen Variables,  Prev: sbrk,  Up: Alphabetical List
  13601. scanf
  13602. =====
  13603. Syntax
  13604. ------
  13605.      #include <stdio.h>
  13606.      
  13607.      int scanf(const char *format, ...);
  13608. Description
  13609. -----------
  13610. This function scans formatted text from `stdin' and stores it in the
  13611. variables pointed to by the arguments.  *Note scanf::.
  13612. The format string contains regular characters which much match the input
  13613. exactly as well as a conversion specifiers, which begin with a percent
  13614. symbol.  Any whitespace in the format string matches zero or more of any
  13615. whitespace characters in the input.  Thus, a single space may match a
  13616. newline and two tabs in the input.  All conversions except `c' and `['
  13617. also skip leading whitespace automatically.  Each conversion specifier
  13618. contains the following fields:
  13619.    *  An asterisk (`*') which indicates that the input should be
  13620.      converted according to the conversion spec, but not stored
  13621.      anywhere.
  13622.    *  A width specifier, which specifies the maximum number of input
  13623.      characters to use in the conversion.
  13624.    *  An optional conversion qualifier, which may be `h' to specify
  13625.      `short', `l' to specify long ints, or `L' to specify long doubles.
  13626.      Long long type can be specified by `L' or `ll'.
  13627.    *  The conversion type specifier:
  13628.     `c'
  13629.           Copy the next character (or WIDTH characters) to the given
  13630.           buffer.
  13631.     `d'
  13632.           Convert the input to a signed integer.
  13633.     `e'
  13634.     `E'
  13635.     `f'
  13636.     `g'
  13637.     `G'
  13638.           Convert the input to a floating point number.
  13639.     `i'
  13640.           Convert the input, determining base automatically by the
  13641.           presence of `0x' or `0' prefixes.  *Note strtol::.
  13642.     `n'
  13643.           Store the number of characters scanned so far into the
  13644.           integer pointed to.
  13645.     `o'
  13646.           Convert the input to a signed integer, using base 8.
  13647.     `p'
  13648.           Convert the input to a pointer.  This is like using the `x'
  13649.           format.
  13650.     `s'
  13651.           Copy the input to the given string, skipping leading
  13652.           whitespace and copying non-whitespace characters up to the
  13653.           next whitespace.  The string stored is then `NULL'-terminated.
  13654.     `u'
  13655.           Convert the input to an unsigned integer.
  13656.     `x'
  13657.     `X'
  13658.           Convert the input to an unsigned integer, using base 16.
  13659.     `[...]'
  13660.           Like the `c' format, except only certain characters are
  13661.           copied.  The characters between the brackets determine which
  13662.           characters are allowed, and thus when the copying stops.
  13663.           These characters may be regular characters (example:
  13664.           `[abcd]') or a range of characters (example: `[a-d]').  If
  13665.           the first character is a caret (`^'), then the set specifies
  13666.           the set of characters that do not get copied (i.e.  the set
  13667.           is negated).  To specify that the set contains a
  13668.           close-bracket (`]'), list that as the first regular character.
  13669.     `%'
  13670.           This must match a percent character in the input.
  13671. Most conversions make use of `strtol' or `strtoul' to perform the
  13672. actual conversions.
  13673. Return Value
  13674. ------------
  13675. The number of items successfully matched and assigned. If input ends
  13676. before first item is assigned, EOF is returned.
  13677. Example
  13678. -------
  13679.      int x, y;
  13680.      char buf[100];
  13681.      scanf("%d %d %s", &x, &y, buf);
  13682.      
  13683.      /* read to end-of-line */
  13684.      scanf("%d %[^\n]\n", &x, buf);
  13685.      /* read letters only */
  13686.      scanf("[a-zA-Z]", buf);
  13687. File: libc.inf,  Node: Screen Variables,  Next: ScreenClear,  Prev: scanf,  Up: Alphabetical List
  13688. Screen Variables
  13689. ================
  13690. Syntax
  13691. ------
  13692.      #include <go32.h>
  13693.      #include <pc.h>
  13694.      
  13695.      unsigned long ScreenPrimary;
  13696.      unsigned long ScreenSecondary;
  13697.      extern unsigned char ScreenAttrib;
  13698. Description
  13699. -----------
  13700. The first two variables (actually, they are #define'd aliases to fields
  13701. in the _GO32_INFO_BLOCK structure *note _go32_info_block::.) allow
  13702. access to the video memory of the primary and secondary screens as if
  13703. they were arrays.  To reference them, you must use
  13704. dosmemget()/dosmemput() functions (*Note dosmemget::, *Note
  13705. dosmemput::) or any one of the far pointer functions (*note _far*::.),
  13706. as the video memory is *not* mapped into your default address space.
  13707. The variable ScreenAttrib holds the current attribute which is in use by
  13708. the text screen writes.  The attribute is constructed as follows:
  13709. bits 0-3  - foreground color;
  13710. bits 4-6  - background color;
  13711. bit  7    - blink on (1) or off (0).
  13712. Example
  13713. -------
  13714. _farpokew(_dos_ds, ScreenPrimary, ( ((unsigned short) attr) << 8) +
  13715. char ));
  13716. File: libc.inf,  Node: ScreenClear,  Next: ScreenCols,  Prev: Screen Variables,  Up: Alphabetical List
  13717. ScreenClear
  13718. ===========
  13719. Syntax
  13720. ------
  13721.      #include <pc.h>
  13722.      
  13723.      void  ScreenClear(void);
  13724. Description
  13725. -----------
  13726. This function clears the text screen.  It overwrites it by blanks with
  13727. the current background and foreground as specified by ScreenAttrib
  13728. (*note Screen Variables::.).
  13729. Return Value
  13730. ------------
  13731. None.
  13732. Example
  13733. -------
  13734.      ScreenClear();
  13735. File: libc.inf,  Node: ScreenCols,  Next: ScreenGetChar,  Prev: ScreenClear,  Up: Alphabetical List
  13736. ScreenCols
  13737. ==========
  13738. Syntax
  13739. ------
  13740.      #include <pc.h>
  13741.      
  13742.      int ScreenCols(void);
  13743. Description
  13744. -----------
  13745. This function returns the number of columns of the screen.  It does so
  13746. by looking at the byte at the absolute address 40:4Ah in the BIOS area.
  13747. In text modes, the meaning of number of columns is obvious; in graphics
  13748. modes, this value is the number of columns of text available when using
  13749. the video BIOS functions to write text.
  13750. Return Value
  13751. ------------
  13752. The number of columns.
  13753. Example
  13754. -------
  13755.      int available_columns = ScreenCols();
  13756. File: libc.inf,  Node: ScreenGetChar,  Next: ScreenGetCursor,  Prev: ScreenCols,  Up: Alphabetical List
  13757. ScreenGetChar
  13758. =============
  13759. Syntax
  13760. ------
  13761.      #include <pc.h>
  13762.      
  13763.      void  ScreenGetChar(int *ch, int *attr, int col, int row);
  13764. Description
  13765. -----------
  13766. This function stores the character and attribute of the current primary
  13767. screen at row given by ROW and column given by COL (these are
  13768. zero-based) into the integers whose address is specified by CH and
  13769. ATTR.  It does so by directly accessing the video memory, so it will
  13770. only work when the screen is in text mode.  You can pass the value
  13771. `NULL' in each of the pointers if you do not want to retrieve the the
  13772. corresponding information.
  13773. Return Value
  13774. ------------
  13775. None.
  13776. Example
  13777. -------
  13778.      int ch, attr;
  13779.      
  13780.      ScreenGetChar(&ch, &attr, 0, 0);
  13781. File: libc.inf,  Node: ScreenGetCursor,  Next: ScreenMode,  Prev: ScreenGetChar,  Up: Alphabetical List
  13782. ScreenGetCursor
  13783. ===============
  13784. Syntax
  13785. ------
  13786.      #include <pc.h>
  13787.      
  13788.      void  ScreenGetCursor(int *row, int *column);
  13789. Description
  13790. -----------
  13791. This function retrieves the current cursor position of the default video
  13792. page by calling function 3 of the interrupt 10h, and stores it in the
  13793. variables pointed by ROW and COLUMN.
  13794. Return Value
  13795. ------------
  13796. None.
  13797. Example
  13798. -------
  13799.      ScreenGetCursor(&wherex, &wherey);
  13800. File: libc.inf,  Node: ScreenMode,  Next: ScreenPutChar,  Prev: ScreenGetCursor,  Up: Alphabetical List
  13801. ScreenMode
  13802. ==========
  13803. Syntax
  13804. ------
  13805.      #include <pc.h>
  13806.      
  13807.      int  ScreenMode(void);
  13808. Description
  13809. -----------
  13810. This function reports the current video mode as known to the system
  13811. BIOS.  It does so by accessing the byte at absolute address 40:49h.
  13812. Return Value
  13813. ------------
  13814. The video mode.
  13815. Example
  13816. -------
  13817.      video_mode = ScreenMode();
  13818. File: libc.inf,  Node: ScreenPutChar,  Next: ScreenPutString,  Prev: ScreenMode,  Up: Alphabetical List
  13819. ScreenPutChar
  13820. =============
  13821. Syntax
  13822. ------
  13823.      #include <pc.h>
  13824.      
  13825.      void  ScreenPutChar(int ch, int attr, int col, int row);
  13826. Description
  13827. -----------
  13828. This function writes the character whose value is specified in CH with
  13829. an attribute ATTR at row given by ROW and column given by COL, which
  13830. are zero-based.  It does so by directly accessing the video memory, so
  13831. it will only work when the screen is in text mode.
  13832. Return Value
  13833. ------------
  13834. None.
  13835. Example
  13836. -------
  13837.      ScreenPutChar('R', (BLUE << 4) | LIGHTMAGENTA, 75, 0);
  13838. File: libc.inf,  Node: ScreenPutString,  Next: ScreenRetrieve,  Prev: ScreenPutChar,  Up: Alphabetical List
  13839. ScreenPutString
  13840. ===============
  13841. Syntax
  13842. ------
  13843.      #include <pc.h>
  13844.      
  13845.      void  ScreenPutString(const char *str, int attr, int column, int row);
  13846. Description
  13847. -----------
  13848. Beginning at screen position given by COLUMN and ROW, this function
  13849. displays the string given by STR.  Each string character gets the
  13850. attribute given by ATTR.  If COLUMN or ROW have values outside legal
  13851. range for current video mode, nothing happens.  The variables ROW and
  13852. COLUMN are zero-based (e.g., the topmost row is row 0).
  13853. Return Value
  13854. ------------
  13855. None.
  13856. Example
  13857. -------
  13858.      ScreenPutString("Hello, world!", (BLUE << 4) | LIGHTBLUE, 20, 10);
  13859. File: libc.inf,  Node: ScreenRetrieve,  Next: ScreenRows,  Prev: ScreenPutString,  Up: Alphabetical List
  13860. ScreenRetrieve
  13861. ==============
  13862. Syntax
  13863. ------
  13864.      #include <pc.h>
  13865.      
  13866.      void  ScreenRetrieve(void *buf);
  13867. Description
  13868. -----------
  13869. This function stores a replica of the current primary screen contents in
  13870. the buffer pointed to by BUF.  It assumes without checking that BUF has
  13871. enough storage to hold the data.  The required storage can be computed
  13872. as `ScreenRows()*ScreenCols()*2' (*Note ScreenRows::, *Note
  13873. ScreenCols::).
  13874. Return Value
  13875. ------------
  13876. None.
  13877. Example
  13878. -------
  13879.      unsigned *saved_screen = (unsigned *)alloca(ScreenRows()*ScreenCols()*2;
  13880.      
  13881.      ScreenRetrieve(saved_screen);
  13882. File: libc.inf,  Node: ScreenRows,  Next: ScreenSetCursor,  Prev: ScreenRetrieve,  Up: Alphabetical List
  13883. ScreenRows
  13884. ==========
  13885. Syntax
  13886. ------
  13887.      #include <pc.h>
  13888.      
  13889.      int ScreenRows(void);
  13890. Description
  13891. -----------
  13892. This function returns the number of rows of the text screen.  It does so
  13893. by looking at the byte at the absolute address 40:84h in the BIOS area.
  13894. This method works only for video adapters with their own BIOS
  13895. extensions, like EGA, VGA, SVGA etc.
  13896. Return Value
  13897. ------------
  13898. The number of rows.
  13899. Example
  13900. -------
  13901.      int rows = ScreenRows();
  13902. File: libc.inf,  Node: ScreenSetCursor,  Next: ScreenUpdate,  Prev: ScreenRows,  Up: Alphabetical List
  13903. ScreenSetCursor
  13904. ===============
  13905. Syntax
  13906. ------
  13907.      #include <pc.h>
  13908.      
  13909.      void  ScreenSetCursor(int  row, int  column);
  13910. Description
  13911. -----------
  13912. This function moves the cursor position on the default video page to the
  13913. point given by (zero-based) ROW and COLUMN, by calling function 2 of
  13914. interrupt 10h.
  13915. Return Value
  13916. ------------
  13917. None.
  13918. Example
  13919. -------
  13920.      ScreenSetCursor(0, 0);   /* home the cursor */
  13921. File: libc.inf,  Node: ScreenUpdate,  Next: ScreenUpdateLine,  Prev: ScreenSetCursor,  Up: Alphabetical List
  13922. ScreenUpdate
  13923. ============
  13924. Syntax
  13925. ------
  13926.      #include <pc.h>
  13927.      
  13928.      void  ScreenUpdate(void *buf);
  13929. Description
  13930. -----------
  13931. This function writes the contents of the buffer BUF to the primary
  13932. screen.  The buffer should contain an exact replica of the video memory,
  13933. including the characters and their attributes.
  13934. Return Value
  13935. ------------
  13936. None.
  13937. Example
  13938. -------
  13939.      ScreenUpdate(saved_screen);
  13940. File: libc.inf,  Node: ScreenUpdateLine,  Next: ScreenVisualBell,  Prev: ScreenUpdate,  Up: Alphabetical List
  13941. ScreenUpdateLine
  13942. ================
  13943. Syntax
  13944. ------
  13945.      #include <pc.h>
  13946.      
  13947.      void  ScreenUpdateLine(void *buf, int row);
  13948. Description
  13949. -----------
  13950. This function writes the contents of BUF to the screen line number
  13951. given in ROW (the topmost line is row 0), on the primary screen.
  13952. Return Value
  13953. ------------
  13954. None.
  13955. Example
  13956. -------
  13957.      ScreenUpdateLine(line_buf, 10);
  13958. File: libc.inf,  Node: ScreenVisualBell,  Next: searchpath,  Prev: ScreenUpdateLine,  Up: Alphabetical List
  13959. ScreenVisualBell
  13960. ================
  13961. Syntax
  13962. ------
  13963.      #include <pc.h>
  13964.      
  13965.      void  ScreenVisualBell(void);
  13966. Description
  13967. -----------
  13968. This function flashes the screen colors to produce the effect of "visual
  13969. bell'.  It does so by momentarily inverting the colors of every
  13970. character on the screen.
  13971. Return Value
  13972. ------------
  13973. None.
  13974. Example
  13975. -------
  13976.      ScreenVisualBell();
  13977. File: libc.inf,  Node: searchpath,  Next: seekdir,  Prev: ScreenVisualBell,  Up: Alphabetical List
  13978. searchpath
  13979. ==========
  13980. Syntax
  13981. ------
  13982.      #include <dir.h>
  13983.      
  13984.      char * searchpath(const char *file);
  13985. Description
  13986. -----------
  13987. Given a name of a file in FILE, searches for that file in a list of
  13988. directories, including the current working directory and those defined
  13989. in the PATH environment variable.
  13990. Return Value
  13991. ------------
  13992. When successfull, the function returns a pointer to a static buffer
  13993. where the full pathname of the found file is stored.  Otherwise, it
  13994. returns NULL.
  13995. Example
  13996. -------
  13997.        printf("%s was found as %s\n", argv[1], searchpath(argv[1]));
  13998. File: libc.inf,  Node: seekdir,  Next: select,  Prev: searchpath,  Up: Alphabetical List
  13999. seekdir
  14000. =======
  14001. Syntax
  14002. ------
  14003.      #include <dirent.h>
  14004.      
  14005.      void seekdir(DIR *dir, long loc);
  14006. Description
  14007. -----------
  14008. This function sets the location pointer in DIR to the specified LOC.
  14009. Note that the value used for LOC should be either zero or a value
  14010. returned by `telldir' (*note telldir::.).  The next call to `readdir'
  14011. (*note readdir::.) will read whatever entry follows that point in the
  14012. directory.
  14013. Return Value
  14014. ------------
  14015. None.
  14016. Example
  14017. -------
  14018.      int q = telldir(dir);
  14019.      do_stuff();
  14020.      seekdir(dir, q);
  14021. File: libc.inf,  Node: select,  Next: _set_screen_lines,  Prev: seekdir,  Up: Alphabetical List
  14022. select
  14023. ======
  14024. Syntax
  14025. ------
  14026.      #include <time.h>
  14027.      
  14028.      int
  14029.      select(int nfds,
  14030.          fd_set *readfds,
  14031.          fd_set *writefds,
  14032.          fd_set *exceptfds,
  14033.          struct timeval *timeout)
  14034. Description
  14035. -----------
  14036. This function waits for files to be ready for input or output, or for a
  14037. timeout.  Each fd_set represents a set of bits representing file
  14038. descriptors.  The following macros shall be used to deal with these
  14039. sets:
  14040. `FD_ZERO(p)'
  14041.      Initialize the set to all zeros.
  14042. `FD_SET(n, p)'
  14043.      Set member N in set P.
  14044. `FD_CLR(n, p)'
  14045.      Clear member N in set P.
  14046. `FD_ISSET(n, p)'
  14047.      Return the value of member N in set P.
  14048. The TIMEOUT value may be a NULL pointer (no timeout), a pointer to a
  14049. zero-value structure (poll mode), or a pointer to an interval-filled
  14050. structure (timeout).
  14051. Return Value
  14052. ------------
  14053. The number of files ready.  The input sets are replaced with sets that
  14054. describe which files are ready for which operations.
  14055. File: libc.inf,  Node: _set_screen_lines,  Next: setbuf,  Prev: select,  Up: Alphabetical List
  14056. _set_screen_lines
  14057. =================
  14058. Syntax
  14059. ------
  14060.      #include <conio.h>
  14061.      void _set_screen_lines(int nlines);
  14062. Description
  14063. -----------
  14064. This function sets the text screen width to 80 and its height to the
  14065. value given by NLINES, which can be one of the following: 25, 28, 35,
  14066. 40, 43 or 50.  On a CGA, only 25-line screen is supported.  On an EGA,
  14067. you can use 25, 35 and 43.  VGA, PGA and MCGA support all of the
  14068. possible dimensions.  The number of columns (i.e., screen width) is 80
  14069. for all of the above resolutions, because the standard EGA/VGA has no
  14070. way of changing it.  After this function returns, calls to
  14071. `gettextinfo()' will return the actual screen dimensions as set by
  14072. `_set_screen_lines()'.  That is, you can e.g. test whether
  14073. `_set_screen_lines()' succeeded by checking the screen height returned
  14074. by `gettextinfo()' against the desired height.  This function has a
  14075. side effect of erasing the screen contents, so application programs
  14076. which use it should make their own arrangements to redisplay it.
  14077. File: libc.inf,  Node: setbuf,  Next: setbuffer,  Prev: _set_screen_lines,  Up: Alphabetical List
  14078. setbuf
  14079. ======
  14080. Syntax
  14081. ------
  14082.      #include <stdio.h>
  14083.      
  14084.      void setbuf(FILE *file, char *buffer);
  14085. Description
  14086. -----------
  14087. This function modifies the buffering characteristics of FILE.  First,
  14088. if the file already has a buffer, it is freed.  If there was any
  14089. pending data in it, it is lost, so this function should only be used
  14090. immediately after a call to `fopen'.
  14091. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  14092. non-`NULL' buffer is passed, it must be at least `BUFSIZ' bytes in
  14093. size, and the file is set to fully buffered.
  14094. *Note setbuffer::.  *Note setlinebuf::.  *Note setvbuf::.
  14095. Return Value
  14096. ------------
  14097. None.
  14098. Example
  14099. -------
  14100.      setbuf(stdout, malloc(BUFSIZ));
  14101. File: libc.inf,  Node: setbuffer,  Next: setcbrk,  Prev: setbuf,  Up: Alphabetical List
  14102. setbuffer
  14103. =========
  14104. Syntax
  14105. ------
  14106.      #include <stdio.h>
  14107.      
  14108.      void setbuffer(FILE *file, char *buffer, int length);
  14109. Description
  14110. -----------
  14111. This function modifies the buffering characteristics of FILE.  First,
  14112. if the file already has a buffer, it is freed.  If there was any
  14113. pending data in it, it is lost, so this function should only be used
  14114. immediately after a call to `fopen'.
  14115. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  14116. non-`NULL' buffer is passed, it must be at least SIZE bytes in size,
  14117. and the file is set to fully buffered.
  14118. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  14119. Return Value
  14120. ------------
  14121. None.
  14122. Example
  14123. -------
  14124.      setbuffer(stdout, malloc(10000), 10000);
  14125. File: libc.inf,  Node: setcbrk,  Next: _setcursortype,  Prev: setbuffer,  Up: Alphabetical List
  14126. setcbrk
  14127. =======
  14128. Syntax
  14129. ------
  14130.      #include <dos.h>
  14131.      
  14132.      void setcbrk(int check);
  14133. Description
  14134. -----------
  14135. Set the setting of the Ctrl-Break checking flag in MS-DOS.  If CHECK is
  14136. zero, checking is not done.  If nonzero, checking is done.
  14137. Return Value
  14138. ------------
  14139. None.
  14140. File: libc.inf,  Node: _setcursortype,  Next: setdate,  Prev: setcbrk,  Up: Alphabetical List
  14141. _setcursortype
  14142. ==============
  14143. Syntax
  14144. ------
  14145.      #include <conio.h>
  14146.      
  14147.      void _setcursortype(int _type);
  14148. Description
  14149. -----------
  14150. Sets the cursor type.  _TYPE is one of the following:
  14151. `_NOCURSOR'
  14152.      No cursor is displayed.
  14153. `_SOLIDCURSOR'
  14154.      A solid block is displayed.
  14155. `_NORMALCURSOR'
  14156.      An underline cursor is displayed.
  14157. File: libc.inf,  Node: setdate,  Next: setdisk,  Prev: _setcursortype,  Up: Alphabetical List
  14158. setdate
  14159. =======
  14160. Syntax
  14161. ------
  14162.      #include <dos.h>
  14163.      
  14164.      void setdate(struct date *ptr);
  14165. Description
  14166. -----------
  14167. This function sets the current time.
  14168. *Note getdate::. *Note settime::.
  14169. Return Value
  14170. ------------
  14171. None.
  14172. Example
  14173. -------
  14174.      struct date d;
  14175.      setdate(&d);
  14176. File: libc.inf,  Node: setdisk,  Next: setenv,  Prev: setdate,  Up: Alphabetical List
  14177. setdisk
  14178. =======
  14179. Syntax
  14180. ------
  14181.      #include <dir.h>
  14182.      
  14183.      int setdisk(int drive);
  14184. Description
  14185. -----------
  14186. This function sets the current disk (0=A).
  14187. *Note getdisk::
  14188. Return Value
  14189. ------------
  14190. The total number of possible drives.
  14191. Example
  14192. -------
  14193.      printf("There are %d drives\n", setdisk(getdisk()));
  14194. File: libc.inf,  Node: setenv,  Next: setftime,  Prev: setdisk,  Up: Alphabetical List
  14195. setenv
  14196. ======
  14197. Syntax
  14198. ------
  14199.      #include <stdlib.h>
  14200.      
  14201.      int setenv(const char *name, const char *value, int rewrite);
  14202. Description
  14203. -----------
  14204. This function sets the environment variable NAME to VALUE.  If REWRITE
  14205. is set, then this function will replace any existing value.  If it is
  14206. not set, it will only put the variable into the environment if that
  14207. variable isn't already defined.
  14208. Return Value
  14209. ------------
  14210. Zero on success, -1 on failure.
  14211. File: libc.inf,  Node: setftime,  Next: setgrent,  Prev: setenv,  Up: Alphabetical List
  14212. setftime
  14213. ========
  14214. Syntax
  14215. ------
  14216.      #include <dos.h>
  14217.      
  14218.      int setftime(int handle, struct ftime *ftimep);
  14219. Description
  14220. -----------
  14221. This function sets the modification time of a file.  Note that since
  14222. writing to a file, and closing a file opened for writing, also sets the
  14223. modification time, you should only use this function on files opened for
  14224. reading.
  14225. *Note getftime::.
  14226. Return Value
  14227. ------------
  14228. Zero on success, nonzero on failure.
  14229. Example
  14230. -------
  14231.      int q = open("data.txt", O_RDONLY);
  14232.      struct ftime f;
  14233.      f.ft_sec = f.ft_min = f.ft_hour = f.ft_day = f.ft_month = f.ft_year = 0;
  14234.      setftime(q, &f);
  14235.      close(q);
  14236. File: libc.inf,  Node: setgrent,  Next: setitimer,  Prev: setftime,  Up: Alphabetical List
  14237. setgrent
  14238. ========
  14239. Syntax
  14240. ------
  14241.      #include <grp.h>
  14242.      
  14243.      void setgrent(void);
  14244. Description
  14245. -----------
  14246. This function should be called before any call to `getgrent',
  14247. `getgrgid', or `getgrnam', to start searching the groups' list from the
  14248. beginning.  *Note getgrent::.
  14249. Return Value
  14250. ------------
  14251. None.
  14252. File: libc.inf,  Node: setitimer,  Next: setjmp,  Prev: setgrent,  Up: Alphabetical List
  14253. setitimer
  14254. =========
  14255. Syntax
  14256. ------
  14257.      #include <sys/time.h>
  14258.      
  14259.      struct itimerval {
  14260.        struct timeval it_interval;    /* timer interval */
  14261.        struct timeval it_value;       /* current value */
  14262.      };
  14263.      
  14264.      int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
  14265. Description
  14266. -----------
  14267. Each process has two interval timers, ITIMER_REAL and ITIMER_PROF, which
  14268. signal SIGALRM and SIGPROF respectively.  These are typically used to
  14269. provide alarm() and profiling capabilities.
  14270. This function changes the current value of the interval timer specified
  14271. by WHICH to the values in structure VALUE.  The previous value of the
  14272. timer is returned if OVALUE is not NULL.  When the timer expires the
  14273. appropriate signal is raised.
  14274. A timer is defined by the itimerval structure.  If it_value is non-zero
  14275. it specifies the time to the next timer expiration.  If it_interval is
  14276. non-zero it specifies the value to reload into it_value on timer
  14277. expiration.  Setting it_value to zero disables a timer.  Setting
  14278. it_interval to zero causes the timer to only happen once instead of
  14279. repeating.
  14280. Return Value
  14281. ------------
  14282. Returns 0 on success, -1 on failure (and sets errno).
  14283. File: libc.inf,  Node: setjmp,  Next: setlinebuf,  Prev: setitimer,  Up: Alphabetical List
  14284. setjmp
  14285. ======
  14286. Syntax
  14287. ------
  14288.      #include <setjmp.h>
  14289.      
  14290.      int setjmp(jmp_buf j);
  14291. Description
  14292. -----------
  14293. This function stores the complete CPU state into J.  This information
  14294. is complete enough that `longjmp' (*note longjmp::.) can return the
  14295. program to that state.  It is also complete enough to implement
  14296. coroutines.
  14297. Return Value
  14298. ------------
  14299. This function will return zero if it is returning from it's own call.
  14300. If longjmp is used to restore the state, it will return whatever value
  14301. was passed to longjmp, except if zero is passed to longjmp it will
  14302. return one.
  14303. Example
  14304. -------
  14305.      jmp_buf j;
  14306.      if (setjmp(j))
  14307.        return;
  14308.      do_something();
  14309.      longjmp(j);
  14310. File: libc.inf,  Node: setlinebuf,  Next: setlocale,  Prev: setjmp,  Up: Alphabetical List
  14311. setlinebuf
  14312. ==========
  14313. Syntax
  14314. ------
  14315.      #include <stdio.h>
  14316.      
  14317.      void setlinebuf(FILE *file);
  14318. Description
  14319. -----------
  14320. This function modifies the buffering characteristics of FILE.  First,
  14321. if the file already has a buffer, it is freed.  If there was any
  14322. pending data in it, it is lost, so this function should only be used
  14323. immediately after a call to `fopen'.
  14324. Next, a buffer is allocated and the file is set to line buffering.
  14325. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  14326. Return Value
  14327. ------------
  14328. None.
  14329. Example
  14330. -------
  14331.      setlinebuf(stderr);
  14332. File: libc.inf,  Node: setlocale,  Next: setmntent,  Prev: setlinebuf,  Up: Alphabetical List
  14333. setlocale
  14334. =========
  14335. Syntax
  14336. ------
  14337.      #include <locale.h>
  14338.      
  14339.      char *setlocale(int category, const char *locale);
  14340. Description
  14341. -----------
  14342. This function sets part or all of the current locale.  The CATEGORY is
  14343. one of the following:
  14344. `LC_ALL'
  14345.      Set all parts of the locale.
  14346. `LC_COLLATE'
  14347.      Set the collating information.
  14348. `LC_CTYPE'
  14349.      Set the character type information.
  14350. `LC_MONETARY'
  14351.      Set the monetary formatting information.
  14352. `LC_NUMERIC'
  14353.      Set the numeric formatting information.
  14354. `LC_TIME'
  14355.      Set the time formatting information.
  14356. The LOCALE should be the name of the current locale.  Currently, only
  14357. the "C" and "POSIX" locales are supported.  If the LOCALE is NULL, no
  14358. action is performed.  If LOCALE is "", the locale is identified by
  14359. environment variables (currently not supported).
  14360. *Note localeconv::.
  14361. Return Value
  14362. ------------
  14363. A static string naming the current locale for the given category, or
  14364. NULL if the requested locale is not supported.
  14365. Example
  14366. -------
  14367.      setlocale(LC_ALL, "C");
  14368. File: libc.inf,  Node: setmntent,  Next: setmode,  Prev: setlocale,  Up: Alphabetical List
  14369. setmntent
  14370. =========
  14371. Syntax
  14372. ------
  14373.      #include <mntent.h>
  14374.      
  14375.      FILE *setmntent(char *filename, const char *mode);
  14376. Description
  14377. -----------
  14378. This function returns an open FILE* pointer which can be used by
  14379. getmntent (*note getmntent::.).  The arguments FILENAME and MODE are
  14380. always ignored under MS-DOS, but for portability should be set,
  14381. accordingly, to the name of the file which describes the mounted
  14382. filesystems and the open mode of that file (like the MODE argument to
  14383. `fopen', *Note fopen::).  (There is no single standard for the name of
  14384. the file that keeps the mounted filesystems, but it is usually,
  14385. although not always, listed in the header `<mntent.h>'.)
  14386. Return Value
  14387. ------------
  14388. The FILE* pointer is returned.  For MS-DOS, this FILE* is not a real
  14389. pointer and may only be used by `getmntent'.
  14390. Example
  14391. -------
  14392.      #include <mntent.h>
  14393.      #if defined(MNT_MNTTAB)
  14394.      #define MNTTAB_FILE MNT_MNTTAB
  14395.      #elif defined(MNTTABNAME)
  14396.      #define MNTTAB_FILE MNTTABNAME
  14397.      #else
  14398.      #define MNTTAB_FILE "/etc/mnttab"
  14399.      #endif
  14400.      
  14401.        FILE *mnt_fp = setmntent (MNTTAB_FILE, "r");
  14402. File: libc.inf,  Node: setmode,  Next: setpgid,  Prev: setmntent,  Up: Alphabetical List
  14403. setmode
  14404. =======
  14405. Syntax
  14406. ------
  14407.      #include <io.h>
  14408.      
  14409.      int setmode(int file, int mode);
  14410. Description
  14411. -----------
  14412. This function sets the mode of the given FILE to MODE, which is either
  14413. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  14414. or raw mode accordingly, and set any `FILE*' objects that use this file
  14415. into text or binary mode.
  14416. When called to put FILE that refers to the console into binary mode,
  14417. `setmode' will disable the generation of `SIGINT' when you press
  14418. `Ctrl-C' (`Ctrl-Break' will still cause `SIGINT'), because many
  14419. programs that use binary reads from the console will also want to get
  14420. the `^C' characters.  You can use the `__djgpp_set_ctrl_c' library
  14421. function (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to generate
  14422. interrupts while console is read in binary mode.
  14423. Note that, for buffered streams (`FILE*'), you must call `fflush'
  14424. (*note fflush::.) before `setmode', or call `setmode' before writing
  14425. anything to the file, for proper operation.
  14426. Return Value
  14427. ------------
  14428. When successful, the function will return the previous mode of the
  14429. given FILE.  In case of failure, -1 is returned and ERRNO is set.
  14430. Example
  14431. -------
  14432.      setmode(0, O_BINARY);
  14433. File: libc.inf,  Node: setpgid,  Next: setpwent,  Prev: setmode,  Up: Alphabetical List
  14434. setpgid
  14435. =======
  14436. Syntax
  14437. ------
  14438.      #include <unistd.h>
  14439.      
  14440.      int setpgid(pid_t _pid, pid_t _pgid);
  14441. Return Value
  14442. ------------
  14443. -1 (EPERM) if _pgid is not your current pid, else zero.
  14444. File: libc.inf,  Node: setpwent,  Next: setrlimit,  Prev: setpgid,  Up: Alphabetical List
  14445. setpwent
  14446. ========
  14447. Syntax
  14448. ------
  14449.      #include <pwd.h>
  14450.      
  14451.      void setpwent(void);
  14452. Description
  14453. -----------
  14454. This function reinitializes `getpwent' so that scanning will start from
  14455. the start of the list.  *Note getpwent::.
  14456. Return Value
  14457. ------------
  14458. None.
  14459. File: libc.inf,  Node: setrlimit,  Next: settime,  Prev: setpwent,  Up: Alphabetical List
  14460. setrlimit
  14461. =========
  14462. Syntax
  14463. ------
  14464.      #include <sys/resource.h>
  14465.      
  14466.      int setrlimit (int rltype, const struct rlimit *rlimitp);
  14467. Description
  14468. -----------
  14469. This function sets new limit pointed to by RLIMITP on the resourece
  14470. limit specified by RLTYPE.  Note that currently it always fail.
  14471. Return Value
  14472. ------------
  14473. Zero on success, nonzero on failure.
  14474. File: libc.inf,  Node: settime,  Next: settimeofday,  Prev: setrlimit,  Up: Alphabetical List
  14475. settime
  14476. =======
  14477. Syntax
  14478. ------
  14479.      #include <dos.h>
  14480.      
  14481.      void settime(struct time *ptr);
  14482. Description
  14483. -----------
  14484. This function sets the current time.
  14485. *Note gettime::. *Note setdate::.
  14486. Return Value
  14487. ------------
  14488. None.
  14489. Example
  14490. -------
  14491.      struct time t;
  14492.      settime(&t);
  14493. File: libc.inf,  Node: settimeofday,  Next: setvbuf,  Prev: settime,  Up: Alphabetical List
  14494. settimeofday
  14495. ============
  14496. Syntax
  14497. ------
  14498.      #include <time.h>
  14499.      
  14500.      int settimeofday(struct timeval *tp, ...);
  14501. Description
  14502. -----------
  14503. Sets the current GMT time.  For compatibility, a second argument is
  14504. accepted.  *Note gettimeofday:: for information on the structure types.
  14505. Return Value
  14506. ------------
  14507. Zero if the time was set, nonzero on error.
  14508. File: libc.inf,  Node: setvbuf,  Next: siglongjmp,  Prev: settimeofday,  Up: Alphabetical List
  14509. setvbuf
  14510. =======
  14511. Syntax
  14512. ------
  14513.      #include <stdio.h>
  14514.      
  14515.      int setvbuf(FILE *file, char *buffer, int type, int length);
  14516. Description
  14517. -----------
  14518. This function modifies the buffering characteristics of FILE.  First,
  14519. if the file already has a buffer, it is freed.  If there was any
  14520. pending data in it, it is lost, so this function should only be used
  14521. immediately after a call to `fopen'.
  14522. If the TYPE is `_IONBF', the BUFFER and LENGTH are ignored and the file
  14523. is set to unbuffered mode.
  14524. If the TYPE is `_IOLBF' or `_IOFBF', then the file is set to line or
  14525. fully buffered, respectively.  If BUFFER is `NULL', a buffer of size
  14526. SIZE is created and used as the buffer.  If BUFFER is non-`NULL', it
  14527. must point to a buffer of at least size SIZE and will be used as the
  14528. buffer.
  14529. *Note setbuf::.  *Note setbuffer::.  *Note setlinebuf::.
  14530. Return Value
  14531. ------------
  14532. Zero on success, nonzero on failure.
  14533. Example
  14534. -------
  14535.      setbuf(stderr, NULL, _IOLBF, 1000);
  14536. File: libc.inf,  Node: siglongjmp,  Next: signal,  Prev: setvbuf,  Up: Alphabetical List
  14537. siglongjmp
  14538. ==========
  14539. Syntax
  14540. ------
  14541.      #include <setjmp.h>
  14542.      
  14543.      int    siglongjmp(sigjmp_buf env, int val);
  14544. Description
  14545. -----------
  14546. *Note longjmp::.
  14547. File: libc.inf,  Node: signal,  Next: sigsetjmp,  Prev: siglongjmp,  Up: Alphabetical List
  14548. signal
  14549. ======
  14550. Syntax
  14551. ------
  14552.      #include <signal.h>
  14553.      
  14554.      void    (*signal(int sig, void (*func)(int)))(int);
  14555. Description
  14556. -----------
  14557. Signals are generated in response to some exceptional behavior of the
  14558. program, such as division by 0.  A signal can also report some
  14559. asynchronous event outside the program, such as someone pressing a
  14560. Ctrl-Break key combination.
  14561. Signals are numbered 0..255 for software interrupts and 256..287 for
  14562. exceptions (exception number plus 256); other implementation-specific
  14563. codes are specified in `<signal.h>' (see below).  Every signal is given
  14564. a mnemonic which you should use for portable programs.
  14565. The default handling for all the signals is to print a traceback (a
  14566. stack dump which describes the sequence of function calls leading to the
  14567. generation of the signal) and abort the program.
  14568. This function allows you to change the default behavior for a specific
  14569. signal.  It registers FUNC as a signal handler for signal number SIG.
  14570. After you register your function as the handler for a particular
  14571. signal, it will be called when that signal occurs.  The execution of
  14572. the program will be suspended until the handler returns or calls
  14573. `longjmp' (*note longjmp::.).
  14574. You may pass SIG_DFL as the value of FUNC to reset the signal handling
  14575. for the signal SIG to default (also *Note __djgpp_exception_toggle::,
  14576. for a quick way to restore all the signals' handling to default),
  14577. SIG_ERR to force an error when that signal happens, or SIG_IGN to
  14578. ignore that signal.  Signal handlers that you write are regular C
  14579. functions, and may call any function that the ANSI/POSIX specs say are
  14580. valid for signal handlers.  For maximum portability, a handler for
  14581. hardware interrupts and processor exceptions should only make calls to
  14582. `signal', assign values to data objects of type `volatile sig_atomic_t'
  14583. (defined as `int' on `<signal.h>') and return.  Handlers for hardware
  14584. interrupts need also be locked in memory (so that the operation of
  14585. virtual memory mechanism won't swap them out), *Note locking memory
  14586. regions: __dpmi_lock_linear_region.  Handlers for software interrupts
  14587. can also terminate by calling `abort', `exit' or `longjmp'.
  14588. The following signals are defined on `<signal.h>':
  14589. `SIGABRT'
  14590.      The Abort signal.  Currently only used by the `assert' macro to
  14591.      terminate the program when an assertion fails (*note assert::.).
  14592. `SIGFPE'
  14593.      The Floating Point Error signal.  Generated in case of divide by
  14594.      zero exception (Int 00h), overflow exception (Int 04h), and any x87
  14595.      co-processor exception, either generated by the CPU (Int 10h), or
  14596.      by the co-processor itself (Int 75h).
  14597. `SIGILL'
  14598.      The Invalid Execution signal.  Currently only generated for
  14599.      unknown/invalid exceptions.
  14600. `SIGINT'
  14601.      The Interrupt signal.  Generated when a `Ctrl-C' or `Ctrl-Break'
  14602.      (Int 1Bh) key is hit.  Note that when you open the console in
  14603.      binary mode, or switch it to binary mode by a call to `setmode'
  14604.      (*note setmode::.), generation of `SIGINT' as result of `Ctrl-C'
  14605.      key is disabled.  This is so for programs (such as Emacs) which
  14606.      want to be able to read the `^C' character as any other character.
  14607.      Use the library function `__djgpp_set_ctrl_c' to restore `SIGINT'
  14608.      generation when `Ctrl-C' is hit, if you need this.  *Note
  14609.      __djgpp_set_ctrl_c::, for details on how this should be done.
  14610.      `Ctrl-Break' always generates `SIGINT'.
  14611.      DJGPP hooks the keyboard hardware interrupt (Int 09h) to be able to
  14612.      generate `SIGINT' in response to `Ctrl-C' key; you should be aware
  14613.      of this when you install a handler for the keyboard interrupt.
  14614. `SIGSEGV'
  14615.      The invalid storage access (Segmentation Violation) signal.
  14616.      Generated in response to any of the following exceptions: Bound
  14617.      range exceeded in BOUND instruction (Int 05h), Double Exception or
  14618.      an exception in the exception handler (Int 08h), Segment Boundary
  14619.      violation by co-processor (Int 09h), Segment Not Present (Int
  14620.      0Bh), Stack Fault (Int 0Ch), General Protection Violation (Int
  14621.      0Dh), or Page Fault (Int 0Eh).  Note that Int 09h is only
  14622.      generated on 80386 processor; i486 and later CPUs cause Int 0Dh
  14623.      when the co-processor accesses memory out of bounds.
  14624. `SIGTERM'
  14625.      The Termination Request signal.  Currently unused.
  14626.      The signals below this are not defined by ANSI C, and cannot be
  14627.      used when compiling under `-ansi' option to `gcc'.
  14628. `SIGALRM'
  14629.      The Alarm signal.  Generated after certain time period has passed
  14630.      after a call to `alarm' library function (*note alarm::.).
  14631. `SIGHUP'
  14632.      The Hang-up signal.  Currently unused.
  14633. `SIGKILL'
  14634.      The Kill signal.  Currently unused.
  14635. `SIGPIPE'
  14636.      The Broken Pipe signal.  Currently unused.
  14637. `SIGQUIT'
  14638.      The Quit signal.  Currently unused.
  14639. `SIGUSR1'
  14640.      User-defined signal no. 1.
  14641. `SIGUSR2'
  14642.      User-defined signal no. 2.
  14643.      The signals below are not defined by ANSI C and POSIX, and cannot
  14644.      be used when compiling under either `-ansi' or `-posix' options to
  14645.      `gcc'.
  14646. `SIGTRAP'
  14647.      The Trap Instruction signal.  Generated in response to the Debugger
  14648.      Exception (Int 01h) or Breakpoint Exception (Int 03h).
  14649. `SIGNOFP'
  14650.      The No Co-processor signal.  Generated if a co-processor
  14651.      (floating-point) instruction is encountered when no co-processor
  14652.      is installed (Int 07h).
  14653. `SIGTIMR'
  14654.      The Timer signal.  Used by the `setitimer' and `alarm' functions
  14655.      (*Note setitimer::, *Note alarm::).
  14656. `SIGPROF'
  14657.      The Profiler signal.  Used by the execution profile gathering code
  14658.      in a program compiled with `-pg' option to `gcc'.
  14659. Return Value
  14660. ------------
  14661. The previous handler for signal SIG, or `SIG_ERR' if the value of SIG
  14662. is outside legal limits.
  14663. Signal Mechanism Implementation Notes
  14664. -------------------------------------
  14665. Due to subtle aspects of protected-mode programs operation under MS-DOS,
  14666. signal handlers cannot be safely called from hardware interrupt
  14667. handlers.  Therefore, DJGPP exception-handling mechanism arranges for
  14668. the signal handler to be called on the first occasion that the program
  14669. is in protected mode and touches any of its data.  This means that if
  14670. the exception occurs while the processor is in real mode, like when your
  14671. program calls some DOS service, the signal handler won't be called until
  14672. that call returns.  For instance, if you call `read' (or `scanf', or
  14673. `gets') to read text from the console and press `Ctrl-C', you will have
  14674. to press `Enter' to terminate the `read' call to cause the signal
  14675. handler for `SIGINT' to be called.  Another significant implication of
  14676. this implementation is that when the program isn't touching any of its
  14677. data (like in very tight loops which only use values in the registers),
  14678. it cannot be interrupted.
  14679. File: libc.inf,  Node: sigsetjmp,  Next: sin,  Prev: signal,  Up: Alphabetical List
  14680. sigsetjmp
  14681. =========
  14682. Syntax
  14683. ------
  14684.      #include <setjmp.h>
  14685.      
  14686.      int    sigsetjmp(sigjmp_buf env, int savemask);
  14687. Description
  14688. -----------
  14689. *Note setjmp::.
  14690. File: libc.inf,  Node: sin,  Next: sinh,  Prev: sigsetjmp,  Up: Alphabetical List
  14691. Syntax
  14692. ------
  14693.      #include <math.h>
  14694.      
  14695.      double sin(double x);
  14696. Return Value
  14697. ------------
  14698. The sine of X.
  14699. File: libc.inf,  Node: sinh,  Next: sleep,  Prev: sin,  Up: Alphabetical List
  14700. Syntax
  14701. ------
  14702.      #include <math.h>
  14703.      
  14704.      double sinh(double x);
  14705. Return Value
  14706. ------------
  14707. The hyperbolic sine of X.
  14708. File: libc.inf,  Node: sleep,  Next: sound,  Prev: sinh,  Up: Alphabetical List
  14709. sleep
  14710. =====
  14711. Syntax
  14712. ------
  14713.      #include <unistd.h>
  14714.      
  14715.      unsigned sleep(unsigned seconds);
  14716. Description
  14717. -----------
  14718. This function causes the program to pause for SECONDS seconds.
  14719. Return Value
  14720. ------------
  14721. The number of seconds that haven't passed (i.e. always zero)
  14722. Example
  14723. -------
  14724.      sleep(5);
  14725. File: libc.inf,  Node: sound,  Next: spawn*,  Prev: sleep,  Up: Alphabetical List
  14726. sound
  14727. =====
  14728. Syntax
  14729. ------
  14730.      #include <pc.h>
  14731.      
  14732.      void        sound(int _frequency);
  14733. Description
  14734. -----------
  14735. Enables the PC speaker at the given frequency.
  14736. File: libc.inf,  Node: spawn*,  Next: sprintf,  Prev: sound,  Up: Alphabetical List
  14737. spawn*
  14738. ======
  14739. Syntax
  14740. ------
  14741.      #include <process.h>
  14742.      
  14743.      int spawnl(int mode, const char *path, const char *argv0, ...);
  14744.      int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  14745.      int spawnlp(int mode, const char *path, const char *argv0, ...);
  14746.      int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  14747.      
  14748.      int spawnv(int mode, const char *path, const char **argv);
  14749.      int spawnve(int mode, const char *path, const char **argv, const char **envp);
  14750.      int spawnvp(int mode, const char *path, const char **argv);
  14751.      int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  14752. Description
  14753. -----------
  14754. These functions run other programs.  The PATH points to the program to
  14755. run.  The extension is optional--if not given, and PATH is not found
  14756. neither in the current directly nor along the `PATH', the extensions
  14757. `.com', `.exe', `.bat', `.btm', `.sh', and `.ksh' are checked.  `.com'
  14758. programs are invoked via the usual DOS calls; DJGPP `.exe' programs are
  14759. invoked in a way that allows long command lines to be passed; other
  14760. `.exe' programs are invoked via DOS; `.bat' and `.btm' programs are
  14761. invoked via the command processor given by the `COMSPEC' environment
  14762. variable; `.sh', `.ksh' programs and programs with any other extensions
  14763. that have `#!' as their first two caharacters are assumed to be
  14764. Unix-style scripts and are invoked by calling a program whose pathname
  14765. immediately follows the first two characters.  (If the name of that
  14766. program is a Unix-style pathname, without a drive letter and without an
  14767. extension, like `/bin/sh', the `spawn' functions will additionally look
  14768. them up on the `PATH'; this allows to run Unix scripts without editing,
  14769. if you have a shell installed somewhere along your `PATH'.)
  14770. Note that built-in commands of the shells can *not* be invoked via
  14771. these functions; use `system' instead.
  14772. The programs are invoked with the arguments given.  The zeroth argument
  14773. is normally not used, since MS-DOS cannot pass it separately.  There are
  14774. two ways of passing arguments.  The `l' functions (like `spawnl') take
  14775. a list of arguments, with a zero at the end of the list.  This is
  14776. useful when you know how many argument there will be ahead of time.
  14777. The `v' functions (like `spawnv') take a pointer to a list of
  14778. arguments.  This is useful when you need to compute the number of
  14779. arguments at runtime.
  14780. In either case, you may also specify `e' to indicate that you will be
  14781. giving an explicit environment, else the current environment is used.
  14782. You may also specify `p' to indicate that you would like `spawn*' to
  14783. search the PATH (in either the environment you pass or the current
  14784. environment) for the executable, else it will only check the explicit
  14785. path given.
  14786. Note that these function understand about other DJGPP programs, and will
  14787. call them directly, so that you can pass command lines longer than 126
  14788. characters to them without any special code.  DJGPP programs called by
  14789. these functions will *not* glob the arguments passed to them; other
  14790. programs also won't glob the arguments if they suppress expansion when
  14791. given quoted filenames.
  14792. *Note exec*::.
  14793. Return Value
  14794. ------------
  14795. If successful and `mode' is `P_WAIT', these functions return the exit
  14796. code of the child process in the lower 8 bits of the return value.
  14797. Note that if the program is run by a command processor (e.g., if it's a
  14798. batch file), the exit code of that command processor will be returned.
  14799. `COMMAND.COM' is notorious for returning 0 even if it couldn't run the
  14800. command.
  14801. If successful and MODE is `P_OVERLAY', these functions will not return.
  14802. If there is an error (e.g., the program specified as `argv[0]' cannot
  14803. be run, or the command line is too long), these functions return -1 and
  14804. set `errno' to indicate the error.  If the child program was
  14805. interrupted by <Ctrl-C> or a Critical Device error, `errno' is set to
  14806. `EINTR' (even if the child's exit code is 0), and bits 8-17 of the
  14807. return value are set to `SIGINT' or `SIGABRT', accordingly.  Note that
  14808. you must set the signal handler for `SIGINT' to `SIG_IGN', or arrange
  14809. for the handler to return, or else your program will be aborted before
  14810. it will get chance to set the value of the return code.
  14811. Example
  14812. -------
  14813.      char *environ[] = {
  14814.        "PATH=c:\\dos;c:\\djgpp;c:\\usr\\local\\bin",
  14815.        "DJGPP=c:/djgpp",
  14816.        0
  14817.      };
  14818.      
  14819.      char *args[] = {
  14820.        "gcc",
  14821.        "-v",
  14822.        "hello.c",
  14823.        0
  14824.      };
  14825.      
  14826.      spawnvpe(P_WAIT, "gcc", args, environ);
  14827. File: libc.inf,  Node: sprintf,  Next: sqrt,  Prev: spawn*,  Up: Alphabetical List
  14828. sprintf
  14829. =======
  14830. Syntax
  14831. ------
  14832.      #include <stdio.h>
  14833.      
  14834.      int sprintf(char *buffer, const char *format, ...);
  14835. Description
  14836. -----------
  14837. Sends formatted output from the arguments (...) to the BUFFER.  *Note
  14838. printf::.
  14839. Return Value
  14840. ------------
  14841. The number of characters written.
  14842. File: libc.inf,  Node: sqrt,  Next: srandom,  Prev: sprintf,  Up: Alphabetical List
  14843. Syntax
  14844. ------
  14845.      #include <math.h>
  14846.      
  14847.      double sqrt(double x);
  14848. Return Value
  14849. ------------
  14850. The square root of X.
  14851. File: libc.inf,  Node: srandom,  Next: sscanf,  Prev: sqrt,  Up: Alphabetical List
  14852. srandom
  14853. =======
  14854. Syntax
  14855. ------
  14856.      #include <stdlib.h>
  14857.      
  14858.      int srandom(int seed);
  14859. Description
  14860. -----------
  14861. This function initialized the random number generator (*note random::.).
  14862. Passing the same SEED results in `random' returning predictable
  14863. sequences of numbers.
  14864. Return Value
  14865. ------------
  14866. Zero.
  14867. Example
  14868. -------
  14869.      srandom(45);
  14870. File: libc.inf,  Node: sscanf,  Next: stat,  Prev: srandom,  Up: Alphabetical List
  14871. sscanf
  14872. ======
  14873. Syntax
  14874. ------
  14875.      #include <stdio.h>
  14876.      
  14877.      int sscanf(const char *string, const char *format, ...);
  14878. Description
  14879. -----------
  14880. This function scans formatted text from the STRING and stores it in the
  14881. variables pointed to by the arguments.  *Note scanf::.
  14882. Return Value
  14883. ------------
  14884. The number of items successfully scanned.
  14885. File: libc.inf,  Node: stat,  Next: statfs,  Prev: sscanf,  Up: Alphabetical List
  14886. Syntax
  14887. ------
  14888.      #include <sys/stat.h>
  14889.      
  14890.      int stat(const char *file, struct stat *sbuf);
  14891. Description
  14892. -----------
  14893. This function obtains the status of the file FILE and stores it in
  14894. SBUF, which has this structure:
  14895.      struct  stat {
  14896.              time_t   st_atime;     /* time of last modification */
  14897.              time_t   st_ctime;     /*            ''             */
  14898.              dev_t    st_dev;       /* The drive number (0 = a:) */
  14899.              gid_t    st_gid;       /* getgid() */
  14900.              ino_t    st_ino;       /* starting cluster or a unique identifier */
  14901.              mode_t   st_mode;      /* file mode - S_IF* and S_IRUSR/S_IWUSR */
  14902.              time_t   st_mtime;     /*            ''             */
  14903.              nlink_t  st_nlink;     /* 2 + number of subdirs, or 1 for files */
  14904.              off_t    st_size;      /* size of file in bytes */
  14905.              off_t    st_blksize;   /* the size of transfer buffer */
  14906.              uid_t    st_uid;       /* getuid() */
  14907.      };
  14908. Return Value
  14909. ------------
  14910. Zero on success, nonzero on failure (and ERRNO set).
  14911. Example
  14912. -------
  14913.      struct stat s;
  14914.      stat("data.txt", &s);
  14915.      if (S_ISDIR(s.st_mode))
  14916.        printf("is directory\n");
  14917. Implementation Notes
  14918. --------------------
  14919. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  14920. implementation nightmare.  The following notes describe some of the
  14921. obscure points specific to their behavior in DJGPP.
  14922. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  14923. is returned as -1.  For drives networked by Novell Netware, it is
  14924. returned as -2.
  14925. 2. The starting cluster number of a file serves as its inode number.
  14926. For files whose starting cluster number is inaccessible (empty files,
  14927. files on networked drives, etc.) the `st_inode' field will be `invented'
  14928. in a way which guarantees that no two different files will get the same
  14929. inode number (thus it is unique).  This invented inode will also be
  14930. different from any real cluster number of any local file.  However, only
  14931. for local, non-empty files/directories the inode is guaranteed to be
  14932. consistent between `stat()' and `fstat()' function calls.
  14933. 3. The WRITE access mode bit is set only for the user (unless the file
  14934. is read-only, hidden or system).  EXECUTE bit is set for directories,
  14935. files which can be executed from the DOS prompt (batch files, .com,
  14936. .dll and .exe executables) or run by go32 extender.
  14937. 4. Size of directories is reported as the number of its files (sans `.'
  14938. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  14939. On FAT filesystems that support the LFN API (such as Windows 9x), the
  14940. reported size of the directory accounts for additional space used to
  14941. store the long filenames.
  14942. 5. Time stamp for root directories is taken from the volume label entry,
  14943. if that's available; otherwise, it is reported as 1-Jan-1980.
  14944. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  14945. of `struct stat' are needed by the application.
  14946. 7. `stat()' should not be used to get an up-to-date info about a file
  14947. which is open and has been written to, because `stat()' will only
  14948. return correct data after the file is closed.  Use *Note fstat:: while
  14949. the file is open.
  14950. 8. The number of links `st_nlink' is always 1 for files other than
  14951. directories.  For directories, it is the number of subdirectories plus
  14952. 2.  This is so that programs written for Unix that depend on this to
  14953. optimize recursive traversal of the directory tree, will still work.
  14954. File: libc.inf,  Node: statfs,  Next: _status87,  Prev: stat,  Up: Alphabetical List
  14955. statfs
  14956. ======
  14957. Syntax
  14958. ------
  14959.      #include <sys/vfs.h>
  14960.      
  14961.      int statfs(const char *filename, struct statfs *buf);
  14962. Description
  14963. -----------
  14964. This function returns information about the given "filesystem".  The
  14965. drive letter of the given FILENAME, or the default drive if none is
  14966. given, is used to retrieve the following structure:
  14967.      struct statfs
  14968.      {
  14969.          long    f_type;   /* 0 */
  14970.          long    f_bsize;  /* bytes per cluster */
  14971.          long    f_blocks; /* clusters on drive */
  14972.          long    f_bfree;  /* available clusters */
  14973.          long    f_bavail; /* available clusters */
  14974.          long    f_files;  /* clusters on drive */
  14975.          long    f_ffree;  /* available clusters */
  14976.          fsid_t    f_fsid;   /* [0]=drive_number, [1]=MOUNT_UFS
  14977.          long    f_magic;  /* FS_MAGIC */
  14978.      };
  14979. Return Value
  14980. ------------
  14981. Zero on success, nonzero on failure.
  14982. Example
  14983. -------
  14984.      struct statfs fs;
  14985.      statfs("anything", &fs);
  14986.      printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
  14987. File: libc.inf,  Node: _status87,  Next: _stklen,  Prev: statfs,  Up: Alphabetical List
  14988. _status87
  14989. =========
  14990. Syntax
  14991. ------
  14992.      #include <float.h>
  14993.      
  14994.      unsigned int _status87(void);
  14995. Description
  14996. -----------
  14997. Returns the status word of the FPU, which indicate the results of the
  14998. most recently completed FPU operation:
  14999.      ---- ---- ---- ---X = SW_INVALID - invalid operation
  15000.      ---- ---- ---- --X- = SW_DENORMAL - denormalized operand
  15001.      ---- ---- ---- -X-- = SW_ZERODIVIDE - division by zero
  15002.      ---- ---- ---- X--- = SW_OVERFLOW - overflow
  15003.      ---- ---- ---X ---- = SW_UNDERFLOW - underflow
  15004.      ---- ---- --X- ---- = SW_INEXACT - loss of precision
  15005.      ---- ---- -X-- ---- = SW_STACKFAULT - stack over/under flow
  15006.      ---- ---- X--- ---- = SW_ERRORSUMMARY - set if any errors
  15007.      -X-- -XXX ---- ---- = SW_COND - condition code
  15008.      ---- ---X ---- ---- = SW_C0
  15009.      ---- --X- ---- ---- = SW_C1
  15010.      ---- -X-- ---- ---- = SW_C2
  15011.      -X-- ---- ---- ---- = SW_C3
  15012.      --XX X--- ---- ---- = SW_TOP - top of stack (use SW_TOP_SHIFT to shift it)
  15013.      X--- ---- ---- ---- = SW_BUSY - fpu is busy
  15014. File: libc.inf,  Node: _stklen,  Next: stpcpy,  Prev: _status87,  Up: Alphabetical List
  15015. _stklen
  15016. =======
  15017. Syntax
  15018. ------
  15019.      extern int _stklen;
  15020. Description
  15021. -----------
  15022. This variable sets the minimum stack length that the program requires.
  15023. Note that the stack may be much larger than this.  This value should be
  15024. set statically, as it is only used at startup.
  15025. Example
  15026. -------
  15027.      int _stklen = 256000;
  15028. File: libc.inf,  Node: stpcpy,  Next: strcase,  Prev: _stklen,  Up: Alphabetical List
  15029. stpcpy
  15030. ======
  15031. Syntax
  15032. ------
  15033.      #include <string.h>
  15034.      
  15035.      char *stpcpy(char *_dest, const char *_src);
  15036. Description
  15037. -----------
  15038. Like `strcpy' (*note strcpy::.), but return value different.
  15039. Return Value
  15040. ------------
  15041. Returns a pointer to the trailing NUL in DEST.
  15042. File: libc.inf,  Node: strcase,  Next: strcasecmp,  Prev: stpcpy,  Up: Alphabetical List
  15043. strcase
  15044. =======
  15045. Syntax
  15046. ------
  15047.      #include <string.h>
  15048.      
  15049.      int strcase(const char *s1, const char *s2);
  15050. Description
  15051. -----------
  15052. This function compares the two strings, disregarding case.
  15053. Return Value
  15054. ------------
  15055. Zero if they're the same, nonzero if different, the sign indicates
  15056. "order".
  15057. Example
  15058. -------
  15059.      if (strcase(arg, "-i") == 0)
  15060.        do_include();
  15061. File: libc.inf,  Node: strcasecmp,  Next: strcat,  Prev: strcase,  Up: Alphabetical List
  15062. strcasecmp
  15063. ==========
  15064. Syntax
  15065. ------
  15066.      #include <string.h>
  15067.      
  15068.      int strcasecmp(const char *s1, const char *s2);
  15069. Description
  15070. -----------
  15071. This function compares the two strings, disregarding case.
  15072. Return Value
  15073. ------------
  15074. Zero if they're the same, nonzero if different, the sign indicates
  15075. "order".
  15076. Example
  15077. -------
  15078.      if (strcasecmp(arg, "-i") == 0)
  15079.        do_include();
  15080. File: libc.inf,  Node: strcat,  Next: strchr,  Prev: strcasecmp,  Up: Alphabetical List
  15081. strcat
  15082. ======
  15083. Syntax
  15084. ------
  15085.      #include <string.h>
  15086.      
  15087.      char *strcat(char *s1, const char *s2);
  15088. Description
  15089. -----------
  15090. This function concatenates S2 to the end of S1.
  15091. Return Value
  15092. ------------
  15093. Example
  15094. -------
  15095.      char buf[100] = "hello";
  15096.      strcat(buf, " there");
  15097. File: libc.inf,  Node: strchr,  Next: strcmp,  Prev: strcat,  Up: Alphabetical List
  15098. strchr
  15099. ======
  15100. Syntax
  15101. ------
  15102.      #include <string.h>
  15103.      
  15104.      char *strchr(const char *s, int c);
  15105. Description
  15106. -----------
  15107. This function returns a pointer to the first occurrence of C in S.
  15108. Note that if C is `NULL', this will return a pointer to the end of the
  15109. string.
  15110. Return Value
  15111. ------------
  15112. A pointer to the character, or `NULL' if it wasn't found.
  15113. Example
  15114. -------
  15115.      char *slash = strchr(filename, '/');
  15116. File: libc.inf,  Node: strcmp,  Next: strcoll,  Prev: strchr,  Up: Alphabetical List
  15117. strcmp
  15118. ======
  15119. Syntax
  15120. ------
  15121.      #include <string.h>
  15122.      
  15123.      int strcmp(const char *s1, const char *s2);
  15124. Description
  15125. -----------
  15126. This function compares S1 and S2.
  15127. Return Value
  15128. ------------
  15129. Zero if the strings are equal, a positive number if S1 comes after S2
  15130. in the ASCII collating sequense, else a negative number.
  15131. Example
  15132. -------
  15133.      if (strcmp(arg, "-i") == 0)
  15134.        do_include();
  15135. File: libc.inf,  Node: strcoll,  Next: strcpy,  Prev: strcmp,  Up: Alphabetical List
  15136. strcoll
  15137. =======
  15138. Syntax
  15139. ------
  15140.      #include <string.h>
  15141.      
  15142.      int strcoll(const char *s1, const char *s2);
  15143. Description
  15144. -----------
  15145. This function compares S1 and S2, using the collating sequences from
  15146. the current locale.
  15147. Return Value
  15148. ------------
  15149. Zero if the strings are equal, a positive number if S1 comes after S2
  15150. in the collating sequense, else a negative number.
  15151. Example
  15152. -------
  15153.      while (strcoll(var, list[i]) < 0)
  15154.        i++;
  15155. File: libc.inf,  Node: strcpy,  Next: strcspn,  Prev: strcoll,  Up: Alphabetical List
  15156. strcpy
  15157. ======
  15158. Syntax
  15159. ------
  15160.      #include <string.h>
  15161.      
  15162.      char *strcpy(char *s1, const char *s2);
  15163. Description
  15164. -----------
  15165. This function copies S2 into S1.
  15166. Return Value
  15167. ------------
  15168. Example
  15169. -------
  15170.      char buf[100];
  15171.      strcpy(buf, arg);
  15172. File: libc.inf,  Node: strcspn,  Next: strdup,  Prev: strcpy,  Up: Alphabetical List
  15173. strcspn
  15174. =======
  15175. Syntax
  15176. ------
  15177.      #include <string.h>
  15178.      
  15179.      size_t strcspn(const char *s1, const char *set);
  15180. Description
  15181. -----------
  15182. This function finds the first character in S1 that matches any
  15183. character in SET.  Note that the `NULL' bytes at the end of each string
  15184. counts, so you'll at least get a pointer to the end of the string if
  15185. nothing else.
  15186. Return Value
  15187. ------------
  15188. The index of the found character.
  15189. Example
  15190. -------
  15191.      int i = strcspn(command, "<>|");
  15192.      if (command[i])
  15193.        do_redirection();
  15194. File: libc.inf,  Node: strdup,  Next: strerror,  Prev: strcspn,  Up: Alphabetical List
  15195. strdup
  15196. ======
  15197. Syntax
  15198. ------
  15199.      #include <string.h>
  15200.      
  15201.      char * strdup (const char *source);
  15202. Description
  15203. -----------
  15204. Returns a newly allocated area of memory that contains a duplicate of
  15205. the string pointed to by SOURCE.  The memory returned by this call must
  15206. be freed by the caller.
  15207. Return Value
  15208. ------------
  15209. Returns the newly allocated string, or NULL if there is no more memory.
  15210. Example
  15211. -------
  15212.      char *foo()
  15213.      {
  15214.        return strdup("hello");
  15215.      }
  15216. File: libc.inf,  Node: strerror,  Next: strftime,  Prev: strdup,  Up: Alphabetical List
  15217. strerror
  15218. ========
  15219. Syntax
  15220. ------
  15221.      #include <string.h>
  15222.      
  15223.      char *strerror(int error);
  15224. Description
  15225. -----------
  15226. This function returns a string that describes the ERROR.
  15227. Return Value
  15228. ------------
  15229. A pointer to a static string that should not be modified or free'd.
  15230. Example
  15231. -------
  15232.      if (f=fopen("foo", "r") == 0)
  15233.        printf("Error! %s: %s\n", "foo", strerror(errno));
  15234. File: libc.inf,  Node: strftime,  Next: stricmp,  Prev: strerror,  Up: Alphabetical List
  15235. strftime
  15236. ========
  15237. Syntax
  15238. ------
  15239.      #include <time.h>
  15240.      
  15241.      size_t strftime(char *buf, size_t n, const char *format, const struct tm *time);
  15242. Description
  15243. -----------
  15244. This function formats the given TIME according to the given FORMAT and
  15245. stores it in BUF, not exceeding N bytes.
  15246. The format string is like `printf' in that any character other than `%'
  15247. is added to the output string, and for each character following a `%' a
  15248. pattern is added to the string as follows, with the examples as if the
  15249. time was Friday, October 1, 1993, at 03:30:34 PM EDT:
  15250.      The full weekday name (`Friday')
  15251.      The abbreviated weekday name (`Fri')
  15252.      The full month name (`October')
  15253.      The abbreviated month name (`Oct')
  15254.      Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct  1 15:30:34 1993')
  15255.      Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
  15256.      The day of the month, blank padded to two characters (` 2')
  15257.      Short for `%m/%d/%y' (`10/01/93')
  15258.      The day of the month, zero padded to two characters (`02')
  15259.      The hour (0-24), zero padded to two characters (`15')
  15260.      The hour (1-12), zero padded to two characters (`03')
  15261.      The Julian day, zero padded to three characters (`275')
  15262.      The hour (0-24), space padded to two characters (`15')
  15263.      The hour (1-12), space padded to two characters(` 3')
  15264.      The minutes, zero padded to two characters (`30')
  15265.      The month (1-12), zero padded to two characters (`10')
  15266.      A newline (`\n')
  15267.      AM or PM (`PM')
  15268.      Short for `%H:%M' (`15:30')
  15269.      Short for `%I:%M:%S %p' (`03:30:35 PM')
  15270.      The seconds, zero padded to two characters (`35')
  15271.      Short for `%H:%M:%S' (`15:30:35')
  15272.      A tab (`\t')
  15273.      The week of the year, with the first week defined by the first
  15274.      Sunday of the year, zero padded to two characters (`39')
  15275.      The week of the year, with the first week defined by the first
  15276.      Monday of the year, zero padded to two characters (`39')
  15277.      The day of the week (0-6) (`5')
  15278.      Short for `%m/%d/%y' (`10/01/93')
  15279.      The year (00-99) of the century (`93')
  15280.      The year, zero padded to four digits (`1993')
  15281.      The timezone abbreviation (`EDT')
  15282.      A percent symbol (`%')
  15283. Return Value
  15284. ------------
  15285. The number of characters stored.
  15286. Example
  15287. -------
  15288.      struct tm t;
  15289.      char buf[100];
  15290.      strftime(buf, 100, "%B %d, %Y", &t);
  15291. File: libc.inf,  Node: stricmp,  Next: strlen,  Prev: strftime,  Up: Alphabetical List
  15292. stricmp
  15293. =======
  15294. Syntax
  15295. ------
  15296.      #include <string.h>
  15297.      
  15298.      int stricmp(const char *s1, const char *s2);
  15299. Description
  15300. -----------
  15301. This function compares the two strings, disregarding case.
  15302. Return Value
  15303. ------------
  15304. Zero if they're the same, nonzero if different, the sign indicates
  15305. "order".
  15306. Example
  15307. -------
  15308.      if (stricmp(arg, "-i") == 0)
  15309.        do_include();
  15310. File: libc.inf,  Node: strlen,  Next: strlwr,  Prev: stricmp,  Up: Alphabetical List
  15311. strlen
  15312. ======
  15313. Syntax
  15314. ------
  15315.      #include <string.h>
  15316.      
  15317.      size_t strlen(const char *string);
  15318. Description
  15319. -----------
  15320. This function returns the number of characters in STRING.
  15321. Return Value
  15322. ------------
  15323. The length of the string.
  15324. Example
  15325. -------
  15326.      if (strlen(fname) > PATH_MAX)
  15327.        invalid_file(fname);
  15328. File: libc.inf,  Node: strlwr,  Next: strncase,  Prev: strlen,  Up: Alphabetical List
  15329. strlwr
  15330. ======
  15331. Syntax
  15332. ------
  15333.      #include <string.h>
  15334.      
  15335.      char *strlwr(char *string);
  15336. Description
  15337. -----------
  15338. This function replaces all upper case letters in STRING with lower case
  15339. letters.
  15340. Return Value
  15341. ------------
  15342. The string.
  15343. Example
  15344. -------
  15345.      char buf[100] = "Hello";
  15346.      strlwr(buf);
  15347. File: libc.inf,  Node: strncase,  Next: strncasecmp,  Prev: strlwr,  Up: Alphabetical List
  15348. strncase
  15349. ========
  15350. Syntax
  15351. ------
  15352.      #include <string.h>
  15353.      
  15354.      int strncase(const char *s1, const char *s2, size_t max);
  15355. Description
  15356. -----------
  15357. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  15358. characters.
  15359. Return Value
  15360. ------------
  15361. Zero if the strings are equal, a positive number if S1 comes after S2
  15362. in the ASCII collating sequense, else a negative number.
  15363. Example
  15364. -------
  15365.      if (strncase(foo, "-i", 2) == 0)
  15366.        do_include();
  15367. File: libc.inf,  Node: strncasecmp,  Next: strncat,  Prev: strncase,  Up: Alphabetical List
  15368. strncasecmp
  15369. ===========
  15370. Syntax
  15371. ------
  15372.      #include <string.h>
  15373.      
  15374.      int strncasecmp(const char *s1, const char *s2, size_t max);
  15375. Description
  15376. -----------
  15377. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  15378. characters.
  15379. Return Value
  15380. ------------
  15381. Zero if the strings are equal, a positive number if S1 comes after S2
  15382. in the ASCII collating sequense, else a negative number.
  15383. Example
  15384. -------
  15385.      if (strncasecmp(foo, "-i", 2) == 0)
  15386.        do_include();
  15387. File: libc.inf,  Node: strncat,  Next: strncmp,  Prev: strncasecmp,  Up: Alphabetical List
  15388. strncat
  15389. =======
  15390. Syntax
  15391. ------
  15392.      #include <string.h>
  15393.      
  15394.      char *strncat(char *s1, const char *s2, size_t max);
  15395. Description
  15396. -----------
  15397. This function concatenates up to MAX characters of S2 to the end of S1.
  15398. Return Value
  15399. ------------
  15400. Example
  15401. -------
  15402.      strncat(fname, extension, 4);
  15403. File: libc.inf,  Node: strncmp,  Next: strncpy,  Prev: strncat,  Up: Alphabetical List
  15404. strncmp
  15405. =======
  15406. Syntax
  15407. ------
  15408.      #include <string.h>
  15409.      
  15410.      int strncmp(const char *s1, const char *s2, size_t max);
  15411. Description
  15412. -----------
  15413. This function compares upto MAX characters of S1 and S2.
  15414. Return Value
  15415. ------------
  15416. Zero if the strings are equal, a positive number if S1 comes after S2
  15417. in the ASCII collating sequense, else a negative number.
  15418. Example
  15419. -------
  15420.      if (strncmp(arg, "-i", 2) == 0)
  15421.        do_include();
  15422. File: libc.inf,  Node: strncpy,  Next: strnicmp,  Prev: strncmp,  Up: Alphabetical List
  15423. strncpy
  15424. =======
  15425. Syntax
  15426. ------
  15427.      #include <string.h>
  15428.      
  15429.      char *strncpy(char *s1, const char *s2, size_t max);
  15430. Description
  15431. -----------
  15432. This function copies up to MAX characters of S2 into S1.
  15433. Return Value
  15434. ------------
  15435. Example
  15436. -------
  15437.      char buf[100];
  15438.      strcpy(buf, arg, 99);
  15439. File: libc.inf,  Node: strnicmp,  Next: strpbrk,  Prev: strncpy,  Up: Alphabetical List
  15440. strnicmp
  15441. ========
  15442. Syntax
  15443. ------
  15444.      #include <string.h>
  15445.      
  15446.      int strnicmp(const char *s1, const char *s2, size_t max);
  15447. Description
  15448. -----------
  15449. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  15450. characters.
  15451. Return Value
  15452. ------------
  15453. Zero if the strings are equal, a positive number if S1 comes after S2
  15454. in the ASCII collating sequense, else a negative number.
  15455. Example
  15456. -------
  15457.      if (strnicmp(foo, "-i", 2) == 0)
  15458.        do_include();
  15459. File: libc.inf,  Node: strpbrk,  Next: strrchr,  Prev: strnicmp,  Up: Alphabetical List
  15460. strpbrk
  15461. =======
  15462. Syntax
  15463. ------
  15464.      #include <string.h>
  15465.      
  15466.      char *strpbrk(const char *s1, const char *set);
  15467. Description
  15468. -----------
  15469. This function finds the first character in S1 that matches any
  15470. character in SET.
  15471. Return Value
  15472. ------------
  15473. A pointer to the first match, or `NULL' if none are found.
  15474. Example
  15475. -------
  15476.      if (strpbrk(command, "<>|"))
  15477.        do_redirection();
  15478. File: libc.inf,  Node: strrchr,  Next: strsep,  Prev: strpbrk,  Up: Alphabetical List
  15479. strrchr
  15480. =======
  15481. Syntax
  15482. ------
  15483.      #include <string.h>
  15484.      
  15485.      char *strrchr(const char *s1, int c);
  15486. Description
  15487. -----------
  15488. This function finds the last occurrence of `c' in `s1'.
  15489. Return Value
  15490. ------------
  15491. A pointer to the last match, or `NULL' if the character isn't in the
  15492. string.
  15493. Example
  15494. -------
  15495.      char *last_slash = strrchr(filename, '/');
  15496. File: libc.inf,  Node: strsep,  Next: strspn,  Prev: strrchr,  Up: Alphabetical List
  15497. strsep
  15498. ======
  15499. Syntax
  15500. ------
  15501.      #include <string.h>
  15502.      
  15503.      char *strsep(char **stringp, char *delim);
  15504. Description
  15505. -----------
  15506. This function retrieves the next token from the given string, where
  15507. STRINGP points to a variable holding, initially, the start of the
  15508. string.  Tokens are delimited by a character from DELIM.  Each time the
  15509. function is called, it returns a pointer to the next token, and sets
  15510. *STRINGP to the next spot to check, or `NULL'.
  15511. Return Value
  15512. ------------
  15513. The next token, or NULL.
  15514. Example
  15515. -------
  15516.      main()
  15517.      {
  15518.        char *buf = "Hello  there,stranger";
  15519.        char **bp = &buf;
  15520.        char *tok;
  15521.        while (tok = strsep(bp, " ,"))
  15522.          printf("tok = `%s'\n", tok);
  15523.      }
  15524.      
  15525.      tok = `Hello'
  15526.      tok = `'
  15527.      tok = `there'
  15528.      tok = `stranger'
  15529. File: libc.inf,  Node: strspn,  Next: strstr,  Prev: strsep,  Up: Alphabetical List
  15530. strspn
  15531. ======
  15532. Syntax
  15533. ------
  15534.      #include <string.h>
  15535.      
  15536.      size_t strspn(const char *s1, const char *set);
  15537. Description
  15538. -----------
  15539. This function finds the first character in S1 that does not match any
  15540. character in SET.  Note that the `NULL' bytes at the end of S1 counts,
  15541. so you'll at least get a pointer to the end of the string if nothing
  15542. else.
  15543. Return Value
  15544. ------------
  15545. The index of the found character.
  15546. Example
  15547. -------
  15548.      int i = strcspn(entry, " \t\b");
  15549.      if (entry[i])
  15550.        do_something();
  15551. File: libc.inf,  Node: strstr,  Next: strtod,  Prev: strspn,  Up: Alphabetical List
  15552. strstr
  15553. ======
  15554. Syntax
  15555. ------
  15556.      #include <string.h>
  15557.      
  15558.      char *strstr(const char *s1, const char *s2);
  15559. Description
  15560. -----------
  15561. This function finds the first occurrence of S2 in S1.
  15562. Return Value
  15563. ------------
  15564. A pointer within S1, or `NULL' if S2 wasn't found.
  15565. Example
  15566. -------
  15567.      if (strstr(command, ".exe"))
  15568.        do_exe();
  15569. File: libc.inf,  Node: strtod,  Next: strtok,  Prev: strstr,  Up: Alphabetical List
  15570. strtod
  15571. ======
  15572. Syntax
  15573. ------
  15574.      #include <stdlib.h>
  15575.      
  15576.      double strtod(const char *s, char **endp);
  15577. Description
  15578. -----------
  15579. This function converts as many characters of S that look like a
  15580. floating point number into one, and sets *ENDP to point to the first
  15581. unused character.
  15582. Return Value
  15583. ------------
  15584. The value the string represented.
  15585. Example
  15586. -------
  15587.      char *buf = "123ret";
  15588.      char *bp;
  15589.      double x = strtod(buf, &bp);
  15590. File: libc.inf,  Node: strtok,  Next: strtol,  Prev: strtod,  Up: Alphabetical List
  15591. strtok
  15592. ======
  15593. Syntax
  15594. ------
  15595.      #include <string.h>
  15596.      
  15597.      char *strtok(char *s1, const char *s2);
  15598. Description
  15599. -----------
  15600. This function retrieves tokens from S1 which are delimited by
  15601. characters from S2.
  15602. To initiate the search, pass the string to be searched as S1.  For the
  15603. remaining tokens, pass `NULL' instead.
  15604. Return Value
  15605. ------------
  15606. A pointer to the token, or `NULL' if no more are found.
  15607. Example
  15608. -------
  15609.      main()
  15610.      {
  15611.        char *buf = "Hello there, stranger";
  15612.        char *tok;
  15613.        for (tok = strtok(buf, " ,");
  15614.             tok;
  15615.             tok=strtok(0, " ,"))
  15616.          printf("tok = `%s'\n", tok);
  15617.      }
  15618.      
  15619.      tok = `Hello'
  15620.      tok = `there'
  15621.      tok = `stranger'
  15622. File: libc.inf,  Node: strtol,  Next: _strtold,  Prev: strtok,  Up: Alphabetical List
  15623. strtol
  15624. ======
  15625. Syntax
  15626. ------
  15627.      #include <stdlib.h>
  15628.      
  15629.      long strtol(const char *s, char **endp, int base);
  15630. Description
  15631. -----------
  15632. This function converts as much of S as looks like an appropriate number
  15633. into the value of that number, and sets *ENDP to point to the first
  15634. unused character.
  15635. The BASE argument indicates what base the digits (or letters) should be
  15636. treated as.  If BASE is zero, the base is determined by looking for
  15637. `0x', `0X', or `0' as the first part of the string, and sets the base
  15638. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  15639. of those prefixes are found.
  15640. Return Value
  15641. ------------
  15642. The value.
  15643. Example
  15644. -------
  15645.      printf("Enter a number: "); fflush(stdout);
  15646.      gets(buf);
  15647.      char *bp;
  15648.      printf("The value is %d\n", strtol(buf, &bp, 0));
  15649. File: libc.inf,  Node: _strtold,  Next: strtoll,  Prev: strtol,  Up: Alphabetical List
  15650. _strtold
  15651. ========
  15652. Syntax
  15653. ------
  15654.      #include <stdlib.h>
  15655.      
  15656.      long double _strtold(const char *s, char **endp);
  15657. Description
  15658. -----------
  15659. This function converts as many characters of S that look like a
  15660. floating point number into one, and sets *ENDP to point to the first
  15661. unused character.
  15662. Return Value
  15663. ------------
  15664. The value the string represented.
  15665. Example
  15666. -------
  15667.      char *buf = "123ret";
  15668.      char *bp;
  15669.      long double x = _strtold(buf, &bp);
  15670. File: libc.inf,  Node: strtoll,  Next: strtoul,  Prev: _strtold,  Up: Alphabetical List
  15671. strtoll
  15672. =======
  15673. Syntax
  15674. ------
  15675.      #include <stdlib.h>
  15676.      
  15677.      long long strtoll(const char *s, char **endp, int base);
  15678. Description
  15679. -----------
  15680. This function converts as much of S as looks like an appropriate number
  15681. into the value of that number, and sets *ENDP to point to the first
  15682. unused character.
  15683. The BASE argument indicates what base the digits (or letters) should be
  15684. treated as.  If BASE is zero, the base is determined by looking for
  15685. `0x', `0X', or `0' as the first part of the string, and sets the base
  15686. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  15687. of those prefixes are found.
  15688. Return Value
  15689. ------------
  15690. The value.
  15691. Example
  15692. -------
  15693.      printf("Enter a number: "); fflush(stdout);
  15694.      gets(buf);
  15695.      char *bp;
  15696.      printf("The value is %lld\n", strtoll(buf, &bp, 0));
  15697. File: libc.inf,  Node: strtoul,  Next: strtoull,  Prev: strtoll,  Up: Alphabetical List
  15698. strtoul
  15699. =======
  15700. Syntax
  15701. ------
  15702.      #include <stdlib.h>
  15703.      
  15704.      unsigned long strtoul(const char *s, char **endp, int base);
  15705. Description
  15706. -----------
  15707. This is just like `strtol' (*note strtol::.) except that the result is
  15708. unsigned.
  15709. Return Value
  15710. ------------
  15711. The value.
  15712. Example
  15713. -------
  15714.      printf("Enter a number: "); fflush(stdout);
  15715.      gets(buf);
  15716.      char *bp;
  15717.      printf("The value is %u\n", strtoul(buf, &bp, 0));
  15718. File: libc.inf,  Node: strtoull,  Next: strupr,  Prev: strtoul,  Up: Alphabetical List
  15719. strtoull
  15720. ========
  15721. Syntax
  15722. ------
  15723.      #include <stdlib.h>
  15724.      
  15725.      unsigned long long strtoull(const char *s, char **endp, int base);
  15726. Description
  15727. -----------
  15728. This is just like `strtoll' (*note strtoll::.) except that the result
  15729. is unsigned.
  15730. Return Value
  15731. ------------
  15732. The value.
  15733. Example
  15734. -------
  15735.      printf("Enter a number: "); fflush(stdout);
  15736.      gets(buf);
  15737.      char *bp;
  15738.      printf("The value is %llu\n", strtoull(buf, &bp, 0));
  15739. File: libc.inf,  Node: strupr,  Next: strxfrm,  Prev: strtoull,  Up: Alphabetical List
  15740. strupr
  15741. ======
  15742. Syntax
  15743. ------
  15744.      #include <string.h>
  15745.      
  15746.      char *strupr(char *string);
  15747. Description
  15748. -----------
  15749. This function converts all lower case characters in STRING to upper
  15750. case.
  15751. Return Value
  15752. ------------
  15753. STRING
  15754. Example
  15755. -------
  15756.      char buf[] = "Foo!";
  15757.      strupr(buf);
  15758. File: libc.inf,  Node: strxfrm,  Next: swab,  Prev: strupr,  Up: Alphabetical List
  15759. strxfrm
  15760. =======
  15761. Syntax
  15762. ------
  15763.      #include <string.h>
  15764.      
  15765.      size_t strxfrm(char *s1, const char *s2, size_t max);
  15766. Description
  15767. -----------
  15768. This copies characters from S2 to S1, which must be able to hold MAX
  15769. characters.  Each character is transformed according to the locale such
  15770. that `strcmp(s1b, s2b)' is just like `strcoll(s1, s2)' where `s1b' and
  15771. `s2b' are the transforms of `s1' and `s2'.
  15772. Return Value
  15773. ------------
  15774. The actual number of bytes required to transform S2, including the
  15775. `NULL'.
  15776. File: libc.inf,  Node: swab,  Next: symlink,  Prev: strxfrm,  Up: Alphabetical List
  15777. Syntax
  15778. ------
  15779.      #include <stdlib.h>
  15780.      
  15781.      void swab(const void *from, void *to, int nbytes);
  15782. Description
  15783. -----------
  15784. This function copies NBYTES bytes from the address pointed to by FROM
  15785. to the address pointed by TO, exchanging adjacent even and odd bytes.
  15786. It is useful for carrying binary data between little-endian and
  15787. big-endian machines.  The argument NBYTES should be even, and the
  15788. buffers FROM and TO should not overlap.
  15789. Return Value
  15790. ------------
  15791. None.
  15792. File: libc.inf,  Node: symlink,  Next: sync,  Prev: swab,  Up: Alphabetical List
  15793. symlink
  15794. =======
  15795. Syntax
  15796. ------
  15797.      #include <unistd.h>
  15798.      
  15799.      int symlink(const char *exists, const char *new);
  15800. Description
  15801. -----------
  15802. MSDOS doesn't support symbolic links.  However, DJGPP supports
  15803. "symlinks" to DJGPP programs.  This function simulates a symlink
  15804. between two `.exe' files in the DJGPP style.  It creates a program
  15805. whose name is given by *NEW which, when run, will actually execute the
  15806. program *EXISTS passing it *NEW in `argv[0]' (some programs change
  15807. their behavior depending on what's passed in `argv[0]').  The file
  15808. referred to by EXISTS doesn't really have to exist when this function
  15809. is called.  Both *NEW and *EXISTS can point to a name with or without
  15810. the `.exe' extension.
  15811. Note that both *EXISTS and *NEW must reside in the same directory (this
  15812. is a restriction of the DJGPP "symlinks"); the function will fail and
  15813. set `errno' to `EXDEV' if they aren't.  Also note that this function
  15814. does nothing to ensure that *EXISTS is actually a DJGPP program.
  15815. This functions runs the `stubify' and `stubedit' programs, so they
  15816. should be somewhere on your `PATH' for the function to succeed.  (These
  15817. programs come with the DJGPP development distribution.)
  15818. Return Value
  15819. ------------
  15820. Zero in case of success, -1 in case of failure (and `errno' set to the
  15821. appropriate error code).
  15822. Example
  15823. -------
  15824.      symlink ("c:/djgpp/bin/grep", "c:/djgpp/bin/fgrep");
  15825. File: libc.inf,  Node: sync,  Next: sys_errlist,  Prev: symlink,  Up: Alphabetical List
  15826. Description
  15827. -----------
  15828. This function is provided only to assist in porting from Unix.  It
  15829. always returns zero.
  15830. File: libc.inf,  Node: sys_errlist,  Next: sys_nerr,  Prev: sync,  Up: Alphabetical List
  15831. sys_errlist
  15832. ===========
  15833. Syntax
  15834. ------
  15835.      #include <errno.h>
  15836.      
  15837.      extern char *sys_errlist[];
  15838. Description
  15839. -----------
  15840. This array contains error messages, indexed by `errno', that describe
  15841. the errors.
  15842. Example
  15843. -------
  15844.      printf("Error: %s\n", sys_errlist[errno]);
  15845. File: libc.inf,  Node: sys_nerr,  Next: sysconf,  Prev: sys_errlist,  Up: Alphabetical List
  15846. sys_nerr
  15847. ========
  15848. Syntax
  15849. ------
  15850.      #include <errno.h>
  15851.      
  15852.      extern int sys_nerr;
  15853. Description
  15854. -----------
  15855. This variable gives the number of error messages in `sys_errlist'
  15856. (*note sys_errlist::.).
  15857. Example
  15858. -------
  15859.      if (errno < sys_nerr)
  15860.        printf("Error: %s\n", sys_errlist[errno]);
  15861. File: libc.inf,  Node: sysconf,  Next: system,  Prev: sys_nerr,  Up: Alphabetical List
  15862. sysconf
  15863. =======
  15864. Syntax
  15865. ------
  15866.      #include <unistd.h>
  15867.      
  15868.      long sysconf(int which);
  15869. Description
  15870. -----------
  15871. This function returns various system configuration values, based on
  15872. WHICH:
  15873.        case _SC_ARG_MAX:    return ARG_MAX;
  15874.        case _SC_CHILD_MAX:    return CHILD_MAX;
  15875.        case _SC_CLK_TCK:    return CLOCKS_PER_SEC;
  15876.        case _SC_NGROUPS_MAX:    return NGROUPS_MAX;
  15877.        case _SC_OPEN_MAX:    return 255;
  15878.        case _SC_JOB_CONTROL:    return -1;
  15879.        case _SC_SAVED_IDS:    return -1;
  15880.        case _SC_STREAM_MAX:    return _POSIX_STREAM_MAX;
  15881.        case _SC_TZNAME_MAX:    return TZNAME_MAX;
  15882.        case _SC_VERSION:    return _POSIX_VERSION;
  15883. Return Value
  15884. ------------
  15885. The value.
  15886. File: libc.inf,  Node: system,  Next: tan,  Prev: sysconf,  Up: Alphabetical List
  15887. system
  15888. ======
  15889. Syntax
  15890. ------
  15891.      #include <stdlib.h>
  15892.      
  15893.      int system(const char *cmd);
  15894. Description
  15895. -----------
  15896. This function runs the command or program specified by CMD.  When
  15897. calling programs compiled by DJGPP this function will not use
  15898. `command.com' and so will not be subject to its 126 character limit on
  15899. command lines.
  15900. Command lines and pipes( i.e., the use of "<", ">", ">>", and "|") will
  15901. be simulated internally in this function; this means that you can have
  15902. both long command lines and redirection/pipes when running DJGPP
  15903. programs with this function.
  15904. By default, `command.com' will only be invoked to run commands internal
  15905. to it, or to run batch files (but this can be changed, see below).  In
  15906. these cases, the returned error code will always be zero, since
  15907. `command.com' always exits with code 0.
  15908. Certain commands internal to `command.com' that don't make sense or
  15909. cause no effect in the context of `system' are ignored by this
  15910. function.  These are `REM', `EXIT', `GOTO', `SHIFT'; `SET', `PATH' and
  15911. `PROMPT' are ignored only if called with an argument.  You can disable
  15912. this feature if you need, see below.
  15913. Some commands are emulated internally by `system', because the
  15914. emulation is better than the original.  Currently, the only emulated
  15915. command is `CD' or `CHDIR': the emulation knows about forward slashes
  15916. and also switches the current drive.  This emulation can also be
  15917. switched off, as explained below.
  15918. When `system' is presented with an internal shell command, it checks
  15919. the environment variables `SHELL' and `COMSPEC' (in that order) and
  15920. invokes the program that they point to.  If the shell thus found is one
  15921. of the DOS shells (`command.com', `4DOS' or `NDOS'), they are called
  15922. with the `/c' switch prepended to the command line.  Otherwise,
  15923. `system' assumes that the shell is a Unix-style shell and invokes it
  15924. with a `-c' switch, passing the entire command line via a response file
  15925. (this should work with any shell compiled with DJGPP, and with the
  15926. `ms_sh' shell).
  15927. Shell scripts and batch files are invoked by calling either the program
  15928. whose name appears on the first line (like in `#! /bin/sh'), or the
  15929. default shell if none is specified by the script.  If the name of the
  15930. shell specified by the script is a Unix-style pathname, without a drive
  15931. letter and with no extension, `system' will additionally search for it
  15932. on the `PATH'.  This allows to invoke Unix shell scripts unmodified, if
  15933. you have a ported shell installed on your system.
  15934. You can customize the behavior of `system' using a bit-mapped variable
  15935. __SYSTEM_FLAGS, defined on `<stdlib.h>'.  The following bits are
  15936. currently defined:
  15937. `__system_redirect'
  15938.      When set (the default), specifies that `system' can use its
  15939.      internal redirection and pipe code.  If reset, any command line
  15940.      that includes an unquoted redirection symbol will be passed to the
  15941.      shell.
  15942. `__system_call_cmdproc'
  15943.      When set, `system' will always call the shell to execute the
  15944.      command line.  If reset (the default), the shell will only be
  15945.      called when needed, as described above.
  15946.      You should *always* set this bit if you use a real, Unix-style
  15947.      shell (also, set `__system_use_shell', described below, and the
  15948.      `SHELL' environment variable).
  15949. `__system_use_shell'
  15950.      When set (the default), the `SHELL' environment variable will take
  15951.      precedence upon `COMSPEC'; this allows you to specify a special
  15952.      shell for `system' that doesn't affect the rest of DOS.  If reset,
  15953.      only `COMSPEC' is used to find the name of the command processor.
  15954. `__system_allow_multiple_cmds'
  15955.      When set, you can put multiple commands together separated by the
  15956.      `;' character.  If reset (the default), the command line passed to
  15957.      `system' is executed as a single command and `;' has no special
  15958.      meaning.
  15959. `__system_allow_long_cmds'
  15960.      When set (the default), `system' will handle command lines longer
  15961.      than the DOS 126-character limit; this might crash your program in
  15962.      some cases, as the low-level functions that invoke the child
  15963.      program will only pass them the first 126 characters.  When reset,
  15964.      `system' will detect early that the command line is longer than
  15965.      126 characters and refuse to run it, but you will not be able to
  15966.      call DJGPP programs with long command lines.
  15967. `__system_emulate_command'
  15968.      If reset (the default), `system' will pass the entire command line
  15969.      to the shell if its name is one of the following: `sh.exe',
  15970.      `sh16.exe', `sh32.exe', `bash.exe', `tcsh.exe'.  When set,
  15971.      `system' will attempt to emulate redirection and pipes internally,
  15972.      even if `COMSPEC' or `SHELL' point to a Unix-style shell.
  15973. `__system_handle_null_commands'
  15974.      When set (the default), commands internal to `COMMAND.COM' and
  15975.      compatible shells which have no effect in the context of `system',
  15976.      are ignored (the list of these commands was given above).  If
  15977.      reset, these commands are processed as all others, which means
  15978.      `COMMAND.COM' will be called to execute them.
  15979.      Note that this bit shouldn't be used with a Unix-style shell,
  15980.      because it does the wrong thing then.  With Unix-style shells, you
  15981.      are supposed to set the `__system_call_cmdproc' bit which will
  15982.      always call the shell.
  15983. `__system_ignore_chdir'
  15984.      If set, the `CD' and `CHDIR' commands are ignored.  When reset
  15985.      (the default), the processing of these commands depends on the
  15986.      `__system_emulate_chdir' bit, see below.
  15987.      This bit is for compatibility with Unix, where a single `cd dir'
  15988.      command has no effect, because the current working directory there
  15989.      is not a global notion (as on MSDOS).  Don't set this bit if you
  15990.      use multiple commands (see `__system_allow_multiple_cmds' above).
  15991. `__system_emulate_chdir'
  15992.      When set, the `CD' and `CHDIR' commands are emulated internally:
  15993.      they change the drive when the argument specifies a drive letter,
  15994.      and they support both forward slashes and backslashes in
  15995.      pathnames.  When `CD' is called without an argument, it prints the
  15996.      current working directory with forward slashes and down-cases DOS
  15997.      8+3 names.  If this bit is reset (the default), `CD' and `CHDIR'
  15998.      are passed to the shell.
  15999. The behavior of `system' can be customized at run time by defining the
  16000. variable `DJSYSFLAGS' in the environment.  The value of that variable
  16001. should be the numerical value of `__system_flags' that you'd like to
  16002. set; it will override the value of `__system_flags' specified when the
  16003. program was compiled.
  16004. Return Value
  16005. ------------
  16006. The exit status of the child process in the lower 8 bits of the return
  16007. value; bits 8-17 of the return value will hold `SIGINT' or `SIGABRT' if
  16008. the child process was aborted by `Ctrl-C' or Critical Device Error,
  16009. respectively; otherwise it will be zero.  If the child couldn't be run,
  16010. `system' will return -1 and set `errno' to an appropriate value.  Note
  16011. that if `COMMAND.COM' was used to run the child, it will always return
  16012. a 0 status, even if the command didn't run successfully.  However,
  16013. `system' only calls `COMMAND.COM' when it needs to run commands
  16014. internal to it.
  16015. Example
  16016. -------
  16017.      system("cc1plus.exe @cc123456.gp");
  16018. File: libc.inf,  Node: tan,  Next: tanh,  Prev: system,  Up: Alphabetical List
  16019. Syntax
  16020. ------
  16021.      #include <math.h>
  16022.      
  16023.      double tan(double x);
  16024. Return Value
  16025. ------------
  16026. The tangent of X.
  16027. File: libc.inf,  Node: tanh,  Next: tcdrain,  Prev: tan,  Up: Alphabetical List
  16028. Syntax
  16029. ------
  16030.      #include <math.h>
  16031.      
  16032.      double tanh(double x);
  16033. Return Value
  16034. ------------
  16035. The hyperbolic tangent of X.
  16036. File: libc.inf,  Node: tcdrain,  Next: tcflow,  Prev: tanh,  Up: Alphabetical List
  16037. tcdrain
  16038. =======
  16039. Syntax
  16040. ------
  16041.      #include <termios.h>
  16042.      
  16043.      int tcdrain (int fd);
  16044. Description
  16045. -----------
  16046. This function waits finishing writing queued buffer to FD. It is
  16047. provided for compatibility only.  Note that the termios emulation
  16048. handles console only.
  16049. Return Value
  16050. ------------
  16051. Zero on success, nonzero on failure.
  16052. File: libc.inf,  Node: tcflow,  Next: tcflush,  Prev: tcdrain,  Up: Alphabetical List
  16053. tcflow
  16054. ======
  16055. Syntax
  16056. ------
  16057.      #include <termios.h>
  16058.      
  16059.      int tcflow (int fd, int action);
  16060. Description
  16061. -----------
  16062. This function performs flow control specified by ACTION on FD.  It is
  16063. provided for compatibility only.  Note that the termios emulation
  16064. handles console only.
  16065. Return Value
  16066. ------------
  16067. Zero on success, nonzero on failure.
  16068. File: libc.inf,  Node: tcflush,  Next: tcgetattr,  Prev: tcflow,  Up: Alphabetical List
  16069. tcflush
  16070. =======
  16071. Syntax
  16072. ------
  16073.      #include <termios.h>
  16074.      
  16075.      int tcflush (int fd, int which);
  16076. Description
  16077. -----------
  16078. This function clears the input and/or output queues on FD. It is
  16079. provided for compatibility only.  Note that the termios emulation
  16080. handles console only.
  16081. Return Value
  16082. ------------
  16083. Zero on success, nonzero on failure.
  16084. File: libc.inf,  Node: tcgetattr,  Next: tcsendbreak,  Prev: tcflush,  Up: Alphabetical List
  16085. tcgetattr
  16086. =========
  16087. Syntax
  16088. ------
  16089.      #include <termios.h>
  16090.      
  16091.      int tcgetattr (int fd, struct termios *termiosp);
  16092. Description
  16093. -----------
  16094. This function gets termios structure from device FD and stores it in
  16095. the structure TERMIOSP.  Note that the termios emulation handles
  16096. console only.
  16097. Return Value
  16098. ------------
  16099. Zero on success, nonzero on failure.
  16100. Example
  16101. -------
  16102.      struct termios termiosbuf;
  16103.      int rc = tcgetattr (0, &termiosbuf);
  16104. File: libc.inf,  Node: tcsendbreak,  Next: tcsetattr,  Prev: tcgetattr,  Up: Alphabetical List
  16105. tcsendbreak
  16106. ===========
  16107. Syntax
  16108. ------
  16109.      #include <termios.h>
  16110.      
  16111.      int tcsendbreak (int fd, int duration);
  16112. Description
  16113. -----------
  16114. This function generates a break condition. It is provided for
  16115. compatibility only.  Note that the termios emulation handles console
  16116. only.
  16117. Return Value
  16118. ------------
  16119. Zero on success, nonzero on failure.
  16120. File: libc.inf,  Node: tcsetattr,  Next: tell,  Prev: tcsendbreak,  Up: Alphabetical List
  16121. tcsetattr
  16122. =========
  16123. Syntax
  16124. ------
  16125.      #include <termios.h>
  16126.      
  16127.      int tcsetattr (int fd, int action, const struct termios *termiosp);
  16128. Description
  16129. -----------
  16130. This function sets termios structure for device FD from the structure
  16131. TERMIOSP.  Note that the termios emulation handles console only.
  16132. Return Value
  16133. ------------
  16134. Zero on success, nonzero on failure.
  16135. Example
  16136. -------
  16137.      tcsetattr (0, TCSANOW, &termiosbuf);
  16138. File: libc.inf,  Node: tell,  Next: telldir,  Prev: tcsetattr,  Up: Alphabetical List
  16139. Syntax
  16140. ------
  16141.      #include <io.h>
  16142.      
  16143.      off_t tell(int file);
  16144. Description
  16145. -----------
  16146. This function returns the location of the file pointer for FILE.
  16147. Return Value
  16148. ------------
  16149. The file pointer, or -1 on error.
  16150. Example
  16151. -------
  16152.      off_t q = tell(fd);
  16153. File: libc.inf,  Node: telldir,  Next: textattr,  Prev: tell,  Up: Alphabetical List
  16154. telldir
  16155. =======
  16156. Syntax
  16157. ------
  16158.      #include <dirent.h>
  16159.      
  16160.      long telldir(DIR *dir);
  16161. Description
  16162. -----------
  16163. This function returns a value which indicates the position of the
  16164. pointer in the given directory.  This value is only useful as an
  16165. argument to `seekdir' (*note seekdir::.).
  16166. Return Value
  16167. ------------
  16168. The directory pointer.
  16169. Example
  16170. -------
  16171.      DIR *dir;
  16172.      long q = telldir(dir);
  16173.      do_something();
  16174.      seekdir(dir, q);
  16175. File: libc.inf,  Node: textattr,  Next: textbackground,  Prev: telldir,  Up: Alphabetical List
  16176. textattr
  16177. ========
  16178. Syntax
  16179. ------
  16180.      #include <conio.h>
  16181.      
  16182.      void textattr(int _attr);
  16183. Description
  16184. -----------
  16185. Sets the attribute used for future writes to the screen:
  16186.      ---- XXXX = foreground color
  16187.      -XXX ---- = background color
  16188.      X--- ---- = 1=blink 0=steady
  16189. File: libc.inf,  Node: textbackground,  Next: textcolor,  Prev: textattr,  Up: Alphabetical List
  16190. textbackground
  16191. ==============
  16192. Syntax
  16193. ------
  16194.      #include <conio.h>
  16195.      
  16196.      void textbackground(int _color);
  16197. Description
  16198. -----------
  16199. Sets just the background of the text attribute. *Note textattr::.
  16200. File: libc.inf,  Node: textcolor,  Next: textmode,  Prev: textbackground,  Up: Alphabetical List
  16201. textcolor
  16202. =========
  16203. Syntax
  16204. ------
  16205.      #include <conio.h>
  16206.      
  16207.      void textcolor(int _color);
  16208. Description
  16209. -----------
  16210. Sets just the foreground of the text attribute. *Note textattr::.
  16211. File: libc.inf,  Node: textmode,  Next: time,  Prev: textcolor,  Up: Alphabetical List
  16212. textmode
  16213. ========
  16214. Syntax
  16215. ------
  16216.      #include <conio.h>
  16217.      
  16218.      void textmode(int _mode);
  16219. Description
  16220. -----------
  16221. Sets the text mode of the screen.  _MODE is one of the following:
  16222. `LASTMODE'
  16223.      The text mode which was in effect *before* the last call to
  16224.      `textmode()'.
  16225. `BW40'
  16226.      40-column black and white (on a color screen)
  16227. `C40'
  16228.      40-color color.
  16229. `BW80'
  16230.      80-column black and white (on a color screen)
  16231. `C80'
  16232.      80-column color
  16233. `MONO'
  16234.      The monochrome monitor
  16235. `C4350'
  16236.      80-column, 43- (on EGAs) or 50-row (on VGAs) color
  16237. *Note _set_screen_lines::, for a more versatile method of setting text
  16238. screen dimensions.
  16239. File: libc.inf,  Node: time,  Next: times,  Prev: textmode,  Up: Alphabetical List
  16240. Syntax
  16241. ------
  16242.      #include <time.h>
  16243.      
  16244.      time_t time(time_t *t);
  16245. Description
  16246. -----------
  16247. If T is not `NULL', the current time is stored in `*t'.
  16248. Return Value
  16249. ------------
  16250. The current time is returned.
  16251. Example
  16252. -------
  16253.      printf("Time is %d\n", time(0));
  16254. File: libc.inf,  Node: times,  Next: tmpfile,  Prev: time,  Up: Alphabetical List
  16255. times
  16256. =====
  16257. Syntax
  16258. ------
  16259.      #include <sys/times.h>
  16260.      
  16261.      clock_t times(struct tms *buf);
  16262. Description
  16263. -----------
  16264. This function returns the number of clock ticks used by the current
  16265. process and all of its children until the moment of call.  The number
  16266. of tics per second is `CLOCKS_PER_SEC', defined on time.h.
  16267. This is the structure in which `times' returns its info:
  16268.      struct  tms {
  16269.        clock_t tms_cstime;
  16270.        clock_t tms_cutime;
  16271.        clock_t tms_stime;
  16272.        clock_t tms_utime;
  16273.      };
  16274. Currently, the elapsed time of the running program is returned in the
  16275. `tms_utime' field, and all other fields return as zero.
  16276. Return Value
  16277. ------------
  16278. The number of elapsed tics since the program started.
  16279. Example
  16280. -------
  16281.      printf("We used %d seconds of elapsed time\n", times(&buf)/CLOCKS_PER_SEC);
  16282. File: libc.inf,  Node: tmpfile,  Next: tmpnam,  Prev: times,  Up: Alphabetical List
  16283. tmpfile
  16284. =======
  16285. Syntax
  16286. ------
  16287.      #include <stdio.h>
  16288.      
  16289.      FILE *tmpfile(void);
  16290. Description
  16291. -----------
  16292. This function opens a temporary file.  It will automatically be removed
  16293. if the file is closed or when the program exits.  The name of the file
  16294. is generated by the same algorithm as described under tmpnam() (*note
  16295. tmpnam::.).
  16296. Return Value
  16297. ------------
  16298. A newly opened file.
  16299. Example
  16300. -------
  16301.      FILE *tmp = tmpfile();
  16302. File: libc.inf,  Node: tmpnam,  Next: toascii,  Prev: tmpfile,  Up: Alphabetical List
  16303. tmpnam
  16304. ======
  16305. Syntax
  16306. ------
  16307.      #include <stdio.h>
  16308.      
  16309.      char *tmpnam(char *s);
  16310. Description
  16311. -----------
  16312. This functions generates a string that is a valid file name and that is
  16313. not the same as the name of an existing file.  A different string is
  16314. guaranteed to be produced each time it is called, up to `TMP_MAX' times
  16315. (`TMP_MAX' is defined on stdio.h).  If `tmpnam' is called more than
  16316. TMP_MAX times, the behavior is implementation-dependent (ours just
  16317. wraps around and tries to reuse the same file names from the beginning).
  16318. This function examines the environment to determine the directory in
  16319. which the temporary file will be opened.  It looks for one of the
  16320. variables `"TMPDIR"', `"TEMP"' and `"TMP"', in that order.  The first
  16321. one which is found in the environment will be used on the assumption
  16322. that it points to a directory.  If neither of the above variables is
  16323. defined, `tmpnam' defaults to the "c:/" directory (which under MS-DOS
  16324. might mean that it fails to generate TMP_MAX unique names, because DOS
  16325. root directories cannot grow beyond certain limits).
  16326. Return Value
  16327. ------------
  16328. If S is a null pointer, `tmpnam' leaves its result in an internal
  16329. static buffer and returns a pointer to that buffer.  If S is not a null
  16330. pointer, it is assumed to point to an array of at least `L_tmpnam'
  16331. characters, and `tmpnam' writes its result in that array and returns a
  16332. pointer to it as its value.
  16333. Example
  16334. -------
  16335.      char buf[L_tmpnam];
  16336.      char *s = tmpname(buf);
  16337. File: libc.inf,  Node: toascii,  Next: tolower,  Prev: tmpnam,  Up: Alphabetical List
  16338. toascii
  16339. =======
  16340. Syntax
  16341. ------
  16342.      #include <ctype.h>
  16343.      
  16344.      int toascii(int c);
  16345. Description
  16346. -----------
  16347. This function strips the high bit of C, forcing it to be an ASCII
  16348. character.
  16349. Return Value
  16350. ------------
  16351. The ASCII character.
  16352. Example
  16353. -------
  16354.      for (i=0; buf[i]; i++)
  16355.        buf[i] = toascii(buf[i]);
  16356. File: libc.inf,  Node: tolower,  Next: toupper,  Prev: toascii,  Up: Alphabetical List
  16357. tolower
  16358. =======
  16359. Syntax
  16360. ------
  16361.      #include <ctype.h>
  16362.      
  16363.      int tolower(int c);
  16364. Description
  16365. -----------
  16366. This function returns C, converting it to lower case if it is upper
  16367. case.  *Note toupper::.
  16368. Return Value
  16369. ------------
  16370. The lower case letter.
  16371. Example
  16372. -------
  16373.      for (i=0; buf[i]; i++)
  16374.        buf[i] = tolower(buf[i]);
  16375. File: libc.inf,  Node: toupper,  Next: _truename,  Prev: tolower,  Up: Alphabetical List
  16376. toupper
  16377. =======
  16378. Syntax
  16379. ------
  16380.      #include <ctype.h>
  16381.      
  16382.      int toupper(int c);
  16383. Description
  16384. -----------
  16385. This function returns C, converting it to upper case if it is lower
  16386. case. *Note tolower::.
  16387. Return Value
  16388. ------------
  16389. The upper case letter.
  16390. Example
  16391. -------
  16392.      for (i=0; buf[i]; i++)
  16393.        buf[i] = toupper(buf[i]);
  16394. File: libc.inf,  Node: _truename,  Next: truncate,  Prev: toupper,  Up: Alphabetical List
  16395. _truename
  16396. =========
  16397. Syntax
  16398. ------
  16399.      #include <sys/stat.h>
  16400.      
  16401.      char * _truename(const char *path, char *true_path);
  16402. Description
  16403. -----------
  16404. Given a PATH of a file, returns in TRUE_PATH its canonicalized
  16405. pathname, with all letters uppercased, default drive and directory made
  16406. explicit, forward slashes converted to backslashes, asterisks converted
  16407. to appropriate number of of question marks, file and directory names
  16408. truncated to 8.3 if necessary, "." and ".." resolved, extra slashes (but
  16409. the last, if present) removed, SUBSTed, JOINed and ASSIGNed drives
  16410. resolved.  Character devices return as "X:/DEVNAME" (note the forward
  16411. slash!), where X is the CURRENT drive and DEVNAME is the device name
  16412. (e.g.  CON).  This is exactly what DOS TRUENAME command does.  See
  16413. Ralph Brown's Interrupt List for more details.
  16414. The named PATH doesn't have to exist, but the drive, if given as part
  16415. of it, should be a legal DOS drive, as this function hits the disk.
  16416. The function will fail if given a PATH which (1) is an empty string; or
  16417. (2) contains only the drive letter (e.g. "c:"); or (3) has leading
  16418. whitespace.  It will also fail if it couldn't allocate memory required
  16419. for its communication with DOS or for TRUE_PATH (see below).
  16420. Upon success, the function will place the result in TRUE_PATH, if
  16421. that's non-NULL; the buffer should be large enough to contain the
  16422. largest possible pathname (PATH_MAX characters).  If TRUE_PATH is a
  16423. NULL pointer, the space to hold the result will be allocated by calling
  16424. *Note malloc::; it is up to the caller to release the buffer by calling
  16425. *Note free::.
  16426. Return Value
  16427. ------------
  16428. The function returns the pointer to the result.  In case of any failure,
  16429. a NULL pointer is returned, and ERRNO is set.
  16430. Example
  16431. -------
  16432.        fprintf(stderr,
  16433.                "True name of %s is %s\n", path, _truename(path, (char *)0));
  16434. File: libc.inf,  Node: truncate,  Next: ttyname,  Prev: _truename,  Up: Alphabetical List
  16435. truncate
  16436. ========
  16437. Syntax
  16438. ------
  16439.      #include <unistd.h>
  16440.      
  16441.      int truncate(const char *file, off_t size);
  16442. Description
  16443. -----------
  16444. This function truncates FILE to SIZE bytes.
  16445. Return Value
  16446. ------------
  16447. Zero on success, nonzero on failure.
  16448. Example
  16449. -------
  16450.      ftruncate("/tmp/data.txt", 400);
  16451. File: libc.inf,  Node: ttyname,  Next: uclock,  Prev: truncate,  Up: Alphabetical List
  16452. ttyname
  16453. =======
  16454. Syntax
  16455. ------
  16456.      #include <unistd.h>
  16457.      
  16458.      char *ttyname(int file);
  16459. Description
  16460. -----------
  16461. Gives the name of the terminal associated with FILE.
  16462. Return Value
  16463. ------------
  16464. Returns "con" if FILE is a device, else `NULL'.
  16465. Example
  16466. -------
  16467.      char *tty = ttyname(0);
  16468. File: libc.inf,  Node: uclock,  Next: umask,  Prev: ttyname,  Up: Alphabetical List
  16469. uclock
  16470. ======
  16471. Syntax
  16472. ------
  16473.      #include <time.h>
  16474.      
  16475.      uclock_t uclock(void);
  16476. Description
  16477. -----------
  16478. This function returns the number of uclock ticks since an arbitrary
  16479. time, actually, since the first call to `uclock', which itself returns
  16480. zero.  The number of tics per second is UCLOCKS_PER_SEC.
  16481. `uclock' is provided for very high-resulution timing.  It is currently
  16482. accurate to better than 1 microsecond (actually about 840 nanoseconds).
  16483. You cannot time across two midnights with this implementation, giving
  16484. a maximum useful period of 48 hours and an effective limit of 24 hours.
  16485. Casting to a 32-bit integer limits its usefulness to about an hour
  16486. before 32 bits will wrap.
  16487. Note that `printf' cannot print a value of type `uclock_t', even though
  16488. it is an integer value, because it is a 64-bit integer.
  16489. Also note that `uclock' reprograms the interval timer in your PC to act
  16490. as a rate generator rather than a square wave generator.  I've had no
  16491. problems running in this mode all the time, but if you notice strange
  16492. things happening with the clock (losing time) after using `uclock',
  16493. check to see if this is the cause of the problem.
  16494. Return Value
  16495. ------------
  16496. The number of tics.
  16497. Example
  16498. -------
  16499.      printf("%d seconds have elapsed\n", (int)(uclock()/UCLOCKS_PER_SEC));
  16500. File: libc.inf,  Node: umask,  Next: uname,  Prev: uclock,  Up: Alphabetical List
  16501. umask
  16502. =====
  16503.      #include <sys/stat.h>
  16504.      
  16505.      mode_t umask(mode_t cmask);
  16506. Description
  16507. -----------
  16508. This function does nothing.  It exists to assist porting.
  16509. File: libc.inf,  Node: uname,  Next: ungetc,  Prev: umask,  Up: Alphabetical List
  16510. uname
  16511. =====
  16512. Syntax
  16513. ------
  16514.      #include <sys/utsname.h>
  16515.      
  16516.      #int uname(struct utsname *u);
  16517. Description
  16518. -----------
  16519. Fills in the structure with information about the system.
  16520.      struct utsname {
  16521.        char machine[9];
  16522.        char nodename[32];
  16523.        char release[9];
  16524.        char sysname[9];
  16525.        char version[9];
  16526.      };
  16527. `machine'
  16528.      "pc"
  16529. `nodename'
  16530.      The name of your PC (if networking is installed), else "pc".
  16531. `release'
  16532.      The minor release of dos.  For example, dos 1.23 would return "23"
  16533.      here.
  16534. `sysname'
  16535.      The flavor of the OS.
  16536. `version'
  16537.      The major release of dos.  For example, dos 1.23 would return "1"
  16538.      here.
  16539. Return Value
  16540. ------------
  16541. Zero on success, else nonzero.
  16542. File: libc.inf,  Node: ungetc,  Next: ungetch,  Prev: uname,  Up: Alphabetical List
  16543. ungetc
  16544. ======
  16545. Syntax
  16546. ------
  16547.      #include <stdio.h>
  16548.      
  16549.      int ungetc(int c, FILE *file);
  16550. Description
  16551. -----------
  16552. This function pushes C back into the FILE.  You can only push back one
  16553. character at a time.
  16554. Return Value
  16555. ------------
  16556. The pushed-back character, or `EOF' on error.
  16557. Example
  16558. -------
  16559.      int q;
  16560.      while (q = getc(stdin) != 'q');
  16561.      ungetc(q);
  16562. File: libc.inf,  Node: ungetch,  Next: unlink,  Prev: ungetc,  Up: Alphabetical List
  16563. ungetch
  16564. =======
  16565. Syntax
  16566. ------
  16567.      #include <conio.h>
  16568.      
  16569.      int ungetch(int);
  16570. Description
  16571. -----------
  16572. Puts a character back, so that *Note getch:: will return it instead of
  16573. actually reading the console.
  16574. Return Value
  16575. ------------
  16576. The charater is returned.
  16577. File: libc.inf,  Node: unlink,  Next: unlock,  Prev: ungetch,  Up: Alphabetical List
  16578. unlink
  16579. ======
  16580. Syntax
  16581. ------
  16582.      #include <unistd.h>
  16583.      
  16584.      int unlink(const char *file);
  16585. Description
  16586. -----------
  16587. This function removes a file from the file system.
  16588. Return Value
  16589. ------------
  16590. Zero on success, nonzero on failure.
  16591. Example
  16592. -------
  16593.      unlink("data.txt");
  16594. File: libc.inf,  Node: unlock,  Next: _use_lfn,  Prev: unlink,  Up: Alphabetical List
  16595. unlock
  16596. ======
  16597. Syntax
  16598. ------
  16599.      #include <io.h>
  16600.      
  16601.      int unlock(int fd, long offset, long length);
  16602. Description
  16603. -----------
  16604. Unlocks a region previously locked by `lock'.
  16605. *Note lock::.
  16606. Return Value
  16607. ------------
  16608. Zero if successful, nonzero if not.
  16609. File: libc.inf,  Node: _use_lfn,  Next: usleep,  Prev: unlock,  Up: Alphabetical List
  16610. _use_lfn
  16611. ========
  16612. Syntax
  16613. ------
  16614.      #include <fcntl.h>
  16615.      
  16616.      char _use_lfn(const char *path);
  16617. Description
  16618. -----------
  16619. The `_use_lfn' function returns a nonzero value if the low level libc
  16620. routines will use the "Long File Name" (LFN) functions provided with
  16621. Windows 9x (and other advanced filesystems), when accessing files and
  16622. directories on the same filesystem as PATH.  PATH may be any legal
  16623. pathname; however, the function only needs the name of the root
  16624. directory on the particular drive in question.  If PATH is a `NULL'
  16625. pointer, the function assumes that all the filesystems support (or do
  16626. not support) LFN in the same manner, and returns the info pertinent to
  16627. the last filesystem that was queried; this usually makes the call
  16628. faster.  Note that on Windows 95 you don't need to distinguish between
  16629. different drives: they all support LFN API.  If PATH does not specify
  16630. the drive explicitly, the current drive is used.
  16631. The header `fcntl.h' defines a macro `_USE_LFN'; applications should
  16632. use this macro instead of calling `_use_lfn' directly.  That is so this
  16633. routine could be replaced with one which always returns 0 to disable
  16634. using long file names.  Calling `_USE_LFN' also makes the code more
  16635. portable to other operating systems, where the macro can be redefined
  16636. to whatever is appropriate for that environment (e.g., it should be a
  16637. constant 1 on Unix systems and constant 0 for environments that don't
  16638. support LFN API, like some other MSDOS compilers).  Currently,
  16639. `_USE_LFN' assumes that LFN API does *not* depend on a drive.
  16640. Long file names can also be disabled by setting the flag
  16641. `_CRT0_FLAG_NO_LFN' in `_crt0_startup_flags' for an image which should
  16642. not allow use of long file names.  Long names can be suppressed at
  16643. runtime on a global basis by setting the environment variable `LFN' to
  16644. `N', i.e. `SET LFN=N'.  This might be needed if a distribution expected
  16645. the truncation of long file names to 8.3 format to work.  For example,
  16646. if a C source routine included the file exception.h (9 letters) and the
  16647. file was unzipped as exceptio.h, then GCC would not find the file
  16648. unless you set `LFN=n'.  The environment variable can be set in the
  16649. `DJGPP.ENV' file to always disable LFN support on any system, or can be
  16650. set in the DOS environment for a short term (single project) basis.  If
  16651. you dual boot a system between Windows 95 and DOS, you probably should
  16652. set `LFN=n' in your `DJGPP.ENV' file, since long file names would not
  16653. be visible under DOS, and working with the short names under DOS will
  16654. damage the long names when returning to Windows 95.
  16655. Return Value
  16656. ------------
  16657. If LFN APIs are supported and should be used, it returns 1, else 0.
  16658. Note that if the `_CRT0_FLAG_NO_LFN' bit is set, or `LFN' is set to `N'
  16659. or `n' in the environment, both `_use_lfn' and `_USE_LFN' will always
  16660. return 0 without querying the filesystem.  You can reset the
  16661. `_CRT0_FLAG_NO_LFN' bit at runtime to force filesystem to be queried.
  16662. Example
  16663. -------
  16664.      #include <fcntl.h>
  16665.      #include <sys/stat.h>
  16666.      
  16667.        int fd = creat (_USE_LFN ? "MyCurrentJobFile.Text" : "currjob.txt",
  16668.                        S_IRUSR | S_IWUSR);
  16669. File: libc.inf,  Node: usleep,  Next: utime,  Prev: _use_lfn,  Up: Alphabetical List
  16670. usleep
  16671. ======
  16672. Syntax
  16673. ------
  16674.      #include <unistd.h>
  16675.      
  16676.      unsigned usleep(unsigned usec);
  16677. Description
  16678. -----------
  16679. This function pauses the program for USEC microseconds.
  16680. Return Value
  16681. ------------
  16682. The number of unslept microseconds (i.e. zero).
  16683. Example
  16684. -------
  16685.      usleep(500000);
  16686. File: libc.inf,  Node: utime,  Next: utimes,  Prev: usleep,  Up: Alphabetical List
  16687. utime
  16688. =====
  16689. Syntax
  16690. ------
  16691.      #include <utime.h>
  16692.      
  16693.      int utime(const char *file, const struct utimbuf *time);
  16694. Description
  16695. -----------
  16696. This function sets the modification timestamp on the FILE.  The new
  16697. time is stored in this structure:
  16698.      struct utimbuf
  16699.      {
  16700.          time_t  actime;  /* access time (unused on FAT filesystems) */
  16701.          time_t  modtime; /* modification time */
  16702.      };
  16703. Note that, as under DOS a file only has a single timestamp, the
  16704. `actime' field of `struct utimbuf' is ignored by this function, and
  16705. only `modtime' field is used.  On filesystems which support long
  16706. filenames, both fields are used and both access and modification times
  16707. are set.
  16708. Return Value
  16709. ------------
  16710. Zero for success, nonzero for failure.
  16711. Example
  16712. -------
  16713.      struct utimbuf t;
  16714.      t.modtime = time(0);
  16715.      utime("data.txt", &t);
  16716. File: libc.inf,  Node: utimes,  Next: vfprintf,  Prev: utime,  Up: Alphabetical List
  16717. utimes
  16718. ======
  16719. Syntax
  16720. ------
  16721.      #include <sys/time.h>
  16722.      
  16723.      int utimes(const char *file, struct timeval tvp[2]);
  16724. Description
  16725. -----------
  16726. This function sets the timestamp of the file to `tvp[1].tv_sec'.
  16727. Return Value
  16728. ------------
  16729. Zero on success, nonzero on failure.
  16730. Example
  16731. -------
  16732.      time_t now;
  16733.      struct timeval tvp[2];
  16734.      time(&now);
  16735.      tvp[0].tv_sec = now + 100;
  16736.      utimes("foo.dat", tvp);
  16737. File: libc.inf,  Node: vfprintf,  Next: vprintf,  Prev: utimes,  Up: Alphabetical List
  16738. vfprintf
  16739. ========
  16740. Syntax
  16741. ------
  16742.      #include <stdio.h>
  16743.      #include <stdarg.h>
  16744.      
  16745.      int vfprintf(FILE *file, const char *format, va_list arguments);
  16746. Description
  16747. -----------
  16748. Sends formatted output from the ARGUMENTS to the FILE.  *Note printf::.
  16749. Return Value
  16750. ------------
  16751. The number of characters written.
  16752. Example
  16753. -------
  16754.      void my_errmsg(char *format, ...)
  16755.      {
  16756.        va_list arg;
  16757.      
  16758.        va_start(arg, format);
  16759.        fprintf(stderr, "my_errmsg: ");
  16760.        vfprintf(stderr, format, arg);
  16761.        va_end(arg);
  16762.      }
  16763. File: libc.inf,  Node: vprintf,  Next: vsprintf,  Prev: vfprintf,  Up: Alphabetical List
  16764. vprintf
  16765. =======
  16766. Syntax
  16767. ------
  16768.      #include <stdio.h>
  16769.      #include <stdarg.h>
  16770.      
  16771.      int vprintf(const char *format, va_list arguments);
  16772. Description
  16773. -----------
  16774. Sends formatted output from the ARGUMENTS to `stdout'.  *Note printf::.
  16775. *Note vfprintf::.
  16776. Return Value
  16777. ------------
  16778. The number of characters written.
  16779. File: libc.inf,  Node: vsprintf,  Next: wait,  Prev: vprintf,  Up: Alphabetical List
  16780. vsprintf
  16781. ========
  16782. Syntax
  16783. ------
  16784.      #include <stdio.h>
  16785.      #include <stdarg.h>
  16786.      
  16787.      int vsprintf(char *buffer, const char *format, va_list arguments);
  16788. Description
  16789. -----------
  16790. Sends formatted output from the ARGUMENTS to the BUFFER.  *Note
  16791. printf::. *Note vfprintf::.
  16792. Return Value
  16793. ------------
  16794. The number of characters written.
  16795. File: libc.inf,  Node: wait,  Next: waitpid,  Prev: vsprintf,  Up: Alphabetical List
  16796. Syntax
  16797. ------
  16798.      #include <sys/wait.h>
  16799.      
  16800.      pid_t pid = wait(int *status);
  16801. Description
  16802. -----------
  16803. This function causes its caller to delay its execution until a signal
  16804. is received or one of its child processes terminates.  If any child has
  16805. terminated, return is immediate, returning the process ID and its exit
  16806. status, if that's available.  If no children processes were called since
  16807. the last call, then -1 is returned and `errno' is set.
  16808. Return Value
  16809. ------------
  16810. If successful, this function returns the exit status of the child.  If
  16811. there is an error, these functions return -1 and set `errno' to
  16812. indicate the error type.
  16813. Currently, this function always fails.
  16814. File: libc.inf,  Node: waitpid,  Next: wcstombs,  Prev: wait,  Up: Alphabetical List
  16815. waitpid
  16816. =======
  16817. Syntax
  16818. ------
  16819.      #include <sys/wait.h>
  16820.      
  16821.      pid_t pid = waitpid((pid_t pid, int *status, int options);
  16822. Description
  16823. -----------
  16824. Currently, this function always fails. A -1 is returned and `errno' is
  16825. set to indicate there are no children.
  16826. Return Value
  16827. ------------
  16828. If successful, this function returns the exit status of the child.  If
  16829. there is an error, these functions return -1 and set `errno' to
  16830. indicate the error type.
  16831. Currently, this function always fails.
  16832. File: libc.inf,  Node: wcstombs,  Next: wctomb,  Prev: waitpid,  Up: Alphabetical List
  16833. wcstombs
  16834. ========
  16835. Syntax
  16836. ------
  16837.      #include <stdlib.h>
  16838.      
  16839.      size_t wcstombs(char *s, const wchar_t *wcs, size_t n);
  16840. Description
  16841. -----------
  16842. Converts a wide character string to a multibyte string.  At most N
  16843. characters are stored.
  16844. Return Value
  16845. ------------
  16846. The number of characters stored.
  16847. Example
  16848. -------
  16849.      int len = wcstombs(buf, wstring, sizeof(buf));
  16850. File: libc.inf,  Node: wctomb,  Next: wherex,  Prev: wcstombs,  Up: Alphabetical List
  16851. wctomb
  16852. ======
  16853. Syntax
  16854. ------
  16855.      #include <stdlib.h>
  16856.      
  16857.      int wctomb(char *s, wchar_t wchar);
  16858. Description
  16859. -----------
  16860. Convert a wide character to a multibyte character.  The string S must
  16861. be at least `MB_LEN_MAX' bytes long.
  16862. Return Value
  16863. ------------
  16864. The number of characters stored.
  16865. Example
  16866. -------
  16867.      char s[MB_LEN_MAX];
  16868.      int mlen = wctomb(s, wc);
  16869. File: libc.inf,  Node: wherex,  Next: wherey,  Prev: wctomb,  Up: Alphabetical List
  16870. wherex
  16871. ======
  16872. Syntax
  16873. ------
  16874.      #include <conio.h>
  16875.      
  16876.      int wherex(void);
  16877. Return Value
  16878. ------------
  16879. The column the cursor is on.  The leftmost column is 1.
  16880. File: libc.inf,  Node: wherey,  Next: window,  Prev: wherex,  Up: Alphabetical List
  16881. wherey
  16882. ======
  16883. Syntax
  16884. ------
  16885.      #include <conio.h>
  16886.      
  16887.      int     wherey(void);
  16888. Return Value
  16889. ------------
  16890. The row the cursor is on.  The topmost row is 1.
  16891. File: libc.inf,  Node: window,  Next: write,  Prev: wherey,  Up: Alphabetical List
  16892. window
  16893. ======
  16894. Syntax
  16895. ------
  16896.      #include <conio.h>
  16897.      
  16898.      void    window(int _left, int _top, int _right, int _bottom);
  16899. Description
  16900. -----------
  16901. Specifies the window on the screen to be used for future output
  16902. requests.  The upper left corner of the physical screen is (1,1).
  16903. File: libc.inf,  Node: write,  Next: _write,  Prev: window,  Up: Alphabetical List
  16904. write
  16905. =====
  16906. Syntax
  16907. ------
  16908.      #include <unistd.h>
  16909.      
  16910.      int write(int file, const void *buffer, unsigned count);
  16911. Description
  16912. -----------
  16913. This function writes COUNT bytes from BUFFER to FILE.  It returns the
  16914. number of bytes actually written.  It will return zero if the disk is
  16915. full, and may return less than COUNT even under valid conditions.
  16916. Note that if FILE is a text file, `write' may write more bytes than it
  16917. reports.
  16918. If COUNT is zero, the function does nothing and returns zero.  Use
  16919. _write if you want to actually ask dos to write zero bytes.
  16920. Return Value
  16921. ------------
  16922. The number of bytes written, zero at EOF, or -1 on error.
  16923. Example
  16924. -------
  16925.      write(fd, "hello", 5);
  16926. File: libc.inf,  Node: _write,  Next: xfree,  Prev: write,  Up: Alphabetical List
  16927. _write
  16928. ======
  16929. Syntax
  16930. ------
  16931.      #include <io.h>
  16932.      
  16933.      ssize_t _write(int fildes, void *buf, size_t nbyte);
  16934. Description
  16935. -----------
  16936. This is a direct connection to the MS-DOS write function call, int
  16937. 0x21, %ah = 0x40.  No conversion is done on the data; it is written as
  16938. raw binary data.
  16939. Return Value
  16940. ------------
  16941. The number of bytes written.
  16942. File: libc.inf,  Node: xfree,  Next: xmalloc,  Prev: _write,  Up: Alphabetical List
  16943. xfree
  16944. =====
  16945. Syntax
  16946. ------
  16947.      #include <stdlib.h>
  16948.      
  16949.      void xfree(void *ptr);
  16950. Description
  16951. -----------
  16952. Frees memory allocated by `xmalloc' (*note xmalloc::.).  This function
  16953. guarantees that a NULL pointer is handled gracefully.
  16954. Example
  16955. -------
  16956.      void *f = xmalloc(100);
  16957.      xfree(f);
  16958. File: libc.inf,  Node: xmalloc,  Next: xrealloc,  Prev: xfree,  Up: Alphabetical List
  16959. xmalloc
  16960. =======
  16961. Syntax
  16962. ------
  16963.      #include <stdlib.h>
  16964.      
  16965.      void *xmalloc(size_t size);
  16966. Description
  16967. -----------
  16968. This function is just like `malloc' (*note malloc::.), except that if
  16969. there is no more memory, it prints an error message and exits.
  16970. Return Value
  16971. ------------
  16972. A pointer to the newly allocated memory.
  16973. Example
  16974. -------
  16975.      char *f = xmalloc(100);
  16976. File: libc.inf,  Node: xrealloc,  Prev: xmalloc,  Up: Alphabetical List
  16977. xrealloc
  16978. ========
  16979. Syntax
  16980. ------
  16981.      #include <stdlib.h>
  16982.      
  16983.      void *xrealloc(void *ptr, size_t size);
  16984. Description
  16985. -----------
  16986. This function is just like `realloc' (*note realloc::.), except that if
  16987. there is no more memory, it prints an error message and exits.  It can
  16988. also properly handle PTR being `NULL'.
  16989. Return Value
  16990. ------------
  16991. A pointer to a possibly new block.
  16992. Example
  16993. -------
  16994.      char *buf;
  16995.      buf = (char *)xrealloc(buf, new_size);
  16996. File: libc.inf,  Node: Index,  Up: Top
  16997. * Menu:
  16998. *Note Alphabetical List::
  16999. Tag Table:
  17000. Node: Top
  17001. Node: Introduction
  17002. Node: Functional Categories
  17003. Node: bios functions
  17004. Node: conio functions
  17005. Node: cpu functions
  17006. Node: ctype functions
  17007. Node: dos functions
  17008. Node: dpmi functions
  17009. Node: environment functions
  17010. Node: file system functions
  17011. Node: go32 functions
  17012. 10310
  17013. Node: io functions
  17014. 10717
  17015. Node: locale functions
  17016. 11196
  17017. Node: math functions
  17018. 11467
  17019. Node: memory functions
  17020. 11937
  17021. Node: misc functions
  17022. 12693
  17023. Node: mono functions
  17024. 13083
  17025. Node: posix functions
  17026. 13288
  17027. Node: process functions
  17028. 13493
  17029. Node: random number functions
  17030. 13859
  17031. Node: shell functions
  17032. 14078
  17033. Node: signal functions
  17034. 14270
  17035. Node: sound functions
  17036. 14507
  17037. Node: startup functions
  17038. 14693
  17039. Node: stdio functions
  17040. 14981
  17041. Node: stdlib functions
  17042. 15866
  17043. Node: string functions
  17044. 16042
  17045. Node: termios functions
  17046. 16702
  17047. Node: time functions
  17048. 17065
  17049. Node: unix functions
  17050. 17464
  17051. Node: Alphabetical List
  17052. 18070
  17053. Node: abort
  17054. 29303
  17055. Node: abs
  17056. 29722
  17057. Node: access
  17058. 30020
  17059. Node: acos
  17060. 30917
  17061. Node: acosh
  17062. 31134
  17063. Node: addmntent
  17064. 31368
  17065. Node: alarm
  17066. 31793
  17067. Node: alloca
  17068. 32392
  17069. Node: asctime
  17070. 32907
  17071. Node: asin
  17072. 33625
  17073. Node: asinh
  17074. 33841
  17075. Node: assert
  17076. 34070
  17077. Node: atan
  17078. 34954
  17079. Node: atan2
  17080. 35172
  17081. Node: atanh
  17082. 35451
  17083. Node: atexit
  17084. 35684
  17085. Node: atof
  17086. 36411
  17087. Node: atoi
  17088. 36980
  17089. Node: atol
  17090. 37535
  17091. Node: _atold
  17092. 38094
  17093. Node: bcmp
  17094. 38690
  17095. Node: bcopy
  17096. 39293
  17097. Node: bdos
  17098. 39768
  17099. Node: bdosptr
  17100. 40544
  17101. Node: _bios_disk
  17102. 41674
  17103. Node: _bios_equiplist
  17104. 46476
  17105. Node: _bios_keybrd
  17106. 47686
  17107. Node: _bios_memsize
  17108. 50279
  17109. Node: _bios_printer
  17110. 50744
  17111. Node: _bios_serialcom
  17112. 52058
  17113. Node: _bios_timeofday
  17114. 54926
  17115. Node: bioscom
  17116. 55906
  17117. Node: biosdisk
  17118. 58003
  17119. Node: biosequip
  17120. 59867
  17121. Node: bioskey
  17122. 61202
  17123. Node: biosmemory
  17124. 62057
  17125. Node: biosprint
  17126. 62605
  17127. Node: biostime
  17128. 63389
  17129. Node: blinkvideo
  17130. 63872
  17131. Node: brk
  17132. 64817
  17133. Node: bsearch
  17134. 65455
  17135. Node: bzero
  17136. 66709
  17137. Node: calloc
  17138. 67068
  17139. Node: ceil
  17140. 67794
  17141. Node: cfgetispeed
  17142. 68051
  17143. Node: cfgetospeed
  17144. 68558
  17145. Node: cfmakeraw
  17146. 69072
  17147. Node: cfree
  17148. 69537
  17149. Node: cfsetispeed
  17150. 69947
  17151. Node: cfsetospeed
  17152. 70449
  17153. Node: cfsetspeed
  17154. 70957
  17155. Node: cgets
  17156. 71465
  17157. Node: chdir
  17158. 72054
  17159. Node: chmod
  17160. 72678
  17161. Node: _chmod
  17162. 73348
  17163. Node: chown
  17164. 74472
  17165. Node: chsize
  17166. 74869
  17167. Node: _clear87
  17168. 75184
  17169. Node: clearerr
  17170. 75509
  17171. Node: clock
  17172. 75870
  17173. Node: close
  17174. 76391
  17175. Node: _close
  17176. 76804
  17177. Node: closedir
  17178. 77157
  17179. Node: clreol
  17180. 77510
  17181. Node: clrscr
  17182. 77766
  17183. Node: _conio_kbhit
  17184. 77995
  17185. Node: _control87
  17186. 78525
  17187. Node: cos
  17188. 80055
  17189. Node: cosh
  17190. 80267
  17191. Node: cprintf
  17192. 80490
  17193. Node: cputs
  17194. 80980
  17195. Node: creat
  17196. 81297
  17197. Node: _creat
  17198. 82029
  17199. Node: crlf2nl
  17200. 82436
  17201. Node: __crt0_glob_function
  17202. 82793
  17203. Node: __crt0_load_environment_file
  17204. 83573
  17205. Node: __crt0_setup_arguments
  17206. 84230
  17207. Node: _crt0_startup_flags
  17208. 85193
  17209. Node: cscanf
  17210. 90216
  17211. Node: ctime
  17212. 90574
  17213. Node: delay
  17214. 91000
  17215. Node: delline
  17216. 91432
  17217. Node: difftime
  17218. 91702
  17219. Node: disable
  17220. 92196
  17221. Node: div
  17222. 92743
  17223. Node: __djgpp_exception_toggle
  17224. 93464
  17225. Node: __djgpp_map_physical_memory
  17226. 94372
  17227. Node: __djgpp_memory_handle
  17228. 95968
  17229. Node: __djgpp_memory_handle_list
  17230. 96608
  17231. Node: __djgpp_nearptr_disable
  17232. 97190
  17233. Node: __djgpp_nearptr_enable
  17234. 97596
  17235. Node: __djgpp_set_ctrl_c
  17236. 99204
  17237. Node: __djgpp_set_page_attributes
  17238. 101060
  17239. Node: _djstat_describe_lossage
  17240. 102368
  17241. Node: _djstat_fail_bits
  17242. 104551
  17243. Node: _djstat_flags
  17244. 108047
  17245. Node: _doprnt
  17246. 110296
  17247. Node: _dos_close
  17248. 110944
  17249. Node: _dos_commit
  17250. 111615
  17251. Node: _dos_creat
  17252. 112202
  17253. Node: _dos_creatnew
  17254. 113343
  17255. Node: _dos_findfirst
  17256. 114495
  17257. Node: _dos_findnext
  17258. 116071
  17259. Node: _dos_getdate
  17260. 116528
  17261. Node: _dos_getdiskfree
  17262. 117291
  17263. Node: _dos_getdrive
  17264. 118286
  17265. Node: _dos_getfileattr
  17266. 118881
  17267. Node: _dos_getftime
  17268. 120299
  17269. Node: _dos_gettime
  17270. 122215
  17271. Node: _dos_lock
  17272. 122927
  17273. Node: _dos_open
  17274. 123302
  17275. Node: _dos_read
  17276. 124841
  17277. Node: _dos_setdate
  17278. 126224
  17279. Node: _dos_setdrive
  17280. 127214
  17281. Node: _dos_setfileattr
  17282. 127960
  17283. Node: _dos_setftime
  17284. 128969
  17285. Node: _dos_settime
  17286. 130438
  17287. Node: _dos_unlock
  17288. 131348
  17289. Node: _dos_write
  17290. 131737
  17291. Node: _doscan
  17292. 133157
  17293. Node: dosexterr
  17294. 133861
  17295. Node: dosmemget
  17296. 139491
  17297. Node: dosmemgetb
  17298. 140366
  17299. Node: dosmemgetl
  17300. 141285
  17301. Node: dosmemgetw
  17302. 142223
  17303. Node: dosmemput
  17304. 143157
  17305. Node: dosmemputb
  17306. 143999
  17307. Node: dosmemputl
  17308. 144892
  17309. Node: dosmemputw
  17310. 145794
  17311. Node: DPMI Overview
  17312. 146702
  17313. Node: DPMI Specification
  17314. 151753
  17315. Node: __dpmi_allocate_dos_memory
  17316. 152092
  17317. Node: __dpmi_allocate_ldt_descriptors
  17318. 153028
  17319. Node: __dpmi_allocate_linear_memory
  17320. 153801
  17321. Node: __dpmi_allocate_memory
  17322. 154586
  17323. Node: __dpmi_allocate_real_mode_callback
  17324. 155213
  17325. Node: __dpmi_allocate_shared_memory
  17326. 156129
  17327. Node: __dpmi_allocate_specific_ldt_descriptor
  17328. 156750
  17329. Node: __dpmi_clear_debug_watchpoint
  17330. 157402
  17331. Node: __dpmi_create_alias_descriptor
  17332. 158015
  17333. Node: __dpmi_discard_page_contents
  17334. 158663
  17335. Node: __dpmi_free_dos_memory
  17336. 159350
  17337. Node: __dpmi_free_ldt_descriptor
  17338. 160022
  17339. Node: __dpmi_free_memory
  17340. 160699
  17341. Node: __dpmi_free_physical_address_mapping
  17342. 161273
  17343. Node: __dpmi_free_real_mode_callback
  17344. 161988
  17345. Node: __dpmi_free_serialization_on_shared_memory
  17346. 162638
  17347. Node: __dpmi_free_shared_memory
  17348. 163305
  17349. Node: __dpmi_get_and_disable_virtual_interrupt_state
  17350. 163925
  17351. Node: __dpmi_get_and_enable_virtual_interrupt_state
  17352. 164624
  17353. Node: __dpmi_get_and_set_virtual_interrupt_state
  17354. 165343
  17355. Node: __dpmi_get_capabilities
  17356. 166150
  17357. Node: __dpmi_get_coprocessor_status
  17358. 167281
  17359. Node: __dpmi_get_descriptor
  17360. 167870
  17361. Node: __dpmi_get_descriptor_access_rights
  17362. 169170
  17363. Node: __dpmi_get_extended_exception_handler_vector_pm
  17364. 169875
  17365. Node: __dpmi_get_extended_exception_handler_vector_rm
  17366. 170640
  17367. Node: __dpmi_get_free_memory_information
  17368. 171398
  17369. Node: __dpmi_get_memory_block_size_and_base
  17370. 172140
  17371. Node: __dpmi_get_memory_information
  17372. 172821
  17373. Node: __dpmi_get_multiple_descriptors
  17374. 173479
  17375. Node: __dpmi_get_page_attributes
  17376. 174436
  17377. Node: __dpmi_get_page_size
  17378. 175191
  17379. Node: __dpmi_get_processor_exception_handler_vector
  17380. 175781
  17381. Node: __dpmi_get_protected_mode_interrupt_vector
  17382. 176540
  17383. Node: __dpmi_get_raw_mode_switch_addr
  17384. 177334
  17385. Node: __dpmi_get_real_mode_interrupt_vector
  17386. 177985
  17387. Node: __dpmi_get_segment_base_address
  17388. 178841
  17389. Node: __dpmi_get_segment_limit
  17390. 179617
  17391. Node: __dpmi_get_selector_increment_value
  17392. 180185
  17393. Node: __dpmi_get_state_of_debug_watchpoint
  17394. 180848
  17395. Node: __dpmi_get_state_save_restore_addr
  17396. 181577
  17397. Node: __dpmi_get_vendor_specific_api_entry_point
  17398. 182252
  17399. Node: __dpmi_get_version
  17400. 182952
  17401. Node: __dpmi_get_virtual_interrupt_state
  17402. 183822
  17403. Node: __dpmi_install_resident_service_provider_callback
  17404. 184447
  17405. Node: __dpmi_int
  17406. 185125
  17407. Node: __dpmi_lock_linear_region
  17408. 186132
  17409. Node: __dpmi_map_conventional_memory_in_memory_block
  17410. 186812
  17411. Node: __dpmi_map_device_in_memory_block
  17412. 187626
  17413. Node: __dpmi_mark_page_as_demand_paging_candidate
  17414. 188443
  17415. Node: __dpmi_mark_real_mode_region_as_pageable
  17416. 189191
  17417. Node: __dpmi_physical_address_mapping
  17418. 189941
  17419. Node: __dpmi_relock_real_mode_region
  17420. 190708
  17421. Node: __dpmi_reset_debug_watchpoint
  17422. 191421
  17423. Node: __dpmi_resize_dos_memory
  17424. 191990
  17425. Node: __dpmi_resize_linear_memory
  17426. 192743
  17427. Node: __dpmi_resize_memory
  17428. 193529
  17429. Node: __dpmi_segment_to_descriptor
  17430. 194262
  17431. Node: __dpmi_serialize_on_shared_memory
  17432. 195082
  17433. Node: __dpmi_set_coprocessor_emulation
  17434. 195718
  17435. Node: __dpmi_set_debug_watchpoint
  17436. 196313
  17437. Node: __dpmi_set_descriptor
  17438. 197032
  17439. Node: __dpmi_set_descriptor_access_rights
  17440. 197665
  17441. Node: __dpmi_set_extended_exception_handler_vector_pm
  17442. 198922
  17443. Node: __dpmi_set_extended_exception_handler_vector_rm
  17444. 199688
  17445. Node: __dpmi_set_multiple_descriptors
  17446. 200445
  17447. Node: __dpmi_set_page_attributes
  17448. 201271
  17449. Node: __dpmi_set_processor_exception_handler_vector
  17450. 202030
  17451. Node: __dpmi_set_protected_mode_interrupt_vector
  17452. 202814
  17453. Node: __dpmi_set_real_mode_interrupt_vector
  17454. 203798
  17455. Node: __dpmi_set_segment_base_address
  17456. 204605
  17457. Node: __dpmi_set_segment_limit
  17458. 205269
  17459. Node: __dpmi_simulate_real_mode_interrupt
  17460. 206107
  17461. Node: __dpmi_simulate_real_mode_procedure_iret
  17462. 206944
  17463. Node: __dpmi_simulate_real_mode_procedure_retf
  17464. 207755
  17465. Node: __dpmi_simulate_real_mode_procedure_retf_stack
  17466. 208606
  17467. Node: __dpmi_terminate_and_stay_resident
  17468. 209785
  17469. Node: __dpmi_unlock_linear_region
  17470. 210447
  17471. Node: __dpmi_yield
  17472. 211076
  17473. Node: dup
  17474. 211610
  17475. Node: dup2
  17476. 212030
  17477. Node: _dxe_load
  17478. 212570
  17479. Node: enable
  17480. 213274
  17481. Node: endgrent
  17482. 213824
  17483. Node: endmntent
  17484. 214190
  17485. Node: endpwent
  17486. 214559
  17487. Node: errno
  17488. 214883
  17489. Node: exec*
  17490. 216757
  17491. Node: __exit
  17492. 217829
  17493. Node: _exit
  17494. 218448
  17495. Node: exit
  17496. 219112
  17497. Node: exp
  17498. 219631
  17499. Node: fabs
  17500. 219838
  17501. Node: _far*
  17502. 220127
  17503. Node: fclose
  17504. 222737
  17505. Node: fcntl
  17506. 223129
  17507. Node: fdopen
  17508. 223672
  17509. Node: feof
  17510. 224218
  17511. Node: ferror
  17512. 224630
  17513. Node: fflush
  17514. 225063
  17515. Node: ffs
  17516. 225594
  17517. Node: fgetc
  17518. 226063
  17519. Node: fgetgrent
  17520. 226502
  17521. Node: fgetpos
  17522. 226806
  17523. Node: fgets
  17524. 227214
  17525. Node: File System Extensions
  17526. 227988
  17527. Node: __file_exists
  17528. 231217
  17529. Node: file_tree_walk
  17530. 231930
  17531. Node: filelength
  17532. 234618
  17533. Node: fileno
  17534. 235322
  17535. Node: findfirst
  17536. 235665
  17537. Node: findnext
  17538. 237871
  17539. Node: _fixpath
  17540. 238246
  17541. Node: floor
  17542. 239282
  17543. Node: _flush_disk_cache
  17544. 239547
  17545. Node: fmod
  17546. 239899
  17547. Node: _fmode
  17548. 240139
  17549. Node: fnmatch
  17550. 240589
  17551. Node: fnmerge
  17552. 242143
  17553. Node: fnsplit
  17554. 242979
  17555. Node: fopen
  17556. 244249
  17557. Node: fork
  17558. 246290
  17559. Node: fpathconf
  17560. 246573
  17561. Node: _fpreset
  17562. 247022
  17563. Node: fprintf
  17564. 247259
  17565. Node: fpurge
  17566. 247615
  17567. Node: fputc
  17568. 247947
  17569. Node: fputs
  17570. 248333
  17571. Node: fread
  17572. 248767
  17573. Node: free
  17574. 249232
  17575. Node: freopen
  17576. 249628
  17577. Node: frexp
  17578. 250183
  17579. Node: fscanf
  17580. 250631
  17581. Node: fseek
  17582. 251048
  17583. Node: fsetpos
  17584. 252126
  17585. Node: __FSEXT_add_open_handler
  17586. 252562
  17587. Node: __FSEXT_alloc_fd
  17588. 253241
  17589. Node: __FSEXT_call_open_handlers
  17590. 254158
  17591. Node: __FSEXT_get_function
  17592. 254714
  17593. Node: __FSEXT_set_function
  17594. 255419
  17595. Node: fstat
  17596. 257257
  17597. Node: fsync
  17598. 260219
  17599. Node: ftell
  17600. 260604
  17601. Node: ftime
  17602. 261006
  17603. Node: ftruncate
  17604. 261741
  17605. Node: ftw
  17606. 262234
  17607. Node: _fwalk
  17608. 266656
  17609. Node: fwrite
  17610. 267095
  17611. Node: _get_dev_info
  17612. 267579
  17613. Node: _get_dos_version
  17614. 268040
  17615. Node: _get_volume_info
  17616. 269907
  17617. Node: getc
  17618. 271643
  17619. Node: getcbrk
  17620. 272047
  17621. Node: getch
  17622. 272378
  17623. Node: getchar
  17624. 272833
  17625. Node: getche
  17626. 273131
  17627. Node: getcwd
  17628. 273581
  17629. Node: getdate
  17630. 274299
  17631. Node: getdfree
  17632. 274801
  17633. Node: getdisk
  17634. 275538
  17635. Node: getdtablesize
  17636. 275917
  17637. Node: getegid
  17638. 276246
  17639. Node: getenv
  17640. 276514
  17641. Node: geteuid
  17642. 276954
  17643. Node: getftime
  17644. 277213
  17645. Node: getgid
  17646. 277940
  17647. Node: getgrent
  17648. 278199
  17649. Node: getgrgid
  17650. 279297
  17651. Node: getgrnam
  17652. 279711
  17653. Node: gethostname
  17654. 280131
  17655. Node: getitimer
  17656. 281010
  17657. Node: getkey
  17658. 281524
  17659. Node: getlogin
  17660. 282099
  17661. Node: getlongpass
  17662. 282539
  17663. Node: getmntent
  17664. 283403
  17665. Node: getopt
  17666. 287363
  17667. Node: getpagesize
  17668. 288842
  17669. Node: getpass
  17670. 289186
  17671. Node: getpgrp
  17672. 290006
  17673. Node: getpid
  17674. 290320
  17675. Node: getpwent
  17676. 290647
  17677. Node: getpwnam
  17678. 291531
  17679. Node: getpwuid
  17680. 291912
  17681. Node: getrlimit
  17682. 292286
  17683. Node: getrusage
  17684. 292812
  17685. Node: gets
  17686. 293538
  17687. Node: gettext
  17688. 294119
  17689. Node: gettextinfo
  17690. 294465
  17691. Node: gettime
  17692. 295295
  17693. Node: gettimeofday
  17694. 295860
  17695. Node: getuid
  17696. 296658
  17697. Node: getw
  17698. 296912
  17699. Node: getwd
  17700. 297392
  17701. Node: getxkey
  17702. 297799
  17703. Node: glob
  17704. 298365
  17705. Node: globfree
  17706. 304719
  17707. Node: gmtime
  17708. 304975
  17709. Node: _go32_conventional_mem_selector
  17710. 306151
  17711. Node: _go32_dpmi_allocate_dos_memory
  17712. 307250
  17713. Node: _go32_dpmi_allocate_iret_wrapper
  17714. 308465
  17715. Node: _go32_dpmi_allocate_real_mode_callback_iret
  17716. 309668
  17717. Node: _go32_dpmi_allocate_real_mode_callback_retf
  17718. 311438
  17719. Node: _go32_dpmi_chain_protected_mode_interrupt_vector
  17720. 312630
  17721. Node: _go32_dpmi_free_dos_memory
  17722. 313631
  17723. Node: _go32_dpmi_free_iret_wrapper
  17724. 314397
  17725. Node: _go32_dpmi_free_real_mode_callback
  17726. 315047
  17727. Node: _go32_dpmi_get_free_memory_information
  17728. 315754
  17729. Node: _go32_dpmi_get_protected_mode_interrupt_vector
  17730. 317062
  17731. Node: _go32_dpmi_get_real_mode_interrupt_vector
  17732. 317929
  17733. Node: _go32_dpmi_lock_code
  17734. 318638
  17735. Node: _go32_dpmi_lock_data
  17736. 319322
  17737. Node: _go32_dpmi_remaining_physical_memory
  17738. 319942
  17739. Node: _go32_dpmi_remaining_virtual_memory
  17740. 320437
  17741. Node: _go32_dpmi_resize_dos_memory
  17742. 320936
  17743. Node: _go32_dpmi_set_protected_mode_interrupt_vector
  17744. 321891
  17745. Node: _go32_dpmi_set_real_mode_interrupt_vector
  17746. 323787
  17747. Node: _go32_dpmi_simulate_fcall
  17748. 324508
  17749. Node: _go32_dpmi_simulate_fcall_iret
  17750. 325633
  17751. Node: _go32_dpmi_simulate_int
  17752. 326769
  17753. Node: _go32_info_block
  17754. 327906
  17755. Node: _go32_interrupt_stack_size
  17756. 331282
  17757. Node: _go32_my_cs
  17758. 331653
  17759. Node: _go32_my_ds
  17760. 332012
  17761. Node: _go32_my_ss
  17762. 332341
  17763. Node: _go32_rmcb_stack_size
  17764. 332680
  17765. Node: _go32_want_ctrl_break
  17766. 333045
  17767. Node: _go32_was_ctrl_break_hit
  17768. 333964
  17769. Node: gotoxy
  17770. 334748
  17771. Node: gppconio_init
  17772. 335070
  17773. Node: hasmntopt
  17774. 335550
  17775. Node: highvideo
  17776. 336055
  17777. Node: htonl
  17778. 336325
  17779. Node: htons
  17780. 336834
  17781. Node: hypot
  17782. 337336
  17783. Node: inb
  17784. 337678
  17785. Node: index
  17786. 337940
  17787. Node: inp
  17788. 338488
  17789. Node: inportb
  17790. 338753
  17791. Node: inportl
  17792. 339205
  17793. Node: inportsb
  17794. 339675
  17795. Node: inportsl
  17796. 339996
  17797. Node: inportsw
  17798. 340319
  17799. Node: inportw
  17800. 340642
  17801. Node: inpw
  17802. 341098
  17803. Node: insline
  17804. 341370
  17805. Node: insque
  17806. 341678
  17807. Node: int386
  17808. 342271
  17809. Node: int386x
  17810. 342649
  17811. Node: int86
  17812. 343043
  17813. Node: int86x
  17814. 345329
  17815. Node: intdos
  17816. 346004
  17817. Node: intdosx
  17818. 346356
  17819. Node: intensevideo
  17820. 346735
  17821. Node: ioctl (DOS)
  17822. 347721
  17823. Node: ioctl (General description)
  17824. 351956
  17825. Node: ioctl (UNIX)
  17826. 352541
  17827. Node: _is_executable
  17828. 352984
  17829. Node: isalnum
  17830. 354865
  17831. Node: isalpha
  17832. 355202
  17833. Node: isascii
  17834. 355495
  17835. Node: isatty
  17836. 355809
  17837. Node: iscntrl
  17838. 356218
  17839. Node: isdigit
  17840. 356532
  17841. Node: isgraph
  17842. 356823
  17843. Node: islower
  17844. 357180
  17845. Node: isprint
  17846. 357484
  17847. Node: ispunct
  17848. 357837
  17849. Node: isspace
  17850. 358193
  17851. Node: isupper
  17852. 358565
  17853. Node: isxdigit
  17854. 358883
  17855. Node: itoa
  17856. 359234
  17857. Node: kbhit
  17858. 360120
  17859. Node: kill
  17860. 360892
  17861. Node: labs
  17862. 361212
  17863. Node: ldexp
  17864. 361493
  17865. Node: ldiv
  17866. 361795
  17867. Node: _lfn_gen_short_fname
  17868. 362527
  17869. Node: _lfn_get_ftime
  17870. 364794
  17871. Node: __libc_termios_init
  17872. 366447
  17873. Node: link
  17874. 366976
  17875. Node: llabs
  17876. 367486
  17877. Node: lldiv
  17878. 367781
  17879. Node: localeconv
  17880. 368537
  17881. Node: localtime
  17882. 371372
  17883. Node: lock
  17884. 371805
  17885. Node: log
  17886. 372570
  17887. Node: log10
  17888. 372788
  17889. Node: log2
  17890. 373012
  17891. Node: longjmp
  17892. 373236
  17893. Node: lowvideo
  17894. 374009
  17895. Node: lseek
  17896. 374273
  17897. Node: malloc
  17898. 374981
  17899. Node: mblen
  17900. 375560
  17901. Node: mbstowcs
  17902. 376139
  17903. Node: mbtowc
  17904. 376641
  17905. Node: memccpy
  17906. 377229
  17907. Node: memchr
  17908. 378200
  17909. Node: memcmp
  17910. 378693
  17911. Node: memcpy
  17912. 379097
  17913. Node: memmove
  17914. 379476
  17915. Node: memset
  17916. 380028
  17917. Node: mkdir
  17918. 380477
  17919. Node: mkfifo
  17920. 380914
  17921. Node: mknod
  17922. 381142
  17923. Node: mkstemp
  17924. 381370
  17925. Node: mktemp
  17926. 382114
  17927. Node: mktime
  17928. 382880
  17929. Node: modf
  17930. 383345
  17931. Node: modfl
  17932. 383734
  17933. Node: _mono_clear
  17934. 384146
  17935. Node: _mono_printf
  17936. 384403
  17937. Node: _mono_putc
  17938. 384712
  17939. Node: movedata
  17940. 384987
  17941. Node: movedatab
  17942. 386568
  17943. Node: movedatal
  17944. 386907
  17945. Node: movedataw
  17946. 387298
  17947. Node: movetext
  17948. 387688
  17949. Node: mprotect
  17950. 388079
  17951. Node: _my_cs
  17952. 389228
  17953. Node: _my_ds
  17954. 389559
  17955. Node: _my_ss
  17956. 389888
  17957. Node: nice
  17958. 390215
  17959. Node: normvideo
  17960. 390542
  17961. Node: nosound
  17962. 390820
  17963. Node: ntohl
  17964. 391045
  17965. Node: ntohs
  17966. 391549
  17967. Node: open
  17968. 392047
  17969. Node: _open
  17970. 394225
  17971. Node: opendir
  17972. 394626
  17973. Node: outb
  17974. 395734
  17975. Node: outp
  17976. 396014
  17977. Node: outportb
  17978. 396296
  17979. Node: outportl
  17980. 396710
  17981. Node: outportsb
  17982. 397129
  17983. Node: outportsl
  17984. 397443
  17985. Node: outportsw
  17986. 397759
  17987. Node: outportw
  17988. 398076
  17989. Node: outpw
  17990. 398494
  17991. Node: pathconf
  17992. 398784
  17993. Node: pause
  17994. 400059
  17995. Node: pclose
  17996. 400386
  17997. Node: perror
  17998. 400957
  17999. Node: pipe
  18000. 401495
  18001. Node: popen
  18002. 401718
  18003. Node: pow
  18004. 402977
  18005. Node: pow10
  18006. 403203
  18007. Node: pow2
  18008. 403425
  18009. Node: _preserve_fncase
  18010. 403656
  18011. Node: printf
  18012. 405198
  18013. Node: putc
  18014. 408568
  18015. Node: putch
  18016. 408952
  18017. Node: putchar
  18018. 409416
  18019. Node: putenv
  18020. 409797
  18021. Node: puts
  18022. 410629
  18023. Node: puttext
  18024. 411028
  18025. Node: putw
  18026. 411370
  18027. Node: qsort
  18028. 411842
  18029. Node: raise
  18030. 413312
  18031. Node: rand
  18032. 413665
  18033. Node: random
  18034. 414021
  18035. Node: rawclock
  18036. 414308
  18037. Node: read
  18038. 414734
  18039. Node: _read
  18040. 415374
  18041. Node: readdir
  18042. 415803
  18043. Node: realloc
  18044. 416558
  18045. Node: regcomp
  18046. 417363
  18047. Node: regerror
  18048. 430742
  18049. Node: regexec
  18050. 433068
  18051. Node: regfree
  18052. 438264
  18053. Node: remove
  18054. 438737
  18055. Node: remque
  18056. 439202
  18057. Node: _rename
  18058. 439764
  18059. Node: rename
  18060. 441034
  18061. Node: rewind
  18062. 442584
  18063. Node: rewinddir
  18064. 442967
  18065. Node: rindex
  18066. 443411
  18067. Node: rmdir
  18068. 443963
  18069. Node: sbrk
  18070. 444370
  18071. Node: scanf
  18072. 445253
  18073. Node: Screen Variables
  18074. 448711
  18075. Node: ScreenClear
  18076. 449845
  18077. Node: ScreenCols
  18078. 450314
  18079. Node: ScreenGetChar
  18080. 450976
  18081. Node: ScreenGetCursor
  18082. 451794
  18083. Node: ScreenMode
  18084. 452326
  18085. Node: ScreenPutChar
  18086. 452783
  18087. Node: ScreenPutString
  18088. 453424
  18089. Node: ScreenRetrieve
  18090. 454166
  18091. Node: ScreenRows
  18092. 454874
  18093. Node: ScreenSetCursor
  18094. 455442
  18095. Node: ScreenUpdate
  18096. 455962
  18097. Node: ScreenUpdateLine
  18098. 456478
  18099. Node: ScreenVisualBell
  18100. 456965
  18101. Node: searchpath
  18102. 457454
  18103. Node: seekdir
  18104. 458129
  18105. Node: select
  18106. 458754
  18107. Node: _set_screen_lines
  18108. 459800
  18109. Node: setbuf
  18110. 460915
  18111. Node: setbuffer
  18112. 461718
  18113. Node: setcbrk
  18114. 462534
  18115. Node: _setcursortype
  18116. 462915
  18117. Node: setdate
  18118. 463353
  18119. Node: setdisk
  18120. 463736
  18121. Node: setenv
  18122. 464142
  18123. Node: setftime
  18124. 464688
  18125. Node: setgrent
  18126. 465423
  18127. Node: setitimer
  18128. 465830
  18129. Node: setjmp
  18130. 467119
  18131. Node: setlinebuf
  18132. 467898
  18133. Node: setlocale
  18134. 468563
  18135. Node: setmntent
  18136. 469692
  18137. Node: setmode
  18138. 470898
  18139. Node: setpgid
  18140. 472196
  18141. Node: setpwent
  18142. 472478
  18143. Node: setrlimit
  18144. 472834
  18145. Node: settime
  18146. 473287
  18147. Node: settimeofday
  18148. 473670
  18149. Node: setvbuf
  18150. 474123
  18151. Node: siglongjmp
  18152. 475184
  18153. Node: signal
  18154. 475435
  18155. Node: sigsetjmp
  18156. 482277
  18157. Node: sin
  18158. 482524
  18159. Node: sinh
  18160. 482733
  18161. Node: sleep
  18162. 482952
  18163. Node: sound
  18164. 483345
  18165. Node: spawn*
  18166. 483593
  18167. Node: sprintf
  18168. 488223
  18169. Node: sqrt
  18170. 488597
  18171. Node: srandom
  18172. 488818
  18173. Node: sscanf
  18174. 489251
  18175. Node: stat
  18176. 489683
  18177. Node: statfs
  18178. 493265
  18179. Node: _status87
  18180. 494341
  18181. Node: _stklen
  18182. 495451
  18183. Node: stpcpy
  18184. 495861
  18185. Node: strcase
  18186. 496224
  18187. Node: strcasecmp
  18188. 496692
  18189. Node: strcat
  18190. 497172
  18191. Node: strchr
  18192. 497551
  18193. Node: strcmp
  18194. 498059
  18195. Node: strcoll
  18196. 498545
  18197. Node: strcpy
  18198. 499080
  18199. Node: strcspn
  18200. 499427
  18201. Node: strdup
  18202. 500041
  18203. Node: strerror
  18204. 500606
  18205. Node: strftime
  18206. 501085
  18207. Node: stricmp
  18208. 503683
  18209. Node: strlen
  18210. 504149
  18211. Node: strlwr
  18212. 504558
  18213. Node: strncase
  18214. 504955
  18215. Node: strncasecmp
  18216. 505520
  18217. Node: strncat
  18218. 506098
  18219. Node: strncmp
  18220. 506496
  18221. Node: strncpy
  18222. 507026
  18223. Node: strnicmp
  18224. 507418
  18225. Node: strpbrk
  18226. 507980
  18227. Node: strrchr
  18228. 508459
  18229. Node: strsep
  18230. 508908
  18231. Node: strspn
  18232. 509794
  18233. Node: strstr
  18234. 510398
  18235. Node: strtod
  18236. 510826
  18237. Node: strtok
  18238. 511356
  18239. Node: strtol
  18240. 512150
  18241. Node: _strtold
  18242. 513043
  18243. Node: strtoll
  18244. 513594
  18245. Node: strtoul
  18246. 514500
  18247. Node: strtoull
  18248. 515021
  18249. Node: strupr
  18250. 515554
  18251. Node: strxfrm
  18252. 515936
  18253. Node: swab
  18254. 516529
  18255. Node: symlink
  18256. 517100
  18257. Node: sync
  18258. 518564
  18259. Node: sys_errlist
  18260. 518780
  18261. Node: sys_nerr
  18262. 519150
  18263. Node: sysconf
  18264. 519547
  18265. Node: system
  18266. 520320
  18267. Node: tan
  18268. 527602
  18269. Node: tanh
  18270. 527811
  18271. Node: tcdrain
  18272. 528035
  18273. Node: tcflow
  18274. 528457
  18275. Node: tcflush
  18276. 528896
  18277. Node: tcgetattr
  18278. 529334
  18279. Node: tcsendbreak
  18280. 529885
  18281. Node: tcsetattr
  18282. 530329
  18283. Node: tell
  18284. 530850
  18285. Node: telldir
  18286. 531216
  18287. Node: textattr
  18288. 531751
  18289. Node: textbackground
  18290. 532131
  18291. Node: textcolor
  18292. 532438
  18293. Node: textmode
  18294. 532730
  18295. Node: time
  18296. 533470
  18297. Node: times
  18298. 533837
  18299. Node: tmpfile
  18300. 534745
  18301. Node: tmpnam
  18302. 535267
  18303. Node: toascii
  18304. 536834
  18305. Node: tolower
  18306. 537242
  18307. Node: toupper
  18308. 537668
  18309. Node: _truename
  18310. 538095
  18311. Node: truncate
  18312. 540046
  18313. Node: ttyname
  18314. 540445
  18315. Node: uclock
  18316. 540831
  18317. Node: umask
  18318. 542208
  18319. Node: uname
  18320. 542457
  18321. Node: ungetc
  18322. 543263
  18323. Node: ungetch
  18324. 543722
  18325. Node: unlink
  18326. 544077
  18327. Node: unlock
  18328. 544447
  18329. Node: _use_lfn
  18330. 544796
  18331. Node: usleep
  18332. 548020
  18333. Node: utime
  18334. 548404
  18335. Node: utimes
  18336. 549337
  18337. Node: vfprintf
  18338. 549844
  18339. Node: vprintf
  18340. 550478
  18341. Node: vsprintf
  18342. 550893
  18343. Node: wait
  18344. 551323
  18345. Node: waitpid
  18346. 552113
  18347. Node: wcstombs
  18348. 552706
  18349. Node: wctomb
  18350. 553170
  18351. Node: wherex
  18352. 553630
  18353. Node: wherey
  18354. 553885
  18355. Node: window
  18356. 554137
  18357. Node: write
  18358. 554507
  18359. Node: _write
  18360. 555288
  18361. Node: xfree
  18362. 555727
  18363. Node: xmalloc
  18364. 556115
  18365. Node: xrealloc
  18366. 556576
  18367. Node: Index
  18368. 557111
  18369. End Tag Table
  18370.