home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJDEV201.ZIP / info / libc.inf < prev    next >
Encoding:
GNU Info File  |  1996-10-31  |  586.5 KB  |  25,563 lines

  1. This is Info file ../../info/libc.inf, produced by Makeinfo version
  2. 1.67 from the input file libc.tex.
  3.  
  4. This is the reference manual for libc.a
  5.  
  6. Copyright (c) 1996 DJ Delorie
  7.  
  8. 
  9. File: libc.inf,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  10.  
  11. * Menu:
  12.  
  13. * Introduction::
  14.  
  15. * Functional Categories::  All public symbols listed by
  16.                            category
  17.  
  18. * Alphabetical List::      All public symbols in alphabetical
  19.                            order
  20.  
  21. * Index::
  22.  
  23. 
  24. File: libc.inf,  Node: Introduction,  Next: Functional Categories,  Prev: Top,  Up: Top
  25.  
  26. Introduction
  27. ************
  28.  
  29. The standard C library, `libc.a', is automatically linked into your
  30. programs by the `gcc' control program.  It provides many of the
  31. functions that are normally associated with C programs.  This document
  32. gives the proper usage information about each of the functions and
  33. variables found in `libc.a'.
  34.  
  35. For each function or variable that the library provides, the definition
  36. of that symbol will include information on which header files to include
  37. in your source to obtain prototypes and type definitions relevent to the
  38. use of that symbol.
  39.  
  40. Note that many of the functions in `libm.a' (the math library) are
  41. defined in `math.h' but are not present in libc.a.  Some are, which may
  42. get confusing, but the rule of thumb is this - the C library contains
  43. those functions that ANSI dictates must exist, so that you don't need
  44. the `-lm' if you only use ANSI functions.  These functions are,
  45. however, vastly simplified compared to the ANSI spec and the functions
  46. in `libm.a', which includes replacements.  For example, `libc.a''s
  47. `ldexp()' doesn't set `errno' on error, but `libm.a''s `ldexp()' does.
  48.  
  49. 
  50. File: libc.inf,  Node: Functional Categories,  Next: Alphabetical List,  Prev: Introduction,  Up: Top
  51.  
  52. Functional Categories
  53. *********************
  54.  
  55. * Menu:
  56.  
  57. * bios functions::
  58. * conio functions::
  59. * cpu functions::
  60. * ctype functions::
  61. * dos functions::
  62. * dpmi functions::
  63. * environment functions::
  64. * file system functions::
  65. * go32 functions::
  66. * io functions::
  67. * locale functions::
  68. * math functions::
  69. * memory functions::
  70. * misc functions::
  71. * mono functions::
  72. * posix functions::
  73. * process functions::
  74. * random number functions::
  75. * shell functions::
  76. * signal functions::
  77. * sound functions::
  78. * startup functions::
  79. * stdio functions::
  80. * stdlib functions::
  81. * string functions::
  82. * termios functions::
  83. * time functions::
  84. * unix functions::
  85.  
  86. 
  87. File: libc.inf,  Node: bios functions,  Next: conio functions,  Up: Functional Categories
  88.  
  89. bios functions
  90. ==============
  91.  
  92. * Menu:
  93.  
  94. * _bios_disk::
  95. * _bios_equiplist::
  96. * _bios_keybrd::
  97. * _bios_memsize::
  98. * _bios_printer::
  99. * _bios_serialcom::
  100. * _bios_timeofday::
  101. * bioscom::
  102. * biosdisk::
  103. * biosequip::
  104. * bioskey::
  105. * biosmemory::
  106. * biosprint::
  107. * biostime::
  108. * getkey::
  109. * getxkey::
  110. * kbhit::
  111.  
  112. 
  113. File: libc.inf,  Node: conio functions,  Next: cpu functions,  Prev: bios functions,  Up: Functional Categories
  114.  
  115. conio functions
  116. ===============
  117.  
  118. * Menu:
  119.  
  120. * blinkvideo::
  121. * cgets::
  122. * clreol::
  123. * clrscr::
  124. * _conio_kbhit::
  125. * cprintf::
  126. * cputs::
  127. * cscanf::
  128. * delline::
  129. * getch::
  130. * getche::
  131. * gettext::
  132. * gettextinfo::
  133. * gotoxy::
  134. * gppconio_init::
  135. * highvideo::
  136. * insline::
  137. * intensevideo::
  138. * lowvideo::
  139. * movetext::
  140. * normvideo::
  141. * putch::
  142. * puttext::
  143. * Screen Variables::
  144. * ScreenClear::
  145. * ScreenCols::
  146. * ScreenGetChar::
  147. * ScreenGetCursor::
  148. * ScreenMode::
  149. * ScreenPutChar::
  150. * ScreenPutString::
  151. * ScreenRetrieve::
  152. * ScreenRows::
  153. * ScreenSetCursor::
  154. * ScreenUpdate::
  155. * ScreenUpdateLine::
  156. * ScreenVisualBell::
  157. * _set_screen_lines::
  158. * _setcursortype::
  159. * textattr::
  160. * textbackground::
  161. * textcolor::
  162. * textmode::
  163. * ungetch::
  164. * wherex::
  165. * wherey::
  166. * window::
  167.  
  168. 
  169. File: libc.inf,  Node: cpu functions,  Next: ctype functions,  Prev: conio functions,  Up: Functional Categories
  170.  
  171. cpu functions
  172. =============
  173.  
  174. * Menu:
  175.  
  176. * _clear87::
  177. * _control87::
  178. * disable::
  179. * enable::
  180. * _fpreset::
  181. * htonl::
  182. * htons::
  183. * inb::
  184. * inp::
  185. * inportb::
  186. * inportl::
  187. * inportsb::
  188. * inportsl::
  189. * inportsw::
  190. * inportw::
  191. * inpw::
  192. * _my_cs::
  193. * _my_ds::
  194. * _my_ss::
  195. * ntohl::
  196. * ntohs::
  197. * outb::
  198. * outp::
  199. * outportb::
  200. * outportl::
  201. * outportsb::
  202. * outportsl::
  203. * outportsw::
  204. * outportw::
  205. * outpw::
  206. * _status87::
  207.  
  208. 
  209. File: libc.inf,  Node: ctype functions,  Next: dos functions,  Prev: cpu functions,  Up: Functional Categories
  210.  
  211. ctype functions
  212. ===============
  213.  
  214. * Menu:
  215.  
  216. * isalnum::
  217. * isalpha::
  218. * isascii::
  219. * iscntrl::
  220. * isdigit::
  221. * isgraph::
  222. * islower::
  223. * isprint::
  224. * ispunct::
  225. * isspace::
  226. * isupper::
  227. * isxdigit::
  228. * toascii::
  229. * tolower::
  230. * toupper::
  231.  
  232. 
  233. File: libc.inf,  Node: dos functions,  Next: dpmi functions,  Prev: ctype functions,  Up: Functional Categories
  234.  
  235. dos functions
  236. =============
  237.  
  238. * Menu:
  239.  
  240. * bdos::
  241. * bdosptr::
  242. * delay::
  243. * _dos_close::
  244. * _dos_commit::
  245. * _dos_creat::
  246. * _dos_creatnew::
  247. * _dos_findfirst::
  248. * _dos_findnext::
  249. * _dos_getdate::
  250. * _dos_getdiskfree::
  251. * _dos_getdrive::
  252. * _dos_getfileattr::
  253. * _dos_getftime::
  254. * _dos_gettime::
  255. * _dos_lock::
  256. * _dos_open::
  257. * _dos_read::
  258. * _dos_setdate::
  259. * _dos_setdrive::
  260. * _dos_setfileattr::
  261. * _dos_setftime::
  262. * _dos_settime::
  263. * _dos_unlock::
  264. * _dos_write::
  265. * dosexterr::
  266. * _flush_disk_cache::
  267. * getcbrk::
  268. * getdisk::
  269. * int386::
  270. * int386x::
  271. * int86::
  272. * int86x::
  273. * intdos::
  274. * intdosx::
  275. * setcbrk::
  276. * setdisk::
  277.  
  278. 
  279. File: libc.inf,  Node: dpmi functions,  Next: environment functions,  Prev: dos functions,  Up: Functional Categories
  280.  
  281. dpmi functions
  282. ==============
  283.  
  284. * Menu:
  285.  
  286. * DPMI Overview::
  287. * DPMI Specification::
  288. * __dpmi_allocate_dos_memory::
  289. * __dpmi_allocate_ldt_descriptors::
  290. * __dpmi_allocate_linear_memory::
  291. * __dpmi_allocate_memory::
  292. * __dpmi_allocate_real_mode_callback::
  293. * __dpmi_allocate_shared_memory::
  294. * __dpmi_allocate_specific_ldt_descriptor::
  295. * __dpmi_clear_debug_watchpoint::
  296. * __dpmi_create_alias_descriptor::
  297. * __dpmi_discard_page_contents::
  298. * __dpmi_free_dos_memory::
  299. * __dpmi_free_ldt_descriptor::
  300. * __dpmi_free_memory::
  301. * __dpmi_free_physical_address_mapping::
  302. * __dpmi_free_real_mode_callback::
  303. * __dpmi_free_serialization_on_shared_memory::
  304. * __dpmi_free_shared_memory::
  305. * __dpmi_get_and_disable_virtual_interrupt_state::
  306. * __dpmi_get_and_enable_virtual_interrupt_state::
  307. * __dpmi_get_and_set_virtual_interrupt_state::
  308. * __dpmi_get_capabilities::
  309. * __dpmi_get_coprocessor_status::
  310. * __dpmi_get_descriptor::
  311. * __dpmi_get_descriptor_access_rights::
  312. * __dpmi_get_extended_exception_handler_vector_pm::
  313. * __dpmi_get_extended_exception_handler_vector_rm::
  314. * __dpmi_get_free_memory_information::
  315. * __dpmi_get_memory_block_size_and_base::
  316. * __dpmi_get_memory_information::
  317. * __dpmi_get_multiple_descriptors::
  318. * __dpmi_get_page_attributes::
  319. * __dpmi_get_page_size::
  320. * __dpmi_get_processor_exception_handler_vector::
  321. * __dpmi_get_protected_mode_interrupt_vector::
  322. * __dpmi_get_raw_mode_switch_addr::
  323. * __dpmi_get_real_mode_interrupt_vector::
  324. * __dpmi_get_segment_base_address::
  325. * __dpmi_get_segment_limit::
  326. * __dpmi_get_selector_increment_value::
  327. * __dpmi_get_state_of_debug_watchpoint::
  328. * __dpmi_get_state_save_restore_addr::
  329. * __dpmi_get_vendor_specific_api_entry_point::
  330. * __dpmi_get_version::
  331. * __dpmi_get_virtual_interrupt_state::
  332. * __dpmi_install_resident_service_provider_callback::
  333. * __dpmi_int::
  334. * __dpmi_lock_linear_region::
  335. * __dpmi_map_conventional_memory_in_memory_block::
  336. * __dpmi_map_device_in_memory_block::
  337. * __dpmi_mark_page_as_demand_paging_candidate::
  338. * __dpmi_mark_real_mode_region_as_pageable::
  339. * __dpmi_physical_address_mapping::
  340. * __dpmi_relock_real_mode_region::
  341. * __dpmi_reset_debug_watchpoint::
  342. * __dpmi_resize_dos_memory::
  343. * __dpmi_resize_linear_memory::
  344. * __dpmi_resize_memory::
  345. * __dpmi_segment_to_descriptor::
  346. * __dpmi_serialize_on_shared_memory::
  347. * __dpmi_set_coprocessor_emulation::
  348. * __dpmi_set_debug_watchpoint::
  349. * __dpmi_set_descriptor::
  350. * __dpmi_set_descriptor_access_rights::
  351. * __dpmi_set_extended_exception_handler_vector_pm::
  352. * __dpmi_set_extended_exception_handler_vector_rm::
  353. * __dpmi_set_multiple_descriptors::
  354. * __dpmi_set_page_attributes::
  355. * __dpmi_set_processor_exception_handler_vector::
  356. * __dpmi_set_protected_mode_interrupt_vector::
  357. * __dpmi_set_real_mode_interrupt_vector::
  358. * __dpmi_set_segment_base_address::
  359. * __dpmi_set_segment_limit::
  360. * __dpmi_simulate_real_mode_interrupt::
  361. * __dpmi_simulate_real_mode_procedure_iret::
  362. * __dpmi_simulate_real_mode_procedure_retf::
  363. * __dpmi_simulate_real_mode_procedure_retf_stack::
  364. * __dpmi_terminate_and_stay_resident::
  365. * __dpmi_unlock_linear_region::
  366. * __dpmi_yield::
  367. * _go32_dpmi_allocate_dos_memory::
  368. * _go32_dpmi_allocate_iret_wrapper::
  369. * _go32_dpmi_allocate_real_mode_callback_iret::
  370. * _go32_dpmi_allocate_real_mode_callback_retf::
  371. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  372. * _go32_dpmi_free_dos_memory::
  373. * _go32_dpmi_free_iret_wrapper::
  374. * _go32_dpmi_free_real_mode_callback::
  375. * _go32_dpmi_get_free_memory_information::
  376. * _go32_dpmi_get_protected_mode_interrupt_vector::
  377. * _go32_dpmi_get_real_mode_interrupt_vector::
  378. * _go32_dpmi_remaining_physical_memory::
  379. * _go32_dpmi_remaining_virtual_memory::
  380. * _go32_dpmi_resize_dos_memory::
  381. * _go32_dpmi_set_protected_mode_interrupt_vector::
  382. * _go32_dpmi_set_real_mode_interrupt_vector::
  383. * _go32_dpmi_simulate_fcall::
  384. * _go32_dpmi_simulate_fcall_iret::
  385. * _go32_dpmi_simulate_int::
  386. * _go32_info_block::
  387.  
  388. 
  389. File: libc.inf,  Node: environment functions,  Next: file system functions,  Prev: dpmi functions,  Up: Functional Categories
  390.  
  391. environment functions
  392. =====================
  393.  
  394. * Menu:
  395.  
  396. * getenv::
  397. * putenv::
  398.  
  399. 
  400. File: libc.inf,  Node: file system functions,  Next: go32 functions,  Prev: environment functions,  Up: Functional Categories
  401.  
  402. file system functions
  403. =====================
  404.  
  405. * Menu:
  406.  
  407. * access::
  408. * chdir::
  409. * chmod::
  410. * _chmod::
  411. * _close::
  412. * closedir::
  413. * _creat::
  414. * File System Extensions::
  415. * file_tree_walk::
  416. * findfirst::
  417. * findnext::
  418. * _fixpath::
  419. * fnmatch::
  420. * fnmerge::
  421. * fnsplit::
  422. * fpathconf::
  423. * __FSEXT_add_open_handler::
  424. * __FSEXT_alloc_fd::
  425. * __FSEXT_call_open_handlers::
  426. * __FSEXT_get_function::
  427. * __FSEXT_set_function::
  428. * ftw::
  429. * _get_volume_info::
  430. * getcwd::
  431. * getdfree::
  432. * getftime::
  433. * getwd::
  434. * _lfn_gen_short_fname::
  435. * _lfn_get_ftime::
  436. * mkdir::
  437. * mkstemp::
  438. * mktemp::
  439. * _open::
  440. * opendir::
  441. * _preserve_fncase::
  442. * _read::
  443. * readdir::
  444. * remove::
  445. * _rename::
  446. * rename::
  447. * rewinddir::
  448. * rmdir::
  449. * searchpath::
  450. * seekdir::
  451. * setftime::
  452. * statfs::
  453. * telldir::
  454. * umask::
  455. * unlink::
  456. * _use_lfn::
  457. * utime::
  458. * _write::
  459.  
  460. 
  461. File: libc.inf,  Node: go32 functions,  Next: io functions,  Prev: file system functions,  Up: Functional Categories
  462.  
  463. go32 functions
  464. ==============
  465.  
  466. * Menu:
  467.  
  468. * _go32_conventional_mem_selector::
  469. * _go32_dpmi_lock_code::
  470. * _go32_dpmi_lock_data::
  471. * _go32_interrupt_stack_size::
  472. * _go32_my_cs::
  473. * _go32_my_ds::
  474. * _go32_my_ss::
  475. * _go32_rmcb_stack_size::
  476. * _go32_want_ctrl_break::
  477. * _go32_was_ctrl_break_hit::
  478.  
  479. 
  480. File: libc.inf,  Node: io functions,  Next: locale functions,  Prev: go32 functions,  Up: Functional Categories
  481.  
  482. io functions
  483. ============
  484.  
  485. * Menu:
  486.  
  487. * chsize::
  488. * close::
  489. * creat::
  490. * crlf2nl::
  491. * dup::
  492. * dup2::
  493. * fcntl::
  494. * __file_exists::
  495. * filelength::
  496. * _get_dev_info::
  497. * ioctl (DOS)::
  498. * ioctl (General description)::
  499. * ioctl (UNIX)::
  500. * _is_executable::
  501. * link::
  502. * lock::
  503. * lseek::
  504. * open::
  505. * read::
  506. * setmode::
  507. * stat::
  508. * symlink::
  509. * tell::
  510. * truncate::
  511. * unlock::
  512. * write::
  513.  
  514. 
  515. File: libc.inf,  Node: locale functions,  Next: math functions,  Prev: io functions,  Up: Functional Categories
  516.  
  517. locale functions
  518. ================
  519.  
  520. * Menu:
  521.  
  522. * localeconv::
  523. * mblen::
  524. * mbstowcs::
  525. * mbtowc::
  526. * setlocale::
  527. * strcoll::
  528. * strxfrm::
  529. * wcstombs::
  530. * wctomb::
  531.  
  532. 
  533. File: libc.inf,  Node: math functions,  Next: memory functions,  Prev: locale functions,  Up: Functional Categories
  534.  
  535. math functions
  536. ==============
  537.  
  538. * Menu:
  539.  
  540. * abs::
  541. * acos::
  542. * acosh::
  543. * asin::
  544. * asinh::
  545. * atan::
  546. * atan2::
  547. * atanh::
  548. * ceil::
  549. * cos::
  550. * cosh::
  551. * div::
  552. * exp::
  553. * fabs::
  554. * floor::
  555. * fmod::
  556. * frexp::
  557. * hypot::
  558. * ldexp::
  559. * ldiv::
  560. * lldiv::
  561. * log::
  562. * log10::
  563. * log2::
  564. * modf::
  565. * modfl::
  566. * pow::
  567. * pow10::
  568. * pow2::
  569. * sin::
  570. * sinh::
  571. * sqrt::
  572. * tan::
  573. * tanh::
  574.  
  575. 
  576. File: libc.inf,  Node: memory functions,  Next: misc functions,  Prev: math functions,  Up: Functional Categories
  577.  
  578. memory functions
  579. ================
  580.  
  581. * Menu:
  582.  
  583. * alloca::
  584. * bcmp::
  585. * bcopy::
  586. * brk::
  587. * bzero::
  588. * calloc::
  589. * cfree::
  590. * __djgpp_map_physical_memory::
  591. * __djgpp_memory_handle::
  592. * __djgpp_memory_handle_list::
  593. * __djgpp_nearptr_disable::
  594. * __djgpp_nearptr_enable::
  595. * __djgpp_set_page_attributes::
  596. * dosmemget::
  597. * dosmemgetb::
  598. * dosmemgetl::
  599. * dosmemgetw::
  600. * dosmemput::
  601. * dosmemputb::
  602. * dosmemputl::
  603. * dosmemputw::
  604. * _far*::
  605. * free::
  606. * malloc::
  607. * memccpy::
  608. * memchr::
  609. * memcmp::
  610. * memcpy::
  611. * memmove::
  612. * memset::
  613. * movedata::
  614. * movedatab::
  615. * movedatal::
  616. * movedataw::
  617. * mprotect::
  618. * realloc::
  619. * sbrk::
  620. * swab::
  621. * xfree::
  622. * xmalloc::
  623. * xrealloc::
  624.  
  625. 
  626. File: libc.inf,  Node: misc functions,  Next: mono functions,  Prev: memory functions,  Up: Functional Categories
  627.  
  628. misc functions
  629. ==============
  630.  
  631. * Menu:
  632.  
  633. * assert::
  634. * bsearch::
  635. * _dxe_load::
  636. * _get_dos_version::
  637. * gethostname::
  638. * getlongpass::
  639. * getopt::
  640. * getpagesize::
  641. * getpass::
  642. * insque::
  643. * labs::
  644. * llabs::
  645. * longjmp::
  646. * qsort::
  647. * remque::
  648. * setjmp::
  649. * siglongjmp::
  650. * sigsetjmp::
  651.  
  652. 
  653. File: libc.inf,  Node: mono functions,  Next: posix functions,  Prev: misc functions,  Up: Functional Categories
  654.  
  655. mono functions
  656. ==============
  657.  
  658. * Menu:
  659.  
  660. * _mono_clear::
  661. * _mono_printf::
  662. * _mono_putc::
  663.  
  664. 
  665. File: libc.inf,  Node: posix functions,  Next: process functions,  Prev: mono functions,  Up: Functional Categories
  666.  
  667. posix functions
  668. ===============
  669.  
  670. * Menu:
  671.  
  672. * getdtablesize::
  673. * pathconf::
  674. * sysconf::
  675.  
  676. 
  677. File: libc.inf,  Node: process functions,  Next: random number functions,  Prev: posix functions,  Up: Functional Categories
  678.  
  679. process functions
  680. =================
  681.  
  682. * Menu:
  683.  
  684. * abort::
  685. * alarm::
  686. * atexit::
  687. * exec*::
  688. * __exit::
  689. * _exit::
  690. * exit::
  691. * getitimer::
  692. * kill::
  693. * nice::
  694. * pause::
  695. * setitimer::
  696. * sleep::
  697. * spawn*::
  698. * system::
  699. * usleep::
  700. * wait::
  701. * waitpid::
  702.  
  703. 
  704. File: libc.inf,  Node: random number functions,  Next: shell functions,  Prev: process functions,  Up: Functional Categories
  705.  
  706. random number functions
  707. =======================
  708.  
  709. * Menu:
  710.  
  711. * rand::
  712. * random::
  713. * srandom::
  714.  
  715. 
  716. File: libc.inf,  Node: shell functions,  Next: signal functions,  Prev: random number functions,  Up: Functional Categories
  717.  
  718. shell functions
  719. ===============
  720.  
  721. * Menu:
  722.  
  723. * glob::
  724. * globfree::
  725.  
  726. 
  727. File: libc.inf,  Node: signal functions,  Next: sound functions,  Prev: shell functions,  Up: Functional Categories
  728.  
  729. signal functions
  730. ================
  731.  
  732. * Menu:
  733.  
  734. * __djgpp_exception_toggle::
  735. * __djgpp_set_ctrl_c::
  736. * raise::
  737. * signal::
  738.  
  739. 
  740. File: libc.inf,  Node: sound functions,  Next: startup functions,  Prev: signal functions,  Up: Functional Categories
  741.  
  742. sound functions
  743. ===============
  744.  
  745. * Menu:
  746.  
  747. * nosound::
  748. * sound::
  749.  
  750. 
  751. File: libc.inf,  Node: startup functions,  Next: stdio functions,  Prev: sound functions,  Up: Functional Categories
  752.  
  753. startup functions
  754. =================
  755.  
  756. * Menu:
  757.  
  758. * __crt0_glob_function::
  759. * __crt0_load_environment_file::
  760. * __crt0_setup_arguments::
  761. * _crt0_startup_flags::
  762. * _stklen::
  763.  
  764. 
  765. File: libc.inf,  Node: stdio functions,  Next: stdlib functions,  Prev: startup functions,  Up: Functional Categories
  766.  
  767. stdio functions
  768. ===============
  769.  
  770. * Menu:
  771.  
  772. * clearerr::
  773. * _djstat_describe_lossage::
  774. * _djstat_fail_bits::
  775. * _djstat_flags::
  776. * _doprnt::
  777. * _doscan::
  778. * errno::
  779. * fclose::
  780. * fdopen::
  781. * feof::
  782. * ferror::
  783. * fflush::
  784. * fgetc::
  785. * fgetpos::
  786. * fgets::
  787. * fileno::
  788. * _fmode::
  789. * fopen::
  790. * fprintf::
  791. * fpurge::
  792. * fputc::
  793. * fputs::
  794. * fread::
  795. * freopen::
  796. * fscanf::
  797. * fseek::
  798. * fsetpos::
  799. * fstat::
  800. * fsync::
  801. * ftell::
  802. * ftruncate::
  803. * _fwalk::
  804. * fwrite::
  805. * getc::
  806. * getchar::
  807. * gets::
  808. * getw::
  809. * perror::
  810. * printf::
  811. * putc::
  812. * putchar::
  813. * puts::
  814. * putw::
  815. * rewind::
  816. * scanf::
  817. * setbuf::
  818. * setbuffer::
  819. * setlinebuf::
  820. * setvbuf::
  821. * sprintf::
  822. * sscanf::
  823. * strerror::
  824. * sys_errlist::
  825. * sys_nerr::
  826. * tmpfile::
  827. * tmpnam::
  828. * _truename::
  829. * ungetc::
  830. * vfprintf::
  831. * vprintf::
  832. * vsprintf::
  833.  
  834. 
  835. File: libc.inf,  Node: stdlib functions,  Next: string functions,  Prev: stdio functions,  Up: Functional Categories
  836.  
  837. stdlib functions
  838. ================
  839.  
  840. * Menu:
  841.  
  842. * setenv::
  843.  
  844. 
  845. File: libc.inf,  Node: string functions,  Next: termios functions,  Prev: stdlib functions,  Up: Functional Categories
  846.  
  847. string functions
  848. ================
  849.  
  850. * Menu:
  851.  
  852. * atof::
  853. * atoi::
  854. * atol::
  855. * _atold::
  856. * ffs::
  857. * index::
  858. * itoa::
  859. * regcomp::
  860. * regerror::
  861. * regexec::
  862. * regfree::
  863. * rindex::
  864. * stpcpy::
  865. * strcase::
  866. * strcasecmp::
  867. * strcat::
  868. * strchr::
  869. * strcmp::
  870. * strcpy::
  871. * strcspn::
  872. * strdup::
  873. * stricmp::
  874. * strlen::
  875. * strlwr::
  876. * strncase::
  877. * strncasecmp::
  878. * strncat::
  879. * strncmp::
  880. * strncpy::
  881. * strnicmp::
  882. * strpbrk::
  883. * strrchr::
  884. * strsep::
  885. * strspn::
  886. * strstr::
  887. * strtod::
  888. * strtok::
  889. * strtol::
  890. * _strtold::
  891. * strtoll::
  892. * strtoul::
  893. * strtoull::
  894. * strupr::
  895.  
  896. 
  897. File: libc.inf,  Node: termios functions,  Next: time functions,  Prev: string functions,  Up: Functional Categories
  898.  
  899. termios functions
  900. =================
  901.  
  902. * Menu:
  903.  
  904. * cfgetispeed::
  905. * cfgetospeed::
  906. * cfmakeraw::
  907. * cfsetispeed::
  908. * cfsetospeed::
  909. * cfsetspeed::
  910. * __libc_termios_init::
  911. * tcdrain::
  912. * tcflow::
  913. * tcflush::
  914. * tcgetattr::
  915. * tcsendbreak::
  916. * tcsetattr::
  917.  
  918. 
  919. File: libc.inf,  Node: time functions,  Next: unix functions,  Prev: termios functions,  Up: Functional Categories
  920.  
  921. time functions
  922. ==============
  923.  
  924. * Menu:
  925.  
  926. * asctime::
  927. * clock::
  928. * ctime::
  929. * difftime::
  930. * ftime::
  931. * getdate::
  932. * gettime::
  933. * gettimeofday::
  934. * gmtime::
  935. * localtime::
  936. * mktime::
  937. * rawclock::
  938. * setdate::
  939. * settime::
  940. * settimeofday::
  941. * strftime::
  942. * time::
  943. * times::
  944. * uclock::
  945. * utimes::
  946.  
  947. 
  948. File: libc.inf,  Node: unix functions,  Prev: time functions,  Up: Functional Categories
  949.  
  950. unix functions
  951. ==============
  952.  
  953. * Menu:
  954.  
  955. * addmntent::
  956. * chown::
  957. * endgrent::
  958. * endmntent::
  959. * endpwent::
  960. * fgetgrent::
  961. * fork::
  962. * getegid::
  963. * geteuid::
  964. * getgid::
  965. * getgrent::
  966. * getgrgid::
  967. * getgrnam::
  968. * getlogin::
  969. * getmntent::
  970. * getpgrp::
  971. * getpid::
  972. * getpwent::
  973. * getpwnam::
  974. * getpwuid::
  975. * getrlimit::
  976. * getrusage::
  977. * getuid::
  978. * hasmntopt::
  979. * isatty::
  980. * mkfifo::
  981. * mknod::
  982. * pclose::
  983. * pipe::
  984. * popen::
  985. * select::
  986. * setgrent::
  987. * setmntent::
  988. * setpgid::
  989. * setpwent::
  990. * setrlimit::
  991. * sync::
  992. * ttyname::
  993. * uname::
  994.  
  995. 
  996. File: libc.inf,  Node: Alphabetical List,  Prev: Functional Categories,  Up: Top
  997.  
  998. Alphabetical List
  999. *****************
  1000.  
  1001. * Menu:
  1002.  
  1003. * abort::
  1004. * abs::
  1005. * access::
  1006. * acos::
  1007. * acosh::
  1008. * addmntent::
  1009. * alarm::
  1010. * alloca::
  1011. * asctime::
  1012. * asin::
  1013. * asinh::
  1014. * assert::
  1015. * atan::
  1016. * atan2::
  1017. * atanh::
  1018. * atexit::
  1019. * atof::
  1020. * atoi::
  1021. * atol::
  1022. * _atold::
  1023. * bcmp::
  1024. * bcopy::
  1025. * bdos::
  1026. * bdosptr::
  1027. * _bios_disk::
  1028. * _bios_equiplist::
  1029. * _bios_keybrd::
  1030. * _bios_memsize::
  1031. * _bios_printer::
  1032. * _bios_serialcom::
  1033. * _bios_timeofday::
  1034. * bioscom::
  1035. * biosdisk::
  1036. * biosequip::
  1037. * bioskey::
  1038. * biosmemory::
  1039. * biosprint::
  1040. * biostime::
  1041. * blinkvideo::
  1042. * brk::
  1043. * bsearch::
  1044. * bzero::
  1045. * calloc::
  1046. * ceil::
  1047. * cfgetispeed::
  1048. * cfgetospeed::
  1049. * cfmakeraw::
  1050. * cfree::
  1051. * cfsetispeed::
  1052. * cfsetospeed::
  1053. * cfsetspeed::
  1054. * cgets::
  1055. * chdir::
  1056. * chmod::
  1057. * _chmod::
  1058. * chown::
  1059. * chsize::
  1060. * _clear87::
  1061. * clearerr::
  1062. * clock::
  1063. * close::
  1064. * _close::
  1065. * closedir::
  1066. * clreol::
  1067. * clrscr::
  1068. * _conio_kbhit::
  1069. * _control87::
  1070. * cos::
  1071. * cosh::
  1072. * cprintf::
  1073. * cputs::
  1074. * creat::
  1075. * _creat::
  1076. * crlf2nl::
  1077. * __crt0_glob_function::
  1078. * __crt0_load_environment_file::
  1079. * __crt0_setup_arguments::
  1080. * _crt0_startup_flags::
  1081. * cscanf::
  1082. * ctime::
  1083. * delay::
  1084. * delline::
  1085. * difftime::
  1086. * disable::
  1087. * div::
  1088. * __djgpp_exception_toggle::
  1089. * __djgpp_map_physical_memory::
  1090. * __djgpp_memory_handle::
  1091. * __djgpp_memory_handle_list::
  1092. * __djgpp_nearptr_disable::
  1093. * __djgpp_nearptr_enable::
  1094. * __djgpp_set_ctrl_c::
  1095. * __djgpp_set_page_attributes::
  1096. * _djstat_describe_lossage::
  1097. * _djstat_fail_bits::
  1098. * _djstat_flags::
  1099. * _doprnt::
  1100. * _dos_close::
  1101. * _dos_commit::
  1102. * _dos_creat::
  1103. * _dos_creatnew::
  1104. * _dos_findfirst::
  1105. * _dos_findnext::
  1106. * _dos_getdate::
  1107. * _dos_getdiskfree::
  1108. * _dos_getdrive::
  1109. * _dos_getfileattr::
  1110. * _dos_getftime::
  1111. * _dos_gettime::
  1112. * _dos_lock::
  1113. * _dos_open::
  1114. * _dos_read::
  1115. * _dos_setdate::
  1116. * _dos_setdrive::
  1117. * _dos_setfileattr::
  1118. * _dos_setftime::
  1119. * _dos_settime::
  1120. * _dos_unlock::
  1121. * _dos_write::
  1122. * _doscan::
  1123. * dosexterr::
  1124. * dosmemget::
  1125. * dosmemgetb::
  1126. * dosmemgetl::
  1127. * dosmemgetw::
  1128. * dosmemput::
  1129. * dosmemputb::
  1130. * dosmemputl::
  1131. * dosmemputw::
  1132. * DPMI Overview::
  1133. * DPMI Specification::
  1134. * __dpmi_allocate_dos_memory::
  1135. * __dpmi_allocate_ldt_descriptors::
  1136. * __dpmi_allocate_linear_memory::
  1137. * __dpmi_allocate_memory::
  1138. * __dpmi_allocate_real_mode_callback::
  1139. * __dpmi_allocate_shared_memory::
  1140. * __dpmi_allocate_specific_ldt_descriptor::
  1141. * __dpmi_clear_debug_watchpoint::
  1142. * __dpmi_create_alias_descriptor::
  1143. * __dpmi_discard_page_contents::
  1144. * __dpmi_free_dos_memory::
  1145. * __dpmi_free_ldt_descriptor::
  1146. * __dpmi_free_memory::
  1147. * __dpmi_free_physical_address_mapping::
  1148. * __dpmi_free_real_mode_callback::
  1149. * __dpmi_free_serialization_on_shared_memory::
  1150. * __dpmi_free_shared_memory::
  1151. * __dpmi_get_and_disable_virtual_interrupt_state::
  1152. * __dpmi_get_and_enable_virtual_interrupt_state::
  1153. * __dpmi_get_and_set_virtual_interrupt_state::
  1154. * __dpmi_get_capabilities::
  1155. * __dpmi_get_coprocessor_status::
  1156. * __dpmi_get_descriptor::
  1157. * __dpmi_get_descriptor_access_rights::
  1158. * __dpmi_get_extended_exception_handler_vector_pm::
  1159. * __dpmi_get_extended_exception_handler_vector_rm::
  1160. * __dpmi_get_free_memory_information::
  1161. * __dpmi_get_memory_block_size_and_base::
  1162. * __dpmi_get_memory_information::
  1163. * __dpmi_get_multiple_descriptors::
  1164. * __dpmi_get_page_attributes::
  1165. * __dpmi_get_page_size::
  1166. * __dpmi_get_processor_exception_handler_vector::
  1167. * __dpmi_get_protected_mode_interrupt_vector::
  1168. * __dpmi_get_raw_mode_switch_addr::
  1169. * __dpmi_get_real_mode_interrupt_vector::
  1170. * __dpmi_get_segment_base_address::
  1171. * __dpmi_get_segment_limit::
  1172. * __dpmi_get_selector_increment_value::
  1173. * __dpmi_get_state_of_debug_watchpoint::
  1174. * __dpmi_get_state_save_restore_addr::
  1175. * __dpmi_get_vendor_specific_api_entry_point::
  1176. * __dpmi_get_version::
  1177. * __dpmi_get_virtual_interrupt_state::
  1178. * __dpmi_install_resident_service_provider_callback::
  1179. * __dpmi_int::
  1180. * __dpmi_lock_linear_region::
  1181. * __dpmi_map_conventional_memory_in_memory_block::
  1182. * __dpmi_map_device_in_memory_block::
  1183. * __dpmi_mark_page_as_demand_paging_candidate::
  1184. * __dpmi_mark_real_mode_region_as_pageable::
  1185. * __dpmi_physical_address_mapping::
  1186. * __dpmi_relock_real_mode_region::
  1187. * __dpmi_reset_debug_watchpoint::
  1188. * __dpmi_resize_dos_memory::
  1189. * __dpmi_resize_linear_memory::
  1190. * __dpmi_resize_memory::
  1191. * __dpmi_segment_to_descriptor::
  1192. * __dpmi_serialize_on_shared_memory::
  1193. * __dpmi_set_coprocessor_emulation::
  1194. * __dpmi_set_debug_watchpoint::
  1195. * __dpmi_set_descriptor::
  1196. * __dpmi_set_descriptor_access_rights::
  1197. * __dpmi_set_extended_exception_handler_vector_pm::
  1198. * __dpmi_set_extended_exception_handler_vector_rm::
  1199. * __dpmi_set_multiple_descriptors::
  1200. * __dpmi_set_page_attributes::
  1201. * __dpmi_set_processor_exception_handler_vector::
  1202. * __dpmi_set_protected_mode_interrupt_vector::
  1203. * __dpmi_set_real_mode_interrupt_vector::
  1204. * __dpmi_set_segment_base_address::
  1205. * __dpmi_set_segment_limit::
  1206. * __dpmi_simulate_real_mode_interrupt::
  1207. * __dpmi_simulate_real_mode_procedure_iret::
  1208. * __dpmi_simulate_real_mode_procedure_retf::
  1209. * __dpmi_simulate_real_mode_procedure_retf_stack::
  1210. * __dpmi_terminate_and_stay_resident::
  1211. * __dpmi_unlock_linear_region::
  1212. * __dpmi_yield::
  1213. * dup::
  1214. * dup2::
  1215. * _dxe_load::
  1216. * enable::
  1217. * endgrent::
  1218. * endmntent::
  1219. * endpwent::
  1220. * errno::
  1221. * exec*::
  1222. * __exit::
  1223. * _exit::
  1224. * exit::
  1225. * exp::
  1226. * fabs::
  1227. * _far*::
  1228. * fclose::
  1229. * fcntl::
  1230. * fdopen::
  1231. * feof::
  1232. * ferror::
  1233. * fflush::
  1234. * ffs::
  1235. * fgetc::
  1236. * fgetgrent::
  1237. * fgetpos::
  1238. * fgets::
  1239. * File System Extensions::
  1240. * __file_exists::
  1241. * file_tree_walk::
  1242. * filelength::
  1243. * fileno::
  1244. * findfirst::
  1245. * findnext::
  1246. * _fixpath::
  1247. * floor::
  1248. * _flush_disk_cache::
  1249. * fmod::
  1250. * _fmode::
  1251. * fnmatch::
  1252. * fnmerge::
  1253. * fnsplit::
  1254. * fopen::
  1255. * fork::
  1256. * fpathconf::
  1257. * _fpreset::
  1258. * fprintf::
  1259. * fpurge::
  1260. * fputc::
  1261. * fputs::
  1262. * fread::
  1263. * free::
  1264. * freopen::
  1265. * frexp::
  1266. * fscanf::
  1267. * fseek::
  1268. * fsetpos::
  1269. * __FSEXT_add_open_handler::
  1270. * __FSEXT_alloc_fd::
  1271. * __FSEXT_call_open_handlers::
  1272. * __FSEXT_get_function::
  1273. * __FSEXT_set_function::
  1274. * fstat::
  1275. * fsync::
  1276. * ftell::
  1277. * ftime::
  1278. * ftruncate::
  1279. * ftw::
  1280. * _fwalk::
  1281. * fwrite::
  1282. * _get_dev_info::
  1283. * _get_dos_version::
  1284. * _get_volume_info::
  1285. * getc::
  1286. * getcbrk::
  1287. * getch::
  1288. * getchar::
  1289. * getche::
  1290. * getcwd::
  1291. * getdate::
  1292. * getdfree::
  1293. * getdisk::
  1294. * getdtablesize::
  1295. * getegid::
  1296. * getenv::
  1297. * geteuid::
  1298. * getftime::
  1299. * getgid::
  1300. * getgrent::
  1301. * getgrgid::
  1302. * getgrnam::
  1303. * gethostname::
  1304. * getitimer::
  1305. * getkey::
  1306. * getlogin::
  1307. * getlongpass::
  1308. * getmntent::
  1309. * getopt::
  1310. * getpagesize::
  1311. * getpass::
  1312. * getpgrp::
  1313. * getpid::
  1314. * getpwent::
  1315. * getpwnam::
  1316. * getpwuid::
  1317. * getrlimit::
  1318. * getrusage::
  1319. * gets::
  1320. * gettext::
  1321. * gettextinfo::
  1322. * gettime::
  1323. * gettimeofday::
  1324. * getuid::
  1325. * getw::
  1326. * getwd::
  1327. * getxkey::
  1328. * glob::
  1329. * globfree::
  1330. * gmtime::
  1331. * _go32_conventional_mem_selector::
  1332. * _go32_dpmi_allocate_dos_memory::
  1333. * _go32_dpmi_allocate_iret_wrapper::
  1334. * _go32_dpmi_allocate_real_mode_callback_iret::
  1335. * _go32_dpmi_allocate_real_mode_callback_retf::
  1336. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  1337. * _go32_dpmi_free_dos_memory::
  1338. * _go32_dpmi_free_iret_wrapper::
  1339. * _go32_dpmi_free_real_mode_callback::
  1340. * _go32_dpmi_get_free_memory_information::
  1341. * _go32_dpmi_get_protected_mode_interrupt_vector::
  1342. * _go32_dpmi_get_real_mode_interrupt_vector::
  1343. * _go32_dpmi_lock_code::
  1344. * _go32_dpmi_lock_data::
  1345. * _go32_dpmi_remaining_physical_memory::
  1346. * _go32_dpmi_remaining_virtual_memory::
  1347. * _go32_dpmi_resize_dos_memory::
  1348. * _go32_dpmi_set_protected_mode_interrupt_vector::
  1349. * _go32_dpmi_set_real_mode_interrupt_vector::
  1350. * _go32_dpmi_simulate_fcall::
  1351. * _go32_dpmi_simulate_fcall_iret::
  1352. * _go32_dpmi_simulate_int::
  1353. * _go32_info_block::
  1354. * _go32_interrupt_stack_size::
  1355. * _go32_my_cs::
  1356. * _go32_my_ds::
  1357. * _go32_my_ss::
  1358. * _go32_rmcb_stack_size::
  1359. * _go32_want_ctrl_break::
  1360. * _go32_was_ctrl_break_hit::
  1361. * gotoxy::
  1362. * gppconio_init::
  1363. * hasmntopt::
  1364. * highvideo::
  1365. * htonl::
  1366. * htons::
  1367. * hypot::
  1368. * inb::
  1369. * index::
  1370. * inp::
  1371. * inportb::
  1372. * inportl::
  1373. * inportsb::
  1374. * inportsl::
  1375. * inportsw::
  1376. * inportw::
  1377. * inpw::
  1378. * insline::
  1379. * insque::
  1380. * int386::
  1381. * int386x::
  1382. * int86::
  1383. * int86x::
  1384. * intdos::
  1385. * intdosx::
  1386. * intensevideo::
  1387. * ioctl (DOS)::
  1388. * ioctl (General description)::
  1389. * ioctl (UNIX)::
  1390. * _is_executable::
  1391. * isalnum::
  1392. * isalpha::
  1393. * isascii::
  1394. * isatty::
  1395. * iscntrl::
  1396. * isdigit::
  1397. * isgraph::
  1398. * islower::
  1399. * isprint::
  1400. * ispunct::
  1401. * isspace::
  1402. * isupper::
  1403. * isxdigit::
  1404. * itoa::
  1405. * kbhit::
  1406. * kill::
  1407. * labs::
  1408. * ldexp::
  1409. * ldiv::
  1410. * _lfn_gen_short_fname::
  1411. * _lfn_get_ftime::
  1412. * __libc_termios_init::
  1413. * link::
  1414. * llabs::
  1415. * lldiv::
  1416. * localeconv::
  1417. * localtime::
  1418. * lock::
  1419. * log::
  1420. * log10::
  1421. * log2::
  1422. * longjmp::
  1423. * lowvideo::
  1424. * lseek::
  1425. * malloc::
  1426. * mblen::
  1427. * mbstowcs::
  1428. * mbtowc::
  1429. * memccpy::
  1430. * memchr::
  1431. * memcmp::
  1432. * memcpy::
  1433. * memmove::
  1434. * memset::
  1435. * mkdir::
  1436. * mkfifo::
  1437. * mknod::
  1438. * mkstemp::
  1439. * mktemp::
  1440. * mktime::
  1441. * modf::
  1442. * modfl::
  1443. * _mono_clear::
  1444. * _mono_printf::
  1445. * _mono_putc::
  1446. * movedata::
  1447. * movedatab::
  1448. * movedatal::
  1449. * movedataw::
  1450. * movetext::
  1451. * mprotect::
  1452. * _my_cs::
  1453. * _my_ds::
  1454. * _my_ss::
  1455. * nice::
  1456. * normvideo::
  1457. * nosound::
  1458. * ntohl::
  1459. * ntohs::
  1460. * open::
  1461. * _open::
  1462. * opendir::
  1463. * outb::
  1464. * outp::
  1465. * outportb::
  1466. * outportl::
  1467. * outportsb::
  1468. * outportsl::
  1469. * outportsw::
  1470. * outportw::
  1471. * outpw::
  1472. * pathconf::
  1473. * pause::
  1474. * pclose::
  1475. * perror::
  1476. * pipe::
  1477. * popen::
  1478. * pow::
  1479. * pow10::
  1480. * pow2::
  1481. * _preserve_fncase::
  1482. * printf::
  1483. * putc::
  1484. * putch::
  1485. * putchar::
  1486. * putenv::
  1487. * puts::
  1488. * puttext::
  1489. * putw::
  1490. * qsort::
  1491. * raise::
  1492. * rand::
  1493. * random::
  1494. * rawclock::
  1495. * read::
  1496. * _read::
  1497. * readdir::
  1498. * realloc::
  1499. * regcomp::
  1500. * regerror::
  1501. * regexec::
  1502. * regfree::
  1503. * remove::
  1504. * remque::
  1505. * _rename::
  1506. * rename::
  1507. * rewind::
  1508. * rewinddir::
  1509. * rindex::
  1510. * rmdir::
  1511. * sbrk::
  1512. * scanf::
  1513. * Screen Variables::
  1514. * ScreenClear::
  1515. * ScreenCols::
  1516. * ScreenGetChar::
  1517. * ScreenGetCursor::
  1518. * ScreenMode::
  1519. * ScreenPutChar::
  1520. * ScreenPutString::
  1521. * ScreenRetrieve::
  1522. * ScreenRows::
  1523. * ScreenSetCursor::
  1524. * ScreenUpdate::
  1525. * ScreenUpdateLine::
  1526. * ScreenVisualBell::
  1527. * searchpath::
  1528. * seekdir::
  1529. * select::
  1530. * _set_screen_lines::
  1531. * setbuf::
  1532. * setbuffer::
  1533. * setcbrk::
  1534. * _setcursortype::
  1535. * setdate::
  1536. * setdisk::
  1537. * setenv::
  1538. * setftime::
  1539. * setgrent::
  1540. * setitimer::
  1541. * setjmp::
  1542. * setlinebuf::
  1543. * setlocale::
  1544. * setmntent::
  1545. * setmode::
  1546. * setpgid::
  1547. * setpwent::
  1548. * setrlimit::
  1549. * settime::
  1550. * settimeofday::
  1551. * setvbuf::
  1552. * siglongjmp::
  1553. * signal::
  1554. * sigsetjmp::
  1555. * sin::
  1556. * sinh::
  1557. * sleep::
  1558. * sound::
  1559. * spawn*::
  1560. * sprintf::
  1561. * sqrt::
  1562. * srandom::
  1563. * sscanf::
  1564. * stat::
  1565. * statfs::
  1566. * _status87::
  1567. * _stklen::
  1568. * stpcpy::
  1569. * strcase::
  1570. * strcasecmp::
  1571. * strcat::
  1572. * strchr::
  1573. * strcmp::
  1574. * strcoll::
  1575. * strcpy::
  1576. * strcspn::
  1577. * strdup::
  1578. * strerror::
  1579. * strftime::
  1580. * stricmp::
  1581. * strlen::
  1582. * strlwr::
  1583. * strncase::
  1584. * strncasecmp::
  1585. * strncat::
  1586. * strncmp::
  1587. * strncpy::
  1588. * strnicmp::
  1589. * strpbrk::
  1590. * strrchr::
  1591. * strsep::
  1592. * strspn::
  1593. * strstr::
  1594. * strtod::
  1595. * strtok::
  1596. * strtol::
  1597. * _strtold::
  1598. * strtoll::
  1599. * strtoul::
  1600. * strtoull::
  1601. * strupr::
  1602. * strxfrm::
  1603. * swab::
  1604. * symlink::
  1605. * sync::
  1606. * sys_errlist::
  1607. * sys_nerr::
  1608. * sysconf::
  1609. * system::
  1610. * tan::
  1611. * tanh::
  1612. * tcdrain::
  1613. * tcflow::
  1614. * tcflush::
  1615. * tcgetattr::
  1616. * tcsendbreak::
  1617. * tcsetattr::
  1618. * tell::
  1619. * telldir::
  1620. * textattr::
  1621. * textbackground::
  1622. * textcolor::
  1623. * textmode::
  1624. * time::
  1625. * times::
  1626. * tmpfile::
  1627. * tmpnam::
  1628. * toascii::
  1629. * tolower::
  1630. * toupper::
  1631. * _truename::
  1632. * truncate::
  1633. * ttyname::
  1634. * uclock::
  1635. * umask::
  1636. * uname::
  1637. * ungetc::
  1638. * ungetch::
  1639. * unlink::
  1640. * unlock::
  1641. * _use_lfn::
  1642. * usleep::
  1643. * utime::
  1644. * utimes::
  1645. * vfprintf::
  1646. * vprintf::
  1647. * vsprintf::
  1648. * wait::
  1649. * waitpid::
  1650. * wcstombs::
  1651. * wctomb::
  1652. * wherex::
  1653. * wherey::
  1654. * window::
  1655. * write::
  1656. * _write::
  1657. * xfree::
  1658. * xmalloc::
  1659. * xrealloc::
  1660.  
  1661. 
  1662. File: libc.inf,  Node: abort,  Next: abs,  Up: Alphabetical List
  1663.  
  1664. abort
  1665. =====
  1666.  
  1667. Syntax
  1668. ------
  1669.  
  1670.      #include <stdlib.h>
  1671.      
  1672.      void abort(void);
  1673.  
  1674. Description
  1675. -----------
  1676.  
  1677. When you call `abort', the message "Abort!" is printed on stdout and
  1678. the program exits with an exit code of one.
  1679.  
  1680. Return Value
  1681. ------------
  1682.  
  1683. This function does not return.
  1684.  
  1685. Example
  1686. -------
  1687.  
  1688.      if ((q = malloc(100)) == NULL)
  1689.        abort();
  1690.  
  1691. 
  1692. File: libc.inf,  Node: abs,  Next: access,  Prev: abort,  Up: Alphabetical List
  1693.  
  1694. abs
  1695. ===
  1696.  
  1697. Syntax
  1698. ------
  1699.  
  1700.      #include <stdlib.h>
  1701.      
  1702.      int abs(int value);
  1703.  
  1704. Return Value
  1705. ------------
  1706.  
  1707. The absolute value of `value' is returned.
  1708.  
  1709. Example
  1710. -------
  1711.  
  1712.      int sq = 7;
  1713.      sq = sq * abs(sq) + 1;
  1714.  
  1715. 
  1716. File: libc.inf,  Node: access,  Next: acos,  Prev: abs,  Up: Alphabetical List
  1717.  
  1718. access
  1719. ======
  1720.  
  1721. Syntax
  1722. ------
  1723.  
  1724.      #include <unistd.h>
  1725.      
  1726.      int access(const char *filename, int flags);
  1727.  
  1728. Description
  1729. -----------
  1730.  
  1731. This function determines what kind of access modes a given file allows.
  1732. The parameter FLAGS is the logical `or' of one or more of the following
  1733. flags:
  1734.  
  1735. `R_OK'
  1736.      Request if the file is readable.  Since all files are readable
  1737.      under MS-DOS, this access mode always exists.
  1738.  
  1739. `W_OK'
  1740.      Request if the file is writable.
  1741.  
  1742. `X_OK'
  1743.      Request if the file is executable.
  1744.  
  1745. `F_OK'
  1746.      Request if the file exists.
  1747.  
  1748. `D_OK'
  1749.      Request if the file is really a directory.
  1750.  
  1751. Return Value
  1752. ------------
  1753.  
  1754. Zero if the requested access mode is allowed, nonzero if not.
  1755.  
  1756. Example
  1757. -------
  1758.  
  1759.      if (access("file.ext", W_OK))
  1760.        return ERROR_CANNOT_WRITE;
  1761.      open("file.ext", O_RDWR);
  1762.  
  1763. 
  1764. File: libc.inf,  Node: acos,  Next: acosh,  Prev: access,  Up: Alphabetical List
  1765.  
  1766. acos
  1767. ====
  1768.  
  1769. Syntax
  1770. ------
  1771.  
  1772.      #include <math.h>
  1773.      
  1774.      double acos(double x);
  1775.  
  1776. Return Value
  1777. ------------
  1778.  
  1779. The arc cosine of X.
  1780.  
  1781. 
  1782. File: libc.inf,  Node: acosh,  Next: addmntent,  Prev: acos,  Up: Alphabetical List
  1783.  
  1784. acosh
  1785. =====
  1786.  
  1787. Syntax
  1788. ------
  1789.  
  1790.      #include <math.h>
  1791.      
  1792.      double acosh(double x);
  1793.  
  1794. Return Value
  1795. ------------
  1796.  
  1797. The arc hyperbolic cosine of X.
  1798.  
  1799. 
  1800. File: libc.inf,  Node: addmntent,  Next: alarm,  Prev: acosh,  Up: Alphabetical List
  1801.  
  1802. addmntent
  1803. =========
  1804.  
  1805. Syntax
  1806. ------
  1807.  
  1808.      #include <mntent.h>
  1809.      
  1810.      int addmntent(FILE *filep, const struct mntent *mnt);
  1811.  
  1812. Description
  1813. -----------
  1814.  
  1815. This function is a no-op for MS-DOS, but is provided to assist in Unix
  1816. ports.  *Note getmntent::.
  1817.  
  1818. Return Value
  1819. ------------
  1820.  
  1821. This function always returns nonzero to signify an error.
  1822.  
  1823. 
  1824. File: libc.inf,  Node: alarm,  Next: alloca,  Prev: addmntent,  Up: Alphabetical List
  1825.  
  1826. alarm
  1827. =====
  1828.  
  1829. Syntax
  1830. ------
  1831.  
  1832.      #include <unistd.h>
  1833.      
  1834.      unsigned alarm(unsigned seconds);
  1835.  
  1836. Description
  1837. -----------
  1838.  
  1839. This function causes the signal SIGALRM to be raised in SECONDS seconds.
  1840. A value of zero for SECONDS cancels any pending alarm.  If an alarm has
  1841. previously been set, the new alarm delay will superceed the prior call.
  1842.  
  1843. Return Value
  1844. ------------
  1845.  
  1846. The number of seconds remaining on the timer (i.e. always SECONDS).
  1847.  
  1848. Example
  1849. -------
  1850.  
  1851.      signal(SIGALRM,my_alarm_routine);
  1852.      alarm(5);
  1853.  
  1854. 
  1855. File: libc.inf,  Node: alloca,  Next: asctime,  Prev: alarm,  Up: Alphabetical List
  1856.  
  1857. alloca
  1858. ======
  1859.  
  1860. Syntax
  1861. ------
  1862.  
  1863.      #include <stdlib.h>
  1864.      
  1865.      void *alloca(size_t _size)
  1866.  
  1867. Description
  1868. -----------
  1869.  
  1870. Allocate memory that will be automatically released when the current
  1871. procedure exits.  Note that, when compiling with gcc, alloca is a
  1872. built-in function and not a library call.
  1873.  
  1874. Return Value
  1875. ------------
  1876.  
  1877. A pointer to the memory, else NULL.
  1878.  
  1879. Example
  1880. -------
  1881.  
  1882.      q = alloca(strlen(x)+1);
  1883.      strcpy(q, x);
  1884.  
  1885. 
  1886. File: libc.inf,  Node: asctime,  Next: asin,  Prev: alloca,  Up: Alphabetical List
  1887.  
  1888. asctime
  1889. =======
  1890.  
  1891. Syntax
  1892. ------
  1893.  
  1894.      #include <time.h>
  1895.      
  1896.      char *asctime(const struct tm *tptr);
  1897.  
  1898. Description
  1899. -----------
  1900.  
  1901. This function returns an ASCII representation of the time represented by
  1902. TPTR.  The string returned is always 26 characters and has this format:
  1903.  
  1904.      Sun Jan 01 12:34:56 1993\n\0
  1905.  
  1906. The string pointed to is in a static buffer and will be overridden with
  1907. each call to asctime.  The data should be copied if it needs to be
  1908. preserved.
  1909.  
  1910. Return Value
  1911. ------------
  1912.  
  1913. A pointer to the string.
  1914.  
  1915. Example
  1916. -------
  1917.  
  1918.      time_t now;
  1919.      time(&now);
  1920.      printf("The current time is %s", asctime(localtime(&now)));
  1921.  
  1922. 
  1923. File: libc.inf,  Node: asin,  Next: asinh,  Prev: asctime,  Up: Alphabetical List
  1924.  
  1925. asin
  1926. ====
  1927.  
  1928. Syntax
  1929. ------
  1930.  
  1931.      #include <math.h>
  1932.      
  1933.      double asin(double x);
  1934.  
  1935. Return Value
  1936. ------------
  1937.  
  1938. The arc sine of X.
  1939.  
  1940. 
  1941. File: libc.inf,  Node: asinh,  Next: assert,  Prev: asin,  Up: Alphabetical List
  1942.  
  1943. asinh
  1944. =====
  1945.  
  1946. Syntax
  1947. ------
  1948.  
  1949.      #include <math.h>
  1950.      
  1951.      double asinh(double x);
  1952.  
  1953. Return Value
  1954. ------------
  1955.  
  1956. The arc hyperbolic sine of X.
  1957.  
  1958. 
  1959. File: libc.inf,  Node: assert,  Next: atan,  Prev: asinh,  Up: Alphabetical List
  1960.  
  1961. assert
  1962. ======
  1963.  
  1964. Syntax
  1965. ------
  1966.  
  1967.      #define NDEBUG
  1968.      #include <assert.h>
  1969.      
  1970.      assert(expression);
  1971.      assertval(expression);
  1972.  
  1973. Description
  1974. -----------
  1975.  
  1976. These macros are used to assist in debugging.  The source code includes
  1977. references to assert and assertval, passing them expressions that should
  1978. be true (or non-zero).  When the expression equals zero, a diagnostic
  1979. message is printed to stderr and the program aborts.
  1980.  
  1981. If you define the macro `NDEBUG' before including `assert.h', then the
  1982. macros expand to nothing to reduce code size after debugging is done.
  1983.  
  1984. Return Value
  1985. ------------
  1986.  
  1987. `assert' returns one if it passes, else it aborts.
  1988.  
  1989. `assertval' returns the value of the expression if nonzero, else it
  1990. aborts.
  1991.  
  1992. Example
  1993. -------
  1994.  
  1995.      int strdup(char *s)
  1996.      {
  1997.        assert(s != 0);
  1998.  
  1999. 
  2000. File: libc.inf,  Node: atan,  Next: atan2,  Prev: assert,  Up: Alphabetical List
  2001.  
  2002. atan
  2003. ====
  2004.  
  2005. Syntax
  2006. ------
  2007.  
  2008.      #include <math.h>
  2009.      
  2010.      double atan(double x);
  2011.  
  2012. Return Value
  2013. ------------
  2014.  
  2015. The arc tangent of X.
  2016.  
  2017. 
  2018. File: libc.inf,  Node: atan2,  Next: atanh,  Prev: atan,  Up: Alphabetical List
  2019.  
  2020. atan2
  2021. =====
  2022.  
  2023. Syntax
  2024. ------
  2025.  
  2026.      #include <math.h>
  2027.      
  2028.      double atan2(double y, double x);
  2029.  
  2030. Return Value
  2031. ------------
  2032.  
  2033. The arc tangent of Y/X, with appropriate return values for Y=0 or X=0.
  2034.  
  2035. 
  2036. File: libc.inf,  Node: atanh,  Next: atexit,  Prev: atan2,  Up: Alphabetical List
  2037.  
  2038. atanh
  2039. =====
  2040.  
  2041. Syntax
  2042. ------
  2043.  
  2044.      #include <math.h>
  2045.      
  2046.      double atanh(double x);
  2047.  
  2048. Return Value
  2049. ------------
  2050.  
  2051. The arc hyperbolic tangent of X.
  2052.  
  2053. 
  2054. File: libc.inf,  Node: atexit,  Next: atof,  Prev: atanh,  Up: Alphabetical List
  2055.  
  2056. atexit
  2057. ======
  2058.  
  2059. Syntax
  2060. ------
  2061.  
  2062.      #include <stdlib.h>
  2063.      
  2064.      int atexit(void (*func)(void));
  2065.  
  2066. Description
  2067. -----------
  2068.  
  2069. This function places the specified function FUNC on a list of functions
  2070. to be called when `exit' is called.  These functions are called as if a
  2071. last-in-first-out queue is used, that is, the last function registered
  2072. with `atexit' will be the first function called by `exit'.
  2073.  
  2074. At least 32 functions can be registered this way.
  2075.  
  2076. Return Value
  2077. ------------
  2078.  
  2079. Zero on success, non-zero on error.
  2080.  
  2081. Example
  2082. -------
  2083.  
  2084.      void exit_func()
  2085.      {
  2086.        remove("file.tmp");
  2087.      }
  2088.      
  2089.      ...
  2090.      atexit(exit_func);
  2091.      ...
  2092.  
  2093. 
  2094. File: libc.inf,  Node: atof,  Next: atoi,  Prev: atexit,  Up: Alphabetical List
  2095.  
  2096. atof
  2097. ====
  2098.  
  2099. Syntax
  2100. ------
  2101.  
  2102.      #include <stdlib.h>
  2103.      
  2104.      double atof(const char *string);
  2105.  
  2106. Description
  2107. -----------
  2108.  
  2109. Convert as much of the string as possible to an equivalent double
  2110. precision real number.
  2111.  
  2112. This function is almost like `strtod(string, NULL)' (*note strtod::.).
  2113.  
  2114. Return Value
  2115. ------------
  2116.  
  2117. The equivalent value, or zero if the string does not represent a number.
  2118.  
  2119. Example
  2120. -------
  2121.  
  2122.      main(int argc, char **argv)
  2123.      {
  2124.        double d = atof(argv[1]);
  2125.        ...
  2126.  
  2127. 
  2128. File: libc.inf,  Node: atoi,  Next: atol,  Prev: atof,  Up: Alphabetical List
  2129.  
  2130. atoi
  2131. ====
  2132.  
  2133. Syntax
  2134. ------
  2135.  
  2136.      #include <stdlib.h>
  2137.      
  2138.      int atoi(const char *string);
  2139.  
  2140. Description
  2141. -----------
  2142.  
  2143. Convert as much of the string as possible to an equivalent integer
  2144. value.
  2145.  
  2146. This function is almost like `(int)strtol(string, NULL, 10)' (*note
  2147. strtol::.).
  2148.  
  2149. Return Value
  2150. ------------
  2151.  
  2152. The equivalent value, or zero if the string does not represent a number.
  2153.  
  2154. Example
  2155. -------
  2156.  
  2157.      main(int argc, char **argv)
  2158.      {
  2159.        int i = atoi(argv[1]);
  2160.        ...
  2161.  
  2162. 
  2163. File: libc.inf,  Node: atol,  Next: _atold,  Prev: atoi,  Up: Alphabetical List
  2164.  
  2165. atol
  2166. ====
  2167.  
  2168. Syntax
  2169. ------
  2170.  
  2171.      #include <stdlib.h>
  2172.      
  2173.      long atol(const char *string);
  2174.  
  2175. Description
  2176. -----------
  2177.  
  2178. Convert as much of the string as possible to an equivalent long integer
  2179. value.
  2180.  
  2181. This function is almost like `strtol(string, NULL, 10)' (*note
  2182. strtol::.).
  2183.  
  2184. Return Value
  2185. ------------
  2186.  
  2187. The equivalent value, or zero if the string does not represent a number.
  2188.  
  2189. Example
  2190. -------
  2191.  
  2192.      main(int argc, char **argv)
  2193.      {
  2194.        long l = atol(argv[1]);
  2195.        ...
  2196.  
  2197. 
  2198. File: libc.inf,  Node: _atold,  Next: bcmp,  Prev: atol,  Up: Alphabetical List
  2199.  
  2200. _atold
  2201. ======
  2202.  
  2203. Syntax
  2204. ------
  2205.  
  2206.      #include <stdlib.h>
  2207.      
  2208.      long double _atold(const char *string);
  2209.  
  2210. Description
  2211. -----------
  2212.  
  2213. Convert as much of the string as possible to an equivalent long double
  2214. precision real number.
  2215.  
  2216. This function is almost like `_strtold(string, NULL)' (*note
  2217. _strtold::.).
  2218.  
  2219. Return Value
  2220. ------------
  2221.  
  2222. The equivalent value, or zero if the string does not represent a number.
  2223.  
  2224. Example
  2225. -------
  2226.  
  2227.      main(int argc, char **argv)
  2228.      {
  2229.        long double d = _atold(argv[1]);
  2230.        ...
  2231.  
  2232. 
  2233. File: libc.inf,  Node: bcmp,  Next: bcopy,  Prev: _atold,  Up: Alphabetical List
  2234.  
  2235. bcmp
  2236. ====
  2237.  
  2238. Syntax
  2239. ------
  2240.  
  2241.      #include <string.h>
  2242.      
  2243.      int bcmp(const void *ptr1, const void *ptr2, int length);
  2244.  
  2245. Description
  2246. -----------
  2247.  
  2248. Compare memory pointed to by PTR1 and PTR2 for at most LENGTH bytes.
  2249.  
  2250. Return Value
  2251. ------------
  2252.  
  2253. The number of bytes remaining when the first mismatch occurred, or zero
  2254. if all bytes were equal.
  2255.  
  2256. Example
  2257. -------
  2258.  
  2259.      void f(char *s1, char *s2)
  2260.      {
  2261.        int l = bcmp(s1, s2, strlen(s1));
  2262.        printf("Difference: %s, %s\n", s1+strlen(s1)-l, s2+strlen(s1)-l);
  2263.      }
  2264.  
  2265. 
  2266. File: libc.inf,  Node: bcopy,  Next: bdos,  Prev: bcmp,  Up: Alphabetical List
  2267.  
  2268. bcopy
  2269. =====
  2270.  
  2271. Syntax
  2272. ------
  2273.  
  2274.      #include <string.h>
  2275.      
  2276.      void bcopy(const void *source, void *dest, int length);
  2277.  
  2278. Description
  2279. -----------
  2280.  
  2281. Copy LENGTH bytes from SOURCE to DEST.  Overlapping regions are handled
  2282. properly, although this behavior is not portable.
  2283.  
  2284. Return Value
  2285. ------------
  2286.  
  2287. No value is returned.
  2288.  
  2289. Example
  2290. -------
  2291.  
  2292.      struct s a, b;
  2293.      bcopy(a, b, sizeof(struct s));
  2294.  
  2295. 
  2296. File: libc.inf,  Node: bdos,  Next: bdosptr,  Prev: bcopy,  Up: Alphabetical List
  2297.  
  2298. bdos
  2299. ====
  2300.  
  2301. Syntax
  2302. ------
  2303.  
  2304.      #include <dos.h>
  2305.      
  2306.      int bdos(int func, unsigned dx, unsigned al);
  2307.  
  2308. Description
  2309. -----------
  2310.  
  2311. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2312. the subfunction and (the lower 16 bit of) DX in the `DX' register.
  2313. This function will only work for a subset of DOS functions which
  2314. require no arguments at all, or take non-pointer arguments in the `AL'
  2315. and `DX' registers only.  For functions which require a pointer in the
  2316. `DX' register, use `bdosptr' (*note bdosptr::.).
  2317.  
  2318. Return Value
  2319. ------------
  2320.  
  2321. Whatever the called function returns in the AX register.
  2322.  
  2323. Example
  2324. -------
  2325.  
  2326.      /* read a character */
  2327.      int ch = bdos(1, 0, 0) & 0xff;
  2328.  
  2329. 
  2330. File: libc.inf,  Node: bdosptr,  Next: _bios_disk,  Prev: bdos,  Up: Alphabetical List
  2331.  
  2332. bdosptr
  2333. =======
  2334.  
  2335. Syntax
  2336. ------
  2337.  
  2338.      #include <dos.h>
  2339.      
  2340.      int bdosptr(int func, void *ptr, unsigned al);
  2341.  
  2342. Description
  2343. -----------
  2344.  
  2345. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2346. the subfunction and a pointer to a copy of the buffer contents whose
  2347. address is in PTR through the `DX' register.  This function will only
  2348. work for a subset of DOS which require an argument in the `AL' register
  2349. and a pointer in `DX' register.  For functions which require
  2350. non-pointer arguments in the `DX' register, use `bdos' (*note bdos::.).
  2351. To make the contents of PTR available to DOS, `bdosptr' copies it to
  2352. the transfer buffer located in the low (below 1 Meg mark) memory.
  2353.  
  2354. Currently, some of the functions which take a pointer to a buffer in
  2355. `DX' are *NOT* supported (notably, most of the FCB-based functions).
  2356. *Note int86:: for the list of supported functions.
  2357.  
  2358. Return Value
  2359. ------------
  2360.  
  2361. Whatever the called function returns in the AX register.
  2362.  
  2363. Example
  2364. -------
  2365.  
  2366.      /* print a string */
  2367.      bdos(9, "Hello, there$", 0);
  2368.  
  2369. 
  2370. File: libc.inf,  Node: _bios_disk,  Next: _bios_equiplist,  Prev: bdosptr,  Up: Alphabetical List
  2371.  
  2372. _bios_disk
  2373. ==========
  2374.  
  2375. Syntax
  2376. ------
  2377.  
  2378.      #include <bios.h>
  2379.      
  2380.      unsigned _bios_disk(unsigned cmd, struct diskinfo_t *di)
  2381.  
  2382. Description
  2383. -----------
  2384.  
  2385. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2386. The parameter CMD select the corresponding disk service and the
  2387. structure DI holds the disk parameters.
  2388.  
  2389.      struct diskinfo_t {
  2390.        unsigned drive;       /* Drive number. */
  2391.        unsigned head;        /* Head number. */
  2392.        unsigned track;       /* Track number. */
  2393.        unsigned sector;      /* Sector number. */
  2394.        unsigned nsectors;    /* Number of sectors to read/write/verify. */
  2395.        void    *buffer;      /* Buffer for reading/writing/verifying. */
  2396.      }
  2397.  
  2398. The following services are available based on value of CMD:
  2399.  
  2400. `_DISK_RESET'
  2401.      Forces the disk controller to do a hard reset, preparing for
  2402.      floppy-disk I/O. This is useful after an error occurs in another
  2403.      operation, such as a read. If this service is specified, the DI
  2404.      argument is ignored. Status is returned in the 8 high-order bits
  2405.      (AH) of the return value. If there is an error, the high-order
  2406.      byte will contain a set of status flags, as defined below under
  2407.      Return Value.
  2408.  
  2409. `_DISK_STATUS'
  2410.      Obtains the status of the last disk operation. If this service is
  2411.      specified, the <diskinfo> argument is ignored. Status is returned
  2412.      in the 8 low-order bits (AL) of the return value. If there is an
  2413.      error, the low-order byte (AL) will contain a set of status flags,
  2414.      as defined below under Return Value.
  2415.  
  2416. `_DISK_READ'
  2417.      Reads one or more disk sectors into memory. This service uses all
  2418.      fields of the structure pointed to by DISKINFO. If no error
  2419.      occurs, the function returns 0 in the high-order byte and the
  2420.      number of sectors read in the low-order byte. If there is an
  2421.      error, the high-order byte (AH) will contain a set of status
  2422.      flags, as defined below under Return Value.
  2423.  
  2424. `_DISK_WRITE'
  2425.      Writes data from memory to one or more disk sectors. This service
  2426.      uses all fields of the structure pointed to by <diskinfo>. If no
  2427.      error occurs, the function returns 0 in the high-order byte (AH)
  2428.      and the number of sectors written in the low-order byte (AL). If
  2429.      there is an error, the high-order byte will contain a set of
  2430.      status flags, as defined below under Return Value.
  2431.  
  2432. `_DISK_FORMAT'
  2433.      Formats the track specified by DISKINFO. The HEAD and TRACK fields
  2434.      indicate the track to format. Only one track can be formatted in a
  2435.      single call. The BUFFER field points to a set of sector markers.
  2436.      The format of the markers depends on the type of disk drive (see a
  2437.      technical reference to the PC BIOS to determine the marker
  2438.      format). The high-order byte (AH) of the return value contains the
  2439.      status of the call; 0 equals success. If there is an error, the
  2440.      high-order byte will contain a set of status flags, as defined
  2441.      below under Return Value.
  2442.  
  2443. `_DISK_VERIFY'
  2444.      Checks the disk to be sure the specified sectors exist and can be
  2445.      read.  It also runs a CRC (cyclic redundancy check) test. This
  2446.      service uses all fields (except BUFFER) of the structure pointed
  2447.      to by DISKINFO.  If no error occurs, the function returns 0 in the
  2448.      high-order byte (AH) and the number of sectors compared in the
  2449.      low-order byte (AL), as defined below under Return Value.
  2450.  
  2451. Return Value
  2452. ------------
  2453.  
  2454. Return value of AX register. The meaning of high-order byte (AH):
  2455.      0x00  No error
  2456.      0x01  Invalid request or a bad command
  2457.      0x02  Address mark not found
  2458.      0x03  Disk write protected
  2459.      0x04  Sector not found
  2460.      0x05  Reset failed
  2461.      0x06  Floppy disk removed
  2462.      0x07  Drive parameter activity failed
  2463.      0x08  Direct Memory Access (DMA) overrun
  2464.      0x09  DMA crossed 64K boundary
  2465.      0x0A  Bad sector flag detected
  2466.      0x0B  Bad track flag detected
  2467.      0x0C  Media type not found
  2468.      0x0D  Invalid number of sectors on format
  2469.      0x0E  Control data access mark detected
  2470.      0x0F  DMA arbitration level out of range
  2471.      0x10  Data read (CRC or ECC) error
  2472.      0x11  Corrected data read (ECC) error
  2473.      0x20  Controller failure
  2474.      0x40  Seek error
  2475.      0x80  Disk timed out or failed to respond
  2476.      0xAA  Drive not ready
  2477.      0xBB  Undefined error
  2478.      0xCC  Write fault on drive
  2479.      0xE0  Status error
  2480.      0xFF  Sense operation failed
  2481.  
  2482. Example
  2483. -------
  2484.  
  2485.      char record_buffer[512];
  2486.      struct diskinfo_t di;
  2487.      
  2488.      di.drive    = 0x80;
  2489.      di.head     = 0;
  2490.      di.track    = 0;
  2491.      di.sector   = 0;
  2492.      di.nsectors = 1;
  2493.      di.buffer   = &record_buffer;
  2494.      if ( _bios_disk(_DISK_READ, &di) )
  2495.        puts("Disk error.");
  2496.  
  2497. 
  2498. File: libc.inf,  Node: _bios_equiplist,  Next: _bios_keybrd,  Prev: _bios_disk,  Up: Alphabetical List
  2499.  
  2500. _bios_equiplist
  2501. ===============
  2502.  
  2503. Syntax
  2504. ------
  2505.  
  2506.      #include <bios.h>
  2507.      
  2508.      unsigned _bios_equiplist(void)
  2509.  
  2510. Description
  2511. -----------
  2512.  
  2513. This function returns the equipment word from BIOS request 0x11.  The
  2514. bits correspond to the following values:
  2515.  
  2516.      Bits  Meaning
  2517.      0     True (1) if disk drive(s) installed
  2518.      1     True (1) if math coprocessor installed
  2519.      2-3   System RAM in 16K blocks (16-64K)
  2520.      4-5   Initial video mode:
  2521.                 00 = Reserved
  2522.                 01 = 40 x 25 color
  2523.                 10 = 80 x 25 color
  2524.                 11 = 80 x 25 monochrome
  2525.      6-7   Number of floppy-disk drives installed
  2526.            (00 = 1, 01 = 2, etc.)
  2527.      8     False (0) if and only if a Direct Memory Access (DMA)
  2528.            chip is installed
  2529.      9-11  Number of RS232 serial ports installed
  2530.      12    True (1) if and only if a game adapter is installed
  2531.      13    True (1) if and only if an internal modem is installed
  2532.      14-15 Number of printers installed
  2533.  
  2534. Return Value
  2535. ------------
  2536.  
  2537. The equipment word.
  2538.  
  2539. Example
  2540. -------
  2541.  
  2542.      if ( _bios_equip() & 0xc000 )
  2543.        do_printing();
  2544.  
  2545. 
  2546. File: libc.inf,  Node: _bios_keybrd,  Next: _bios_memsize,  Prev: _bios_equiplist,  Up: Alphabetical List
  2547.  
  2548. _bios_keybrd
  2549. ============
  2550.  
  2551. Syntax
  2552. ------
  2553.  
  2554.      #include <bios.h>
  2555.      
  2556.      unsigned _bios_keybrd(unsigned cmd);
  2557.  
  2558. Description
  2559. -----------
  2560.  
  2561. The _bios_keybrd routine uses INT 0x16 to access the keyboard services.
  2562. The CMD argument can be any of the following manifest constants:
  2563.  
  2564. `_KEYBRD_READ'
  2565.      Read the next key pressed
  2566.  
  2567. `_NKEYBRD_READ'
  2568.      Read the next extended key pressed
  2569.  
  2570. `_KEYBRD_READY'
  2571.      Check if the next key in the keyboard buffer
  2572.  
  2573. `_NKEYBRD_READY'
  2574.      Check if the next extended key in the keyboard buffer
  2575.  
  2576. `_KEYBRD_SHIFTSTATUS'
  2577.      Read keyboard shift state (0x0040:0x0017 byte):
  2578.  
  2579.           7654 3210  Meaning
  2580.           ---- ---X  Right SHIFT is pressed
  2581.           ---- --X-  Left SHIFT is pressed
  2582.           ---- -X--  CTRL is pressed
  2583.           ---- X---  ALT is pressed
  2584.           ---X ----  Scroll Lock locked
  2585.           --X- ----  Num Lock locked
  2586.           -X-- ----  Caps Lock locked
  2587.           X--- ----  Insert locked
  2588.  
  2589. `_NKEYBRD_SHIFTSTATUS'
  2590.      Read keyboard shift and extended shift state (0x0040:0x0017 word):
  2591.  
  2592.           FEDC BA98  7654 3210  Meaning
  2593.           ---- ----  ---- ---X  Right SHIFT is pressed
  2594.           ---- ----  ---- --X-  Left SHIFT is pressed
  2595.           ---- ----  ---- -X--  CTRL is pressed
  2596.           ---- ----  ---- X---  ALT is pressed
  2597.           ---- ----  ---X ----  Scroll Lock locked
  2598.           ---- ----  --X- ----  Num Lock locked
  2599.           ---- ----  -X-- ----  Caps Lock locked
  2600.           ---- ----  X--- ----  Insert locked
  2601.           
  2602.           ---- ---X  ---- ----  Left CTRL is pressed
  2603.           ---- --X-  ---- ----  Left ALT is pressed
  2604.           ---- -X--  ---- ----  Right CTRL is pressed
  2605.           ---- X---  ---- ----  Right ALT is pressed
  2606.           ---X ----  ---- ----  Scroll Lock is pressed
  2607.           --X- ----  ---- ----  Num Lock is pressed
  2608.           -X-- ----  ---- ----  Caps Lock is pressed
  2609.           X--- ----  ---- ----  SysReq is pressed
  2610.  
  2611. Return Value
  2612.  
  2613. With the ???_READ and ???_SHIFTSTATUS arguments, the _bios_keybrd
  2614. function returns the contents of the AX register after the BIOS call.
  2615.  
  2616. With the ???_READY argument, _bios_keybrd returns 0 if there is no key.
  2617. If there is a key, _bios_keybrd returns the key waiting to be read
  2618. (that is, the same value as _KEYBRD_READ).
  2619.  
  2620. With the ???_READ and ???_READY arguments, the _bios_keybrd function
  2621. returns -1 if CTRL+BREAK has been pressed and is the next keystroke to
  2622. be read.
  2623.  
  2624. Example
  2625. -------
  2626.  
  2627.      while( !_bios_keybrd(_KEYBRD_READY) )
  2628.        try_to_do_something();
  2629.  
  2630. 
  2631. File: libc.inf,  Node: _bios_memsize,  Next: _bios_printer,  Prev: _bios_keybrd,  Up: Alphabetical List
  2632.  
  2633. _bios_memsize
  2634. =============
  2635.  
  2636. Syntax
  2637. ------
  2638.  
  2639.      #include <bios.h>
  2640.      
  2641.      unsigned _bios_memsize(void);
  2642.  
  2643. Description
  2644. -----------
  2645.  
  2646. This function returns the amount of system memory in 1K blocks (up to
  2647. 640K).
  2648.  
  2649. Return Value
  2650. ------------
  2651.  
  2652. Size of memory (in K).
  2653.  
  2654. Example
  2655. -------
  2656.  
  2657.      printf("This system has %d bytes of memory\n", _bios_memsize() * 1024);
  2658.  
  2659. 
  2660. File: libc.inf,  Node: _bios_printer,  Next: _bios_serialcom,  Prev: _bios_memsize,  Up: Alphabetical List
  2661.  
  2662. _bios_printer
  2663. =============
  2664.  
  2665. Syntax
  2666. ------
  2667.  
  2668.      #include <bios.h>
  2669.      
  2670.      unsigned _bios_printer(unsigned cmd, unsigned printer, unsigned data);
  2671.  
  2672. Description
  2673. -----------
  2674.  
  2675. The _bios_printer routine uses INT 0x17 to perform printer output
  2676. services for parallel printers. The PRINTER argument specifies the
  2677. affected printer, where 0 is LPT1, 1 is LPT2, and so on.  The CMD
  2678. argument can be any of the following manifest constants:
  2679.  
  2680. `_PRINTER_INIT'
  2681. `Reset and initialize the specified printer port'
  2682. `_PRINTER_STATUS'
  2683.      Return the status of the specified printer port
  2684.  
  2685. `_PRINTER_WRITE'
  2686.      Print the DATA argument to the specified printer port
  2687.  
  2688. Return Value
  2689. ------------
  2690.  
  2691. The _bios_printer function returns the value in the AX register after
  2692. the BIOS interrupt. The high-order byte (AH) of the return value
  2693. indicates the printer status after the operation, as defined below:
  2694.  
  2695.      Bit     Meaning if True
  2696.      
  2697.      0       Printer timed out
  2698.      1       Not used
  2699.      2       Not used
  2700.      3       I/O error
  2701.      4       Printer selected
  2702.      5       Out of paper
  2703.      6       Acknowledge
  2704.      7       Printer not busy
  2705.  
  2706. Example
  2707. -------
  2708.  
  2709.      while (*c)
  2710.        _bios_printer(_PRINTER_WRITE, *c++, 0);
  2711.  
  2712. 
  2713. File: libc.inf,  Node: _bios_serialcom,  Next: _bios_timeofday,  Prev: _bios_printer,  Up: Alphabetical List
  2714.  
  2715. _bios_serialcom
  2716. ===============
  2717.  
  2718. Syntax
  2719. ------
  2720.  
  2721.      #include <bios.h>
  2722.      
  2723.      unsigned _bios_serialcom(unsigned cmd, unsingned serialport, unsigned data);
  2724.  
  2725. Description
  2726. -----------
  2727.  
  2728. The _bios_serialcom routine uses INT 0x14 to provide serial
  2729. communications services. The SERIALPORT argument is set to 0 for COM1,
  2730. to 1 for COM2, and so on. The CMD argument can be set to one of the
  2731. following manifest constants:
  2732.  
  2733. `_COM_INIT'
  2734.      Initialize com port (DATA is the settings)
  2735.  
  2736. `_COM_RECEIVE'
  2737.      Read a byte from port
  2738.  
  2739. `_COM_SEND'
  2740.      Write a byte to port
  2741.  
  2742. `_COM_STATUS'
  2743.      Get the port status
  2744.  
  2745. The DATA argument is ignored if CMD is set to _COM_RECEIVE or
  2746. _COM_STATUS. The DATA argument for _COM_INIT is created by combining
  2747. one or more of the following constants (with the OR operator):
  2748.  
  2749.      _COM_CHR7         7 bits/character
  2750.      _COM_CHR8         8 bits/character
  2751.      _COM_STOP1        1 stop bit
  2752.      _COM_STOP2        2 stop bits
  2753.      _COM_NOPARITY     no parity
  2754.      _COM_EVENPARITY   even parity
  2755.      _COM_ODDPARITY    odd parity
  2756.      _COM_110          110 baud
  2757.      _COM_150          150 baud
  2758.      _COM_300          300 baud
  2759.      _COM_600          600 baud
  2760.      _COM_1200         1200 baud
  2761.      _COM_2400         2400 baud
  2762.      _COM_4800         4800 baud
  2763.      _COM_9600         9600 baud
  2764.  
  2765. The default value of DATA is 1 stop bit, no parity, and 110 baud.
  2766.  
  2767. Return Value
  2768. ------------
  2769.  
  2770. The function returns a 16-bit integer whose high-order byte contains
  2771. status bits. The meaning of the low-order byte varies, depending on the
  2772. CMD value. The high-order bits are as follows:
  2773.  
  2774.      Bit     Meaning if Set
  2775.      
  2776.      15      Timed out
  2777.      14      Transmission-shift register empty
  2778.      13      Transmission-hold register empty
  2779.      12      Break detected
  2780.      11      Framing error
  2781.      10      Parity error
  2782.       9      Overrun error
  2783.       8      Data ready
  2784.  
  2785. When service is _COM_SEND, bit 15 is set if data cannot be sent.
  2786.  
  2787. When service is _COM_RECEIVE, the byte read is returned in the
  2788. low-order bits if the call is successful. If an error occurs, any of
  2789. the bits 9, 10, 11, or 15 is set.
  2790.  
  2791. When service is _COM_INIT or _COM_STATUS, the low-order bits are
  2792. defined as follows:
  2793.  
  2794.      Bit     Meaning if Set
  2795.      
  2796.      7       Receive-line signal detected
  2797.      6       Ring indicator
  2798.      5       Data-set-ready
  2799.      4       Clear-to-send
  2800.      3       Change in receive-line signal detected
  2801.      2       Trailing-edge ring indicator
  2802.      1       Change in data-set-ready status
  2803.      0       Change in clear-to-send status
  2804.  
  2805. Example
  2806. -------
  2807.  
  2808.      /* 9600 baud, no parity, one stop, 8 bits */
  2809.      _bios_serialcom(_COM_INIT, 0, _COM_9600|_COM_NOPARITY|_COM_STOP1|_COM_CHR8);
  2810.      for(i=0; buf[i]; i++)
  2811.        _bios_serialcom(_COM_SEND, 0, buf[i]);
  2812.  
  2813. 
  2814. File: libc.inf,  Node: _bios_timeofday,  Next: bioscom,  Prev: _bios_serialcom,  Up: Alphabetical List
  2815.  
  2816. _bios_timeofday
  2817. ===============
  2818.  
  2819. Syntax
  2820. ------
  2821.  
  2822.      #include <bios.h>
  2823.      
  2824.      unsigned _bios_timeofday(unsigned cmd, unsigned long *timeval);
  2825.  
  2826. Description
  2827. -----------
  2828.  
  2829. The _bios_timeofday routine uses INT 0x1A to get or set the clock count
  2830. (which is the number of 18.2 Hz ticks since midnight). The CMD argument
  2831. can be either the _TIME_GETCLOCK or _TIME_SETCLOCK manifest constant.
  2832.  
  2833. Return Value
  2834. ------------
  2835.  
  2836. If the argument is _TIME_GETCLOCK, the routine returns a nonzero value
  2837. if midnight was passed since last read, or zero if midnight was not
  2838. passed. If the argument is _TIME_SETCLOCK, the return value is
  2839. undefined.
  2840.  
  2841. Example
  2842. -------
  2843.  
  2844.      unsigned hour, min, sec, hsec;
  2845.      unsigned long ticks;
  2846.      ...
  2847.      ticks = (unsigned long)(hour * 65543.33) + (min * 1092.38) +
  2848.              (sec * 18.21) + (hsec * 0.182);
  2849.      _bios_timeofday(_TIME_SETCLOCK, &ticks);
  2850.  
  2851. 
  2852. File: libc.inf,  Node: bioscom,  Next: biosdisk,  Prev: _bios_timeofday,  Up: Alphabetical List
  2853.  
  2854. bioscom
  2855. =======
  2856.  
  2857. Syntax
  2858. ------
  2859.  
  2860.      #include <bios.h>
  2861.      
  2862.      int bioscom(int cmd, char data, int port);
  2863.  
  2864. Description
  2865. -----------
  2866.  
  2867. This function accesses the BIOS interrupt 0x14 function, serial
  2868. communication services.  The valid values of cmd are:
  2869.  
  2870. 0 - initialize com port (DATA is the settings)
  2871. 1 - write byte to port
  2872. 2 - read byte from port
  2873. 3 - get port status
  2874.  
  2875. For initialization, the byte is made up of the following bits:
  2876.  
  2877.      0000 0000
  2878.      7654 3210  Meaning
  2879.      
  2880.      ---- --10  7 bits/character
  2881.      ---- --11  8 bits/character
  2882.      ---- -0--  1 stop bit
  2883.      ---- -1--  2 stop bits
  2884.      ---X 0---  no parity
  2885.      ---0 1---  odd parity
  2886.      ---1 1---  even parity
  2887.      000- ----  110 baud
  2888.      001- ----  150 baud
  2889.      010- ----  300 baud
  2890.      011- ----  600 baud
  2891.      100- ----  1200 baud
  2892.      101- ----  2400 baud
  2893.      110- ----  4800 baud
  2894.      111- ----  9600 baud
  2895.  
  2896. Return Value
  2897. ------------
  2898.  
  2899. The return value is a sequence of bits that indicate the port status
  2900. and, for cmd=0 and 3, the modem status.  For read/write operations, the
  2901. lower eight bits are the character read.
  2902.  
  2903.      1111 1100 0000 0000
  2904.      5432 1098 7654 3210  Meaning
  2905.      
  2906.      ---- ---- ---- ---1  CTS change
  2907.      ---- ---- ---- --1-  DSR change
  2908.      ---- ---- ---- -1--  ring change
  2909.      ---- ---- ---- 1---  carrier detect change
  2910.      ---- ---- ---1 ----  CTS present
  2911.      ---- ---- --1- ----  DSR present
  2912.      ---- ---- -1-- ----  ring present
  2913.      ---- ---- 1--- ----  carrier detect
  2914.      ---- ---1 ---- ----  data ready
  2915.      ---- --1- ---- ----  overrun error
  2916.      ---- -1-- ---- ----  parity error
  2917.      ---- 1--- ---- ----  framing error
  2918.      ---1 ---- ---- ----  break detected
  2919.      --1- ---- ---- ----  transmit holding register empty
  2920.      -1-- ---- ---- ----  transmit shift register empty
  2921.      1--- ---- ---- ----  time out (=1 if error present for cmd=1,2)
  2922.  
  2923. Example
  2924. -------
  2925.  
  2926.      bioscom(0, 0xe3); /* 9600 baud, no parity, one stop, 8 bits */
  2927.      for (i=0; buf[i]; i++)
  2928.        bioscom(1, buf[i]);
  2929.  
  2930. 
  2931. File: libc.inf,  Node: biosdisk,  Next: biosequip,  Prev: bioscom,  Up: Alphabetical List
  2932.  
  2933. biosdisk
  2934. ========
  2935.  
  2936. Syntax
  2937. ------
  2938.  
  2939.      #include <bios.h>
  2940.      
  2941.      int biosdisk(int cmd, int drive, int head, int track,
  2942.               int sector, int nsects, void *buffer);
  2943.  
  2944. Description
  2945. -----------
  2946.  
  2947. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2948. Please refer to a BIOS reference manual for detailed information about
  2949. the parameters of this call.  All known calls are supported.  A sector
  2950. size of 512 bytes is assumed.
  2951.  
  2952. 0 - reset disk subsystem
  2953. 1 - get disk subsystem status
  2954. 2 - read one or more sectors
  2955. 3 - write one or more sectors
  2956. 5 - format a track
  2957. 6 - format back track
  2958. 7 - format drive
  2959. 8 - get drive parameters
  2960. 9 - initialize drive parameters
  2961. 10 - read long sectors
  2962. 11 - write long sectors
  2963. 12 - seek to cylinder
  2964. 13 - alternate fixed disk reset
  2965. 14 - read test buffer
  2966. 15 - write test buffer
  2967. 16 - test for drive ready
  2968. 17 - recalibrate drive
  2969. 18 - controller RAM diagnostic
  2970. 19 - controller drive diagnostic
  2971. 20 - controller internal diagnostic
  2972. 15 - read fixed disk type
  2973. 22 - read disk change line status
  2974. 23 - set DASD type (pass dasd in NSECTS)
  2975. 24 - set media type for format
  2976.  
  2977. The first request with more sectors than will fit in the transfer
  2978. buffer will cause a DOS buffer to be allocated.  This buffer is
  2979. automatically freed when your application exits.  Since this buffer is
  2980. big enough to hold 18 sectors, requests for more sectors than that will
  2981. fail.
  2982.  
  2983. Request eight returns values in buffer as follows:
  2984.  
  2985. byte 0 = sectors per track (bits 0..5) and top two bits of cylinder (in bits 6..7)
  2986. byte 1 = cyliders (bits 0..7)
  2987. byte 2 = number of drives
  2988. byte 3 = number of heads
  2989.  
  2990. Return Value
  2991. ------------
  2992.  
  2993. The value of AH returned by the BIOS.
  2994.  
  2995. Example
  2996. -------
  2997.  
  2998.      char buffer[512];
  2999.      if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
  3000.        error("disk");
  3001.  
  3002. 
  3003. File: libc.inf,  Node: biosequip,  Next: bioskey,  Prev: biosdisk,  Up: Alphabetical List
  3004.  
  3005. biosequip
  3006. =========
  3007.  
  3008. Syntax
  3009. ------
  3010.  
  3011.      #include <bios.h>
  3012.      
  3013.      int biosequip(void);
  3014.  
  3015. Description
  3016. -----------
  3017.  
  3018. This function returns the equipment word from BIOS request 0x11.  The
  3019. bits correspond to the following values:
  3020.  
  3021.      1111 1100 0000 0000
  3022.      5432 1098 7654 3210  Meaning
  3023.      
  3024.      ---- ---- ---- ---X  1 = disk drive(s) installed
  3025.      ---- ---- ---- --X-  1 = math coprocessor installed
  3026.      ---- ---- ---- XX--  System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
  3027.      ---- ---- ---- -X--  1 = pointing device installed (PS/2)
  3028.      ---- ---- ---- X---  not used on PS/2
  3029.      ---- ---- --XX ----  initial video mode: 01=CO40 10=CO80 11=MONO
  3030.      ---- ---- XX-- ----  disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
  3031.      ---- ---X ---- ----  1 = no DMA available
  3032.      ---- XXX- ---- ----  number of serial ports installed (000=0 001=1 etc)
  3033.      ---X ---- ---- ----  1 = game port adapter installed
  3034.      --X- ---- ---- ----  1 = internal modem installed (PS/2)
  3035.      --X- ---- ---- ----  1 = serial printer attached (non PS/2)
  3036.      XX-- ---- ---- ----  number of printers installed (00=0 01=1 10=2 11=3)
  3037.  
  3038. Return Value
  3039. ------------
  3040.  
  3041. The equipment word.
  3042.  
  3043. Example
  3044. -------
  3045.  
  3046.      if (biosequip() & 0xc000)
  3047.        do_printing();
  3048.  
  3049. 
  3050. File: libc.inf,  Node: bioskey,  Next: biosmemory,  Prev: biosequip,  Up: Alphabetical List
  3051.  
  3052. bioskey
  3053. =======
  3054.  
  3055. Syntax
  3056. ------
  3057.  
  3058.      #include <bios.h>
  3059.      
  3060.      int bioskey(int command)
  3061.  
  3062. Description
  3063. -----------
  3064.  
  3065. COMMAND = 0
  3066.      Returns the next key pressed
  3067.  
  3068. COMMAND = 1
  3069.      Checks the keyboard, returns zero if no key pressed, else the key.
  3070.      Does not dequeue the key.
  3071.  
  3072. COMMAND = 2
  3073.      Returns the shift state:
  3074.  
  3075.           7654 3210  Meaning
  3076.           
  3077.           ---- ---X  Right shift key down
  3078.           ---- --X-  Left shift key down
  3079.           ---- -X--  Ctrl key down
  3080.           ---- X---  Alt key down
  3081.           ---X ----  Scroll lock on
  3082.           --X- ----  Num lock on
  3083.           -X-- ----  Caps lock on
  3084.           X--- ----  Insert on
  3085.  
  3086. Return Value
  3087. ------------
  3088.  
  3089. Depends on COMMAND.
  3090.  
  3091. Example
  3092. -------
  3093.  
  3094.      while (!bioskey(1))
  3095.        do_stuff();
  3096.  
  3097. 
  3098. File: libc.inf,  Node: biosmemory,  Next: biosprint,  Prev: bioskey,  Up: Alphabetical List
  3099.  
  3100. biosmemory
  3101. ==========
  3102.  
  3103. Syntax
  3104. ------
  3105.  
  3106.      #include <bios.h>
  3107.      
  3108.      unsigned biosmemory(void);
  3109.  
  3110. Description
  3111. -----------
  3112.  
  3113. This function returns the amount of system memory in 1k blocks.
  3114.  
  3115. Note that this function will return 65535 if the system has more than
  3116. 64M of memory.  This is a limitation of the BIOS.
  3117.  
  3118. Return Value
  3119. ------------
  3120.  
  3121. Bytes of memory / 1024.
  3122.  
  3123. Example
  3124. -------
  3125.  
  3126.      printf("This system has %d bytes of memory\n", biosmemory()*1024);
  3127.  
  3128. 
  3129. File: libc.inf,  Node: biosprint,  Next: biostime,  Prev: biosmemory,  Up: Alphabetical List
  3130.  
  3131. biosprint
  3132. =========
  3133.  
  3134. Syntax
  3135. ------
  3136.  
  3137.      #include <stdio.h>
  3138.      
  3139.      int biosprint(int cmd, int byte, int port)
  3140.  
  3141. Description
  3142. -----------
  3143.  
  3144. COMMAND = 0
  3145.      `byte' is sent to parallel port PORT.
  3146.  
  3147. COMMAND = 1
  3148.      Parallel port PORT is reset and initialized.
  3149.  
  3150. COMMAND = 2
  3151.      The status of parallel port PORT is returned.
  3152.  
  3153.           7654 3210  Meaning
  3154.           
  3155.           ---- ---X  Timeout
  3156.           ---- -XX-  Unused
  3157.           ---- X---  I/O Error
  3158.           ---X ----  Selected
  3159.           --X- ----  Out of paper
  3160.           -X-- ----  Acknowledged
  3161.           X--- ----  Idle
  3162.  
  3163. Return Value
  3164. ------------
  3165.  
  3166. The printer status.
  3167.  
  3168. Example
  3169. -------
  3170.  
  3171.      while (*c)
  3172.        biosprint(0, *c++, 0);
  3173.  
  3174. 
  3175. File: libc.inf,  Node: biostime,  Next: blinkvideo,  Prev: biosprint,  Up: Alphabetical List
  3176.  
  3177. biostime
  3178. ========
  3179.  
  3180. Syntax
  3181. ------
  3182.  
  3183.      #include <bios.h>
  3184.      
  3185.      long biostime(int cmd, long newtime);
  3186.  
  3187. Description
  3188. -----------
  3189.  
  3190. This function reads (CMD=0) or sets (CMD=1) the internal tick counter,
  3191. which is the number of 18.2 Hz ticks since midnight.
  3192.  
  3193. Return Value
  3194. ------------
  3195.  
  3196. When reading, the number of ticks since midnight.
  3197.  
  3198. Example
  3199. -------
  3200.  
  3201.      long ticks = biostime(0, 0);
  3202.  
  3203. 
  3204. File: libc.inf,  Node: blinkvideo,  Next: brk,  Prev: biostime,  Up: Alphabetical List
  3205.  
  3206. blinkvideo
  3207. ==========
  3208.  
  3209. Syntax
  3210. ------
  3211.  
  3212.      #include <conio.h>
  3213.      void blinkvideo(void);
  3214.  
  3215. Description
  3216. -----------
  3217.  
  3218. Bit 7 (`MSB') of the character attribute byte has two possible effects
  3219. on EGA and VGA displays: it can either make the character blink or
  3220. change the background color to bright (thus allowing for 16 background
  3221. colors as opposed to the usual 8).  This function sets that bit to
  3222. display blinking characters.  After a call to this function, every
  3223. character written to the screen with bit 7 of the attribute byte set,
  3224. will blink.  The companion function `intensevideo' (*note
  3225. intensevideo::.) has the opposite effect.
  3226.  
  3227. Note that there is no BIOS function to get the current status of this
  3228. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  3229. the current state: if it's 1 (the default), blinking characters will be
  3230. displayed.
  3231.  
  3232. 
  3233. File: libc.inf,  Node: brk,  Next: bsearch,  Prev: blinkvideo,  Up: Alphabetical List
  3234.  
  3235. brk
  3236. ===
  3237.  
  3238. Syntax
  3239. ------
  3240.  
  3241.      #include <stdlib.h>
  3242.      
  3243.      int brk(void *ptr);
  3244.  
  3245. Description
  3246. -----------
  3247.  
  3248. This function changes the *break* for the program.  This is the first
  3249. address that, if referenced, will cause a fault to occur.  The program
  3250. asks for more memory by specifying larger values for PTR.  Normally,
  3251. this is done transparently through the `malloc' function.
  3252.  
  3253. Return Value
  3254. ------------
  3255.  
  3256. zero if the break was changed, -1 if not.  ERRNO is set to the error.
  3257.  
  3258. Example
  3259. -------
  3260.  
  3261.      if (brk(old_brk+1000))
  3262.        printf("no memory\n");
  3263.  
  3264. 
  3265. File: libc.inf,  Node: bsearch,  Next: bzero,  Prev: brk,  Up: Alphabetical List
  3266.  
  3267. bsearch
  3268. =======
  3269.  
  3270. Syntax
  3271. ------
  3272.  
  3273.      #include <stdlib.h>
  3274.      
  3275.      void *bsearch (const void *key, const void *base, size_t num,
  3276.        size_t size, int (*ptf)(const void *ckey, const void *celem));
  3277.  
  3278. Description
  3279. -----------
  3280.  
  3281. Given an array of values, perform a binary search on the values looking
  3282. for value that "matches" the given key.  A match is determined by
  3283. calling the provided function PTF and passing it the key as CKEY and a
  3284. pointer to one of the elements of the array as CELEM.  This function
  3285. must return a negative number if the key is closer than the element to
  3286. the beginning of the array, positive if it is closer to the end, and
  3287. zero if the element matches the key.
  3288.  
  3289. The array begins at address BASE and contains NUM elements, each of
  3290. size SIZE.
  3291.  
  3292. Return Value
  3293. ------------
  3294.  
  3295. Returns a pointer to the element that matches the key, else NULL.
  3296.  
  3297. Example
  3298. -------
  3299.  
  3300.      typedef struct {
  3301.        int a, b;
  3302.      } q;
  3303.      
  3304.      int compare(void *key, void *elem)
  3305.      {
  3306.        return *(int *)key - ((q *)elem)->a;
  3307.      }
  3308.      
  3309.      q qlist[100];
  3310.      
  3311.      ...
  3312.      q *match = bsearch(4, qlist, 100, sizeof(q), compare);
  3313.      printf("4->%d=n", match->b);
  3314.      ...
  3315.  
  3316. 
  3317. File: libc.inf,  Node: bzero,  Next: calloc,  Prev: bsearch,  Up: Alphabetical List
  3318.  
  3319. bzero
  3320. =====
  3321.  
  3322. Syntax
  3323. ------
  3324.  
  3325.      #include <string.h>
  3326.      
  3327.      void bzero(void *pointer, int length);
  3328.  
  3329. Description
  3330. -----------
  3331.  
  3332. The data at POINTER is filled with LENGTH zeros.
  3333.  
  3334. Return Value
  3335. ------------
  3336.  
  3337. None.
  3338.  
  3339. Example
  3340. -------
  3341.  
  3342.      char foo[100];
  3343.      bzero(foo,100);
  3344.  
  3345. 
  3346. File: libc.inf,  Node: calloc,  Next: ceil,  Prev: bzero,  Up: Alphabetical List
  3347.  
  3348. calloc
  3349. ======
  3350.  
  3351. Syntax
  3352. ------
  3353.  
  3354.      #include <malloc.h>
  3355.      
  3356.      void *calloc(size_t num_elements, size_t size);
  3357.  
  3358. Description
  3359. -----------
  3360.  
  3361. This function allocates enough memory for NUM_ELEMENTS objects of size
  3362. SIZE.  The memory returned is initialized to all zeros.  The pointer
  3363. returned should later be passed to free (*note free::.) so that the
  3364. memory can be returned to the heap.
  3365.  
  3366. You may use cfree (*note xfree::.) to free the pointer also; it just
  3367. calls free.
  3368.  
  3369. Return Value
  3370. ------------
  3371.  
  3372. A pointer to the memory, or `NULL' if no more memory is available.
  3373.  
  3374. Example
  3375. -------
  3376.  
  3377.      Complex *x = calloc(12, sizeof(Complex));
  3378.      cfree(x);
  3379.  
  3380. 
  3381. File: libc.inf,  Node: ceil,  Next: cfgetispeed,  Prev: calloc,  Up: Alphabetical List
  3382.  
  3383. ceil
  3384. ====
  3385.  
  3386. Syntax
  3387. ------
  3388.  
  3389.      #include <math.h>
  3390.      
  3391.      double ceil(double x);
  3392.  
  3393. Return Value
  3394. ------------
  3395.  
  3396. The smallest integer value greater than or equal to X.
  3397.  
  3398. 
  3399. File: libc.inf,  Node: cfgetispeed,  Next: cfgetospeed,  Prev: ceil,  Up: Alphabetical List
  3400.  
  3401. cfgetispeed
  3402. ===========
  3403.  
  3404. Syntax
  3405. ------
  3406.  
  3407.      #include <termios.h>
  3408.      
  3409.      speed_t cfgetispeed (const struct termios *termiosp);
  3410.  
  3411. Description
  3412. -----------
  3413.  
  3414. This function gets the input line speed stored in the structure
  3415. TERMIOSP.  It is provided for compatibility only.  Note that the
  3416. termios emulation handles console only.
  3417.  
  3418. Return Value
  3419. ------------
  3420.  
  3421. The input line speed on success, (speed_t) -1 for error.
  3422.  
  3423. 
  3424. File: libc.inf,  Node: cfgetospeed,  Next: cfmakeraw,  Prev: cfgetispeed,  Up: Alphabetical List
  3425.  
  3426. cfgetospeed
  3427. ===========
  3428.  
  3429. Syntax
  3430. ------
  3431.  
  3432.      #include <termios.h>
  3433.      
  3434.      speed_t cfgetospeed (const struct termios *termiosp);
  3435.  
  3436. Description
  3437. -----------
  3438.  
  3439. This function gets the output line speed stored in the structure
  3440. TERMIOSP.  It is provided for compatibility only.  Note that the
  3441. termios emulation handles console only.
  3442.  
  3443. Return Value
  3444. ------------
  3445.  
  3446. The output line speed on success, (speed_t) -1 for error.
  3447.  
  3448. 
  3449. File: libc.inf,  Node: cfmakeraw,  Next: cfree,  Prev: cfgetospeed,  Up: Alphabetical List
  3450.  
  3451. cfmakeraw
  3452. =========
  3453.  
  3454. Syntax
  3455. ------
  3456.  
  3457.      #include <termios.h>
  3458.      
  3459.      void cfmakeraw (struct termios *termiosp);
  3460.  
  3461. Description
  3462. -----------
  3463.  
  3464. This function sets the structure specified by TERMIOSP for raw mode.
  3465. It is provided for compatibility only.  Note that the termios emulation
  3466. handles console only.
  3467.  
  3468. Return Value
  3469. ------------
  3470.  
  3471. Zero on success, nonzero on failure.
  3472.  
  3473. 
  3474. File: libc.inf,  Node: cfree,  Next: cfsetispeed,  Prev: cfmakeraw,  Up: Alphabetical List
  3475.  
  3476. cfree
  3477. =====
  3478.  
  3479. Syntax
  3480. ------
  3481.  
  3482.      #include <stdlib.h>
  3483.      
  3484.      void cfree(void *pointer);
  3485.  
  3486. Description
  3487. -----------
  3488.  
  3489. This function returns the memory allocated by calloc (*note calloc::.)
  3490. to the heap.
  3491.  
  3492. Return Value
  3493. ------------
  3494.  
  3495. None.
  3496.  
  3497. Example
  3498. -------
  3499.  
  3500.      Complex *x = calloc(12, sizeof(Complex));
  3501.      cfree(x);
  3502.  
  3503. 
  3504. File: libc.inf,  Node: cfsetispeed,  Next: cfsetospeed,  Prev: cfree,  Up: Alphabetical List
  3505.  
  3506. cfsetispeed
  3507. ===========
  3508.  
  3509. Syntax
  3510. ------
  3511.  
  3512.      #include <termios.h>
  3513.      
  3514.      int cfsetispeed (struct termios *termiosp, speed_t speed);
  3515.  
  3516. Description
  3517. -----------
  3518.  
  3519. This function sets the input line speed stored in the structure
  3520. TERMIOSP to SPEED.  It is provided for compatibility only.  Note that
  3521. the termios emulation handles console only.
  3522.  
  3523. Return Value
  3524. ------------
  3525.  
  3526. Zero on success, nonzero on failure.
  3527.  
  3528. 
  3529. File: libc.inf,  Node: cfsetospeed,  Next: cfsetspeed,  Prev: cfsetispeed,  Up: Alphabetical List
  3530.  
  3531. cfsetospeed
  3532. ===========
  3533.  
  3534. Syntax
  3535. ------
  3536.  
  3537.      #include <termios.h>
  3538.      
  3539.      int cfsetospeed (struct termios *termiosp, speed_t speed);
  3540.  
  3541. Description
  3542. -----------
  3543.  
  3544. This function sets the output line speed stored in the structure
  3545. TERMIOSP to SPEED.  It is provided for compatibility only.  Note that
  3546. the termios emulation handles console only.
  3547.  
  3548. Return Value
  3549. ------------
  3550.  
  3551. Zero on success, nonzero on failure.
  3552.  
  3553. 
  3554. File: libc.inf,  Node: cfsetspeed,  Next: cgets,  Prev: cfsetospeed,  Up: Alphabetical List
  3555.  
  3556. cfsetspeed
  3557. ==========
  3558.  
  3559. Syntax
  3560. ------
  3561.  
  3562.      #include <termios.h>
  3563.      
  3564.      int cfsetspeed (struct termios *termiosp, speed_t speed);
  3565.  
  3566. Description
  3567. -----------
  3568.  
  3569. This function sets the input and output line speed stored in the
  3570. structure TERMIOSP to SPEED.  It is provided for compatibility only.
  3571. Note that the termios emulation handles console only.
  3572.  
  3573. Return Value
  3574. ------------
  3575.  
  3576. Zero on success, nonzero on failure.
  3577.  
  3578. 
  3579. File: libc.inf,  Node: cgets,  Next: chdir,  Prev: cfsetspeed,  Up: Alphabetical List
  3580.  
  3581. cgets
  3582. =====
  3583.  
  3584. Syntax
  3585. ------
  3586.  
  3587.      #include <conio.h>
  3588.      
  3589.      char *cgets(char *_str);
  3590.  
  3591. Description
  3592. -----------
  3593.  
  3594. Get a string from the console.  This will take advantage of any
  3595. command-line editing TSRs.  To use, you must pre-fill the first
  3596. character of the buffer.  The first character is the size of the
  3597. buffer.  On return, the second character is the number of characters
  3598. read.  The third character is the first character read.
  3599.  
  3600. Return Value
  3601. ------------
  3602.  
  3603. A pointer to the first character read.
  3604.  
  3605. 
  3606. File: libc.inf,  Node: chdir,  Next: chmod,  Prev: cgets,  Up: Alphabetical List
  3607.  
  3608. chdir
  3609. =====
  3610.  
  3611. Syntax
  3612. ------
  3613.  
  3614.      #include <unistd.h>
  3615.      
  3616.      int chdir(const char *new_directory);
  3617.  
  3618. Description
  3619. -----------
  3620.  
  3621. This function changes the current directory to NEW_DIRECTORY.  If a
  3622. drive letter is specified, the current directory for that drive is
  3623. changed and the current disk is set to that drive, else the current
  3624. directory for the current drive is changed.
  3625.  
  3626. Return Value
  3627. ------------
  3628.  
  3629. Zero if the new directory exists, else nonzero and ERRNO set if error.
  3630.  
  3631. Example
  3632. -------
  3633.  
  3634.      if (chdir("/tmp"))
  3635.        perror("/tmp");
  3636.  
  3637. 
  3638. File: libc.inf,  Node: chmod,  Next: _chmod,  Prev: chdir,  Up: Alphabetical List
  3639.  
  3640. chmod
  3641. =====
  3642.  
  3643. Syntax
  3644. ------
  3645.  
  3646.      #include <sys/stat.h>
  3647.      
  3648.      int chmod(const char *path, mode_t mode);
  3649.  
  3650. Description
  3651. -----------
  3652.  
  3653. This function changes the mode (writable or write-only) of the specified
  3654. file.  The value of MODE can be a combination of one or more of the
  3655. following:
  3656.  
  3657. `S_IRUSR'
  3658.      Make the file readable
  3659.  
  3660. `S_IWUSR'
  3661.      Make the file writable
  3662.  
  3663. Other `S_I*' values could be included, but they will be ignored.
  3664.  
  3665. Return Value
  3666. ------------
  3667.  
  3668. Zero if the file exists and the mode was changed, else nonzero.
  3669.  
  3670. Example
  3671. -------
  3672.  
  3673.      chmod("/tmp/dj.dat", S_IWUSR|S_IRUSR);
  3674.  
  3675. 
  3676. File: libc.inf,  Node: _chmod,  Next: chown,  Prev: chmod,  Up: Alphabetical List
  3677.  
  3678. _chmod
  3679. ======
  3680.  
  3681. Syntax
  3682. ------
  3683.  
  3684.      #include <io.h>
  3685.      
  3686.      int _chmod(const char *filename, int func, mode_t mode);
  3687.  
  3688. Description
  3689. -----------
  3690.  
  3691. This is a direct connection to the MS-DOS chmod function call, int
  3692. 0x21, %ax = 0x4300/0x4301.  If FUNC is 0, then DOS is called with AX =
  3693. 0x4300, which returns an attribute byte of a file.  If FUNC is 1, then
  3694. the attributes of a file are set as specified in MODE.  Note that the
  3695. directory and volume attribute bits must always be 0 when `_chmod()' is
  3696. called with FUNC = 1, or else the call will fail.  The third argument
  3697. is optional when getting attributes.  The attribute bits are defined as
  3698. follows:
  3699.  
  3700.        Bit       Meaning
  3701.      76543210
  3702.      .......1    Read-only
  3703.      ......1.    Hidden
  3704.      .....1..    System
  3705.      ....1...    Volume Label
  3706.      ...1....    Directory
  3707.      ..1.....    Archive
  3708.      xx......    Reserved (used by some network redirectors)
  3709.  
  3710. Return Value
  3711. ------------
  3712.  
  3713. If the file exists, `_chmod()' returns its attribute byte in case it
  3714. succeded, or -1 in case of failure.
  3715.  
  3716. 
  3717. File: libc.inf,  Node: chown,  Next: chsize,  Prev: _chmod,  Up: Alphabetical List
  3718.  
  3719. chown
  3720. =====
  3721.  
  3722. Syntax
  3723. ------
  3724.  
  3725.      #include <unistd.h>
  3726.      
  3727.      int chown(const char *file, int owner, int group);
  3728.  
  3729. Description
  3730. -----------
  3731.  
  3732. This function does nothing under MS-DOS
  3733.  
  3734. Return Value
  3735. ------------
  3736.  
  3737. This function always returns zero if the file exists, else it returns
  3738. -1 and sets ERRNO to `ENOENT'.
  3739.  
  3740. 
  3741. File: libc.inf,  Node: chsize,  Next: _clear87,  Prev: chown,  Up: Alphabetical List
  3742.  
  3743. chsize
  3744. ======
  3745.  
  3746. Syntax
  3747. ------
  3748.  
  3749.      #include <io.h>
  3750.      
  3751.      int chsize(int handle, long size);
  3752.  
  3753. Description
  3754. -----------
  3755.  
  3756. Just calls ftruncate (*note ftruncate::.).
  3757.  
  3758. Return Value
  3759. ------------
  3760.  
  3761. Zero on success, -1 on failure.
  3762.  
  3763. 
  3764. File: libc.inf,  Node: _clear87,  Next: clearerr,  Prev: chsize,  Up: Alphabetical List
  3765.  
  3766. _clear87
  3767. ========
  3768.  
  3769. Syntax
  3770. ------
  3771.  
  3772.      #include <float.h>
  3773.      
  3774.      unsigned int _clear87(void);
  3775.  
  3776. Description
  3777. -----------
  3778.  
  3779. Clears the floating point processor's exception flags.
  3780.  
  3781. Return Value
  3782. ------------
  3783.  
  3784. The previous status word.
  3785.  
  3786. 
  3787. File: libc.inf,  Node: clearerr,  Next: clock,  Prev: _clear87,  Up: Alphabetical List
  3788.  
  3789. clearerr
  3790. ========
  3791.  
  3792. Syntax
  3793. ------
  3794.  
  3795.      #include <stdio.h>
  3796.      
  3797.      void clearerr(FILE *stream);
  3798.  
  3799. Description
  3800. -----------
  3801.  
  3802. This function clears the EOF and error indicators for the file STREAM.
  3803.  
  3804. Return Value
  3805. ------------
  3806.  
  3807. None.
  3808.  
  3809. Example
  3810. -------
  3811.  
  3812.      clearerr(stdout);
  3813.  
  3814. 
  3815. File: libc.inf,  Node: clock,  Next: close,  Prev: clearerr,  Up: Alphabetical List
  3816.  
  3817. clock
  3818. =====
  3819.  
  3820. Syntax
  3821. ------
  3822.  
  3823.      #include <time.h>
  3824.      
  3825.      clock_t clock(void);
  3826.  
  3827. Description
  3828. -----------
  3829.  
  3830. This function returns the number of clock ticks since an arbitrary time,
  3831. actually, since the first call to `clock', which itself returns zero.
  3832. The number of tics per second is CLOCKS_PER_SEC.
  3833.  
  3834. Return Value
  3835. ------------
  3836.  
  3837. The number of tics.
  3838.  
  3839. Example
  3840. -------
  3841.  
  3842.      printf("%d seconds have elapsed\n", clock()/CLOCKS_PER_SEC);
  3843.  
  3844. 
  3845. File: libc.inf,  Node: close,  Next: _close,  Prev: clock,  Up: Alphabetical List
  3846.  
  3847. close
  3848. =====
  3849.  
  3850. Syntax
  3851. ------
  3852.  
  3853.      #include <unistd.h>
  3854.      
  3855.      int close(int fd);
  3856.  
  3857. Description
  3858. -----------
  3859.  
  3860. The open file associated with FD is closed.
  3861.  
  3862. Return Value
  3863. ------------
  3864.  
  3865. Zero if the file was closed, nonzero if FD was invalid or already
  3866. closed.
  3867.  
  3868. Example
  3869. -------
  3870.  
  3871.      int fd = open("data", O_RDONLY);
  3872.      close(fd);
  3873.  
  3874. 
  3875. File: libc.inf,  Node: _close,  Next: closedir,  Prev: close,  Up: Alphabetical List
  3876.  
  3877. _close
  3878. ======
  3879.  
  3880. Syntax
  3881. ------
  3882.  
  3883.      #include <io.h>
  3884.      
  3885.      int _close(int fd);
  3886.  
  3887. Description
  3888. -----------
  3889.  
  3890. This is a direct connection to the MS-DOS close function call, int
  3891. 0x21, %ah = 0x3e.
  3892.  
  3893. Return Value
  3894. ------------
  3895.  
  3896. Zero if the file was closed, else nonzero.
  3897.  
  3898. 
  3899. File: libc.inf,  Node: closedir,  Next: clreol,  Prev: _close,  Up: Alphabetical List
  3900.  
  3901. closedir
  3902. ========
  3903.  
  3904. Syntax
  3905. ------
  3906.  
  3907.      #include <dirent.h>
  3908.      
  3909.      int closedir(DIR *dir);
  3910.  
  3911. Description
  3912. -----------
  3913.  
  3914. This function closes a directory opened by opendir (*note opendir::.).
  3915.  
  3916. Return Value
  3917. ------------
  3918.  
  3919. Zero on success, nonzero if DIR is invalid.
  3920.  
  3921. 
  3922. File: libc.inf,  Node: clreol,  Next: clrscr,  Prev: closedir,  Up: Alphabetical List
  3923.  
  3924. clreol
  3925. ======
  3926.  
  3927. Syntax
  3928. ------
  3929.  
  3930.      #include <conio.h>
  3931.      
  3932.      void clreol(void);
  3933.  
  3934. Description
  3935. -----------
  3936.  
  3937. Clear to end of line.
  3938.  
  3939. Return Value
  3940. ------------
  3941.  
  3942. None.
  3943.  
  3944. 
  3945. File: libc.inf,  Node: clrscr,  Next: _conio_kbhit,  Prev: clreol,  Up: Alphabetical List
  3946.  
  3947. clrscr
  3948. ======
  3949.  
  3950. Syntax
  3951. ------
  3952.  
  3953.      #include <conio.h>
  3954.      
  3955.      void clrscr(void);
  3956.  
  3957. Description
  3958. -----------
  3959.  
  3960. Clear the entire screen.
  3961.  
  3962. 
  3963. File: libc.inf,  Node: _conio_kbhit,  Next: _control87,  Prev: clrscr,  Up: Alphabetical List
  3964.  
  3965. _conio_kbhit
  3966. ============
  3967.  
  3968. Syntax
  3969. ------
  3970.  
  3971.      #include <conio.h>
  3972.      
  3973.      int _conio_kbhit(void);
  3974.  
  3975. Description
  3976. -----------
  3977.  
  3978. Determines whether or not a character is waiting at the keyboard.  If
  3979. there is an ungetch'd character, this function returns true.  Note that
  3980. if you include `conio.h', the *Note kbhit:: function is redefined to be
  3981. this function instead.
  3982.  
  3983. Return Value
  3984. ------------
  3985.  
  3986. Nonzero if a key is waiting, else zero.
  3987.  
  3988. 
  3989. File: libc.inf,  Node: _control87,  Next: cos,  Prev: _conio_kbhit,  Up: Alphabetical List
  3990.  
  3991. _control87
  3992. ==========
  3993.  
  3994. Syntax
  3995. ------
  3996.  
  3997.      #include <float.h>
  3998.      
  3999.      unsigned int _control87(unsigned int newcw, unsigned int mask);
  4000.  
  4001. Description
  4002. -----------
  4003.  
  4004. Sets or resets bits in the FPU's control register.  The bits are
  4005. defined by macros in float.h, and by this table:
  4006.  
  4007.      ---- ---- --XX XXXX = MCW_EM - exception masks (1=handle exception internally, 0=fault)
  4008.      ---- ---- ---- ---X = EM_INVALID - invalid operation
  4009.      ---- ---- ---- --X- = EM_DENORMAL - denormal operand
  4010.      ---- ---- ---- -X-- = EM_ZERODIVIDE - divide by zero
  4011.      ---- ---- ---- X--- = EM_OVERFLOW - overflow
  4012.      ---- ---- ---X ---- = EM_UNDERFLOW - underflow
  4013.      ---- ---- --X- ---- = EM_INEXACT - rounding was required
  4014.      ---- --XX ---- ---- = MCW_PC - precision control
  4015.      ---- --00 ---- ---- = PC_24 - single precision
  4016.      ---- --10 ---- ---- = PC_53 - double precision
  4017.      ---- --11 ---- ---- = PC_64 - extended precision
  4018.      ---- XX-- ---- ---- = MCW_RC - rounding control
  4019.      ---- 00-- ---- ---- = RC_NEAR - round to nearest
  4020.      ---- 01-- ---- ---- = RC_DOWN - round towards -Inf
  4021.      ---- 10-- ---- ---- = RC_UP - round towards +Inf
  4022.      ---- 11-- ---- ---- = RC_CHOP - round towards zero
  4023.      ---X ---- ---- ---- = MCW_IC - infinity control (obsolete, always affine)
  4024.      ---0 ---- ---- ---- = IC_AFFINE - -Inf < +Inf
  4025.      ---1 ---- ---- ---- = IC_PROJECTIVE - -Inf == +Inf
  4026.  
  4027. Return Value
  4028. ------------
  4029.  
  4030. The previous control word.
  4031.  
  4032. 
  4033. File: libc.inf,  Node: cos,  Next: cosh,  Prev: _control87,  Up: Alphabetical List
  4034.  
  4035. cos
  4036. ===
  4037.  
  4038. Syntax
  4039. ------
  4040.  
  4041.      #include <math.h>
  4042.      
  4043.      double cos(double x);
  4044.  
  4045. Return Value
  4046. ------------
  4047.  
  4048. The cosine of X.
  4049.  
  4050. 
  4051. File: libc.inf,  Node: cosh,  Next: cprintf,  Prev: cos,  Up: Alphabetical List
  4052.  
  4053. cosh
  4054. ====
  4055.  
  4056. Syntax
  4057. ------
  4058.  
  4059.      #include <math.h>
  4060.      
  4061.      double cosh(double x);
  4062.  
  4063. Return Value
  4064. ------------
  4065.  
  4066. The hyperbolic cosine of X.
  4067.  
  4068. 
  4069. File: libc.inf,  Node: cprintf,  Next: cputs,  Prev: cosh,  Up: Alphabetical List
  4070.  
  4071. cprintf
  4072. =======
  4073.  
  4074. Syntax
  4075. ------
  4076.  
  4077.      #include <conio.h>
  4078.      
  4079.      int cprintf(const char *_format, ...);
  4080.  
  4081. Description
  4082. -----------
  4083.  
  4084. Like `printf' (*note printf::.), but prints through the console, taking
  4085. into consideration window borders and text attributes.  There is
  4086. currently a 2048-byte limit on the size of each individual cprintf call.
  4087.  
  4088. Return Value
  4089. ------------
  4090.  
  4091. The number of characters written.
  4092.  
  4093. 
  4094. File: libc.inf,  Node: cputs,  Next: creat,  Prev: cprintf,  Up: Alphabetical List
  4095.  
  4096. cputs
  4097. =====
  4098.  
  4099. Syntax
  4100. ------
  4101.  
  4102.      #include <conio.h>
  4103.      
  4104.      int cputs(const char *_str);
  4105.  
  4106. Description
  4107. -----------
  4108.  
  4109. Puts the string onto the console.  The cursor position is updated.
  4110.  
  4111. Return Value
  4112. ------------
  4113.  
  4114. zero on success.
  4115.  
  4116. 
  4117. File: libc.inf,  Node: creat,  Next: _creat,  Prev: cputs,  Up: Alphabetical List
  4118.  
  4119. creat
  4120. =====
  4121.  
  4122. Syntax
  4123. ------
  4124.  
  4125.      #include <fcntl.h>
  4126.      #include <sys/stat.h> /* for mode definitions */
  4127.      
  4128.      int creat(const char *filename, mode_t mode);
  4129.  
  4130. Description
  4131. -----------
  4132.  
  4133. This function creates the given file and opens it for writing.  If the
  4134. file exists, it is truncated to zero size, unless it is read-only, in
  4135. which case the function fails.  If the file does not exist, it will be
  4136. created read-only if MODE does not have `S_IWUSR' set.
  4137.  
  4138. Return Value
  4139. ------------
  4140.  
  4141. A file descriptor >= 0, or a negative number on error.
  4142.  
  4143. Example
  4144. -------
  4145.  
  4146.      int fd = creat("data", S_IRUSR|S_IWUSR);
  4147.      write(fd, buf, 1024);
  4148.      close(fd);
  4149.  
  4150. 
  4151. File: libc.inf,  Node: _creat,  Next: crlf2nl,  Prev: creat,  Up: Alphabetical List
  4152.  
  4153. _creat
  4154. ======
  4155.  
  4156. Syntax
  4157. ------
  4158.  
  4159.      #include <io.h>
  4160.      
  4161.      int _creat(const char *path, int attrib);
  4162.  
  4163. Description
  4164. -----------
  4165.  
  4166. This is a direct connection to the MS-DOS creat function call, int
  4167. 0x21, %ah = 0x3c.  The file is set to binary mode.
  4168.  
  4169. Return Value
  4170. ------------
  4171.  
  4172. The new file descriptor, else -1 on error.
  4173.  
  4174. 
  4175. File: libc.inf,  Node: crlf2nl,  Next: __crt0_glob_function,  Prev: _creat,  Up: Alphabetical List
  4176.  
  4177. crlf2nl
  4178. =======
  4179.  
  4180. Syntax
  4181. ------
  4182.  
  4183.      size_t crlf2nl(char *buf, ssize_t len);
  4184.  
  4185. Description
  4186. -----------
  4187.  
  4188. This function removes Ctrl-M characters from the given BUF.
  4189.  
  4190. Return Value
  4191. ------------
  4192.  
  4193. The number of characters remaining in the buffer are returned.
  4194.  
  4195. 
  4196. File: libc.inf,  Node: __crt0_glob_function,  Next: __crt0_load_environment_file,  Prev: crlf2nl,  Up: Alphabetical List
  4197.  
  4198. __crt0_glob_function
  4199. ====================
  4200.  
  4201. Syntax
  4202. ------
  4203.  
  4204.      #include <crt0.h>
  4205.      
  4206.      char **__crt0_glob_function(char *_argument);
  4207.  
  4208. Description
  4209. -----------
  4210.  
  4211. If the application wishes to provide a wildcard expansion function, it
  4212. should define a `__crt0_glob_function' function.  It should return a
  4213. list of the expanded values, or 0 if no expansion will occur.  The
  4214. startup code will free the returned pointer if it is nonzero.
  4215.  
  4216. If no expander function is provided, wildcards will be expanded in the
  4217. POSIX.1 style by the default `__crt0_glob_function' from the C library.
  4218. To disable expansion, provide a `__crt0_glob_function' that always
  4219. returns 0.
  4220.  
  4221. 
  4222. File: libc.inf,  Node: __crt0_load_environment_file,  Next: __crt0_setup_arguments,  Prev: __crt0_glob_function,  Up: Alphabetical List
  4223.  
  4224. __crt0_load_environment_file
  4225. ============================
  4226.  
  4227. Syntax
  4228. ------
  4229.  
  4230.      #include <crt0.h>
  4231.      
  4232.      void   __crt0_load_environment_file(char *_app_name);
  4233.  
  4234. Description
  4235. -----------
  4236.  
  4237. This function, provided by libc.a, does all the work required to load
  4238. additional environment variables from the file $DJGPP.  If the
  4239. application does not use environment variables, the programmer can
  4240. reduce the size of the program image by providing a version of this
  4241. function that does nothing.
  4242.  
  4243. *Note __crt0_setup_arguments::.
  4244.  
  4245. 
  4246. File: libc.inf,  Node: __crt0_setup_arguments,  Next: _crt0_startup_flags,  Prev: __crt0_load_environment_file,  Up: Alphabetical List
  4247.  
  4248. __crt0_setup_arguments
  4249. ======================
  4250.  
  4251. Syntax
  4252. ------
  4253.  
  4254.      #include <crt0.h>
  4255.      
  4256.      void   __crt0_setup_arguments(void);
  4257.  
  4258. Description
  4259. -----------
  4260.  
  4261. This function, provided by libc.a, does all the work required to
  4262. provide the two arguments passed to main() (usually `argc' and `argv').
  4263. If main() does not use these arguments, the programmer can reduce the
  4264. size of the program image by providing a version of this function that
  4265. does nothing.
  4266.  
  4267. Note that since the default `__crt0_setup_arguments_function' will
  4268. *not* expand wildcards inside quotes (`"' or `''), but you can quote a
  4269. part of the argument that doesn't include wildcards and still have them
  4270. expanded.  This is so you could use wildcard expansion with filenames
  4271. which have embedded whitespace (on LFN filesystems).
  4272.  
  4273. *Note __crt0_load_environment_file::.
  4274.  
  4275. 
  4276. File: libc.inf,  Node: _crt0_startup_flags,  Next: cscanf,  Prev: __crt0_setup_arguments,  Up: Alphabetical List
  4277.  
  4278. _crt0_startup_flags
  4279. ===================
  4280.  
  4281. Syntax
  4282. ------
  4283.  
  4284.      #include <crt0.h>
  4285.      
  4286.      int _crt0_startup_flags = ...;
  4287.  
  4288. Description
  4289. -----------
  4290.  
  4291. This variable can be used to determine what the startup code will (or
  4292. will not) do when the program begins.  This can be used to tailor the
  4293. startup environment to a particular program.
  4294.  
  4295. `_CRT0_FLAG_PRESERVE_UPPER_CASE'
  4296.      If set, argv[0] is left in whatever case it was.  If not set, all
  4297.      characters are mapped to lower case.  Note that if the argv0 field
  4298.      in the stubinfo structure is present, the case of that part of
  4299.      argv0 is not affected.
  4300.  
  4301. `_CRT0_FLAG_USE_DOS_SLASHES'
  4302.      If set, reverse slashes (dos-style) are preserved in argv[0].  If
  4303.      not set, all reverse slashes are replaced with unix-style slashes.
  4304.  
  4305. `_CRT0_FLAG_DROP_EXE_SUFFIX'
  4306.      If set, the .EXE suffix is removed from the file name component of
  4307.      argv[0].  If not set, the suffix remains.
  4308.  
  4309. `_CRT0_FLAG_DROP_DRIVE_SPECIFIER'
  4310.      If set, the drive specifier (ex: `C:') is removed from the
  4311.      beginning of argv[0] (if present).  If not set, the drive
  4312.      specifier remains.
  4313.  
  4314. `_CRT0_FLAG_DISALLOW_RESPONSE_FILES'
  4315.      If set, response files (ex: @gcc.rf) are not expanded.  If not
  4316.      set, the contents of the response files are used to create
  4317.      arguments.  Note that if the file does not exist, that argument
  4318.      remains unexpanded.
  4319.  
  4320. `_CRT0_FLAG_FILL_SBRK_MEMORY'
  4321.      If set, fill sbrk()'d memory with a constant value.  If not, memory
  4322.      gets whatever happens to have been in there, which breaks some
  4323.      applications.
  4324.  
  4325. `_CRT0_FLAG_FILL_DEADBEEF'
  4326.      If set, fill memory (above) with 0xdeadbeef, else fill with zero.
  4327.      This is especially useful for debugging uninitialized memory
  4328.      problems.
  4329.  
  4330. `_CRT0_FLAG_NEARPTR'
  4331.      If set, set DS limit to 4GB which allows use of near pointers to
  4332.      DOS (and other) memory.  WARNING, disables memory protection and
  4333.      bad pointers may crash the machine or wipe out your data.
  4334.  
  4335. `_CRT0_FLAG_NULLOK'
  4336.      If set, disable NULL pointer protection (if it can be controlled
  4337.      at all).
  4338.  
  4339. `_CRT0_FLAG_NMI_SIGNAL'
  4340.      If set, enabled capture of NMI in exception code.  This may cause
  4341.      problems with laptops and "green" boxes which use it to wake up.
  4342.      Default is to leave NMIs alone and pass through to real mode code.
  4343.      You decide.
  4344.  
  4345. `_CRT0_FLAG_NO_LFN'
  4346.      If set, disable usage of long file name functions even on systems
  4347.      (such as Win95) which support them.  This might be needed to work
  4348.      around program assumptions on file name format on programs written
  4349.      specifically for DOS.  Note that this flag overrides the value of
  4350.      the environment variable `LFN'.
  4351.  
  4352. `_CRT0_FLAG_NONMOVE_SBRK'
  4353.      If set, the sbrk() algorithm used used multiple DPMI memory blocks
  4354.      which makes sure the base of CS/DS/SS does not change.  This may
  4355.      cause problems with sbrk(0) values and programs with other
  4356.      assumptions about sbrk behavior.  This flag is useful with near
  4357.      pointers, since a constant pointer to DOS/Video memory can be
  4358.      computed without needing to reload it after any routine which
  4359.      might call sbrk().
  4360.  
  4361. `_CRT0_FLAG_UNIX_SBRK'
  4362.      If set, the sbrk() algorithm used resizes memory blocks so that
  4363.      the layout of memory is set up to be the most compatible with unix
  4364.      sbrk() expectations.  This mode should not be used with hardware
  4365.      interrupts, near pointers, and may cause problems with QDPMI
  4366.      virtual memory.  If your program requires a specific sbrk()
  4367.      behavior, you should set one of these flags, since the default may
  4368.      change in different libc releases.
  4369.  
  4370. `_CRT0_FLAG_LOCK_MEMORY'
  4371.      If set, locks all memory as it is allocated.  This effectively
  4372.      disables virtual memory, and may be useful if using extensive
  4373.      hardware interrupt codes in a relatively small image size.  The
  4374.      memory is locked after it is sbrk()ed, so the locking may fail.
  4375.      This bit may be set or cleared during execution.  When sbrk() uses
  4376.      multiple memory zones, it can be difficult to lock all memory
  4377.      since the memory block size and location is impossible to
  4378.      determine.
  4379.  
  4380. `_CRT0_FLAG_PRESERVE_FILENAME_CASE'
  4381.      If set, disables all filename letter-case conversions in functions
  4382.      that traverse directories (except findfirst/findnext which always
  4383.      return the filenames exactly as found in the directory entry).
  4384.      When reset, all filenames on 8+3 MSDOS filesystems and DOS-style
  4385.      8+3 filenames on LFN systems are converted to lower-case by
  4386.      functions such as `readdir', `getcwd', `_fixpath' and others.
  4387.      Note that when this flag is set, ALL filenames on MSDOS systems
  4388.      will appear in upper-case, which is both ugly and will break many
  4389.      Unix-born programs.  Use only if you know exactly what you are
  4390.      doing!
  4391.  
  4392.      This flag overrides the value of the environment variable `FNCASE',
  4393.      *Note _preserve_fncase::.
  4394.  
  4395. 
  4396. File: libc.inf,  Node: cscanf,  Next: ctime,  Prev: _crt0_startup_flags,  Up: Alphabetical List
  4397.  
  4398. cscanf
  4399. ======
  4400.  
  4401. Syntax
  4402. ------
  4403.  
  4404.      #include <conio.h>
  4405.      
  4406.      int cscanf(const char *_format, ...);
  4407.  
  4408. Description
  4409. -----------
  4410.  
  4411. Like `scanf' (*note scanf::.), but it reads from the keyboard directly.
  4412.  
  4413. Return Value
  4414. ------------
  4415.  
  4416. The number of fields stored.
  4417.  
  4418. 
  4419. File: libc.inf,  Node: ctime,  Next: delay,  Prev: cscanf,  Up: Alphabetical List
  4420.  
  4421. ctime
  4422. =====
  4423.  
  4424. Syntax
  4425. ------
  4426.  
  4427.      #include <time.h>
  4428.      
  4429.      char *ctime(const time_t *cal);
  4430.  
  4431. Description
  4432. -----------
  4433.  
  4434. This function returns an ASCII representation of the time in CAL.  This
  4435. is equivalent to `asctime(localtime(cal))'.  *Note asctime::.  *Note
  4436. localtime::.
  4437.  
  4438. Return Value
  4439. ------------
  4440.  
  4441. The ascii representation of the time.
  4442.  
  4443. 
  4444. File: libc.inf,  Node: delay,  Next: delline,  Prev: ctime,  Up: Alphabetical List
  4445.  
  4446. delay
  4447. =====
  4448.  
  4449. Syntax
  4450. ------
  4451.  
  4452.      void delay(unsigned msec);
  4453.  
  4454. Description
  4455. -----------
  4456.  
  4457. This function causes the program to pause for MSEC milliseconds.  It
  4458. uses the `int 15h' delay function to relinquish the CPU to other
  4459. programs that might need it.
  4460.  
  4461. Return Value
  4462. ------------
  4463.  
  4464. None.
  4465.  
  4466. Example
  4467. -------
  4468.  
  4469.      delay(200); /* delay for 1/5 second */
  4470.  
  4471. 
  4472. File: libc.inf,  Node: delline,  Next: difftime,  Prev: delay,  Up: Alphabetical List
  4473.  
  4474. delline
  4475. =======
  4476.  
  4477. Syntax
  4478. ------
  4479.  
  4480.      #include <conio.h>
  4481.      
  4482.      void    delline(void);
  4483.  
  4484. Description
  4485. -----------
  4486.  
  4487. The line the cursor is on is deleted; lines below it scroll up.
  4488.  
  4489. 
  4490. File: libc.inf,  Node: difftime,  Next: disable,  Prev: delline,  Up: Alphabetical List
  4491.  
  4492. difftime
  4493. ========
  4494.  
  4495. Syntax
  4496. ------
  4497.  
  4498.      #include <time.h>
  4499.      
  4500.      double difftime(time_t t1, time_t t0);
  4501.  
  4502. Description
  4503. -----------
  4504.  
  4505. This function returns the difference in time, in seconds, from T0 to T1.
  4506.  
  4507. Return Value
  4508. ------------
  4509.  
  4510. The number of seconds.
  4511.  
  4512. Example
  4513. -------
  4514.  
  4515.      time_t t1, t0;
  4516.      double elapsed;
  4517.      time(&t0);
  4518.      do_something();
  4519.      time(&t1);
  4520.      elapsed = difftime(t1, t0);
  4521.  
  4522. 
  4523. File: libc.inf,  Node: disable,  Next: div,  Prev: difftime,  Up: Alphabetical List
  4524.  
  4525. disable
  4526. =======
  4527.  
  4528. Syntax
  4529. ------
  4530.  
  4531.      #include <dos.h>
  4532.      
  4533.      int disable(void);
  4534.  
  4535. Description
  4536. -----------
  4537.  
  4538. This function disables interrupts.
  4539.  
  4540. *Note enable::.
  4541.  
  4542. Return Value
  4543. ------------
  4544.  
  4545. Returns nonzero if the interrupts had been enabled before this call,
  4546. zero if they were already disabled.
  4547.  
  4548. Example
  4549. -------
  4550.  
  4551.      int ints_were_enabled;
  4552.      
  4553.      ints_were_enabled = disable();
  4554.      . . . do some stuff . . .
  4555.      if (ints_were_enabled)
  4556.        enable();
  4557.  
  4558. 
  4559. File: libc.inf,  Node: div,  Next: __djgpp_exception_toggle,  Prev: disable,  Up: Alphabetical List
  4560.  
  4561. div
  4562. ===
  4563.  
  4564. Syntax
  4565. ------
  4566.  
  4567.      #include <stdlib.h>
  4568.      
  4569.      div_t div(int numberator, int denomonator);
  4570.  
  4571. Description
  4572. -----------
  4573.  
  4574. Returns the quotient and remainder of the division NUMBERATOR divided
  4575. by DENOMONATOR.  The return type is as follows:
  4576.  
  4577.      typedef struct {
  4578.        int quot;
  4579.        int rem;
  4580.      } div_t;
  4581.  
  4582. Return Value
  4583. ------------
  4584.  
  4585. The results of the division are returned.
  4586.  
  4587. Example
  4588. -------
  4589.  
  4590.      div_t d = div(42, 3);
  4591.      printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  4592.      
  4593.      div(+40, +3) = { +13, +1 }
  4594.      div(+40, -3) = { -13, -1 }
  4595.      div(-40, +3) = { -13, -1 }
  4596.      div(-40, -3) = { +13, -1 }
  4597.  
  4598. 
  4599. File: libc.inf,  Node: __djgpp_exception_toggle,  Next: __djgpp_map_physical_memory,  Prev: div,  Up: Alphabetical List
  4600.  
  4601. __djgpp_exception_toggle
  4602. ========================
  4603.  
  4604. Syntax
  4605. ------
  4606.  
  4607.  
  4608.      #include <sys/exceptn.h>
  4609.      
  4610.      void __djgpp_exception_toggle(void);
  4611.  
  4612. Description
  4613. -----------
  4614.  
  4615. This function is automatically called when the program exits, to restore
  4616. handling of all the exceptions to their normal state.  You may also call
  4617. it from your program, around the code fragments where you need to
  4618. temporarily restore *all* the exceptions to their default handling.
  4619. One example of such case might be a call to a library functions that
  4620. spawn child programs, when you don't want to handle signals generated
  4621. while the child runs (by default, those signals are also passed to the
  4622. parent).
  4623.  
  4624. Example
  4625. -------
  4626.  
  4627.  
  4628.        __djgpp_exception_toggle();
  4629.        system("myprog");
  4630.        __djgpp_exception_toggle();
  4631.  
  4632. 
  4633. File: libc.inf,  Node: __djgpp_map_physical_memory,  Next: __djgpp_memory_handle,  Prev: __djgpp_exception_toggle,  Up: Alphabetical List
  4634.  
  4635. __djgpp_map_physical_memory
  4636. ===========================
  4637.  
  4638. Syntax
  4639. ------
  4640.  
  4641.      #include <dpmi.h>
  4642.      
  4643.      int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
  4644.                          unsigned long phys_addr);
  4645.  
  4646. Description
  4647. -----------
  4648.  
  4649. This function attempts to map a range of physical memory over the
  4650. specified addresses.  One common use of this routine is to map device
  4651. memory, such as a linear frame buffer, into the address space of the
  4652. calling program.  OUR_ADDR, NUM_BYTES, and PHYS_ADDR must be
  4653. page-aligned.  If they are not page-aligned, ERRNO will be set to
  4654. `EINVAL' and the routine will fail.
  4655.  
  4656. This routine properly handles memory ranges that span multiple DPMI
  4657. handles, while `__dpmi_map_device_in_memory_block' does not.
  4658.  
  4659. Consult DPMI documentation on function 0508H for details on how this
  4660. function works.  Note: since 0508H is a DPMI service new with DPMI 1.0,
  4661. this call will fail on most DPMI 0.9 servers.  For your program to work
  4662. on a wide range of systems, you should not assume this call will
  4663. succeed.
  4664.  
  4665. Even on failure, this routine may affect a subset of the pages
  4666. specified.
  4667.  
  4668. Return Value
  4669. ------------
  4670.  
  4671. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  4672. for illegal input parameters, or `EACCES' if the DPMI server rejected
  4673. the mapping request.
  4674.  
  4675. Example
  4676. -------
  4677.  
  4678.      if (__djgpp_map_physical_memory (my_page_aligned_memory, 16384, 0x40000000))
  4679.        printf ("Failed to map physical addresses!\n");
  4680.  
  4681. 
  4682. File: libc.inf,  Node: __djgpp_memory_handle,  Next: __djgpp_memory_handle_list,  Prev: __djgpp_map_physical_memory,  Up: Alphabetical List
  4683.  
  4684. __djgpp_memory_handle
  4685. =====================
  4686.  
  4687. Syntax
  4688. ------
  4689.  
  4690.      #include <crt0.h>
  4691.      
  4692.      __djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
  4693.  
  4694. Description
  4695. -----------
  4696.  
  4697. This function returns a pointer to a structure containing the memory
  4698. handle and program relative offset associated with the address passed.
  4699. It is just a convenient way to process the __djgpp_memory_handle_list.
  4700.  
  4701. Return Value
  4702. ------------
  4703.  
  4704. A pointer to the __djgpp_sbrk_handle associated with a particular
  4705. address.
  4706.  
  4707. 
  4708. File: libc.inf,  Node: __djgpp_memory_handle_list,  Next: __djgpp_nearptr_disable,  Prev: __djgpp_memory_handle,  Up: Alphabetical List
  4709.  
  4710. __djgpp_memory_handle_list
  4711. ==========================
  4712.  
  4713. Syntax
  4714. ------
  4715.  
  4716.      #include <crt0.h>
  4717.      
  4718.      extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
  4719.  
  4720. Description
  4721. -----------
  4722.  
  4723. This array contains a list of memory handles and program relative
  4724. offsets allocated by sbrk() in addition to the handle allocated by the
  4725. stub.  These values are normally not needed unless you are doing
  4726. low-level DPMI page protection or memory mapping.
  4727.  
  4728. 
  4729. File: libc.inf,  Node: __djgpp_nearptr_disable,  Next: __djgpp_nearptr_enable,  Prev: __djgpp_memory_handle_list,  Up: Alphabetical List
  4730.  
  4731. __djgpp_nearptr_disable
  4732. =======================
  4733.  
  4734. Syntax
  4735. ------
  4736.  
  4737.      #include <sys/nearptr.h>
  4738.      
  4739.      void __djgpp_nearptr_disable(void);
  4740.  
  4741. Description
  4742. -----------
  4743.  
  4744. This function disables near pointers, and re-enables protection.  *Note
  4745. __djgpp_nearptr_enable::.
  4746.  
  4747. 
  4748. File: libc.inf,  Node: __djgpp_nearptr_enable,  Next: __djgpp_set_ctrl_c,  Prev: __djgpp_nearptr_disable,  Up: Alphabetical List
  4749.  
  4750. __djgpp_nearptr_enable
  4751. ======================
  4752.  
  4753. Syntax
  4754. ------
  4755.  
  4756.      #include <sys/nearptr.h>
  4757.      
  4758.      int __djgpp_nearptr_enable(void);
  4759.  
  4760. Description
  4761. -----------
  4762.  
  4763. This function enables "near pointers" to be used to access the DOS
  4764. memory arena.  Sort of.  When you call this function, it will return
  4765. nonzero if it has successfully enabled near pointers.  If so, you must
  4766. add the value `__djgpp_conventional_base' to the linear address of the
  4767. physical memory.  For example:
  4768.  
  4769.      if (__djgpp_nearptr_enable())
  4770.      {
  4771.        short *screen = (short *)(__djgpp_conventional_base + 0xb8000);
  4772.        for (i=0; i<80*24*2; i++)
  4773.          screen[i] = 0x0720;
  4774.        __djgpp_nearptr_disable();
  4775.      }
  4776.  
  4777. The variable `__djgpp_base_address' contains the linear base address of
  4778. the application's data segment.  You can subtract this value from other
  4779. linear addresses that DPMI functions might return in order to obtain a
  4780. near pointer to those linear regions as well.
  4781.  
  4782. If using the Unix-like sbrk algorithm, near pointers are only valid
  4783. until the next `malloc', `system', `spawn*', or `exec*' function call,
  4784. since the linear base address of the application may be changed by
  4785. these calls.
  4786.  
  4787. WARNING: When you enable near pointers, you disable all the protection
  4788. that the system is providing.  If you are not careful, your application
  4789. may destroy the data in your computer.  USE AT YOUR OWN RISK!
  4790.  
  4791. Return Value
  4792. ------------
  4793.  
  4794. Returns 0 if near pointers are not available, or nonzero if they are.
  4795.  
  4796. 
  4797. File: libc.inf,  Node: __djgpp_set_ctrl_c,  Next: __djgpp_set_page_attributes,  Prev: __djgpp_nearptr_enable,  Up: Alphabetical List
  4798.  
  4799. __djgpp_set_ctrl_c
  4800. ==================
  4801.  
  4802. Syntax
  4803. ------
  4804.  
  4805.      #include <sys/exceptn.h>
  4806.      
  4807.      int __djgpp_set_ctrl_c(int enable);
  4808.  
  4809. Description
  4810. -----------
  4811.  
  4812. This function sets and resets the bit which controls whether `SIGINT'
  4813. (*note SIGINT: signal.) will be raised when you press `Ctrl-C'.  By
  4814. default `Ctrl-C' generates an interrupt signal which, if uncaught by a
  4815. signal handler, will abort your program.  However, when you call the
  4816. `setmode' library function to switch the console reads to binary mode,
  4817. or open the console in binary mode for reading, this generation of
  4818. interrupt signal is turned off, because some programs want to get the
  4819. `^C' characters as any other character and handle them by themselves.
  4820.  
  4821. `__djgpp_set_ctrl_c' lets you explicitly determine the effect of
  4822. `Ctrl-C'.  When called with non-zero value of ENABLE, it arranges for
  4823. `Ctrl-C' to generate an interrupt; if you call it with a zero in
  4824. ENABLE, `Ctrl-C' are treated as normal characters.
  4825.  
  4826. Note that the effect of `Ctrl-Break' key is unaffected by this
  4827. function; use the `_go32_want_ctrl_break' library function to control
  4828. it.
  4829.  
  4830. Also note that in DJGPP, the effect of the interrupt signal will only be
  4831. seen when the program is in protected mode (*Note Signal Mechanism:
  4832. signal, for more details).  Thus, if you press `Ctrl-C' while your
  4833. program calls DOS (e.g., when reading from the console), the `SIGINT'
  4834. signal handler will only be called after that call returns.
  4835.  
  4836. Return Value
  4837. ------------
  4838.  
  4839. The previous state of the `Ctrl-C' effect: 0 if the generation of
  4840. `SIGINT' by `Ctrl-C' was disabled, 1 if it was enabled.
  4841.  
  4842. Example
  4843. -------
  4844.  
  4845.  
  4846.        setmode(fileno(stdin), O_BINARY);
  4847.        if (isatty(fileno(stdin)));
  4848.          __djgpp_set_ctrl_c(1);
  4849.  
  4850. 
  4851. File: libc.inf,  Node: __djgpp_set_page_attributes,  Next: _djstat_describe_lossage,  Prev: __djgpp_set_ctrl_c,  Up: Alphabetical List
  4852.  
  4853. __djgpp_set_page_attributes
  4854. ===========================
  4855.  
  4856. Syntax
  4857. ------
  4858.  
  4859.      #include <dpmi.h>
  4860.      
  4861.      int __djgpp_set_page_attributes(void *our_addr, unsigned long num_bytes,
  4862.                          unsigned short attributes);
  4863.  
  4864. Description
  4865. -----------
  4866.  
  4867. This function sets the DPMI page attributes for the pages in a range of
  4868. memory.  OUR_ADDR and NUM_BYTES must be page-aligned.  If they are not
  4869. page-aligned, ERRNO will be set to `EINVAL' and the routine will fail.
  4870.  
  4871. Consult DPMI documentation on function 0507H for the meaning of the
  4872. ATTRIBUTES argument.  Note: since 0507H is a DPMI service new with DPMI
  4873. 1.0, this call will fail on most DPMI 0.9 servers.  For your program to
  4874. work on a wide range of systems, you should not assume this call will
  4875. succeed.
  4876.  
  4877. Even on failure, this routine may affect a subset of the pages
  4878. specified.
  4879.  
  4880. Return Value
  4881. ------------
  4882.  
  4883. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  4884. for illegal input parameters, or `EACCES' if the DPMI server rejected
  4885. the attribute setting.
  4886.  
  4887. Example
  4888. -------
  4889.  
  4890.      if (__djgpp_set_page_attributes (my_page_aligned_memory, 16384, 0))
  4891.        printf ("Failed to make pages uncommitted!\n");
  4892.  
  4893. 
  4894. File: libc.inf,  Node: _djstat_describe_lossage,  Next: _djstat_fail_bits,  Prev: __djgpp_set_page_attributes,  Up: Alphabetical List
  4895.  
  4896. _djstat_describe_lossage
  4897. ========================
  4898.  
  4899. Syntax
  4900. ------
  4901.  
  4902.      #include <stdio.h>
  4903.      
  4904.      void _djstat_describe_lossage(FILE *fp);
  4905.  
  4906. Description
  4907. -----------
  4908.  
  4909. Accesses the global variable *Note _djstat_fail_bits:: and prints to the
  4910. stream given by FP a human-readable description of the undocumented DOS
  4911. features which the last call to `stat()' or `fstat()' failed to use.
  4912. (If FP is zero, the function prints to stderr.)  If the last call to
  4913. `f?stat()' didn't set any failure bits, an "all's well" message is
  4914. printed.  This function is designed to help in debugging these
  4915. functions in hostile environments (like DOS clones) and in adapting
  4916. them to the future DOS versions.  If you ever have any strange results
  4917. returned by `f?stat()', please call this function and post the
  4918. diagnostics it printed to the DJGPP mailing list.
  4919.  
  4920. The diagnostic messages this function prints are almost
  4921. self-explanatory.  Some explanations of terminology and abbreviations
  4922. used by the printed messages will further clarify them.
  4923.  
  4924. SDA (Swappable DOS Area) - this is an internal DOS structure.  `stat()'
  4925. uses it to get the full directory entry (including the starting cluster
  4926. number) of a file.  The pointer to SDA found by `stat()' is trusted
  4927. only if we find the pathname of our file at a specific offset in that
  4928. SDA.
  4929.  
  4930. SFT (System File Table) - another internal DOS structure, used in file
  4931. operations.  `fstat()' uses it to get full information on a file given
  4932. its handle.  An SFT entry which is found by `fstat()' is only trusted
  4933. if it contains files size and time stamp like those returned by DOS
  4934. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  4935. such a way they never get to SFT, so some failure messages refer
  4936. specifically to Novell.
  4937.  
  4938. Hashing - the fall-back method of returning a unique inode number for
  4939. each file.  It is used whenever the starting cluster of a file couldn't
  4940. be reliably determined.
  4941.  
  4942. Return Value
  4943. ------------
  4944.  
  4945. None.
  4946.  
  4947. Example
  4948. -------
  4949.  
  4950.        if (stat(path, &stat_buf))
  4951.          _djstat_describe_lossage((FILE *)0);
  4952.  
  4953. 
  4954. File: libc.inf,  Node: _djstat_fail_bits,  Next: _djstat_flags,  Prev: _djstat_describe_lossage,  Up: Alphabetical List
  4955.  
  4956. _djstat_fail_bits
  4957. =================
  4958.  
  4959. Syntax
  4960. ------
  4961.  
  4962.      #include <sys/stat.h>
  4963.      
  4964.      extern unsigned short   _djstat_fail_bits;
  4965.  
  4966. As proper operation of *Note stat:: and *Note fstat:: depend on
  4967. undocumented DOS features, they could fail in some incompatible
  4968. environment or a future DOS version.  If they do, the
  4969. `_djstat_fail_bits' variable will have some of its bits set.  Each bit
  4970. describes a single feature which was used and failed.  The function
  4971. *Note _djstat_describe_lossage:: may be called to print a
  4972. human-readable description of the bits which were set by the last call
  4973. to `f?stat()'.  This should make debugging `f?stat()' failures in an
  4974. unanticipated environment a lot easier.
  4975.  
  4976. The following bits are currently defined:
  4977.  
  4978. `_STFAIL_SDA'
  4979.      Indicates that Get SDA call failed.
  4980.  
  4981. `_STFAIL_OSVER'
  4982.      Indicates an unsupported DOS version (less than 3.10 for `stat()'
  4983.      or less than 2.0 for `fstat()').
  4984.  
  4985. `_STFAIL_BADSDA'
  4986.      The pointer to SDA was found to be bogus.
  4987.  
  4988. `_STFAIL_TRUENAME'
  4989.      Indicates that *Note _truename:: function call failed.
  4990.  
  4991. `_STFAIL_HASH'
  4992.      Indicates that the starting cluster of the file is unavailable,
  4993.      and inode number was computed by hashing its name.
  4994.  
  4995. `_STFAIL_LABEL'
  4996.      The application requested the time stamp of a root dir, but no
  4997.      volume label was found.
  4998.  
  4999. `_STFAIL_DCOUNT'
  5000.      The number of SDA reported is ridiculously large (probbaly an
  5001.      unsupported DOS clone).
  5002.  
  5003. `_STFAIL_WRITEBIT'
  5004.      `fstat()' was asked to get write access bit of a file, but
  5005.      couldn't.
  5006.  
  5007. `_STFAIL_DEVNO'
  5008.      `fstat()' failed to get device number.
  5009.  
  5010. `_STFAIL_BADSFT'
  5011.      An SFT entry for this file was found by `fstat()', but its contents
  5012.      can't be trusted because it didn't match file size and time stamp
  5013.      as reported by DOS.
  5014.  
  5015. `_STFAIL_SFTIDX'
  5016.      The SFT index in Job File Table in program's PSP is negative.
  5017.  
  5018. `_STFAIL_SFTNF'
  5019.      The file entry was not found in the SFT array.
  5020.  
  5021. Below are some explanations of terminology and abbreviations used by the
  5022. printed messages, which will further clarify the meaning of the above
  5023. bits and their descriptions printed by *Note _djstat_describe_lossage::.
  5024.  
  5025. SDA (Swappable Data Area) - this is an internal DOS structure.
  5026. `stat()' uses it to get the full directory entry (including the
  5027. starting cluster number) of a file.  The pointer to SDA found by
  5028. `stat()' is trusted only if we find the pathname of our file at a
  5029. specific offset in that SDA.
  5030.  
  5031. SFT (System File Table) - another internal DOS structure, used in file
  5032. operations.  `fstat()' uses it to get full information on a file given
  5033. its handle.  An SFT entry which is found by `fstat()' is only trusted
  5034. if it contains files size and time stamp like those returned by DOS
  5035. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  5036. such a way they never get to SFT, so some failure messages refer
  5037. specifically to Novell.
  5038.  
  5039. Hashing - the fall-back method of returning a unique inode number for
  5040. each file.  It is used whenever the starting cluster of a file couldn't
  5041. be reliably determined.  The full pathname of the file is looked up in a
  5042. table of files seen earlier (hashing is used to speed the lookup
  5043. process).  If found, the inode from the table is returned; this ensures
  5044. that a given file will get the same inode number.  Otherwise a new inode
  5045. number is invented, recorded in the table and returned to caller.
  5046.  
  5047. 
  5048. File: libc.inf,  Node: _djstat_flags,  Next: _doprnt,  Prev: _djstat_fail_bits,  Up: Alphabetical List
  5049.  
  5050. _djstat_flags
  5051. =============
  5052.  
  5053. Syntax
  5054. ------
  5055.  
  5056.      #include <sys/stat.h>
  5057.      
  5058.      extern unsigned short   _djstat_flags;
  5059.  
  5060. This variable contains bits for some fields of struct stat which are
  5061. expensive to compute under DOS.  Any such computation is only done by
  5062. *Note stat:: or *Note fstat:: if the corresponding bit in
  5063. `_djstat_flags' is *cleared*.  By default, all the bits are cleared, so
  5064. applications which don't care, automagically get a full version,
  5065. possibly at a price of performance.  To get the fastest possible
  5066. `f?stat()' for your application, clear only the bits which you need and
  5067. set all the others.
  5068.  
  5069. The following bits are currently defined:
  5070.  
  5071. `_STAT_INODE'
  5072.      Causes `f?stat()' to compute the `st_ino' (inode number) field.
  5073.  
  5074. `_STAT_EXEC_EXT'
  5075.      Tells `f?stat()' to compute the execute access bit from extension.
  5076.  
  5077. `_STAT_EXEC_MAGIC'
  5078.      Tells `f?stat()' to compute the execute access bit from magic
  5079.      signature (the first two bytes of the file, see *Note
  5080.      _is_executable::.  Note that if _STAT_EXEC_MAGIC is set, but
  5081.      _STAT_EXEC_EXT is not, some files which shouldn't be flagged as
  5082.      executables (e.g., COFF *.o object files) will have their execute
  5083.      bit set, because they have the magic number signature at their
  5084.      beginning.  Therefore, only use the above combination if you want
  5085.      to debug the list of extensions provided in is_exec.c file.
  5086.  
  5087. `_STAT_DIRSIZE'
  5088.      Causes `stat' to compute directory size by counting the number of
  5089.      its entries (unless some friendly network redirector brought a
  5090.      true directory size with it).  Also computes the number of
  5091.      subdirectories and sets the number of links `st_nlink' field.
  5092.  
  5093. `_STAT_ROOT_TIME'
  5094.      Causes `stat()' to try to get time stamp of root directory from its
  5095.      volume label entry, if there is one.
  5096.  
  5097. `_STAT_WRITEBIT'
  5098.      Tells `fstat()' that file's write access bit is required (this
  5099.      could be a problem only under some versions of Novell Netware).
  5100.  
  5101. Note that if you set a bit, some failure bits in *Note
  5102. _djstat_fail_bits:: might not be set, because some computations which
  5103. report failures are only done when they are required.
  5104.  
  5105. 
  5106. File: libc.inf,  Node: _doprnt,  Next: _dos_close,  Prev: _djstat_flags,  Up: Alphabetical List
  5107.  
  5108. _doprnt
  5109. =======
  5110.  
  5111. Syntax
  5112. ------
  5113.  
  5114.      #include <stdio.h>
  5115.      
  5116.      int _doprnt(const char *format, void *params, FILE *file);
  5117.  
  5118. Description
  5119. -----------
  5120.  
  5121. This is an internal function that is used by all the `printf' style
  5122. functions, which simply pass their format, arguments, and stream to this
  5123. function.
  5124.  
  5125. *Note printf:: for a discussion of the allowed formats and arguments.
  5126.  
  5127. Return Value
  5128. ------------
  5129.  
  5130. The number of characters generated is returned.
  5131.  
  5132. Example
  5133. -------
  5134.  
  5135.      int args[] = { 1, 2, 3, 66 };
  5136.      _doprnt("%d %d %d %c\n", args, stdout);
  5137.  
  5138. 
  5139. File: libc.inf,  Node: _dos_close,  Next: _dos_commit,  Prev: _doprnt,  Up: Alphabetical List
  5140.  
  5141. _dos_close
  5142. ==========
  5143.  
  5144. Syntax
  5145. ------
  5146.  
  5147.      #include <dos.h>
  5148.      
  5149.      unsigned int _dos_close(int handle);
  5150.  
  5151. Description
  5152. -----------
  5153.  
  5154. This is a direct connection to the MS-DOS close function call (%ah =
  5155. 0x3E).  This function closes the specified file.
  5156.  
  5157. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  5158. _dos_read::. *Note _dos_write::.
  5159.  
  5160. Return Value
  5161. ------------
  5162.  
  5163. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  5164.  
  5165. Example
  5166. -------
  5167.  
  5168.      int handle;
  5169.      
  5170.      _dos_creat("FOO.DAT", _A_ARCH, &handle);
  5171.      ...
  5172.      _dos_close(handle);
  5173.  
  5174. 
  5175. File: libc.inf,  Node: _dos_commit,  Next: _dos_creat,  Prev: _dos_close,  Up: Alphabetical List
  5176.  
  5177. _dos_commit
  5178. ===========
  5179.  
  5180. Syntax
  5181. ------
  5182.  
  5183.      #include <dos.h>
  5184.      
  5185.      unsigned int _dos_commit(int handle);
  5186.  
  5187. Description
  5188. -----------
  5189.  
  5190. This is a direct connection to the MS-DOS commit function call (%ah =
  5191. 0x68).  This function flushes DOS internal file buffers to disk.
  5192.  
  5193. Return Value
  5194. ------------
  5195.  
  5196. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  5197.  
  5198. Example
  5199. -------
  5200.  
  5201.      _dos_write(handle, buffer, 1000, &result);
  5202.      _dos_commit(handle);
  5203.      _dos_close(handle);
  5204.  
  5205. 
  5206. File: libc.inf,  Node: _dos_creat,  Next: _dos_creatnew,  Prev: _dos_commit,  Up: Alphabetical List
  5207.  
  5208. _dos_creat
  5209. ==========
  5210.  
  5211. Syntax
  5212. ------
  5213.  
  5214.      #include <dos.h>
  5215.      
  5216.      unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);
  5217.  
  5218. Description
  5219. -----------
  5220.  
  5221. This is a direct connection to the MS-DOS creat function call (%ah =
  5222. 0x3C).  This function creates the given file with the given attribute
  5223. and puts file handle into HANDLE if creating is successful. If the file
  5224. already exists it truncates the file to zero length. Meaning of ATTR
  5225. parameter is the following:
  5226.  
  5227. `_A_NORMAL (0x00)'
  5228.      Normal file (no read/write restrictions)
  5229.  
  5230. `_A_RDONLY (0x01)'
  5231.      Read only file
  5232.  
  5233. `_A_HIDDEN (0x02)'
  5234.      Hidden file
  5235.  
  5236. `_A_SYSTEM (0x04)'
  5237.      System file
  5238.  
  5239. `_A_ARCH (0x20)'
  5240.      Archive file
  5241.  
  5242. *Note _dos_open::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  5243. _dos_write::. *Note _dos_close::
  5244.  
  5245. Return Value
  5246. ------------
  5247.  
  5248. Returns 0 if successful or DOS error code on error (and sets ERRNO)
  5249.  
  5250. Example
  5251. -------
  5252.  
  5253.      int handle;
  5254.      
  5255.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  5256.         puts("Creating was successful !");
  5257.  
  5258. 
  5259. File: libc.inf,  Node: _dos_creatnew,  Next: _dos_findfirst,  Prev: _dos_creat,  Up: Alphabetical List
  5260.  
  5261. _dos_creatnew
  5262. =============
  5263.  
  5264. Syntax
  5265. ------
  5266.  
  5267.      #include <dos.h>
  5268.      
  5269.      unsigned int _dos_creatnew(const char *filename, unsigned short attr, int *handle);
  5270.  
  5271. Description
  5272. -----------
  5273.  
  5274. This is a direct connection to the MS-DOS create unique function call
  5275. (%ah = 0x5B). This function creates the given file with the given
  5276. attribute and puts file handle into HANDLE if creating is successful.
  5277. This function will fail if the specified file exists. Meaning of ATTR
  5278. parameter is the following:
  5279.  
  5280. `_A_NORMAL (0x00)'
  5281.      Normal file (no read/write restrictions)
  5282.  
  5283. `_A_RDONLY (0x01)'
  5284.      Read only file
  5285.  
  5286. `_A_HIDDEN (0x02)'
  5287.      Hidden file
  5288.  
  5289. `_A_SYSTEM (0x04)'
  5290.      System file
  5291.  
  5292. `_A_ARCH (0x20)'
  5293.      Archive file
  5294.  
  5295. *Note _dos_open::. *Note _dos_creat::. *Note _dos_read::.  *Note
  5296. _dos_write::. *Note _dos_close::
  5297.  
  5298. Return Value
  5299. ------------
  5300.  
  5301. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  5302.  
  5303. Example
  5304. -------
  5305.  
  5306.      int handle;
  5307.      
  5308.      if ( !_dos_creatnew("FOO.DAT", _A_NORMAL, &handle) )
  5309.         puts("Creating was successful !");
  5310.  
  5311. 
  5312. File: libc.inf,  Node: _dos_findfirst,  Next: _dos_findnext,  Prev: _dos_creatnew,  Up: Alphabetical List
  5313.  
  5314. _dos_findfirst
  5315. ==============
  5316.  
  5317. Syntax
  5318. ------
  5319.  
  5320.      #include <dos.h>
  5321.      
  5322.      unsigned int _dos_findfirst(char *name, unsigned int attr, struct find_t *result);
  5323.  
  5324. Description
  5325. -----------
  5326.  
  5327. This function and the related `_dos_findnext' (*note _dos_findnext::.)
  5328. are used to scan directories for the list of files therein. The NAME is
  5329. a wildcard that specifies the directory and files to search. RESULT is
  5330. a structure to hold the results and state of the search, and ATTR is a
  5331. combination of the following:
  5332.  
  5333. `_A_NORMAL (0x00)'
  5334.      Normal file (no read/write restrictions)
  5335.  
  5336. `_A_RDONLY (0x01)'
  5337.      Read only file
  5338.  
  5339. `_A_HIDDEN (0x02)'
  5340.      Hidden file
  5341.  
  5342. `_A_SYSTEM (0x04)'
  5343.      System file
  5344.  
  5345. `_A_VOLID (0x08)'
  5346.      Volume ID file
  5347.  
  5348. `_A_SUBDIR (0x10)'
  5349.      Subdirectory
  5350.  
  5351. `_A_ARCH (0x20)'
  5352.      Archive file
  5353.  
  5354. *Note _dos_findnext::.
  5355.  
  5356. Return Value
  5357. ------------
  5358.  
  5359. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  5360.  
  5361. Example
  5362. -------
  5363.  
  5364.      struct find_t f;
  5365.      
  5366.      if ( !_dos_findfirst("*.DAT", &result, _A_ARCH | _A_RDONLY) )
  5367.      {
  5368.        do
  5369.        {
  5370.          printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
  5371.                 f.name,
  5372.                 f.size,
  5373.                 (f.wr_time >> 11) & 0x1f,
  5374.                 (f.wr_time >>  5) & 0x3f,
  5375.                 (f.wr_time & 0x1f) * 2,
  5376.                 (f.wr_date >>  5) & 0x0f,
  5377.                 (f.wr_date & 0x1f),
  5378.                 ((f.wr_date >> 9) & 0x7f) + 1980,
  5379.        } while( !_dos_findnext(&f) );
  5380.      }
  5381.  
  5382. 
  5383. File: libc.inf,  Node: _dos_findnext,  Next: _dos_getdate,  Prev: _dos_findfirst,  Up: Alphabetical List
  5384.  
  5385. _dos_findnext
  5386. =============
  5387.  
  5388. Syntax
  5389. ------
  5390.  
  5391.      #include <dos.h>
  5392.      
  5393.      unsigned int _dos_findnext(struct _find_t *result);
  5394.  
  5395. Description
  5396. -----------
  5397.  
  5398. This finds the next file in the search started by `_dos_findfirst'.
  5399.  
  5400. *Note _dos_findfirst::.
  5401.  
  5402. Return Value
  5403. ------------
  5404.  
  5405. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  5406.  
  5407. 
  5408. File: libc.inf,  Node: _dos_getdate,  Next: _dos_getdiskfree,  Prev: _dos_findnext,  Up: Alphabetical List
  5409.  
  5410. _dos_getdate
  5411. ============
  5412.  
  5413. Syntax
  5414. ------
  5415.  
  5416.      #include <dos.h>
  5417.      
  5418.      void _dos_getdate(struct dosdate_t *date);
  5419.  
  5420. Description
  5421. -----------
  5422.  
  5423. This function gets the current date and fills the DATE structure with
  5424. these values.
  5425.  
  5426.      struct dosdate_t {
  5427.        unsigned char  day;       /* 1-31          */
  5428.        unsigned char  month;     /* 1-12          */
  5429.        unsigned short year;      /* 1980-2099     */
  5430.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  5431.      };
  5432.  
  5433. *Note _dos_setdate::. *Note _dos_gettime::. *Note _dos_settime::.
  5434.  
  5435. Return Value
  5436. ------------
  5437.  
  5438. None.
  5439.  
  5440. Example
  5441. -------
  5442.  
  5443.      struct dosdate_t date;
  5444.      
  5445.      _dos_getdate(&date);
  5446.  
  5447. 
  5448. File: libc.inf,  Node: _dos_getdiskfree,  Next: _dos_getdrive,  Prev: _dos_getdate,  Up: Alphabetical List
  5449.  
  5450. _dos_getdiskfree
  5451. ================
  5452.  
  5453. `_dos_getdiskfree'
  5454. ==================
  5455.  
  5456. Syntax
  5457. ------
  5458.  
  5459.      #include <dos.h>
  5460.      
  5461.      unsigned int _dos_getdiskfree(unsigned int drive, struct diskfree_t *diskspace);
  5462.  
  5463. Description
  5464. -----------
  5465.  
  5466. This function determines the free space on DRIVE drive (0=default,
  5467. 1=A:, 2=B:, etc.) and fills DISKSPACE structure.
  5468.  
  5469. Return Value
  5470. ------------
  5471.  
  5472. Returns with 0 if successful and non-zero on error (sets ERRNO=EINVAL).
  5473.  
  5474. Example
  5475. -------
  5476.  
  5477.      struct diskfree_t df;
  5478.      unsigned long freebytes;
  5479.      
  5480.      if ( !_dos_getdiskfree(0, &df) )
  5481.      {
  5482.        freebytes = (unsigned long)df.avail_clusters *
  5483.                    (unsigned long)df.bytes_per_sector *
  5484.                    (unsigned long)df.sectors_per_cluster;
  5485.        printf("There is %lu free bytes on the current drive.\n", freebytes);
  5486.      }
  5487.      else
  5488.        printf("Unable to get free disk space.\n");
  5489.  
  5490. 
  5491. File: libc.inf,  Node: _dos_getdrive,  Next: _dos_getfileattr,  Prev: _dos_getdiskfree,  Up: Alphabetical List
  5492.  
  5493. _dos_getdrive
  5494. =============
  5495.  
  5496. `_dos_getdrive'
  5497. ===============
  5498.  
  5499. Syntax
  5500. ------
  5501.  
  5502.      #include <dos.h>
  5503.      
  5504.      void _dos_getdrive(unsigned int *p_drive);
  5505.  
  5506. Description
  5507. -----------
  5508.  
  5509. This function determine the current default drive and writes this value
  5510. into P_DRIVE (1=A:, 2=B:, etc.).
  5511.  
  5512. *Note _dos_setdrive::.
  5513.  
  5514. Return Value
  5515. ------------
  5516.  
  5517. None.
  5518.  
  5519. Example
  5520. -------
  5521.  
  5522.      unsigned int drive;
  5523.      
  5524.      _dos_getdrive(&drive);
  5525.      printf("The current drive is %c:.\n", 'A' - 1 + drive);
  5526.  
  5527. 
  5528. File: libc.inf,  Node: _dos_getfileattr,  Next: _dos_getftime,  Prev: _dos_getdrive,  Up: Alphabetical List
  5529.  
  5530. _dos_getfileattr
  5531. ================
  5532.  
  5533. `_dos_getfileattr'
  5534. ==================
  5535.  
  5536. Syntax
  5537. ------
  5538.  
  5539.      #include <dos.h>
  5540.      
  5541.      unsigned int _dos_getfileattr(const char *filename, unsigned int *p_attr);
  5542.  
  5543. Description
  5544. -----------
  5545.  
  5546. This function determines the attributes of given file and fills ATTR
  5547. with it. Use the following constans (in DOS.H) to check this value.
  5548.  
  5549. `_A_NORMAL (0x00)'
  5550.      Normal file (no read/write restrictions)
  5551.  
  5552. `_A_RDONLY (0x01)'
  5553.      Read only file
  5554.  
  5555. `_A_HIDDEN (0x02)'
  5556.      Hidden file
  5557.  
  5558. `_A_SYSTEM (0x04)'
  5559.      System file
  5560.  
  5561. `_A_VOLID (0x08)'
  5562.      Volume ID file
  5563.  
  5564. `_A_SUBDIR (0x10)'
  5565.      Subdirectory
  5566.  
  5567. `_A_ARCH (0x20)'
  5568.      Archive file
  5569.  
  5570. *Note _dos_setfileattr::.
  5571.  
  5572. Return Value
  5573. ------------
  5574.  
  5575. Returns with 0 if successful and DOS error value on error (and sets
  5576. ERRNO=ENOENT).
  5577.  
  5578. Example
  5579. -------
  5580.  
  5581.      unsigned int attr;
  5582.      
  5583.      if ( !_dos_getfileattr("FOO.DAT", &attr) )
  5584.      {
  5585.        puts("FOO.DAT attributes are:");
  5586.        if ( attr & _A_ARCH )   puts("Archive");
  5587.        if ( attr & _A_RDONLY ) puts("Read only");
  5588.        if ( attr & _A_HIDDEN ) puts("Hidden");
  5589.        if ( attr & _A_SYSTEM ) puts("Is it part of DOS ?");
  5590.        if ( attr & _A_VOLID )  puts("Volume ID");
  5591.        if ( attr & _A_SUBDIR ) puts("Directory");
  5592.      }
  5593.      else
  5594.        puts("Unable to get FOO.DAT attributes.");
  5595.  
  5596. 
  5597. File: libc.inf,  Node: _dos_getftime,  Next: _dos_gettime,  Prev: _dos_getfileattr,  Up: Alphabetical List
  5598.  
  5599. _dos_getftime
  5600. =============
  5601.  
  5602. Syntax
  5603. ------
  5604.  
  5605.      #include <dos.h>
  5606.      
  5607.      unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time);
  5608.  
  5609. Description
  5610. -----------
  5611.  
  5612. This function gets the date and time of the given file and puts these
  5613. values into P_DATE and P_TIME variable. The meaning of DOS date in the
  5614. P_DATE variable is the following:
  5615.  
  5616.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0  (bits)
  5617.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  5618.      *-----------------------*   *-----------*   *---------------*
  5619.              year                    month              day
  5620.      
  5621.      year  = 0-119 (relative to 1980)
  5622.      month = 1-12
  5623.      day   = 1-31
  5624.  
  5625. The meaning of DOS time in the P_TIME variable is the following:
  5626.  
  5627.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0
  5628.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  5629.      *---------------*   *-------------------*   *---------------*
  5630.            hours              minutes                seconds
  5631.      
  5632.      hours   = 0-23
  5633.      minutes = 0-59
  5634.      seconds = 0-29 in two-second intervals
  5635.  
  5636. *Note _dos_setftime::.
  5637.  
  5638. Return Value
  5639. ------------
  5640.  
  5641. Returns 0 if successful and return DOS error on error (and sets
  5642. ERRNO=EBADF).
  5643.  
  5644. Example
  5645. -------
  5646.  
  5647.      unsigned int handle, date, time;
  5648.      
  5649.      _dos_open("FOO.DAT", O_RDWR, &handle);
  5650.      _dos_gettime(handle, &date, &time);
  5651.      _dos_close(handle);
  5652.      printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n",
  5653.             /*       year                      month              day    */
  5654.             ((date >> 9) & 0x7F) + 1980U, (date >>  5) & 0x0F, date & 0x1F,
  5655.             /*       hour                minute           second         */
  5656.             (time >> 11) & 0x1F, (time >>  5) & 0x3F, (time & 0x1F) * 2);
  5657.  
  5658. 
  5659. File: libc.inf,  Node: _dos_gettime,  Next: _dos_lock,  Prev: _dos_getftime,  Up: Alphabetical List
  5660.  
  5661. _dos_gettime
  5662. ============
  5663.  
  5664. Syntax
  5665. ------
  5666.  
  5667.      #include <dos.h>
  5668.      
  5669.      void _dos_gettime(struct dostime_t *time);
  5670.  
  5671. Description
  5672. -----------
  5673.  
  5674. This function gets the current time and fills the TIME structure with
  5675. these values.
  5676.  
  5677.      struct dostime_t {
  5678.        unsigned char hour;     /* 0-23 */
  5679.        unsigned char minute;   /* 0-59 */
  5680.        unsigned char second;   /* 0-59 */
  5681.        unsigned char hsecond;  /* 0-99 */
  5682.      };
  5683.  
  5684. *Note _dos_settime::. *Note _dos_getdate::. *Note _dos_setdate::.
  5685.  
  5686. Return Value
  5687. ------------
  5688.  
  5689. None.
  5690.  
  5691. Example
  5692. -------
  5693.  
  5694.      struct dostime_t time;
  5695.      
  5696.      _dos_gettime(&time);
  5697.  
  5698. 
  5699. File: libc.inf,  Node: _dos_lock,  Next: _dos_open,  Prev: _dos_gettime,  Up: Alphabetical List
  5700.  
  5701. _dos_lock
  5702. =========
  5703.  
  5704. Syntax
  5705. ------
  5706.  
  5707.      #include <io.h>
  5708.      
  5709.      _dos_lock(int _fd, long _offset, long _length)
  5710.  
  5711. Description
  5712. -----------
  5713.  
  5714. Adds an advisory lock to the specified region of the file.
  5715.  
  5716. Return Value
  5717. ------------
  5718.  
  5719. Zero if the lock was added, nonzero otherwise.
  5720.  
  5721. 
  5722. File: libc.inf,  Node: _dos_open,  Next: _dos_read,  Prev: _dos_lock,  Up: Alphabetical List
  5723.  
  5724. _dos_open
  5725. =========
  5726.  
  5727. Syntax
  5728. ------
  5729.  
  5730.      #include <fcntl.h>
  5731.      #include <share.h>
  5732.      #include <dos.h>
  5733.      
  5734.      unsigned int _dos_open(const char *filename, unsigned short mode, int *handle);
  5735.  
  5736. Description
  5737. -----------
  5738.  
  5739. This is a direct connection to the MS-DOS open function call (%ah =
  5740. 0x3D).  This function opens the given file with the given mode and puts
  5741. handle of file into HANDLE if openning is successful.  Meaning of MODE
  5742. parameter is the following:
  5743.  
  5744. Access mode bits (in FCNTL.H):
  5745. `O_RDONLY (_O_RDONLY) 0x00'
  5746.      Open for read only
  5747.  
  5748. `O_WRONLY (_O_WRONLY) 0x01'
  5749.      Open for write only
  5750.  
  5751. `O_RDWR (_O_RDWR) 0x02'
  5752.      Open for read and write
  5753.  
  5754. Sharing mode bits (in SHARE.H):
  5755. `SH_COMPAT (_SH_COMPAT) 0x00'
  5756.      Compatibility mode
  5757.  
  5758. `SH_DENYRW (_SH_DENYRW) 0x10'
  5759.      Deny read/write mode
  5760.  
  5761. `SH_DENYWR (_SH_DENYWR) 0x20'
  5762.      Deny write mode
  5763.  
  5764. `SH_DENYRD (_SH_DENYRD) 0x30'
  5765.      Deny read mode
  5766.  
  5767. `SH_DENYNO (_SH_DENYNO) 0x40'
  5768.      Deny none mode
  5769.  
  5770. Inheritance bits (in FCNTL.H):
  5771. `O_NOINHERIT (_O_NOINHERIT) 0x80'
  5772.      File is not inherited by child process
  5773.  
  5774. *Note _dos_creat::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  5775. _dos_write::. *Note _dos_close::
  5776.  
  5777. Return Value
  5778. ------------
  5779.  
  5780. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  5781. EACCES, EINVAL, EMFILE or ENOENT).
  5782.  
  5783. Example
  5784. -------
  5785.  
  5786.      int handle;
  5787.      
  5788.      if ( !_dos_open("FOO.DAT", O_RDWR, &handle) )
  5789.         puts("Wow, file opening was successful !");
  5790.  
  5791. 
  5792. File: libc.inf,  Node: _dos_read,  Next: _dos_setdate,  Prev: _dos_open,  Up: Alphabetical List
  5793.  
  5794. _dos_read
  5795. =========
  5796.  
  5797. Syntax
  5798. ------
  5799.  
  5800.      #include <dos.h>
  5801.      
  5802.      unsigned int _dos_read(int handle, void *buffer, unsigned int count, unsigned int *result);
  5803.  
  5804. Description
  5805. -----------
  5806.  
  5807. This is a direct connection to the MS-DOS read function call (%ah =
  5808. 0x3F).  No conversion is done on the data; it is read as raw binary
  5809. data. This function reads from HANDLE into BUFFER COUNT bytes.  COUNT
  5810. value may be arbitrary size (for example > 64KB). It puts number of
  5811. bytes read into RESULT if reading is successful.
  5812.  
  5813. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  5814. _dos_write::. *Note _dos_close::
  5815.  
  5816. Return Value
  5817. ------------
  5818.  
  5819. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  5820. EACCES or EBADF)
  5821.  
  5822. Example
  5823. -------
  5824.  
  5825.      int handle;
  5826.      unsigned int result;
  5827.      char *filebuffer;
  5828.      
  5829.      if ( !_dos_open("FOO.DAT", O_RDONLY, &handle) )
  5830.      {
  5831.         puts("FOO.DAT openning was successful.");
  5832.         if ( (filebuffer = malloc(130000)) != NULL )
  5833.         {
  5834.           if ( !_dos_read(handle, buffer, 130000, &result) )
  5835.             printf("%u bytes read from FOO.DAT.\n", result);
  5836.           else
  5837.             puts("Reading error.");
  5838.           ...
  5839.           /* Do something with filebuffer. */
  5840.           ...
  5841.         }
  5842.         _dos_close(handle);
  5843.      }
  5844.  
  5845. 
  5846. File: libc.inf,  Node: _dos_setdate,  Next: _dos_setdrive,  Prev: _dos_read,  Up: Alphabetical List
  5847.  
  5848. _dos_setdate
  5849. ============
  5850.  
  5851. Syntax
  5852. ------
  5853.  
  5854.      #include <dos.h>
  5855.      
  5856.      unsigned int _dos_setdate(struct dosdate_t *date);
  5857.  
  5858. Description
  5859. -----------
  5860.  
  5861. This function sets the current date. The DOSDATE_T structure is as
  5862. follows:
  5863.  
  5864.      struct dosdate_t {
  5865.        unsigned char  day;       /* 1-31          */
  5866.        unsigned char  month;     /* 1-12          */
  5867.        unsigned short year;      /* 1980-2099     */
  5868.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  5869.      };
  5870.  
  5871. DAYOFWEEK field has no effect at this function call.
  5872.  
  5873. *Note _dos_getdate::. *Note _dos_gettime::. *Note _dos_settime::.
  5874.  
  5875. Return Value
  5876. ------------
  5877.  
  5878. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  5879.  
  5880. Example
  5881. -------
  5882.  
  5883.      struct dosdate_t date;
  5884.      
  5885.      date->year  = 1999;
  5886.      date->month = 12;
  5887.      date->day   = 31;
  5888.      if ( !_dos_setdate(&date) )
  5889.        puts("It was a valid date.");
  5890.  
  5891. 
  5892. File: libc.inf,  Node: _dos_setdrive,  Next: _dos_setfileattr,  Prev: _dos_setdate,  Up: Alphabetical List
  5893.  
  5894. _dos_setdrive
  5895. =============
  5896.  
  5897. `_dos_setdrive'
  5898. ===============
  5899.  
  5900. Syntax
  5901. ------
  5902.  
  5903.      #include <dos.h>
  5904.      
  5905.      void _dos_setdrive(unsigned int drive, unsigned int *p_drives);
  5906.  
  5907. Description
  5908. -----------
  5909.  
  5910. This function set the current default drive based on DRIVE (1=A:, 2=B:,
  5911. etc.) and determines the number of available logical drives and fills
  5912. P_DRIVES with it.
  5913.  
  5914. *Note _dos_getdrive::.
  5915.  
  5916. Return Value
  5917. ------------
  5918.  
  5919. None.
  5920.  
  5921. Example
  5922. -------
  5923.  
  5924.      unsigned int available_drives;
  5925.      
  5926.      /* The current drive will be A: */
  5927.      _dos_setdrive(1, &available_drives);
  5928.      printf("Number of available logical drives %u.\n", available_drives);
  5929.  
  5930. 
  5931. File: libc.inf,  Node: _dos_setfileattr,  Next: _dos_setftime,  Prev: _dos_setdrive,  Up: Alphabetical List
  5932.  
  5933. _dos_setfileattr
  5934. ================
  5935.  
  5936. `_dos_setfileattr'
  5937. ==================
  5938.  
  5939. Syntax
  5940. ------
  5941.  
  5942.      #include <dos.h>
  5943.      
  5944.      unsigned int _dos_setfileattr(const char *filename, unsigned int attr);
  5945.  
  5946. Description
  5947. -----------
  5948.  
  5949. This function sets the attributes of given file. Use the following
  5950. constans in DOS.H to create ATTR parameter:
  5951.  
  5952. `_A_NORMAL (0x00)'
  5953.      Normal file (no read/write restrictions)
  5954.  
  5955. `_A_RDONLY (0x01)'
  5956.      Read only file
  5957.  
  5958. `_A_HIDDEN (0x02)'
  5959.      Hidden file
  5960.  
  5961. `_A_SYSTEM (0x04)'
  5962.      System file
  5963.  
  5964. `_A_VOLID (0x08)'
  5965.      Volume ID file
  5966.  
  5967. `_A_SUBDIR (0x10)'
  5968.      Subdirectory
  5969.  
  5970. `_A_ARCH (0x20)'
  5971.      Archive file
  5972.  
  5973. *Note _dos_getfileattr::.
  5974.  
  5975. Return Value
  5976. ------------
  5977.  
  5978. Returns with 0 if successful and DOS error value on error (and sets
  5979. ERRNO to ENOENT or EACCES).
  5980.  
  5981. Example
  5982. -------
  5983.  
  5984.      if ( !_dos_setfileattr("FOO.DAT", _A_RDONLY | _A_HIDDEN) )
  5985.         puts("FOO.DAT is hidden now.");
  5986.  
  5987. 
  5988. File: libc.inf,  Node: _dos_setftime,  Next: _dos_settime,  Prev: _dos_setfileattr,  Up: Alphabetical List
  5989.  
  5990. _dos_setftime
  5991. =============
  5992.  
  5993. Syntax
  5994. ------
  5995.  
  5996.      #include <dos.h>
  5997.      
  5998.      unsigned int _dos_setftime(int handle, unsigned int date, unsigned time);
  5999.  
  6000. Description
  6001. -----------
  6002.  
  6003. This function sets the date and time of the given file. The meaning of
  6004. DOS date in the DATE variable is the following:
  6005.  
  6006.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  6007.      x x x x x x x x x x x x x x x x
  6008.      *-----------* *-----* *-------*
  6009.          year       month     day
  6010.      
  6011.      year  = 0-119 (relative to 1980)
  6012.      month = 1-12
  6013.      day   = 1-31
  6014.  
  6015. The meaning of DOS time in the TIME variable is the following:
  6016.  
  6017.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  6018.      x x x x x x x x x x x x x x x x
  6019.      *-------* *---------* *-------*
  6020.        hours     minutes    seconds
  6021.      
  6022.      hours   = 0-23
  6023.      minutes = 0-59
  6024.      seconds = 0-29 in two-second intervals
  6025.  
  6026. *Note _dos_getftime::.
  6027.  
  6028. Return Value
  6029. ------------
  6030.  
  6031. Returns 0 if successful and return DOS error on error (and sets
  6032. ERRNO=EBADF).
  6033.  
  6034. Example
  6035. -------
  6036.  
  6037.      struct dosdate_t d;
  6038.      struct dostime_t t;
  6039.      unsigned int handle, date, time;
  6040.      
  6041.      _dos_open("FOO.DAT", O_RDWR, &handle);
  6042.      _dos_getdate(&d);
  6043.      _dos_gettime(&t);
  6044.      date = ((d.year - 1980) << 9) | (d.month << 5) | d.day;
  6045.      time = (t.hour << 11) | (t.minute << 5) | (t.second / 2);
  6046.      _dos_settime(handle, date, time);
  6047.      _dos_close(handle);
  6048.  
  6049. 
  6050. File: libc.inf,  Node: _dos_settime,  Next: _dos_unlock,  Prev: _dos_setftime,  Up: Alphabetical List
  6051.  
  6052. _dos_settime
  6053. ============
  6054.  
  6055. Syntax
  6056. ------
  6057.  
  6058.      #include <dos.h>
  6059.      
  6060.      void _dos_settime(struct dostime_t *time);
  6061.  
  6062. Description
  6063. -----------
  6064.  
  6065. This function sets the current time. The TIME structure is as follows:
  6066.  
  6067.      struct dostime_t {
  6068.        unsigned char hour;     /* 0-23 */
  6069.        unsigned char minute;   /* 0-59 */
  6070.        unsigned char second;   /* 0-59 */
  6071.        unsigned char hsecond;  /* 0-99 */
  6072.      };
  6073.  
  6074. *Note _dos_gettime::. *Note _dos_getdate::. *Note _dos_setdate::.
  6075.  
  6076. Return Value
  6077. ------------
  6078.  
  6079. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  6080.  
  6081. Example
  6082. -------
  6083.  
  6084.      struct dostime_t time;
  6085.      
  6086.      time->hour    = 23;
  6087.      time->minute  = 59;
  6088.      time->second  = 59;
  6089.      time->hsecond = 99;
  6090.      if ( !_dos_settime(&time) )
  6091.        puts("It was a valid time.");
  6092.  
  6093. 
  6094. File: libc.inf,  Node: _dos_unlock,  Next: _dos_write,  Prev: _dos_settime,  Up: Alphabetical List
  6095.  
  6096. _dos_unlock
  6097. ===========
  6098.  
  6099. Syntax
  6100. ------
  6101.  
  6102.      #include <io.h>
  6103.      
  6104.      _dos_unlock(int _fd, long _offset, long _length)
  6105.  
  6106. Description
  6107. -----------
  6108.  
  6109. Removes an advisory lock to the specified region of the file.
  6110.  
  6111. Return Value
  6112. ------------
  6113.  
  6114. Zero if the lock was removed, nonzero otherwise.
  6115.  
  6116. 
  6117. File: libc.inf,  Node: _dos_write,  Next: _doscan,  Prev: _dos_unlock,  Up: Alphabetical List
  6118.  
  6119. _dos_write
  6120. ==========
  6121.  
  6122. Syntax
  6123. ------
  6124.  
  6125.      #include <dos.h>
  6126.      
  6127.      unsigned int _dos_write(int handle, const void *buffer, unsigned int count,
  6128.                              unsigned int *result);
  6129.  
  6130. Description
  6131. -----------
  6132.  
  6133. This is a direct connection to the MS-DOS write function call (%ah =
  6134. 0x40).  No conversion is done on the data; it is written as raw binary
  6135. data. This function writes COUNT bytes from BUFFER to HANDLE.  COUNT
  6136. value may be arbitrary size (e.g. > 64KB). It puts number of bytes
  6137. written into RESULT if writing is successful.
  6138.  
  6139. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  6140. _dos_read::. *Note _dos_close::
  6141.  
  6142. Return Value
  6143. ------------
  6144.  
  6145. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  6146. EACCES or EBADF)
  6147.  
  6148. Example
  6149. -------
  6150.  
  6151.      int handle;
  6152.      unsigned int result;
  6153.      char *filebuffer;
  6154.      
  6155.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  6156.      {
  6157.         puts("FOO.DAT creating was successful.");
  6158.         if ( (filebuffer = malloc(130000)) != NULL )
  6159.         {
  6160.           ...
  6161.           /* Put something into filebuffer. */
  6162.           ...
  6163.           if ( !_dos_write(handle, buffer, 130000, &result) )
  6164.             printf("%u bytes written into FOO.DAT.", result);
  6165.           else
  6166.             puts("Writing error.");
  6167.         }
  6168.         _dos_close(handle);
  6169.      }
  6170.  
  6171. 
  6172. File: libc.inf,  Node: _doscan,  Next: dosexterr,  Prev: _dos_write,  Up: Alphabetical List
  6173.  
  6174. _doscan
  6175. =======
  6176.  
  6177. Syntax
  6178. ------
  6179.  
  6180.      #include <stdio.h>
  6181.      
  6182.      int _doscan(FILE *file, const char *format, void **ptrs_to_args);
  6183.  
  6184. Description
  6185. -----------
  6186.  
  6187. This is an internal function that is used by all the `scanf' style
  6188. functions, which simply pass their format, arguments, and stream to this
  6189. function.
  6190.  
  6191. *Note scanf:: for a discussion of the allowed formats and arguments.
  6192.  
  6193. Return Value
  6194. ------------
  6195.  
  6196. The number of characters successfully scanned is returned, or -1 on
  6197. error.
  6198.  
  6199. Example
  6200. -------
  6201.  
  6202.      int x, y;
  6203.      int *args[2];
  6204.      args[0] = &x;
  6205.      args[1] = &y;
  6206.      _doscan(stdin, "%d %d", args);
  6207.  
  6208. 
  6209. File: libc.inf,  Node: dosexterr,  Next: dosmemget,  Prev: _doscan,  Up: Alphabetical List
  6210.  
  6211. dosexterr
  6212. =========
  6213.  
  6214. Syntax
  6215. ------
  6216.  
  6217.      #include <dos.h>
  6218.      
  6219.      int dosexterr(struct DOSERROR *p_error);
  6220.  
  6221. Description
  6222. -----------
  6223.  
  6224. This function reads extended error information from DOS and fills
  6225. P_ERROR structure.
  6226.  
  6227.      struct _DOSERROR {
  6228.        int  exterror;
  6229.        char class;
  6230.        char action;
  6231.        char locus;
  6232.      };
  6233.  
  6234. Values for extended error code (EXTERROR field):
  6235.      00h (0)   no error
  6236.      01h (1)   function number invalid
  6237.      02h (2)   file not found
  6238.      03h (3)   path not found
  6239.      04h (4)   too many open files (no handles available)
  6240.      05h (5)   access denied
  6241.      06h (6)   invalid handle
  6242.      07h (7)   memory control block destroyed
  6243.      08h (8)   insufficient memory
  6244.      09h (9)   memory block address invalid
  6245.      0Ah (10)  environment invalid (usually >32K in length)
  6246.      0Bh (11)  format invalid
  6247.      0Ch (12)  access code invalid
  6248.      0Dh (13)  data invalid
  6249.      0Eh (14)  reserved
  6250.      0Fh (15)  invalid drive
  6251.      10h (16)  attempted to remove current directory
  6252.      11h (17)  not same device
  6253.      12h (18)  no more files
  6254.      13h (19)  disk write-protected
  6255.      14h (20)  unknown unit
  6256.      15h (21)  drive not ready
  6257.      16h (22)  unknown command
  6258.      17h (23)  data error (CRC)
  6259.      18h (24)  bad request structure length
  6260.      19h (25)  seek error
  6261.      1Ah (26)  unknown media type (non-DOS disk)
  6262.      1Bh (27)  sector not found
  6263.      1Ch (28)  printer out of paper
  6264.      1Dh (29)  write fault
  6265.      1Eh (30)  read fault
  6266.      1Fh (31)  general failure
  6267.      20h (32)  sharing violation
  6268.      21h (33)  lock violation
  6269.      22h (34)  disk change invalid (ES:DI -> media ID structure)(see below)
  6270.      23h (35)  FCB unavailable
  6271.      24h (36)  sharing buffer overflow
  6272.      25h (37)  (DOS 4+) code page mismatch
  6273.      26h (38)  (DOS 4+) cannot complete file operation (out of input)
  6274.      27h (39)  (DOS 4+) insufficient disk space
  6275.      28h-31h   reserved
  6276.      32h (50)  network request not supported
  6277.      33h (51)  remote computer not listening
  6278.      34h (52)  duplicate name on network
  6279.      35h (53)  network name not found
  6280.      36h (54)  network busy
  6281.      37h (55)  network device no longer exists
  6282.      38h (56)  network BIOS command limit exceeded
  6283.      39h (57)  network adapter hardware error
  6284.      3Ah (58)  incorrect response from network
  6285.      3Bh (59)  unexpected network error
  6286.      3Ch (60)  incompatible remote adapter
  6287.      3Dh (61)  print queue full
  6288.      3Eh (62)  queue not full
  6289.      3Fh (63)  not enough space to print file
  6290.      40h (64)  network name was deleted
  6291.      41h (65)  network: Access denied
  6292.      42h (66)  network device type incorrect
  6293.      43h (67)  network name not found
  6294.      44h (68)  network name limit exceeded
  6295.      45h (69)  network BIOS session limit exceeded
  6296.      46h (70)  temporarily paused
  6297.      47h (71)  network request not accepted
  6298.      48h (72)  network print/disk redirection paused
  6299.      49h (73)  network software not installed
  6300.                (LANtastic) invalid network version
  6301.      4Ah (74)  unexpected adapter close
  6302.                (LANtastic) account expired
  6303.      4Bh (75)  (LANtastic) password expired
  6304.      4Ch (76)  (LANtastic) login attempt invalid at this time
  6305.      4Dh (77)  (LANtastic v3+) disk limit exceeded on network node
  6306.      4Eh (78)  (LANtastic v3+) not logged in to network node
  6307.      4Fh (79)  reserved
  6308.      50h (80)  file exists
  6309.      51h (81)  reserved
  6310.      52h (82)  cannot make directory
  6311.      53h (83)  fail on INT 24h
  6312.      54h (84)  (DOS 3.3+) too many redirections
  6313.      55h (85)  (DOS 3.3+) duplicate redirection
  6314.      56h (86)  (DOS 3.3+) invalid password
  6315.      57h (87)  (DOS 3.3+) invalid parameter
  6316.      58h (88)  (DOS 3.3+) network write fault
  6317.      59h (89)  (DOS 4+) function not supported on network
  6318.      5Ah (90)  (DOS 4+) required system component not installed
  6319.      64h (100) (MSCDEX) unknown error
  6320.      65h (101) (MSCDEX) not ready
  6321.      66h (102) (MSCDEX) EMS memory no longer valid
  6322.      67h (103) (MSCDEX) not High Sierra or ISO-9660 format
  6323.      68h (104) (MSCDEX) door open
  6324.  
  6325. Values for error class (CLASS field):
  6326.      01h  out of resource (storage space or I/O channels)
  6327.      02h  temporary situation (file or record lock)
  6328.      03h  authorization (denied access)
  6329.      04h  internal (system software bug)
  6330.      05h  hardware failure
  6331.      06h  system failure (configuration file missing or incorrect)
  6332.      07h  application program error
  6333.      08h  not found
  6334.      09h  bad format
  6335.      0Ah  locked
  6336.      0Bh  media error
  6337.      0Ch  already exists
  6338.      0Dh  unknown
  6339.  
  6340. Values for suggested action (ACTION field):
  6341.      01h  retry
  6342.      02h  delayed retry
  6343.      03h  prompt user to reenter input
  6344.      04h  abort after cleanup
  6345.      05h  immediate abort
  6346.      06h  ignore
  6347.      07h  retry after user intervention
  6348.  
  6349. Values for error locus (LOCUS field):
  6350.      01h  unknown or not appropriate
  6351.      02h  block device (disk error)
  6352.      03h  network related
  6353.      04h  serial device (timeout)
  6354.      05h  memory related
  6355.  
  6356. Return Value
  6357. ------------
  6358.  
  6359. Returns with the extended error code.
  6360.  
  6361. Example
  6362. -------
  6363.  
  6364.      #include <stdio.h>
  6365.      #include <dos.h>
  6366.      
  6367.      void main(void)
  6368.      {
  6369.        FILE *fp;
  6370.        struct _DOSERROR de;
  6371.      
  6372.        fp = fopen("EXAMPLE.DAT","r");
  6373.        if ( fp == NULL )
  6374.        {
  6375.          puts("Unable to open file for reading.");
  6376.          _dosexterr(&de);
  6377.          printf("Extended DOS error information:\n");
  6378.          printf("Extended error: %i\n",de.exterror);
  6379.          printf("Class:          %x\n",de.class);
  6380.          printf("Action:         %x\n",de.action);
  6381.          printf("Error Locus:    %x\n",de.locus);
  6382.        }
  6383.      }
  6384.  
  6385. 
  6386. File: libc.inf,  Node: dosmemget,  Next: dosmemgetb,  Prev: dosexterr,  Up: Alphabetical List
  6387.  
  6388. dosmemget
  6389. =========
  6390.  
  6391. Syntax
  6392. ------
  6393.  
  6394.      #include <sys/movedata.h>
  6395.      
  6396.      void dosmemget(int offset, int length, void *buffer);
  6397.  
  6398. Description
  6399. -----------
  6400.  
  6401. This function transfers data from MS-DOS's conventional memory space to
  6402. the program's virtual address space.  The OFFSET is a physical address,
  6403. which can be computed from a real-mode segment/offset pair as follows:
  6404.  
  6405.      offset = segment * 16 + offset;
  6406.  
  6407. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  6408. to somewhere in your virtual address space (such as memory obtained
  6409. from `malloc') where the data will go.
  6410.  
  6411. Return Value
  6412. ------------
  6413.  
  6414. None.
  6415.  
  6416. Example
  6417. -------
  6418.  
  6419.      unsigned short shift_state;
  6420.      dosmemget(0x417, 2, &shift_state);
  6421.      if (shift_state & 0x0004)
  6422.        /* Ctrl key pressed */;
  6423.  
  6424. 
  6425. File: libc.inf,  Node: dosmemgetb,  Next: dosmemgetl,  Prev: dosmemget,  Up: Alphabetical List
  6426.  
  6427. dosmemgetb
  6428. ==========
  6429.  
  6430. Syntax
  6431. ------
  6432.  
  6433.      #include <sys/movedata.h>
  6434.      
  6435.      void _dosmemgetb(unsigned long offset, size_t xfers, void *buffer);
  6436.  
  6437. Description
  6438. -----------
  6439.  
  6440. This function transfers data from MS-DOS's conventional memory space to
  6441. the program's virtual address space, using only byte transfers.  The
  6442. OFFSET is a physical address, which can be computed from a real-mode
  6443. segment/offset pair as follows:
  6444.  
  6445.      offset = segment * 16 + offset;
  6446.  
  6447. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  6448. to somewhere in your virtual address space (such as memory obtained
  6449. from `malloc') where the data will go.
  6450.  
  6451. Return Value
  6452. ------------
  6453.  
  6454. None.
  6455.  
  6456. Example
  6457. -------
  6458.  
  6459.      unsigned short shift_state;
  6460.      dosmemgetb(0x417, 2, &shift_state);
  6461.      if (shift_state & 0x0004)
  6462.        /* Ctrl key pressed */;
  6463.  
  6464. 
  6465. File: libc.inf,  Node: dosmemgetl,  Next: dosmemgetw,  Prev: dosmemgetb,  Up: Alphabetical List
  6466.  
  6467. dosmemgetl
  6468. ==========
  6469.  
  6470. Syntax
  6471. ------
  6472.  
  6473.      #include <sys/movedata.h>
  6474.      
  6475.      void _dosmemgetl(unsigned long offset, size_t xfers, void *buffer);
  6476.  
  6477. Description
  6478. -----------
  6479.  
  6480. This function transfers data from MS-DOS's conventional memory space to
  6481. the program's virtual address space, using only long-word (32-bit)
  6482. transfers.  The OFFSET is a physical address, which can be computed
  6483. from a real-mode segment/offset pair as follows:
  6484.  
  6485.      offset = segment * 16 + offset;
  6486.  
  6487. The COUNT is the number of long-words to transfer, and BUFFER is a
  6488. pointer to somewhere in your virtual address space (such as memory
  6489. obtained from `malloc') where the data will go.
  6490.  
  6491. Return Value
  6492. ------------
  6493.  
  6494. None.
  6495.  
  6496. Example
  6497. -------
  6498.  
  6499.      unsigned long shift_state;
  6500.      dosmemgetl(0x417, 1, &shift_state);
  6501.      if (shift_state & 0x0004)
  6502.        /* Ctrl key pressed */;
  6503.  
  6504. 
  6505. File: libc.inf,  Node: dosmemgetw,  Next: dosmemput,  Prev: dosmemgetl,  Up: Alphabetical List
  6506.  
  6507. dosmemgetw
  6508. ==========
  6509.  
  6510. Syntax
  6511. ------
  6512.  
  6513.      #include <sys/movedata.h>
  6514.      
  6515.      void _dosmemgetw(unsigned long offset, size_t xfers, void *buffer);
  6516.  
  6517. Description
  6518. -----------
  6519.  
  6520. This function transfers data from MS-DOS's conventional memory space to
  6521. the program's virtual address space, using only short-word (16-bit)
  6522. transfers.  The OFFSET is a physical address, which can be computed
  6523. from a real-mode segment/offset pair as follows:
  6524.  
  6525.      offset = segment * 16 + offset;
  6526.  
  6527. The XFERS is the number of words to transfer, and BUFFER is a pointer
  6528. to somewhere in your virtual address space (such as memory obtained
  6529. from `malloc') where the data will go.
  6530.  
  6531. Return Value
  6532. ------------
  6533.  
  6534. None.
  6535.  
  6536. Example
  6537. -------
  6538.  
  6539.      unsigned short shift_state;
  6540.      dosmemgetw(0x417, 1, &shift_state);
  6541.      if (shift_state & 0x0004)
  6542.        /* Ctrl key pressed */;
  6543.  
  6544. 
  6545. File: libc.inf,  Node: dosmemput,  Next: dosmemputb,  Prev: dosmemgetw,  Up: Alphabetical List
  6546.  
  6547. dosmemput
  6548. =========
  6549.  
  6550. Syntax
  6551. ------
  6552.  
  6553.      #include <sys/movedata.h>
  6554.      
  6555.      void dosmemput(const void *buffer, int length, int offset);
  6556.  
  6557. Description
  6558. -----------
  6559.  
  6560. This function transfers data from the program's virtual address space to
  6561. MS-DOS's conventional memory space.  The OFFSET is a physical address,
  6562. which can be computed from a real-mode segment/offset pair as follows:
  6563.  
  6564.      offset = segment * 16 + offset;
  6565.  
  6566. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  6567. to somewhere in your virtual address space (such as memory obtained
  6568. from `malloc') where the data will come from.
  6569.  
  6570. Return Value
  6571. ------------
  6572.  
  6573. None.
  6574.  
  6575. Example
  6576. -------
  6577.  
  6578.      unsigned short save_screen[25][80];
  6579.      dosmemput(save_screen, 80*2*25, 0xb8000);
  6580.  
  6581. 
  6582. File: libc.inf,  Node: dosmemputb,  Next: dosmemputl,  Prev: dosmemput,  Up: Alphabetical List
  6583.  
  6584. dosmemputb
  6585. ==========
  6586.  
  6587. Syntax
  6588. ------
  6589.  
  6590.      #include <sys/movedata.h>
  6591.      
  6592.      void _dosmemputb(const void *buffer, size_t xfers, unsigned long offset);
  6593.  
  6594. Description
  6595. -----------
  6596.  
  6597. This function transfers data from the program's virtual address space
  6598. to MS-DOS's conventional memory space, using only byte (8-bit)
  6599. transfers.  The OFFSET is a physical address, which can be computed
  6600. from a real-mode segment/offset pair as follows:
  6601.  
  6602.      offset = segment * 16 + offset;
  6603.  
  6604. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  6605. to somewhere in your virtual address space (such as memory obtained
  6606. from `malloc') where the data will come from.
  6607.  
  6608. Return Value
  6609. ------------
  6610.  
  6611. None.
  6612.  
  6613. Example
  6614. -------
  6615.  
  6616.      unsigned short save_screen[25][80];
  6617.      dosmemputb(save_screen, 0xb8000, 80*2*25);
  6618.  
  6619. 
  6620. File: libc.inf,  Node: dosmemputl,  Next: dosmemputw,  Prev: dosmemputb,  Up: Alphabetical List
  6621.  
  6622. dosmemputl
  6623. ==========
  6624.  
  6625. Syntax
  6626. ------
  6627.  
  6628.      #include <sys/movedata.h>
  6629.      
  6630.      void _dosmemputl(const void *buffer, size_t xfers unsigned long offset);
  6631.  
  6632. Description
  6633. -----------
  6634.  
  6635. This function transfers data from the program's virtual address space
  6636. to MS-DOS's conventional memory space, using only long-word (32-bit)
  6637. transfers.  The OFFSET is a physical address, which can be computed
  6638. from a real-mode segment/offset pair as follows:
  6639.  
  6640.      offset = segment * 16 + offset;
  6641.  
  6642. The XFERS is the number of long-words to transfer, and BUFFER is a
  6643. pointer to somewhere in your virtual address space (such as memory
  6644. obtained from `malloc') where the data will come from.
  6645.  
  6646. Return Value
  6647. ------------
  6648.  
  6649. None.
  6650.  
  6651. Example
  6652. -------
  6653.  
  6654.      unsigned short save_screen[25][80];
  6655.      dosmemputl(save_screen, 0xb8000, 40*25);
  6656.  
  6657. 
  6658. File: libc.inf,  Node: dosmemputw,  Next: DPMI Overview,  Prev: dosmemputl,  Up: Alphabetical List
  6659.  
  6660. dosmemputw
  6661. ==========
  6662.  
  6663. Syntax
  6664. ------
  6665.  
  6666.      #include <sys/movedata.h>
  6667.      
  6668.      void _dosmemputw(const void *buffer, size_t xfers, unsigned long offset);
  6669.  
  6670. Description
  6671. -----------
  6672.  
  6673. This function transfers data from the program's virtual address space
  6674. to MS-DOS's conventional memory space, using only short-word (16-bit)
  6675. transfers.  The OFFSET is a physical address, which can be computed
  6676. from a real-mode segment/offset pair as follows:
  6677.  
  6678.      offset = segment * 16 + offset;
  6679.  
  6680. The XFERS is the number of short-words to transfer, and BUFFER is a
  6681. pointer to somewhere in your virtual address space (such as memory
  6682. obtained from `malloc') where the data will come from.
  6683.  
  6684. Return Value
  6685. ------------
  6686.  
  6687. None.
  6688.  
  6689. Example
  6690. -------
  6691.  
  6692.      unsigned short save_screen[25][80];
  6693.      dosmemputw(save_screen, 0xb8000, 80*25);
  6694.  
  6695. 
  6696. File: libc.inf,  Node: DPMI Overview,  Next: DPMI Specification,  Prev: dosmemputw,  Up: Alphabetical List
  6697.  
  6698. DPMI Overview
  6699. =============
  6700.  
  6701.      extern unsigned short __dpmi_error;
  6702.  
  6703. For most functions, the error returned from the DPMI server is stored
  6704. in this variable.
  6705.  
  6706.      typedef struct {
  6707.        unsigned short offset16;
  6708.        unsigned short segment;
  6709.      } __dpmi_raddr;
  6710.  
  6711. This structure is used to hold a real-mode address, which consists of a
  6712. segment:offset pair.
  6713.  
  6714.      typedef struct {
  6715.        unsigned long  offset32;
  6716.        unsigned short selector;
  6717.      } __dpmi_paddr;
  6718.  
  6719. This structure is used to hold a protected-mode address, which consists
  6720. of a selector:offset pair.
  6721.  
  6722.      typedef struct {
  6723.        unsigned long handle;            /* 0, 2 */
  6724.        unsigned long size;     /* or count */    /* 4, 6 */
  6725.        unsigned long address;        /* 8, 10 */
  6726.      } __dpmi_meminfo;
  6727.  
  6728. This structure is used by many functions that need to refer to blocks
  6729. of 32-bit memory.  The `size' field doubles as a count for those
  6730. operations that want a count of something, or return a count.
  6731.  
  6732.      typedef union {
  6733.        struct {
  6734.          unsigned long edi;
  6735.          unsigned long esi;
  6736.          unsigned long ebp;
  6737.          unsigned long res;
  6738.          unsigned long ebx;
  6739.          unsigned long edx;
  6740.          unsigned long ecx;
  6741.          unsigned long eax;
  6742.        } d;
  6743.        struct {
  6744.          unsigned short di, di_hi;
  6745.          unsigned short si, si_hi;
  6746.          unsigned short bp, bp_hi;
  6747.          unsigned short res, res_hi;
  6748.          unsigned short bx, bx_hi;
  6749.          unsigned short dx, dx_hi;
  6750.          unsigned short cx, cx_hi;
  6751.          unsigned short ax, ax_hi;
  6752.          unsigned short flags;
  6753.          unsigned short es;
  6754.          unsigned short ds;
  6755.          unsigned short fs;
  6756.          unsigned short gs;
  6757.          unsigned short ip;
  6758.          unsigned short cs;
  6759.          unsigned short sp;
  6760.          unsigned short ss;
  6761.        } x;
  6762.        struct {
  6763.          unsigned char edi[4];
  6764.          unsigned char esi[4];
  6765.          unsigned char ebp[4];
  6766.          unsigned char res[4];
  6767.          unsigned char bl, bh, ebx_b2, ebx_b3;
  6768.          unsigned char dl, dh, edx_b2, edx_b3;
  6769.          unsigned char cl, ch, ecx_b2, ecx_b3;
  6770.          unsigned char al, ah, eax_b2, eax_b3;
  6771.        } h;
  6772.      } __dpmi_regs;
  6773.  
  6774. This structure is used by functions that pass register information,
  6775. such as simulating real-mode calls.
  6776.  
  6777.      typedef struct {
  6778.        unsigned char  major;
  6779.        unsigned char  minor;
  6780.        unsigned short flags;
  6781.        unsigned char  cpu;
  6782.        unsigned char  master_pic;
  6783.        unsigned char  slave_pic;
  6784.      } __dpmi_version_ret;
  6785.  
  6786. This structure is used to return version information to the program.
  6787.  
  6788.      typedef struct {
  6789.        unsigned long largest_available_free_block_in_bytes;
  6790.        unsigned long maximum_unlocked_page_allocation_in_pages;
  6791.        unsigned long maximum_locked_page_allocation_in_pages;
  6792.        unsigned long linear_address_space_size_in_pages;
  6793.        unsigned long total_number_of_unlocked_pages;
  6794.        unsigned long total_number_of_free_pages;
  6795.        unsigned long total_number_of_physical_pages;
  6796.        unsigned long free_linear_address_space_in_pages;
  6797.        unsigned long size_of_paging_file_partition_in_pages;
  6798.        unsigned long reserved[3];
  6799.      } __dpmi_free_mem_info;
  6800.  
  6801. This structure is used to return information about the state of virtual
  6802. memory in the system.
  6803.  
  6804.      typedef struct {
  6805.        unsigned long total_allocated_bytes_of_physical_memory_host;
  6806.        unsigned long total_allocated_bytes_of_virtual_memory_host;
  6807.        unsigned long total_available_bytes_of_virtual_memory_host;
  6808.        unsigned long total_allocated_bytes_of_virtual_memory_vcpu;
  6809.        unsigned long total_available_bytes_of_virtual_memory_vcpu;
  6810.        unsigned long total_allocated_bytes_of_virtual_memory_client;
  6811.        unsigned long total_available_bytes_of_virtual_memory_client;
  6812.        unsigned long total_locked_bytes_of_memory_client;
  6813.        unsigned long max_locked_bytes_of_memory_client;
  6814.        unsigned long highest_linear_address_available_to_client;
  6815.        unsigned long size_in_bytes_of_largest_free_memory_block;
  6816.        unsigned long size_of_minimum_allocation_unit_in_bytes;
  6817.        unsigned long size_of_allocation_alignmentunit_in_bytes;
  6818.        unsigned long reserved[19];
  6819.      } __dpmi_memory_info;
  6820.  
  6821. This is also used to return memory information, but by a different
  6822. function.
  6823.  
  6824.      typedef struct {
  6825.        unsigned long data16[2];
  6826.        unsigned long code16[2];
  6827.        unsigned short ip;
  6828.        unsigned short reserved;
  6829.        unsigned long data32[2];
  6830.        unsigned long code32[2];
  6831.        unsigned long eip;
  6832.      } __dpmi_callback_info;
  6833.  
  6834. This structure is used to install TSR programs.
  6835.  
  6836.      typedef struct {
  6837.        unsigned long size_requested;
  6838.        unsigned long size;
  6839.        unsigned long handle;
  6840.        unsigned long address;
  6841.        unsigned long name_offset;
  6842.        unsigned short name_selector;
  6843.        unsigned short reserved1;
  6844.        unsigned long reserved2;
  6845.      } __dpmi_shminfo;
  6846.  
  6847. This structure is used to manipulate shared memory regions.
  6848.  
  6849. 
  6850. File: libc.inf,  Node: DPMI Specification,  Next: __dpmi_allocate_dos_memory,  Prev: DPMI Overview,  Up: Alphabetical List
  6851.  
  6852. DPMI Specification
  6853. ==================
  6854.  
  6855. To obtain the DPMI specification, Contact Intel and order document
  6856. number 240977-001.  Also, try ftp.qdeck.com:/pub/memory/dpmi* and
  6857. http://www.delorie.com/djgpp/doc/dpmi/.
  6858.  
  6859. 
  6860. File: libc.inf,  Node: __dpmi_allocate_dos_memory,  Next: __dpmi_allocate_ldt_descriptors,  Prev: DPMI Specification,  Up: Alphabetical List
  6861.  
  6862. __dpmi_allocate_dos_memory
  6863. ==========================
  6864.  
  6865. Syntax
  6866. ------
  6867.  
  6868.      #include <dpmi.h>
  6869.      
  6870.      int __dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);
  6871.  
  6872. Description
  6873. -----------
  6874.  
  6875. Please refer to *Note DPMI Specification:: for details on DPMI function
  6876. call operation.  Also see *Note DPMI Overview:: for general information.
  6877.  
  6878. DPMI function AX = 0x0100
  6879.  
  6880. This function allocates DOS memory.  You pass it the number of
  6881. paragraphs ((bytes+15)>>4) to allocate.  If it succeeds, it returns a
  6882. segment (dos-style) and fills in _RET_SELECTOR_OR_MAX with a selector
  6883. (protected-mode) that you can use to reference the same memory.  Note
  6884. that it's the selector you use to free the block, not the segment.
  6885.  
  6886. Return Value
  6887. ------------
  6888.  
  6889. -1 on error, else the segment [0000..FFFF].
  6890.  
  6891. 
  6892. File: libc.inf,  Node: __dpmi_allocate_ldt_descriptors,  Next: __dpmi_allocate_linear_memory,  Prev: __dpmi_allocate_dos_memory,  Up: Alphabetical List
  6893.  
  6894. __dpmi_allocate_ldt_descriptors
  6895. ===============================
  6896.  
  6897. Syntax
  6898. ------
  6899.  
  6900.      #include <dpmi.h>
  6901.      
  6902.      int __dpmi_allocate_ldt_descriptors(int count);
  6903.  
  6904. Description
  6905. -----------
  6906.  
  6907. Please refer to *Note DPMI Specification:: for details on DPMI function
  6908. call operation.  Also see *Note DPMI Overview:: for general information.
  6909.  
  6910. DPMI function AX = 0x0000
  6911.  
  6912. Allocates COUNT descriptors.
  6913.  
  6914. Return Value
  6915. ------------
  6916.  
  6917. -1 on error, else the first descriptor.  Use *Note
  6918. __dpmi_get_selector_increment_value:: to figure out the remaining
  6919. selectors.
  6920.  
  6921. Example
  6922. -------
  6923.  
  6924.      short sel = __dpmi_allocate_ldt_descriptors(1);
  6925.  
  6926. 
  6927. File: libc.inf,  Node: __dpmi_allocate_linear_memory,  Next: __dpmi_allocate_memory,  Prev: __dpmi_allocate_ldt_descriptors,  Up: Alphabetical List
  6928.  
  6929. __dpmi_allocate_linear_memory
  6930. =============================
  6931.  
  6932. Syntax
  6933. ------
  6934.  
  6935.      #include <dpmi.h>
  6936.      
  6937.      int __dpmi_allocate_linear_memory
  6938.  
  6939. Description
  6940. -----------
  6941.  
  6942. Please refer to *Note DPMI Specification:: for details on DPMI function
  6943. call operation.  Also see *Note DPMI Overview:: for general information.
  6944.  
  6945. DPMI function AX = 0x0504 (DPMI 1.0 only)
  6946.  
  6947. This allocates a block of page-aligned linear address space.  Pass a
  6948. desired address (or zero for any) and a size.  _COMMIT is 1 for
  6949. committed pages, else they are uncommitted.  It returns a handle and
  6950. the actual address.
  6951.  
  6952. Return Value
  6953. ------------
  6954.  
  6955. -1 on error, else zero.
  6956.  
  6957. 
  6958. File: libc.inf,  Node: __dpmi_allocate_memory,  Next: __dpmi_allocate_real_mode_callback,  Prev: __dpmi_allocate_linear_memory,  Up: Alphabetical List
  6959.  
  6960. __dpmi_allocate_memory
  6961. ======================
  6962.  
  6963. Syntax
  6964. ------
  6965.  
  6966.      #include <dpmi.h>
  6967.      
  6968.      int __dpmi_allocate_memory(__dpmi_meminfo *_info);
  6969.  
  6970. Description
  6971. -----------
  6972.  
  6973. Please refer to *Note DPMI Specification:: for details on DPMI function
  6974. call operation.  Also see *Note DPMI Overview:: for general information.
  6975.  
  6976. DPMI function AX = 0x0501
  6977.  
  6978. This allocates virtual memory.  Fill in size, returns handle and
  6979. address.
  6980.  
  6981. Return Value
  6982. ------------
  6983.  
  6984. -1 on error, else zero.
  6985.  
  6986. 
  6987. File: libc.inf,  Node: __dpmi_allocate_real_mode_callback,  Next: __dpmi_allocate_shared_memory,  Prev: __dpmi_allocate_memory,  Up: Alphabetical List
  6988.  
  6989. __dpmi_allocate_real_mode_callback
  6990. ==================================
  6991.  
  6992. Syntax
  6993. ------
  6994.  
  6995.      #include <dpmi.h>
  6996.      
  6997.      int __dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret);
  6998.  
  6999. Description
  7000. -----------
  7001.  
  7002. Please refer to *Note DPMI Specification:: for details on DPMI function
  7003. call operation.  Also see *Note DPMI Overview:: for general information.
  7004.  
  7005. DPMI function AX = 0x0303
  7006.  
  7007. This function gives you a real-mode address to pass to TSRs that gets
  7008. reflected to your protected-mode handler.  You pass it a register block
  7009. to use; it gets filled in with the real-mode registers when your
  7010. handler is called, and the registers are set from it when the handler
  7011. returns.
  7012.  
  7013. Return Value
  7014. ------------
  7015.  
  7016. -1 on error, else zero.
  7017.  
  7018. 
  7019. File: libc.inf,  Node: __dpmi_allocate_shared_memory,  Next: __dpmi_allocate_specific_ldt_descriptor,  Prev: __dpmi_allocate_real_mode_callback,  Up: Alphabetical List
  7020.  
  7021. __dpmi_allocate_shared_memory
  7022. =============================
  7023.  
  7024. Syntax
  7025. ------
  7026.  
  7027.      #include <dpmi.h>
  7028.      
  7029.      int __dpmi_allocate_shared_memory(__dpmi_shminfo *_info);
  7030.  
  7031. Description
  7032. -----------
  7033.  
  7034. Please refer to *Note DPMI Specification:: for details on DPMI function
  7035. call operation.  Also see *Note DPMI Overview:: for general information.
  7036.  
  7037. DPMI function AX = 0x0d00 (DPMI 1.0 only)
  7038.  
  7039. See the spec.
  7040.  
  7041. Return Value
  7042. ------------
  7043.  
  7044. -1 on error, else zero.
  7045.  
  7046. 
  7047. File: libc.inf,  Node: __dpmi_allocate_specific_ldt_descriptor,  Next: __dpmi_clear_debug_watchpoint,  Prev: __dpmi_allocate_shared_memory,  Up: Alphabetical List
  7048.  
  7049. __dpmi_allocate_specific_ldt_descriptor
  7050. =======================================
  7051.  
  7052. Syntax
  7053. ------
  7054.  
  7055.      #include <dpmi.h>
  7056.      
  7057.      int __dpmi_allocate_specific_ldt_descriptor(int _selector);
  7058.  
  7059. Description
  7060. -----------
  7061.  
  7062. Please refer to *Note DPMI Specification:: for details on DPMI function
  7063. call operation.  Also see *Note DPMI Overview:: for general information.
  7064.  
  7065. DPMI function AX = 0x000d
  7066.  
  7067. This allocates the specific selector given.
  7068.  
  7069. Return Value
  7070. ------------
  7071.  
  7072. -1 on error, else zero.
  7073.  
  7074. 
  7075. File: libc.inf,  Node: __dpmi_clear_debug_watchpoint,  Next: __dpmi_create_alias_descriptor,  Prev: __dpmi_allocate_specific_ldt_descriptor,  Up: Alphabetical List
  7076.  
  7077. __dpmi_clear_debug_watchpoint
  7078. =============================
  7079.  
  7080. Syntax
  7081. ------
  7082.  
  7083.      #include <dpmi.h>
  7084.      
  7085.      int __dpmi_clear_debug_watchpoint(unsigned long _handle);
  7086.  
  7087. Description
  7088. -----------
  7089.  
  7090. Please refer to *Note DPMI Specification:: for details on DPMI function
  7091. call operation.  Also see *Note DPMI Overview:: for general information.
  7092.  
  7093. DPMI function AX = 0x0b01
  7094.  
  7095. Clear a debug watchpoint.
  7096.  
  7097. Return Value
  7098. ------------
  7099.  
  7100. -1 on error, else zero.
  7101.  
  7102. 
  7103. File: libc.inf,  Node: __dpmi_create_alias_descriptor,  Next: __dpmi_discard_page_contents,  Prev: __dpmi_clear_debug_watchpoint,  Up: Alphabetical List
  7104.  
  7105. __dpmi_create_alias_descriptor
  7106. ==============================
  7107.  
  7108. Syntax
  7109. ------
  7110.  
  7111.      #include <dpmi.h>
  7112.      
  7113.      int __dpmi_create_alias_descriptor(int _selector);
  7114.  
  7115. Description
  7116. -----------
  7117.  
  7118. Please refer to *Note DPMI Specification:: for details on DPMI function
  7119. call operation.  Also see *Note DPMI Overview:: for general information.
  7120.  
  7121. DPMI function AX = 0x000a
  7122.  
  7123. Create a new selector with the same parameters as the given one.
  7124.  
  7125. Return Value
  7126. ------------
  7127.  
  7128. -1 on error, else the new selector.
  7129.  
  7130. 
  7131. File: libc.inf,  Node: __dpmi_discard_page_contents,  Next: __dpmi_free_dos_memory,  Prev: __dpmi_create_alias_descriptor,  Up: Alphabetical List
  7132.  
  7133. __dpmi_discard_page_contents
  7134. ============================
  7135.  
  7136. Syntax
  7137. ------
  7138.  
  7139.      #include <dpmi.h>
  7140.      
  7141.      int __dpmi_discard_page_contents(__dpmi_meminfo *_info);
  7142.  
  7143. Description
  7144. -----------
  7145.  
  7146. Please refer to *Note DPMI Specification:: for details on DPMI function
  7147. call operation.  Also see *Note DPMI Overview:: for general information.
  7148.  
  7149. DPMI function AX = 0x0703
  7150.  
  7151. Advises the server that the given pages are no longer needed and may be
  7152. reclaimed.  Fill in address and size (in bytes).
  7153.  
  7154. Return Value
  7155. ------------
  7156.  
  7157. -1 on error, else zero.
  7158.  
  7159. 
  7160. File: libc.inf,  Node: __dpmi_free_dos_memory,  Next: __dpmi_free_ldt_descriptor,  Prev: __dpmi_discard_page_contents,  Up: Alphabetical List
  7161.  
  7162. __dpmi_free_dos_memory
  7163. ======================
  7164.  
  7165. Syntax
  7166. ------
  7167.  
  7168.      #include <dpmi.h>
  7169.      
  7170.      int __dpmi_free_dos_memory(int _selector);
  7171.  
  7172. Description
  7173. -----------
  7174.  
  7175. Please refer to *Note DPMI Specification:: for details on DPMI function
  7176. call operation.  Also see *Note DPMI Overview:: for general information.
  7177.  
  7178. DPMI function AX = 0x0101
  7179.  
  7180. This function frees the dos memory allocated by *Note
  7181. __dpmi_allocate_dos_memory::.  Remember to pass the selector and not
  7182. the segment.
  7183.  
  7184. Return Value
  7185. ------------
  7186.  
  7187. -1 on error, else zero.
  7188.  
  7189. 
  7190. File: libc.inf,  Node: __dpmi_free_ldt_descriptor,  Next: __dpmi_free_memory,  Prev: __dpmi_free_dos_memory,  Up: Alphabetical List
  7191.  
  7192. __dpmi_free_ldt_descriptor
  7193. ==========================
  7194.  
  7195. Syntax
  7196. ------
  7197.  
  7198.      #include <dpmi.h>
  7199.      
  7200.      int __dpmi_free_ldt_descriptor(int descriptor);
  7201.  
  7202. Description
  7203. -----------
  7204.  
  7205. Please refer to *Note DPMI Specification:: for details on DPMI function
  7206. call operation.  Also see *Note DPMI Overview:: for general information.
  7207.  
  7208. DPMI function AX = 0x0001
  7209.  
  7210. This function frees a single descriptor, even if it was allocated as
  7211. one of many.
  7212.  
  7213. Return Value
  7214. ------------
  7215.  
  7216. -1 on error, else zero.
  7217.  
  7218. Example
  7219. -------
  7220.  
  7221.      __dpmi_free_ldt_descriptor(sel);
  7222.  
  7223. 
  7224. File: libc.inf,  Node: __dpmi_free_memory,  Next: __dpmi_free_physical_address_mapping,  Prev: __dpmi_free_ldt_descriptor,  Up: Alphabetical List
  7225.  
  7226. __dpmi_free_memory
  7227. ==================
  7228.  
  7229. Syntax
  7230. ------
  7231.  
  7232.      #include <dpmi.h>
  7233.      
  7234.      int __dpmi_free_memory(unsigned long _handle);
  7235.  
  7236. Description
  7237. -----------
  7238.  
  7239. Please refer to *Note DPMI Specification:: for details on DPMI function
  7240. call operation.  Also see *Note DPMI Overview:: for general information.
  7241.  
  7242. DPMI function AX = 0x0502
  7243.  
  7244. This frees a block of virtual memory.
  7245.  
  7246. Return Value
  7247. ------------
  7248.  
  7249. -1 on error, else zero.
  7250.  
  7251. 
  7252. File: libc.inf,  Node: __dpmi_free_physical_address_mapping,  Next: __dpmi_free_real_mode_callback,  Prev: __dpmi_free_memory,  Up: Alphabetical List
  7253.  
  7254. __dpmi_free_physical_address_mapping
  7255. ====================================
  7256.  
  7257. Syntax
  7258. ------
  7259.  
  7260.      #include <dpmi.h>
  7261.      
  7262.      int __dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);
  7263.  
  7264. Description
  7265. -----------
  7266.  
  7267. Please refer to *Note DPMI Specification:: for details on DPMI function
  7268. call operation.  Also see *Note DPMI Overview:: for general information.
  7269.  
  7270. DPMI function AX = 0x0801
  7271.  
  7272. This function unmaps a physical device mapped with *Note
  7273. __dpmi_physical_address_mapping::.  Fill in the linear address.
  7274.  
  7275. Return Value
  7276. ------------
  7277.  
  7278. -1 on error, else zero.
  7279.  
  7280. 
  7281. 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
  7282.  
  7283. __dpmi_free_real_mode_callback
  7284. ==============================
  7285.  
  7286. Syntax
  7287. ------
  7288.  
  7289.      #include <dpmi.h>
  7290.      
  7291.      int __dpmi_free_real_mode_callback(__dpmi_raddr *_addr);
  7292.  
  7293. Description
  7294. -----------
  7295.  
  7296. Please refer to *Note DPMI Specification:: for details on DPMI function
  7297. call operation.  Also see *Note DPMI Overview:: for general information.
  7298.  
  7299. DPMI function AX = 0x0303
  7300.  
  7301. This function frees the real-mode callback address.
  7302.  
  7303. Return Value
  7304. ------------
  7305.  
  7306. -1 on error, else zero.
  7307.  
  7308. 
  7309. File: libc.inf,  Node: __dpmi_free_serialization_on_shared_memory,  Next: __dpmi_free_shared_memory,  Prev: __dpmi_free_real_mode_callback,  Up: Alphabetical List
  7310.  
  7311. __dpmi_free_serialization_on_shared_memory
  7312. ==========================================
  7313.  
  7314. Syntax
  7315. ------
  7316.  
  7317.      #include <dpmi.h>
  7318.      
  7319.      int __dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);
  7320.  
  7321. Description
  7322. -----------
  7323.  
  7324. Please refer to *Note DPMI Specification:: for details on DPMI function
  7325. call operation.  Also see *Note DPMI Overview:: for general information.
  7326.  
  7327. DPMI function AX = 0x0d03 (DPMI 1.0 only)
  7328.  
  7329. See the spec.
  7330.  
  7331. Return Value
  7332. ------------
  7333.  
  7334. -1 on error, else zero.
  7335.  
  7336. 
  7337. 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
  7338.  
  7339. __dpmi_free_shared_memory
  7340. =========================
  7341.  
  7342. Syntax
  7343. ------
  7344.  
  7345.      #include <dpmi.h>
  7346.      
  7347.      int __dpmi_free_shared_memory(unsigned long _handle);
  7348.  
  7349. Description
  7350. -----------
  7351.  
  7352. Please refer to *Note DPMI Specification:: for details on DPMI function
  7353. call operation.  Also see *Note DPMI Overview:: for general information.
  7354.  
  7355. DPMI function AX = 0x0d01 (DPMI 1.0 only)
  7356.  
  7357. See the spec.
  7358.  
  7359. Return Value
  7360. ------------
  7361.  
  7362. -1 on error, else zero.
  7363.  
  7364. 
  7365. 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
  7366.  
  7367. __dpmi_get_and_disable_virtual_interrupt_state
  7368. ==============================================
  7369.  
  7370. Syntax
  7371. ------
  7372.  
  7373.      #include <dpmi.h>
  7374.      
  7375.      int __dpmi_get_and_disable_virtual_interrupt_state
  7376.  
  7377. Description
  7378. -----------
  7379.  
  7380. Please refer to *Note DPMI Specification:: for details on DPMI function
  7381. call operation.  Also see *Note DPMI Overview:: for general information.
  7382.  
  7383. DPMI function AX = 0x0900
  7384.  
  7385. This function disables interrupts, and returns the previous setting.
  7386.  
  7387. Return Value
  7388. ------------
  7389.  
  7390. The previous setting.
  7391.  
  7392. 
  7393. 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
  7394.  
  7395. __dpmi_get_and_enable_virtual_interrupt_state
  7396. =============================================
  7397.  
  7398. Syntax
  7399. ------
  7400.  
  7401.      #include <dpmi.h>
  7402.      
  7403.      int __dpmi_get_and_enable_virtual_interrupt_state(void);
  7404.  
  7405. Description
  7406. -----------
  7407.  
  7408. Please refer to *Note DPMI Specification:: for details on DPMI function
  7409. call operation.  Also see *Note DPMI Overview:: for general information.
  7410.  
  7411. DPMI function AX = 0x0901
  7412.  
  7413. This function enables interrupts, and returns the previous setting.
  7414.  
  7415. Return Value
  7416. ------------
  7417.  
  7418. The previous setting.
  7419.  
  7420. 
  7421. 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
  7422.  
  7423. __dpmi_get_and_set_virtual_interrupt_state
  7424. ==========================================
  7425.  
  7426. Syntax
  7427. ------
  7428.  
  7429.      #include <dpmi.h>
  7430.      
  7431.      int __dpmi_get_and_set_virtual_interrupt_state(int _old_state);
  7432.  
  7433. Description
  7434. -----------
  7435.  
  7436. Please refer to *Note DPMI Specification:: for details on DPMI function
  7437. call operation.  Also see *Note DPMI Overview:: for general information.
  7438.  
  7439. DPMI function AH = 0x09
  7440.  
  7441. This function restores the interrupt state from a previous call to
  7442. *Note __dpmi_get_and_disable_virtual_interrupt_state:: or *Note
  7443. __dpmi_get_and_enable_virtual_interrupt_state::.
  7444.  
  7445. Return Value
  7446. ------------
  7447.  
  7448. The previous setting.
  7449.  
  7450. 
  7451. File: libc.inf,  Node: __dpmi_get_capabilities,  Next: __dpmi_get_coprocessor_status,  Prev: __dpmi_get_and_set_virtual_interrupt_state,  Up: Alphabetical List
  7452.  
  7453. __dpmi_get_capabilities
  7454. =======================
  7455.  
  7456. Syntax
  7457. ------
  7458.  
  7459.      #include <dpmi.h>
  7460.      
  7461.      int __dpmi_get_capabilities(int *_flags, char *vendor_info);
  7462.  
  7463. Description
  7464. -----------
  7465.  
  7466. Please refer to *Note DPMI Specification:: for details on DPMI function
  7467. call operation.  Also see *Note DPMI Overview:: for general information.
  7468.  
  7469. DPMI function AX = 0x0401 (DPMI 1.0 only)
  7470.  
  7471. Gets the capabilities of the server.  The flags are as follows:
  7472.  
  7473.      ---- ---X = 1="page accessed/dirty" supported
  7474.      ---- --X- = 1="exceptions restartble" supported
  7475.      ---- -X-- = 1="device mapping" supported
  7476.      ---- X--- = 1="map conventional memory" supported
  7477.      ---X ---- = 1="demand zero-fill" supported
  7478.      --X- ---- = 1="write-protect client" supported
  7479.      -X-- ---- = 1="write-protect host" supported
  7480.  
  7481. The vendor info is a 128-byte buffer:
  7482.  
  7483.      [0] host major number
  7484.      [1] host minor number
  7485.      [2..127] vendor name
  7486.  
  7487. Return Value
  7488. ------------
  7489.  
  7490. !-1 on error, else zero.
  7491.  
  7492. 
  7493. File: libc.inf,  Node: __dpmi_get_coprocessor_status,  Next: __dpmi_get_descriptor,  Prev: __dpmi_get_capabilities,  Up: Alphabetical List
  7494.  
  7495. __dpmi_get_coprocessor_status
  7496. =============================
  7497.  
  7498. Syntax
  7499. ------
  7500.  
  7501.      #include <dpmi.h>
  7502.      
  7503.      int __dpmi_get_coprocessor_status(void);
  7504.  
  7505. Description
  7506. -----------
  7507.  
  7508. Please refer to *Note DPMI Specification:: for details on DPMI function
  7509. call operation.  Also see *Note DPMI Overview:: for general information.
  7510.  
  7511. DPMI function AX = 0x0e00 (DPMI 1.0 only)
  7512.  
  7513. Return Value
  7514. ------------
  7515.  
  7516. -1 on error, else returns the processor status flags
  7517.  
  7518. 
  7519. File: libc.inf,  Node: __dpmi_get_descriptor,  Next: __dpmi_get_descriptor_access_rights,  Prev: __dpmi_get_coprocessor_status,  Up: Alphabetical List
  7520.  
  7521. __dpmi_get_descriptor
  7522. =====================
  7523.  
  7524. Syntax
  7525. ------
  7526.  
  7527.      #include <dpmi.h>
  7528.      
  7529.      int __dpmi_get_descriptor(int _selector, void *_buffer);
  7530.  
  7531. Description
  7532. -----------
  7533.  
  7534. Please refer to *Note DPMI Specification:: for details on DPMI function
  7535. call operation.  Also see *Note DPMI Overview:: for general information.
  7536.  
  7537. DPMI function AX = 0x000b
  7538.  
  7539. This function fills a 8-byte buffer with the parameters of the
  7540. descriptor.  The data has the following format:
  7541.  
  7542.      [0] XXXX XXXX = segment limit [7:0]
  7543.      [1] XXXX XXXX = segment limit [15:8]
  7544.      [2] XXXX XXXX = base address [7:0]
  7545.      [3] XXXX XXXX = base address [15:8]
  7546.      [4] XXXX XXXX = base address [23:16]
  7547.      [5] ---- XXXX = type
  7548.      [5] ---X ---- = 0=system, 1=application
  7549.      [5] -XX- ---- = priviledge level
  7550.      [5] X--- ---- = 0=absent, 1=present
  7551.      [6] ---- XXXX = segment limit [19:16]
  7552.      [6] ---X ---- = available for user
  7553.      [6] --0- ---- = must be zero
  7554.      [6] -X-- ---- = 0=16-bit 1=32-bit (cs only)
  7555.      [6] X--- ---- = 0=byte-granular (small) 1=page-granular (big)
  7556.      [7] XXXX XXXX = base address [31:24]
  7557.  
  7558. Return Value
  7559. ------------
  7560.  
  7561. -1 on error, else zero.
  7562.  
  7563. 
  7564. File: libc.inf,  Node: __dpmi_get_descriptor_access_rights,  Next: __dpmi_get_extended_exception_handler_vector_pm,  Prev: __dpmi_get_descriptor,  Up: Alphabetical List
  7565.  
  7566. __dpmi_get_descriptor_access_rights
  7567. ===================================
  7568.  
  7569. Syntax
  7570. ------
  7571.  
  7572.      #include <dpmi.h>
  7573.      
  7574.      int __dpmi_get_descriptor_access_rights(int _selector);
  7575.  
  7576. Description
  7577. -----------
  7578.  
  7579. Please refer to *Note DPMI Specification:: for details on DPMI function
  7580. call operation.  Also see *Note DPMI Overview:: for general information.
  7581.  
  7582. This function returns the access rights byte from the `lar' opcode.
  7583.  
  7584. Return Value
  7585. ------------
  7586.  
  7587. The access byte.  See an Intel programming manual for the list of
  7588. access information.
  7589.  
  7590. 
  7591. 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
  7592.  
  7593. __dpmi_get_extended_exception_handler_vector_pm
  7594. ===============================================
  7595.  
  7596. Syntax
  7597. ------
  7598.  
  7599.      #include <dpmi.h>
  7600.      
  7601.      int __dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  7602.  
  7603. Description
  7604. -----------
  7605.  
  7606. Please refer to *Note DPMI Specification:: for details on DPMI function
  7607. call operation.  Also see *Note DPMI Overview:: for general information.
  7608.  
  7609. DPMI function AX = 0x0210 (DPMI 1.0 only)
  7610.  
  7611. This gets the function that handles protected mode exceptions.
  7612.  
  7613. Return Value
  7614. ------------
  7615.  
  7616. -1 on error, else zero.
  7617.  
  7618. 
  7619. 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
  7620.  
  7621. __dpmi_get_extended_exception_handler_vector_rm
  7622. ===============================================
  7623.  
  7624. Syntax
  7625. ------
  7626.  
  7627.      #include <dpmi.h>
  7628.      
  7629.      int __dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  7630.  
  7631. Description
  7632. -----------
  7633.  
  7634. Please refer to *Note DPMI Specification:: for details on DPMI function
  7635. call operation.  Also see *Note DPMI Overview:: for general information.
  7636.  
  7637. DPMI function AX = 0x0211 (DPMI 1.0 only)
  7638.  
  7639. This function gets the handler for real-mode exceptions.
  7640.  
  7641. Return Value
  7642. ------------
  7643.  
  7644. -1 on error, else zero.
  7645.  
  7646. 
  7647. 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
  7648.  
  7649. __dpmi_get_free_memory_information
  7650. ==================================
  7651.  
  7652. Syntax
  7653. ------
  7654.  
  7655.      #include <dpmi.h>
  7656.      
  7657.      int __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);
  7658.  
  7659. Description
  7660. -----------
  7661.  
  7662. Please refer to *Note DPMI Specification:: for details on DPMI function
  7663. call operation.  Also see *Note DPMI Overview:: for general information.
  7664.  
  7665. DPMI function AX = 0x0500
  7666.  
  7667. This function returns information about available memory.  Unsupported
  7668. fields will have -1 (0xfffffff) in them.
  7669.  
  7670. Return Value
  7671. ------------
  7672.  
  7673. Zero.  This always works.
  7674.  
  7675. 
  7676. 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
  7677.  
  7678. __dpmi_get_memory_block_size_and_base
  7679. =====================================
  7680.  
  7681. Syntax
  7682. ------
  7683.  
  7684.      #include <dpmi.h>
  7685.      
  7686.      int __dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);
  7687.  
  7688. Description
  7689. -----------
  7690.  
  7691. Please refer to *Note DPMI Specification:: for details on DPMI function
  7692. call operation.  Also see *Note DPMI Overview:: for general information.
  7693.  
  7694. DPMI function AX = 0x050a (DPMI 1.0 only)
  7695.  
  7696. Pass the handle.  It fills in the address and size.
  7697.  
  7698. Return Value
  7699. ------------
  7700.  
  7701. -1 on error, else zero.
  7702.  
  7703. 
  7704. File: libc.inf,  Node: __dpmi_get_memory_information,  Next: __dpmi_get_multiple_descriptors,  Prev: __dpmi_get_memory_block_size_and_base,  Up: Alphabetical List
  7705.  
  7706. __dpmi_get_memory_information
  7707. =============================
  7708.  
  7709. Syntax
  7710. ------
  7711.  
  7712.      #include <dpmi.h>
  7713.      
  7714.      int __dpmi_get_memory_information(__dpmi_memory_info *_buffer);
  7715.  
  7716. Description
  7717. -----------
  7718.  
  7719. Please refer to *Note DPMI Specification:: for details on DPMI function
  7720. call operation.  Also see *Note DPMI Overview:: for general information.
  7721.  
  7722. DPMI function AX = 0x050b (DPMI 1.0 only)
  7723.  
  7724. This function returns virtual memory information.
  7725.  
  7726. Return Value
  7727. ------------
  7728.  
  7729. -1 on error, else zero.
  7730.  
  7731. 
  7732. File: libc.inf,  Node: __dpmi_get_multiple_descriptors,  Next: __dpmi_get_page_attributes,  Prev: __dpmi_get_memory_information,  Up: Alphabetical List
  7733.  
  7734. __dpmi_get_multiple_descriptors
  7735. ===============================
  7736.  
  7737. Syntax
  7738. ------
  7739.  
  7740.      #include <dpmi.h>
  7741.      
  7742.      int __dpmi_get_multiple_descriptors(int _count, void *_buffer);
  7743.  
  7744. Description
  7745. -----------
  7746.  
  7747. Please refer to *Note DPMI Specification:: for details on DPMI function
  7748. call operation.  Also see *Note DPMI Overview:: for general information.
  7749.  
  7750. DPMI function AX = 0x000e (DPMI 1.0 only)
  7751.  
  7752. This function gets a list of selectors' parameters.  The buffer must be
  7753. prefilled with selector values, and will contain the parameters on
  7754. return:
  7755.  
  7756.      [0x00:2] selector #1 (pass)
  7757.      [0x02:8] parameters #1 (returned)
  7758.      [0x0a:2] selector #2 (pass)
  7759.      [0x0c:8] parameters #2 (returned)
  7760.      ...
  7761.  
  7762. Return Value
  7763. ------------
  7764.  
  7765. Returns _count if successful, the negative of # descriptors copied if
  7766. failure.
  7767.  
  7768. 
  7769. File: libc.inf,  Node: __dpmi_get_page_attributes,  Next: __dpmi_get_page_size,  Prev: __dpmi_get_multiple_descriptors,  Up: Alphabetical List
  7770.  
  7771. __dpmi_get_page_attributes
  7772. ==========================
  7773.  
  7774. Syntax
  7775. ------
  7776.  
  7777.      #include <dpmi.h>
  7778.      
  7779.      int __dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  7780.  
  7781. Description
  7782. -----------
  7783.  
  7784. Please refer to *Note DPMI Specification:: for details on DPMI function
  7785. call operation.  Also see *Note DPMI Overview:: for general information.
  7786.  
  7787. DPMI function AX = 0x0506 (DPMI 1.0 only)
  7788.  
  7789. Pass the handle, offset of first page (relative to start of block) in
  7790. .address, and number of pages in .count.  Buffer gets filled in with
  7791. the attributes (see spec).
  7792.  
  7793. Return Value
  7794. ------------
  7795.  
  7796. -1 on error, else zero.
  7797.  
  7798. 
  7799. File: libc.inf,  Node: __dpmi_get_page_size,  Next: __dpmi_get_processor_exception_handler_vector,  Prev: __dpmi_get_page_attributes,  Up: Alphabetical List
  7800.  
  7801. __dpmi_get_page_size
  7802. ====================
  7803.  
  7804. Syntax
  7805. ------
  7806.  
  7807.      #include <dpmi.h>
  7808.      
  7809.      int __dpmi_get_page_size(unsigned long *_size);
  7810.  
  7811. Description
  7812. -----------
  7813.  
  7814. Please refer to *Note DPMI Specification:: for details on DPMI function
  7815. call operation.  Also see *Note DPMI Overview:: for general information.
  7816.  
  7817. DPMI function AX = 0x0604
  7818.  
  7819. Fills in the page size.
  7820.  
  7821. Return Value
  7822. ------------
  7823.  
  7824. -1 on error (16-bit host), else zero.
  7825.  
  7826. 
  7827. 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
  7828.  
  7829. __dpmi_get_processor_exception_handler_vector
  7830. =============================================
  7831.  
  7832. Syntax
  7833. ------
  7834.  
  7835.      #include <dpmi.h>
  7836.      
  7837.      int __dpmi_get_processor_exception_handler_vector
  7838.  
  7839. Description
  7840. -----------
  7841.  
  7842. Please refer to *Note DPMI Specification:: for details on DPMI function
  7843. call operation.  Also see *Note DPMI Overview:: for general information.
  7844.  
  7845. DPMI function AX = 0x0202
  7846.  
  7847. This function gets the current protected-mode exception handler (not
  7848. interrupts).  It will return a selector:offset pair.
  7849.  
  7850. Return Value
  7851. ------------
  7852.  
  7853. -1 on error (invalid vector), else zero.
  7854.  
  7855. 
  7856. 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
  7857.  
  7858. __dpmi_get_protected_mode_interrupt_vector
  7859. ==========================================
  7860.  
  7861. Syntax
  7862. ------
  7863.  
  7864.      #include <dpmi.h>
  7865.      
  7866.      int __dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  7867.  
  7868. Description
  7869. -----------
  7870.  
  7871. Please refer to *Note DPMI Specification:: for details on DPMI function
  7872. call operation.  Also see *Note DPMI Overview:: for general information.
  7873.  
  7874. DPMI function AX = 0x0204
  7875.  
  7876. This function gets the address of the current protected mode interrupt
  7877. (not exception) handler.  It returns a selector:offset pair.
  7878.  
  7879. Return Value
  7880. ------------
  7881.  
  7882. Zero.  This always works.
  7883.  
  7884. 
  7885. 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
  7886.  
  7887. __dpmi_get_raw_mode_switch_addr
  7888. ===============================
  7889.  
  7890. Syntax
  7891. ------
  7892.  
  7893.      #include <dpmi.h>
  7894.      
  7895.      int __dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  7896.  
  7897. Description
  7898. -----------
  7899.  
  7900. Please refer to *Note DPMI Specification:: for details on DPMI function
  7901. call operation.  Also see *Note DPMI Overview:: for general information.
  7902.  
  7903. DPMI function AX = 0x0306
  7904.  
  7905. Read the spec for more info.
  7906.  
  7907. Return Value
  7908. ------------
  7909.  
  7910. Zero.  This always works.
  7911.  
  7912. 
  7913. 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
  7914.  
  7915. __dpmi_get_real_mode_interrupt_vector
  7916. =====================================
  7917.  
  7918. Syntax
  7919. ------
  7920.  
  7921.      #include <dpmi.h>
  7922.      
  7923.      int __dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  7924.  
  7925. Description
  7926. -----------
  7927.  
  7928. Please refer to *Note DPMI Specification:: for details on DPMI function
  7929. call operation.  Also see *Note DPMI Overview:: for general information.
  7930.  
  7931. DPMI function AX = 0x0200
  7932.  
  7933. This function stores the real-mode interrupt vector address in
  7934. _ADDRESS. This is the same as the DOS get vector call, and returns a
  7935. real-mode segment:offset pair.
  7936.  
  7937. Bits [31:8] in the vector number are silently ignored.
  7938.  
  7939. Return Value
  7940. ------------
  7941.  
  7942. Zero.  This function always works.
  7943.  
  7944. 
  7945. File: libc.inf,  Node: __dpmi_get_segment_base_address,  Next: __dpmi_get_segment_limit,  Prev: __dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  7946.  
  7947. __dpmi_get_segment_base_address
  7948. ===============================
  7949.  
  7950. Syntax
  7951. ------
  7952.  
  7953.      #include <dpmi.h>
  7954.      
  7955.      int __dpmi_get_segment_base_address(int _selector, unsigned long *_addr);
  7956.  
  7957. Description
  7958. -----------
  7959.  
  7960. Please refer to *Note DPMI Specification:: for details on DPMI function
  7961. call operation.  Also see *Note DPMI Overview:: for general information.
  7962.  
  7963. DPMI function AX = 0x0006
  7964.  
  7965. The physical base address of the selector is stored in *ADDR.
  7966.  
  7967. Return Value
  7968. ------------
  7969.  
  7970. -1 on error, else zero.
  7971.  
  7972. Example
  7973. -------
  7974.  
  7975.      unsigned long addr;
  7976.      if (__dpmi_get_segment_base_address(selector, &addr))
  7977.        ...
  7978.  
  7979. 
  7980. File: libc.inf,  Node: __dpmi_get_segment_limit,  Next: __dpmi_get_selector_increment_value,  Prev: __dpmi_get_segment_base_address,  Up: Alphabetical List
  7981.  
  7982. __dpmi_get_segment_limit
  7983. ========================
  7984.  
  7985. Syntax
  7986. ------
  7987.  
  7988.      #include <dpmi.h>
  7989.      
  7990.      unsigned __dpmi_get_segment_limit(int _selector);
  7991.  
  7992. Description
  7993. -----------
  7994.  
  7995. Please refer to *Note DPMI Specification:: for details on DPMI function
  7996. call operation.  Also see *Note DPMI Overview:: for general information.
  7997.  
  7998. Return Value
  7999. ------------
  8000.  
  8001. The limit of the segment, as returned by the `lsl' opcode.
  8002.  
  8003. 
  8004. File: libc.inf,  Node: __dpmi_get_selector_increment_value,  Next: __dpmi_get_state_of_debug_watchpoint,  Prev: __dpmi_get_segment_limit,  Up: Alphabetical List
  8005.  
  8006. __dpmi_get_selector_increment_value
  8007. ===================================
  8008.  
  8009. Syntax
  8010. ------
  8011.  
  8012.      #include <dpmi.h>
  8013.      
  8014.      int __dpmi_get_selector_increment_value(void);
  8015.  
  8016. Description
  8017. -----------
  8018.  
  8019. Please refer to *Note DPMI Specification:: for details on DPMI function
  8020. call operation.  Also see *Note DPMI Overview:: for general information.
  8021.  
  8022. DPMI function AX = 0x0003
  8023.  
  8024. Return Value
  8025. ------------
  8026.  
  8027. The value to return to each selector allocated by
  8028. __dpmi_allocate_ldt_descriptors to get the next one.
  8029.  
  8030. 
  8031. 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
  8032.  
  8033. __dpmi_get_state_of_debug_watchpoint
  8034. ====================================
  8035.  
  8036. Syntax
  8037. ------
  8038.  
  8039.      #include <dpmi.h>
  8040.      
  8041.      int __dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);
  8042.  
  8043. Description
  8044. -----------
  8045.  
  8046. Please refer to *Note DPMI Specification:: for details on DPMI function
  8047. call operation.  Also see *Note DPMI Overview:: for general information.
  8048.  
  8049. DPMI function AX = 0x0b02
  8050.  
  8051. Gets the state of the watchpoint.  Pass handle, fills in status (0=not
  8052. encountered, 1=encountered).
  8053.  
  8054. Return Value
  8055. ------------
  8056.  
  8057. -1 on error, else zero.
  8058.  
  8059. 
  8060. 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
  8061.  
  8062. __dpmi_get_state_save_restore_addr
  8063. ==================================
  8064.  
  8065. Syntax
  8066. ------
  8067.  
  8068.      #include <dpmi.h>
  8069.      
  8070.      int __dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  8071.  
  8072. Description
  8073. -----------
  8074.  
  8075. Please refer to *Note DPMI Specification:: for details on DPMI function
  8076. call operation.  Also see *Note DPMI Overview:: for general information.
  8077.  
  8078. DPMI function AX = 0x0305
  8079.  
  8080. Read the spec for info.
  8081.  
  8082. Return Value
  8083. ------------
  8084.  
  8085. The number of bytes required to save state.
  8086.  
  8087. 
  8088. 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
  8089.  
  8090. __dpmi_get_vendor_specific_api_entry_point
  8091. ==========================================
  8092.  
  8093. Syntax
  8094. ------
  8095.  
  8096.      #include <dpmi.h>
  8097.      
  8098.      int __dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);
  8099.  
  8100. Description
  8101. -----------
  8102.  
  8103. Please refer to *Note DPMI Specification:: for details on DPMI function
  8104. call operation.  Also see *Note DPMI Overview:: for general information.
  8105.  
  8106. DPMI function AX = 0x0a00
  8107.  
  8108. Look up a vendor-specific function, given the *name* of the function.
  8109.  
  8110. Return Value
  8111. ------------
  8112.  
  8113. -1 on error, else zero.
  8114.  
  8115. 
  8116. File: libc.inf,  Node: __dpmi_get_version,  Next: __dpmi_get_virtual_interrupt_state,  Prev: __dpmi_get_vendor_specific_api_entry_point,  Up: Alphabetical List
  8117.  
  8118. __dpmi_get_version
  8119. ==================
  8120.  
  8121. Syntax
  8122. ------
  8123.  
  8124.      #include <dpmi.h>
  8125.      
  8126.      int __dpmi_get_version(__dpmi_version_ret *_ret);
  8127.  
  8128. Description
  8129. -----------
  8130.  
  8131. Please refer to *Note DPMI Specification:: for details on DPMI function
  8132. call operation.  Also see *Note DPMI Overview:: for general information.
  8133.  
  8134. DPMI function AX = 0x0400
  8135.  
  8136. Fills in version information.  The flags are as follows:
  8137.  
  8138.      ---- ---X = 0=16-bit host  1=32-bit host
  8139.      ---- --X- = 0=V86 used for reflected ints, 1=real mode
  8140.      ---- -X-- = 0=no virtual memory, 1=virtual memory supported
  8141.  
  8142. The cpu is 2=80286, 3=80386, 4=80486, etc.
  8143.  
  8144. DPMI 0.9 returns major=0 and minor=0x5a.
  8145.  
  8146. Return Value
  8147. ------------
  8148.  
  8149. Zero.  This always works.
  8150.  
  8151. 
  8152. File: libc.inf,  Node: __dpmi_get_virtual_interrupt_state,  Next: __dpmi_install_resident_service_provider_callback,  Prev: __dpmi_get_version,  Up: Alphabetical List
  8153.  
  8154. __dpmi_get_virtual_interrupt_state
  8155. ==================================
  8156.  
  8157. Syntax
  8158. ------
  8159.  
  8160.      #include <dpmi.h>
  8161.      
  8162.      int __dpmi_get_virtual_interrupt_state(void);
  8163.  
  8164. Description
  8165. -----------
  8166.  
  8167. Please refer to *Note DPMI Specification:: for details on DPMI function
  8168. call operation.  Also see *Note DPMI Overview:: for general information.
  8169.  
  8170. DPMI function AX = 0x0902
  8171.  
  8172. Return Value
  8173. ------------
  8174.  
  8175. This function returns the current interrupt flag (1=enabled).
  8176.  
  8177. 
  8178. File: libc.inf,  Node: __dpmi_install_resident_service_provider_callback,  Next: __dpmi_int,  Prev: __dpmi_get_virtual_interrupt_state,  Up: Alphabetical List
  8179.  
  8180. __dpmi_install_resident_service_provider_callback
  8181. =================================================
  8182.  
  8183. Syntax
  8184. ------
  8185.  
  8186.      #include <dpmi.h>
  8187.      
  8188.      int __dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);
  8189.  
  8190. Description
  8191. -----------
  8192.  
  8193. Please refer to *Note DPMI Specification:: for details on DPMI function
  8194. call operation.  Also see *Note DPMI Overview:: for general information.
  8195.  
  8196. DPMI function AX = 0x0c00 (DPMI 1.0 only)
  8197.  
  8198. See the spec.
  8199.  
  8200. Return Value
  8201. ------------
  8202.  
  8203. -1 on error, else zero.
  8204.  
  8205. 
  8206. File: libc.inf,  Node: __dpmi_int,  Next: __dpmi_lock_linear_region,  Prev: __dpmi_install_resident_service_provider_callback,  Up: Alphabetical List
  8207.  
  8208. __dpmi_int
  8209. ==========
  8210.  
  8211. Syntax
  8212. ------
  8213.  
  8214.      #include <dpmi.h>
  8215.      
  8216.      int __dpmi_int(int _vector, __dpmi_regs *_regs);
  8217.  
  8218. Description
  8219. -----------
  8220.  
  8221. Please refer to *Note DPMI Specification:: for details on DPMI function
  8222. call operation.  Also see *Note DPMI Overview:: for general information.
  8223.  
  8224. DPMI function AX = 0x0300
  8225.  
  8226. This function performs a software interrupt in real mode after filling
  8227. in *most* the registers from the given structure.  %ss, %esp, and
  8228. %eflags are automatically taken care of, unlike *Note
  8229. __dpmi_simulate_real_mode_interrupt::.
  8230.  
  8231. The following variables can be used to tune this function.  By default,
  8232. these variables are all zero.
  8233.  
  8234. `__dpmi_int_ss'
  8235. `__dpmi_int_sp'
  8236. `__dpmi_int_flags'
  8237.      These hold the values stored in the appropriate field in the
  8238.      `__dpmi_regs' structure.
  8239.  
  8240. Return Value
  8241. ------------
  8242.  
  8243. -1 on error, else zero.
  8244.  
  8245. 
  8246. File: libc.inf,  Node: __dpmi_lock_linear_region,  Next: __dpmi_map_conventional_memory_in_memory_block,  Prev: __dpmi_int,  Up: Alphabetical List
  8247.  
  8248. __dpmi_lock_linear_region
  8249. =========================
  8250.  
  8251. Syntax
  8252. ------
  8253.  
  8254.      #include <dpmi.h>
  8255.      
  8256.      int __dpmi_lock_linear_region(__dpmi_meminfo *_info);
  8257.  
  8258. Description
  8259. -----------
  8260.  
  8261. Please refer to *Note DPMI Specification:: for details on DPMI function
  8262. call operation.  Also see *Note DPMI Overview:: for general information.
  8263.  
  8264. DPMI function AX = 0x0600
  8265.  
  8266. This function locks virtual memory, to prevent page faults during
  8267. hardware interrupts.  Pass address and size (in bytes).
  8268.  
  8269. Return Value
  8270. ------------
  8271.  
  8272. -1 on error, else zero.
  8273.  
  8274. 
  8275. 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
  8276.  
  8277. __dpmi_map_conventional_memory_in_memory_block
  8278. ==============================================
  8279.  
  8280. Syntax
  8281. ------
  8282.  
  8283.      #include <dpmi.h>
  8284.      
  8285.      int __dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);
  8286.  
  8287. Description
  8288. -----------
  8289.  
  8290. Please refer to *Note DPMI Specification:: for details on DPMI function
  8291. call operation.  Also see *Note DPMI Overview:: for general information.
  8292.  
  8293. DPMI function AX = 0x0509 (DPMI 1.0 only)
  8294.  
  8295. This function maps conventional memory (even when virtualized) to
  8296. virtual memory.  Pass the handle, offset, and number of pages.
  8297.  
  8298. Return Value
  8299. ------------
  8300.  
  8301. -1 on error, else zero.
  8302.  
  8303. 
  8304. 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
  8305.  
  8306. __dpmi_map_device_in_memory_block
  8307. =================================
  8308.  
  8309. Syntax
  8310. ------
  8311.  
  8312.      #include <dpmi.h>
  8313.      
  8314.      int __dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long *_physaddr);
  8315.  
  8316. Description
  8317. -----------
  8318.  
  8319. Please refer to *Note DPMI Specification:: for details on DPMI function
  8320. call operation.  Also see *Note DPMI Overview:: for general information.
  8321.  
  8322. DPMI function AX = 0x0508 (DPMI 1.0 only)
  8323.  
  8324. This function maps a physical address range to virtual memory.  Pass
  8325. the handle, offset relative to the start of the block, and number of
  8326. pages to map.
  8327.  
  8328. Return Value
  8329. ------------
  8330.  
  8331. -1 on error, else zero.
  8332.  
  8333. 
  8334. 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
  8335.  
  8336. __dpmi_mark_page_as_demand_paging_candidate
  8337. ===========================================
  8338.  
  8339. Syntax
  8340. ------
  8341.  
  8342.      #include <dpmi.h>
  8343.      
  8344.      int __dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);
  8345.  
  8346. Description
  8347. -----------
  8348.  
  8349. Please refer to *Note DPMI Specification:: for details on DPMI function
  8350. call operation.  Also see *Note DPMI Overview:: for general information.
  8351.  
  8352. DPMI function AX = 0x0702
  8353.  
  8354. Advises the server that certain pages are unlikely to be used soon.
  8355. Set address and size (in bytes).
  8356.  
  8357. Return Value
  8358. ------------
  8359.  
  8360. -1 on error, else zero.
  8361.  
  8362. 
  8363. 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
  8364.  
  8365. __dpmi_mark_real_mode_region_as_pageable
  8366. ========================================
  8367.  
  8368. Syntax
  8369. ------
  8370.  
  8371.      #include <dpmi.h>
  8372.      
  8373.      int __dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);
  8374.  
  8375. Description
  8376. -----------
  8377.  
  8378. Please refer to *Note DPMI Specification:: for details on DPMI function
  8379. call operation.  Also see *Note DPMI Overview:: for general information.
  8380.  
  8381. DPMI function AX = 0x0602
  8382.  
  8383. This function advises the host that the given pages are suitable for
  8384. page-out.  Pass address and size (in bytes).
  8385.  
  8386. Return Value
  8387. ------------
  8388.  
  8389. -1 on error, else zero.
  8390.  
  8391. 
  8392. 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
  8393.  
  8394. __dpmi_physical_address_mapping
  8395. ===============================
  8396.  
  8397. Syntax
  8398. ------
  8399.  
  8400.      #include <dpmi.h>
  8401.      
  8402.      int __dpmi_physical_address_mapping(__dpmi_meminfo *_info);
  8403.  
  8404. Description
  8405. -----------
  8406.  
  8407. Please refer to *Note DPMI Specification:: for details on DPMI function
  8408. call operation.  Also see *Note DPMI Overview:: for general information.
  8409.  
  8410. DPMI function AX = 0x0800
  8411.  
  8412. Maps a physical device (like a graphics buffer) to linear memory.  Fill
  8413. in the physical address and size (in bytes).  On return, the address is
  8414. the linear address to use.
  8415.  
  8416. Return Value
  8417. ------------
  8418.  
  8419. -1 on error, else zero.
  8420.  
  8421. 
  8422. File: libc.inf,  Node: __dpmi_relock_real_mode_region,  Next: __dpmi_reset_debug_watchpoint,  Prev: __dpmi_physical_address_mapping,  Up: Alphabetical List
  8423.  
  8424. __dpmi_relock_real_mode_region
  8425. ==============================
  8426.  
  8427. Syntax
  8428. ------
  8429.  
  8430.      #include <dpmi.h>
  8431.      
  8432.      int __dpmi_relock_real_mode_region(__dpmi_meminfo *_info);
  8433.  
  8434. Description
  8435. -----------
  8436.  
  8437. Please refer to *Note DPMI Specification:: for details on DPMI function
  8438. call operation.  Also see *Note DPMI Overview:: for general information.
  8439.  
  8440. DPMI function AX = 0x0603
  8441.  
  8442. This function relocks the pages unlocked with *Note
  8443. __dpmi_mark_real_mode_region_as_pageable::.  Pass address and size (in
  8444. bytes).
  8445.  
  8446. Return Value
  8447. ------------
  8448.  
  8449. -1 on error, else zero.
  8450.  
  8451. 
  8452. File: libc.inf,  Node: __dpmi_reset_debug_watchpoint,  Next: __dpmi_resize_dos_memory,  Prev: __dpmi_relock_real_mode_region,  Up: Alphabetical List
  8453.  
  8454. __dpmi_reset_debug_watchpoint
  8455. =============================
  8456.  
  8457. Syntax
  8458. ------
  8459.  
  8460.      #include <dpmi.h>
  8461.      
  8462.      int __dpmi_reset_debug_watchpoint
  8463.  
  8464. Description
  8465. -----------
  8466.  
  8467. Please refer to *Note DPMI Specification:: for details on DPMI function
  8468. call operation.  Also see *Note DPMI Overview:: for general information.
  8469.  
  8470. DPMI function AX = 0x0b03
  8471.  
  8472. Resets a watchpoint.
  8473.  
  8474. Return Value
  8475. ------------
  8476.  
  8477. -1 on error, else zero.
  8478.  
  8479. 
  8480. File: libc.inf,  Node: __dpmi_resize_dos_memory,  Next: __dpmi_resize_linear_memory,  Prev: __dpmi_reset_debug_watchpoint,  Up: Alphabetical List
  8481.  
  8482. __dpmi_resize_dos_memory
  8483. ========================
  8484.  
  8485. Syntax
  8486. ------
  8487.  
  8488.      #include <dpmi.h>
  8489.      
  8490.      int __dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);
  8491.  
  8492. Description
  8493. -----------
  8494.  
  8495. Please refer to *Note DPMI Specification:: for details on DPMI function
  8496. call operation.  Also see *Note DPMI Overview:: for general information.
  8497.  
  8498. DPMI function AX = 0x0102
  8499.  
  8500. This function resizes a dos memory block.  Remember to pass the
  8501. selector, and not the segment.  If this call fails, _RET_MAX contains
  8502. the largest number of paragraphs available.
  8503.  
  8504. Return Value
  8505. ------------
  8506.  
  8507. -1 on error, else zero.
  8508.  
  8509. 
  8510. File: libc.inf,  Node: __dpmi_resize_linear_memory,  Next: __dpmi_resize_memory,  Prev: __dpmi_resize_dos_memory,  Up: Alphabetical List
  8511.  
  8512. __dpmi_resize_linear_memory
  8513. ===========================
  8514.  
  8515. Syntax
  8516. ------
  8517.  
  8518.      #include <dpmi.h>
  8519.      
  8520.      int __dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);
  8521.  
  8522. Description
  8523. -----------
  8524.  
  8525. Please refer to *Note DPMI Specification:: for details on DPMI function
  8526. call operation.  Also see *Note DPMI Overview:: for general information.
  8527.  
  8528. DPMI function AX = 0x0505 (DPMI 1.0 only)
  8529.  
  8530. This function resizes a memory block.  Pass the handle and new size.
  8531. Bit 0 of _commit is 1 for committed pages; bit 1 is 1 to automatically
  8532. update descriptors.  It returns a new handle and base address.
  8533.  
  8534. Return Value
  8535. ------------
  8536.  
  8537. -1 on error, else zero.
  8538.  
  8539. 
  8540. File: libc.inf,  Node: __dpmi_resize_memory,  Next: __dpmi_segment_to_descriptor,  Prev: __dpmi_resize_linear_memory,  Up: Alphabetical List
  8541.  
  8542. __dpmi_resize_memory
  8543. ====================
  8544.  
  8545. Syntax
  8546. ------
  8547.  
  8548.      #include <dpmi.h>
  8549.      
  8550.      int __dpmi_resize_memory
  8551.  
  8552. Description
  8553. -----------
  8554.  
  8555. Please refer to *Note DPMI Specification:: for details on DPMI function
  8556. call operation.  Also see *Note DPMI Overview:: for general information.
  8557.  
  8558. DPMI function AX = 0x0503
  8559.  
  8560. This function changes the size of a virtual memory block.  You must
  8561. pass the handle and size fields.  It may change the base address also;
  8562. beware of debugging breakpoints and locked memory.  It will return a
  8563. new handle.
  8564.  
  8565. Return Value
  8566. ------------
  8567.  
  8568. -1 on error, else zero.
  8569.  
  8570. 
  8571. File: libc.inf,  Node: __dpmi_segment_to_descriptor,  Next: __dpmi_serialize_on_shared_memory,  Prev: __dpmi_resize_memory,  Up: Alphabetical List
  8572.  
  8573. __dpmi_segment_to_descriptor
  8574. ============================
  8575.  
  8576. Syntax
  8577. ------
  8578.  
  8579.      #include <dpmi.h>
  8580.      
  8581.      int __dpmi_segment_to_descriptor
  8582.  
  8583. Description
  8584. -----------
  8585.  
  8586. Please refer to *Note DPMI Specification:: for details on DPMI function
  8587. call operation.  Also see *Note DPMI Overview:: for general information.
  8588.  
  8589. DPMI function AX = 0x0002
  8590.  
  8591. This function returns a selector that maps to what the real-mode
  8592. segment provided would have referenced.  Warning: this is a scarce
  8593. resource.
  8594.  
  8595. Return Value
  8596. ------------
  8597.  
  8598. -1 on error, else the selector.
  8599.  
  8600. Example
  8601. -------
  8602.  
  8603.      short video = __dpmi_segment_to_descriptor(0xa000);
  8604.      movedata(_my_ds(), buffer, video, 0, 320*200);
  8605.  
  8606. 
  8607. File: libc.inf,  Node: __dpmi_serialize_on_shared_memory,  Next: __dpmi_set_coprocessor_emulation,  Prev: __dpmi_segment_to_descriptor,  Up: Alphabetical List
  8608.  
  8609. __dpmi_serialize_on_shared_memory
  8610. =================================
  8611.  
  8612. Syntax
  8613. ------
  8614.  
  8615.      #include <dpmi.h>
  8616.      
  8617.      int __dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);
  8618.  
  8619. Description
  8620. -----------
  8621.  
  8622. Please refer to *Note DPMI Specification:: for details on DPMI function
  8623. call operation.  Also see *Note DPMI Overview:: for general information.
  8624.  
  8625. DPMI function AX = 0x0d02 (DPMI 1.0 only)
  8626.  
  8627. See the spec.
  8628.  
  8629. Return Value
  8630. ------------
  8631.  
  8632. -1 on error, else zero.
  8633.  
  8634. 
  8635. File: libc.inf,  Node: __dpmi_set_coprocessor_emulation,  Next: __dpmi_set_debug_watchpoint,  Prev: __dpmi_serialize_on_shared_memory,  Up: Alphabetical List
  8636.  
  8637. __dpmi_set_coprocessor_emulation
  8638. ================================
  8639.  
  8640. Syntax
  8641. ------
  8642.  
  8643.      #include <dpmi.h>
  8644.      
  8645.      int __dpmi_set_coprocessor_emulation(int _flags);
  8646.  
  8647. Description
  8648. -----------
  8649.  
  8650. Please refer to *Note DPMI Specification:: for details on DPMI function
  8651. call operation.  Also see *Note DPMI Overview:: for general information.
  8652.  
  8653. DPMI function AX = 0x0e01 (DPMI 1.0 only)
  8654.  
  8655. Return Value
  8656. ------------
  8657.  
  8658. -1 on errors, else zero.
  8659.  
  8660. 
  8661. File: libc.inf,  Node: __dpmi_set_debug_watchpoint,  Next: __dpmi_set_descriptor,  Prev: __dpmi_set_coprocessor_emulation,  Up: Alphabetical List
  8662.  
  8663. __dpmi_set_debug_watchpoint
  8664. ===========================
  8665.  
  8666. Syntax
  8667. ------
  8668.  
  8669.      #include <dpmi.h>
  8670.      
  8671.      int __dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);
  8672.  
  8673. Description
  8674. -----------
  8675.  
  8676. Please refer to *Note DPMI Specification:: for details on DPMI function
  8677. call operation.  Also see *Note DPMI Overview:: for general information.
  8678.  
  8679. DPMI function AX = 0x0b00
  8680.  
  8681. Set a debug breakpoint.  Type is 0 for execute, 1 for write, and 2 for
  8682. access.  Fill in address and size (1,2,4 bytes).  Server fills in
  8683. handle.
  8684.  
  8685. Return Value
  8686. ------------
  8687.  
  8688. -1 on error, else zero.
  8689.  
  8690. 
  8691. File: libc.inf,  Node: __dpmi_set_descriptor,  Next: __dpmi_set_descriptor_access_rights,  Prev: __dpmi_set_debug_watchpoint,  Up: Alphabetical List
  8692.  
  8693. __dpmi_set_descriptor
  8694. =====================
  8695.  
  8696. Syntax
  8697. ------
  8698.  
  8699.      #include <dpmi.h>
  8700.      
  8701.      int __dpmi_set_descriptor(int _selector, void *_buffer);
  8702.  
  8703. Description
  8704. -----------
  8705.  
  8706. Please refer to *Note DPMI Specification:: for details on DPMI function
  8707. call operation.  Also see *Note DPMI Overview:: for general information.
  8708.  
  8709. DPMI function AX = 0x000c
  8710.  
  8711. This function sets the selector's parameters.  *Note
  8712. __dpmi_get_descriptor::.
  8713.  
  8714. Return Value
  8715. ------------
  8716.  
  8717. -1 on error, else zero.
  8718.  
  8719. 
  8720. File: libc.inf,  Node: __dpmi_set_descriptor_access_rights,  Next: __dpmi_set_extended_exception_handler_vector_pm,  Prev: __dpmi_set_descriptor,  Up: Alphabetical List
  8721.  
  8722. __dpmi_set_descriptor_access_rights
  8723. ===================================
  8724.  
  8725. Syntax
  8726. ------
  8727.  
  8728.      #include <dpmi.h>
  8729.      
  8730.      int __dpmi_set_descriptor_access_rights(int _selector, int _rights);
  8731.  
  8732. Description
  8733. -----------
  8734.  
  8735. Please refer to *Note DPMI Specification:: for details on DPMI function
  8736. call operation.  Also see *Note DPMI Overview:: for general information.
  8737.  
  8738. DPMI function AX = 0x0009
  8739.  
  8740. This sets the rights of _SELECTOR to _RIGHTS.
  8741.  
  8742.      ---- ---- ---- ---X = 0=not accessed, 1=accessed
  8743.      ---- ---- ---- --X- = data: 0=read, 1=r/w; code: 1=readable
  8744.      ---- ---- ---- -X-- = data: 0=expand-up, 1=expand-down; code: 0=non-conforming
  8745.      ---- ---- ---- X--- = 0=data, 1=code
  8746.      ---- ---- ---1 ---- = must be 1
  8747.      ---- ---- -XX- ---- = priviledge level (must equal CPL)
  8748.      ---- ---- X--- ---- = 0=absent, 1=present
  8749.      ---X ---- ---- ---- = available for the user
  8750.      --0- ---- ---- ---- = must be 0
  8751.      -X-- ---- ---- ---- = 0=16-bit 1=32-bit
  8752.      X--- ---- ---- ---- = 0=byte granular (small) 1=page-granular (big)
  8753.  
  8754. Return Value
  8755. ------------
  8756.  
  8757. -1 on error, else zero.
  8758.  
  8759. 
  8760. 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
  8761.  
  8762. __dpmi_set_extended_exception_handler_vector_pm
  8763. ===============================================
  8764.  
  8765. Syntax
  8766. ------
  8767.  
  8768.      #include <dpmi.h>
  8769.      
  8770.      int __dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  8771.  
  8772. Description
  8773. -----------
  8774.  
  8775. Please refer to *Note DPMI Specification:: for details on DPMI function
  8776. call operation.  Also see *Note DPMI Overview:: for general information.
  8777.  
  8778. DPMI function AX = 0x0212 (DPMI 1.0 only)
  8779.  
  8780. This function installs a handler for protected-mode exceptions.
  8781.  
  8782. Return Value
  8783. ------------
  8784.  
  8785. -1 on error, else zero.
  8786.  
  8787. 
  8788. 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
  8789.  
  8790. __dpmi_set_extended_exception_handler_vector_rm
  8791. ===============================================
  8792.  
  8793. Syntax
  8794. ------
  8795.  
  8796.      #include <dpmi.h>
  8797.      
  8798.      int __dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  8799.  
  8800. Description
  8801. -----------
  8802.  
  8803. Please refer to *Note DPMI Specification:: for details on DPMI function
  8804. call operation.  Also see *Note DPMI Overview:: for general information.
  8805.  
  8806. DPMI function AX = 0x0213 (DPMI 1.0 only)
  8807.  
  8808. This function installs a handler for real-mode exceptions.
  8809.  
  8810. Return Value
  8811. ------------
  8812.  
  8813. -1 on error, else zero.
  8814.  
  8815. 
  8816. File: libc.inf,  Node: __dpmi_set_multiple_descriptors,  Next: __dpmi_set_page_attributes,  Prev: __dpmi_set_extended_exception_handler_vector_rm,  Up: Alphabetical List
  8817.  
  8818. __dpmi_set_multiple_descriptors
  8819. ===============================
  8820.  
  8821. Syntax
  8822. ------
  8823.  
  8824.      #include <dpmi.h>
  8825.      
  8826.      int __dpmi_set_multiple_descriptors(int _count, void *_buffer);
  8827.  
  8828. Description
  8829. -----------
  8830.  
  8831. Please refer to *Note DPMI Specification:: for details on DPMI function
  8832. call operation.  Also see *Note DPMI Overview:: for general information.
  8833.  
  8834. DPMI function AX = 0x000f (DPMI 1.0 only)
  8835.  
  8836. This function sets multiple descriptors.  Buffer usage is like *Note
  8837. __dpmi_get_multiple_descriptors::, but the caller fills in everything
  8838. before calling.
  8839.  
  8840. Return Value
  8841. ------------
  8842.  
  8843. Returns _count if successful, the negative of # descriptors set if
  8844. failure.
  8845.  
  8846. 
  8847. File: libc.inf,  Node: __dpmi_set_page_attributes,  Next: __dpmi_set_processor_exception_handler_vector,  Prev: __dpmi_set_multiple_descriptors,  Up: Alphabetical List
  8848.  
  8849. __dpmi_set_page_attributes
  8850. ==========================
  8851.  
  8852. Syntax
  8853. ------
  8854.  
  8855.      #include <dpmi.h>
  8856.      
  8857.      int __dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  8858.  
  8859. Description
  8860. -----------
  8861.  
  8862. Please refer to *Note DPMI Specification:: for details on DPMI function
  8863. call operation.  Also see *Note DPMI Overview:: for general information.
  8864.  
  8865. DPMI function AX = 0x0507 (DPMI 1.0 only)
  8866.  
  8867. Sets page attributes.  Pass handle, offset within block in .address,
  8868. and number of pages in .count.  Buffer points to new attributes (see
  8869. spec).
  8870.  
  8871. Return Value
  8872. ------------
  8873.  
  8874. -1 on error, else zero.
  8875.  
  8876. 
  8877. 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
  8878.  
  8879. __dpmi_set_processor_exception_handler_vector
  8880. =============================================
  8881.  
  8882. Syntax
  8883. ------
  8884.  
  8885.      #include <dpmi.h>
  8886.      
  8887.      int __dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);
  8888.  
  8889. Description
  8890. -----------
  8891.  
  8892. Please refer to *Note DPMI Specification:: for details on DPMI function
  8893. call operation.  Also see *Note DPMI Overview:: for general information.
  8894.  
  8895. DPMI function AX = 0x0203
  8896.  
  8897. This function installs a handler for protected mode exceptions (not
  8898. interrupts).  You must pass a selector:offset pair.
  8899.  
  8900. Return Value
  8901. ------------
  8902.  
  8903. -1 on error, else zero.
  8904.  
  8905. 
  8906. 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
  8907.  
  8908. __dpmi_set_protected_mode_interrupt_vector
  8909. ==========================================
  8910.  
  8911. Syntax
  8912. ------
  8913.  
  8914.      #include <dpmi.h>
  8915.      
  8916.      int __dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  8917.  
  8918. Description
  8919. -----------
  8920.  
  8921. Please refer to *Note DPMI Specification:: for details on DPMI function
  8922. call operation.  Also see *Note DPMI Overview:: for general information.
  8923.  
  8924. DPMI function AX = 0x0205
  8925.  
  8926. This function installs a protected-mode interrupt (not exception)
  8927. handler.  You must pass a selector:offset pair.  Hardware interrupts
  8928. will always be reflected to protected mode if you install a handler.
  8929. You must explicitely `sti' before `iret' because `iret' won't always
  8930. restore interrupts in a virtual environment.
  8931.  
  8932. Return Value
  8933. ------------
  8934.  
  8935. -1 on error, else zero.
  8936.  
  8937. 
  8938. 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
  8939.  
  8940. __dpmi_set_real_mode_interrupt_vector
  8941. =====================================
  8942.  
  8943. Syntax
  8944. ------
  8945.  
  8946.      #include <dpmi.h>
  8947.      
  8948.      int __dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  8949.  
  8950. Description
  8951. -----------
  8952.  
  8953. Please refer to *Note DPMI Specification:: for details on DPMI function
  8954. call operation.  Also see *Note DPMI Overview:: for general information.
  8955.  
  8956. DPMI function AX = 0x0201
  8957.  
  8958. This function sets a real-mode interrupt vector.  You must pass a
  8959. segment:offset pair, not a selector.
  8960.  
  8961. Bits [31:8] in the vector number are silently ignored.
  8962.  
  8963. Return Value
  8964. ------------
  8965.  
  8966. Zero.  This function always works.
  8967.  
  8968. 
  8969. File: libc.inf,  Node: __dpmi_set_segment_base_address,  Next: __dpmi_set_segment_limit,  Prev: __dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  8970.  
  8971. __dpmi_set_segment_base_address
  8972. ===============================
  8973.  
  8974. Syntax
  8975. ------
  8976.  
  8977.      #include <dpmi.h>
  8978.      
  8979.      int __dpmi_set_segment_base_address(int _selector, unsigned _address);
  8980.  
  8981. Description
  8982. -----------
  8983.  
  8984. Please refer to *Note DPMI Specification:: for details on DPMI function
  8985. call operation.  Also see *Note DPMI Overview:: for general information.
  8986.  
  8987. DPMI function AX = 0x0007
  8988.  
  8989. This function sets the base address of the _SELECTOR to _ADDRESS.
  8990.  
  8991. Return Value
  8992. ------------
  8993.  
  8994. -1 on error, else zero.
  8995.  
  8996. 
  8997. File: libc.inf,  Node: __dpmi_set_segment_limit,  Next: __dpmi_simulate_real_mode_interrupt,  Prev: __dpmi_set_segment_base_address,  Up: Alphabetical List
  8998.  
  8999. __dpmi_set_segment_limit
  9000. ========================
  9001.  
  9002. Syntax
  9003. ------
  9004.  
  9005.      #include <dpmi.h>
  9006.      
  9007.      int __dpmi_set_segment_limit(int _selector, unsigned _address);
  9008.  
  9009. Description
  9010. -----------
  9011.  
  9012. Please refer to *Note DPMI Specification:: for details on DPMI function
  9013. call operation.  Also see *Note DPMI Overview:: for general information.
  9014.  
  9015. DPMI function AX = 0x0008
  9016.  
  9017. This function sets the highest valid address in the segment referenced
  9018. by _SELECTOR.  For example, if you pass 0xfffff, the highest valid
  9019. address is 0xfffff.  Note: if you pass a number <= 64K, the segment
  9020. changes to "non-big", and may cause unexpected problems.
  9021.  
  9022. Return Value
  9023. ------------
  9024.  
  9025. -1 on error, else zero.
  9026.  
  9027. 
  9028. File: libc.inf,  Node: __dpmi_simulate_real_mode_interrupt,  Next: __dpmi_simulate_real_mode_procedure_iret,  Prev: __dpmi_set_segment_limit,  Up: Alphabetical List
  9029.  
  9030. __dpmi_simulate_real_mode_interrupt
  9031. ===================================
  9032.  
  9033. Syntax
  9034. ------
  9035.  
  9036.      #include <dpmi.h>
  9037.      
  9038.      int __dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);
  9039.  
  9040. Description
  9041. -----------
  9042.  
  9043. Please refer to *Note DPMI Specification:: for details on DPMI function
  9044. call operation.  Also see *Note DPMI Overview:: for general information.
  9045.  
  9046. DPMI function AX = 0x0300
  9047.  
  9048. This function performs a software interrupt in real mode after filling
  9049. in *all* the registers from the given structure.  You *must* set %ss,
  9050. %esp, and %eflags to valid real-mode values or zero, unlike *Note
  9051. __dpmi_int::.
  9052.  
  9053. Return Value
  9054. ------------
  9055.  
  9056. -1 on error, else zero.
  9057.  
  9058. 
  9059. 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
  9060.  
  9061. __dpmi_simulate_real_mode_procedure_iret
  9062. ========================================
  9063.  
  9064. Syntax
  9065. ------
  9066.  
  9067.      #include <dpmi.h>
  9068.      
  9069.      int __dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);
  9070.  
  9071. Description
  9072. -----------
  9073.  
  9074. Please refer to *Note DPMI Specification:: for details on DPMI function
  9075. call operation.  Also see *Note DPMI Overview:: for general information.
  9076.  
  9077. DPMI function AX = 0x0303
  9078.  
  9079. This function switches to real mode, filling in *all* the registers
  9080. from the structure.  ss:sp and flags must be valid or zero.  The called
  9081. function must return with an `iret'.
  9082.  
  9083. Return Value
  9084. ------------
  9085.  
  9086. -1 on error, else zero.
  9087.  
  9088. 
  9089. 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
  9090.  
  9091. __dpmi_simulate_real_mode_procedure_retf
  9092. ========================================
  9093.  
  9094. Syntax
  9095. ------
  9096.  
  9097.      #include <dpmi.h>
  9098.      
  9099.      int __dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);
  9100.  
  9101. Description
  9102. -----------
  9103.  
  9104. Please refer to *Note DPMI Specification:: for details on DPMI function
  9105. call operation.  Also see *Note DPMI Overview:: for general information.
  9106.  
  9107. DPMI function AX = 0x0301
  9108.  
  9109. This function switches to real mode with *all* the registers set from
  9110. the structure, including cs:ip.  The function called should return with
  9111. a `retf'.  ss:sp and flags must be set to valid values or zero.
  9112.  
  9113. Return Value
  9114. ------------
  9115.  
  9116. -1 on error, else zero.
  9117.  
  9118. 
  9119. 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
  9120.  
  9121. __dpmi_simulate_real_mode_procedure_retf_stack
  9122. ==============================================
  9123.  
  9124. Syntax
  9125. ------
  9126.  
  9127.      #include <dpmi.h>
  9128.      
  9129.      int    __dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_bytes_to_copy, const void *stack_bytes);
  9130.  
  9131. Description
  9132. -----------
  9133.  
  9134. Please refer to *Note DPMI Specification:: for details on DPMI function
  9135. call operation.  Also see *Note DPMI Overview:: for general information.
  9136.  
  9137. DPMI function AX = 0x0301
  9138.  
  9139. This function switches to real mode with *all* the registers set from
  9140. the structure, including cs:ip.  The function called should return with
  9141. a `retf'.  ss:sp and flags must be set to valid values or zero.
  9142.  
  9143. You may optionally specify bytes to be copied to the real mode stack,
  9144. to pass arguments to real-mode procedures with stack-based calling
  9145. conventions.  If you don't want to copy bytes to the real mode stack,
  9146. pass 0 for stack_bytes_to_copy, and NULL for stack_bytes.
  9147.  
  9148. Return Value
  9149. ------------
  9150.  
  9151. -1 on error, else zero.
  9152.  
  9153. 
  9154. 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
  9155.  
  9156. __dpmi_terminate_and_stay_resident
  9157. ==================================
  9158.  
  9159. Syntax
  9160. ------
  9161.  
  9162.      #include <dpmi.h>
  9163.      
  9164.      int __dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);
  9165.  
  9166. Description
  9167. -----------
  9168.  
  9169. Please refer to *Note DPMI Specification:: for details on DPMI function
  9170. call operation.  Also see *Note DPMI Overview:: for general information.
  9171.  
  9172. DPMI function AX = 0x0c01 (DPMI 1.0 only)
  9173.  
  9174. See the spec.
  9175.  
  9176. Return Value
  9177. ------------
  9178.  
  9179. This call does not return.
  9180.  
  9181. 
  9182. File: libc.inf,  Node: __dpmi_unlock_linear_region,  Next: __dpmi_yield,  Prev: __dpmi_terminate_and_stay_resident,  Up: Alphabetical List
  9183.  
  9184. __dpmi_unlock_linear_region
  9185. ===========================
  9186.  
  9187. Syntax
  9188. ------
  9189.  
  9190.      #include <dpmi.h>
  9191.      
  9192.      int __dpmi_unlock_linear_region(__dpmi_meminfo *_info);
  9193.  
  9194. Description
  9195. -----------
  9196.  
  9197. Please refer to *Note DPMI Specification:: for details on DPMI function
  9198. call operation.  Also see *Note DPMI Overview:: for general information.
  9199.  
  9200. DPMI function AX = 0x0601
  9201.  
  9202. This function unlocks virtual memory.  Pass address and size (in bytes).
  9203.  
  9204. Return Value
  9205. ------------
  9206.  
  9207. -1 on error, else zero.
  9208.  
  9209. 
  9210. File: libc.inf,  Node: __dpmi_yield,  Next: dup,  Prev: __dpmi_unlock_linear_region,  Up: Alphabetical List
  9211.  
  9212. __dpmi_yield
  9213. ============
  9214.  
  9215. Syntax
  9216. ------
  9217.  
  9218.      #include <dpmi.h>
  9219.      
  9220.      int __dpmi_yield(void);
  9221.  
  9222. Description
  9223. -----------
  9224.  
  9225. Please refer to *Note DPMI Specification:: for details on DPMI function
  9226. call operation.  Also see *Note DPMI Overview:: for general information.
  9227.  
  9228. INT 0x2f, AX = 0x1680
  9229.  
  9230. This function yields the CPU to the next process.  This should be
  9231. called in busy-wait loops.
  9232.  
  9233. Return Value
  9234. ------------
  9235.  
  9236. None.
  9237.  
  9238. 
  9239. File: libc.inf,  Node: dup,  Next: dup2,  Prev: __dpmi_yield,  Up: Alphabetical List
  9240.  
  9241. dup
  9242. ===
  9243.  
  9244. Syntax
  9245. ------
  9246.  
  9247.      #include <unistd.h>
  9248.      
  9249.      int dup(int old_handle);
  9250.  
  9251. Description
  9252. -----------
  9253.  
  9254. This function duplicates the given file handle.  Both handles refer to
  9255. the same file and file pointer.
  9256.  
  9257. Return Value
  9258. ------------
  9259.  
  9260. The new file handle, or -1 if error.
  9261.  
  9262. Example
  9263. -------
  9264.  
  9265.      do_file(dup(fileno(stdin)));
  9266.  
  9267. 
  9268. File: libc.inf,  Node: dup2,  Next: _dxe_load,  Prev: dup,  Up: Alphabetical List
  9269.  
  9270. dup2
  9271. ====
  9272.  
  9273. Syntax
  9274. ------
  9275.  
  9276.      #include <unistd.h>
  9277.      
  9278.      int dup2(int existing_handle, int new_handle);
  9279.  
  9280. Description
  9281. -----------
  9282.  
  9283. This call causes NEW_HANDLE to refer to the same file and file pointer
  9284. as EXISTING_HANDLE.  If NEW_HANDLE is an open file, it is closed.
  9285.  
  9286. Return Value
  9287. ------------
  9288.  
  9289. The new handle, or -1 on error.
  9290.  
  9291. Example
  9292. -------
  9293.  
  9294.      /* copy new file to stdin stream */
  9295.      close(0);
  9296.      dup2(new_stdin, 0);
  9297.      close(new_stdin);
  9298.  
  9299. 
  9300. File: libc.inf,  Node: _dxe_load,  Next: enable,  Prev: dup2,  Up: Alphabetical List
  9301.  
  9302. _dxe_load
  9303. =========
  9304.  
  9305. Syntax
  9306. ------
  9307.  
  9308.      #include <sys/dxe.h>
  9309.      
  9310.      void *_dxe_load(char *dxe_filename);
  9311.      
  9312.        static int (*add)(int a, int b);
  9313.      
  9314.        add = _dxe_load("add.dxe");
  9315.        if (add == 0)
  9316.          printf("Cannot load add.dxe\n");
  9317.        else
  9318.          printf("Okay, 3 + 4 = %d\n", add(3,4));
  9319.  
  9320. Description
  9321. -----------
  9322.  
  9323. This function loads a dynamic executable image into memory and returns
  9324. the entry point for the symbol associated with the image.  The symbol
  9325. may point to a structure or a function.
  9326.  
  9327. Return Value
  9328. ------------
  9329.  
  9330. 0 on failure, the address of the loaded symbol on success.
  9331.  
  9332. 
  9333. File: libc.inf,  Node: enable,  Next: endgrent,  Prev: _dxe_load,  Up: Alphabetical List
  9334.  
  9335. enable
  9336. ======
  9337.  
  9338. Syntax
  9339. ------
  9340.  
  9341.      #include <dos.h>
  9342.      
  9343.      int enable(void);
  9344.  
  9345. Description
  9346. -----------
  9347.  
  9348. This function enables interrupts.
  9349.  
  9350. *Note disable::.
  9351.  
  9352. Return Value
  9353. ------------
  9354.  
  9355. Returns nonzero if the interrupts were already enabled, zero if they
  9356. had been disabled before this call.
  9357.  
  9358. Example
  9359. -------
  9360.  
  9361.      int ints_were_enabled;
  9362.      
  9363.      ints_were_enabled = enable();
  9364.      . . . do some stuff . . .
  9365.      if (!ints_were_enabled)
  9366.        disable();
  9367.  
  9368. 
  9369. File: libc.inf,  Node: endgrent,  Next: endmntent,  Prev: enable,  Up: Alphabetical List
  9370.  
  9371. endgrent
  9372. ========
  9373.  
  9374. Syntax
  9375. ------
  9376.  
  9377.      #include <grp.h>
  9378.      
  9379.      void endgrent(void);
  9380.  
  9381. Description
  9382. -----------
  9383.  
  9384. This function should be called after all calls to `getgrent',
  9385. `getgrgid', or `getgrnam'.
  9386.  
  9387. Return Value
  9388. ------------
  9389.  
  9390. None.
  9391.  
  9392. Example
  9393. -------
  9394.  
  9395. *Note getgrent::.
  9396.  
  9397. 
  9398. File: libc.inf,  Node: endmntent,  Next: endpwent,  Prev: endgrent,  Up: Alphabetical List
  9399.  
  9400. endmntent
  9401. =========
  9402.  
  9403. Syntax
  9404. ------
  9405.  
  9406.      #include <mntent.h>
  9407.      
  9408.      int endmntent(FILE *filep);
  9409.  
  9410. Description
  9411. -----------
  9412.  
  9413. This function should be called after the last call to getmntent (*note
  9414. getmntent::.).
  9415.  
  9416. Return Value
  9417. ------------
  9418.  
  9419. This function always returns one.
  9420.  
  9421. 
  9422. File: libc.inf,  Node: endpwent,  Next: errno,  Prev: endmntent,  Up: Alphabetical List
  9423.  
  9424. endpwent
  9425. ========
  9426.  
  9427. Syntax
  9428. ------
  9429.  
  9430.      #include <pwd.h>
  9431.      
  9432.      void endpwent(void);
  9433.  
  9434. Description
  9435. -----------
  9436.  
  9437. This function should be called after the last call to getpwent (*note
  9438. getpwent::.).
  9439.  
  9440. Return Value
  9441. ------------
  9442.  
  9443. None.
  9444.  
  9445. 
  9446. File: libc.inf,  Node: errno,  Next: exec*,  Prev: endpwent,  Up: Alphabetical List
  9447.  
  9448. errno
  9449. =====
  9450.  
  9451. Syntax
  9452. ------
  9453.  
  9454.      #include <errno.h>
  9455.      
  9456.      extern int errno;
  9457.  
  9458. Description
  9459. -----------
  9460.  
  9461. This variable is used to hold the value of the error of the last
  9462. function call.  The value might be one of the following:
  9463.  
  9464. `0'
  9465.      No Error
  9466.  
  9467. `1'
  9468.      EDOM - Input to function out of range
  9469.  
  9470. `2'
  9471.      ERANGE - Output of function out of range
  9472.  
  9473. `3'
  9474.      E2BIG - Argument list too long
  9475.  
  9476. `4'
  9477.      EACCES - Permission denied
  9478.  
  9479. `5'
  9480.      EAGAIN - Resource temporarily unavailable
  9481.  
  9482. `6'
  9483.      EBADF - Bad file descriptor
  9484.  
  9485. `7'
  9486.      EBUSY - Resource busy
  9487.  
  9488. `8'
  9489.      ECHILD - No child processes
  9490.  
  9491. `9'
  9492.      EDEADLK - Resource deadlock avoided
  9493.  
  9494. `10'
  9495.      EEXIST - File exists
  9496.  
  9497. `11'
  9498.      EFAULT - Bad address
  9499.  
  9500. `12'
  9501.      EFBIG - File too large
  9502.  
  9503. `13'
  9504.      EINTR - Interrupted system call
  9505.  
  9506. `14'
  9507.      EINVAL - Invalid argument
  9508.  
  9509. `15'
  9510.      EIO - Input or output
  9511.  
  9512. `16'
  9513.      EISDIR - Is a directory
  9514.  
  9515. `17'
  9516.      EMFILE - Too many open files
  9517.  
  9518. `18'
  9519.      EMLINK - Too many links
  9520.  
  9521. `19'
  9522.      ENAMETOOLONG - File name too long
  9523.  
  9524. `20'
  9525.      ENFILE - Too many open files in system
  9526.  
  9527. `21'
  9528.      ENODEV - No such device
  9529.  
  9530. `22'
  9531.      ENOENT - No such file or directory
  9532.  
  9533. `23'
  9534.      ENOEXEC - Unable to execute file
  9535.  
  9536. `24'
  9537.      ENOLCK - No locks available
  9538.  
  9539. `25'
  9540.      ENOMEM - Not enough memory
  9541.  
  9542. `26'
  9543.      ENOSPC - No space left on drive
  9544.  
  9545. `27'
  9546.      ENOSYS - Function not implemented
  9547.  
  9548. `28'
  9549.      ENOTDIR - Not a directory
  9550.  
  9551. `29'
  9552.      ENOTEMPTY - Directory not empty
  9553.  
  9554. `30'
  9555.      ENOTTY - Inappropriate I/O control operation
  9556.  
  9557. `31'
  9558.      ENXIO - No such device or address
  9559.  
  9560. `32'
  9561.      EPERM - Operation not permitted
  9562.  
  9563. `33'
  9564.      EPIPE - Broken pipe
  9565.  
  9566. `34'
  9567.      EROFS - Read-only file system
  9568.  
  9569. `35'
  9570.      ESPIPE - Invalid seek
  9571.  
  9572. `36'
  9573.      ESRCH - No such process
  9574.  
  9575. `37'
  9576.      EXDEV - Improper link
  9577.  
  9578. `38'
  9579.      ENMFILE - No more files
  9580.  
  9581. *Note perror::.
  9582.  
  9583. 
  9584. File: libc.inf,  Node: exec*,  Next: __exit,  Prev: errno,  Up: Alphabetical List
  9585.  
  9586. exec*
  9587. =====
  9588.  
  9589. Syntax
  9590. ------
  9591.  
  9592.      #include <unistd.h>
  9593.      
  9594.      int execl(const char *path, const char *argv0, ...);
  9595.      int execle(const char *path, const char *argv0, ... /*, char *const envp[] */);
  9596.      int execlp(const char *path, const char *argv0, ...);
  9597.      int execlpe(const char *path, const char *argv0, ... /*, char *const envp[] */);
  9598.      
  9599.      int execv(const char *path, char *const argv[]);
  9600.      int execve(const char *path, char *const argv[], char *const envp[]);
  9601.      int execvp(const char *path, char *const argv[]);
  9602.      int execvpe(const char *path, char *const argv[], char *const envp[]);
  9603.  
  9604. Description
  9605. -----------
  9606.  
  9607. These functions operate by calling `spawn*' with a type of `P_OVERLAY'.
  9608. Refer to *Note spawn*:: for a full description.
  9609.  
  9610. Return Value
  9611. ------------
  9612.  
  9613. If successful, these functions do not return.  If there is an error,
  9614. these functions return -1 and set `errno' to indicate the error.
  9615.  
  9616. Example
  9617. -------
  9618.  
  9619.      execlp("gcc", "gcc", "-v", "hello.c", 0);
  9620.  
  9621. 
  9622. File: libc.inf,  Node: __exit,  Next: _exit,  Prev: exec*,  Up: Alphabetical List
  9623.  
  9624. __exit
  9625. ======
  9626.  
  9627. Syntax
  9628. ------
  9629.  
  9630.      #include <stdlib.h>
  9631.      
  9632.      void __exit(int exit_code);
  9633.  
  9634. Description
  9635. -----------
  9636.  
  9637. This is an internal library function which exits the program, returning
  9638. EXIT_CODE to the calling process.  No additional processing is done,
  9639. and any `atexit' functions are not called.  Since hardware interrupts
  9640. are not unhooked, this can cause crashes after the program exits. This
  9641. function is normally called only by `_exit'; do *not* call it directly.
  9642.  
  9643. Return Value
  9644. ------------
  9645.  
  9646. This function does not return.
  9647.  
  9648. 
  9649. File: libc.inf,  Node: _exit,  Next: exit,  Prev: __exit,  Up: Alphabetical List
  9650.  
  9651. _exit
  9652. =====
  9653.  
  9654. Syntax
  9655. ------
  9656.  
  9657.      #include <stdlib.h>
  9658.      
  9659.      void _exit(int exit_code);
  9660.  
  9661. Description
  9662. -----------
  9663.  
  9664. This function exits the program, returning EXIT_CODE to the calling
  9665. process.  No additional processing (such as closing file descriptors or
  9666. calls to the static destructor functions) is done, and any `atexit'
  9667. functions are not called; only the hardware interrupt handlers are
  9668. unhooked, to prevent system crashes e.g. after a call to `abort'.  This
  9669. function is normally called only by `exit' and `abort'.
  9670.  
  9671. Return Value
  9672. ------------
  9673.  
  9674. This function does not return.
  9675.  
  9676. 
  9677. File: libc.inf,  Node: exit,  Next: exp,  Prev: _exit,  Up: Alphabetical List
  9678.  
  9679. exit
  9680. ====
  9681.  
  9682. Syntax
  9683. ------
  9684.  
  9685.      #include <stdlib.h>
  9686.      
  9687.      void exit(int exit_code);
  9688.  
  9689. Description
  9690. -----------
  9691.  
  9692. This function exits the program, returning EXIT_CODE to the calling
  9693. process.  Before exiting, all open files are closed and all `atexit'
  9694. and `on_exit' requests are processed.
  9695.  
  9696. Return Value
  9697. ------------
  9698.  
  9699. This function does not return.
  9700.  
  9701. Example
  9702. -------
  9703.  
  9704.      if (argc < 4)
  9705.      {
  9706.        print_usage();
  9707.        exit(1);
  9708.      }
  9709.  
  9710. 
  9711. File: libc.inf,  Node: exp,  Next: fabs,  Prev: exit,  Up: Alphabetical List
  9712.  
  9713. exp
  9714. ===
  9715.  
  9716. Syntax
  9717. ------
  9718.  
  9719.      #include <math.h>
  9720.      
  9721.      double exp(double x);
  9722.  
  9723. Return Value
  9724. ------------
  9725.  
  9726. e to the X power.
  9727.  
  9728. 
  9729. File: libc.inf,  Node: fabs,  Next: _far*,  Prev: exp,  Up: Alphabetical List
  9730.  
  9731. fabs
  9732. ====
  9733.  
  9734. Syntax
  9735. ------
  9736.  
  9737.      #include <math.h>
  9738.      
  9739.      double fabs(double x);
  9740.  
  9741. Return Value
  9742. ------------
  9743.  
  9744. X if X is positive, else -X.  Note that in this context, +0.0 is
  9745. positive and -0.0 is negative.
  9746.  
  9747. 
  9748. File: libc.inf,  Node: _far*,  Next: fclose,  Prev: fabs,  Up: Alphabetical List
  9749.  
  9750. _far*
  9751. =====
  9752.  
  9753. Syntax
  9754. ------
  9755.  
  9756.      #include <sys/farptr.h>
  9757.      
  9758.      unsigned char _farpeekb(unsigned short selector, unsigned long offset);
  9759.      unsigned short _farpeekw(unsigned short selector, unsigned long offset);
  9760.      unsigned long _farpeekl(unsigned short selector, unsigned long offset);
  9761.      
  9762.      void _farpokeb(unsigned short sel, unsigned long off, unsigned char val);
  9763.      void _farpokew(unsigned short sel, unsigned long off, unsigned short val);
  9764.      void _farpokel(unsigned short sel, unsigned long off, unsigned long val);
  9765.      
  9766.      void _farsetsel(unsigned short selector);
  9767.      unsigned short _fargetsel(void);
  9768.      
  9769.      void _farnspokeb(unsigned long offset, unsigned char value);
  9770.      void _farnspokew(unsigned long offset, unsigned short value);
  9771.      void _farnspokel(unsigned long offset, unsigned long value);
  9772.      
  9773.      unsigned char _farnspeekb(unsigned long offset);
  9774.      unsigned short _farnspeekw(unsigned long offset);
  9775.      unsigned long _farnspeekl(unsigned long offset);
  9776.  
  9777. Description
  9778. -----------
  9779.  
  9780. These functions provide the equivalent functionality of "far pointers"
  9781. to peek or poke an absolute memory addresses, even though gcc doesn't
  9782. understand the keyword "far".  They come in handy when you need to
  9783. access memory-mapped devices (like VGA) or some address in lower memory
  9784. returned by a real-mode service.  These functions are provided as
  9785. inline assembler functions, so when you optimize your program they
  9786. reduce to only a few opcodes (only one more than a regular memory
  9787. access), resulting in very optimal code.
  9788.  
  9789. The first two groups of functions take a SELECTOR and an OFFSET.  This
  9790. selector is *not* a dos segment.  If you want to access dos memory,
  9791. pass _go32_info_block.selector_for_linear_memory (or just _dos_ds) as
  9792. the selector, and seg*16+ofs as the offset.  For functions which poke
  9793. the memory, you should also provide the VALUE to put there.
  9794.  
  9795. The last two groups assume that you've used `_farsetsel' to specify the
  9796. selector.  You should avoid making any function calls between
  9797. `_farsetsel' and using these other functions, unless you're absolutely
  9798. sure that they won't modify that selector.  This allows you to optimize
  9799. loops by setting the selector once outside the loop, and using the
  9800. shorter functions within the loop.  You can use `_fargetsel' if you
  9801. want to temporary change the selector with `_farsetsel' and restore it
  9802. afterwards.
  9803.  
  9804. Return Value
  9805. ------------
  9806.  
  9807. Functions which peek the address return the value at given address.
  9808. `_fargetsel' returns the current selector.
  9809.  
  9810. 
  9811. File: libc.inf,  Node: fclose,  Next: fcntl,  Prev: _far*,  Up: Alphabetical List
  9812.  
  9813. fclose
  9814. ======
  9815.  
  9816. Syntax
  9817. ------
  9818.  
  9819.      #include <stdio.h>
  9820.      
  9821.      int fclose(FILE *file);
  9822.  
  9823. Description
  9824. -----------
  9825.  
  9826. This function closes the given FILE.
  9827.  
  9828. Return Value
  9829. ------------
  9830.  
  9831. Zero on success, else `EOF'.
  9832.  
  9833. Example
  9834. -------
  9835.  
  9836.      FILE *f = fopen("data", "r");
  9837.      fprintf(f, "Hello\n");
  9838.      fclose(f);
  9839.  
  9840. 
  9841. File: libc.inf,  Node: fcntl,  Next: fdopen,  Prev: fclose,  Up: Alphabetical List
  9842.  
  9843. fcntl
  9844. =====
  9845.  
  9846. Syntax
  9847. ------
  9848.  
  9849.      #include <fcntl.h>
  9850.      
  9851.      int fcntl (int fd, int cmd, ...);
  9852.  
  9853. Description
  9854. -----------
  9855.  
  9856. This function performs the operation specified by CMD on FD.  Note that
  9857. it only supports `F_DUPFD' which acts like `dup(fd)' (*note dup::.) but
  9858. searches empty descriptor from additional argument.
  9859.  
  9860. Return Value
  9861. ------------
  9862.  
  9863. If invalid CMD or FD was passed, it returns -1.  In case F_DUPFD, it
  9864. returns new descriptor or -1 for error.
  9865.  
  9866. 
  9867. File: libc.inf,  Node: fdopen,  Next: feof,  Prev: fcntl,  Up: Alphabetical List
  9868.  
  9869. fdopen
  9870. ======
  9871.  
  9872. Syntax
  9873. ------
  9874.  
  9875.      #include <stdio.h>
  9876.      
  9877.      FILE *fdopen(int fd, const char *mode);
  9878.  
  9879. Description
  9880. -----------
  9881.  
  9882. This function opens a stream-type file that uses the given FD file,
  9883. which must already be open.  The file is opened with the modes
  9884. specified by MODE, which is the same as for `fopen'.  *Note fopen::.
  9885.  
  9886. Return Value
  9887. ------------
  9888.  
  9889. The newly created `FILE *', or `NULL' on error.
  9890.  
  9891. Example
  9892. -------
  9893.  
  9894.      FILE *stdprn = fdopen(4, "w");
  9895.  
  9896. 
  9897. File: libc.inf,  Node: feof,  Next: ferror,  Prev: fdopen,  Up: Alphabetical List
  9898.  
  9899. feof
  9900. ====
  9901.  
  9902. Syntax
  9903. ------
  9904.  
  9905.      #include <stdio.h>
  9906.      
  9907.      int feof(FILE *file);
  9908.  
  9909. Description
  9910. -----------
  9911.  
  9912. This function can be used to indicate if the given FILE is at the
  9913. end-of-file or not.
  9914.  
  9915. Return Value
  9916. ------------
  9917.  
  9918. Nonzero at end-of-file, zero otherwise.
  9919.  
  9920. Example
  9921. -------
  9922.  
  9923.      while (!feof(stdin))
  9924.        gets(line);
  9925.  
  9926. 
  9927. File: libc.inf,  Node: ferror,  Next: fflush,  Prev: feof,  Up: Alphabetical List
  9928.  
  9929. ferror
  9930. ======
  9931.  
  9932. Syntax
  9933. ------
  9934.  
  9935.      #include <stdio.h>
  9936.      
  9937.      int ferror(FILE *file);
  9938.  
  9939. Description
  9940. -----------
  9941.  
  9942. This function can be used to indicate if the given FILE has encountered
  9943. an error or not.  *Note clearerr::.
  9944.  
  9945. Return Value
  9946. ------------
  9947.  
  9948. Nonzero for an error, zero otherwize.
  9949.  
  9950. Example
  9951. -------
  9952.  
  9953.      if (ferror(stdin))
  9954.        exit(1);
  9955.  
  9956. 
  9957. File: libc.inf,  Node: fflush,  Next: ffs,  Prev: ferror,  Up: Alphabetical List
  9958.  
  9959. fflush
  9960. ======
  9961.  
  9962. Syntax
  9963. ------
  9964.  
  9965.      #include <stdio.h>
  9966.      
  9967.      int fflush(FILE *file);
  9968.  
  9969. Description
  9970. -----------
  9971.  
  9972. This function causes any unwritten buffered data to be written out to
  9973. the given FILE.  This is useful in cases where the output is line
  9974. buffered and you want to write a partial line.
  9975.  
  9976. Return Value
  9977. ------------
  9978.  
  9979. Zero on success, -1 on error.
  9980.  
  9981. Example
  9982. -------
  9983.  
  9984.      printf("Enter value : ");
  9985.      fflush(stdout);
  9986.      scanf(result);
  9987.  
  9988. 
  9989. File: libc.inf,  Node: ffs,  Next: fgetc,  Prev: fflush,  Up: Alphabetical List
  9990.  
  9991. ffs
  9992. ===
  9993.  
  9994. Syntax
  9995. ------
  9996.  
  9997.      #include <string.h>
  9998.      
  9999.      int ffs(int _mask);
  10000.  
  10001. Description
  10002. -----------
  10003.  
  10004. This function find the first (least significant) bit set in the input
  10005. value.
  10006.  
  10007. Return Value
  10008. ------------
  10009.  
  10010. Bit position (1..32) of the least significant set bit, or zero if the
  10011. input value is zero.
  10012.  
  10013. Example
  10014. -------
  10015.  
  10016.      ffs(0) = 0
  10017.      ffs(1) = 1
  10018.      ffs(5) = 1
  10019.      ffs(96) = 6
  10020.  
  10021. 
  10022. File: libc.inf,  Node: fgetc,  Next: fgetgrent,  Prev: ffs,  Up: Alphabetical List
  10023.  
  10024. fgetc
  10025. =====
  10026.  
  10027. Syntax
  10028. ------
  10029.  
  10030.      #include <stdio.h>
  10031.      
  10032.      int fgetc(FILE *file);
  10033.  
  10034. Description
  10035. -----------
  10036.  
  10037. Returns the next character in the given FILE as an unsigned char.
  10038.  
  10039. Return Value
  10040. ------------
  10041.  
  10042. The given char (value 0..255) or `EOF' at end-of-file.
  10043.  
  10044. Example
  10045. -------
  10046.  
  10047.      int c;
  10048.      while((c=fgetc(stdin)) != EOF)
  10049.        fputc(c, stdout);
  10050.  
  10051. 
  10052. File: libc.inf,  Node: fgetgrent,  Next: fgetpos,  Prev: fgetc,  Up: Alphabetical List
  10053.  
  10054. fgetgrent
  10055. =========
  10056.  
  10057. Syntax
  10058. ------
  10059.  
  10060.      #include <grp.h>
  10061.      
  10062.      struct group *fgetgrent(FILE *file);
  10063.  
  10064. Description
  10065. -----------
  10066.  
  10067. This function, in MS-DOS, is exactly the same as `getgrent' (*note
  10068. getgrent::.).
  10069.  
  10070. 
  10071. File: libc.inf,  Node: fgetpos,  Next: fgets,  Prev: fgetgrent,  Up: Alphabetical List
  10072.  
  10073. fgetpos
  10074. =======
  10075.  
  10076. Syntax
  10077. ------
  10078.  
  10079.      #include <stdio.h>
  10080.      
  10081.      int fgetpos(FILE *file, fpos_t *offset);
  10082.  
  10083. Description
  10084. -----------
  10085.  
  10086. This function records the current file pointer for FILE, for later use
  10087. by `fsetpos'.
  10088.  
  10089. *Note fsetpos::.  *Note ftell::.
  10090.  
  10091. Return Value
  10092. ------------
  10093.  
  10094. Zero if successful, nonzero if not.
  10095.  
  10096. 
  10097. File: libc.inf,  Node: fgets,  Next: File System Extensions,  Prev: fgetpos,  Up: Alphabetical List
  10098.  
  10099. fgets
  10100. =====
  10101.  
  10102. Syntax
  10103. ------
  10104.  
  10105.      #include <stdio.h>
  10106.      
  10107.      char *fgets(char *buffer, int maxlength, FILE *file);
  10108.  
  10109. Description
  10110. -----------
  10111.  
  10112. This function reads as much of a line from a file as possible, stopping
  10113. when the buffer is full (MAXLENGTH-1 characters), an end-of-line is
  10114. detected, or `EOF' or an error is detected.  It then stores a `NULL' to
  10115. terminate the string.
  10116.  
  10117. Return Value
  10118. ------------
  10119.  
  10120. The address of the buffer is returned on success, if `EOF' is
  10121. encountered before any characters are stored, or if an error is
  10122. detected, `NULL' is returned instead.
  10123.  
  10124. Example
  10125. -------
  10126.  
  10127.      char buf[100];
  10128.      while (fgets(buf, 100, stdin))
  10129.        fputs(buf, stdout);
  10130.  
  10131. 
  10132. File: libc.inf,  Node: File System Extensions,  Next: __file_exists,  Prev: fgets,  Up: Alphabetical List
  10133.  
  10134. File System Extensions
  10135. ======================
  10136.  
  10137. Description
  10138. -----------
  10139.  
  10140. The File System Extensions are a part of the lowest level of I/O
  10141. operations in the C runtime library of DJGPP.  These extensions are
  10142. provided to allow for cases where Unix uses a file descriptor to access
  10143. such items as serial ports, memory, and the network, but DOS does not.
  10144. It allows a set of functions (called an extension) to gain control when
  10145. one of these low-level functions is called on a file descriptor set up
  10146. by the extension.
  10147.  
  10148. Each extension must provide one or two handler functions.  All handler
  10149. functions take the same arguments:
  10150.  
  10151.        int function(__FSEXT_Fnumber func_number, int *rv, va_list args);
  10152.  
  10153. The FUNC_NUMBER identifies which function is to be emulated.  The file
  10154. `<sys/fsext.h>' defines the function numbers as follows:
  10155.  
  10156. `__FSEXT_nop'
  10157.      A no-op.  This is currently unused by the library functions.
  10158.  
  10159. `__FSEXT_open'
  10160.      An open handler.  This is called just before the library is about
  10161.      to issue the DOS OpenFile call on behalf of your program.
  10162.  
  10163. `__FSEXT_creat'
  10164.      A create handler.  Called when a file needs to be created.  Note
  10165.      that the handler should both create the "file" and open it.
  10166.  
  10167. `__FSEXT_read'
  10168.      A read handler.  Called when data should be read from a "file".
  10169.  
  10170. `__FSEXT_write'
  10171.      A write handler.  Called to write data to a "file".
  10172.  
  10173. `__FSEXT_read'
  10174.      A ready handler.  It is called by `select' library function (*note
  10175.      select::.) when it needs to know whether a handle used to
  10176.      reference the "file" is ready for reading or writing, or has an
  10177.      error condition set.  The handler should return an OR'ed bit mask
  10178.      of the following bits (defined on `<sys/fsext.h>'):
  10179.  
  10180.     `__FSEXT_ready_read'
  10181.           The "file" is ready for reading.
  10182.  
  10183.     `__FSEXT_ready_write'
  10184.           The "file" is ready for writing.
  10185.  
  10186.     `__FSEXT_ready_error'
  10187.           The "file" has an error condition set.
  10188.  
  10189. `__FSEXT_close'
  10190.      A close handler.  Called when the "file" should be closed.
  10191.  
  10192. RV points to a temporary return value pointer.  If the function is
  10193. emulated by the handler, the return value should be stored here, and the
  10194. handler should return a nonzero value.  If the handler returns zero, it
  10195. is assumed to have not emulated the call, and the regular DOS I/O
  10196. function will happen.  The ARGS represent the arguments passed to the
  10197. original function; these point to the actual arguments on the stack, so
  10198. the emulation may choose to modify them and return zero to the regular
  10199. function, which will then act on the modified arguments.
  10200.  
  10201. A normal extension would provide these parts:
  10202.  
  10203.    *  Some function to create a connection to the extension.  This may
  10204.      be a custom function (such as `socket' for networking) or an
  10205.      extension to open (such as for `/dev/null' emulation).
  10206.  
  10207.    *  Initialization code that adds the open handler, if any.
  10208.  
  10209.    *  Overrides for the basic I/O functions, such as `read' and
  10210.      `write'.  This is a single function in the extension that uses the
  10211.      function number parameter to select an extension function.
  10212.  
  10213.    *  The core functionality of the extension, if any.
  10214.  
  10215. 
  10216. File: libc.inf,  Node: __file_exists,  Next: file_tree_walk,  Prev: File System Extensions,  Up: Alphabetical List
  10217.  
  10218. __file_exists
  10219. =============
  10220.  
  10221. Syntax
  10222. ------
  10223.  
  10224.      #include <unistd.h>
  10225.      
  10226.      int __file_exists(const char *_fn);
  10227.  
  10228. Description
  10229. -----------
  10230.  
  10231. This function provides a fast way to ask if a given file exists.
  10232. Unlike access(), this function does not cause other objects to get
  10233. linked in with your program, so is used primarily by the startup code
  10234. to keep minimum code size small.
  10235.  
  10236. Return Value
  10237. ------------
  10238.  
  10239. Zero if the file does not exist, nonzero if it does.  Note that this is
  10240. the opposite of what access() returns.
  10241.  
  10242. Example
  10243. -------
  10244.  
  10245.  
  10246.      if (__file_exists(fname))
  10247.        process_file(fname);
  10248.  
  10249. 
  10250. File: libc.inf,  Node: file_tree_walk,  Next: filelength,  Prev: __file_exists,  Up: Alphabetical List
  10251.  
  10252. file_tree_walk
  10253. ==============
  10254.  
  10255. Syntax
  10256. ------
  10257.  
  10258.      #include <dir.h>
  10259.      
  10260.      int __file_tree_walk(const char *dir,
  10261.                         int (*func)(const char *path, const struct ffblk *ff));
  10262.  
  10263. Description
  10264. -----------
  10265.  
  10266. This function recursively descends the directory hierarchy which starts
  10267. with DIR.  For each file in the hierarchy, `__file_tree_walk' calls the
  10268. user-defined function FUNC which is passed a pointer to a
  10269. `NULL'-terminated character array in PATH holding the full pathname of
  10270. the file, a pointer to a `ffblk' structure (*note findfirst::.) FFF
  10271. with a DOS filesystem information about that file.
  10272.  
  10273. This function always visits a directory before any of its siblings.  The
  10274. argument DIR must be a directory, or `__file_tree_walk' will fail and
  10275. set ERRNO to `ENOTDIR'.  The directory DIR itself is never passed to
  10276. FUNC.
  10277.  
  10278. The tree traversal continues until one of the following events:
  10279.  
  10280. (1)  The tree is exhausted (i.e., all descendants of DIR are
  10281. processed).  In this case, `__file_tree_walk' returns 0, meaning a
  10282. success.
  10283.  
  10284. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  10285. `__file_tree_walk' stops the tree traversal and returns whatever FUNC
  10286. returned.
  10287.  
  10288. (3)  An error is detected within `__file_tree_walk'.  In that case,
  10289. `ftw' returns -1 and sets ERRNO (*note errno::.) to a suitable value.
  10290.  
  10291. Return Value
  10292. ------------
  10293.  
  10294. Zero in case the entire tree was successfully traversed, -1 if
  10295. `__file_tree_walk' detected some error during its operation, or any
  10296. other non-zero value which was returned by the user-defined function
  10297. FUNC.
  10298.  
  10299. Example
  10300. -------
  10301.  
  10302.      #include <stdlib.h>
  10303.      
  10304.      int
  10305.      ff_walker(const char *path, const struct ffblk *ff)
  10306.      {
  10307.        printf("%s:\t%lu\t", path, ff->ff_fsize);
  10308.        if (ff->ff_attrib & 1)
  10309.          printf("R");
  10310.        if (ff->ff_attrib & 2)
  10311.          printf("H");
  10312.        if (ff->ff_attrib & 4)
  10313.          printf("S");
  10314.        if (ff->ff_attrib & 8)
  10315.          printf("V");
  10316.        if (ff->ff_attrib & 0x10)
  10317.          printf("D");
  10318.        if (ff->ff_attrib & 0x20)
  10319.          printf("A");
  10320.        printf("\n");
  10321.      
  10322.        if (strcmp(ff->ff_name, "XXXXX") == 0)
  10323.          return 42;
  10324.        return 0;
  10325.      }
  10326.      
  10327.      int
  10328.      main(int argc, char *argv[])
  10329.      {
  10330.        if (argc > 1)
  10331.          {
  10332.            char msg[80];
  10333.      
  10334.            sprintf(msg, "__file_tree_walk: %d",
  10335.                         __file_tree_walk(argv[1], ff_walker));
  10336.            if (errno)
  10337.              perror(msg);
  10338.            else
  10339.              puts(msg);
  10340.          }
  10341.        else
  10342.          printf("Usage: %s dir\n", argv[0]);
  10343.      
  10344.        return 0;
  10345.      }
  10346.  
  10347. 
  10348. File: libc.inf,  Node: filelength,  Next: fileno,  Prev: file_tree_walk,  Up: Alphabetical List
  10349.  
  10350. filelength
  10351. ==========
  10352.  
  10353. Syntax
  10354. ------
  10355.  
  10356.      #include <io.h>
  10357.      
  10358.      long filelength(int fhandle);
  10359.  
  10360. Description
  10361. -----------
  10362.  
  10363. This function returns the size, in bytes, of a file whose handle is
  10364. specified in the argument FHANDLE.  To get the handle of a file opened
  10365. by *Note fopen:: or *Note freopen::, you can use *Note fileno:: macro.
  10366.  
  10367. Return Value
  10368. ------------
  10369.  
  10370. The size of the file in bytes, or (if any error occured) -1L and ERRNO
  10371. set to a value describing the cause of the failure.
  10372.  
  10373. Example
  10374. -------
  10375.  
  10376.        printf("Size of file to which STDIN is redirected is %ld\n",
  10377.                filelength(0));
  10378.  
  10379. 
  10380. File: libc.inf,  Node: fileno,  Next: findfirst,  Prev: filelength,  Up: Alphabetical List
  10381.  
  10382. fileno
  10383. ======
  10384.  
  10385. Syntax
  10386. ------
  10387.  
  10388.      #include <stdio.h>
  10389.      
  10390.      int fileno(FILE *file);
  10391.  
  10392. Description
  10393. -----------
  10394.  
  10395. This function returns the raw file descriptor number that FILE uses for
  10396. I/O.
  10397.  
  10398. Return Value
  10399. ------------
  10400.  
  10401. The file descriptor number.
  10402.  
  10403. 
  10404. File: libc.inf,  Node: findfirst,  Next: findnext,  Prev: fileno,  Up: Alphabetical List
  10405.  
  10406. findfirst
  10407. =========
  10408.  
  10409. Syntax
  10410. ------
  10411.  
  10412.      #include <dir.h>
  10413.      
  10414.      int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
  10415.  
  10416. Description
  10417. -----------
  10418.  
  10419. This function and the related `findnext' (*note findnext::.) are used
  10420. to scan directories for the list of files therein.  The PATHNAME is a
  10421. wildcard that specifies the directory and files to search for (such as
  10422. `subdir/*.c'), FFBLK is a structure to hold the results and state of
  10423. the search, and ATTRIB is a combination of the following:
  10424.  
  10425. `FA_RDONLY'
  10426.      Include read-only files in the search
  10427.  
  10428. `FA_HIDDEN'
  10429.      Include hidden files in the search
  10430.  
  10431. `FA_SYSTEM'
  10432.      Include system files in the search
  10433.  
  10434. `FA_LABEL'
  10435.      Include the volume label in the search
  10436.  
  10437. `FA_DIREC'
  10438.      Include subdirectories in the search
  10439.  
  10440. `FA_ARCH'
  10441.      Include modified files in the search
  10442.  
  10443. Any file that doesn't have any flag bits that aren't specified is
  10444. selected for the search.  Thus, if you specified `FA_DIREC' and
  10445. `FA_LABEL', you would get all subdirectories, the volume label, and any
  10446. file that is neither read-only or modified.
  10447.  
  10448. The results of the search are stored in FFBLK:
  10449.  
  10450.      struct ffblk {
  10451.        char ff_reserved[21];     /* used to hold the state of the search */
  10452.        unsigned char ff_attrib;  /* actual attributes of the file found */
  10453.        unsigned short ff_ftime;  /* hours:5, minutes:6, (seconds/2):5 */
  10454.        unsigned short ff_fdate;  /* (year-1980):7, month:4, day:5 */
  10455.        unsigned long ff_fsize;   /* size of file */
  10456.        char ff_name[16];         /* name of file as ASCIIZ string */
  10457.      }
  10458.  
  10459. Return Value
  10460. ------------
  10461.  
  10462. Zero if a match is found, nonzero if none found.
  10463.  
  10464. Example
  10465. -------
  10466.  
  10467.      struct ffblk f;
  10468.      int done = findfirst("*.exe", &f, FA_ARCH|FA_RDONLY);
  10469.      while (!done)
  10470.      {
  10471.        printf("%10u %2u:%02u:%02u %2u/%02u/%4u %s\n",
  10472.          f.ff_fsize,
  10473.          (f.ff_ftime >> 11) & 0x1f,
  10474.          (f.ff_ftime >>  5) & 0x3f,
  10475.          (f.ff_ftime & 0x1f) * 2,
  10476.          (f.ff_fdate >>  5) & 0x0f,
  10477.          (f.ff_fdate & 0x1f),
  10478.          ((f.ff_fdate >> 9) & 0x7f) + 1980,
  10479.          f.ff_name);
  10480.        done = findnext(&f);
  10481.      }
  10482.  
  10483. 
  10484. File: libc.inf,  Node: findnext,  Next: _fixpath,  Prev: findfirst,  Up: Alphabetical List
  10485.  
  10486. findnext
  10487. ========
  10488.  
  10489. Syntax
  10490. ------
  10491.  
  10492.      #include <dir.h>
  10493.      
  10494.      int findnext(struct ffblk *ffblk);
  10495.  
  10496. Description
  10497. -----------
  10498.  
  10499. This finds the next file in the search started by `findfirst'.  *Note
  10500. findfirst::.
  10501.  
  10502. Return Value
  10503. ------------
  10504.  
  10505. Zero if there was a match, else nonzero.
  10506.  
  10507. 
  10508. File: libc.inf,  Node: _fixpath,  Next: floor,  Prev: findnext,  Up: Alphabetical List
  10509.  
  10510. _fixpath
  10511. ========
  10512.  
  10513. Syntax
  10514. ------
  10515.  
  10516.      #include <sys/stat.h>
  10517.      
  10518.      void _fixpath(const char *in_path, char *out_path);
  10519.  
  10520. Description
  10521. -----------
  10522.  
  10523. This function canonicalizes the input path IN_PATH and stores the
  10524. result in the buffer pointed to by OUT_PATH.
  10525.  
  10526. The path is fixed by removing consecutive and trailing slashes, making
  10527. the path absolute if it's relative, removing "." components, collapsing
  10528. ".." components, adding a drive specifier if needed, and converting all
  10529. slashes to '/'.  DOS-style 8+3 names of directories which are part of
  10530. the pathname, as well as its final filename part, are returned
  10531. lower-cased in OUT_PATH, but long filenames are left intact.  *Note
  10532. _preserve_fncase::, for more details on letter-case conversions in
  10533. filenames.
  10534.  
  10535. Return Value
  10536. ------------
  10537.  
  10538. None.
  10539.  
  10540. Example
  10541. -------
  10542.  
  10543.      char oldpath[100], newpath[100];
  10544.      scanf(oldpath);
  10545.      _fixpath(oldpath, newpath);
  10546.      printf("that really is %s\n", newpath);
  10547.  
  10548. 
  10549. File: libc.inf,  Node: floor,  Next: _flush_disk_cache,  Prev: _fixpath,  Up: Alphabetical List
  10550.  
  10551. floor
  10552. =====
  10553.  
  10554. Syntax
  10555. ------
  10556.  
  10557.      #include <math.h>
  10558.      
  10559.      double floor(double x);
  10560.  
  10561. Return Value
  10562. ------------
  10563.  
  10564. The largest integer value less than or equal to X.
  10565.  
  10566. 
  10567. File: libc.inf,  Node: _flush_disk_cache,  Next: fmod,  Prev: floor,  Up: Alphabetical List
  10568.  
  10569. _flush_disk_cache
  10570. =================
  10571.  
  10572. Syntax
  10573. ------
  10574.  
  10575.      #include <io.h>
  10576.      
  10577.      void _flush_disk_cache (void);
  10578.  
  10579. Description
  10580. -----------
  10581.  
  10582. Attempts to update the disk with the data cached in the write-behind
  10583. disk cache.
  10584.  
  10585. Return Value
  10586. ------------
  10587.  
  10588. None.
  10589.  
  10590. 
  10591. File: libc.inf,  Node: fmod,  Next: _fmode,  Prev: _flush_disk_cache,  Up: Alphabetical List
  10592.  
  10593. fmod
  10594. ====
  10595.  
  10596. Syntax
  10597. ------
  10598.  
  10599.      #include <math.h>
  10600.      
  10601.      double fmod(double x, double y);
  10602.  
  10603. Return Value
  10604. ------------
  10605.  
  10606. The remainder of X/Y.
  10607.  
  10608. 
  10609. File: libc.inf,  Node: _fmode,  Next: fnmatch,  Prev: fmod,  Up: Alphabetical List
  10610.  
  10611. _fmode
  10612. ======
  10613.  
  10614. Syntax
  10615. ------
  10616.  
  10617.      #include <fcntl.h>
  10618.      
  10619.      extern int _fmode;
  10620.  
  10621. Description
  10622. -----------
  10623.  
  10624. This variable may be set to `O_TEXT' or `O_BINARY' to specify the mode
  10625. that newly opened files should be opened in if the open call did not
  10626. specify.  *Note open::. *Note fopen::.
  10627.  
  10628. The default value is `O_TEXT'.
  10629.  
  10630. Example
  10631. -------
  10632.  
  10633.      _fmode = O_BINARY;
  10634.  
  10635. 
  10636. File: libc.inf,  Node: fnmatch,  Next: fnmerge,  Prev: _fmode,  Up: Alphabetical List
  10637.  
  10638. fnmatch
  10639. =======
  10640.  
  10641. Syntax
  10642. ------
  10643.  
  10644.      #include <fnmatch.h>
  10645.      
  10646.      int fnmatch(const char *pattern, const char *string, int flags);
  10647.  
  10648. Description
  10649. -----------
  10650.  
  10651. This function indicates if STRING matches the PATTERN.  The pattern may
  10652. include the following special characters:
  10653.  
  10654. `*'
  10655.      Matches zero of more characters.
  10656.  
  10657. `?'
  10658.      Matches exactly one character
  10659.  
  10660. `[...]'
  10661.      Matches one character if it's in a range of characters.  If the
  10662.      first character is `!', matches if the character is not in the
  10663.      range.  Between the brackets, the range is specified by listing
  10664.      the characters that are in the range, or two characters separated
  10665.      by `-' to indicate all characters in that range.  For example,
  10666.      `[a-d]' matches `a', `b', `c', or `d'.
  10667.  
  10668. `\'
  10669.      Causes the next character to not be treated as a wildcard.  For
  10670.      example, `\*' matches an asterisk.  This is only available if FLAGS
  10671.      includes `FNM_QUOTE'.
  10672.  
  10673. The value of FLAGS is a combination of zero of more of the following:
  10674.  
  10675. `FNM_PATHNAME'
  10676.      This means that the string should be treated as a pathname, in
  10677.      that the slash character `/' never matches any of the wildcards.
  10678.  
  10679. `FNM_QUOTE'
  10680.      This means that the backslash `\\' may be used for quoting special
  10681.      characters in the pattern.
  10682.  
  10683. Return Value
  10684. ------------
  10685.  
  10686. Zero if the string matches, FNM_NOMATCH if it does not.
  10687.  
  10688. Example
  10689. -------
  10690.  
  10691.      if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
  10692.        do_source_file(filename);
  10693.  
  10694. 
  10695. File: libc.inf,  Node: fnmerge,  Next: fnsplit,  Prev: fnmatch,  Up: Alphabetical List
  10696.  
  10697. fnmerge
  10698. =======
  10699.  
  10700. Syntax
  10701. ------
  10702.  
  10703.      #include <dir.h>
  10704.      
  10705.      void fnmerge (char *path, const char *drive, const char *dir,
  10706.              const char *name, const char *ext);
  10707.  
  10708. Description
  10709. -----------
  10710.  
  10711. This function constructs a file PATH from its components DRIVE, DIR,
  10712. NAME, and EXT.  If any of these is a `NULL' pointer, it won't be used.
  10713. Usually, the DRIVE string should include the trailing colon ``:'', the
  10714. DIR string should include the trailing slash ``/'' or backslash ``\'',
  10715. and the EXT string should include the leading dot ``.''.  However, if
  10716. any of these isn't present, `fnmerge' will add them.
  10717.  
  10718. *Note fnsplit::.
  10719.  
  10720. Return Value
  10721. ------------
  10722.  
  10723. None.
  10724.  
  10725. Example
  10726. -------
  10727.  
  10728.      char buf[MAXPATH];
  10729.      fnmerge(buf, "d:", "/foo/", "data", ".txt");
  10730.  
  10731. 
  10732. File: libc.inf,  Node: fnsplit,  Next: fopen,  Prev: fnmerge,  Up: Alphabetical List
  10733.  
  10734. fnsplit
  10735. =======
  10736.  
  10737. Syntax
  10738. ------
  10739.  
  10740.      #include <dir.h>
  10741.      
  10742.      int fnsplit (const char *path, char *drive, char *dir,
  10743.              char *name, char *ext);
  10744.  
  10745. Description
  10746. -----------
  10747.  
  10748. This function decomposes a PATH into its components.  It is smart
  10749. enough to know that `.' and `..' are directories.  The DRIVE, DIR, NAME
  10750. and EXT arguments should all be passed, but some or even all of them
  10751. might be `NULL' pointers.  Those of them which are non-`NULL' should
  10752. point to buffers which have enough room for the strings they would
  10753. hold.  The constants `MAXDRIVE', `MAXDIR', `MAXFILE' and `MAXEXT',
  10754. defined on dir.h, define the maximum length of these buffers.
  10755.  
  10756. *Note fnmerge::.
  10757.  
  10758. Return Value
  10759. ------------
  10760.  
  10761. A flag that indicates which components were found:
  10762.  
  10763. `DRIVE'
  10764.      The drive letter was found.
  10765.  
  10766. `DIRECTORY'
  10767.      A directory or subdirectories was found.
  10768.  
  10769. `FILENAME'
  10770.      A filename was found.
  10771.  
  10772. `EXTENSION'
  10773.      An extension was found.
  10774.  
  10775. `WILDCARDS'
  10776.      The path included `*' or `?'.
  10777.  
  10778. Example
  10779. -------
  10780.  
  10781.      char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  10782.      int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  10783.      d = "d:"
  10784.      p = "/djgpp/bin/"
  10785.      f = "gcc"
  10786.      e = ".exe"
  10787.  
  10788. 
  10789. File: libc.inf,  Node: fopen,  Next: fork,  Prev: fnsplit,  Up: Alphabetical List
  10790.  
  10791. fopen
  10792. =====
  10793.  
  10794. Syntax
  10795. ------
  10796.  
  10797.      #include <stdio.h>
  10798.      FILE *fopen(const char *filename, const char *mode);
  10799.  
  10800. Description
  10801. -----------
  10802.  
  10803. This function opens a stream corresponding to the named FILENAME with
  10804. the given MODE.  The mode can be one of the following:
  10805.  
  10806. `r'
  10807.      Open an existing file for reading.
  10808.  
  10809. `w'
  10810.      Create a new file (or truncate an existing file) and open it for
  10811.      writing.
  10812.  
  10813. `a'
  10814.      Open an existing file (or create a new one) for writing.  The file
  10815.      pointer is positioned to the end of the file before every write.
  10816.  
  10817. Followed by any of these characters:
  10818.  
  10819. `b'
  10820.      Force the file to be open in binary mode instead of the default
  10821.      mode.
  10822.  
  10823.      When called to open the console in binary mode, `fopen' will
  10824.      disable the generation of `SIGINT' when you press `Ctrl-C'
  10825.      (`Ctrl-Break' will still cause `SIGINT'), because many programs
  10826.      that use binary reads from the console will also want to get the
  10827.      `^C' characters.  You can use the `__djgpp_set_ctrl_c' library
  10828.      function (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to
  10829.      generate interrupts while console is read in binary mode.
  10830.  
  10831. `t'
  10832.      Force the file to be open in text mode instead of the default mode.
  10833.  
  10834. `+'
  10835.      Open the file as with `O_RDWR' so that both reads and writes can
  10836.      be done to the same file.
  10837.  
  10838. If the file is open for both reading and writing, you must call
  10839. `fflush', `fseek', or `rewind' before switching from read to write or
  10840. from write to read.
  10841.  
  10842. The open file is set to line buffered if the underlying object is a
  10843. device (stdin, stdout, etc), or is fully buffered if the underlying
  10844. object is a disk file (data.c, etc).
  10845.  
  10846. If `b' or `t' is not specified in MODE, the file type is chosen by the
  10847. value of `fmode' (*note _fmode::.).
  10848.  
  10849. Return Value
  10850. ------------
  10851.  
  10852. A pointer to the `FILE' object, or `NULL' if there was an error.
  10853.  
  10854. Example
  10855. -------
  10856.  
  10857.      FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
  10858.  
  10859. 
  10860. File: libc.inf,  Node: fork,  Next: fpathconf,  Prev: fopen,  Up: Alphabetical List
  10861.  
  10862. fork
  10863. ====
  10864.  
  10865. Description
  10866. -----------
  10867.  
  10868. This function always returns -1 and sets `errno' to ENOMEM, as MS-DOS
  10869. does not support multiple processes.  It exists only to assist in
  10870. porting Unix programs.
  10871.  
  10872. 
  10873. File: libc.inf,  Node: fpathconf,  Next: _fpreset,  Prev: fork,  Up: Alphabetical List
  10874.  
  10875. fpathconf
  10876. =========
  10877.  
  10878. Syntax
  10879. ------
  10880.  
  10881.      #include <unistd.h>
  10882.      
  10883.      long fpathconf(int fd, int name);
  10884.  
  10885. Description
  10886. -----------
  10887.  
  10888. Returns configuration information on the filesystem that the open file
  10889. resides on.  *Note pathconf::.
  10890.  
  10891. Return Value
  10892. ------------
  10893.  
  10894. The configuration value, which are currently independent of the
  10895. filesystem that the file is on.
  10896.  
  10897. 
  10898. File: libc.inf,  Node: _fpreset,  Next: fprintf,  Prev: fpathconf,  Up: Alphabetical List
  10899.  
  10900. _fpreset
  10901. ========
  10902.  
  10903. Syntax
  10904. ------
  10905.  
  10906.      #include <float.h>
  10907.      
  10908.      void _fpreset(void);
  10909.  
  10910. Description
  10911. -----------
  10912.  
  10913. Resets the FPU completely.
  10914.  
  10915. 
  10916. File: libc.inf,  Node: fprintf,  Next: fpurge,  Prev: _fpreset,  Up: Alphabetical List
  10917.  
  10918. fprintf
  10919. =======
  10920.  
  10921. Syntax
  10922. ------
  10923.  
  10924.      #include <stdio.h>
  10925.      
  10926.      int fprintf(FILE *file, const char *format, ...);
  10927.  
  10928. Description
  10929. -----------
  10930.  
  10931. Prints formatted output to the named file.  *Note printf::.
  10932.  
  10933. Return Value
  10934. ------------
  10935.  
  10936. The number of characters written.
  10937.  
  10938. 
  10939. File: libc.inf,  Node: fpurge,  Next: fputc,  Prev: fprintf,  Up: Alphabetical List
  10940.  
  10941. fpurge
  10942. ======
  10943.  
  10944. Syntax
  10945. ------
  10946.  
  10947.      #include <stdio.h>
  10948.      
  10949.      int fpurge(FILE *file);
  10950.  
  10951. Description
  10952. -----------
  10953.  
  10954. This function purges the buffer for FILE without writing it to disk.
  10955.  
  10956. Return Value
  10957. ------------
  10958.  
  10959. Zero on success, -1 on failure.
  10960.  
  10961. 
  10962. File: libc.inf,  Node: fputc,  Next: fputs,  Prev: fpurge,  Up: Alphabetical List
  10963.  
  10964. fputc
  10965. =====
  10966.  
  10967. Syntax
  10968. ------
  10969.  
  10970.      #include <stdio.h>
  10971.      
  10972.      int fputc(int character, FILE *file);
  10973.  
  10974. Description
  10975. -----------
  10976.  
  10977. This function writes the given CHARACTER to the given `file'.
  10978.  
  10979. Return Value
  10980. ------------
  10981.  
  10982. The given character [0..255] or `EOF'.
  10983.  
  10984. Example
  10985. -------
  10986.  
  10987.      fputc('\n', stdout);
  10988.  
  10989. 
  10990. File: libc.inf,  Node: fputs,  Next: fread,  Prev: fputc,  Up: Alphabetical List
  10991.  
  10992. fputs
  10993. =====
  10994.  
  10995. Syntax
  10996. ------
  10997.  
  10998.      #include <stdio.h>
  10999.      
  11000.      int fputs(const char *string, FILE *file);
  11001.  
  11002. Description
  11003. -----------
  11004.  
  11005. This function all the characters of STRING (except the trailing `NULL')
  11006. to the given FILE.
  11007.  
  11008. Return Value
  11009. ------------
  11010.  
  11011. A nonnegative number on success, `EOF' on error.
  11012.  
  11013. Example
  11014. -------
  11015.  
  11016.      fputs("Hello\n", stdout);
  11017.  
  11018. 
  11019. File: libc.inf,  Node: fread,  Next: free,  Prev: fputs,  Up: Alphabetical List
  11020.  
  11021. fread
  11022. =====
  11023.  
  11024. Syntax
  11025. ------
  11026.  
  11027.      #include <stdio.h>
  11028.      
  11029.      size_t fread(void *buffer, size_t size, size_t number, FILE *file);
  11030.  
  11031. Description
  11032. -----------
  11033.  
  11034. This function reads SIZE*NUMBER characters from FILE to BUFFER.
  11035.  
  11036. Return Value
  11037. ------------
  11038.  
  11039. The number of items of size SIZE read, or -1 on error.
  11040.  
  11041. Example
  11042. -------
  11043.  
  11044.      int foo[10];
  11045.      fread(foo, sizeof(int), 10, stdin);
  11046.  
  11047. 
  11048. File: libc.inf,  Node: free,  Next: freopen,  Prev: fread,  Up: Alphabetical List
  11049.  
  11050. free
  11051. ====
  11052.  
  11053. Syntax
  11054. ------
  11055.  
  11056.      #include <stdio.h>
  11057.      
  11058.      void free(void *ptr);
  11059.  
  11060. Description
  11061. -----------
  11062.  
  11063. Returns the allocated memory to the heap (*note malloc::.).  If the PTR
  11064. is `NULL', it does nothing.
  11065.  
  11066. Return Value
  11067. ------------
  11068.  
  11069. None.
  11070.  
  11071. Example
  11072. -------
  11073.  
  11074.      char *q = (char *)malloc(20);
  11075.      free(q);
  11076.  
  11077. 
  11078. File: libc.inf,  Node: freopen,  Next: frexp,  Prev: free,  Up: Alphabetical List
  11079.  
  11080. freopen
  11081. =======
  11082.  
  11083. Syntax
  11084. ------
  11085.  
  11086.      #include <stdio.h>
  11087.      
  11088.      FILE *freopen(const char *filename, const char *mode, FILE *file);
  11089.  
  11090. Description
  11091. -----------
  11092.  
  11093. This function closes FILE if it was open, then opens a new file like
  11094. `fopen(filename, mode)' but it reuses FILE.
  11095.  
  11096. This is useful to, for example, associate `stdout' with a new file.
  11097.  
  11098. Return Value
  11099. ------------
  11100.  
  11101. The new file, or `NULL' on error.
  11102.  
  11103. Example
  11104. -------
  11105.  
  11106.      freopen("/tmp/stdout.dat", "wb", stdout);
  11107.  
  11108. 
  11109. File: libc.inf,  Node: frexp,  Next: fscanf,  Prev: freopen,  Up: Alphabetical List
  11110.  
  11111. frexp
  11112. =====
  11113.  
  11114. Syntax
  11115. ------
  11116.  
  11117.      #include <math.h>
  11118.      
  11119.      double frexp(double x, int *pexp);
  11120.  
  11121. Description
  11122. -----------
  11123.  
  11124. This function separates the given value X into a mantissa [0.5,1) and
  11125. an exponent *PEXP, such that m * 2 ^ e = x.  As an exception, when X is
  11126. zero, *PEXP and the return value are also both zero.
  11127.  
  11128. Return Value
  11129. ------------
  11130.  
  11131. The mantissa.
  11132.  
  11133. 
  11134. File: libc.inf,  Node: fscanf,  Next: fseek,  Prev: frexp,  Up: Alphabetical List
  11135.  
  11136. fscanf
  11137. ======
  11138.  
  11139. Syntax
  11140. ------
  11141.  
  11142.      #include <stdio.h>
  11143.      
  11144.      int fscanf(FILE *file, const char *format, ...);
  11145.  
  11146. Description
  11147. -----------
  11148.  
  11149. This function scans formatted text from FILE and stores it in the
  11150. variables pointed to by the arguments.  *Note scanf::.
  11151.  
  11152. Return Value
  11153. ------------
  11154.  
  11155. The number of items successfully scanned.
  11156.  
  11157. 
  11158. File: libc.inf,  Node: fseek,  Next: fsetpos,  Prev: fscanf,  Up: Alphabetical List
  11159.  
  11160. fseek
  11161. =====
  11162.  
  11163. Syntax
  11164. ------
  11165.  
  11166.      #include <stdio.h>
  11167.      
  11168.      int fseek(FILE *file, long offset, int mode);
  11169.  
  11170. Description
  11171. -----------
  11172.  
  11173. This function moves the file pointer for FILE according to MODE:
  11174.  
  11175. `SEEK_SET'
  11176.      The file pointer is moved to the offset specified.
  11177.  
  11178. `SEEK_CUR'
  11179.      The file pointer is moved relative to its current position.
  11180.  
  11181. `SEEK_END'
  11182.      The file pointer is moved to a position OFFSET bytes from the end
  11183.      of the file.  The offset is usually nonpositive in this case.
  11184.  
  11185. *Warning!* The ANSI standard only allows values of zero for OFFSET when
  11186. WHENCE is not `SEEK_SET' and the file has been opened as a text file.
  11187. Although this restriction is not enforced, beware that there is not a
  11188. one-to-one correspondence between file characters and text characters
  11189. under MS-DOS, so some `fseek' operations may not do exactly what you
  11190. expect.
  11191.  
  11192. Return Value
  11193. ------------
  11194.  
  11195. Zero if successful, nonzero if not.
  11196.  
  11197. Example
  11198. -------
  11199.  
  11200.      fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
  11201.  
  11202. 
  11203. File: libc.inf,  Node: fsetpos,  Next: __FSEXT_add_open_handler,  Prev: fseek,  Up: Alphabetical List
  11204.  
  11205. fsetpos
  11206. =======
  11207.  
  11208. Syntax
  11209. ------
  11210.  
  11211.      #include <stdio.h>
  11212.      
  11213.      int fsetpos(FILE *file, const fpos_t *offset);
  11214.  
  11215. Description
  11216. -----------
  11217.  
  11218. This function moves the file pointer for FILE to position OFFSET, as
  11219. recorded by `fgetpos'.
  11220.  
  11221. *Note fgetpos::.  *Note fseek::.
  11222.  
  11223. Return Value
  11224. ------------
  11225.  
  11226. Zero if successful, nonzero if not.
  11227.  
  11228. 
  11229. File: libc.inf,  Node: __FSEXT_add_open_handler,  Next: __FSEXT_alloc_fd,  Prev: fsetpos,  Up: Alphabetical List
  11230.  
  11231. __FSEXT_add_open_handler
  11232. ========================
  11233.  
  11234. Syntax
  11235. ------
  11236.  
  11237.      #include <sys/fsext.h>
  11238.      
  11239.      int __FSEXT_add_open_handler(__FSEXT_Function *_function);
  11240.  
  11241. Description
  11242. -----------
  11243.  
  11244. This function is part of the *Note File System Extensions::.  It is used
  11245. to add a handler for functions that do not get passed descriptors, such
  11246. as `_open' and `_creat'.
  11247.  
  11248. Example
  11249. -------
  11250.  
  11251.      static int
  11252.      _my_handler(__FSEXT_Fnumber n, int *rv, va_list args)
  11253.      {
  11254.        . . .
  11255.      }
  11256.      
  11257.      int main()
  11258.      {
  11259.        __FSEXT_add_open_handler(_my_handler);
  11260.      }
  11261.  
  11262. 
  11263. File: libc.inf,  Node: __FSEXT_alloc_fd,  Next: __FSEXT_call_open_handlers,  Prev: __FSEXT_add_open_handler,  Up: Alphabetical List
  11264.  
  11265. __FSEXT_alloc_fd
  11266. ================
  11267.  
  11268. Syntax
  11269. ------
  11270.  
  11271.      #include <sys/fsext.h>
  11272.      
  11273.      int __FSEXT_alloc_fd(__FSEXT_Function *_function);
  11274.  
  11275. Description
  11276. -----------
  11277.  
  11278. This function is part of the *Note File System Extensions::.  It is used
  11279. by extensions that fully emulate the I/O functions, and thus don't have
  11280. a corresponding DOS file handle.  This function opens DOS's `NUL'
  11281. device, so as to allocate a handle that DOS won't then reuse.  It also
  11282. assigns the handler function for that descriptor.
  11283.  
  11284. The module is responsible for calling `_close' on the descriptor after
  11285. setting the handler function to zero in the extended close handler.
  11286.  
  11287. Example
  11288. -------
  11289.  
  11290.  
  11291.      int socket()
  11292.      {
  11293.        int fd = __FSEXT_alloc_fd(socket_handler);
  11294.        init_socket(fd);
  11295.        return fd;
  11296.      }
  11297.  
  11298. 
  11299. File: libc.inf,  Node: __FSEXT_call_open_handlers,  Next: __FSEXT_get_function,  Prev: __FSEXT_alloc_fd,  Up: Alphabetical List
  11300.  
  11301. __FSEXT_call_open_handlers
  11302. ==========================
  11303.  
  11304. Syntax
  11305. ------
  11306.  
  11307.      #include <sys/fsext.h>
  11308.      
  11309.      int __FSEXT_call_open_handlers(__FSEXT_Fnumber _function_number,
  11310.                         int *rv, va_list _args);
  11311.  
  11312. Description
  11313. -----------
  11314.  
  11315. This function is part of the *Note File System Extensions::.  It is used
  11316. internally to libc.a to allow extensions to get an opportunity to
  11317. override the `_open' and `_creat' functions.
  11318.  
  11319. 
  11320. File: libc.inf,  Node: __FSEXT_get_function,  Next: __FSEXT_set_function,  Prev: __FSEXT_call_open_handlers,  Up: Alphabetical List
  11321.  
  11322. __FSEXT_get_function
  11323. ====================
  11324.  
  11325. Syntax
  11326. ------
  11327.  
  11328.      #include <sys/fsext.h>
  11329.      
  11330.      __FSEXT_Function *__FSEXT_get_function(int _fd);
  11331.  
  11332. This function is part of the *Note File System Extensions::.  It is used
  11333. internal to libc.a to redirect I/O requests to the appropriate
  11334. extensions.
  11335.  
  11336. Example
  11337. -------
  11338.  
  11339.      _read(int fd, void *buf, int len)
  11340.      {
  11341.        __FSEXT_Function *func = __FSEXT_get_function(fd);
  11342.        if (func)
  11343.        {
  11344.          int rv;
  11345.          if (func(__FSEXT_read, &rv, &fd))
  11346.            return rv;
  11347.        }
  11348.        /* rest of read() */
  11349.      }
  11350.  
  11351. 
  11352. File: libc.inf,  Node: __FSEXT_set_function,  Next: fstat,  Prev: __FSEXT_get_function,  Up: Alphabetical List
  11353.  
  11354. __FSEXT_set_function
  11355. ====================
  11356.  
  11357. Syntax
  11358. ------
  11359.  
  11360.      #include <sys/fsext.h>
  11361.      
  11362.      int __FSEXT_set_function(int _fd, __FSEXT_Function *_function);
  11363.  
  11364. Description
  11365. -----------
  11366.  
  11367. This function is part of the *Note File System Extensions::.  It is used
  11368. to set the handler function for those extensions that use DOS files for
  11369. I/O.  One situation where you might need this is when you must catch
  11370. output to the terminal and play some tricks with it, like colorize it or
  11371. redirect it to another device.
  11372.  
  11373. Return Value
  11374. ------------
  11375.  
  11376. Zero in case of success, non-zero in case of failure (like if _FD is
  11377. negative).
  11378.  
  11379. Example
  11380. -------
  11381.  
  11382.  
  11383.      #include <sys/fsext.h>
  11384.      #include <conio.h>
  11385.      
  11386.      /* A simple example of a write handler which converts DOS I/O to the
  11387.         screen into direct writes to video RAM.  */
  11388.      static int
  11389.      my_screen_write (__FSEXT_Fnumber func, int *retval, va_list rest_args)
  11390.      {
  11391.        char *buf, *mybuf;
  11392.        size_t buflen;
  11393.        int fd = va_arg (rest_args, int);
  11394.      
  11395.        if (func != __FSEXT_write || !isatty (fd))
  11396.          return 0;  /* and the usual DOS call will be issued */
  11397.      
  11398.        buf = va_arg (rest_args, char *);
  11399.        buflen = va_arg (rest_args, size_t);
  11400.        mybuf = alloca (buflen + 1);
  11401.        memcpy (mybuf, buf, buflen);
  11402.        mybuf[buflen] = '\0';
  11403.        cputs (mybuf);
  11404.        *retval = buflen;
  11405.        return 1;  /* meaning that we handled the call */
  11406.      }
  11407.      
  11408.      /* Install our handler.  The `attribute constructor' causes this
  11409.         function to be called by the startup code.  */
  11410.      static void __attribute__((constructor))
  11411.      install_screen_write_handler (void)
  11412.      {
  11413.        __FSEXT_set_function (fileno (stdout), my_screen_write);
  11414.      }
  11415.  
  11416. 
  11417. File: libc.inf,  Node: fstat,  Next: fsync,  Prev: __FSEXT_set_function,  Up: Alphabetical List
  11418.  
  11419. fstat
  11420. =====
  11421.  
  11422. Syntax
  11423. ------
  11424.  
  11425.      #include <sys/stat.h>
  11426.      
  11427.      int fstat(int file, struct stat *sbuf);
  11428.  
  11429. Description
  11430. -----------
  11431.  
  11432. This function obtains the status of the open file FILE and stores it in
  11433. SBUF.  *Note stat:: for the description of `struct stat' fields.
  11434.  
  11435. Return Value
  11436. ------------
  11437.  
  11438. Zero on success, nonzero on failure (and ERRNO set).
  11439.  
  11440. Example
  11441. -------
  11442.  
  11443.      struct stat s;
  11444.      fstat(fileno(stdin), &s);
  11445.      if (S_ISREG(s.st_mode))
  11446.        puts("STDIN is a redirected disk file");
  11447.      else if (S_ISCHR(s.st_mode))
  11448.        puts("STDIN is a character device");
  11449.  
  11450. Bugs
  11451. ----
  11452.  
  11453. If a file was open in write-only mode, its execute mode bits might be
  11454. incorrectly reported as if the file were non-executable.  This is
  11455. because some executables are only recognized by reading their first two
  11456. bytes, which cannot be done for files open in write-only mode.
  11457.  
  11458. For `fstat()' to return valid info, you should make sure that all the
  11459. data written to the file has been delivered to the operating system,
  11460. e.g. by calling `fflush()'.  Otherwise, the buffering of the library
  11461. I/O functions might cause stale info to be returned.
  11462.  
  11463. Implementation Notes
  11464. --------------------
  11465.  
  11466. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  11467. implementation nightmare.  The following notes describe some of the
  11468. obscure points specific to their behavior in DJGPP.
  11469.  
  11470. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  11471. is returned as -1.  For drives networked by Novell Netware, it is
  11472. returned as -2.
  11473.  
  11474. 2. The starting cluster number of a file serves as its inode number.
  11475. For files whose starting cluster number is inaccessible (empty files,
  11476. files on networked drives, etc.) the `st_inode' field will be `invented'
  11477. in a way which guarantees that no two different files will get the same
  11478. inode number (thus it is unique).  This invented inode will also be
  11479. different from any real cluster number of any local file.  However, only
  11480. for local, non-empty files/directories the inode is guaranteed to be
  11481. consistent between `stat()' and `fstat()' function calls.
  11482.  
  11483. 3. The WRITE access mode bit is set only for the user (unless the file
  11484. is read-only, hidden or system).  EXECUTE bit is set for directories,
  11485. files which can be executed from the DOS prompt (batch files, .com,
  11486. .dll and .exe executables) or run by go32 extender.  For files which
  11487. reside on networked drives under Novell Netware, this can sometimes
  11488. fail, in which case only the read access bit is set.
  11489.  
  11490. 4. Size of directories is reported as the number of its files (sans `.'
  11491. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  11492.  
  11493. 5. Time stamp for root directories is taken from the volume label entry,
  11494. if that's available; otherwise, it is reported as 1-Jan-1980.
  11495.  
  11496. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  11497. of `struct stat' are needed by the application.
  11498.  
  11499. 
  11500. File: libc.inf,  Node: fsync,  Next: ftell,  Prev: fstat,  Up: Alphabetical List
  11501.  
  11502. fsync
  11503. =====
  11504.  
  11505. Syntax
  11506. ------
  11507.  
  11508.      #include <unistd.h>
  11509.      
  11510.      int fsync(int file);
  11511.  
  11512. Description
  11513. -----------
  11514.  
  11515. Forces all information about the file to be synchronized with the disk
  11516. image.
  11517.  
  11518. Return Value
  11519. ------------
  11520.  
  11521. Zero on success, nonzero on failure.
  11522.  
  11523. Example
  11524. -------
  11525.  
  11526.      fsync(fileno(stdout));
  11527.  
  11528. 
  11529. File: libc.inf,  Node: ftell,  Next: ftime,  Prev: fsync,  Up: Alphabetical List
  11530.  
  11531. ftell
  11532. =====
  11533.  
  11534. Syntax
  11535. ------
  11536.  
  11537.      #include <stdio.h>
  11538.      
  11539.      long ftell(FILE *file);
  11540.  
  11541. Description
  11542. -----------
  11543.  
  11544. Returns the current file position for `file'.  This is suitable for a
  11545. future call to `fseek'.
  11546.  
  11547. Return Value
  11548. ------------
  11549.  
  11550. The file position, or -1 on error.
  11551.  
  11552. Example
  11553. -------
  11554.  
  11555.      long p = ftell(stdout);
  11556.  
  11557. 
  11558. File: libc.inf,  Node: ftime,  Next: ftruncate,  Prev: ftell,  Up: Alphabetical List
  11559.  
  11560. ftime
  11561. =====
  11562.  
  11563. Syntax
  11564. ------
  11565.  
  11566.      #include <sys/timeb.h>
  11567.      
  11568.      int ftime(struct timeb *buf);
  11569.  
  11570. Description
  11571. -----------
  11572.  
  11573. This function stores the current time in the structure BUF.  The format
  11574. of `struct timeb' is:
  11575.  
  11576.      struct timeb {
  11577.        time_t         time;     /* seconds since 00:00:00 GMT 1/1/1970 */
  11578.        unsigned short millitm;  /* milliseconds */
  11579.        short          timezone; /* difference between GMT and local, minutes */
  11580.        short          dstflag;  /* set if daylight savings time in affect */
  11581.      };
  11582.  
  11583. Return Value
  11584. ------------
  11585.  
  11586. Zero on success, nonzero on error.
  11587.  
  11588. Example
  11589. -------
  11590.  
  11591.      struct timeb t;
  11592.      ftime(&t);
  11593.  
  11594. 
  11595. File: libc.inf,  Node: ftruncate,  Next: ftw,  Prev: ftime,  Up: Alphabetical List
  11596.  
  11597. ftruncate
  11598. =========
  11599.  
  11600. Syntax
  11601. ------
  11602.  
  11603.      #include <unistd.h>
  11604.      
  11605.      int ftruncate(int file, off_t where);
  11606.  
  11607. Description
  11608. -----------
  11609.  
  11610. This function truncates FILE at WHERE length.  This only works if the
  11611. file is closed right after this call.
  11612.  
  11613. Return Value
  11614. ------------
  11615.  
  11616. Zero for success, nonzero for failure.
  11617.  
  11618. Example
  11619. -------
  11620.  
  11621.      int x = open("data", O_WRONLY);
  11622.      ftruncate(x, 1000);
  11623.      close(x);
  11624.  
  11625. 
  11626. File: libc.inf,  Node: ftw,  Next: _fwalk,  Prev: ftruncate,  Up: Alphabetical List
  11627.  
  11628. ftw
  11629. ===
  11630.  
  11631. Syntax
  11632. ------
  11633.  
  11634.      #include <ftw.h>
  11635.      
  11636.      int ftw(const char *dir,
  11637.              int (*func)(const char *path, struct stat *stbuf, int flag),
  11638.              int depth);
  11639.  
  11640. Description
  11641. -----------
  11642.  
  11643. This function recursively descends the directory hierarchy which starts
  11644. with DIR.  For each file in the hierarchy, `ftw' calls the user-defined
  11645. function FUNC which is passed a pointer to a `NULL'-terminated
  11646. character array in PATH holding the full pathname of the file, a
  11647. pointer to a `stat' structure (*note stat::.) STBUF with a filesystem
  11648. information about that file, and an integer FLAG.  Possible values of
  11649. FLAG are:
  11650.  
  11651. `FTW_F'
  11652.      This is a regular file.
  11653.  
  11654. `FTW_D'
  11655.      This is a directory.
  11656.  
  11657. `FTW_VL'
  11658.      This is a volume label.
  11659.  
  11660. `FTW_DNR'
  11661.      This is a directory which cannot be read with `readdir()'.  (This
  11662.      will never happen in DJGPP.)
  11663.  
  11664. `FTW_NS'
  11665.      This file exists, but `stat' fails for it.
  11666.  
  11667. If FLAG is `FTW_DNR', the descendants of that directory won't be
  11668. processed.  If FLAG is `FTW_NS', then STBUF will be garbled.
  11669.  
  11670. This function always visits a directory before any of its siblings.  The
  11671. argument DIR must be a directory, or `ftw' will fail and set ERRNO to
  11672. `ENOTDIR'.  The function FUNC is called with DIR as its argument before
  11673. the recursive descent begins.
  11674.  
  11675. The DEPTH argument has no meaning in the DJGPP implementation and is
  11676. always ignored.
  11677.  
  11678. The tree traversal continues until one of the following events:
  11679.  
  11680. (1)  The tree is exhausted (i.e., all descendants of DIR are
  11681. processed).  In this case, `ftw' returns 0, meaning a success.
  11682.  
  11683. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  11684. `ftw' stops the tree traversal and returns whatever FUNC returned.
  11685.  
  11686. (3)  An error is detected within `ftw'.  In that case, `ftw' returns -1
  11687. and sets ERRNO (*note errno::.) to a suitable value.
  11688.  
  11689. Return Value
  11690. ------------
  11691.  
  11692. Zero in case the entire tree was successfully traversed, -1 if `ftw'
  11693. detected some error during its operation, or any other non-zero value
  11694. which was returned by the user-defined function FUNC.
  11695.  
  11696. Implementation Notes
  11697. --------------------
  11698.  
  11699. This function uses `malloc' (*note malloc::.) for dynamic memory
  11700. allocation during its operation.  If FUNC disrupts the normal flow of
  11701. code execution by e.g. calling `longjump' or if an interrupt handler
  11702. which never returns is executed, this memory will remain permanently
  11703. allocated.
  11704.  
  11705. This function calls `opendir()' and `readdir()' functions to read the
  11706. directory entries.  Therefore, you can control what files will your
  11707. FUNC get by setting the appropriate bits in the external variable
  11708. __OPENDIR_FLAGS.  *Note opendir::, for description of these bits.
  11709.  
  11710. This function also calls `stat' for every directory entry it passes to
  11711. FUNC.  If your application only needs some part of the information
  11712. returned in the `stat' structure, you can make your application
  11713. significantly faster by setting bits in the external variable
  11714. _DJSTAT_FLAGS (*note _djstat_flags::. for details).  The most expensive
  11715. `stat' features are `_STAT_EXEC_MAGIC' and `_STAT_DIRSIZE'.
  11716.  
  11717. Example
  11718. -------
  11719.  
  11720.      #include <stdlib.h>
  11721.      
  11722.      int
  11723.      file_walker(const char *path, struct stat *sb, int flag)
  11724.      {
  11725.        char *base;
  11726.      
  11727.        printf("%s:\t%u\t", path, sb->st_size);
  11728.        if (S_ISLABEL(sb->st_mode))
  11729.          printf("V");
  11730.        if (S_ISDIR(sb->st_mode))
  11731.          printf("D");
  11732.        if (S_ISCHR(sb->st_mode))
  11733.          printf("C");
  11734.        if (sb->st_mode & S_IRUSR)
  11735.          printf("r");
  11736.        if (sb->st_mode & S_IWUSR)
  11737.          printf("w");
  11738.        if (sb->st_mode & S_IXUSR)
  11739.          printf("x");
  11740.      
  11741.        if (flag == FTW_NS)
  11742.          printf("  !!no_stat!!");
  11743.        printf("\n");
  11744.      
  11745.        base = strrchr(path, '/');
  11746.        if (base == 0)
  11747.          base = strrchr(path, '\\');
  11748.        if (base == 0)
  11749.          base = strrchr(path, ':');
  11750.        if (strcmp(base == 0 ? path : base + 1, "xxxxx") == 0)
  11751.          return 42;
  11752.        return 0;
  11753.      }
  11754.      
  11755.      int
  11756.      main(int argc, char *argv[])
  11757.      {
  11758.        if (argc > 1)
  11759.          {
  11760.            char msg[80];
  11761.      
  11762.            sprintf(msg, "file_tree_walk: %d",
  11763.                         ftw(argv[1], file_walker, 0));
  11764.            if (errno)
  11765.              perror(msg);
  11766.            else
  11767.              puts(msg);
  11768.          }
  11769.        else
  11770.          printf("Usage: %s dir\n", argv[0]);
  11771.      
  11772.        return 0;
  11773.      }
  11774.  
  11775. 
  11776. File: libc.inf,  Node: _fwalk,  Next: fwrite,  Prev: ftw,  Up: Alphabetical List
  11777.  
  11778. _fwalk
  11779. ======
  11780.  
  11781. Syntax
  11782. ------
  11783.  
  11784.      void _fwalk(void (*function)(FILE *file));
  11785.  
  11786. Description
  11787. -----------
  11788.  
  11789. For each open file in the system, the given FUNCTION is called, passing
  11790. the file pointer as it's only argument
  11791.  
  11792. Return Value
  11793. ------------
  11794.  
  11795. None.
  11796.  
  11797. Example
  11798. -------
  11799.  
  11800.      void pfile(FILE *x)
  11801.      { printf("FILE at %p\n", x); }
  11802.      
  11803.      _fwalk(pfile);
  11804.  
  11805. 
  11806. File: libc.inf,  Node: fwrite,  Next: _get_dev_info,  Prev: _fwalk,  Up: Alphabetical List
  11807.  
  11808. fwrite
  11809. ======
  11810.  
  11811. Syntax
  11812. ------
  11813.  
  11814.      #include <stdio.h>
  11815.      
  11816.      size_t fwrite(void *buffer, size_t size, size_t number, FILE *file);
  11817.  
  11818. Description
  11819. -----------
  11820.  
  11821. This function writes SIZE*NUMBER characters from BUFFER to FILE.
  11822.  
  11823. Return Value
  11824. ------------
  11825.  
  11826. The number of items of size SIZE written, or -1 on error.
  11827.  
  11828. Example
  11829. -------
  11830.  
  11831.      int foo[10];
  11832.      fwrite(foo, sizeof(int), 10, stdin);
  11833.  
  11834. 
  11835. File: libc.inf,  Node: _get_dev_info,  Next: _get_dos_version,  Prev: fwrite,  Up: Alphabetical List
  11836.  
  11837. _get_dev_info
  11838. =============
  11839.  
  11840. Syntax
  11841. ------
  11842.  
  11843.      #include <io.h>
  11844.      
  11845.      short _get_dev_info(int arg);
  11846.  
  11847. Description
  11848. -----------
  11849.  
  11850. Given drive_number (A: = 0, B: = 1, etc.) or a file handle in ARG, this
  11851. function returns the device info word which is returned by DOS IOCTL
  11852. function 0 (Int 21h/AX=4400h).  In case of error, -1 is returned and
  11853. ERRNO is set.
  11854.  
  11855. 
  11856. File: libc.inf,  Node: _get_dos_version,  Next: _get_volume_info,  Prev: _get_dev_info,  Up: Alphabetical List
  11857.  
  11858. _get_dos_version
  11859. ================
  11860.  
  11861. Syntax
  11862. ------
  11863.  
  11864.      #include <dos.h>
  11865.      
  11866.      extern unsigned short   _osmajor, _osminor;
  11867.      extern const    char  * _os_flavor;
  11868.      
  11869.      unsigned short _get_dos_version(int true_version);
  11870.  
  11871. Description
  11872. -----------
  11873.  
  11874. This function gets the host OS version and flavor.  If the argument
  11875. TRUE_VERSION is non-zero, it will return a `true' version number, which
  11876. is unaffected by possible tinkering with SETVER TSR program.  (This is
  11877. only available in DOS 5.0 or later.)
  11878.  
  11879. The external variables `_osmajor' and `_osminor' will always be set to
  11880. the major and minor parts of the `advertised' version number, possibly
  11881. changed by SETVER, even if TRUE_VERSION is non-zero.  You typically
  11882. need the true version when you need an intimate knowledge of the host
  11883. OS internals, like when using undocumented features.  Note that some
  11884. DOS clones (notably, DR-DOS) do not support DOS function required to
  11885. report the true DOS version; for these, the version reported might be
  11886. affected by SETVER even if TRUE_VERSION is non-zero.
  11887.  
  11888. The external variable `_os_flavor' will point to a string which
  11889. describes the OEM name of the host OS variety.
  11890.  
  11891. Return Value
  11892. ------------
  11893.  
  11894. `_get_dos_version()' returns the version number (true version number,
  11895. if TRUE_VERSION is non-zero) as a 16-bit number: the major part of the
  11896. version in the upper 8 bits, the minor part in the lower 8 bits.  For
  11897. instance, DOS version 6.20 will be returned as 0x0614.
  11898.  
  11899. Example
  11900. -------
  11901.  
  11902.        unsigned short true_dos_version = _get_dos_version(1);
  11903.      
  11904.        if (true_dos_version < 0x0614)   /* require DOS 6.20 or later */
  11905.          puts("This program needs DOS 6.20 or later to run");
  11906.        else
  11907.          printf("You are running %s variety of DOS\n", _os_flavor);
  11908.  
  11909. 
  11910. File: libc.inf,  Node: _get_volume_info,  Next: getc,  Prev: _get_dos_version,  Up: Alphabetical List
  11911.  
  11912. _get_volume_info
  11913. ================
  11914.  
  11915. Syntax
  11916. ------
  11917.  
  11918.      #include <fcntl.h>
  11919.      
  11920.      unsigned _get_volume_info (const char *path,
  11921.                                 int *max_file_len, int *max_path_len,
  11922.                                 char *fsystype);
  11923.  
  11924. Description
  11925. -----------
  11926.  
  11927. This function returns filesystem information about the volume where
  11928. PATH resides.  Only the root directory name part is actually used; if
  11929. PATH does not specify the drive explicitly, or is a `NULL' pointer, the
  11930. current drive is used.  Upon return, the variable pointed to by
  11931. *MAX_FILE_LEN contains the maximum length of a filename (including the
  11932. terminating zero), the variable pointed to by *MAX_PATH_LEN contains
  11933. the maximum length of a pathname (including the terminating zero), and
  11934. a string that identifies the filesystem type (e.g., "FAT", "NTFS" etc.)
  11935. is placed into the buffer pointed to by *FSYSTYPE, which should be long
  11936. enough (32 bytes are usually enough).  If any of these pointers is a
  11937. `NULL' pointer, it will be ignored.  The function returns various flags
  11938. that describe features supported by the given filesystem as a
  11939. bit-mapped number.  The following bits are currently defined:
  11940.  
  11941. `_FILESYS_CASE_SENSITIVE'
  11942.      Specifies that file searches are case-sensitive.
  11943.  
  11944. `_FILESYS_CASE_PRESERVED'
  11945.      Filename letter-case is preserved in directory entries.
  11946.  
  11947. `_FILESYS_UNICODE'
  11948.      Filesystem uses Unicode characters in file and directory names.
  11949.  
  11950. `_FILESYS_LFN_SUPPORTED'
  11951.      Filesystem supports the "Long File Name" (LFN) API.
  11952.  
  11953. `_FILESYS_VOL_COMPRESSED'
  11954.      This volume is compressed.
  11955.  
  11956. Return value
  11957. ------------
  11958.  
  11959. A combination of the above bits.
  11960.  
  11961. 
  11962. File: libc.inf,  Node: getc,  Next: getcbrk,  Prev: _get_volume_info,  Up: Alphabetical List
  11963.  
  11964. getc
  11965. ====
  11966.  
  11967. Syntax
  11968. ------
  11969.  
  11970.      #include <stdio.h>
  11971.      
  11972.      int getc(FILE *file);
  11973.  
  11974. Description
  11975. -----------
  11976.  
  11977. Get one character from FILE.
  11978.  
  11979. Return Value
  11980. ------------
  11981.  
  11982. The character ([0..255]) or `EOF' if eof or error.
  11983.  
  11984. Example
  11985. -------
  11986.  
  11987.      int c;
  11988.      while ((c=getc(stdin)) != EOF)
  11989.        putc(c, stdout);
  11990.  
  11991. 
  11992. File: libc.inf,  Node: getcbrk,  Next: getch,  Prev: getc,  Up: Alphabetical List
  11993.  
  11994. getcbrk
  11995. =======
  11996.  
  11997. Syntax
  11998. ------
  11999.  
  12000.      #include <dos.h>
  12001.      
  12002.      int getcbrk(void);
  12003.  
  12004. Description
  12005. -----------
  12006.  
  12007. Get the setting of the Ctrl-C checking flag in MS-DOS.
  12008.  
  12009. *Note setcbrk::.
  12010.  
  12011. Return Value
  12012. ------------
  12013.  
  12014. 0 if not checking, 1 if checking.
  12015.  
  12016. 
  12017. File: libc.inf,  Node: getch,  Next: getchar,  Prev: getcbrk,  Up: Alphabetical List
  12018.  
  12019. getch
  12020. =====
  12021.  
  12022. Syntax
  12023. ------
  12024.  
  12025.      #include <conio.h>
  12026.      
  12027.      int     getch(void);
  12028.  
  12029. Description
  12030. -----------
  12031.  
  12032. A single character from the console (stdin) is returned.  The input is
  12033. not line-buffered.  If there is a character pending from *Note
  12034. ungetch::, it is returned instead.  The character is not echoed to the
  12035. screen.
  12036.  
  12037. Return Value
  12038. ------------
  12039.  
  12040. The character.
  12041.  
  12042. 
  12043. File: libc.inf,  Node: getchar,  Next: getche,  Prev: getch,  Up: Alphabetical List
  12044.  
  12045. getchar
  12046. =======
  12047.  
  12048. Syntax
  12049. ------
  12050.  
  12051.      #include <stdio.h>
  12052.      
  12053.      int getchar(void);
  12054.  
  12055. Description
  12056. -----------
  12057.  
  12058. The same as `fgetc(stdin)' (*note fgetc::.).
  12059.  
  12060. Return Value
  12061. ------------
  12062.  
  12063. The character, or `EOF'.
  12064.  
  12065. 
  12066. File: libc.inf,  Node: getche,  Next: getcwd,  Prev: getchar,  Up: Alphabetical List
  12067.  
  12068. getche
  12069. ======
  12070.  
  12071. Syntax
  12072. ------
  12073.  
  12074.      #include <conio.h>
  12075.      
  12076.      int getche(void);
  12077.  
  12078. Description
  12079. -----------
  12080.  
  12081. A single character from the console (stdin) is returned.  The input is
  12082. not line-buffered.  If there is a character pending from *Note
  12083. ungetch::, it is returned instead.  The character is echoed to the
  12084. screen.
  12085.  
  12086. Return Value
  12087. ------------
  12088.  
  12089. The character.
  12090.  
  12091. 
  12092. File: libc.inf,  Node: getcwd,  Next: getdate,  Prev: getche,  Up: Alphabetical List
  12093.  
  12094. getcwd
  12095. ======
  12096.  
  12097. Syntax
  12098. ------
  12099.  
  12100.      #include <unistd.h>
  12101.      
  12102.      char *getcwd(char *buffer, int max);
  12103.  
  12104. Description
  12105. -----------
  12106.  
  12107. Get the current directory.  The return value includes the drive
  12108. specifier.  If BUFFER is `NULL', `getcwd' allocates memory with
  12109. `malloc'.  This call fails if more than MAX characters are required to
  12110. specify the current directory.
  12111.  
  12112. Return Value
  12113. ------------
  12114.  
  12115. The buffer, either BUFFER or a newly-allocated buffer, or `NULL' on
  12116. error.
  12117.  
  12118. Example
  12119. -------
  12120.  
  12121.      char *buf = (char *)malloc(PATH_MAX);
  12122.      if (buf && getcwd(buf, PATH_MAX))
  12123.      {
  12124.        printf("cwd is %s\n", buf);
  12125.        free(buf);
  12126.      }
  12127.  
  12128. 
  12129. File: libc.inf,  Node: getdate,  Next: getdfree,  Prev: getcwd,  Up: Alphabetical List
  12130.  
  12131. getdate
  12132. =======
  12133.  
  12134. Syntax
  12135. ------
  12136.  
  12137.      #include <dos.h>
  12138.      
  12139.      void getdate(struct date *);
  12140.  
  12141. Description
  12142. -----------
  12143.  
  12144. This function gets the current date.  The return structure is as
  12145. follows:
  12146.  
  12147.      struct date {
  12148.        short da_year;
  12149.        char  da_day;
  12150.        char  da_mon;
  12151.      };
  12152.  
  12153. *Note setdate::. *Note gettime::.
  12154.  
  12155. Return Value
  12156. ------------
  12157.  
  12158. None.
  12159.  
  12160. Example
  12161. -------
  12162.  
  12163.      struct date d;
  12164.      getdate(&d);
  12165.  
  12166. 
  12167. File: libc.inf,  Node: getdfree,  Next: getdisk,  Prev: getdate,  Up: Alphabetical List
  12168.  
  12169. getdfree
  12170. ========
  12171.  
  12172. Syntax
  12173. ------
  12174.  
  12175.      #include <dos.h>
  12176.      
  12177.      void getdfree(unsigned char drive, struct dfree *ptr);
  12178.  
  12179. Description
  12180. -----------
  12181.  
  12182. This function gets information about the size and fullness of the given
  12183. drive (0=default, 1=A:, etc).  The return structure is as follows:
  12184.  
  12185.      struct dfree {
  12186.        unsigned df_avail; /* number of available clusters */
  12187.        unsigned df_total; /* total number of clusters */
  12188.        unsigned df_bsec;  /* bytes per sector */
  12189.        unsigned df_sclus; /* sectors per cluster */
  12190.      };
  12191.  
  12192. Return Value
  12193. ------------
  12194.  
  12195. None.
  12196.  
  12197. Example
  12198. -------
  12199.  
  12200.      struct dfree d;
  12201.      getdfree(3, &d); /* drive C: */
  12202.  
  12203. 
  12204. File: libc.inf,  Node: getdisk,  Next: getdtablesize,  Prev: getdfree,  Up: Alphabetical List
  12205.  
  12206. getdisk
  12207. =======
  12208.  
  12209. Syntax
  12210. ------
  12211.  
  12212.      #include <dir.h>
  12213.      
  12214.      int getdisk(void);
  12215.  
  12216. Description
  12217. -----------
  12218.  
  12219. Gets the current disk (0=A).
  12220.  
  12221. *Note setdisk::.
  12222.  
  12223. Return Value
  12224. ------------
  12225.  
  12226. The current disk number.
  12227.  
  12228. Example
  12229. -------
  12230.  
  12231.      printf("This drive is %c:\n", getdisk() + 'A');
  12232.  
  12233. 
  12234. File: libc.inf,  Node: getdtablesize,  Next: getegid,  Prev: getdisk,  Up: Alphabetical List
  12235.  
  12236. getdtablesize
  12237. =============
  12238.  
  12239. Syntax
  12240. ------
  12241.  
  12242.      #include <unistd.h>
  12243.      
  12244.      int getdtablesize(void);
  12245.  
  12246. Description
  12247. -----------
  12248.  
  12249. Get the maximum number of open file descriptors the system supports.
  12250.  
  12251. Return Value
  12252. ------------
  12253.  
  12254. 255
  12255.  
  12256. 
  12257. File: libc.inf,  Node: getegid,  Next: getenv,  Prev: getdtablesize,  Up: Alphabetical List
  12258.  
  12259. getegid
  12260. =======
  12261.  
  12262. Syntax
  12263. ------
  12264.  
  12265.      #include <unistd.h>
  12266.      
  12267.      int getegid(void);
  12268.  
  12269. Description
  12270. -----------
  12271.  
  12272. Get the effective group id.
  12273.  
  12274. Return Value
  12275. ------------
  12276.  
  12277. 42
  12278.  
  12279. 
  12280. File: libc.inf,  Node: getenv,  Next: geteuid,  Prev: getegid,  Up: Alphabetical List
  12281.  
  12282. getenv
  12283. ======
  12284.  
  12285. Syntax
  12286. ------
  12287.  
  12288.      #include <stdlib.h>
  12289.      
  12290.      char *getenv(const char *name);
  12291.  
  12292. Description
  12293. -----------
  12294.  
  12295. Get the setting of the environment variable NAME.  Do not alter or free
  12296. the returned value.
  12297.  
  12298. Return Value
  12299. ------------
  12300.  
  12301. The value, or `NULL' if that variable does not exist.
  12302.  
  12303. Example
  12304. -------
  12305.  
  12306.      char *term = getenv("TERM");
  12307.  
  12308. 
  12309. File: libc.inf,  Node: geteuid,  Next: getftime,  Prev: getenv,  Up: Alphabetical List
  12310.  
  12311. geteuid
  12312. =======
  12313.  
  12314. Syntax
  12315. ------
  12316.  
  12317.      #include <unistd.h>
  12318.      
  12319.      int geteuid(void);
  12320.  
  12321. Description
  12322. -----------
  12323.  
  12324. Gets the effective UID.
  12325.  
  12326. Return Value
  12327. ------------
  12328.  
  12329. 42
  12330.  
  12331. 
  12332. File: libc.inf,  Node: getftime,  Next: getgid,  Prev: geteuid,  Up: Alphabetical List
  12333.  
  12334. getftime
  12335. ========
  12336.  
  12337. Syntax
  12338. ------
  12339.  
  12340.      #include <dos.h>
  12341.      
  12342.      int getftime(int handle, struct ftime *ptr);
  12343.  
  12344. Description
  12345. -----------
  12346.  
  12347. Get the timestamp for the given file handle.  The return structure is as
  12348. follows:
  12349.  
  12350.      struct ftime {
  12351.        unsigned ft_tsec:5;    /* 0-29, double to get real seconds */
  12352.        unsigned ft_min:6;    /* 0-59 */
  12353.        unsigned ft_hour:5;    /* 0-23 */
  12354.        unsigned ft_day:5;    /* 1-31 */
  12355.        unsigned ft_month:4;    /* 1-12 */
  12356.        unsigned ft_year:7;    /* since 1980 */
  12357.      }
  12358.  
  12359. Return Value
  12360. ------------
  12361.  
  12362. Zero on success, nonzero on failure.
  12363.  
  12364. Example
  12365. -------
  12366.  
  12367.      struct ftime t;
  12368.      getftime(fd, &t);
  12369.  
  12370. 
  12371. File: libc.inf,  Node: getgid,  Next: getgrent,  Prev: getftime,  Up: Alphabetical List
  12372.  
  12373. getgid
  12374. ======
  12375.  
  12376. Syntax
  12377. ------
  12378.  
  12379.      #include <unistd.h>
  12380.      
  12381.      int getgid(void);
  12382.  
  12383. Description
  12384. -----------
  12385.  
  12386. Get the current group id.
  12387.  
  12388. Return Value
  12389. ------------
  12390.  
  12391. 42
  12392.  
  12393. 
  12394. File: libc.inf,  Node: getgrent,  Next: getgrgid,  Prev: getgid,  Up: Alphabetical List
  12395.  
  12396. getgrent
  12397. ========
  12398.  
  12399. Syntax
  12400. ------
  12401.  
  12402.      #include <grp.h>
  12403.      
  12404.      struct group *getgrent(void);
  12405.  
  12406. Description
  12407. -----------
  12408.  
  12409. This function returns the next available group entry.  Note that for
  12410. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  12411. that is the name of the only group returned, else the only group is
  12412. "dos".  Thus, under DOS, `getgrent' will always fail on the second and
  12413. subsequent calls.
  12414.  
  12415. The return type of this and related function is as follows:
  12416.  
  12417.      struct group {
  12418.        gid_t    gr_gid;    /* result of getgid() */
  12419.        char  ** gr_mem;    /* gr_mem[0] points to
  12420.                                getenv("USER"/"LOGNAME") or "user" */
  12421.        char  *  gr_name;   /* getenv("GROUP") or "dos" */
  12422.      };
  12423.  
  12424. Return Value
  12425. ------------
  12426.  
  12427. The next structure, or `NULL' at the end of the list.
  12428.  
  12429. Example
  12430. -------
  12431.  
  12432.  
  12433.      struct group *g;
  12434.      setgrent();
  12435.      while ((g = getgrent()) != NULL)
  12436.      {
  12437.        printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  12438.      }
  12439.      endgrent();
  12440.  
  12441. 
  12442. File: libc.inf,  Node: getgrgid,  Next: getgrnam,  Prev: getgrent,  Up: Alphabetical List
  12443.  
  12444. getgrgid
  12445. ========
  12446.  
  12447. Syntax
  12448. ------
  12449.  
  12450.      #include <grp.h>
  12451.      
  12452.      extern struct group *getgrgid(int gid);
  12453.  
  12454. Description
  12455. -----------
  12456.  
  12457. This function returns the group entry that matches GID.  *Note
  12458. getgrent::, for the description of `struct group'.
  12459.  
  12460. Return Value
  12461. ------------
  12462.  
  12463. The matching group, or `NULL' if none match.
  12464.  
  12465. 
  12466. File: libc.inf,  Node: getgrnam,  Next: gethostname,  Prev: getgrgid,  Up: Alphabetical List
  12467.  
  12468. getgrnam
  12469. ========
  12470.  
  12471. Syntax
  12472. ------
  12473.  
  12474.      #include <grp.h>
  12475.      
  12476.      struct group *getgrnam(char *name);
  12477.  
  12478. Description
  12479. -----------
  12480.  
  12481. This function returns the group entry for the group named NAME.  *Note
  12482. getgrent:: for the description of `struct group'.
  12483.  
  12484. Return Value
  12485. ------------
  12486.  
  12487. The matching group, or `NULL' if none match.
  12488.  
  12489. 
  12490. File: libc.inf,  Node: gethostname,  Next: getitimer,  Prev: getgrnam,  Up: Alphabetical List
  12491.  
  12492. gethostname
  12493. ===========
  12494.  
  12495. Syntax
  12496. ------
  12497.  
  12498.      #include <unistd.h>
  12499.      #include <sys/param.h>
  12500.      
  12501.      int gethostname (char *buf, int size);
  12502.  
  12503. Description
  12504. -----------
  12505.  
  12506. Get the name of the host the program is executing on.  This name is
  12507. obtained from the network software, if present, otherwise from the
  12508. `"HOSTNAME"' environment variable, if present, finally defaulting to
  12509. `"pc"'.
  12510.  
  12511. The call fails if more than SIZE characters are required to specify the
  12512. host name.  A buffer size of `MAXGETHOSTNAME' is guaranteed to be
  12513. enough.
  12514.  
  12515. Return Value
  12516. ------------
  12517.  
  12518. Zero on success, nonzero on failure.
  12519.  
  12520. Example
  12521. -------
  12522.  
  12523.      char *buf = (char *) malloc (MAXGETHOSTNAME);
  12524.      if (buf && 0 == gethostname (buf, MAXGETHOSTNAME))
  12525.        printf ("We're on %s\n", buf);
  12526.      if (buf) free(buf);
  12527.  
  12528. 
  12529. File: libc.inf,  Node: getitimer,  Next: getkey,  Prev: gethostname,  Up: Alphabetical List
  12530.  
  12531. getitimer
  12532. =========
  12533.  
  12534. Syntax
  12535. ------
  12536.  
  12537.      #include <sys/time.h>
  12538.      
  12539.      int getitimer(int which, struct itimerval *value);
  12540.  
  12541. Description
  12542. -----------
  12543.  
  12544. This function gets the current value of the interval timer specified by
  12545. WHICH into structure VALUE.  Variable WHICH can have the value of
  12546. ITIMER_REAL or ITIMER_PROF. *Note setitimer::.
  12547.  
  12548. Return Value
  12549. ------------
  12550.  
  12551. Returns 0 on success, -1 on failure (and sets errno).
  12552.  
  12553. 
  12554. File: libc.inf,  Node: getkey,  Next: getlogin,  Prev: getitimer,  Up: Alphabetical List
  12555.  
  12556. getkey
  12557. ======
  12558.  
  12559. Syntax
  12560. ------
  12561.  
  12562.      #include <pc.h>
  12563.      #include <keys.h>
  12564.      
  12565.      int getkey(void);
  12566.  
  12567. Description
  12568. -----------
  12569.  
  12570. Waits for the user to press one key, then returns that key.  Alt-key
  12571. combinations have 0x100 added to them.  Extended keys return their
  12572. non-extended codes.
  12573.  
  12574. The file `keys.h' has symbolic names for many of the keys.
  12575.  
  12576. *Note getxkey::.
  12577.  
  12578. Return Value
  12579. ------------
  12580.  
  12581. The key pressed.
  12582.  
  12583. Example
  12584. -------
  12585.  
  12586.      while (getkey() != K_Alt_3)
  12587.        do_something();
  12588.  
  12589. 
  12590. File: libc.inf,  Node: getlogin,  Next: getlongpass,  Prev: getkey,  Up: Alphabetical List
  12591.  
  12592. getlogin
  12593. ========
  12594.  
  12595. Syntax
  12596. ------
  12597.  
  12598.      #include <unistd.h>
  12599.      
  12600.      char *getlogin(void);
  12601.  
  12602. Description
  12603. -----------
  12604.  
  12605. Get the login ID of the user.
  12606.  
  12607. Return Value
  12608. ------------
  12609.  
  12610. Returns the value of the `USER' environment variable, else the
  12611. `LOGNAME' environment variable, else `"dosuser"'.
  12612.  
  12613. Example
  12614. -------
  12615.  
  12616.      printf("I am %s\n", getlogin());
  12617.  
  12618. 
  12619. File: libc.inf,  Node: getlongpass,  Next: getmntent,  Prev: getlogin,  Up: Alphabetical List
  12620.  
  12621. getlongpass
  12622. ===========
  12623.  
  12624. Syntax
  12625. ------
  12626.  
  12627.      #include <stdlib.h>
  12628.      
  12629.      int  getlongpass(const char *prompt, char *password, int max_length)
  12630.  
  12631. Description
  12632. -----------
  12633.  
  12634. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  12635. from the standard input, without an echo, after prompting with a
  12636. null-terminated string PROMPT.  It puts a null-terminated string of at
  12637. most MAX_LENGTH - 1 first characters typed by the user into a buffer
  12638. pointed to by PASSWORD.  Pressing Ctrl-C or Ctrl-Break will cause the
  12639. calling program to `exit(1)'.
  12640.  
  12641. Return Value
  12642. ------------
  12643.  
  12644. Zero if successfull, -1 on error (and ERRNO is set to and appropriate
  12645. value.
  12646.  
  12647. Example
  12648. -------
  12649.  
  12650.      char password[MAX_PASS];
  12651.      
  12652.      (void)getlongpass("Password: ", password, MAX_PASS);
  12653.  
  12654. 
  12655. File: libc.inf,  Node: getmntent,  Next: getopt,  Prev: getlongpass,  Up: Alphabetical List
  12656.  
  12657. getmntent
  12658. =========
  12659.  
  12660. Syntax
  12661. ------
  12662.  
  12663.      #include <mntent.h>
  12664.      
  12665.      struct mntent *getmntent(FILE *filep);
  12666.  
  12667. Description
  12668. -----------
  12669.  
  12670. This function returns information about the various drives that are
  12671. available to your program.  Beginning with drive `A:', information is
  12672. retrieved for successive drives with successive calls to `getmntent'.
  12673. Note that drives `A:' and `B:' will only be returned if there is an
  12674. MS-DOS formatted disk in the drive; empty drives are skipped.  For
  12675. systems with a single floppy drive, it is returned as if it were
  12676. mounted on A:/ or B:/, depending on how it was last referenced (and if
  12677. there is a disk in the drive).
  12678.  
  12679. For each drive scanned, a pointer to a static structure of the following
  12680. type is returned:
  12681.  
  12682.      struct mntent
  12683.      {
  12684.          char * mnt_fsname;  /* The name of this file system */
  12685.          char * mnt_dir;     /* The root directory of this file system */
  12686.          char * mnt_type;    /* Filesystem type */
  12687.          char * mnt_opts;    /* Options, see below */
  12688.          int    mnt_freq;    /* -1 */
  12689.          int    mnt_passno;  /* -1 */
  12690.          long   mnt_time;    /* -1 */
  12691.      };
  12692.  
  12693. DJGPP implementation returns the following in the first 4 fields of
  12694. `struct mntent':
  12695.  
  12696. `mnt_fsname'
  12697.      For networked and CD-ROM drives, the name of root directory in the
  12698.      form "\\HOST\PATH" (this is called a UNC name).
  12699.  
  12700.      For drives compressed with DoubleSpace, the string
  12701.      "X:\DBLSPACE.NNN", where "X" is the drive letter of the host drive
  12702.      and "NNN" is the sequence number of the Compressed Volume File.
  12703.  
  12704.      For drives compressed with Stacker, the string "X:\STACVOL.NNN",
  12705.      where "X" and "NNN" are as for DoubleSpace drives.
  12706.  
  12707.      For drives compressed with Jam (a shareware disk compression
  12708.      software), the full name of the Jam archive file.
  12709.  
  12710.      For SUBSTed drives, the actual directory name that that was
  12711.      SUBSTed to emulate a drive.
  12712.  
  12713.      JOINed drives get their name as if they were NOT JOINed (i.e.,
  12714.      either the label name or the default "Drive X:").
  12715.  
  12716.      For drives with a volume label, the name of the label; otherwise
  12717.      the string "Drive X:", where "X" is the drive letter.
  12718.  
  12719. `mnt_dir'
  12720.      For most drives, the name of its root directory "X:/" (where "X" is
  12721.      the drive letter), except that JOINed drives get this as the name
  12722.      of the directory to which they were JOINed.
  12723.  
  12724.      For systems with a single floppy drive (which can be referenced as
  12725.      either "a:/" or "b:/"), the mount directory will be returned as
  12726.      one of these, depending on which drive letter was last used to
  12727.      reference that drive.
  12728.  
  12729. `mnt_type'
  12730.            "fd"     for floppy disks
  12731.            "hd"     for hard disks
  12732.            "dblsp"  for disks compressed with DoubleSpace
  12733.            "stac"   for disks compressed with Stacker
  12734.            "jam"    for disks compressed with Jam
  12735.            "cdrom"  for CD-ROM drives
  12736.            "ram"    for RAM disks
  12737.            "subst"  for SUBSTed directories
  12738.            "join"   for JOINed disks
  12739.            "net"    for networked drives
  12740.  
  12741. `mnt_opts'
  12742.      The string "ro,dev=XX" for CD-ROM drives, "rw,dev=XX" for all the
  12743.      others, where "XX" is the hexadecimal drive number of the REAL
  12744.      drive on which this filesystem resides.  That is, if you call
  12745.      `stat' on MNT_FSNAME, you will get the numeric equivalent of XX in
  12746.      `st_dev' field of `struct stat'.  E.g., for drive C: you will get
  12747.      "rw,dev=02".  Note that SUBSTed and JOINed drives get the drive
  12748.      numbers as if SUBST and JOIN were NOT in effect.
  12749.  
  12750. Return Value
  12751. ------------
  12752.  
  12753. This function returns a pointer to an `struct' `mntent', or NULL if
  12754. there are no more drives to report on.
  12755.  
  12756. Example
  12757. -------
  12758.  
  12759.      struct mntent *m;
  12760.      FILE *f;
  12761.      f = setmntent("/etc/mnttab", "r");
  12762.      while ((m = getmntent(f)))
  12763.        printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
  12764.      endmntent(f);
  12765.  
  12766. 
  12767. File: libc.inf,  Node: getopt,  Next: getpagesize,  Prev: getmntent,  Up: Alphabetical List
  12768.  
  12769. getopt
  12770. ======
  12771.  
  12772. Syntax
  12773. ------
  12774.  
  12775.      int getopt(int argc, char * const *argv, const char *options);
  12776.      extern char *optarg;
  12777.      extern int optind, opterr;
  12778.      extern char optopt;
  12779.  
  12780. Description
  12781. -----------
  12782.  
  12783. Parse options from the command line.  The OPTIONS are a string of valid
  12784. option characters.  If a given option takes a parameter, that character
  12785. should be followed by a colon.
  12786.  
  12787. For each valid switch, this function sets `optarg' to the argument (if
  12788. the switch takes one), sets `optind' to the index in ARGV that it is
  12789. using, sets `optopt' to the option letter found, and returns the option
  12790. letter found.
  12791.  
  12792. If an unexpected option is found, `getopt' will return `?', and if
  12793. `opterr' is nonzero, will print an error message to stderr.
  12794.  
  12795. The special option `--' indicates that no more options follow on the
  12796. command line, and cause `getopt' to stop looking.
  12797.  
  12798. Return Value
  12799. ------------
  12800.  
  12801. The option found, or -1 if no more options.
  12802.  
  12803. Example
  12804. -------
  12805.  
  12806.      int c;
  12807.      opterr = 0;
  12808.      while ((c=getopt(argc, argv, "vbf:")) != -1)
  12809.      {
  12810.        switch (c)
  12811.        {
  12812.          case 'v':
  12813.            verbose_flag ++;
  12814.            break;
  12815.          case 'b':
  12816.            binary_flag ++;
  12817.            break;
  12818.          case 'f':
  12819.            output_filename = optarg;
  12820.            break;
  12821.          case '?':
  12822.            printf("Unknown option %c\n", c);
  12823.            usage();
  12824.            exit(1);
  12825.        }
  12826.      }
  12827.  
  12828. 
  12829. File: libc.inf,  Node: getpagesize,  Next: getpass,  Prev: getopt,  Up: Alphabetical List
  12830.  
  12831. getpagesize
  12832. ===========
  12833.  
  12834. Syntax
  12835. ------
  12836.  
  12837.      #include <unistd.h>
  12838.      
  12839.      int getpagesize(void);
  12840.  
  12841. Description
  12842. -----------
  12843.  
  12844. Return the size of the native virtual memory page size.
  12845.  
  12846. Return Value
  12847. ------------
  12848.  
  12849. 4096 for the i386 and higher processors.
  12850.  
  12851. 
  12852. File: libc.inf,  Node: getpass,  Next: getpgrp,  Prev: getpagesize,  Up: Alphabetical List
  12853.  
  12854. getpass
  12855. =======
  12856.  
  12857. Syntax
  12858. ------
  12859.  
  12860.      #include <stdlib.h>
  12861.      
  12862.      char * getpass(const char *prompt)
  12863.  
  12864. Description
  12865. -----------
  12866.  
  12867. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  12868. from the standard input, without an echo, after prompting with a
  12869. null-terminated string PROMPT.  It returns the string of at most 8
  12870. characters typed by the user.  Pressing Ctrl-C or Ctrl-Break will cause
  12871. the calling program to `exit(1)'.
  12872.  
  12873. Return Value
  12874. ------------
  12875.  
  12876. A pointer to a static buffer which holds the user's response.  The
  12877. buffer will be overwritten by each new call.  In case of any error in
  12878. the lower I/O routines, a NULL pointer will be returned.
  12879.  
  12880. Example
  12881. -------
  12882.  
  12883.      char *password = getpass("Password: ");
  12884.  
  12885. 
  12886. File: libc.inf,  Node: getpgrp,  Next: getpid,  Prev: getpass,  Up: Alphabetical List
  12887.  
  12888. getpgrp
  12889. =======
  12890.  
  12891. Syntax
  12892. ------
  12893.  
  12894.      #include <unistd.h>
  12895.      
  12896.      int getpgrp(void);
  12897.  
  12898. Description
  12899. -----------
  12900.  
  12901. Gets the process group, which is currently the same as the pid.
  12902.  
  12903. Return Value
  12904. ------------
  12905.  
  12906. The process group.
  12907.  
  12908. 
  12909. File: libc.inf,  Node: getpid,  Next: getpwent,  Prev: getpgrp,  Up: Alphabetical List
  12910.  
  12911. getpid
  12912. ======
  12913.  
  12914. Syntax
  12915. ------
  12916.  
  12917.      #include <unistd.h>
  12918.      
  12919.      int getpid(void);
  12920.  
  12921. Description
  12922. -----------
  12923.  
  12924. Get the process ID, which uniquely identifies each program running on
  12925. the system.
  12926.  
  12927. Return Value
  12928. ------------
  12929.  
  12930. The process ID.
  12931.  
  12932. 
  12933. File: libc.inf,  Node: getpwent,  Next: getpwnam,  Prev: getpid,  Up: Alphabetical List
  12934.  
  12935. getpwent
  12936. ========
  12937.  
  12938. Syntax
  12939. ------
  12940.  
  12941.      #include <pwd.h>
  12942.      
  12943.      struct passwd *getpwent(void);
  12944.  
  12945. Description
  12946. -----------
  12947.  
  12948. This function retrieves the next available password file entry.  For
  12949. MS-DOS, this is simulated by providing exactly one entry:
  12950.  
  12951.      struct passwd {
  12952.        char * pw_name;    /* getlogin() */
  12953.        int    pw_uid;     /* getuid() */
  12954.        int    pw_gid;     /* getgid() */
  12955.        char * pw_dir;     /* "/" or getenv("HOME") */
  12956.        char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  12957.      };
  12958.  
  12959. Return Value
  12960. ------------
  12961.  
  12962. The next passwd entry, or `NULL' if there are no more.
  12963.  
  12964. Example
  12965. -------
  12966.  
  12967.      struct passwd *p;
  12968.      setpwent();
  12969.      while ((p = getpwent()) != NULL)
  12970.      {
  12971.        printf("user %s name %s\n", p->pw_name, p->pw_gecos);
  12972.      }
  12973.      endpwent();
  12974.  
  12975. 
  12976. File: libc.inf,  Node: getpwnam,  Next: getpwuid,  Prev: getpwent,  Up: Alphabetical List
  12977.  
  12978. getpwnam
  12979. ========
  12980.  
  12981. Syntax
  12982. ------
  12983.  
  12984.      #include <pwd.h>
  12985.      
  12986.      struct passwd *getpwnam(const char *name);
  12987.  
  12988. Description
  12989. -----------
  12990.  
  12991. This function gets the password file entry matching NAME.  *Note
  12992. getpwent::.
  12993.  
  12994. Return Value
  12995. ------------
  12996.  
  12997. The matching record, or `NULL' if none match.
  12998.  
  12999. 
  13000. File: libc.inf,  Node: getpwuid,  Next: getrlimit,  Prev: getpwnam,  Up: Alphabetical List
  13001.  
  13002. getpwuid
  13003. ========
  13004.  
  13005. Syntax
  13006. ------
  13007.  
  13008.      #include <pwd.h>
  13009.      
  13010.      struct passwd *getpwuid(uid_t uid);
  13011.  
  13012. Description
  13013. -----------
  13014.  
  13015. This function gets the password file entry matching UID.  *Note
  13016. getpwent::.
  13017.  
  13018. Return Value
  13019. ------------
  13020.  
  13021. The matching record, or `NULL' if none match.
  13022.  
  13023. 
  13024. File: libc.inf,  Node: getrlimit,  Next: getrusage,  Prev: getpwuid,  Up: Alphabetical List
  13025.  
  13026. getrlimit
  13027. =========
  13028.  
  13029. Syntax
  13030. ------
  13031.  
  13032.      #include <sys/resource.h>
  13033.      
  13034.      int getrlimit (int rltype, struct rlimit *rlimitp);
  13035.  
  13036. Description
  13037. -----------
  13038.  
  13039. This function gets the resource limit specified by RLTYPE and stores it
  13040. in the buffer pointed to by RLIMITP.
  13041.  
  13042. Return Value
  13043. ------------
  13044.  
  13045. Zero on success, nonzero on failure.
  13046.  
  13047. Example
  13048. -------
  13049.  
  13050.      struct rlimit rlimitbuf;
  13051.      int rc = getrlimit (RLIMIT_STACK, &rlimitbuf);
  13052.  
  13053. 
  13054. File: libc.inf,  Node: getrusage,  Next: gets,  Prev: getrlimit,  Up: Alphabetical List
  13055.  
  13056. getrusage
  13057. =========
  13058.  
  13059. Syntax
  13060. ------
  13061.  
  13062.      #include <sys/time.h>
  13063.      #include <sys/resource.h
  13064.      
  13065.      int getrusage(int who, struct rusage *rusage);
  13066.  
  13067. Description
  13068. -----------
  13069.  
  13070. This function returns information about the running process.  Currently,
  13071. the only field that is computed is this:
  13072.  
  13073.      struct rusage {
  13074.        struct timeval ru_utime;  /* total time used by process */
  13075.      };
  13076.  
  13077. The remainder of the fields are set to zero.
  13078.  
  13079. The WHO parameter must be `RUSAGE_SELF' or `RUSAGE_CHILDREN'.
  13080.  
  13081. Return Value
  13082. ------------
  13083.  
  13084. Zero on success, nonzero on failure.
  13085.  
  13086. Example
  13087. -------
  13088.  
  13089.      struct rusage r;
  13090.      getrusage(RUSAGE_SELF, &r);
  13091.  
  13092. 
  13093. File: libc.inf,  Node: gets,  Next: gettext,  Prev: getrusage,  Up: Alphabetical List
  13094.  
  13095. gets
  13096. ====
  13097.  
  13098. Syntax
  13099. ------
  13100.  
  13101.      #include <stdio.h>
  13102.      
  13103.      char *gets(char *buffer);
  13104.  
  13105. Description
  13106. -----------
  13107.  
  13108. Reads characters from `stdin', storing them in BUFFER, until either end
  13109. of file or a newline is encountered.  If any characters were stored,
  13110. the BUFFER is then `NULL' terminated and its address is returned, else
  13111. `NULL' is returned.
  13112.  
  13113. Return Value
  13114. ------------
  13115.  
  13116. The address of the buffer, or `NULL'.
  13117.  
  13118. Example
  13119. -------
  13120.  
  13121.      char buf[1000];
  13122.      while (gets(buf))
  13123.        puts(buf);
  13124.  
  13125. 
  13126. File: libc.inf,  Node: gettext,  Next: gettextinfo,  Prev: gets,  Up: Alphabetical List
  13127.  
  13128. gettext
  13129. =======
  13130.  
  13131. Syntax
  13132. ------
  13133.  
  13134.      #include <conio.h>
  13135.      
  13136.      int     gettext(int _left, int _top, int _right, int _bottom, void *_destin);
  13137.  
  13138. Description
  13139. -----------
  13140.  
  13141. Retrieve a block of screen characters into a buffer.
  13142.  
  13143. Return Value
  13144. ------------
  13145.  
  13146. 1
  13147.  
  13148. 
  13149. File: libc.inf,  Node: gettextinfo,  Next: gettime,  Prev: gettext,  Up: Alphabetical List
  13150.  
  13151. gettextinfo
  13152. ===========
  13153.  
  13154. Syntax
  13155. ------
  13156.  
  13157.      #include <conio.h>
  13158.      
  13159.      void    gettextinfo(struct text_info *_r);
  13160.  
  13161. Description
  13162. -----------
  13163.  
  13164. This function returns the parameters of the current window on the
  13165. screen.  The return structure is this:
  13166.  
  13167.      struct text_info {
  13168.          unsigned char winleft;
  13169.          unsigned char wintop;
  13170.          unsigned char winright;
  13171.          unsigned char winbottom;
  13172.          unsigned char attribute;
  13173.          unsigned char normattr;
  13174.          unsigned char currmode;
  13175.          unsigned char screenheight;
  13176.          unsigned char screenwidth;
  13177.          unsigned char curx;
  13178.          unsigned char cury;
  13179.      };
  13180.  
  13181. The `normattr' field is the text attribute which was in effect before
  13182. the program started.
  13183.  
  13184. 
  13185. File: libc.inf,  Node: gettime,  Next: gettimeofday,  Prev: gettextinfo,  Up: Alphabetical List
  13186.  
  13187. gettime
  13188. =======
  13189.  
  13190. Syntax
  13191. ------
  13192.  
  13193.      #include <dos.h>
  13194.      
  13195.      void gettime(struct time *);
  13196.  
  13197. Description
  13198. -----------
  13199.  
  13200. This function gets the current time.  The return structure is as
  13201. follows:
  13202.  
  13203.      struct time {
  13204.        unsigned char ti_min;
  13205.        unsigned char ti_hour;
  13206.        unsigned char ti_hund;
  13207.        unsigned char ti_sec;
  13208.      };
  13209.  
  13210. *Note settime::. *Note getdate::.
  13211.  
  13212. Return Value
  13213. ------------
  13214.  
  13215. None.
  13216.  
  13217. Example
  13218. -------
  13219.  
  13220.      struct time t;
  13221.      gettime(&t);
  13222.  
  13223. 
  13224. File: libc.inf,  Node: gettimeofday,  Next: getuid,  Prev: gettime,  Up: Alphabetical List
  13225.  
  13226. gettimeofday
  13227. ============
  13228.  
  13229. Syntax
  13230. ------
  13231.  
  13232.      #include <sys/time.h>
  13233.      
  13234.      int gettimeofday(struct timeval *tp, struct timezone *tzp);
  13235.  
  13236. Description
  13237. -----------
  13238.  
  13239. Gets the current GMT time and the local timezone information.  The
  13240. return structures are as follows:
  13241.  
  13242.      struct timeval {
  13243.        long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  13244.        long tv_usec; /* microseconds */
  13245.      };
  13246.      struct timezone {
  13247.        int tz_minuteswest; /* west of GMT */
  13248.        int tz_dsttime;     /* set if daylight saving time in affect */
  13249.      };
  13250.  
  13251. If either TP or TZP are `NULL', that information is not provided.
  13252.  
  13253. *Note settimeofday::.
  13254.  
  13255. Return Value
  13256. ------------
  13257.  
  13258. Zero on success, nonzero on failure.
  13259.  
  13260. 
  13261. File: libc.inf,  Node: getuid,  Next: getw,  Prev: gettimeofday,  Up: Alphabetical List
  13262.  
  13263. getuid
  13264. ======
  13265.  
  13266. Syntax
  13267. ------
  13268.  
  13269.      #include <unistd.h>
  13270.      
  13271.      int getuid(void);
  13272.  
  13273. Description
  13274. -----------
  13275.  
  13276. Returns the user ID.
  13277.  
  13278. Return Value
  13279. ------------
  13280.  
  13281. 42
  13282.  
  13283. 
  13284. File: libc.inf,  Node: getw,  Next: getwd,  Prev: getuid,  Up: Alphabetical List
  13285.  
  13286. getw
  13287. ====
  13288.  
  13289. Syntax
  13290. ------
  13291.  
  13292.      #include <stdio.h>
  13293.      
  13294.      int getw(FILE *file);
  13295.  
  13296. Description
  13297. -----------
  13298.  
  13299. Reads a single binary word in native format from FILE.
  13300.  
  13301. *Note putw::.
  13302.  
  13303. Return Value
  13304. ------------
  13305.  
  13306. The value read, or `EOF' for end-of-file or error.  Since `EOF' is a
  13307. valid integer, you should use `feof' or `ferror' to detect this
  13308. situation.
  13309.  
  13310. Example
  13311. -------
  13312.  
  13313.      int i = getw(stdin);
  13314.  
  13315. 
  13316. File: libc.inf,  Node: getwd,  Next: getxkey,  Prev: getw,  Up: Alphabetical List
  13317.  
  13318. getwd
  13319. =====
  13320.  
  13321. Syntax
  13322. ------
  13323.  
  13324.      #include <unistd.h>
  13325.      
  13326.      char *getwd(char *buffer);
  13327.  
  13328. Description
  13329. -----------
  13330.  
  13331. Get the current directory and put it in BUFFER.  The return value
  13332. includes the drive specifier.
  13333.  
  13334. Return Value
  13335. ------------
  13336.  
  13337. BUFFER is returned.
  13338.  
  13339. Example
  13340. -------
  13341.  
  13342.      char buf[PATH_MAX];
  13343.      getwd(buf);
  13344.  
  13345. 
  13346. File: libc.inf,  Node: getxkey,  Next: glob,  Prev: getwd,  Up: Alphabetical List
  13347.  
  13348. getxkey
  13349. =======
  13350.  
  13351. Syntax
  13352. ------
  13353.  
  13354.      #include <pc.h>
  13355.      #include <keys.h>
  13356.      
  13357.      int getxkey(void);
  13358.  
  13359. Description
  13360. -----------
  13361.  
  13362. Waits for the user to press one key, then returns that key.  Alt-key
  13363. combinations have 0x100 added to them, and extended keys have 0x200
  13364. added to them.
  13365.  
  13366. The file `keys.h' has symbolic names for many of the keys.
  13367.  
  13368. *Note getkey::.
  13369.  
  13370. Return Value
  13371. ------------
  13372.  
  13373. The key pressed.
  13374.  
  13375. Example
  13376. -------
  13377.  
  13378.      while (getxkey() != K_EEnd)
  13379.        do_something();
  13380.  
  13381. 
  13382. File: libc.inf,  Node: glob,  Next: globfree,  Prev: getxkey,  Up: Alphabetical List
  13383.  
  13384. glob
  13385. ====
  13386.  
  13387. Syntax
  13388. ------
  13389.  
  13390.      #include <glob.h>
  13391.      
  13392.      int  glob(const char *pattern, int flags,
  13393.                int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);
  13394.  
  13395. Description
  13396. -----------
  13397.  
  13398. This function expands a filename wildcard which is passed as PATTERN.
  13399. The pattern may include these special characters:
  13400.  
  13401. `*'
  13402.      Matches zero of more characters.
  13403.  
  13404. `?'
  13405.      Matches exactly one character (any character).
  13406.  
  13407. `[...]'
  13408.      Matches one character from a group of characters.  If the first
  13409.      character is `!', matches any character *not* in the group.  A
  13410.      group is defined as a list of characters between the brackets,
  13411.      e.g. `[dkl_]', or by two characters separated by `-' to indicate
  13412.      all characters between and including these two.  For example,
  13413.      `[a-d]' matches `a', `b', `c', or `d', and `[!a-zA-Z0-9]' matches
  13414.      any character that is not alphanumeric.
  13415.  
  13416. `...'
  13417.      Matches all the subdirectories, recursively (VMS aficionados,
  13418.      rejoice!).
  13419.  
  13420. `\'
  13421.      Causes the next character to not be treated as special.  For
  13422.      example, `\[' matches a literal `['.  If FLAGS includes
  13423.      `GLOB_NOESCAPE', this quoting is disabled and `\' is handled as a
  13424.      simple character.
  13425.  
  13426. The variable FLAGS controls certain options of the expansion process.
  13427. Possible values for _FLAGS are as follows:
  13428.  
  13429. `GLOB_APPEND'
  13430.      Append the matches to those already present in the array
  13431.      `pglob->gl_pathv'.  By default, `glob' discards all previous
  13432.      contents of `pglob->gl_pathv' and allocates a new memory block for
  13433.      it.  If you use `GLOB_APPEND', `pglob' should point to a structure
  13434.      returned by a previous call to `glob'.
  13435.  
  13436. `GLOB_DOOFFS'
  13437.      Skip `pglob->gl_offs' entries in `gl_pathv' and put new matches
  13438.      after that point.  By default, `glob' puts the new matches
  13439.      beginning at `pglob->gl_pathv[0]'.  You can use this flag both with
  13440.      `GLOB_APPEND' (in which case the new matches will be put after the
  13441.      first `pglob->gl_offs' matches from previous call to `glob'), or
  13442.      without it (in which case the first `pglob->gl_offs' entries in
  13443.      `pglob->gl_pathv' will be filled by `NULL' pointers).
  13444.  
  13445. `GLOB_ERR'
  13446.      Stop when an unreadable directory is encountered and call
  13447.      user-defined function ERRFUNC.  This cannot happen under DOS (and
  13448.      thus ERRFUNC is never used).
  13449.  
  13450. `GLOB_MARK'
  13451.      Append a slash to each pathname that is a directory.
  13452.  
  13453. `GLOB_NOCHECK'
  13454.      If no matches are found, return the pattern itself as the only
  13455.      match.  By default, `glob' doesn't change `pglob' if no matches are
  13456.      found.
  13457.  
  13458. `GLOB_NOESCAPE'
  13459.      Disable blackslash as an escape character.  By default, backslash
  13460.      quotes special meta-characters in wildcards described above.
  13461.  
  13462. `GLOB_NOSORT'
  13463.      Do not sort the returned list.  By default, the list is sorted
  13464.      alphabetically.  This flag causes the files to be returned in the
  13465.      order they were found in the directory.
  13466.  
  13467. Given the pattern and the flags, `glob' expands the pattern and returns
  13468. a list of files that match the pattern in a structure a pointer to
  13469. which is passed via PGLOB.  This structure is like this:
  13470.  
  13471.      typedef struct {
  13472.        size_t gl_pathc;
  13473.        char **gl_pathv;
  13474.        size_t gl_offs;
  13475.      } glob_t;
  13476.  
  13477. In the structure, the `gl_pathc' field holds the number of filenames in
  13478. `gl_pathv' list; this includes the filenames produced by this call,
  13479. plus any previous filenames if `GLOB_APPEND' or `GLOB_DOOFFS' were set
  13480. in FLAGS.  The list of matches is returned as an array of pointers to
  13481. the filenames; `gl_pathv' holds the address of the array.  Thus, the
  13482. filenames which match the pattern can be accessed as `gl_pathv[0]',
  13483. `gl_pathv[1]', etc.  If `GLOB_DOOFFS' was set in FLAGS, the new matches
  13484. begin at offset given by `gl_offs'.
  13485.  
  13486. Return Value
  13487. ------------
  13488.  
  13489. Zero on success, or one of these codes:
  13490.  
  13491. `GLOB_ABORTED'
  13492.      Not used in DJGPP implementation.
  13493.  
  13494. `GLOB_NOMATCH'
  13495.      No files matched the given pattern.
  13496.  
  13497. `GLOB_NOSPACE'
  13498.      Not enough memory to accomodate expanded filenames.
  13499.  
  13500. `GLOB_ERR'
  13501.      Never happens on MSDOS, see above.
  13502.  
  13503. Notes
  13504. -----
  13505.  
  13506. `glob' will not match names of volume labels.
  13507.  
  13508. On MSDOS, filenames are always matched case-insensitively.  On
  13509. filesystems that preserve letter-case in filenames (such as Windows 9x),
  13510. matches are case-insensitive unless the pattern includes uppercase
  13511. characters.
  13512.  
  13513. On MSDOS, the list of expanded filenames will be returned in lower case,
  13514. if all the characters of the pattern (except those between brackets
  13515. [...]) are lower-case; if some of them are upper-case, the expanded
  13516. filenames will be also in upper case.  On filesystems that preserve
  13517. letter-case in filenames, long filenames are returned as they are found
  13518. in the directory entry; DOS-style 8+3 filenames are returned as on MSDOS
  13519. (in lower case if the pattern doesn't include any upper-case letters, in
  13520. upper case otherwise).
  13521.  
  13522. When the environment variable `LFN' is set to `n', `glob' behaves on
  13523. Windows 9x exactly as it does on MSDOS.
  13524.  
  13525. Setting the environment variable `FNCASE' to `y', or setting the
  13526. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  13527. variable (*note _crt0_startup_flags::.) suppresses any letter-case
  13528. conversions in filenames and forces case-sensitive filename matching.
  13529. *Note _preserve_fncase::.
  13530.  
  13531. Example
  13532. -------
  13533.  
  13534.  
  13535.      #include <stdlib.h>
  13536.      #include <string.h>
  13537.      #include <glob.h>
  13538.      
  13539.      /* Convert a wildcard pattern into a list of blank-separated
  13540.         filenames which match the wildcard.  */
  13541.      
  13542.      char * glob_pattern(char *wildcard)
  13543.      {
  13544.        char *gfilename;
  13545.        size_t cnt, length;
  13546.        glob_t glob_results;
  13547.        char **p;
  13548.      
  13549.        glob(wildcard, GLOB_NOCHECK, 0, &glob_results);
  13550.      
  13551.        /* How much space do we need?  */
  13552.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  13553.             cnt; p++, cnt--)
  13554.          length += strlen(*p) + 1;
  13555.      
  13556.        /* Allocate the space and generate the list.  */
  13557.        gfilename = (char *) calloc(length, sizeof(char));
  13558.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  13559.             cnt; p++, cnt--)
  13560.          {
  13561.            strcat(gfilename, *p);
  13562.            if (cnt > 1)
  13563.              strcat(gfilename, " ");
  13564.          }
  13565.      
  13566.        globfree(&glob_results);
  13567.        return gfilename;
  13568.      }
  13569.  
  13570. 
  13571. File: libc.inf,  Node: globfree,  Next: gmtime,  Prev: glob,  Up: Alphabetical List
  13572.  
  13573. globfree
  13574. ========
  13575.  
  13576. Syntax
  13577. ------
  13578.  
  13579.      #include <glob.h>
  13580.      
  13581.      void globfree(glob_t *_pglob);
  13582.  
  13583. Description
  13584. -----------
  13585.  
  13586. Frees the memory associated with `_pglob'.
  13587.  
  13588. 
  13589. File: libc.inf,  Node: gmtime,  Next: _go32_conventional_mem_selector,  Prev: globfree,  Up: Alphabetical List
  13590.  
  13591. gmtime
  13592. ======
  13593.  
  13594. Syntax
  13595. ------
  13596.  
  13597.      #include <time.h>
  13598.      
  13599.      struct tm *gmtime(const time_t *tod);
  13600.  
  13601. Description
  13602. -----------
  13603.  
  13604. Converts the time represented by TOD into a structure.
  13605.  
  13606. The return structure has this format:
  13607.  
  13608.      struct tm {
  13609.        int    tm_sec;    /* seconds after the minute [0-60] */
  13610.        int    tm_min;    /* minutes after the hour [0-59] */
  13611.        int    tm_hour;   /* hours since midnight [0-23] */
  13612.        int    tm_mday;   /* day of the month [1-31] */
  13613.        int    tm_mon;    /* months since January [0-11] */
  13614.        int    tm_year;   /* years since 1900 */
  13615.        int    tm_wday;   /* days since Sunday [0-6] */
  13616.        int    tm_yday;   /* days since January 1 [0-365] */
  13617.        int    tm_isdst;  /* Daylight Savings Time flag */
  13618.        long   tm_gmtoff; /* offset from GMT in seconds */
  13619.        char * tm_zone;   /* timezone abbreviation */
  13620.      };
  13621.  
  13622. Return Value
  13623. ------------
  13624.  
  13625. A pointer to a static structure which is overridden with each call.
  13626.  
  13627. Example
  13628. -------
  13629.  
  13630.      time_t x;
  13631.      struct tm *t;
  13632.      time(&x);
  13633.      t = gmtime(&t);
  13634.  
  13635. 
  13636. File: libc.inf,  Node: _go32_conventional_mem_selector,  Next: _go32_dpmi_allocate_dos_memory,  Prev: gmtime,  Up: Alphabetical List
  13637.  
  13638. _go32_conventional_mem_selector
  13639. ===============================
  13640.  
  13641. Syntax
  13642. ------
  13643.  
  13644.      #include <go32.h>
  13645.      
  13646.      u_short _go32_conventional_mem_selector();
  13647.  
  13648. Description
  13649. -----------
  13650.  
  13651. This function returns a selector which has a physical base address
  13652. corresponding to the beginning of conventional memory.  This selector
  13653. can be used as a parameter to `movedata' (*note movedata::.) to
  13654. manipulate memory in the conventional address space.
  13655.  
  13656. Return Value
  13657. ------------
  13658.  
  13659. The selector.
  13660.  
  13661. Example
  13662. -------
  13663.  
  13664.      short blank_row_buf[ScreenCols()];
  13665.      /* scroll screen */
  13666.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  13667.               _go32_conventional_mem_selector(), 0xb8000,
  13668.               ScreenCols() * (ScreenRows()-1) * 2);
  13669.      /* fill last row */
  13670.      movedata(_go32_my_ds, (int)blank_row_buf,
  13671.               _go32_conventional_mem_selector(),
  13672.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  13673.                ScreenCols() * 2);
  13674.  
  13675. 
  13676. File: libc.inf,  Node: _go32_dpmi_allocate_dos_memory,  Next: _go32_dpmi_allocate_iret_wrapper,  Prev: _go32_conventional_mem_selector,  Up: Alphabetical List
  13677.  
  13678. _go32_dpmi_allocate_dos_memory
  13679. ==============================
  13680.  
  13681. Syntax
  13682. ------
  13683.  
  13684.      #include <dpmi.h>
  13685.      
  13686.      int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
  13687.  
  13688. Description
  13689. -----------
  13690.  
  13691. *Note DPMI Overview::
  13692.  
  13693. Allocate a part of the conventional memory area (the first 640K).  Set
  13694. the `size' field of INFO to the number of paragraphs requested (this is
  13695. (size in bytes + 15)/16), then call.  The `rm_segment' field of INFO
  13696. contains the segment of the allocated memory.
  13697.  
  13698. The memory may be resized with `_go32_dpmi_resize_dos_memory' and must
  13699. be freed with `_go32_dpmi_free_dos_memory'.
  13700.  
  13701. If there isn't enough memory in the system, the `size' field of INFO
  13702. has the largest available size, and an error is returned.
  13703.  
  13704. *Note dosmemput:: *Note dosmemget::
  13705.  
  13706. Return Value
  13707. ------------
  13708.  
  13709. Zero on success, nonzero on failure.
  13710.  
  13711. Example
  13712. -------
  13713.  
  13714.      _go32_dpmi_seginfo info;
  13715.      info.size = (want_size+15) / 16;
  13716.      _go32_dpmi_allocate_dos_memory(&info);
  13717.      dosmemput(buffer, want_size, info.rm_segment*16);
  13718.      _go32_dpmi_free_dos_memory(&info);
  13719.  
  13720. 
  13721. 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
  13722.  
  13723. _go32_dpmi_allocate_iret_wrapper
  13724. ================================
  13725.  
  13726. Syntax
  13727. ------
  13728.  
  13729.      #include <dpmi.h>
  13730.      
  13731.      int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
  13732.  
  13733. Description
  13734. -----------
  13735.  
  13736. *Note DPMI Overview::
  13737.  
  13738. This function creates a small assembler function that handles the
  13739. overhead of servicing an interrupt.  To use, put the address of your
  13740. servicing function in the `pm_offset' field of INFO and call this
  13741. function.  The `pm_field' will get replaced with the address of the
  13742. wrapper function, which you pass to both
  13743. `_go32_dpmi_set_protected_mode_interrupt_vector' and
  13744. `_go32_dpmi_free_iret_wrapper'.
  13745.  
  13746. *Note _go32_dpmi_set_protected_mode_interrupt_vector:: *Note
  13747. _go32_dpmi_free_iret_wrapper::
  13748.  
  13749. Return Value
  13750. ------------
  13751.  
  13752. Zero on success, nonzero on failure.
  13753.  
  13754. Example
  13755. -------
  13756.  
  13757.      _go32_dpmi_seginfo info;
  13758.      info.pm_offset = my_handler;
  13759.      _go32_dpmi_allocate_iret_wrapper(&info);
  13760.      _go32_dpmi_set_protected_mode_interrupt_handler(0x75, &info);
  13761.      ...
  13762.      _go32_dpmi_free_iret_wrapper(&info);
  13763.  
  13764. 
  13765. 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
  13766.  
  13767. _go32_dpmi_allocate_real_mode_callback_iret
  13768. ===========================================
  13769.  
  13770. Syntax
  13771. ------
  13772.  
  13773.      #include <dpmi.h>
  13774.      
  13775.      int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  13776.  
  13777. Description
  13778. -----------
  13779.  
  13780. *Note DPMI Overview::
  13781.  
  13782. This function allocates a "real-mode callback".  Fill in the
  13783. `pm_offset' field of INFO and call this function.  It will fill in the
  13784. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  13785. calls the real-mode address, your function gets called.  The registers
  13786. in affect will be stored in REGS, which should be a global, and will be
  13787. passed to your function.  Any changes in REGS will be reflected back
  13788. into real mode.  A wrapper will be added to your function to simulate
  13789. the effects of an `iret' instruction, so this function is useful for
  13790. trapping real-mode software interrupts (like 0x1b - `Ctrl-Break' hit).
  13791.  
  13792. Return Value
  13793. ------------
  13794.  
  13795. Zero on success, nonzero on failure.
  13796.  
  13797. Example
  13798. -------
  13799.  
  13800.      _go32_dpmi_registers regs;
  13801.      
  13802.      my_handler(_go32_dpmi_registers *r)
  13803.      {
  13804.        r.d.eax = 4;
  13805.      }
  13806.      
  13807.      setup()
  13808.      {
  13809.        _go32_dpmi_seginfo info;
  13810.        _go32_dpmi_seginfo old_vector;
  13811.        _go32_dpmi_get_real_mode_interrupt_vector(0x84, &old_vector);
  13812.        info.pm_offset = my_handler;
  13813.        _go32_dpmi_allocate_real_mode_callback_iret(&info, ®s);
  13814.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &info);
  13815.        do_stuff();
  13816.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &old_vector);
  13817.        _go32_dpmi_free_real_mode_callback(&info);
  13818.      }
  13819.  
  13820. 
  13821. 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
  13822.  
  13823. _go32_dpmi_allocate_real_mode_callback_retf
  13824. ===========================================
  13825.  
  13826. Syntax
  13827. ------
  13828.  
  13829.      #include <dpmi.h>
  13830.      
  13831.      int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  13832.  
  13833. Description
  13834. -----------
  13835.  
  13836. *Note DPMI Overview::
  13837.  
  13838. This function allocates a "real-mode callback".  Fill in the
  13839. `pm_offset' field of INFO and call this function.  It will fill in the
  13840. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  13841. calls the real-mode address, your function gets called.  The registers
  13842. in affect will be stored in REGS, which should be a global, and will be
  13843. passed to your function.  Any changes in REGS will be reflected back
  13844. into real mode.  A wrapper will be added to your function to simulate
  13845. the effects of a far return, such as the callback for the packet driver
  13846. receiver.
  13847.  
  13848. Return Value
  13849. ------------
  13850.  
  13851. Zero on success, nonzero on failure.
  13852.  
  13853. Example
  13854. -------
  13855.  
  13856. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13857.  
  13858. 
  13859. 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
  13860.  
  13861. _go32_dpmi_chain_protected_mode_interrupt_vector
  13862. ================================================
  13863.  
  13864. Syntax
  13865. ------
  13866.  
  13867.      #include <dpmi.h>
  13868.      
  13869.      int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13870.  
  13871. Description
  13872. -----------
  13873.  
  13874. *Note DPMI Overview::
  13875.  
  13876. This function is used to chain a protected mode interrupt.  It will
  13877. build a suitable wrapper that will call your function and then jump to
  13878. the next handler.  Your function need not perform any special handling.
  13879.  
  13880. *Warning!* Because of the way DPMI works, you may *not* `longjmp' out
  13881. of an interrupt handler or perform any system calls (such as `printf')
  13882. from within an interrupt handler.
  13883.  
  13884. Return Value
  13885. ------------
  13886.  
  13887. Zero on success, nonzero on failure.
  13888.  
  13889. Example
  13890. -------
  13891.  
  13892. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  13893.  
  13894. 
  13895. 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
  13896.  
  13897. _go32_dpmi_free_dos_memory
  13898. ==========================
  13899.  
  13900. Syntax
  13901. ------
  13902.  
  13903.      #include <dpmi.h>
  13904.      
  13905.      int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
  13906.  
  13907. Description
  13908. -----------
  13909.  
  13910. *Note DPMI Overview::
  13911.  
  13912. This function frees the conventional memory allocated by
  13913. `_go32_dpmi_allocate_real_mode_memory'.  You should pass it the same
  13914. structure as was used to allocate it.
  13915.  
  13916. Return Value
  13917. ------------
  13918.  
  13919. Zero on success, nonzero on failure.
  13920.  
  13921. Example
  13922. -------
  13923.  
  13924.      _go32_dpmi_seginfo info;
  13925.      info.size = 100;
  13926.      _go32_dpmi_allocate_dos_memory(&info);
  13927.      _go32_dpmi_free_dos_memory(&info);
  13928.  
  13929. 
  13930. 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
  13931.  
  13932. _go32_dpmi_free_iret_wrapper
  13933. ============================
  13934.  
  13935. Syntax
  13936. ------
  13937.  
  13938.      #include <dpmi.h>
  13939.      
  13940.      int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
  13941.  
  13942. Description
  13943. -----------
  13944.  
  13945. *Note DPMI Overview::
  13946.  
  13947. This function frees the memory used by the wrapper created by
  13948. `_go32_dpmi_allocate_iret_wrapper'.  You should not free a wrapper that
  13949. is still in use.
  13950.  
  13951. Return Value
  13952. ------------
  13953.  
  13954. Zero on success, nonzero on failure.
  13955.  
  13956. Example
  13957. -------
  13958.  
  13959. *Note _go32_dpmi_allocate_iret_wrapper::
  13960.  
  13961. 
  13962. 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
  13963.  
  13964. _go32_dpmi_free_real_mode_callback
  13965. ==================================
  13966.  
  13967. Syntax
  13968. ------
  13969.  
  13970.      #include <dpmi.h>
  13971.      
  13972.      int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
  13973.  
  13974. Description
  13975. -----------
  13976.  
  13977. *Note DPMI Overview::
  13978.  
  13979. This function frees the real-mode callbacks and wrappers allocated by
  13980. `_go32_dpmi_allocate_real_mode_callback_iret' and
  13981. `_go32_dpmi_allocate_real_mode_callback_retf'.
  13982.  
  13983. Return Value
  13984. ------------
  13985.  
  13986. Zero on success, nonzero on failure.
  13987.  
  13988. Example
  13989. -------
  13990.  
  13991. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13992.  
  13993. 
  13994. 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
  13995.  
  13996. _go32_dpmi_get_free_memory_information
  13997. ======================================
  13998.  
  13999. Syntax
  14000. ------
  14001.  
  14002.      #include <dpmi.h
  14003.      
  14004.      int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
  14005.  
  14006. Description
  14007. -----------
  14008.  
  14009. This function fills in the following structure:
  14010.  
  14011.      typedef struct {
  14012.        u_long available_memory;
  14013.        u_long available_pages;
  14014.        u_long available_lockable_pages;
  14015.        u_long linear_space;
  14016.        u_long unlocked_pages;
  14017.        u_long available_physical_pages;
  14018.        u_long total_physical_pages;
  14019.        u_long free_linear_space;
  14020.        u_long max_pages_in_paging_file;
  14021.        u_long reserved[3];
  14022.      } _go32_dpmi_meminfo;
  14023.  
  14024. The only field that is guaranteed to have useful data is
  14025. `available_memory'.  Any unavailable field has -1 in it.
  14026.  
  14027. Return Value
  14028. ------------
  14029.  
  14030. Zero on success, nonzero on failure.
  14031.  
  14032. Example
  14033. -------
  14034.  
  14035.      int phys_mem_left()
  14036.      {
  14037.        _go32_dpmi_meminfo info;
  14038.        _go32_dpmi_get_free_memory_information(&info);
  14039.        if (info.available_physical_pages != -1)
  14040.          return info.available_physical_pages * 4096;
  14041.        return info.available_memory;
  14042.      }
  14043.  
  14044. 
  14045. 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
  14046.  
  14047. _go32_dpmi_get_protected_mode_interrupt_vector
  14048. ==============================================
  14049.  
  14050. Syntax
  14051. ------
  14052.  
  14053.      #include <dpmi.h>
  14054.      
  14055.      int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  14056.  
  14057. Description
  14058. -----------
  14059.  
  14060. *Note DPMI Overview::
  14061.  
  14062. This function puts the selector and offset of the specified interrupt
  14063. vector into the `pm_selector' and `pm_offset' fields of INFO.  This
  14064. structure can be saved and later passed to
  14065. `_go32_dpmi_get_protected_mode_interrupt_vector' to restore a vector.
  14066.  
  14067. Return Value
  14068. ------------
  14069.  
  14070. Zero on success, nonzero on failure.
  14071.  
  14072. Example
  14073. -------
  14074.  
  14075. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  14076.  
  14077. 
  14078. 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
  14079.  
  14080. _go32_dpmi_get_real_mode_interrupt_vector
  14081. =========================================
  14082.  
  14083. Syntax
  14084. ------
  14085.  
  14086.      #include <dpmi.h>
  14087.      
  14088.      int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  14089.  
  14090. Description
  14091. -----------
  14092.  
  14093. *Note DPMI Overview::
  14094.  
  14095. This function gets the real-mode interrupt vector specified into the
  14096. address in the `rm_segment' and `rm_offset' fields in INFO.
  14097.  
  14098. Return Value
  14099. ------------
  14100.  
  14101. Zero on success, nonzero on failure.
  14102.  
  14103. Example
  14104. -------
  14105.  
  14106. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  14107.  
  14108. 
  14109. File: libc.inf,  Node: _go32_dpmi_lock_code,  Next: _go32_dpmi_lock_data,  Prev: _go32_dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  14110.  
  14111. _go32_dpmi_lock_code
  14112. ====================
  14113.  
  14114. Syntax
  14115. ------
  14116.  
  14117.      #include <dpmi.h>
  14118.      
  14119.      int _go32_dpmi_lock_code( void *lockaddr, unsigned long locksize);
  14120.  
  14121. Description
  14122. -----------
  14123.  
  14124. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  14125. bytes.  LOCKADDR is a regular pointer in your program, such as the
  14126. address of a function.
  14127.  
  14128. Example
  14129. -------
  14130.  
  14131.  
  14132.      void my_handler()
  14133.      {
  14134.      }
  14135.      
  14136.      void lock_my_handler()
  14137.      {
  14138.        _go32_dpmi_lock_code(my_handler, (unsigned long)(lock_my_handler - my_handler));
  14139.      }
  14140.  
  14141. 
  14142. File: libc.inf,  Node: _go32_dpmi_lock_data,  Next: _go32_dpmi_remaining_physical_memory,  Prev: _go32_dpmi_lock_code,  Up: Alphabetical List
  14143.  
  14144. _go32_dpmi_lock_data
  14145. ====================
  14146.  
  14147. Syntax
  14148. ------
  14149.  
  14150.      #include <dpmi.h>
  14151.      
  14152.      int _go32_dpmi_lock_data( void *lockaddr, unsigned long locksize);
  14153.  
  14154. Description
  14155. -----------
  14156.  
  14157. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  14158. bytes.  LOCKADDR is a regular pointer in your program, such as the
  14159. address of a variable.
  14160.  
  14161. Example
  14162. -------
  14163.  
  14164.  
  14165.      int semaphore=0;
  14166.      
  14167.      void lock_my_handler()
  14168.      {
  14169.        _go32_dpmi_lock_data(&semaphore, 4);
  14170.      }
  14171.  
  14172. 
  14173. File: libc.inf,  Node: _go32_dpmi_remaining_physical_memory,  Next: _go32_dpmi_remaining_virtual_memory,  Prev: _go32_dpmi_lock_data,  Up: Alphabetical List
  14174.  
  14175. _go32_dpmi_remaining_physical_memory
  14176. ====================================
  14177.  
  14178. Syntax
  14179. ------
  14180.  
  14181.      #include <dpmi.h>
  14182.      
  14183.      unsigned long _go32_dpmi_remaining_physical_memory(void);
  14184.  
  14185. Description
  14186. -----------
  14187.  
  14188. Returns the amount of physical memory that is still available in the
  14189. system.
  14190.  
  14191. Return Value
  14192. ------------
  14193.  
  14194. The amount in bytes.
  14195.  
  14196. 
  14197. File: libc.inf,  Node: _go32_dpmi_remaining_virtual_memory,  Next: _go32_dpmi_resize_dos_memory,  Prev: _go32_dpmi_remaining_physical_memory,  Up: Alphabetical List
  14198.  
  14199. _go32_dpmi_remaining_virtual_memory
  14200. ===================================
  14201.  
  14202. Syntax
  14203. ------
  14204.  
  14205.      #include <dpmi.h>
  14206.      
  14207.      unsigned long _go32_dpmi_remaining_virtual_memory(void);
  14208.  
  14209. Description
  14210. -----------
  14211.  
  14212. Returns the amount of virtual memory that is still available in the
  14213. system.
  14214.  
  14215. Return Value
  14216. ------------
  14217.  
  14218. The amount in bytes.
  14219.  
  14220. 
  14221. 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
  14222.  
  14223. _go32_dpmi_resize_dos_memory
  14224. ============================
  14225.  
  14226. Syntax
  14227. ------
  14228.  
  14229.      #include <dpmi.h>
  14230.      
  14231.      int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
  14232.  
  14233. Description
  14234. -----------
  14235.  
  14236. *Note DPMI Overview::
  14237.  
  14238. The INFO structure is the same one used to allocate the memory.  Fill
  14239. in a new value for `size' and call this function.  If there is not
  14240. enough memory to satisfy the request, the largest size is filled in to
  14241. the `size' field, the memory is not resized, and this function fails.
  14242.  
  14243. Return Value
  14244. ------------
  14245.  
  14246. Zero on success, nonzero on failure.
  14247.  
  14248. Example
  14249. -------
  14250.  
  14251.      _go32_dpmi_seginfo info;
  14252.      info.size = 10;
  14253.      _go32_dpmi_allocate_dos_memory(&info);
  14254.      info.size = 20;
  14255.      _go32_dpmi_resize_dos_memory(&info);
  14256.      _go32_dpmi_free_dos_memory(&info);
  14257.  
  14258. 
  14259. 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
  14260.  
  14261. _go32_dpmi_set_protected_mode_interrupt_vector
  14262. ==============================================
  14263.  
  14264. Syntax
  14265. ------
  14266.  
  14267.      #include <dpmi.h>
  14268.      
  14269.      int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  14270.  
  14271. Description
  14272. -----------
  14273.  
  14274. *Note DPMI Overview::
  14275.  
  14276. This function sets the protected mode interrupt vector specified to
  14277. point to the given function.  The `pm_offset' and `pm_selector' fields
  14278. of INFO must be filled in (*note _go32_my_cs::.).  The following should
  14279. be noted:
  14280.  
  14281.    *  You may not `longjmp' out of an interrupt handler.
  14282.  
  14283.    *  You may not make any function calls that require system calls,
  14284.      such as `printf'.
  14285.  
  14286.    *  This function will not wrap the handler for you.  The
  14287.      `_go32_dpmi_allocate_iret_wrapper' and
  14288.      `_go32_dpmi_chain_protected_mode_interrupt_vector' functions can
  14289.      wrap your function if you want.
  14290.  
  14291.    *  You must set the pm_selector field of INFO.  Use `_go32_my_cs' to
  14292.      get a selector valid for your functions.
  14293.  
  14294. Return Value
  14295. ------------
  14296.  
  14297. Zero on success, nonzero on failure.
  14298.  
  14299. Example
  14300. -------
  14301.  
  14302.      volatile int tics = 0;
  14303.      
  14304.      timer_handler()
  14305.      {
  14306.        tics++;
  14307.      }
  14308.      
  14309.      int main()
  14310.      {
  14311.        _go32_dpmi_seginfo old_handler, new_handler;
  14312.      
  14313.        printf("grabbing timer interrupt\n");
  14314.        _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  14315.      
  14316.        new_handler.pm_offset = (int)tic_handler;
  14317.        new_handler.pm_selector = _go32_my_cs();
  14318.        _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  14319.      
  14320.        getkey();
  14321.      
  14322.        printf("releasing timer interrupt\n");
  14323.        _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  14324.      
  14325.        return 0;
  14326.      }
  14327.  
  14328. 
  14329. 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
  14330.  
  14331. _go32_dpmi_set_real_mode_interrupt_vector
  14332. =========================================
  14333.  
  14334. Syntax
  14335. ------
  14336.  
  14337.      #include <dpmi.h>
  14338.      
  14339.      int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  14340.  
  14341. Description
  14342. -----------
  14343.  
  14344. *Note DPMI Overview::
  14345.  
  14346. This function sets the real-mode interrupt vector specified to point to
  14347. the address in the `rm_segment' and `rm_offset' fields in INFO.
  14348.  
  14349. Return Value
  14350. ------------
  14351.  
  14352. Zero on success, nonzero on failure.
  14353.  
  14354. Example
  14355. -------
  14356.  
  14357. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  14358.  
  14359. 
  14360. 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
  14361.  
  14362. _go32_dpmi_simulate_fcall
  14363. =========================
  14364.  
  14365. Syntax
  14366. ------
  14367.  
  14368.      #include <dpmi.h>
  14369.      
  14370.      int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
  14371.  
  14372. Description
  14373. -----------
  14374.  
  14375. *Note DPMI Overview::
  14376.  
  14377. This function simulates a real-mode far call to a function that returns
  14378. with a far return.  The registers are set up from REGS, including `CS'
  14379. and `IP', which indicate the address of the call.  Any registers the
  14380. function modifies are reflected in REGS on return.
  14381.  
  14382. If `SS' and `SP' are both zero, a small temporary stack is used when in
  14383. real mode.  If not, they are used AS IS.  It's a good idea to use
  14384. `memset' to initialize the register structure before using it.
  14385.  
  14386. Return Value
  14387. ------------
  14388.  
  14389. Zero on success, nonzero on failure.
  14390.  
  14391. Example
  14392. -------
  14393.  
  14394.      _go32_dpmi_registers r;
  14395.      r.x.ax = 47;
  14396.      r.x.cs = some_segment;
  14397.      r.x.ip = some_offset;
  14398.      r.x.ss = r.x.sp = 0;
  14399.      _go32_dpmi_simulate_fcall(&r);
  14400.      printf("returns %d\n", r.x.ax);
  14401.  
  14402. 
  14403. File: libc.inf,  Node: _go32_dpmi_simulate_fcall_iret,  Next: _go32_dpmi_simulate_int,  Prev: _go32_dpmi_simulate_fcall,  Up: Alphabetical List
  14404.  
  14405. _go32_dpmi_simulate_fcall_iret
  14406. ==============================
  14407.  
  14408. Syntax
  14409. ------
  14410.  
  14411.      #include <dpmi.h>
  14412.      
  14413.      int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
  14414.  
  14415. Description
  14416. -----------
  14417.  
  14418. *Note DPMI Overview::
  14419.  
  14420. This function simulates a real-mode far call to a function that returns
  14421. with an `iret' instruction.  The registers are set up from REGS,
  14422. including `CS' and `IP', which indicate the address of the call.  Any
  14423. registers the function modifies are reflected in REGS on return.
  14424.  
  14425. If `SS' and `SP' are both zero, a small temporary stack is used when in
  14426. real mode.  If not, they are used AS IS.  It's a good idea to use
  14427. `memset' to initialize the register structure before using it.
  14428.  
  14429. Return Value
  14430. ------------
  14431.  
  14432. Zero on success, nonzero on failure.
  14433.  
  14434. Example
  14435. -------
  14436.  
  14437.      _go32_dpmi_registers r;
  14438.      r.x.ax = 47;
  14439.      r.x.cs = some_segment;
  14440.      r.x.ip = some_offset;
  14441.      r.x.ss = r.x.sp = 0;
  14442.      _go32_dpmi_simulate_fcall_iret(&r);
  14443.      printf("returns %d\n", r.x.ax);
  14444.  
  14445. 
  14446. File: libc.inf,  Node: _go32_dpmi_simulate_int,  Next: _go32_info_block,  Prev: _go32_dpmi_simulate_fcall_iret,  Up: Alphabetical List
  14447.  
  14448. _go32_dpmi_simulate_int
  14449. =======================
  14450.  
  14451. Syntax
  14452. ------
  14453.  
  14454.      #include <dpmi.h>
  14455.      
  14456.      int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
  14457.  
  14458. Description
  14459. -----------
  14460.  
  14461. *Note DPMI Overview::
  14462.  
  14463. This function simulates a real-mode interrup.  The registers are set up
  14464. from REGS, including `CS' and `IP', which indicate the address of the
  14465. call.  Any registers the function modifies are reflected in REGS on
  14466. return.
  14467.  
  14468. If `SS' and `SP' are both zero, a small temporary stack is used when in
  14469. real mode.  If not, they are used AS IS.  It's a good idea to use
  14470. `memset' to initialize the register structure before using it.
  14471.  
  14472. Return Value
  14473. ------------
  14474.  
  14475. Zero on success, nonzero on failure.
  14476.  
  14477. Example
  14478. -------
  14479.  
  14480.      _go32_dpmi_registers r;
  14481.      r.h.ah = 0x08;
  14482.      r.h.dl = 0x80; /* drive C: */
  14483.      r.x.ss = r.x.sp = 0;
  14484.      _go32_dpmi_simulate_int(0x13, &r);
  14485.      printf("disk is %d cyl, %d head, %d sect\n",
  14486.             r.h.ch | ((r.x.cl<<2)&0x300),
  14487.             r.h.dh, r.h.cl & 0x3f));
  14488.  
  14489. 
  14490. File: libc.inf,  Node: _go32_info_block,  Next: _go32_interrupt_stack_size,  Prev: _go32_dpmi_simulate_int,  Up: Alphabetical List
  14491.  
  14492. _go32_info_block
  14493. ================
  14494.  
  14495. Syntax
  14496. ------
  14497.  
  14498.      #include <go32.h>
  14499.      
  14500.      extern __Go32_Info_Block _go32_info_block;
  14501.  
  14502. Description
  14503. -----------
  14504.  
  14505. The go32 information block is a mechanism for `go32' to pass
  14506. information to the application.  Some of this information is generally
  14507. useful, such as the pid or the transfer buffer, while some is used
  14508. internally to `libc.a' only.
  14509.  
  14510. The structure has this format:
  14511.  
  14512.      typedef struct {
  14513.        unsigned long  size_of_this_structure_in_bytes;
  14514.        unsigned long  linear_address_of_primary_screen;
  14515.        unsigned long  linear_address_of_secondary_screen;
  14516.        unsigned long  linear_address_of_transfer_buffer;
  14517.        unsigned long  size_of_transfer_buffer;
  14518.        unsigned long  pid;
  14519.        unsigned char  master_interrupt_controller_base;
  14520.        unsigned char  slave_interrupt_controller_base;
  14521.        unsigned short selector_for_linear_memory;
  14522.        unsigned long  linear_address_of_stub_info_structure;
  14523.        unsigned long  linear_address_of_original_psp;
  14524.        unsigned short run_mode;
  14525.        unsigned short run_mode_info;
  14526.      } Go32_Info_Block;
  14527.  
  14528. The linear address fields provide values that are suitable for
  14529. `dosmemget', `dosmemput', and `movedata'.  The
  14530. selector_for_linear_memory is suitable for `<sys/farptr.h>' selector
  14531. parameters.
  14532.  
  14533. Due to the length of these fields, and their popularity, the following
  14534. macros are available:
  14535.  
  14536. `_dos_ds'
  14537.      This expands to _go32_info_block.selector_for_linear_memory
  14538.  
  14539. `__tb'
  14540.      This expands to _go32_info_block.linear_address_of_transfer_buffer
  14541.  
  14542. The `run_mode' field indicates the mode that the program is running in.
  14543. The following modes are defined:
  14544.  
  14545. `_GO32_RUN_MODE_UNDEF'
  14546.      This indicates that the extender did not (or could not) determine
  14547.      or provide the mode information.  The most probable reason is that
  14548.      it's an older extender that does not support this field.  The
  14549.      program should not assume anything about the run mode if it is
  14550.      this value.
  14551.  
  14552. `_GO32_RUN_MODE_RAW'
  14553.      This indicates that no CPU manager is being used, and no XMS
  14554.      manager is present.  The CPU is being managed directly from the
  14555.      extender, and memory was allocated from the extended memory pool.
  14556.  
  14557. `_GO32_RUN_MODE_XMS'
  14558.      This indicates that the extender is managing the CPU, but an XMS
  14559.      driver is managing the memory pool.
  14560.  
  14561. `_GO32_RUN_MODE_VCPI'
  14562.      This indicates that a VCPI server (like `emm386' or `qemm') is
  14563.      managing both the CPU and the memory.
  14564.  
  14565. `_GO32_RUN_MODE_DPMI'
  14566.      This indicates that a DPMI server (like `qdpmi' or Windows) is
  14567.      managing both the CPU and memory.  Programs may rely on this value
  14568.      to determine if it is safe to use DPMI 0.9 functions.
  14569.  
  14570.      If this value is set, the `run_mode_info' field has the DPMI
  14571.      specification version, in hex, shifted eight bits.  For example,
  14572.      DPMI 0.9 has 0x005A in the `run_mode_info' field.
  14573.  
  14574. Note that the program should not assume that the value will be one of
  14575. the listed values.  If the program is running with an extender that
  14576. provides some other mode (say, a newly released extender) then the
  14577. program should be able to handle that case gracefully.
  14578.  
  14579. Example
  14580. -------
  14581.  
  14582.      dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
  14583.  
  14584. 
  14585. File: libc.inf,  Node: _go32_interrupt_stack_size,  Next: _go32_my_cs,  Prev: _go32_info_block,  Up: Alphabetical List
  14586.  
  14587. _go32_interrupt_stack_size
  14588. ==========================
  14589.  
  14590. Syntax
  14591. ------
  14592.  
  14593.      #include <dpmi.h>
  14594.      
  14595.      extern unsigned long _go32_interrupt_stack_size;
  14596.  
  14597. Description
  14598. -----------
  14599.  
  14600. The default size of the interrupt handler's stack.  Defaults to 32k.
  14601.  
  14602. 
  14603. File: libc.inf,  Node: _go32_my_cs,  Next: _go32_my_ds,  Prev: _go32_interrupt_stack_size,  Up: Alphabetical List
  14604.  
  14605. _go32_my_cs
  14606. ===========
  14607.  
  14608. Syntax
  14609. ------
  14610.  
  14611.      #include <go32.h>
  14612.      
  14613.      u_short _go32_my_cs();
  14614.  
  14615. Description
  14616. -----------
  14617.  
  14618. Returns the current `CS'.  This is useful for setting up interrupt
  14619. vectors and such.
  14620.  
  14621. Return Value
  14622. ------------
  14623.  
  14624. `CS'
  14625.  
  14626. 
  14627. File: libc.inf,  Node: _go32_my_ds,  Next: _go32_my_ss,  Prev: _go32_my_cs,  Up: Alphabetical List
  14628.  
  14629. _go32_my_ds
  14630. ===========
  14631.  
  14632. Syntax
  14633. ------
  14634.  
  14635.      #include <go32.h>
  14636.      
  14637.      u_short _go32_my_ds();
  14638.  
  14639. Description
  14640. -----------
  14641.  
  14642. Returns the current `DS'.  This is useful for moving memory and such.
  14643.  
  14644. Return Value
  14645. ------------
  14646.  
  14647. `DS'
  14648.  
  14649. 
  14650. File: libc.inf,  Node: _go32_my_ss,  Next: _go32_rmcb_stack_size,  Prev: _go32_my_ds,  Up: Alphabetical List
  14651.  
  14652. _go32_my_ss
  14653. ===========
  14654.  
  14655. Syntax
  14656. ------
  14657.  
  14658.      #include <go32.h>
  14659.      
  14660.      u_short _go32_my_ss();
  14661.  
  14662. Description
  14663. -----------
  14664.  
  14665. Returns the current `SS'.  This is useful for moving memory and such.
  14666.  
  14667. Return Value
  14668. ------------
  14669.  
  14670. `SS'
  14671.  
  14672. 
  14673. File: libc.inf,  Node: _go32_rmcb_stack_size,  Next: _go32_want_ctrl_break,  Prev: _go32_my_ss,  Up: Alphabetical List
  14674.  
  14675. _go32_rmcb_stack_size
  14676. =====================
  14677.  
  14678. Syntax
  14679. ------
  14680.  
  14681.      #include <dpmi.h>
  14682.      
  14683.      extern unsigned long _go32_rmcb_stack_size;
  14684.  
  14685. Description
  14686. -----------
  14687.  
  14688. The default size of the real mode callback handler's stack.  Defaults
  14689. to 32k.
  14690.  
  14691. 
  14692. File: libc.inf,  Node: _go32_want_ctrl_break,  Next: _go32_was_ctrl_break_hit,  Prev: _go32_rmcb_stack_size,  Up: Alphabetical List
  14693.  
  14694. _go32_want_ctrl_break
  14695. =====================
  14696.  
  14697. Syntax
  14698. ------
  14699.  
  14700.      #include <go32.h>
  14701.      
  14702.      void   _go32_want_ctrl_break(int yes);
  14703.  
  14704. Description
  14705. -----------
  14706.  
  14707. This function tells go32 whether or not it wants `Ctrl-Break' to be an
  14708. exception or passed to the application.  If you pass a nonzero value
  14709. for YES, pressing `Ctrl-Break' will set a flag that can be detected
  14710. with `_go32_was_ctrl_break_hit' (*note _go32_was_ctrl_break_hit::.).
  14711. If you pass zero for YES, When you press `Ctrl-Break' the program will
  14712. be terminated.
  14713.  
  14714. Note that if you call `_go32_was_ctrl_break_hit', this function
  14715. automatically gets called to ask for `Ctrl-Break' events.
  14716.  
  14717. Return Value
  14718. ------------
  14719.  
  14720. None.
  14721.  
  14722. Example
  14723. -------
  14724.  
  14725.      _g32_want_ctrl_break(1);
  14726.      do_something_long();
  14727.      _g32_want_ctrl_break(0);
  14728.  
  14729. 
  14730. File: libc.inf,  Node: _go32_was_ctrl_break_hit,  Next: gotoxy,  Prev: _go32_want_ctrl_break,  Up: Alphabetical List
  14731.  
  14732. _go32_was_ctrl_break_hit
  14733. ========================
  14734.  
  14735. Syntax
  14736. ------
  14737.  
  14738.      #include <go32.h>
  14739.      
  14740.      unsigned _go32_was_ctrl_break_hit(void);
  14741.  
  14742. Description
  14743. -----------
  14744.  
  14745. This function returns the number of times that `Ctrl-Break' was hit
  14746. since the last call to this function or `_go32_want_ctrl_break' (*note
  14747. _go32_want_ctrl_break::.).
  14748.  
  14749. Return Value
  14750. ------------
  14751.  
  14752. Zero if `Ctrl-Break' hasn't been hit, nonzero to indicate how many
  14753. times if it has been hit.
  14754.  
  14755. Note that `_go32_want_ctrl_break' is automatically called to request
  14756. these events, so you don't have to set up for this call.
  14757.  
  14758. Example
  14759. -------
  14760.  
  14761.      while (!_go32_was_ctrl_break_hit())
  14762.        do_something();
  14763.  
  14764. 
  14765. File: libc.inf,  Node: gotoxy,  Next: gppconio_init,  Prev: _go32_was_ctrl_break_hit,  Up: Alphabetical List
  14766.  
  14767. gotoxy
  14768. ======
  14769.  
  14770. Syntax
  14771. ------
  14772.  
  14773.      #include <conio.h>
  14774.      
  14775.      void gotoxy(int x, int y);
  14776.  
  14777. Description
  14778. -----------
  14779.  
  14780. Move the cursor to row y, column x.  The upper left corner of the
  14781. current window is (1,1).
  14782.  
  14783. 
  14784. File: libc.inf,  Node: gppconio_init,  Next: hasmntopt,  Prev: gotoxy,  Up: Alphabetical List
  14785.  
  14786. gppconio_init
  14787. =============
  14788.  
  14789. Syntax
  14790. ------
  14791.  
  14792.      #include <conio.h>
  14793.      
  14794.      void gppconio_init(void);
  14795.  
  14796. Description
  14797. -----------
  14798.  
  14799. Initialize the screen.  This is called automatically at program start-up
  14800. if you use any of the `conio' functions, but there may be times when
  14801. you need to call it again, typically after calling some video BIOS
  14802. function which affects screen parameters.
  14803.  
  14804. 
  14805. File: libc.inf,  Node: hasmntopt,  Next: highvideo,  Prev: gppconio_init,  Up: Alphabetical List
  14806.  
  14807. hasmntopt
  14808. =========
  14809.  
  14810. Syntax
  14811. ------
  14812.  
  14813.      #include <mntent.h>
  14814.      
  14815.      char *hasmntopt(const struct mntent *mnt, const char *opt);
  14816.  
  14817. Description
  14818. -----------
  14819.  
  14820. This function scans the `mnt_opts' field of the `mntent' structure MNT
  14821. for a substring that matches OPT.  *Note getmntent::.
  14822.  
  14823. Return Value
  14824. ------------
  14825.  
  14826. This function returns the address of the substring if a match is found,
  14827. or `NULL' otherwise.
  14828.  
  14829. 
  14830. File: libc.inf,  Node: highvideo,  Next: htonl,  Prev: hasmntopt,  Up: Alphabetical List
  14831.  
  14832. highvideo
  14833. =========
  14834.  
  14835. Syntax
  14836. ------
  14837.  
  14838.      #include <conio.h>
  14839.      
  14840.      void highvideo(void);
  14841.  
  14842. Description
  14843. -----------
  14844.  
  14845. Causes any new characters put on the screen to be bright.
  14846.  
  14847. 
  14848. File: libc.inf,  Node: htonl,  Next: htons,  Prev: highvideo,  Up: Alphabetical List
  14849.  
  14850. htonl
  14851. =====
  14852.  
  14853. Syntax
  14854. ------
  14855.  
  14856.      #include <netinet/in.h>
  14857.      
  14858.      unsigned long htonl(unsigned long val);
  14859.  
  14860. Description
  14861. -----------
  14862.  
  14863. This function converts from host formatted longs to network formatted
  14864. longs.  For the i386 and higher processors, this means that the bytes
  14865. are swapped from 1234 order to 4321 order.
  14866.  
  14867. Return Value
  14868. ------------
  14869.  
  14870. The network-order value.
  14871.  
  14872. Example
  14873. -------
  14874.  
  14875.      packet.ipaddr = htonl(ip);
  14876.  
  14877. 
  14878. File: libc.inf,  Node: htons,  Next: hypot,  Prev: htonl,  Up: Alphabetical List
  14879.  
  14880. htons
  14881. =====
  14882.  
  14883. Syntax
  14884. ------
  14885.  
  14886.      #include <netinet/in.h>
  14887.      
  14888.      unsigned short htons(unsigned short val);
  14889.  
  14890. Description
  14891. -----------
  14892.  
  14893. This function converts from host formatted shorts to network formatted
  14894. shorts.  For the i386 and higher processors, this means that the bytes
  14895. are swapped from 12 order to 21 order.
  14896.  
  14897. Return Value
  14898. ------------
  14899.  
  14900. The network-order value.
  14901.  
  14902. Example
  14903. -------
  14904.  
  14905.      tcp.port = htons(port);
  14906.  
  14907. 
  14908. File: libc.inf,  Node: hypot,  Next: inb,  Prev: htons,  Up: Alphabetical List
  14909.  
  14910. hypot
  14911. =====
  14912.  
  14913. Syntax
  14914. ------
  14915.  
  14916.      #include <math.h>
  14917.      
  14918.      double hypot(double x, double y);
  14919.  
  14920. Return Value
  14921. ------------
  14922.  
  14923. The length of a hypotenuse of a right triangle whose shorter sides are
  14924. X and Y.  In other words, the distance between (0,0) and (X,Y).
  14925.  
  14926. 
  14927. File: libc.inf,  Node: inb,  Next: index,  Prev: hypot,  Up: Alphabetical List
  14928.  
  14929. inb
  14930. ===
  14931.  
  14932. Syntax
  14933. ------
  14934.  
  14935.      #include <pc.h>
  14936.      
  14937.      unsigned char inb(unsigned short _port);
  14938.  
  14939. Description
  14940. -----------
  14941.  
  14942. Calls *Note inportb::. Provided only for compatibility.
  14943.  
  14944. 
  14945. File: libc.inf,  Node: index,  Next: inp,  Prev: inb,  Up: Alphabetical List
  14946.  
  14947. index
  14948. =====
  14949.  
  14950. Syntax
  14951. ------
  14952.  
  14953.      #include <strings.h>
  14954.      
  14955.      char *index(const char *string, int ch);
  14956.  
  14957. Description
  14958. -----------
  14959.  
  14960. Returns a pointer to the first occurrence of CH in STRING.  Note that
  14961. the `NULL' character counts, so if you pass zero as CH you'll get a
  14962. pointer to the end of the string back.
  14963.  
  14964. Return Value
  14965. ------------
  14966.  
  14967. A pointer to the character, or `NULL' if it wasn't found.
  14968.  
  14969. Example
  14970. -------
  14971.  
  14972.      if (index(path, '*'))
  14973.        do_wildcards(path);
  14974.  
  14975. 
  14976. File: libc.inf,  Node: inp,  Next: inportb,  Prev: index,  Up: Alphabetical List
  14977.  
  14978. inp
  14979. ===
  14980.  
  14981. Syntax
  14982. ------
  14983.  
  14984.      #include <pc.h>
  14985.      
  14986.      unsigned char inp(unsigned short _port);
  14987.  
  14988. Description
  14989. -----------
  14990.  
  14991. Calls *Note inportb::.  Provided only for compatibility.
  14992.  
  14993. 
  14994. File: libc.inf,  Node: inportb,  Next: inportl,  Prev: inp,  Up: Alphabetical List
  14995.  
  14996. inportb
  14997. =======
  14998.  
  14999. Syntax
  15000. ------
  15001.  
  15002.      #include <pc.h>
  15003.      
  15004.      unsigned char inportb(unsigned short _port);
  15005.  
  15006. Description
  15007. -----------
  15008.  
  15009. Read a single 8-bit I/O port.
  15010.  
  15011. This function is provided as an inline assembler macro, and will be
  15012. optimized down to a single opcode when you optimize your program.
  15013.  
  15014. Return Value
  15015. ------------
  15016.  
  15017. The value returned through the port.
  15018.  
  15019. 
  15020. File: libc.inf,  Node: inportl,  Next: inportsb,  Prev: inportb,  Up: Alphabetical List
  15021.  
  15022. inportl
  15023. =======
  15024.  
  15025. Syntax
  15026. ------
  15027.  
  15028.      #include <pc.h>
  15029.      
  15030.      unsigned long inportl(unsigned short _port);
  15031.  
  15032. Description
  15033. -----------
  15034.  
  15035. This function reads a single 32-bit I/O port.
  15036.  
  15037. This function is provided as an inline assembler macro, and will be
  15038. optimized down to a single opcode when you optimize your program.
  15039.  
  15040. Return Value
  15041. ------------
  15042.  
  15043. The value returned from the port.
  15044.  
  15045. 
  15046. File: libc.inf,  Node: inportsb,  Next: inportsl,  Prev: inportl,  Up: Alphabetical List
  15047.  
  15048. inportsb
  15049. ========
  15050.  
  15051. Syntax
  15052. ------
  15053.  
  15054.      #include <pc.h>
  15055.      
  15056.      void inportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  15057.  
  15058. Description
  15059. -----------
  15060.  
  15061. Reads the 8-bit _PORT _LEN times, and stores the bytes in BUF.
  15062.  
  15063. 
  15064. File: libc.inf,  Node: inportsl,  Next: inportsw,  Prev: inportsb,  Up: Alphabetical List
  15065.  
  15066. inportsl
  15067. ========
  15068.  
  15069. Syntax
  15070. ------
  15071.  
  15072.      #include <pc.h>
  15073.      
  15074.      void inportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  15075.  
  15076. Description
  15077. -----------
  15078.  
  15079. Reads the 32-bit _PORT _LEN times, and stores the bytes in BUF.
  15080.  
  15081. 
  15082. File: libc.inf,  Node: inportsw,  Next: inportw,  Prev: inportsl,  Up: Alphabetical List
  15083.  
  15084. inportsw
  15085. ========
  15086.  
  15087. Syntax
  15088. ------
  15089.  
  15090.      #include <pc.h>
  15091.      
  15092.      void inportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  15093.  
  15094. Description
  15095. -----------
  15096.  
  15097. Reads the 16-bit _PORT _LEN times, and stores the bytes in BUF.
  15098.  
  15099. 
  15100. File: libc.inf,  Node: inportw,  Next: inpw,  Prev: inportsw,  Up: Alphabetical List
  15101.  
  15102. inportw
  15103. =======
  15104.  
  15105. Syntax
  15106. ------
  15107.  
  15108.      #include <pc.h>
  15109.      
  15110.      unsigned short inportw(unsigned short _port);
  15111.  
  15112. Description
  15113. -----------
  15114.  
  15115. Read a single 16-bit I/O port.
  15116.  
  15117. This function is provided as an inline assembler macro, and will be
  15118. optimized down to a single opcode when you optimize your program.
  15119.  
  15120. Return Value
  15121. ------------
  15122.  
  15123. The value returned through the port.
  15124.  
  15125. 
  15126. File: libc.inf,  Node: inpw,  Next: insline,  Prev: inportw,  Up: Alphabetical List
  15127.  
  15128. inpw
  15129. ====
  15130.  
  15131. Syntax
  15132. ------
  15133.  
  15134.      #include <pc.h>
  15135.      
  15136.      unsigned short inpw(unsigned short _port);
  15137.  
  15138. Description
  15139. -----------
  15140.  
  15141. Calls *Note inportw::.  Provided only for compatibility.
  15142.  
  15143. 
  15144. File: libc.inf,  Node: insline,  Next: insque,  Prev: inpw,  Up: Alphabetical List
  15145.  
  15146. insline
  15147. =======
  15148.  
  15149. Syntax
  15150. ------
  15151.  
  15152.      #include <conio.h>
  15153.      
  15154.      void insline(void);
  15155.  
  15156. Description
  15157. -----------
  15158.  
  15159. A blank line is inserted at the current cursor position.  The previous
  15160. line and lines below it scroll down.
  15161.  
  15162. 
  15163. File: libc.inf,  Node: insque,  Next: int386,  Prev: insline,  Up: Alphabetical List
  15164.  
  15165. insque
  15166. ======
  15167.  
  15168. Syntax
  15169. ------
  15170.  
  15171.      #include <search.h>
  15172.      
  15173.      void insque(struct qelem *elem, struct qelem *pred);
  15174.  
  15175. Description
  15176. -----------
  15177.  
  15178. This function manipulates queues built from doubly linked lists.  Each
  15179. element in the queue must be in the form of `struct qelem' which is
  15180. defined thus:
  15181.  
  15182.      struct qelem {
  15183.        struct qelem *q_forw;
  15184.        struct qelem *q_back;
  15185.        char q_data[0];
  15186.      }
  15187.  
  15188. This function inserts ELEM in a queue immediately after PRED.
  15189.  
  15190. Return Value
  15191. ------------
  15192.  
  15193. None.
  15194.  
  15195. 
  15196. File: libc.inf,  Node: int386,  Next: int386x,  Prev: insque,  Up: Alphabetical List
  15197.  
  15198. int386
  15199. ======
  15200.  
  15201. Syntax
  15202. ------
  15203.  
  15204.      #include <dos.h>
  15205.      
  15206.      int int386(int ivec, union REGS *in, union REGS *out);
  15207.  
  15208. Description
  15209. -----------
  15210.  
  15211. This function is equal to `int86' function.  See *Note int86:: for
  15212. further description.
  15213.  
  15214. Return Value
  15215. ------------
  15216.  
  15217. The returned value of `EAX'.
  15218.  
  15219. 
  15220. File: libc.inf,  Node: int386x,  Next: int86,  Prev: int386,  Up: Alphabetical List
  15221.  
  15222. int386x
  15223. =======
  15224.  
  15225. Syntax
  15226. ------
  15227.  
  15228.      #include <dos.h>
  15229.      
  15230.      int int386x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  15231.  
  15232. Description
  15233. -----------
  15234.  
  15235. This function is equal to `int86x'.  See *Note int86:: for further
  15236. description.
  15237.  
  15238. Return Value
  15239. ------------
  15240.  
  15241. The value of `EAX' is returned.
  15242.  
  15243. 
  15244. File: libc.inf,  Node: int86,  Next: int86x,  Prev: int386x,  Up: Alphabetical List
  15245.  
  15246. int86
  15247. =====
  15248.  
  15249. Syntax
  15250. ------
  15251.  
  15252.      #include <dos.h>
  15253.      
  15254.      int int86(int ivec, union REGS *in, union REGS *out);
  15255.  
  15256. Description
  15257. -----------
  15258.  
  15259. Note: The `.x.' branch is a problem generator.  Most code expects the
  15260. `.x.' branch to have e.g. "`.x.ax'" members, and that they are 16-bit.
  15261. If you know you want 32-bit values, use the `.d.eax' members.  If you
  15262. know you want 16-bit values, use the `.w.ax' members.  The `.x.'
  15263. members behave according to `#defines', as follows:
  15264.  
  15265. `default'
  15266.      If you specify no `#define', the `.x.' branch has "`ax'" members
  15267.      and is 32-bit.  This is compatible with previous versions of djgpp.
  15268.  
  15269. `_NAIVE_DOS_REGS'
  15270.      This define gives you `.x.ax', but they are 16-bit.  This is
  15271.      probably what most programs ported from 16-bit dos compilers will
  15272.      want.
  15273.  
  15274. `_BORLAND_DOS_REGS'
  15275.      This define gives you `.x.eax' which are 32-bit.  This is
  15276.      compatible with Borland's 32-bit compilers.
  15277.  
  15278. This function simulates a software interrupt.  Note that, unlike the
  15279. `__dpmi_int' function, requests that go through `int86' and similar
  15280. functions are specially processed to make them suitable for invoking
  15281. real-mode interrupts from protected-mode programs.  For example, if a
  15282. particular routine takes a pointer in `BX', `int86' expects you to put
  15283. a (protected-mode) pointer in `EBX'.  Therefore, `int86' should have
  15284. specific support for every interrupt and function you invoke this way.
  15285. Currently, it supports only a subset of all available interrupts and
  15286. functions:
  15287.  
  15288. 1) All functions of any interrupt which expects only scalar arguments
  15289. registers (i.e., no pointers to buffers).
  15290.  
  15291. 2) In addition, the following functions of interrupt 21h are supported:
  15292. 9, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Fh, 40h, 41h, 43h, 47h, 56h.
  15293.  
  15294. When the interrupt is invoked, the CPU registers are copied from IN.
  15295. After the interrupt, the CPU registers are copied to OUT.
  15296.  
  15297. This function is just like `int86x' (*note int86x::.) except that
  15298. suitable default values are used for the segment registers.
  15299.  
  15300. *Note int86x::. *Note intdos::. *Note bdos::.
  15301.  
  15302. Return Value
  15303. ------------
  15304.  
  15305. The returned value of `EAX'.
  15306.  
  15307. Example
  15308. -------
  15309.  
  15310.      union REGS r;
  15311.      r.x.ax = 0x0100;
  15312.      r.h.dl = 'c';
  15313.      int86(0x21, &r, &r);
  15314.  
  15315. 
  15316. File: libc.inf,  Node: int86x,  Next: intdos,  Prev: int86,  Up: Alphabetical List
  15317.  
  15318. int86x
  15319. ======
  15320.  
  15321. Syntax
  15322. ------
  15323.  
  15324.      #include <dos.h>
  15325.      
  15326.      int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  15327.  
  15328. Description
  15329. -----------
  15330.  
  15331. This function is just like `int86' (*note int86::.) except that values
  15332. you pass in SREGS are used for the segment registers instead of the
  15333. defaults.
  15334.  
  15335. *Note int86::. *Note intdos::. *Note bdos::.
  15336.  
  15337. Return Value
  15338. ------------
  15339.  
  15340. The value of `EAX' is returned.
  15341.  
  15342. Example
  15343. -------
  15344.  
  15345.      union REGS r;
  15346.      struct SREGS s;
  15347.      r.h.ah = 0x31;
  15348.      r.h.dl = 'c';
  15349.      r.x.si = si_val;
  15350.      s.ds = ds_val;
  15351.      int86x(0x21, &r, &r, &s);
  15352.  
  15353. 
  15354. File: libc.inf,  Node: intdos,  Next: intdosx,  Prev: int86x,  Up: Alphabetical List
  15355.  
  15356. intdos
  15357. ======
  15358.  
  15359. Syntax
  15360. ------
  15361.  
  15362.      #include <dos.h>
  15363.      
  15364.      int intdos(union REGS *in, union REGS *out);
  15365.  
  15366. Description
  15367. -----------
  15368.  
  15369. This function is just like `int86' (*note int86x::.) except that the
  15370. interrupt vector is 0x21.
  15371.  
  15372. Return Value
  15373. ------------
  15374.  
  15375. `EAX'
  15376.  
  15377. 
  15378. File: libc.inf,  Node: intdosx,  Next: intensevideo,  Prev: intdos,  Up: Alphabetical List
  15379.  
  15380. intdosx
  15381. =======
  15382.  
  15383. Syntax
  15384. ------
  15385.  
  15386.      #include <dos.h>
  15387.      
  15388.      int intdosx(union REGS *in, union REGS *out, struct SREGS *s);
  15389.  
  15390. Description
  15391. -----------
  15392.  
  15393. This function is just like `int86x' (*note int86x::.) except that the
  15394. interrupt vector is 0x21.
  15395.  
  15396. Return Value
  15397. ------------
  15398.  
  15399. `EAX'
  15400.  
  15401. 
  15402. File: libc.inf,  Node: intensevideo,  Next: ioctl (DOS),  Prev: intdosx,  Up: Alphabetical List
  15403.  
  15404. intensevideo
  15405. ============
  15406.  
  15407. Syntax
  15408. ------
  15409.  
  15410.      #include <conio.h>
  15411.      void intensevideo(void);
  15412.  
  15413. Description
  15414. -----------
  15415.  
  15416. Bit 7 (`MSB') of the character attribute byte has two possible effects
  15417. on EGA and VGA displays: it can either make the character blink or
  15418. change the background color to bright (thus allowing for 16 background
  15419. colors as opposed to the usual 8).  This function sets that bit to
  15420. display bright background colors.  After a call to this function, every
  15421. character written to the screen with bit 7 of the attribute byte set,
  15422. will have a bright background color.  The companion function
  15423. `blinkvideo' (*note blinkvideo::.) has the opposite effect.
  15424.  
  15425. Note that there is no BIOS function to get the current status of this
  15426. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  15427. the current state: if it's 1 (the default), blinking characters will be
  15428. displayed.
  15429.  
  15430. 
  15431. File: libc.inf,  Node: ioctl (DOS),  Next: ioctl (General description),  Prev: intensevideo,  Up: Alphabetical List
  15432.  
  15433. ioctl (DOS)
  15434. ===========
  15435.  
  15436. The DOSish version of `ioctl' performs an interrupt 0x21, function
  15437. 0x44. It takes care of supplying transfer buffers in low address
  15438. regions, if they are needed. For an exhaustive description of the
  15439. various commands and subcommands, see Ralph Browns interrupt list.
  15440.  
  15441. It is highly recommended to use only the DOS_* functions listed in
  15442. `sys/ioctl.h'.
  15443.  
  15444. Syntax
  15445. ------
  15446.  
  15447. ioctl(fd, cmd, ... );
  15448.  
  15449.      #include <sys/ioctl.h>
  15450.      int main(int argc, char **argv){
  15451.         char buf[6];
  15452.         short *s;
  15453.      
  15454.         open(fd,"EMMQXXX0",O_RDONLY);
  15455.         mybuf[0] = '\0';
  15456.         s = mybuf;
  15457.         ioctl(fd,DOS_SNDDATA,6, (int) &mybuf);
  15458.         if(*s ==0x25 )printf("EMM386 >= 4.45\n");
  15459.         mybuf[0]='\x02';
  15460.         ioctl(fd,DOS_SNDDATA,2,(int )&mybuf);
  15461.         printf("EMM Version %d.%d\n",(int )mybuf[0],(int) mybuf[1]);
  15462.         close(fd);
  15463.      }
  15464.  
  15465. Description
  15466. -----------
  15467.  
  15468. The parameter `fd' must refer to a file descriptor for character device
  15469. functions, or the number of a block device (usually current=0, A:=1,
  15470. ...).
  15471.  
  15472. The following constants can be used for the `cmd' parameter:
  15473. `DOS_GETDEVDATA'
  15474.      Get device information. Returns the device information word from
  15475.      `DX'.
  15476.  
  15477. `DOS_SETDEVDATA'
  15478.      Set device information. Returns the new device information word
  15479.      form `DX' or -1
  15480.  
  15481. `DOS_RCVDATA'
  15482.      Read from character device control channel. After `cmd' must
  15483.      follow the number of requested bytes to read and a pointer to a
  15484.      buffer. Returns the number of bytes actually read or -1 on error.
  15485.  
  15486. `DOS_SNDDATA'
  15487.      Write to character device control channel. After `cmd' must follow
  15488.      the number of bytes to write and a pointer to a buffer holding the
  15489.      data.  Returns the number of bytes actually written.
  15490.  
  15491. `DOS_RCVCTLDATA'
  15492.      Read from block device control channel. See `DOS_RCVDATA'.
  15493.  
  15494. `DOS_SNDCTLDATA'
  15495.      Write to block device control channel. See `DOS_SNDDATA'.
  15496.  
  15497. `DOS_CHKINSTAT'
  15498.      Check the input status of a file. Returns 0 if not ready of at
  15499.      EOF, `0xff' if file is ready.
  15500.  
  15501. `DOS_CHKOUTSTAT'
  15502.      Check the output status of a file. Returns 0 if not ready of at
  15503.      EOF, `0xff' if file is ready.
  15504.  
  15505. `DOS_ISCHANGEABLE'
  15506.      Check if a block device is changeable. Returns 0 for removable or
  15507.      1 for fixed.
  15508.  
  15509. `DOS_ISREDIRBLK'
  15510.      Check if a block device is remote o local.
  15511.  
  15512. `DOS_ISREDIRHND'
  15513.      Check if a file handle refers to a local or remote device.
  15514.  
  15515. `DOS_SETRETRY'
  15516.      Set the sharing retry count. the first extra parameter specifies
  15517.      the pause between retries, the second number of retries.
  15518.  
  15519. `DOS_GENCHARREQ'
  15520.      Generic character device request.
  15521.  
  15522. `DOS_GENBLKREQ'
  15523.      Generic block device request.
  15524.  
  15525. `DOS_GLDRVMAP'
  15526.      Get logical drive map.
  15527.  
  15528. `DOS_SLDRVMAP'
  15529.      Set logical drive map.
  15530.  
  15531. `DOS_QGIOCTLCAPH'
  15532.      Query generic ioctl capability (handle). Test if a handle supports
  15533.      ioctl functions beyond those in the standard DOS 3.2 set.
  15534.  
  15535. `DOS_QGIOCTLCAPD'
  15536.      Query generic ioctl capability (drive). Test if a drive supports
  15537.      ioctl functions beyond those in the standard DOS 3.2 set.
  15538.  
  15539. If your specific device driver requires different commands, they must
  15540. be or'ed together with the flags listed in `ioctl.h' to tell the drive
  15541. about transfer buffers and what to return.
  15542.  
  15543. Return Value
  15544. ------------
  15545.  
  15546. See description above.
  15547.  
  15548. Device information word
  15549. -----------------------
  15550.  
  15551. The bits of the device information word have the following meaning:\\
  15552. Character device:
  15553.      14  Device driver can process IOCTL request
  15554.  
  15555.      13  output until busy supported
  15556.  
  15557.      11  driver supports OPEN/CLOSE calls
  15558.  
  15559.      7   set (indicates device)
  15560.  
  15561.      6   EOF on input
  15562.  
  15563.      5   raw (binary) mode
  15564.  
  15565.      4   device is special (uses INT 29)
  15566.  
  15567.      3   clock device
  15568.  
  15569.      2   NUL device
  15570.  
  15571.      1   standard output
  15572.  
  15573.      0   standard input
  15574.  
  15575. Disk file:
  15576.      15  file is remote (DOS 3.0+)
  15577.  
  15578.      14  don't set file date/time on closing (DOS 3.0+)
  15579.  
  15580.      11  media not removable
  15581.  
  15582.      8   (DOS 4 only) generate INT 24 if no disk space on write or read
  15583.      past end of file
  15584.  
  15585.      7   clear (indicates file)
  15586.  
  15587.      6   file has not been written
  15588.  
  15589.      5-0 drive number (0 = A:)
  15590.  
  15591. 
  15592. File: libc.inf,  Node: ioctl (General description),  Next: ioctl (UNIX),  Prev: ioctl (DOS),  Up: Alphabetical List
  15593.  
  15594. ioctl (General description)
  15595. ===========================
  15596.  
  15597. `ioctl' performs low level calls to communicate with device drivers. As
  15598. there are lots of different device drivers, no really general
  15599. description is possible.
  15600.  
  15601. The DJGPP version tries to cope two different flavors of `ioctl', a
  15602. DOSish and a UNIXish way. To distinguish between DOS-like and UNIX-like
  15603. calls, all valid DOS commands have the 3 MSB set to 0, the UNIX command
  15604. have at least one of the 3 MSB set.
  15605.  
  15606. 
  15607. File: libc.inf,  Node: ioctl (UNIX),  Next: _is_executable,  Prev: ioctl (General description),  Up: Alphabetical List
  15608.  
  15609. ioctl (UNIX)
  15610. ============
  15611.  
  15612. The UNIX version first checks if an FSE handler is associated to the
  15613. file descriptor. If so, it calls the handler in the usual way *Note
  15614. File System Extensions::. Otherwise it sets ERRNO to `ENOTTY' and
  15615. returns -1.
  15616.  
  15617. As this part is still under development, it should not be used
  15618. exhaustively.
  15619.  
  15620. 
  15621. File: libc.inf,  Node: _is_executable,  Next: isalnum,  Prev: ioctl (UNIX),  Up: Alphabetical List
  15622.  
  15623. _is_executable
  15624. ==============
  15625.  
  15626. Syntax
  15627. ------
  15628.  
  15629.      #include <sys/stat.h>
  15630.      
  15631.      int _is_executable(const char *path, int fhandle, const char *extension);
  15632.  
  15633. Description
  15634. -----------
  15635.  
  15636. This function determines if a file is executable under DOS/DJGPP
  15637. environment.  The file may be given either by its PATH or its file
  15638. handle FHANDLE.  If EXTENSION is non-NULL and non-empty, it is used
  15639. first to look up in a list of known extensions which determine whether
  15640. the file is executable.  (If the _STAT_EXEC_EXT bit of the *Note
  15641. _djstat_flags:: global variable is not set, this step is skipped.) If
  15642. EXTENSION is unavailable or not enough to determine the result, the
  15643. first 2 bytes of the file are checked to contain one of the known
  15644. `magic numbers' identifying the file as executable.  If the file's 2
  15645. first bytes need to be read but the read fails, 0 is returned and errno
  15646. is set.  (The file is only searched for magic number if the
  15647. _STAT_EXEC_MAGIC bit of the *Note _djstat_flags:: variable is set.)
  15648.  
  15649. Note that if _STAT_EXEC_MAGIC is set, but _STAT_EXEC_EXT is not, some
  15650. files which shouldn't be flagged as executables (e.g., COFF *.o object
  15651. files) will have their execute bit set, because they have the magic
  15652. number signature at their beginning.  Therefore, only use the above
  15653. combination if you want to debug the list of extensions provided in
  15654. is_exec.c file.
  15655.  
  15656. If the file passed by its handle was open as write-only, and the
  15657. extension alone isn't enough to determine whether the file is
  15658. executable, then this function returns 0, because it cannot look at the
  15659. `magic number'.
  15660.  
  15661. This function is used internally by `f?stat()'; you are not supposed to
  15662. call it directly.
  15663.  
  15664. Return Value
  15665. ------------
  15666.  
  15667. 1 for executable file, 0 otherwise (including in case of errors in
  15668. accessing the file).
  15669.  
  15670. 
  15671. File: libc.inf,  Node: isalnum,  Next: isalpha,  Prev: _is_executable,  Up: Alphabetical List
  15672.  
  15673. isalnum
  15674. =======
  15675.  
  15676. Syntax
  15677. ------
  15678.  
  15679.      #include <ctype.h>
  15680.      
  15681.      int isalnum(int c);
  15682.  
  15683. Description
  15684. -----------
  15685.  
  15686. Tells if C is any letter or digit.
  15687.  
  15688. Return Value
  15689. ------------
  15690.  
  15691. Nonzero if C is a letter or digit, else zero.
  15692.  
  15693. Example
  15694. -------
  15695.  
  15696. 
  15697. File: libc.inf,  Node: isalpha,  Next: isascii,  Prev: isalnum,  Up: Alphabetical List
  15698.  
  15699. isalpha
  15700. =======
  15701.  
  15702. Syntax
  15703. ------
  15704.  
  15705.      #include <ctype.h>
  15706.      
  15707.      int isalpha(int c);
  15708.  
  15709. Description
  15710. -----------
  15711.  
  15712. Tells if C is a letter.
  15713.  
  15714. Return Value
  15715. ------------
  15716.  
  15717. Nonzero if C is a letter, else zero.
  15718.  
  15719. 
  15720. File: libc.inf,  Node: isascii,  Next: isatty,  Prev: isalpha,  Up: Alphabetical List
  15721.  
  15722. isascii
  15723. =======
  15724.  
  15725. Syntax
  15726. ------
  15727.  
  15728.      #include <ctype.h>
  15729.      
  15730.      int isascii(int c);
  15731.  
  15732. Description
  15733. -----------
  15734.  
  15735. Tells if C is an ASCII character (0x00 to 0x7f).
  15736.  
  15737. Return Value
  15738. ------------
  15739.  
  15740. Nonzero if C is ASCII, else zero.
  15741.  
  15742. 
  15743. File: libc.inf,  Node: isatty,  Next: iscntrl,  Prev: isascii,  Up: Alphabetical List
  15744.  
  15745. isatty
  15746. ======
  15747.  
  15748. Syntax
  15749. ------
  15750.  
  15751.      #include <unistd.h>
  15752.      
  15753.      int isatty(int fd);
  15754.  
  15755. Description
  15756. -----------
  15757.  
  15758. Tells if the file descriptor refers to a terminal device or not.
  15759.  
  15760. Return Value
  15761. ------------
  15762.  
  15763. Nonzero if FD is a terminal device, zero  otherwise.
  15764.  
  15765. Example
  15766. -------
  15767.  
  15768.      if (isatty(1))
  15769.        fflush(stdout);
  15770.  
  15771. 
  15772. File: libc.inf,  Node: iscntrl,  Next: isdigit,  Prev: isatty,  Up: Alphabetical List
  15773.  
  15774. iscntrl
  15775. =======
  15776.  
  15777. Syntax
  15778. ------
  15779.  
  15780.      #include <ctype.h>
  15781.      
  15782.      int iscntrl(int c);
  15783.  
  15784. Description
  15785. -----------
  15786.  
  15787. Tells if C is a control character.
  15788.  
  15789. Return Value
  15790. ------------
  15791.  
  15792. Nonzero if C is a control character, else zero.
  15793.  
  15794. 
  15795. File: libc.inf,  Node: isdigit,  Next: isgraph,  Prev: iscntrl,  Up: Alphabetical List
  15796.  
  15797. isdigit
  15798. =======
  15799.  
  15800. Syntax
  15801. ------
  15802.  
  15803.      #include <ctype.h>
  15804.      
  15805.      int isdigit(int c);
  15806.  
  15807. Description
  15808. -----------
  15809.  
  15810. Tells if C is a digit.
  15811.  
  15812. Return Value
  15813. ------------
  15814.  
  15815. Nonzero if C is a digit, else zero.
  15816.  
  15817. 
  15818. File: libc.inf,  Node: isgraph,  Next: islower,  Prev: isdigit,  Up: Alphabetical List
  15819.  
  15820. isgraph
  15821. =======
  15822.  
  15823. Syntax
  15824. ------
  15825.  
  15826.      #include <ctype.h>
  15827.      
  15828.      int isgraph(int c);
  15829.  
  15830. Description
  15831. -----------
  15832.  
  15833. Tells if C is a visible printing character.  Space is not included.
  15834.  
  15835. Return Value
  15836. ------------
  15837.  
  15838. Nonzero if C is a visible printing character, else zero.
  15839.  
  15840. 
  15841. File: libc.inf,  Node: islower,  Next: isprint,  Prev: isgraph,  Up: Alphabetical List
  15842.  
  15843. islower
  15844. =======
  15845.  
  15846. Syntax
  15847. ------
  15848.  
  15849.      #include <ctype.h>
  15850.      
  15851.      int islower(int c);
  15852.  
  15853. Description
  15854. -----------
  15855.  
  15856. Tells if C is lower case or not.
  15857.  
  15858. Return Value
  15859. ------------
  15860.  
  15861. Nonzero if C is lower case, else zero.
  15862.  
  15863. 
  15864. File: libc.inf,  Node: isprint,  Next: ispunct,  Prev: islower,  Up: Alphabetical List
  15865.  
  15866. isprint
  15867. =======
  15868.  
  15869. Syntax
  15870. ------
  15871.  
  15872.      #include <ctype.h>
  15873.      
  15874.      int isprint(int c);
  15875.  
  15876. Description
  15877. -----------
  15878.  
  15879. Tells if C is a printing character, which includes the space character.
  15880.  
  15881. Return Value
  15882. ------------
  15883.  
  15884. Nonzero if C is a printing character, else zero.
  15885.  
  15886. 
  15887. File: libc.inf,  Node: ispunct,  Next: isspace,  Prev: isprint,  Up: Alphabetical List
  15888.  
  15889. ispunct
  15890. =======
  15891.  
  15892. Syntax
  15893. ------
  15894.  
  15895.      #include <ctype.h>
  15896.      
  15897.      int ispunct(int c);
  15898.  
  15899. Description
  15900. -----------
  15901.  
  15902. Tells if C is any printing character except space and those indicated
  15903. by `isalnum'.
  15904.  
  15905. Return Value
  15906. ------------
  15907.  
  15908. Nonzero if C is punctuation, else zero.
  15909.  
  15910. 
  15911. File: libc.inf,  Node: isspace,  Next: isupper,  Prev: ispunct,  Up: Alphabetical List
  15912.  
  15913. isspace
  15914. =======
  15915.  
  15916. Syntax
  15917. ------
  15918.  
  15919.      #include <ctype.h>
  15920.      
  15921.      int isspace(int c);
  15922.  
  15923. Description
  15924. -----------
  15925.  
  15926. Tells if C is whitespace, that is, carriage return, newline, form feed,
  15927. tab, vertical tab, or space.
  15928.  
  15929. Return Value
  15930. ------------
  15931.  
  15932. Nonzero if C is whitespace, else zero.
  15933.  
  15934. 
  15935. File: libc.inf,  Node: isupper,  Next: isxdigit,  Prev: isspace,  Up: Alphabetical List
  15936.  
  15937. isupper
  15938. =======
  15939.  
  15940. Syntax
  15941. ------
  15942.  
  15943.      #include <ctype.h>
  15944.      
  15945.      int isupper(int c);
  15946.  
  15947. Description
  15948. -----------
  15949.  
  15950. Tells if C is an upper case character or not.
  15951.  
  15952. Return Value
  15953. ------------
  15954.  
  15955. Nonzero if C is upper case, else zero.
  15956.  
  15957. 
  15958. File: libc.inf,  Node: isxdigit,  Next: itoa,  Prev: isupper,  Up: Alphabetical List
  15959.  
  15960. isxdigit
  15961. ========
  15962.  
  15963. Syntax
  15964. ------
  15965.  
  15966.      #include <ctype.h>
  15967.      
  15968.      int isxdigit(int c);
  15969.  
  15970. Description
  15971. -----------
  15972.  
  15973. Tells if C is a valid hexidecimal digit or not.  This includes
  15974. `[0-9a-fA-F]'.
  15975.  
  15976. Return Value
  15977. ------------
  15978.  
  15979. Nonzero if C is a hex digit, else zero.
  15980.  
  15981. 
  15982. File: libc.inf,  Node: itoa,  Next: kbhit,  Prev: isxdigit,  Up: Alphabetical List
  15983.  
  15984. itoa
  15985. ====
  15986.  
  15987. Syntax
  15988. ------
  15989.  
  15990.      #include <stdlib.h>
  15991.      
  15992.      char * itoa(int value, char *string, int radix)
  15993.  
  15994. Description
  15995. -----------
  15996.  
  15997. This function converts its argument VALUE into a null-terminated
  15998. character string using RADIX as the base of the number system.  The
  15999. resulting string with a length of upto 33 bytes (including the optional
  16000. sign and the terminating `NULL' is put into the buffer whose address is
  16001. given by STRING.  For radixes other than 10, VALUE is treated as an
  16002. unsigned int (i.e., the sign bit is not interpreted as such).  The
  16003. argument RADIX should specify the base, between 2 and 36, in which the
  16004. string reprsentation of VALUE is requested.
  16005.  
  16006. Return Value
  16007. ------------
  16008.  
  16009. A pointer to STRING.
  16010.  
  16011. Example
  16012. -------
  16013.  
  16014.      char binary_str[33];
  16015.      
  16016.      (void)itoa(num, binary_str, 2);
  16017.  
  16018. 
  16019. File: libc.inf,  Node: kbhit,  Next: kill,  Prev: itoa,  Up: Alphabetical List
  16020.  
  16021. kbhit
  16022. =====
  16023.  
  16024. Syntax
  16025. ------
  16026.  
  16027.      #include <pc.h>
  16028.      
  16029.      int kbhit(void);
  16030.  
  16031. Description
  16032. -----------
  16033.  
  16034. If the user has hit a key, this function will detect it.  This function
  16035. is very fast when there is no key waiting, so it may be used inside
  16036. loops as needed.
  16037.  
  16038. If you test shift/alt/ctrl status with bios calls (e.g., using `bioskey
  16039. (2)' or `bioskey (0x12)') then you should also use bios calls for
  16040. testing for keys.  This can be done with by `bioskey (1)' or `bioskey
  16041. (0x11)'.  Failing to do so can cause trouble in multitasking
  16042. environments like DESQview/X.
  16043.  
  16044. Return Value
  16045. ------------
  16046.  
  16047. Nonzero if a key has been hit, else zero.
  16048.  
  16049. Example
  16050. -------
  16051.  
  16052.      while (!kbhit())
  16053.        do_stuff();
  16054.  
  16055. 
  16056. File: libc.inf,  Node: kill,  Next: labs,  Prev: kbhit,  Up: Alphabetical List
  16057.  
  16058. kill
  16059. ====
  16060.  
  16061.      #include <signal.h>
  16062.      
  16063.      int    kill(pid_t _pid, int _sig);
  16064.  
  16065. Description
  16066. -----------
  16067.  
  16068. If _PID is the current `getpid()', the given _SIG is raised with *Note
  16069. raise::.
  16070.  
  16071. Return Value
  16072. ------------
  16073.  
  16074. -1 on error, else zero.
  16075.  
  16076. 
  16077. File: libc.inf,  Node: labs,  Next: ldexp,  Prev: kill,  Up: Alphabetical List
  16078.  
  16079. labs
  16080. ====
  16081.  
  16082. Syntax
  16083. ------
  16084.  
  16085.      #include <stdlib.h>
  16086.      
  16087.      long labs(long x);
  16088.  
  16089. Description
  16090. -----------
  16091.  
  16092. This function takes the absolute value of X.  *Note abs::.
  16093.  
  16094. Return Value
  16095. ------------
  16096.  
  16097. |X|
  16098.  
  16099. 
  16100. File: libc.inf,  Node: ldexp,  Next: ldiv,  Prev: labs,  Up: Alphabetical List
  16101.  
  16102. ldexp
  16103. =====
  16104.  
  16105. Syntax
  16106. ------
  16107.  
  16108.      #include <math.h>
  16109.      
  16110.      double ldexp(double val, int exp);
  16111.  
  16112. Return Value
  16113. ------------
  16114.  
  16115. This function returns VAL * 2 ** EXP.
  16116.  
  16117. Example
  16118. -------
  16119.  
  16120.      ldexp(3.5,4) == 3.5 * 16 == 56.0
  16121.  
  16122. 
  16123. File: libc.inf,  Node: ldiv,  Next: _lfn_gen_short_fname,  Prev: ldexp,  Up: Alphabetical List
  16124.  
  16125. ldiv
  16126. ====
  16127.  
  16128. Syntax
  16129. ------
  16130.  
  16131.      #include <stdlib.h>
  16132.      
  16133.      ldiv_t ldiv(long numerator, long denomonator);
  16134.  
  16135. Description
  16136. -----------
  16137.  
  16138. Returns the quotient and remainder of the division NUMBERATOR divided
  16139. by DENOMONATOR.  The return type is as follows:
  16140.  
  16141.      typedef struct {
  16142.        long quot;
  16143.        long rem;
  16144.      } ldiv_t;
  16145.  
  16146. Return Value
  16147. ------------
  16148.  
  16149. The results of the division are returned.
  16150.  
  16151. Example
  16152. -------
  16153.  
  16154.      ldiv_t l = ldiv(42, 3);
  16155.      printf("42 = %ld x 3 + %ld\n", l.quot, l.rem);
  16156.      
  16157.      ldiv(+40, +3) = { +13, +1 }
  16158.      ldiv(+40, -3) = { -13, -1 }
  16159.      ldiv(-40, +3) = { -13, -1 }
  16160.      ldiv(-40, -3) = { +13, -1 }
  16161.  
  16162. 
  16163. File: libc.inf,  Node: _lfn_gen_short_fname,  Next: _lfn_get_ftime,  Prev: ldiv,  Up: Alphabetical List
  16164.  
  16165. _lfn_gen_short_fname
  16166. ====================
  16167.  
  16168. Syntax
  16169. ------
  16170.  
  16171.      #include <fcntl.h>
  16172.      
  16173.      char _lfn_gen_short_fname (const char *long_fname, char *short_fname);
  16174.  
  16175. Description
  16176. -----------
  16177.  
  16178. This function generates a short (8+3) filename alias for the long
  16179. filename pointed to by LONG_FNAME and puts it into the buffer pointed
  16180. to by SHORT_FNAME.  It uses the same algorithm that Windows 9x uses,
  16181. with the exception that the returned short name will never have a
  16182. numeric tail, because this function doesn't check the directory to see
  16183. whether the generated short name will collide with any other file in
  16184. the directory.  Note that LONG_FNAME must contain only the name part of
  16185. a file; elements of a full pathname (like `:' or `/' are not allowed
  16186. (they will cause the function to fail).  SHORT_FNAME will be returned
  16187. upper-cased, since that is how 8+3 filenames are stored in directory
  16188. entries.
  16189.  
  16190. When the LFN API is not supported (*note _use_lfn::.), the function
  16191. simply converts up to 12 characters of LONG_FNAME to upper-case and
  16192. returns that.  It will do the same if LONG_FNAME includes any
  16193. characters illegal in a filename.
  16194.  
  16195. You might need to call this function if you want to know whether a given
  16196. filename is valid on MSDOS: if a case-sensitive string comparison
  16197. function such as `strcmp' (*note strcmp::.) returns a 0 when it
  16198. compares the original long filename with the short one returned by
  16199. `_lfn_gen_short_fname', then the filename is a valid DOS name.  (Note
  16200. that if LONG_FNAME is in lower case, it might not compare equal with
  16201. SHORT_FNAME because of the case difference.)
  16202.  
  16203. Return value
  16204. ------------
  16205.  
  16206. The function returns a pointer to SHORT_FNAME.
  16207.  
  16208. Example
  16209. -------
  16210.  
  16211.      #include <stdio.h>
  16212.      #include <string.h>
  16213.      #include <fcntl.h>
  16214.      
  16215.      int dos_check (char *fname)
  16216.      {
  16217.        char fshort[13];
  16218.        int retval;
  16219.      
  16220.        if (stricmp (_lfn_gen_short_fname (fname, fshort), fname) == 0)
  16221.        {
  16222.          printf ("%s is a valid MSDOS 8+3 filename\n", fname);
  16223.          retval = 1;
  16224.        }
  16225.        else
  16226.        {
  16227.          printf ("%s will have to be changed for MSDOS\n", fname);
  16228.          retval = 0;
  16229.        }
  16230.        return retval;
  16231.      }
  16232.  
  16233. 
  16234. File: libc.inf,  Node: _lfn_get_ftime,  Next: __libc_termios_init,  Prev: _lfn_gen_short_fname,  Up: Alphabetical List
  16235.  
  16236. _lfn_get_ftime
  16237. ==============
  16238.  
  16239. Syntax
  16240. ------
  16241.  
  16242.      #include <fcntl.h>
  16243.      
  16244.      char _lfn_get_ftime (int fhandle, int flag);
  16245.  
  16246. Description
  16247. -----------
  16248.  
  16249. This function returns creation and access time for files that reside on
  16250. a filesystem which supports long filenames (such as Windows 95).  Files
  16251. which reside on native FAT filesystems will cause this function to fail.
  16252. The FHANDLE parameter is the file handle as returned by one of the
  16253. functions which open or create files.  The FLAG parameter determines
  16254. which time (creation or access) is returned.  It can be set to one of
  16255. the following:
  16256.  
  16257. `_LFN_ATIME'
  16258.      Causes `_lfn_get_ftime' to return the time when the file was last
  16259.      accessed.  (Currently, it actually only returns the *date* of last
  16260.      access; the time bits are all zeroed.)
  16261.  
  16262. `_LFN_CTIME'
  16263.      Causes `_lfn_get_ftime' to return the time when the file was
  16264.      created.  Note that if the file was created by a program which
  16265.      doesn't support long filenames, this time will be zero.
  16266.  
  16267. Return value
  16268. ------------
  16269.  
  16270. The file time stamp, as a packed unsigned int value:
  16271.  
  16272. `Bits 0-4'
  16273.      seconds divided by 2
  16274.  
  16275. `Bits 5-10'
  16276.      minutes (0-59)
  16277.  
  16278. `Bits 11-15'
  16279.      hours (0-23)
  16280.  
  16281. `Bits 16-20'
  16282.      day of the month (1-31)
  16283.  
  16284. `Bits 21-24'
  16285.      month (1 = January)
  16286.  
  16287. `Bits 25-31'
  16288.      year offset from 1980 (add 1980 to get the actual year)
  16289.  
  16290. If the underlying system calls fail, the function will return 0 and set
  16291. `errno' to an appropriate value.
  16292.  
  16293. Example
  16294. -------
  16295.  
  16296.       unsigned file_stamp = _lfn_get_ftime (handle, _LFN_CTIME);
  16297.  
  16298. 
  16299. File: libc.inf,  Node: __libc_termios_init,  Next: link,  Prev: _lfn_get_ftime,  Up: Alphabetical List
  16300.  
  16301. __libc_termios_init
  16302. ===================
  16303.  
  16304. Syntax
  16305. ------
  16306.  
  16307.      #include <libc/ttyprvt.h>
  16308.      
  16309.      void __libc_termios_init (void);
  16310.  
  16311. Description
  16312. -----------
  16313.  
  16314. This function sets read/write hooks for the termios emulation and
  16315. import parameters. Currently importing parameters is not supported, the
  16316. emulation is resolved by only internal(static) parameters.  Note that
  16317. this function is called by tcXXX function automatically.
  16318.  
  16319. 
  16320. File: libc.inf,  Node: link,  Next: llabs,  Prev: __libc_termios_init,  Up: Alphabetical List
  16321.  
  16322. link
  16323. ====
  16324.  
  16325. Syntax
  16326. ------
  16327.  
  16328.      #include <unistd.h>
  16329.      
  16330.      int link(const char *exists, const char *new);
  16331.  
  16332. Description
  16333. -----------
  16334.  
  16335. Because of limitations of MS-DOS, this function doesn't really link two
  16336. files together.  However, it simulates a real `link' by copying the
  16337. file at EXISTS to NEW.
  16338.  
  16339. Return Value
  16340. ------------
  16341.  
  16342. Zero on success, nonzero on failure.
  16343.  
  16344. Example
  16345. -------
  16346.  
  16347.      link("foo.c", "foo.bak");
  16348.  
  16349. 
  16350. File: libc.inf,  Node: llabs,  Next: lldiv,  Prev: link,  Up: Alphabetical List
  16351.  
  16352. llabs
  16353. =====
  16354.  
  16355. Syntax
  16356. ------
  16357.  
  16358.      #include <stdlib.h>
  16359.      
  16360.      long long llabs(long long x);
  16361.  
  16362. Description
  16363. -----------
  16364.  
  16365. This function takes the absolute value of X.  *Note abs::.
  16366.  
  16367. Return Value
  16368. ------------
  16369.  
  16370. |X|
  16371.  
  16372. 
  16373. File: libc.inf,  Node: lldiv,  Next: localeconv,  Prev: llabs,  Up: Alphabetical List
  16374.  
  16375. lldiv
  16376. =====
  16377.  
  16378. Syntax
  16379. ------
  16380.  
  16381.      #include <stdlib.h>
  16382.      
  16383.      lldiv_t lldiv(long long numerator, long long denomonator);
  16384.  
  16385. Description
  16386. -----------
  16387.  
  16388. Returns the quotient and remainder of the division NUMBERATOR divided
  16389. by DENOMONATOR.  The return type is as follows:
  16390.  
  16391.      typedef struct {
  16392.        long long quot;
  16393.        long long rem;
  16394.      } lldiv_t;
  16395.  
  16396. Return Value
  16397. ------------
  16398.  
  16399. The results of the division are returned.
  16400.  
  16401. Example
  16402. -------
  16403.  
  16404.      lldiv_t l = lldiv(42, 3);
  16405.      printf("42 = %lld x 3 + %lld\n", l.quot, l.rem);
  16406.      
  16407.      lldiv(+40, +3) = { +13, +1 }
  16408.      lldiv(+40, -3) = { -13, -1 }
  16409.      lldiv(-40, +3) = { -13, -1 }
  16410.      lldiv(-40, -3) = { +13, -1 }
  16411.  
  16412. 
  16413. File: libc.inf,  Node: localeconv,  Next: localtime,  Prev: lldiv,  Up: Alphabetical List
  16414.  
  16415. localeconv
  16416. ==========
  16417.  
  16418. Syntax
  16419. ------
  16420.  
  16421.      #include <locale.h>
  16422.      
  16423.      struct lconv *localeconv(void);
  16424.  
  16425. Description
  16426. -----------
  16427.  
  16428. This function returns a pointer to a static structure that contains
  16429. information about the current locale.  The structure contains these
  16430. fields:
  16431.  
  16432. `char *currency_symbol'
  16433.      A string that should be used when printing local currency.
  16434.  
  16435. `char *decimal_point'
  16436.      A string that is used to separate the integer and fractional
  16437.      portions of real numbers in `printf'.  Currently, only the first
  16438.      character is significant.
  16439.  
  16440. `char *grouping'
  16441.      An array of numbers indicating the size of groupings for
  16442.      non-monetary values to the left of the decimal point.  The first
  16443.      number is the size of the grouping just before the decimal point.
  16444.      A number of zero means to repeat the previous number indefinitely.
  16445.      A number of `CHAR_MAX' means to group the remainder of the digits
  16446.      together.
  16447.  
  16448. `char *int_curr_symbol'
  16449.      A string that should be used when formatting monetary values for
  16450.      local currency when the result will be used internationally.
  16451.  
  16452. `char *mon_decimal_point'
  16453.      A string that separates the interger and fractional parts of
  16454.      monetary values.
  16455.  
  16456. `char *mon_grouping'
  16457.      Same as grouping, but for monetary values.
  16458.  
  16459. `char *negative_sign'
  16460.      A string that is used to represent negative monetary values.
  16461.  
  16462. `char *positive_sign'
  16463.      A string that is used to represent positive monetary values.
  16464.  
  16465. `char *thousands_sep'
  16466.      The grouping separator for non-monetary values.
  16467.  
  16468. `char frac_digits'
  16469.      The number of digits to the right of the decimal point for monetary
  16470.      values.
  16471.  
  16472. `char int_frac_digits'
  16473.      Like frac_digits, but when formatting for international use.
  16474.  
  16475. `char n_cs_precedes'
  16476.      If nonzero, the currency string should precede the monetary value
  16477.      if the monetary value is negative.
  16478.  
  16479. `char n_sep_by_space'
  16480.      If nonzero, the currency string and the monetary value should be
  16481.      separated by a space if the monetary value is negative.
  16482.  
  16483. `char n_sign_posn'
  16484.      Determines the placement of the negative indication string if the
  16485.      monetary value is negative.
  16486.  
  16487.     0
  16488.           ($value), (value$)
  16489.  
  16490.     1
  16491.           -$value, -value$
  16492.  
  16493.     2
  16494.           $value-, value$-
  16495.  
  16496.     3
  16497.           -$value, value-$
  16498.  
  16499.     4
  16500.           $-value, value$-
  16501.  
  16502. `char p_cs_precedes'
  16503. `char p_sep_by_space'
  16504. `char p_sign_posn'
  16505.      These are the same as n_*, but for when the monetary value is
  16506.      positive.
  16507.  
  16508. Note that any numeric field may have a value of `CHAR_MAX', which
  16509. indicates that no information is available.
  16510.  
  16511. Return Value
  16512. ------------
  16513.  
  16514. A pointer to the `struct lconv' structure.
  16515.  
  16516. Example
  16517. -------
  16518.  
  16519.      struct lconv *l = localeconv;
  16520.      printf("%s%d\n", l->negative_sign, value);
  16521.  
  16522. 
  16523. File: libc.inf,  Node: localtime,  Next: lock,  Prev: localeconv,  Up: Alphabetical List
  16524.  
  16525. localtime
  16526. =========
  16527.  
  16528. Syntax
  16529. ------
  16530.  
  16531.      #include <time.h>
  16532.      
  16533.      struct tm *localtime(const time_t *tod);
  16534.  
  16535. Description
  16536. -----------
  16537.  
  16538. Converts the time represented by TOD into a structure, correcting for
  16539. the local timezone.  *Note gmtime::.
  16540.  
  16541. Return Value
  16542. ------------
  16543.  
  16544. A pointer to a static structure which is overridden with each call.
  16545.  
  16546. 
  16547. File: libc.inf,  Node: lock,  Next: log,  Prev: localtime,  Up: Alphabetical List
  16548.  
  16549. lock
  16550. ====
  16551.  
  16552. Syntax
  16553. ------
  16554.  
  16555.      #include <io.h>
  16556.      
  16557.      int lock(int fd, long offset, long length);
  16558.  
  16559. Description
  16560. -----------
  16561.  
  16562. Locks a region in file FD using MS-DOS file sharing interface.  The
  16563. region of LENGTH bytes, starting from OFFSET, will become entirely
  16564. inaccessible to other processes. If multiple locks are used on a single
  16565. file they must be non-overlapping. The lock must be removed before the
  16566. file is closed.
  16567.  
  16568. This function will fail unless SHARE, or a network software providing
  16569. similar interface, is installed. This function is compatible with
  16570. Borland C++ function of the same name.
  16571.  
  16572. *Note unlock::.
  16573.  
  16574. Return Value
  16575. ------------
  16576.  
  16577. Zero if successful, nonzero if not.
  16578.  
  16579. 
  16580. File: libc.inf,  Node: log,  Next: log10,  Prev: lock,  Up: Alphabetical List
  16581.  
  16582. log
  16583. ===
  16584.  
  16585. Syntax
  16586. ------
  16587.  
  16588.      #include <math.h>
  16589.      
  16590.      double log(double x);
  16591.  
  16592. Return Value
  16593. ------------
  16594.  
  16595. The natural logarithm of X.
  16596.  
  16597. 
  16598. File: libc.inf,  Node: log10,  Next: log2,  Prev: log,  Up: Alphabetical List
  16599.  
  16600. log10
  16601. =====
  16602.  
  16603. Syntax
  16604. ------
  16605.  
  16606.      #include <math.h>
  16607.      
  16608.      double log10(double x);
  16609.  
  16610. Return Value
  16611. ------------
  16612.  
  16613. The logarithm base 10 of X.
  16614.  
  16615. 
  16616. File: libc.inf,  Node: log2,  Next: longjmp,  Prev: log10,  Up: Alphabetical List
  16617.  
  16618. log2
  16619. ====
  16620.  
  16621. Syntax
  16622. ------
  16623.  
  16624.      #include <math.h>
  16625.      
  16626.      double log2(double x);
  16627.  
  16628. Return Value
  16629. ------------
  16630.  
  16631. The logarithm base 2 of X.
  16632.  
  16633. 
  16634. File: libc.inf,  Node: longjmp,  Next: lowvideo,  Prev: log2,  Up: Alphabetical List
  16635.  
  16636. longjmp
  16637. =======
  16638.  
  16639. Syntax
  16640. ------
  16641.  
  16642.      #include <setjmp.h>
  16643.      
  16644.      void longjmp(jmp_buf env, int val);
  16645.  
  16646. Description
  16647. -----------
  16648.  
  16649. This function reverts back to a CPU state that was stored in ENV by
  16650. `setjmp' (*note setjmp::.).  The state includes all CPU registers, so
  16651. any variable in a register when `setjmp' was called will be preserved,
  16652. and all else will be indeterminate.
  16653.  
  16654. The value passed as VAL will be the return value of `setjmp' when it
  16655. resumes processing there.  If VAL is zero, the return value will be one.
  16656.  
  16657. Return Value
  16658. ------------
  16659.  
  16660. This function does not return.
  16661.  
  16662. Example
  16663. -------
  16664.  
  16665.      jmp_buf j;
  16666.      if (setjmp(j))
  16667.        return;
  16668.      do_something();
  16669.      longjmp(j);
  16670.  
  16671. 
  16672. File: libc.inf,  Node: lowvideo,  Next: lseek,  Prev: longjmp,  Up: Alphabetical List
  16673.  
  16674. lowvideo
  16675. ========
  16676.  
  16677. Syntax
  16678. ------
  16679.  
  16680.      #include <conio.h>
  16681.      
  16682.      void    lowvideo(void);
  16683.  
  16684. Description
  16685. -----------
  16686.  
  16687. Causes any new characters put on the screen to be dim.
  16688.  
  16689. 
  16690. File: libc.inf,  Node: lseek,  Next: malloc,  Prev: lowvideo,  Up: Alphabetical List
  16691.  
  16692. lseek
  16693. =====
  16694.  
  16695. Syntax
  16696. ------
  16697.  
  16698.      #include <unistd.h>
  16699.      
  16700.      off_t lseek(int fd, off_t offset, int whence);
  16701.  
  16702. Description
  16703. -----------
  16704.  
  16705. This function moves the file pointer for FD according to MODE:
  16706.  
  16707. `SEEK_SET'
  16708.      The file pointer is moved to the offset specified.
  16709.  
  16710. `SEEK_CUR'
  16711.      The file pointer is moved relative to its current position.
  16712.  
  16713. `SEEK_END'
  16714.      The file pointer is moved to a position OFFSET bytes from the end
  16715.      of the file.  The offset is usually nonpositive in this case.
  16716.  
  16717. Return Value
  16718. ------------
  16719.  
  16720. The new offset is returned.
  16721.  
  16722. Example
  16723. -------
  16724.  
  16725.      lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */
  16726.  
  16727. 
  16728. File: libc.inf,  Node: malloc,  Next: mblen,  Prev: lseek,  Up: Alphabetical List
  16729.  
  16730. malloc
  16731. ======
  16732.  
  16733. Syntax
  16734. ------
  16735.  
  16736.      #include <stdlib.h>
  16737.      
  16738.      void *malloc(size_t size);
  16739.  
  16740. Description
  16741. -----------
  16742.  
  16743. This function allocates a chunk of memory from the heap large enough to
  16744. hold any object that is SIZE bytes in length.  This memory must be
  16745. returned to the heap with `free' (*note free::.).
  16746.  
  16747. Return Value
  16748. ------------
  16749.  
  16750. A pointer to the allocated memory, or `NULL' if there isn't enough free
  16751. memory to satisfy the request.
  16752.  
  16753. Example
  16754. -------
  16755.  
  16756.      char *c = (char *)malloc(100);
  16757.  
  16758. 
  16759. File: libc.inf,  Node: mblen,  Next: mbstowcs,  Prev: malloc,  Up: Alphabetical List
  16760.  
  16761. mblen
  16762. =====
  16763.  
  16764. Syntax
  16765. ------
  16766.  
  16767.      #include <stdlib.h>
  16768.      
  16769.      int mblen(const char *s, size_t n);
  16770.  
  16771. Description
  16772. -----------
  16773.  
  16774. This function returns the number of characters of string S that make up
  16775. the next multibyte character.  No more than N characters are checked.
  16776.  
  16777. If S is `NULL', the internal shift state is reset.
  16778.  
  16779. Return Value
  16780. ------------
  16781.  
  16782. The number of characters that comprise the next multibyte character.
  16783.  
  16784. Example
  16785. -------
  16786.  
  16787.      int n = mblen(string, INT_MAX);
  16788.      string += n;
  16789.  
  16790. 
  16791. File: libc.inf,  Node: mbstowcs,  Next: mbtowc,  Prev: mblen,  Up: Alphabetical List
  16792.  
  16793. mbstowcs
  16794. ========
  16795.  
  16796. Syntax
  16797. ------
  16798.  
  16799.      #include <stdlib.h>
  16800.      
  16801.      size_t mbstowcs(wchar_t *wcs, const char *s, size_t n);
  16802.  
  16803. Description
  16804. -----------
  16805.  
  16806. Converts a multibyte string to a wide character string.  The result
  16807. will be no more than N wide characters.
  16808.  
  16809. Return Value
  16810. ------------
  16811.  
  16812. The number of wide characters stored.
  16813.  
  16814. Example
  16815. -------
  16816.  
  16817.      int wlen = mbtowcs(wbuf, string, sizeof(wbuf)/sizeof(wchar_t));
  16818.  
  16819. 
  16820. File: libc.inf,  Node: mbtowc,  Next: memccpy,  Prev: mbstowcs,  Up: Alphabetical List
  16821.  
  16822. mbtowc
  16823. ======
  16824.  
  16825. Syntax
  16826. ------
  16827.  
  16828.      #include <stdlib.h>
  16829.      
  16830.      int mbtowc(wchar_t *pwc, const char *s, size_t n);
  16831.  
  16832. Description
  16833. -----------
  16834.  
  16835. Convert the first multibyte sequence in S to a wide character.  At most
  16836. N characters are checked.  If PWC is not `NULL', the result is stored
  16837. there.  If S is null, the internal shift state is reset.
  16838.  
  16839. Return Value
  16840. ------------
  16841.  
  16842. The number of characters used by the multibyte sequence.
  16843.  
  16844. Example
  16845. -------
  16846.  
  16847.      string += mbtowc(&wc, string, strlen(string));
  16848.  
  16849. 
  16850. File: libc.inf,  Node: memccpy,  Next: memchr,  Prev: mbtowc,  Up: Alphabetical List
  16851.  
  16852. memccpy
  16853. =======
  16854.  
  16855. Syntax
  16856. ------
  16857.  
  16858.      #include <string.h>
  16859.      
  16860.      void * memccpy(void *to, const void *from, int ch, size_t nbytes)
  16861.  
  16862. Description
  16863. -----------
  16864.  
  16865. This function copies characters from memory area FROM into TO, stopping
  16866. after the first occurrence of character CH has been copied, or after
  16867. NBYTES characters have been copied, whichever comes first.  The buffers
  16868. should not overlap.
  16869.  
  16870. Return Value
  16871. ------------
  16872.  
  16873. A pointer to the character after the copy of CH in TO, or a `NULL'
  16874. pointer if CH was not found in the first NBYTES characters of FROM.
  16875.  
  16876. Example
  16877. -------
  16878.  
  16879.      char inpbuf[256], dest[81];
  16880.      
  16881.      printf("Enter a path: ");
  16882.      fflush(stdout);
  16883.      gets(inpbuf);
  16884.      memset(dest, 0, sizeof(dest));
  16885.      if (memccpy(dest, inpbuf, '\\', 80))
  16886.        printf("The first directory in path is %s\n", dest);
  16887.      else
  16888.        printf("No explicit directory in path\n");
  16889.  
  16890. 
  16891. File: libc.inf,  Node: memchr,  Next: memcmp,  Prev: memccpy,  Up: Alphabetical List
  16892.  
  16893. memchr
  16894. ======
  16895.  
  16896. Syntax
  16897. ------
  16898.  
  16899.      #include <string.h>
  16900.      
  16901.      void *memchr(const void *string, int ch, size_t num);
  16902.  
  16903. Description
  16904. -----------
  16905.  
  16906. This function searches NUM bytes starting at STRING, looking for the
  16907. first occurence of CH.
  16908.  
  16909. Return Value
  16910. ------------
  16911.  
  16912. A pointer to the first match, or `NULL' if it wasn't found.
  16913.  
  16914. Example
  16915. -------
  16916.  
  16917.      if (memchr(path, '/', strlen(path))
  16918.        do_slash();
  16919.  
  16920. 
  16921. File: libc.inf,  Node: memcmp,  Next: memcpy,  Prev: memchr,  Up: Alphabetical List
  16922.  
  16923. memcmp
  16924. ======
  16925.  
  16926. Syntax
  16927. ------
  16928.  
  16929.      #include <string.h>
  16930.      
  16931.      int memcmp(const void *s1, const void *s2, size_t num);
  16932.  
  16933. Description
  16934. -----------
  16935.  
  16936. This function compares two regions of memory, at S1 and S2, for NUM
  16937. bytes.
  16938.  
  16939. Return Value
  16940. ------------
  16941.  
  16942. zero
  16943.      s1 == s2
  16944.  
  16945. positive
  16946.      s1 > s2
  16947.  
  16948. negative
  16949.      s1 < s2
  16950.  
  16951. 
  16952. File: libc.inf,  Node: memcpy,  Next: memmove,  Prev: memcmp,  Up: Alphabetical List
  16953.  
  16954. memcpy
  16955. ======
  16956.  
  16957. Syntax
  16958. ------
  16959.  
  16960.      #include <string.h>
  16961.      
  16962.      void *memcpy(void *dest, const void *src, int num);
  16963.  
  16964. Description
  16965. -----------
  16966.  
  16967. This function copies NUM bytes from SOURCE to DEST.
  16968.  
  16969. Return Value
  16970. ------------
  16971.  
  16972. DEST
  16973.  
  16974. Example
  16975. -------
  16976.  
  16977.      memcpy(buffer, temp_buffer, BUF_MAX);
  16978.  
  16979. 
  16980. File: libc.inf,  Node: memmove,  Next: memset,  Prev: memcpy,  Up: Alphabetical List
  16981.  
  16982. memmove
  16983. =======
  16984.  
  16985. Syntax
  16986. ------
  16987.  
  16988.      #include <string.h>
  16989.      
  16990.      void *memmove(void *dest, const void *source, int num);
  16991.  
  16992. Description
  16993. -----------
  16994.  
  16995. This function copies NUM bytes from SOURCE to DEST.  The copy is done
  16996. in such a way that if the two regions overlap, the source is always
  16997. read before that byte is changed by writing to the destination.
  16998.  
  16999. Return Value
  17000. ------------
  17001.  
  17002. DEST
  17003.  
  17004. Example
  17005. -------
  17006.  
  17007.      memmove(buf+1, buf, 99);
  17008.      memmove(buf, buf+1, 99);
  17009.  
  17010. 
  17011. File: libc.inf,  Node: memset,  Next: mkdir,  Prev: memmove,  Up: Alphabetical List
  17012.  
  17013. memset
  17014. ======
  17015.  
  17016. Syntax
  17017. ------
  17018.  
  17019.      #include <string.h>
  17020.      
  17021.      void *memset(void *buffer, int ch, size_t num);
  17022.  
  17023. Description
  17024. -----------
  17025.  
  17026. This function stores NUM copies of CH, starting at BUFFER.  This is
  17027. often used to initialize objects to a known value.
  17028.  
  17029. Return Value
  17030. ------------
  17031.  
  17032. BUFFER
  17033.  
  17034. Example
  17035. -------
  17036.  
  17037.      struct tm t;
  17038.      memset(&t, 0, sizeof(t));
  17039.  
  17040. 
  17041. File: libc.inf,  Node: mkdir,  Next: mkfifo,  Prev: memset,  Up: Alphabetical List
  17042.  
  17043. mkdir
  17044. =====
  17045.  
  17046. Syntax
  17047. ------
  17048.  
  17049.      #include <sys/stat.h>
  17050.      
  17051.      int mkdir(const char *path, mode_t mode);
  17052.  
  17053. Description
  17054. -----------
  17055.  
  17056. This function creates a subdirectory.  The MODE field is ignored under
  17057. MS-DOS.
  17058.  
  17059. Return Value
  17060. ------------
  17061.  
  17062. Zero if the subdirectory was created, nonzero on failure.
  17063.  
  17064. Example
  17065. -------
  17066.  
  17067.      mkdir("/usr/tmp", S_IWUSR);
  17068.  
  17069. 
  17070. File: libc.inf,  Node: mkfifo,  Next: mknod,  Prev: mkdir,  Up: Alphabetical List
  17071.  
  17072. mkfifo
  17073. ======
  17074.  
  17075. Description
  17076. -----------
  17077.  
  17078. This function is provided only to assist in porting from Unix.  It
  17079. always returns an error condition.
  17080.  
  17081. 
  17082. File: libc.inf,  Node: mknod,  Next: mkstemp,  Prev: mkfifo,  Up: Alphabetical List
  17083.  
  17084. mknod
  17085. =====
  17086.  
  17087. Description
  17088. -----------
  17089.  
  17090. This function is provided only to assist in porting from Unix.  It
  17091. always returns an error condition.
  17092.  
  17093. 
  17094. File: libc.inf,  Node: mkstemp,  Next: mktemp,  Prev: mknod,  Up: Alphabetical List
  17095.  
  17096. mkstemp
  17097. =======
  17098.  
  17099. Syntax
  17100. ------
  17101.  
  17102.      #include <stdio.h>
  17103.      
  17104.      int mkstemp(char *template);
  17105.  
  17106. Description
  17107. -----------
  17108.  
  17109. TEMPLATE is a file specification that ends with six trailing `X'
  17110. characters.  This function replaces the `XXXXXX' with a set of
  17111. characters such that the resulting file name names a nonexisting file.
  17112. It then creates and opens the file.
  17113.  
  17114. Note that since MS-DOS is limited to eight characters for the file name,
  17115. and since none of the `X''s get replaced by a dot, you can only have
  17116. two additional characters before the `X''s.
  17117.  
  17118. Return Value
  17119. ------------
  17120.  
  17121. The open file descriptor.
  17122.  
  17123. Example
  17124. -------
  17125.  
  17126.      int fd = mkstemp("/tmp/ccXXXXXX");
  17127.  
  17128. 
  17129. File: libc.inf,  Node: mktemp,  Next: mktime,  Prev: mkstemp,  Up: Alphabetical List
  17130.  
  17131. mktemp
  17132. ======
  17133.  
  17134. Syntax
  17135. ------
  17136.  
  17137.      #include <stdio.h>
  17138.      
  17139.      char *mktemp(char *template);
  17140.  
  17141. Description
  17142. -----------
  17143.  
  17144. TEMPLATE is a file specification that ends with six trailing `X'
  17145. characters.  This function replaces the `XXXXXX' with a set of
  17146. characters such that the resulting file name names a nonexisting file.
  17147.  
  17148. Note that since MS-DOS is limited to eight characters for the file name,
  17149. and since none of the `X''s get replaced by a dot, you can only have
  17150. two additional characters before the `X''s.
  17151.  
  17152. Return Value
  17153. ------------
  17154.  
  17155. The resulting filename.
  17156.  
  17157. Example
  17158. -------
  17159.  
  17160.      char template[] = "/tmp/ccXXXXXX";
  17161.      mktemp(template);
  17162.      FILE *q = fopen(template, "w");
  17163.  
  17164. 
  17165. File: libc.inf,  Node: mktime,  Next: modf,  Prev: mktemp,  Up: Alphabetical List
  17166.  
  17167. mktime
  17168. ======
  17169.  
  17170. Syntax
  17171. ------
  17172.  
  17173.      #include <time.h>
  17174.      
  17175.      time_t mktime(struct tm *tptr);
  17176.  
  17177. Description
  17178. -----------
  17179.  
  17180. This function converts a time structure into the number of seconds since
  17181. 00:00:00 GMT 1/1/1970.  It also attempts to normalize the fields of
  17182. TPTR.
  17183.  
  17184. Return Value
  17185. ------------
  17186.  
  17187. The resulting time, or -1 if the time in TPTR cannot be described in
  17188. that format.
  17189.  
  17190. 
  17191. File: libc.inf,  Node: modf,  Next: modfl,  Prev: mktime,  Up: Alphabetical List
  17192.  
  17193. modf
  17194. ====
  17195.  
  17196. Syntax
  17197. ------
  17198.  
  17199.      #include <math.h>
  17200.      
  17201.      double modf(double x, double *pint);
  17202.  
  17203. Description
  17204. -----------
  17205.  
  17206. `modf' breaks down X into its integer portion (which it stores in
  17207. *PINT) and the remaining fractional portion, which it returns.
  17208.  
  17209. Return Value
  17210. ------------
  17211.  
  17212. The fractional portion.
  17213.  
  17214. 
  17215. File: libc.inf,  Node: modfl,  Next: _mono_clear,  Prev: modf,  Up: Alphabetical List
  17216.  
  17217. modfl
  17218. =====
  17219.  
  17220. Syntax
  17221. ------
  17222.  
  17223.      #include <math.h>
  17224.      
  17225.      long double modf(long double x, long double *pint);
  17226.  
  17227. Description
  17228. -----------
  17229.  
  17230. `modfl' breaks down X into its integer portion (which it stores in
  17231. *PINT) and the remaining fractional portion, which it returns.
  17232.  
  17233. Return Value
  17234. ------------
  17235.  
  17236. The fractional portion.
  17237.  
  17238. 
  17239. File: libc.inf,  Node: _mono_clear,  Next: _mono_printf,  Prev: modfl,  Up: Alphabetical List
  17240.  
  17241. _mono_clear
  17242. ===========
  17243.  
  17244. Syntax
  17245. ------
  17246.  
  17247.      #include <sys/mono.h>
  17248.      
  17249.      void _mono_clear(void);
  17250.  
  17251. Description
  17252. -----------
  17253.  
  17254. Clears the monochrome monitor.
  17255.  
  17256. 
  17257. File: libc.inf,  Node: _mono_printf,  Next: _mono_putc,  Prev: _mono_clear,  Up: Alphabetical List
  17258.  
  17259. _mono_printf
  17260. ============
  17261.  
  17262. Syntax
  17263. ------
  17264.  
  17265.      #include <sys/mono.h>
  17266.      
  17267.      void _mono_printf(const char *fmt, ...);
  17268.  
  17269. Description
  17270. -----------
  17271.  
  17272. Like *Note printf::, but prints to the monochrome monitor.
  17273.  
  17274. 
  17275. File: libc.inf,  Node: _mono_putc,  Next: movedata,  Prev: _mono_printf,  Up: Alphabetical List
  17276.  
  17277. _mono_putc
  17278. ==========
  17279.  
  17280. Syntax
  17281. ------
  17282.  
  17283.      #include <mono.h>
  17284.      
  17285.      void _mono_putc(int c);
  17286.  
  17287. Description
  17288. -----------
  17289.  
  17290. Prints a single character to the monochrome monitor.
  17291.  
  17292. 
  17293. File: libc.inf,  Node: movedata,  Next: movedatab,  Prev: _mono_putc,  Up: Alphabetical List
  17294.  
  17295. movedata
  17296. ========
  17297.  
  17298. Syntax
  17299. ------
  17300.  
  17301.      #include <sys/movedata.h>
  17302.      
  17303.      void movedata(unsigned source_selector, unsigned source_offset,
  17304.                    unsigned dest_selector, unsigned dest_offset,
  17305.                    size_t length);
  17306.  
  17307. Description
  17308. -----------
  17309.  
  17310. This function allows the caller to directly transfer information
  17311. between conventional and linear memory, and among each as well.  The
  17312. selectors passed are *not* segment values like in DOS.  They are
  17313. protected mode selectors that can be obtained by the `_my_ds' and
  17314. `_go32_info_block.selector_for_linear_memory' (or just `_dos_ds')
  17315. functions (*Note _my_ds::, *Note _go32_info_block::).  The offsets are
  17316. linear offsets.  If the selector is for the program's data area, this
  17317. offset corresponds to the address of a buffer (like `(int)&something').
  17318. If the selector is for the conventional memory area, the offset is the
  17319. physical address of the memory, which can be computed from a
  17320. traditional segment/offset pair as `segment'*16+`offset'.  For example,
  17321. the color text screen buffer is at offset 0xb8000.
  17322.  
  17323. Return Value
  17324. ------------
  17325.  
  17326. None.
  17327.  
  17328. Example
  17329. -------
  17330.  
  17331.      short blank_row_buf[ScreenCols()];
  17332.      /* scroll screen */
  17333.      movedata(_dos_ds, 0xb8000 + ScreenCols()*2,
  17334.               _dos_ds, 0xb8000,
  17335.               ScreenCols() * (ScreenRows()-1) * 2);
  17336.      /* fill last row */
  17337.      movedata(_my_ds(), (int)blank_row_buf,
  17338.               _dos_ds, 0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  17339.                ScreenCols() * 2);
  17340.  
  17341. 
  17342. File: libc.inf,  Node: movedatab,  Next: movedatal,  Prev: movedata,  Up: Alphabetical List
  17343.  
  17344. movedatab
  17345. =========
  17346.  
  17347. Syntax
  17348. ------
  17349.  
  17350.      #include <sys/movedata.h>
  17351.      
  17352.      void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t);
  17353.  
  17354. Description
  17355. -----------
  17356.  
  17357. Just like *Note movedata::, but all transfers are always 8-bit
  17358. transfers.
  17359.  
  17360. 
  17361. File: libc.inf,  Node: movedatal,  Next: movedataw,  Prev: movedatab,  Up: Alphabetical List
  17362.  
  17363. movedatal
  17364. =========
  17365.  
  17366. Syntax
  17367. ------
  17368.  
  17369.      #include <sys/movedata.h>
  17370.      
  17371.      void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t);
  17372.  
  17373. Description
  17374. -----------
  17375.  
  17376. Just like *Note movedata::, but all transfers are always 32-bit
  17377. transfers, and the count is a count of transfers, not bytes.
  17378.  
  17379. 
  17380. File: libc.inf,  Node: movedataw,  Next: movetext,  Prev: movedatal,  Up: Alphabetical List
  17381.  
  17382. movedataw
  17383. =========
  17384.  
  17385. Syntax
  17386. ------
  17387.  
  17388.      #include <sys/movedata.h>
  17389.      
  17390.      void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t);
  17391.  
  17392. Description
  17393. -----------
  17394.  
  17395. Just like *Note movedata::, but all transfers are always 16-bit
  17396. transfers, and the count is a count of transfers, not bytes.
  17397.  
  17398. 
  17399. File: libc.inf,  Node: movetext,  Next: mprotect,  Prev: movedataw,  Up: Alphabetical List
  17400.  
  17401. movetext
  17402. ========
  17403.  
  17404. Syntax
  17405. ------
  17406.  
  17407.      #include <conio.h>
  17408.      
  17409.      int movetext(int _left, int _top, int _right, int _bottom,
  17410.                   int _destleft, int _desttop);
  17411.  
  17412. Description
  17413. -----------
  17414.  
  17415. Moves a block of text on the screen.
  17416.  
  17417. Return Value
  17418. ------------
  17419.  
  17420. 1 on success, zero on error.
  17421.  
  17422. 
  17423. File: libc.inf,  Node: mprotect,  Next: _my_cs,  Prev: movetext,  Up: Alphabetical List
  17424.  
  17425. mprotect
  17426. ========
  17427.  
  17428. Syntax
  17429. ------
  17430.  
  17431.      #include <sys/types.h>
  17432.      #include <sys/mman.h>
  17433.      
  17434.      int mprotect(void *addr, size_t len, int prot);
  17435.  
  17436. Description
  17437. -----------
  17438.  
  17439. This function modifies the access protection of a memory region.
  17440. Protection occurs in 4Kbyte regions (pages) aligned on 4Kbyte
  17441. boundaries.  All pages in the region will be changed, so ADDR and LEN
  17442. should be multiples of 4096.
  17443.  
  17444. The protection PROT for each page is specified with the values:
  17445. PROT_NONE  Region can not be touched (if or'ed is ignored).
  17446. PROT_READ  Region can be read (can be or'ed with PROT_WRITE).
  17447. PROT_WRITE Region can be written (implies read access).
  17448.  
  17449. This function is only supported on DPMI hosts which provide some V1.0
  17450. extensions on V0.9 memory blocks.
  17451.  
  17452. Return Value
  17453. ------------
  17454.  
  17455. The function returns 0 if successful and the value -1 if all the pages
  17456. could not be set.
  17457.  
  17458. Example
  17459. -------
  17460.  
  17461.      mprotect(readonly_buffer,8192,PROT_READ);
  17462.      mprotect(guard_area,4096,PROT_NONE);
  17463.      mprotect(NULL,4096,PROT_WRITE);    /* Let NULL pointers not generate exceptions */
  17464.  
  17465. 
  17466. File: libc.inf,  Node: _my_cs,  Next: _my_ds,  Prev: mprotect,  Up: Alphabetical List
  17467.  
  17468. _my_cs
  17469. ======
  17470.  
  17471. Syntax
  17472. ------
  17473.  
  17474.      #include <sys/segments.h>
  17475.      
  17476.      unsigned short _my_cs();
  17477.  
  17478. Description
  17479. -----------
  17480.  
  17481. Returns the current `CS'.  This is useful for setting up interrupt
  17482. vectors and such.
  17483.  
  17484. Return Value
  17485. ------------
  17486.  
  17487. `CS'
  17488.  
  17489. 
  17490. File: libc.inf,  Node: _my_ds,  Next: _my_ss,  Prev: _my_cs,  Up: Alphabetical List
  17491.  
  17492. _my_ds
  17493. ======
  17494.  
  17495. Syntax
  17496. ------
  17497.  
  17498.      #include <sys/segments.h>
  17499.      
  17500.      unsigned short _my_ds();
  17501.  
  17502. Description
  17503. -----------
  17504.  
  17505. Returns the current `DS'.  This is useful for setting up interrupt
  17506. vectors and such.
  17507.  
  17508. Return Value
  17509. ------------
  17510.  
  17511. `DS'
  17512.  
  17513. 
  17514. File: libc.inf,  Node: _my_ss,  Next: nice,  Prev: _my_ds,  Up: Alphabetical List
  17515.  
  17516. _my_ss
  17517. ======
  17518.  
  17519. Syntax
  17520. ------
  17521.  
  17522.      #include <sys/segments.h>
  17523.      
  17524.      unsigned short _my_ss();
  17525.  
  17526. Description
  17527. -----------
  17528.  
  17529. Returns the current `SS'.  This is useful for setting up interrupt
  17530. vectors and such.
  17531.  
  17532. Return Value
  17533. ------------
  17534.  
  17535. `SS'
  17536.  
  17537. 
  17538. File: libc.inf,  Node: nice,  Next: normvideo,  Prev: _my_ss,  Up: Alphabetical List
  17539.  
  17540. nice
  17541. ====
  17542.  
  17543. Syntax
  17544. ------
  17545.  
  17546.      #include <unistd.h>
  17547.      
  17548.      int nice(int _increment);
  17549.  
  17550. Description
  17551. -----------
  17552.  
  17553. Adjusts the priority of the process.  Provided for Unix compatibility
  17554. only.
  17555.  
  17556. Return Value
  17557. ------------
  17558.  
  17559. The new nice value.
  17560.  
  17561. 
  17562. File: libc.inf,  Node: normvideo,  Next: nosound,  Prev: nice,  Up: Alphabetical List
  17563.  
  17564. normvideo
  17565. =========
  17566.  
  17567. Syntax
  17568. ------
  17569.  
  17570.      #include <conio.h>
  17571.      
  17572.      void normvideo(void);
  17573.  
  17574. Description
  17575. -----------
  17576.  
  17577. Resets the text attribute to what it was before the program started.
  17578.  
  17579. 
  17580. File: libc.inf,  Node: nosound,  Next: ntohl,  Prev: normvideo,  Up: Alphabetical List
  17581.  
  17582. nosound
  17583. =======
  17584.  
  17585. Syntax
  17586. ------
  17587.  
  17588.      #include <pc.h>
  17589.      
  17590.      void nosound(void);
  17591.  
  17592. Description
  17593. -----------
  17594.  
  17595. Disable the PC speaker.
  17596.  
  17597. 
  17598. File: libc.inf,  Node: ntohl,  Next: ntohs,  Prev: nosound,  Up: Alphabetical List
  17599.  
  17600. ntohl
  17601. =====
  17602.  
  17603. Syntax
  17604. ------
  17605.  
  17606.      #include <netinet/in.h>
  17607.      
  17608.      unsigned long ntohl(unsigned long val);
  17609.  
  17610. Description
  17611. -----------
  17612.  
  17613. This function converts from network formatted longs to host formatted
  17614. longs.  For the i386 and higher processors, this means that the bytes
  17615. are swapped from 1234 order to 4321 order.
  17616.  
  17617. Return Value
  17618. ------------
  17619.  
  17620. The host-order value.
  17621.  
  17622. Example
  17623. -------
  17624.  
  17625.      ip = htonl(packet.ipaddr);
  17626.  
  17627. 
  17628. File: libc.inf,  Node: ntohs,  Next: open,  Prev: ntohl,  Up: Alphabetical List
  17629.  
  17630. ntohs
  17631. =====
  17632.  
  17633. Syntax
  17634. ------
  17635.  
  17636.      #include <netinet/in.h>
  17637.      
  17638.      unsigned short ntohs(unsigned short val);
  17639.  
  17640. Description
  17641. -----------
  17642.  
  17643. This function converts from network formatted shorts to host formatted
  17644. shorts.  For the i386 and higher processors, this means that the bytes
  17645. are swapped from 12 order to 21 order.
  17646.  
  17647. Return Value
  17648. ------------
  17649.  
  17650. The host-order value.
  17651.  
  17652. Example
  17653. -------
  17654.  
  17655.      port = htons(tcp.port);
  17656.  
  17657. 
  17658. File: libc.inf,  Node: open,  Next: _open,  Prev: ntohs,  Up: Alphabetical List
  17659.  
  17660. open
  17661. ====
  17662.  
  17663. Syntax
  17664. ------
  17665.  
  17666.      #include <fcntl.h>
  17667.      #include <sys/stat.h> /* for mode definitions */
  17668.      
  17669.      int open(const char *file, int mode /*, int permissions */);
  17670.  
  17671. Description
  17672. -----------
  17673.  
  17674. This function opens the named FILE in the given MODE, which is any
  17675. combination of the following:
  17676.  
  17677. `O_RDONLY'
  17678.      The file is opened for reading.
  17679.  
  17680. `O_WRONLY'
  17681.      The file is opened for writing.
  17682.  
  17683. `O_RDWR'
  17684.      The file is opened for both reading and writing.
  17685.  
  17686. `O_CREAT'
  17687.      If the file does not exist, it is created. *Note creat::.
  17688.  
  17689. `O_TRUNC'
  17690.      If the file does exist, it is truncated to zero bytes.
  17691.  
  17692. `O_EXCL'
  17693.      If the file exists, and `O_CREAT' is also specified, the `open'
  17694.      call will fail.
  17695.  
  17696. `O_APPEND'
  17697.      The file pointer is positioned at the end of the file before each
  17698.      write.
  17699.  
  17700. `O_TEXT'
  17701.      The file is opened in text mode, meaning that Ctrl-M characters are
  17702.      stripped on reading and added on writing as needed.  The default
  17703.      mode is specified by the `_fmode' variable *Note _fmode::.
  17704.  
  17705. `O_BINARY'
  17706.      The file is opened in binary mode.
  17707.  
  17708.      When called to open the console in binary mode, `open' will disable
  17709.      the generation of `SIGINT' when you press `Ctrl-C' (`Ctrl-Break'
  17710.      will still cause `SIGINT'), because many programs that use binary
  17711.      reads from the console will also want to get the `^C' characters.
  17712.      You can use the `__djgpp_set_ctrl_c' library function (*note
  17713.      __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to generate interrupts
  17714.      while console is read in binary mode.
  17715.  
  17716. If the file is created by this call, it will be given the read/write
  17717. permissions specified by PERMISSIONS, which may be any combination of
  17718. these values:
  17719.  
  17720. `S_IRUSR'
  17721.      The file is readable.  This is always true for MS-DOS
  17722.  
  17723. `S_IWUSR'
  17724.      The file is writable.
  17725.  
  17726. Other `S_I*' values may be included, but they will be ignored.
  17727.  
  17728. Return Value
  17729. ------------
  17730.  
  17731. If successful, the file descriptor is returned.  On error, a negative
  17732. number is returned and `errno' is set to indicate the error.
  17733.  
  17734. Example
  17735. -------
  17736.  
  17737.      int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
  17738.  
  17739. 
  17740. File: libc.inf,  Node: _open,  Next: opendir,  Prev: open,  Up: Alphabetical List
  17741.  
  17742. _open
  17743. =====
  17744.  
  17745. Syntax
  17746. ------
  17747.  
  17748.      #include <io.h>
  17749.      
  17750.      int _open(const char *path, int attrib);
  17751.  
  17752. Description
  17753. -----------
  17754.  
  17755. This is a direct connection to the MS-DOS open function call, int 0x21,
  17756. %ah = 0x3d.  The file is set to binary mode.
  17757.  
  17758. Return Value
  17759. ------------
  17760.  
  17761. The new file descriptor, else -1 on error.
  17762.  
  17763. 
  17764. File: libc.inf,  Node: opendir,  Next: outb,  Prev: _open,  Up: Alphabetical List
  17765.  
  17766. opendir
  17767. =======
  17768.  
  17769. Syntax
  17770. ------
  17771.  
  17772.      #include <dirent.h>
  17773.      
  17774.      extern int __opendir_flags;
  17775.      
  17776.      DIR *opendir(char *name);
  17777.  
  17778. Description
  17779. -----------
  17780.  
  17781. This function "opens" a directory so that you can read the list of file
  17782. names in it.  The pointer returned must be passed to `closedir' when
  17783. you are done with it.  *Note readdir::.
  17784.  
  17785. The global variable `__opendir_flags' can be set to include the
  17786. following values to control the operation of `opendir':
  17787.  
  17788. `__OPENDIR_PRESERVE_CASE'
  17789.      Do not change the case of files to lower case.  Just in case
  17790.      Micros*ft decides to support case-sensitive file systems some day.
  17791.  
  17792. `__OPENDIR_FIND_HIDDEN'
  17793.      Include hidden files and directories in the search.  By default,
  17794.      these are skipped.
  17795.  
  17796. You can simply put "int __opendir_flags = ...;" in your code.  The
  17797. default is to let it get set to zero as an uninitialized variable.
  17798.  
  17799. Return Value
  17800. ------------
  17801.  
  17802. The open directory structure, or `NULL' on error.
  17803.  
  17804. Example
  17805. -------
  17806.  
  17807.      DIR *d = opendir(".");
  17808.      closedir(d);
  17809.  
  17810. 
  17811. File: libc.inf,  Node: outb,  Next: outp,  Prev: opendir,  Up: Alphabetical List
  17812.  
  17813. outb
  17814. ====
  17815.  
  17816. Syntax
  17817. ------
  17818.  
  17819.      #include <pc.h>
  17820.      
  17821.      void outb(unsigned short _port, unsigned char _data);
  17822.  
  17823. Description
  17824. -----------
  17825.  
  17826. Calls *Note outportb::. Provided only for compatibility.
  17827.  
  17828. 
  17829. File: libc.inf,  Node: outp,  Next: outportb,  Prev: outb,  Up: Alphabetical List
  17830.  
  17831. outp
  17832. ====
  17833.  
  17834. Syntax
  17835. ------
  17836.  
  17837.      #include <pc.h>
  17838.      
  17839.      void outp(unsigned short _port, unsigned char  _data);
  17840.  
  17841. Description
  17842. -----------
  17843.  
  17844. Calls *Note outportb::. Provided only for compatibility.
  17845.  
  17846. 
  17847. File: libc.inf,  Node: outportb,  Next: outportl,  Prev: outp,  Up: Alphabetical List
  17848.  
  17849. outportb
  17850. ========
  17851.  
  17852. Syntax
  17853. ------
  17854.  
  17855.      #include <pc.h>
  17856.      
  17857.      void outportb(unsigned short _port, unsigned char  _data);
  17858.  
  17859. Description
  17860. -----------
  17861.  
  17862. Write a single byte to an 8-bit port.
  17863.  
  17864. This function is provided as an inline assembler macro, and will be
  17865. optimized down to a single opcode when you optimize your program.
  17866.  
  17867. 
  17868. File: libc.inf,  Node: outportl,  Next: outportsb,  Prev: outportb,  Up: Alphabetical List
  17869.  
  17870. outportl
  17871. ========
  17872.  
  17873. Syntax
  17874. ------
  17875.  
  17876.      #include <pc.h>
  17877.      
  17878.      void outportl(unsigned short _port, unsigned long _data);
  17879.  
  17880. Description
  17881. -----------
  17882.  
  17883. Write a single long to an 32-bit port.
  17884.  
  17885. This function is provided as an inline assembler macro, and will be
  17886. optimized down to a single opcode when you optimize your program.
  17887.  
  17888. 
  17889. File: libc.inf,  Node: outportsb,  Next: outportsl,  Prev: outportl,  Up: Alphabetical List
  17890.  
  17891. outportsb
  17892. =========
  17893.  
  17894. Syntax
  17895. ------
  17896.  
  17897.      #include <pc.h>
  17898.      
  17899.      void outportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  17900.  
  17901. Description
  17902. -----------
  17903.  
  17904. Writes the _LEN bytes in _BUF to the 8-bit _PORT.
  17905.  
  17906. 
  17907. File: libc.inf,  Node: outportsl,  Next: outportsw,  Prev: outportsb,  Up: Alphabetical List
  17908.  
  17909. outportsl
  17910. =========
  17911.  
  17912. Syntax
  17913. ------
  17914.  
  17915.      #include <pc.h>
  17916.      
  17917.      void outportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  17918.  
  17919. Description
  17920. -----------
  17921.  
  17922. Writes the _LEN longs in _BUF to the 32-bit _PORT.
  17923.  
  17924. 
  17925. File: libc.inf,  Node: outportsw,  Next: outportw,  Prev: outportsl,  Up: Alphabetical List
  17926.  
  17927. outportsw
  17928. =========
  17929.  
  17930. Syntax
  17931. ------
  17932.  
  17933.      #include <pc.h>
  17934.      
  17935.      void outportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  17936.  
  17937. Description
  17938. -----------
  17939.  
  17940. Writes the _LEN shorts in _BUF to the 16-bit _PORT.
  17941.  
  17942. 
  17943. File: libc.inf,  Node: outportw,  Next: outpw,  Prev: outportsw,  Up: Alphabetical List
  17944.  
  17945. outportw
  17946. ========
  17947.  
  17948. Syntax
  17949. ------
  17950.  
  17951.      #include <pc.h>
  17952.      
  17953.      void outportw(unsigned short _port, unsigned short _data);
  17954.  
  17955. Description
  17956. -----------
  17957.  
  17958. Write a single short to an 16-bit port.
  17959.  
  17960. This function is provided as an inline assembler macro, and will be
  17961. optimized down to a single opcode when you optimize your program.
  17962.  
  17963. 
  17964. File: libc.inf,  Node: outpw,  Next: pathconf,  Prev: outportw,  Up: Alphabetical List
  17965.  
  17966. outpw
  17967. =====
  17968.  
  17969. Syntax
  17970. ------
  17971.  
  17972.      #include <pc.h>
  17973.      
  17974.      void outpw(unsigned short _port, unsigned short _data);
  17975.  
  17976. Description
  17977. -----------
  17978.  
  17979. Calls *Note outportw::. Provided only for compatibility.
  17980.  
  17981. 
  17982. File: libc.inf,  Node: pathconf,  Next: pause,  Prev: outpw,  Up: Alphabetical List
  17983.  
  17984. pathconf
  17985. ========
  17986.  
  17987. Syntax
  17988. ------
  17989.  
  17990.      #include <unistd.h>
  17991.      
  17992.      long pathconf(const char *filename, int name);
  17993.  
  17994. Description
  17995. -----------
  17996.  
  17997. This function returns various system-dependent configuration values.
  17998. The NAME is one of the following:
  17999.  
  18000. `_PC_LINK_MAX'
  18001.      The maximum number of directory entries that can refer to a single
  18002.      real file.
  18003.  
  18004. `_PC_MAX_CANON'
  18005.      The maximum number of bytes in an editable input line.
  18006.  
  18007. `_PC_MAX_INPUT'
  18008.      The maximum number of bytes in a non-editable input line.
  18009.  
  18010. `_PC_NAME_MAX'
  18011.      The maximum length of an individual file name.
  18012.  
  18013. `_PC_PATH_MAX'
  18014.      The maximum length of a complete path name.
  18015.  
  18016. `_PC_PIPE_BUF'
  18017.      The size of a pipe's internal buffer.
  18018.  
  18019. `_PC_CHOWN_RESTRICTED'
  18020.      If non-zero, only privileged user can chown() files, otherwise
  18021.      anyone may give away files.
  18022.  
  18023. `_PC_NO_TRUNC'
  18024.      If false filenames longer than `_PC_NAME_MAX' are truncated,
  18025.      otherwise an error occurs if you use longer names.
  18026.  
  18027. `_PC_VDISABLE'
  18028.      A character to use to disable tty special characters.
  18029.  
  18030. Return Value
  18031. ------------
  18032.  
  18033. The selected configuration value is returned.
  18034.  
  18035. Example
  18036. -------
  18037.  
  18038.      char *buf = malloc(pathconf("c:/", _PC_MAX_PATH)+1);
  18039.  
  18040. 
  18041. File: libc.inf,  Node: pause,  Next: pclose,  Prev: pathconf,  Up: Alphabetical List
  18042.  
  18043. pause
  18044. =====
  18045.  
  18046. Syntax
  18047. ------
  18048.  
  18049.      #include <unistd.h>
  18050.      
  18051.      int pause(void);
  18052.  
  18053. Description
  18054. -----------
  18055.  
  18056. This function just calls `__dpmi_yield()' (*note __dpmi_yield::.) to
  18057. give up a slice of the CPU.
  18058.  
  18059. Return Value
  18060. ------------
  18061.  
  18062. Zero.
  18063.  
  18064. 
  18065. File: libc.inf,  Node: pclose,  Next: perror,  Prev: pause,  Up: Alphabetical List
  18066.  
  18067. pclose
  18068. ======
  18069.  
  18070. Syntax
  18071. ------
  18072.  
  18073.      #include <stdio.h>
  18074.      
  18075.      int pclose(FILE *pipe);
  18076.  
  18077. Description
  18078. -----------
  18079.  
  18080. This function closes a pipe opened with `popen' (*note popen::.).  Note
  18081. that since MS-DOS is not multitasking, this function will actually run
  18082. the program specified in `popen' if the pipe was opened for writing.
  18083.  
  18084. Return Value
  18085. ------------
  18086.  
  18087. Zero on success, nonzero on failure.
  18088.  
  18089. Example
  18090. -------
  18091.  
  18092.      FILE *f = popen("sort", "w");
  18093.      write_to_pipe(f);
  18094.      pclose(f);
  18095.  
  18096. 
  18097. File: libc.inf,  Node: perror,  Next: pipe,  Prev: pclose,  Up: Alphabetical List
  18098.  
  18099. perror
  18100. ======
  18101.  
  18102. Syntax
  18103. ------
  18104.  
  18105.      #include <stdio.h>
  18106.      
  18107.      void perror(const char *string);
  18108.  
  18109. Description
  18110. -----------
  18111.  
  18112. This function formats an error message and prints it to `stderr'.  The
  18113. message is the STRING, a colon, and a message suitable for the error
  18114. condition indicated by `errno'.
  18115.  
  18116. Return Value
  18117. ------------
  18118.  
  18119. None.
  18120.  
  18121. Example
  18122. -------
  18123.  
  18124.      int x = open("foo", O_RDONLY);
  18125.      if (x < 0)
  18126.      {
  18127.        perror("foo");
  18128.        exit(1);
  18129.      }
  18130.  
  18131. 
  18132. File: libc.inf,  Node: pipe,  Next: popen,  Prev: perror,  Up: Alphabetical List
  18133.  
  18134. pipe
  18135. ====
  18136.  
  18137. Description
  18138. -----------
  18139.  
  18140. This function is provided only to assist in porting from Unix.  It
  18141. always returns an error condition.
  18142.  
  18143. 
  18144. File: libc.inf,  Node: popen,  Next: pow,  Prev: pipe,  Up: Alphabetical List
  18145.  
  18146. popen
  18147. =====
  18148.  
  18149. Syntax
  18150. ------
  18151.  
  18152.      #include <stdio.h>
  18153.      
  18154.      FILE *popen(const char *program, const char *mode);
  18155.  
  18156. Description
  18157. -----------
  18158.  
  18159. This function executes the named `program' and attaches either its
  18160. input stream or its output stream to the returned file.  While the file
  18161. is open, the calling program can write to the program (if the program
  18162. was open for writing) or read the program's output (if the program was
  18163. opened for reading).  When the program is done, or if you have no more
  18164. input for it, pass the file pointer to `pclose' (*note pclose::.),
  18165. which terminates the program.
  18166.  
  18167. Since MS-DOS does not support multitasking, this function actually runs
  18168. the entire program when the program is opened for reading, and stores
  18169. the output in a temporary file.  `pclose' then removes that file.
  18170. Similarly, when you open a program for writing, a temp file holds the
  18171. data and `pclose' runs the entire program.
  18172.  
  18173. The MODE is the same as for `fopen' (*note fopen::.).
  18174.  
  18175. Return Value
  18176. ------------
  18177.  
  18178. An open file which can be used to read the program's output or write to
  18179. the program's input.
  18180.  
  18181. Example
  18182. -------
  18183.  
  18184.      FILE *p = popen("dir", "r");
  18185.      read_program(p);
  18186.      pclose(p);
  18187.  
  18188. 
  18189. File: libc.inf,  Node: pow,  Next: pow10,  Prev: popen,  Up: Alphabetical List
  18190.  
  18191. pow
  18192. ===
  18193.  
  18194. Syntax
  18195. ------
  18196.  
  18197.      #include <math.h>
  18198.      
  18199.      double pow(double x, double y);
  18200.  
  18201. Return Value
  18202. ------------
  18203.  
  18204. X raised to the Y power.
  18205.  
  18206. 
  18207. File: libc.inf,  Node: pow10,  Next: pow2,  Prev: pow,  Up: Alphabetical List
  18208.  
  18209. pow10
  18210. =====
  18211.  
  18212. Syntax
  18213. ------
  18214.  
  18215.      #include <math.h>
  18216.      
  18217.      double pow10(double x);
  18218.  
  18219. Return Value
  18220. ------------
  18221.  
  18222. 10 raised to the X power.
  18223.  
  18224. 
  18225. File: libc.inf,  Node: pow2,  Next: _preserve_fncase,  Prev: pow10,  Up: Alphabetical List
  18226.  
  18227. pow2
  18228. ====
  18229.  
  18230. Syntax
  18231. ------
  18232.  
  18233.      #include <math.h>
  18234.      
  18235.      double pow2(double x);
  18236.  
  18237. Return Value
  18238. ------------
  18239.  
  18240. 2 raised to the X power.
  18241.  
  18242. 
  18243. File: libc.inf,  Node: _preserve_fncase,  Next: printf,  Prev: pow2,  Up: Alphabetical List
  18244.  
  18245. _preserve_fncase
  18246. ================
  18247.  
  18248. Syntax
  18249. ------
  18250.  
  18251.      #include <fcntl.h>
  18252.      
  18253.      char _preserve_fncase (void);
  18254.  
  18255. Description
  18256. -----------
  18257.  
  18258. This function returns a non-zero value if letter-case in filenames
  18259. should be preserved.  It is used by library functions that get filenames
  18260. from the operating system (like `readdir', `_fixpath' and others).  The
  18261. usual behavior of these functions (when `_preserve_fncase' returns
  18262. zero) is to down-case 8+3 DOS-style filenames, but leave alone the
  18263. letter-case in long filenames when these are supported (*note
  18264. _use_lfn::.).  This can be changed by either setting
  18265. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  18266. variable (*note _crt0_startup_flags::.), or by setting the `FNCASE'
  18267. environment variable to `Y' at run time.  You might need such a setup
  18268. e.g. on Windows 95 if you want to see files with names like `README'
  18269. and `FAQ' listed in upper-case (for this to work, you will have to
  18270. manually rename all the other files with 8+3 DOS-style names to
  18271. lower-case names).  When the case in filenames is preserved, all
  18272. filenames will be returned in upper case on MSDOS (and other systems
  18273. that don't support long filenames), or if the environment variable
  18274. `LFN' is set to `N' on systems that support LFN.  That is because this
  18275. is how filenames are stored in the DOS directory entries.
  18276.  
  18277. Return value
  18278. ------------
  18279.  
  18280. Zero when 8+3 filenames should be converted to lower-case, non-zero
  18281. otherwise.
  18282.  
  18283. 
  18284. File: libc.inf,  Node: printf,  Next: putc,  Prev: _preserve_fncase,  Up: Alphabetical List
  18285.  
  18286. printf
  18287. ======
  18288.  
  18289. Syntax
  18290. ------
  18291.  
  18292.      #include <stdio.h>
  18293.      
  18294.      int printf(const char *format, ...);
  18295.  
  18296. Description
  18297. -----------
  18298.  
  18299. Sends formatted output from the arguments (...) to `stdout'.
  18300.  
  18301. The format string contains regular characters to print, as well as
  18302. conversion specifiers, which begin with a percent symbol.  Each
  18303. conversion speficier contains the following fields:
  18304.  
  18305.    *  an optional flag, which may alter the conversion:
  18306.  
  18307.     `-'
  18308.           left-justify the field.
  18309.  
  18310.     `+'
  18311.           Force a `+' sign on positive numbers.
  18312.  
  18313.     `space'
  18314.           To leave a blank space where a plus or minus sign would have
  18315.           been.
  18316.  
  18317.     `#'
  18318.           Alternate conversion - prefix octal numbers with `0',
  18319.           hexadecimal numbers with `0x' or `0X', or force a trailing
  18320.           decimal point if a floating point conversion would have
  18321.           omitted it.
  18322.  
  18323.     `0'
  18324.           To pad numbers with leading zeros.
  18325.  
  18326.    *  A field width specifier, which specifies the minimum width of the
  18327.      field.  This may also be an asterisk (`*'), which means that the
  18328.      actual width will be obtained from the next argument.  If the
  18329.      argument is negative, it supplies a `-' flag and a positive width.
  18330.  
  18331.    *  An optional decimal point and a precision.  This may also be an
  18332.      asterisk, but a negative argument for it indicates a precision of
  18333.      zero.  The precision specifies the minimum number of digits to
  18334.      print for an integer, the number of fraction digits for a floating
  18335.      point number (max for `g' or `G', actual for others), or the
  18336.      maximum number of characters for a string.
  18337.  
  18338.    *  An optional conversion qualifier, which may be `h' to specify
  18339.      `short', `l' to specify long ints, or `L' to specify long doubles.
  18340.      Long long type can be specified by `L' or `ll'.
  18341.  
  18342.    *  The conversion type specifier:
  18343.  
  18344.     `c'
  18345.           A single character
  18346.  
  18347.     `d'
  18348.           A signed integer
  18349.  
  18350.     `D'
  18351.           A signed long integer
  18352.  
  18353.     `e'
  18354.     `E'
  18355.           A floating point number (double or long double).  The
  18356.           exponent case matches the specifier case.  The representation
  18357.           always has an exponent.
  18358.  
  18359.     `f'
  18360.           A floating point number (double or long double).  The
  18361.           representation never has an exponent.
  18362.  
  18363.     `g'
  18364.     `G'
  18365.           A floating point number (double or long double).  The
  18366.           exponent case matches the specifier case.  The representation
  18367.           has an exponent if it needs one.
  18368.  
  18369.     `i'
  18370.           A signed integer.
  18371.  
  18372.     `n'
  18373.           The next argument is a pointer to an integer, and the number
  18374.           of characters generated so far is stored in that integer.
  18375.  
  18376.     `o'
  18377.           A unsigned integer, printed in base 8 instead of base 10.
  18378.  
  18379.     `p'
  18380.           A pointer.  This is printed with an `x' specifier.
  18381.  
  18382.     `s'
  18383.           A `NULL'-terminated string.
  18384.  
  18385.     `u'
  18386.           An unsigned integer.
  18387.  
  18388.     `U'
  18389.           An unsigned long integer.
  18390.  
  18391.     `x'
  18392.     `X'
  18393.           An unsigned integer, printed in base 16 instead of base 10.
  18394.           The case of the letters used matches the specifier case.
  18395.  
  18396.     `%'
  18397.           A single percent symbol is printed.
  18398.  
  18399. Return Value
  18400. ------------
  18401.  
  18402. The number of characters written.
  18403.  
  18404. Example
  18405. -------
  18406.  
  18407.      printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
  18408.  
  18409. 
  18410. File: libc.inf,  Node: putc,  Next: putch,  Prev: printf,  Up: Alphabetical List
  18411.  
  18412. putc
  18413. ====
  18414.  
  18415. Syntax
  18416. ------
  18417.  
  18418.      #include <stdio.h>
  18419.      
  18420.      int putc(int c, FILE *file);
  18421.  
  18422. Description
  18423. -----------
  18424.  
  18425. This function writes one character to the given FILE.
  18426.  
  18427. Return Value
  18428. ------------
  18429.  
  18430. The character written.
  18431.  
  18432. Example
  18433. -------
  18434.  
  18435.      while ((c=getc(stdin)) != EOF)
  18436.        putc(c, stdout);
  18437.  
  18438. 
  18439. File: libc.inf,  Node: putch,  Next: putchar,  Prev: putc,  Up: Alphabetical List
  18440.  
  18441. putch
  18442. =====
  18443.  
  18444. Syntax
  18445. ------
  18446.  
  18447.      #include <conio.h>
  18448.      
  18449.      int putch(int _c);
  18450.  
  18451. Description
  18452. -----------
  18453.  
  18454. Put the character _C on the screen at the current cursor position.  The
  18455. special characters return, linefeed, bell, and backspace are handled
  18456. properly, as is line wrap and scrolling.  The cursor position is
  18457. updated.
  18458.  
  18459. Return Value
  18460. ------------
  18461.  
  18462. The character is returned.
  18463.  
  18464. 
  18465. File: libc.inf,  Node: putchar,  Next: putenv,  Prev: putch,  Up: Alphabetical List
  18466.  
  18467. putchar
  18468. =======
  18469.  
  18470. Syntax
  18471. ------
  18472.  
  18473.      #include <stdio.h>
  18474.      
  18475.      int putchar(int c);
  18476.  
  18477. Description
  18478. -----------
  18479.  
  18480. This is the same as `fputc(c, stdout)'.  *Note fputc::.
  18481.  
  18482. Return Value
  18483. ------------
  18484.  
  18485. The character written.
  18486.  
  18487. Example
  18488. -------
  18489.  
  18490.      while ((c = getchar()) != EOF)
  18491.        putchar(c);
  18492.  
  18493. 
  18494. File: libc.inf,  Node: putenv,  Next: puts,  Prev: putchar,  Up: Alphabetical List
  18495.  
  18496. putenv
  18497. ======
  18498.  
  18499. Syntax
  18500. ------
  18501.  
  18502.      #include <stdlib.h>
  18503.      
  18504.      int putenv(const char *env);
  18505.  
  18506. Description
  18507. -----------
  18508.  
  18509. This function adds an entry to the program's environment.  The string
  18510. passed must be of the form `NAME'=`VALUE'.  Any existing value for the
  18511. environment variable is gone.
  18512.  
  18513. `putenv' will copy the string passed to it, and will automatically free
  18514. any existing string already in the environment.  Keep this in mind if
  18515. you alter the environment yourself.  The string you pass is still your
  18516. responsibility to free.  Note that most implementations will not let
  18517. you free the string you pass, resulting in memory leaks.
  18518.  
  18519. Return Value
  18520. ------------
  18521.  
  18522. Zero on success, nonzero on failure.
  18523.  
  18524. Example
  18525. -------
  18526.  
  18527.      putenv("SHELL=ksh.exe");
  18528.  
  18529. 
  18530. File: libc.inf,  Node: puts,  Next: puttext,  Prev: putenv,  Up: Alphabetical List
  18531.  
  18532. puts
  18533. ====
  18534.  
  18535. Syntax
  18536. ------
  18537.  
  18538.      #include <stdio.h>
  18539.      
  18540.      int puts(const char *string);
  18541.  
  18542. Description
  18543. -----------
  18544.  
  18545. This function writes STRING to `stdout', and then writes a newline
  18546. character.
  18547.  
  18548. Return Value
  18549. ------------
  18550.  
  18551. Nonnegative for success, or `EOF' on error.
  18552.  
  18553. Example
  18554. -------
  18555.  
  18556.      puts("Hello, there");
  18557.  
  18558. 
  18559. File: libc.inf,  Node: puttext,  Next: putw,  Prev: puts,  Up: Alphabetical List
  18560.  
  18561. puttext
  18562. =======
  18563.  
  18564. Syntax
  18565. ------
  18566.  
  18567.      #include <conio.h>
  18568.      
  18569.      int puttext(int _left, int _top, int _right, int _bottom, void *_source);
  18570.  
  18571. Description
  18572. -----------
  18573.  
  18574. The opposite of *Note gettext::.
  18575.  
  18576. Return Value
  18577. ------------
  18578.  
  18579. 1 on success, zero on error.
  18580.  
  18581. 
  18582. File: libc.inf,  Node: putw,  Next: qsort,  Prev: puttext,  Up: Alphabetical List
  18583.  
  18584. putw
  18585. ====
  18586.  
  18587. Syntax
  18588. ------
  18589.  
  18590.      #include <stdio.h>
  18591.      
  18592.      int putw(int x, FILE *file);
  18593.  
  18594. Description
  18595. -----------
  18596.  
  18597. Writes a single binary word in native format to FILE.
  18598.  
  18599. Return Value
  18600. ------------
  18601.  
  18602. The value written, or `EOF' for end-of-file or error.  Since `EOF' is a
  18603. valid integer, you should use `feof' or `ferror' to detect this
  18604. situation.
  18605.  
  18606. Example
  18607. -------
  18608.  
  18609.      putw(12, stdout);
  18610.  
  18611. 
  18612. File: libc.inf,  Node: qsort,  Next: raise,  Prev: putw,  Up: Alphabetical List
  18613.  
  18614. qsort
  18615. =====
  18616.  
  18617. Syntax
  18618. ------
  18619.  
  18620.      #include <stdlib.h>
  18621.      
  18622.      void qsort(void *base, size_t numelem, size_t size,
  18623.                 int (*cmp)(const void *e1, const void *e2));
  18624.  
  18625. Description
  18626. -----------
  18627.  
  18628. This function sorts the given array in place.  BASE is the address of
  18629. the first of NUMELEM array entries, each of size SIZE bytes.  `qsort'
  18630. uses the supplied function CMP to determine the sort order for any two
  18631. elements by passing the address of the two elements and using the
  18632. function's return address.
  18633.  
  18634. The return address of the function indicates the sort order:
  18635.  
  18636. Negative
  18637.      Element E1 should come before element E2 in the resulting array.
  18638.  
  18639. Positive
  18640.      Element E1 should come after element E2 in the resulting array.
  18641.  
  18642. Zero
  18643.      It doesn't matter which element comes first in the resulting array.
  18644.  
  18645. Return Value
  18646. ------------
  18647.  
  18648. None.
  18649.  
  18650. Example
  18651. -------
  18652.  
  18653.      typedef struct {
  18654.        int size;
  18655.        int sequence;
  18656.      } Item;
  18657.      
  18658.      int qsort_helper_by_size(void *e1, void *e2)
  18659.      {
  18660.        return ((Item *)e2)->size - ((Item *)e1)->size;
  18661.      }
  18662.      
  18663.      Item list[100];
  18664.      
  18665.      qsort(list, 100, sizeof(Item), qsort_helper_by_size);
  18666.      
  18667.      int qsort_stringlist(void *e1, void *e2)
  18668.      {
  18669.        return strcmp(*(char **)e1, *(char **)e2);
  18670.      }
  18671.      
  18672.      char *slist[10];
  18673.      
  18674.      /* alphabetical order */
  18675.      qsort(slist, 10, sizeof(char *), qsort_stringlist);
  18676.  
  18677. 
  18678. File: libc.inf,  Node: raise,  Next: rand,  Prev: qsort,  Up: Alphabetical List
  18679.  
  18680. raise
  18681. =====
  18682.  
  18683. Syntax
  18684. ------
  18685.  
  18686.      #include <signal.h>
  18687.      
  18688.      int    raise(int sig);
  18689.  
  18690. Description
  18691. -----------
  18692.  
  18693. This function raises the given signal SIG.  *Note the list of possible
  18694. signals: signal.
  18695.  
  18696. Return Value
  18697. ------------
  18698.  
  18699. 0 on success, -1 for illegal value of SIG.
  18700.  
  18701. 
  18702. File: libc.inf,  Node: rand,  Next: random,  Prev: raise,  Up: Alphabetical List
  18703.  
  18704. rand
  18705. ====
  18706.  
  18707. Syntax
  18708. ------
  18709.  
  18710.      #include <stdlib.h>
  18711.      
  18712.      int rand(void);
  18713.  
  18714. Description
  18715. -----------
  18716.  
  18717. Returns a pseudo-random number from zero to `RAND_MAX'.
  18718.  
  18719. Return Value
  18720. ------------
  18721.  
  18722. The number.
  18723.  
  18724. Example
  18725. -------
  18726.  
  18727.      /* random pause */
  18728.      for (i=rand(); i; i--);
  18729.  
  18730. 
  18731. File: libc.inf,  Node: random,  Next: rawclock,  Prev: rand,  Up: Alphabetical List
  18732.  
  18733. random
  18734. ======
  18735.  
  18736. Syntax
  18737. ------
  18738.  
  18739.      #include <stdlib.h>
  18740.      
  18741.      long random(void);
  18742.  
  18743. Description
  18744. -----------
  18745.  
  18746. Returns a random number in the range 0..MAXINT.
  18747.  
  18748. Return Value
  18749. ------------
  18750.  
  18751. 0 .. MAXINT
  18752.  
  18753. 
  18754. File: libc.inf,  Node: rawclock,  Next: read,  Prev: random,  Up: Alphabetical List
  18755.  
  18756. rawclock
  18757. ========
  18758.  
  18759. Syntax
  18760. ------
  18761.  
  18762.      #include <time.h>
  18763.      
  18764.      unsigned long rawclock(void);
  18765.  
  18766. Description
  18767. -----------
  18768.  
  18769. Returns the number of clock tics (18.2 per second) since midnight.
  18770.  
  18771. Return Value
  18772. ------------
  18773.  
  18774. The number of tics.
  18775.  
  18776. Example
  18777. -------
  18778.  
  18779.      /* wait 1/4 second */
  18780.      int i = rawclock()+5;
  18781.      while (rawclock()<i);
  18782.  
  18783. 
  18784. File: libc.inf,  Node: read,  Next: _read,  Prev: rawclock,  Up: Alphabetical List
  18785.  
  18786. read
  18787. ====
  18788.  
  18789. Syntax
  18790. ------
  18791.  
  18792.      #include <unistd.h>
  18793.      
  18794.      ssize_t read(int fd, void *buffer, size_t length);
  18795.  
  18796. Description
  18797. -----------
  18798.  
  18799. This function reads at most LENGTH bytes from file FD into BUFFER.
  18800. Note that in some cases, such as end-of-file conditions and text files,
  18801. it may read less than the requested number of bytes.  At end-of-file,
  18802. `read' will read exactly zero bytes.
  18803.  
  18804. Return Value
  18805. ------------
  18806.  
  18807. The number of bytes read, zero meaning end-of-file, or -1 for an error.
  18808.  
  18809. Example
  18810. -------
  18811.  
  18812.      char buf[10];
  18813.      int r = read(0, buf, 10);
  18814.  
  18815. 
  18816. File: libc.inf,  Node: _read,  Next: readdir,  Prev: read,  Up: Alphabetical List
  18817.  
  18818. _read
  18819. =====
  18820.  
  18821. Syntax
  18822. ------
  18823.  
  18824.      #include <io.h>
  18825.      
  18826.      ssize_t _read(int fildes, void *buf, size_t nbyte);
  18827.  
  18828. Description
  18829. -----------
  18830.  
  18831. This is a direct connection to the MS-DOS read function call, int 0x21,
  18832. %ah = 0x3f.  No conversion is done on the data; it is read as raw
  18833. binary data.
  18834.  
  18835. Return Value
  18836. ------------
  18837.  
  18838. The number of bytes read.
  18839.  
  18840. 
  18841. File: libc.inf,  Node: readdir,  Next: realloc,  Prev: _read,  Up: Alphabetical List
  18842.  
  18843. readdir
  18844. =======
  18845.  
  18846. Syntax
  18847. ------
  18848.  
  18849.      #include <dirent.h>
  18850.      
  18851.      struct dirent *readdir(DIR *dir);
  18852.  
  18853. Description
  18854. -----------
  18855.  
  18856. This function reads entries from a directory opened by `opendir' (*note
  18857. opendir::.).  It returns the information in a static buffer with this
  18858. format:
  18859.  
  18860.      struct dirent {
  18861.        unsigned short d_namlen;  /* The length of the name (like strlen) */
  18862.        char d_name[MAXNAMLEN+1]; /* The name */
  18863.      };
  18864.  
  18865. Return Value
  18866. ------------
  18867.  
  18868. A pointer to a static buffer that is overridden with each call.
  18869.  
  18870. Example
  18871. -------
  18872.  
  18873.      DIR *d = opendir(".");
  18874.      struct dirent *de;
  18875.      while (de = readdir(d))
  18876.        puts(de->d_name);
  18877.      closedir(d);
  18878.  
  18879. 
  18880. File: libc.inf,  Node: realloc,  Next: regcomp,  Prev: readdir,  Up: Alphabetical List
  18881.  
  18882. realloc
  18883. =======
  18884.  
  18885. Syntax
  18886. ------
  18887.  
  18888.      #include <stdlib.h>
  18889.      
  18890.      void *realloc(void *ptr, size_t size);
  18891.  
  18892. Description
  18893. -----------
  18894.  
  18895. This function changes the size of the region pointed to by PTR.  If it
  18896. can, it will reuse the same memory space, but it may have to allocate a
  18897. new memory space to satisfy the request.  In either case, it will
  18898. return the pointer that you should use to refer to the (possibly new)
  18899. memory area.  The pointer passed may be `NULL', in which case this
  18900. function acts just like `malloc' (*note malloc::.).
  18901.  
  18902. Return Value
  18903. ------------
  18904.  
  18905. A pointer to the memory you should now refer to.
  18906.  
  18907. Example
  18908. -------
  18909.  
  18910.      if (now+new > max)
  18911.      {
  18912.        max = now+new;
  18913.        p = realloc(p, max);
  18914.      }
  18915.  
  18916. 
  18917. File: libc.inf,  Node: regcomp,  Next: regerror,  Prev: realloc,  Up: Alphabetical List
  18918.  
  18919. regcomp
  18920. =======
  18921.  
  18922. Syntax
  18923. ------
  18924.  
  18925.      #include <sys/types.h>
  18926.      #include <regex.h>
  18927.      
  18928.      int regcomp(regex_t *preg, const char *pattern, int cflags);
  18929.  
  18930. Description
  18931. -----------
  18932.  
  18933. This function is part of the implementation of POSIX 1003.2 regular
  18934. expressions ("RE"s).
  18935.  
  18936. `regcomp' compiles the regular expression contained in the PATTERN
  18937. string, subject to the flags in CFLAGS, and places the results in the
  18938. `regex_t' structure pointed to by PREG.  (The regular expression
  18939. syntax, as defined by POSIX 1003.2, is described below.)
  18940.  
  18941. The parameter CFLAGS is the bitwise OR of zero or more of the following
  18942. flags:
  18943.  
  18944. `REG_EXTENDED'
  18945.      Compile modern ("extended") REs, rather than the obsolete
  18946.      ("basic") REs that are the default.
  18947.  
  18948. `REG_BASIC'
  18949.      This is a synonym for 0, provided as a counterpart to
  18950.      `REG_EXTENDED' to improve readability.
  18951.  
  18952. `REG_NOSPEC'
  18953.      Compile with recognition of all special characters turned off.  All
  18954.      characters are thus considered ordinary, so the RE in PATTERN is a
  18955.      literal string.  This is an extension, compatible with but not
  18956.      specified by POSIX 1003.2, and should be used with caution in
  18957.      software intended to be portable to other systems.  `REG_EXTENDED'
  18958.      and `REG_NOSPEC' may not be used in the same call to `regcomp'.
  18959.  
  18960. `REG_ICASE'
  18961.      Compile for matching that ignores upper/lower case distinctions.
  18962.      See the description of regular expressions below for details of
  18963.      case-independent matching.
  18964.  
  18965. `REG_NOSUB'
  18966.      Compile for matching that need only report success or failure, not
  18967.      what was matched.
  18968.  
  18969. `REG_NEWLINE'
  18970.      Compile for newline-sensitive matching.  By default, newline is a
  18971.      completely ordinary character with no special meaning in either
  18972.      REs or strings.  With this flag, `[^' bracket expressions and `.'
  18973.      never match newline, a `^' anchor matches the null string after any
  18974.      newline in the string in addition to its normal function, and the
  18975.      `$' anchor matches the null string before any newline in the string
  18976.      in addition to its normal function.
  18977.  
  18978. `REG_PEND'
  18979.      The regular expression ends, not at the first NUL, but just before
  18980.      the character pointed to by the `re_endp' member of the structure
  18981.      pointed to by PREG.  The `re_endp' member is of type `const char
  18982.      *'.  This flag permits inclusion of NULs in the RE; they are
  18983.      considered ordinary characters.  This is an extension, compatible
  18984.      with but not specified by POSIX 1003.2, and should be used with
  18985.      caution in software intended to be portable to other systems.
  18986.  
  18987. When successful, `regcomp' returns 0 and fills in the structure pointed
  18988. to by PREG.  One member of that structure (other than `re_endp') is
  18989. publicized: `re_nsub', of type `size_t', contains the number of
  18990. parenthesized subexpressions within the RE (except that the value of
  18991. this member is undefined if the `REG_NOSUB' flag was used).
  18992.  
  18993. Note that the length of the RE does matter; in particular, there is a
  18994. strong speed bonus for keeping RE length under about 30 characters,
  18995. with most special characters counting roughly double.
  18996.  
  18997. Return Value
  18998. ------------
  18999.  
  19000. If `regcomp' succeeds, it returns zero; if it fails, it returns a
  19001. non-zero error code, which is one of these:
  19002.  
  19003. `REG_BADPAT'
  19004.      invalid regular expression
  19005.  
  19006. `REG_ECOLLATE'
  19007.      invalid collating element
  19008.  
  19009. `REG_ECTYPE'
  19010.      invalid character class
  19011.  
  19012. `REG_EESCAPE'
  19013.      `\' applied to unescapable character
  19014.  
  19015. `REG_ESUBREG'
  19016.      invalid backreference number (e.g., larger than the number of
  19017.      parenthesized subexpressions in the RE)
  19018.  
  19019. `REG_EBRACK'
  19020.      brackets [ ] not balanced
  19021.  
  19022. `REG_EPAREN'
  19023.      parentheses ( ) not balanced
  19024.  
  19025. `REG_EBRACE'
  19026.      braces { } not balanced
  19027.  
  19028. `REG_BADBR'
  19029.      invalid repetition count(s) in { }
  19030.  
  19031. `REG_ERANGE'
  19032.      invalid character range in [ ]
  19033.  
  19034. `REG_ESPACE'
  19035.      ran out of memory (an RE like, say,
  19036.      `((((a{1,100}){1,100}){1,100}){1,100}){1,100}'' will eventually
  19037.      run almost any existing machine out of swap space)
  19038.  
  19039. `REG_BADRPT'
  19040.      ?, *, or + operand invalid
  19041.  
  19042. `REG_EMPTY'
  19043.      empty (sub)expression
  19044.  
  19045. `REG_ASSERT'
  19046.      "can't happen" (you found a bug in `regcomp')
  19047.  
  19048. `REG_INVARG'
  19049.      invalid argument (e.g. a negative-length string)
  19050.  
  19051. Regular Expressions' Syntax
  19052. ---------------------------
  19053.  
  19054. Regular expressions ("RE"s), as defined in POSIX 1003.2, come in two
  19055. forms: modern REs (roughly those of `egrep'; 1003.2 calls these
  19056. *extended* REs) and obsolete REs (roughly those of `ed'; 1003.2 *basic*
  19057. REs).  Obsolete REs mostly exist for backward compatibility in some old
  19058. programs; they will be discussed at the end.  1003.2 leaves some
  19059. aspects of RE syntax and semantics open; `(*)' marks decisions on these
  19060. aspects that may not be fully portable to other 1003.2 implementations.
  19061.  
  19062. A (modern) RE is one(*) or more non-empty(*) *branches*, separated by
  19063. `|'.  It matches anything that matches one of the branches.
  19064.  
  19065. A branch is one(*) or more *pieces*, concatenated.  It matches a match
  19066. for the first, followed by a match for the second, etc.
  19067.  
  19068. A piece is an *atom* possibly followed by a single(*) `*', `+', `?', or
  19069. *bound*.  An atom followed by `*' matches a sequence of 0 or more
  19070. matches of the atom.  An atom followed by `+' matches a sequence of 1
  19071. or more matches of the atom.  An atom followed by `?' matches a
  19072. sequence of 0 or 1 matches of the atom.
  19073.  
  19074. A *bound* is `{' followed by an unsigned decimal integer, possibly
  19075. followed by `,' possibly followed by another unsigned decimal integer,
  19076. always followed by `}'.  The integers must lie between 0 and
  19077. `RE_DUP_MAX' (255(*)) inclusive, and if there are two of them, the
  19078. first may not exceed the second.  An atom followed by a bound containing
  19079. one integer `i' and no comma matches a sequence of exactly `i' matches
  19080. of the atom.  An atom followed by a bound containing one integer `i'
  19081. and a comma matches a sequence of `i' or more matches of the atom.  An
  19082. atom followed by a bound containing two integers `i' and `j' matches a
  19083. sequence of `i' through `j' (inclusive) matches of the atom.
  19084.  
  19085. An atom is a regular expression enclosed in `()' (matching a match for
  19086. the regular expression), an empty set of `()' (matching the null
  19087. string(*)), a *bracket expression* (see below), `.' (matching any single
  19088. character), `^' (matching the null string at the beginning of a line),
  19089. `$' (matching the null string at the end of a line), a `\\' followed by
  19090. one of the characters `^.[$()|*+?{\\' (matching that character taken as
  19091. an ordinary character), a `\\' followed by any other character(*)
  19092. (matching that character taken as an ordinary character, as if the `\\'
  19093. had not been present(*)), or a single character with no other
  19094. significance (matching that character).  A `{' followed by a character
  19095. other than a digit is an ordinary character, not the beginning of a
  19096. bound(*).  It is illegal to end an RE with `\\'.
  19097.  
  19098. A *bracket expression* is a list of characters enclosed in `[]'.  It
  19099. normally matches any single character from the list (but see below).
  19100. If the list begins with `^', it matches any single character (but see
  19101. below) *not* from the rest of the list.  If two characters in the list
  19102. are separated by `-', this is shorthand for the full *range* of
  19103. characters between those two (inclusive) in the collating sequence,
  19104. e.g. `[0-9]' in ASCII matches any decimal digit.  It is illegal(*) for
  19105. two ranges to share an endpoint, e.g. `a-c-e'.  Ranges are very
  19106. collating-sequence-dependent, and portable programs should avoid relying
  19107. on them.
  19108.  
  19109. To include a literal `]' in the list, make it the first character
  19110. (following a possible `^').  To include a literal `-', make it the
  19111. first or last character, or the second endpoint of a range.  To use a
  19112. literal `-' as the first endpoint of a range, enclose it in `[.' and
  19113. `.]' to make it a collating element (see below).  With the exception of
  19114. these and some combinations using `[' (see next paragraphs), all other
  19115. special characters, including `\\', lose their special significance
  19116. within a bracket expression.
  19117.  
  19118. Within a bracket expression, a collating element (a character, a
  19119. multi-character sequence that collates as if it were a single character,
  19120. or a collating-sequence name for either) enclosed in `[.' and `.]'
  19121. stands for the sequence of characters of that collating element.  The
  19122. sequence is a single element of the bracket expression's list.  A
  19123. bracket expression containing a multi-character collating element can
  19124. thus match more than one character, e.g. if the collating sequence
  19125. includes a `ch' collating element, then the RE `[[.ch.]]*c' matches the
  19126. first five characters of "chchcc".
  19127.  
  19128. Within a bracket expression, a collating element enclosed in `[=' and
  19129. `=]' is an equivalence class, standing for the sequences of characters
  19130. of all collating elements equivalent to that one, including itself.
  19131. (If there are no other equivalent collating elements, the treatment is
  19132. as if the enclosing delimiters were `[.' and `.]'.)  For example, if o
  19133. and \o'o^' are the members of an equivalence class, then `[[=o=]]',
  19134. `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.  An equivalence
  19135. class may not\(dg be an endpoint of a range.
  19136.  
  19137. Within a bracket expression, the name of a *character class* enclosed
  19138. in `[:' and `:]' stands for the list of all characters belonging to
  19139. that class.  Standard character class names are:
  19140.  
  19141.      alnum    digit    punct
  19142.      alpha    graph    space
  19143.      blank    lower    upper
  19144.      cntrl    print    xdigit
  19145.  
  19146. These stand for the character classes defined by `isalnum' (*note
  19147. isalnum::.), `isdigit' (*note isdigit::.), `ispunct' (*note
  19148. ispunct::.), `isalpha' (*note isalpha::.), `isgraph' (*note
  19149. isgraph::.), `isspace' (*note isspace::.) (`blank' is the same as
  19150. `space'), `islower' (*note islower::.), `isupper' (*note isupper::.),
  19151. `iscntrl' (*note iscntrl::.), `isprint' (*note isprint::.), and
  19152. `isxdigit' (*note isxdigit::.), respectively.  A locale may provide
  19153. others.  A character class may not be used as an endpoint of a range.
  19154.  
  19155. There are two special cases(*) of bracket expressions: the bracket
  19156. expressions `[[:<:]]' and `[[:>:]]' match the null string at the
  19157. beginning and end of a word respectively.  A word is defined as a
  19158. sequence of word characters which is neither preceded nor followed by
  19159. word characters.  A word character is an `alnum' character (as defined
  19160. by `isalnum' library function) or an underscore.  This is an extension,
  19161. compatible with but not specified by POSIX 1003.2, and should be used
  19162. with caution in software intended to be portable to other systems.
  19163.  
  19164. In the event that an RE could match more than one substring of a given
  19165. string, the RE matches the one starting earliest in the string.  If the
  19166. RE could match more than one substring starting at that point, it
  19167. matches the longest.  Subexpressions also match the longest possible
  19168. substrings, subject to the constraint that the whole match be as long as
  19169. possible, with subexpressions starting earlier in the RE taking priority
  19170. over ones starting later.  Note that higher-level subexpressions thus
  19171. take priority over their lower-level component subexpressions.
  19172.  
  19173. Match lengths are measured in characters, not collating elements.  A
  19174. null string is considered longer than no match at all.  For example,
  19175. `bb*' matches the three middle characters of `abbbc',
  19176. `(wee|week)(knights|nights)' matches all ten characters of
  19177. `weeknights', when `(.*).*' is matched against `abc' the parenthesized
  19178. subexpression matches all three characters, and when `(a*)*' is matched
  19179. against `bc' both the whole RE and the parenthesized subexpression
  19180. match the null string.
  19181.  
  19182. If case-independent matching is specified, the effect is much as if all
  19183. case distinctions had vanished from the alphabet.  When an alphabetic
  19184. that exists in multiple cases appears as an ordinary character outside a
  19185. bracket expression, it is effectively transformed into a bracket
  19186. expression containing both cases, e.g. `x' becomes `[xX]'.  When it
  19187. appears inside a bracket expression, all case counterparts of it are
  19188. added to the bracket expression, so that (e.g.) `[x]' becomes `[xX]' and
  19189. `[^x]' becomes `[^xX]'.
  19190.  
  19191. No particular limit is imposed on the length of REs(*).  Programs
  19192. intended to be portable should not employ REs longer than 256 bytes, as
  19193. an implementation can refuse to accept such REs and remain
  19194. POSIX-compliant.
  19195.  
  19196. Obsolete (*basic*) regular expressions differ in several respects.
  19197. `|', `+', and `?' are ordinary characters and there is no equivalent
  19198. for their functionality.  The delimiters for bounds are `\\{' and
  19199. `\\}', with `{' and `}' by themselves ordinary characters.  The
  19200. parentheses for nested subexpressions are `\(' and `\)', with `(' and
  19201. `)' by themselves ordinary characters.  `^' is an ordinary character
  19202. except at the beginning of the RE or(*) the beginning of a parenthesized
  19203. subexpression, `$' is an ordinary character except at the end of the RE
  19204. or(*) the end of a parenthesized subexpression, and `*' is an ordinary
  19205. character if it appears at the beginning of the RE or the beginning of a
  19206. parenthesized subexpression (after a possible leading `^').  Finally,
  19207. there is one new type of atom, a *back reference*: `\\' followed by a
  19208. non-zero decimal digit *d* matches the same sequence of characters
  19209. matched by the *d*th parenthesized subexpression (numbering
  19210. subexpressions by the positions of their opening parentheses, left to
  19211. right), so that (e.g.) `\\([bc]\\)\\1' matches `bb' or `cc' but not
  19212. `bc'.
  19213.  
  19214. 
  19215. File: libc.inf,  Node: regerror,  Next: regexec,  Prev: regcomp,  Up: Alphabetical List
  19216.  
  19217. regerror
  19218. ========
  19219.  
  19220. Syntax
  19221. ------
  19222.  
  19223.  
  19224.      #include <sys/types.h>
  19225.      #include <regex.h>
  19226.      
  19227.      size_t regerror(int errcode, const regex_t *preg,
  19228.                      char *errbuf, size_t errbuf_size);
  19229.  
  19230. Description
  19231. -----------
  19232.  
  19233. `regerror' maps a non-zero value of ERRCODE from either `regcomp'
  19234. (Return Value, *note regcomp::.) or `regexec' (Return Value, *note
  19235. regexec::.) to a human-readable, printable message.
  19236.  
  19237. If PREG is non-`NULL', the error code should have arisen from use of
  19238. the variable of the type `regex_t' pointed to by PREG, and if the error
  19239. code came from `regcomp', it should have been the result from the most
  19240. recent `regcomp' using that `regex_t' variable.  (`regerror' may be
  19241. able to supply a more detailed message using information from the
  19242. `regex_t' than from ERRCODE alone.)  `regerror' places the
  19243. `NUL'-terminated message into the buffer pointed to by ERRBUF, limiting
  19244. the length (including the `NUL') to at most ERRBUF_SIZE bytes.  If the
  19245. whole message won't fit, as much of it as will fit before the
  19246. terminating `NUL' is supplied.  In any case, the returned value is the
  19247. size of buffer needed to hold the whole message (including terminating
  19248. `NUL').  If ERRBUF_SIZE is 0, ERRBUF is ignored but the return value is
  19249. still correct.
  19250.  
  19251. If the ERRCODE given to `regerror' is first ORed with `REG_ITOA', the
  19252. "message" that results is the printable name of the error code, e.g.
  19253. "REG_NOMATCH", rather than an explanation thereof.  If ERRCODE is
  19254. `REG_ATOI', then PREG shall be non-NULL and the `re_endp' member of the
  19255. structure it points to must point to the printable name of an error code
  19256. (e.g. "REG_ECOLLATE"); in this case, the result in ERRBUF is the
  19257. decimal representation of the numeric value of the error code (0 if the
  19258. name is not recognized).  `REG_ITOA' and `REG_ATOI' are intended
  19259. primarily as debugging facilities; they are extensions, compatible with
  19260. but not specified by POSIX 1003.2, and should be used with caution in
  19261. software intended to be portable to other systems.  Be warned also that
  19262. they are considered experimental and changes are possible.
  19263.  
  19264. Return Value
  19265. ------------
  19266.  
  19267. The size of buffer needed to hold the message (including terminating
  19268. `NUL') is always returned, even if ERRBUF_SIZE is zero.
  19269.  
  19270. 
  19271. File: libc.inf,  Node: regexec,  Next: regfree,  Prev: regerror,  Up: Alphabetical List
  19272.  
  19273. regexec
  19274. =======
  19275.  
  19276. Syntax
  19277. ------
  19278.  
  19279.      #include <sys/types.h>
  19280.      #include <regex.h>
  19281.      
  19282.      int regexec(const regex_t *preg, const char *string,
  19283.                  size_t nmatch, regmatch_t pmatch[], int eflags);
  19284.  
  19285. Description
  19286. -----------
  19287.  
  19288. `regexec' matches the compiled RE pointed to by PREG against the
  19289. STRING, subject to the flags in EFLAGS, and reports results using
  19290. NMATCH, PMATCH, and the returned value.  The RE must have been compiled
  19291. by a previous invocation of `regcomp' (*note regcomp::.).  The compiled
  19292. form is not altered during execution of `regexec', so a single compiled
  19293. RE can be used simultaneously by multiple threads.
  19294.  
  19295. By default, the NUL-terminated string pointed to by STRING is
  19296. considered to be the text of an entire line, minus any terminating
  19297. newline.
  19298.  
  19299. The EFLAGS argument is the bitwise OR of zero or more of the following
  19300. flags:
  19301.  
  19302. `REG_NOTBOL'
  19303.      The first character of the string is not the beginning of a line,
  19304.      so the `^' anchor should not match before it.  This does not
  19305.      affect the behavior of newlines under `REG_NEWLINE' (REG_NEWLINE,
  19306.      *note regcomp::.).
  19307.  
  19308. `REG_NOTEOL'
  19309.      The NUL terminating the string does not end a line, so the `$'
  19310.      anchor should not match before it.  This does not affect the
  19311.      behavior of newlines under `REG_NEWLINE' (REG_NEWLINE, *note
  19312.      regcomp::.).
  19313.  
  19314. `REG_STARTEND'
  19315.      The string is considered to start at STRING + PMATCH[0].RM_SO and
  19316.      to have a terminating `NUL' located at STRING + PMATCH[0].RM_EO
  19317.      (there need not actually be a `NUL' at that location), regardless
  19318.      of the value of NMATCH.  See below for the definition of PMATCH
  19319.      and NMATCH.  This is an extension, compatible with but not
  19320.      specified by POSIX 1003.2, and should be used with caution in
  19321.      software intended to be portable to other systems.  Note that a
  19322.      non-zero `rm_so' does not imply `REG_NOTBOL'; `REG_STARTEND'
  19323.      affects only the location of the string, not how it is matched.
  19324.  
  19325. `REG_TRACE'
  19326.      trace execution (printed to stdout)
  19327.  
  19328. `REG_LARGE'
  19329.      force large representation
  19330.  
  19331. `REG_BACKR'
  19332.      force use of backref code
  19333.  
  19334. Regular Expressions' Syntax, *Note regcomp::, for a discussion of what
  19335. is matched in situations where an RE or a portion thereof could match
  19336. any of several substrings of STRING.
  19337.  
  19338. If `REG_NOSUB' was specified in the compilation of the RE (REG_NOSUB,
  19339. *note regcomp::.), or if NMATCH is 0, `regexec' ignores the PMATCH
  19340. argument (but see below for the case where `REG_STARTEND' is
  19341. specified).  Otherwise, PMATCH should point to an array of NMATCH
  19342. structures of type `regmatch_t'.  Such a structure has at least the
  19343. members `rm_so' and `rm_eo', both of type `regoff_t' (a signed
  19344. arithmetic type at least as large as an `off_t' and a `ssize_t',
  19345. containing respectively the offset of the first character of a
  19346. substring and the offset of the first character after the end of the
  19347. substring.  Offsets are measured from the beginning of the STRING
  19348. argument given to `regexec'.  An empty substring is denoted by equal
  19349. offsets, both indicating the character following the empty substring.
  19350.  
  19351. When `regexec' returns, the 0th member of the PMATCH array is filled in
  19352. to indicate what substring of STRING was matched by the entire RE.
  19353. Remaining members report what substring was matched by parenthesized
  19354. subexpressions within the RE; member `i' reports subexpression `i',
  19355. with subexpressions counted (starting at 1) by the order of their
  19356. opening parentheses in the RE, left to right.  Unused entries in the
  19357. array--corresponding either to subexpressions that did not participate
  19358. in the match at all, or to subexpressions that do not exist in the RE
  19359. (that is, `i > preg->re_nsub'--have both `rm_so' and `rm_eo' set to
  19360. `-1'.  If a subexpression participated in the match several times, the
  19361. reported substring is the last one it matched.  (Note, as an example in
  19362. particular, that when the RE `(b*)+' matches `bbb', the parenthesized
  19363. subexpression matches each of the three `b's and then an infinite
  19364. number of empty strings following the last `b', so the reported
  19365. substring is one of the empties.)
  19366.  
  19367. If `REG_STARTEND' is specified in EFLAGS, PMATCH must point to at least
  19368. one `regmatch_t' variable (even if NMATCH is 0 or `REG_NOSUB' was
  19369. specified in the compilation of the RE, REG_NOSUB, *note regcomp::.),
  19370. to hold the input offsets for `REG_STARTEND'.  Use for output is still
  19371. entirely controlled by NMATCH; if NMATCH is 0 or `REG_NOSUB' was
  19372. specified, the value of `pmatch[0]' will not be changed by a successful
  19373. `regexec'.
  19374.  
  19375. NMATCH exceeding 0 is expensive; NMATCH exceeding 1 is worse.  Back
  19376. references are massively expensive.
  19377.  
  19378. Return Value
  19379. ------------
  19380.  
  19381. Normally, `regexec' returns 0 for success and the non-zero code
  19382. `REG_NOMATCH' for failure.  Other non-zero error codes may be returned
  19383. in exceptional situations.  The list of possible error return values is
  19384. below:
  19385.  
  19386. `REG_ESPACE'
  19387.      ran out of memory
  19388.  
  19389. `REG_BADPAT'
  19390.      the passed argument PREG doesn't point to an RE compiled by
  19391.      `regcomp'
  19392.  
  19393. `REG_INVARG'
  19394.      invalid argument(s) (e.g., STRING + PMATCH[0].RM_EO is less than
  19395.      STRING + PMATCH[0].RM_SO)
  19396.  
  19397. 
  19398. File: libc.inf,  Node: regfree,  Next: remove,  Prev: regexec,  Up: Alphabetical List
  19399.  
  19400. regfree
  19401. =======
  19402.  
  19403. Syntax
  19404. ------
  19405.  
  19406.  
  19407.      #include <sys/types.h>
  19408.      #include <regex.h>
  19409.      
  19410.      void regfree(regex_t *preg);
  19411.  
  19412. Description
  19413. -----------
  19414.  
  19415. `regfree' frees any dynamically-allocated storage associated with the
  19416. compiled RE pointed to by PREG.  The remaining `regex_t' is no longer a
  19417. valid compiled RE and the effect of supplying it to `regexec' or
  19418. `regerror' is undefined.
  19419.  
  19420. 
  19421. File: libc.inf,  Node: remove,  Next: remque,  Prev: regfree,  Up: Alphabetical List
  19422.  
  19423. remove
  19424. ======
  19425.  
  19426. Syntax
  19427. ------
  19428.  
  19429.      #include <stdio.h>
  19430.      
  19431.      int remove(const char *file);
  19432.  
  19433. Description
  19434. -----------
  19435.  
  19436. This function removes the named FILE from the file system.  Unless you
  19437. have an un-erase program, the file and its contents are gone for good.
  19438.  
  19439. Return Value
  19440. ------------
  19441.  
  19442. Zero on success, nonzero on failure.
  19443.  
  19444. Example
  19445. -------
  19446.  
  19447.      remove("/tmp/data.tmp");
  19448.  
  19449. 
  19450. File: libc.inf,  Node: remque,  Next: _rename,  Prev: remove,  Up: Alphabetical List
  19451.  
  19452. remque
  19453. ======
  19454.  
  19455. Syntax
  19456. ------
  19457.  
  19458.      #include <search.h>
  19459.      
  19460.      void putenv(struct qelem *elem);
  19461.  
  19462. Description
  19463. -----------
  19464.  
  19465. This function manipulates queues built from doubly linked lists.  Each
  19466. element in the queue must be in the form of `struct qelem' which is
  19467. defined thus:
  19468.  
  19469.      struct qelem {
  19470.        struct qelem *q_forw;
  19471.        struct qelem *q_back;
  19472.        char q_data[0];
  19473.      }
  19474.  
  19475. This function removes the entry ELEM from a queue.
  19476.  
  19477. Return Value
  19478. ------------
  19479.  
  19480. None.
  19481.  
  19482. 
  19483. File: libc.inf,  Node: _rename,  Next: rename,  Prev: remque,  Up: Alphabetical List
  19484.  
  19485. _rename
  19486. =======
  19487.  
  19488. Syntax
  19489. ------
  19490.  
  19491.      #include <stdio.h>
  19492.      
  19493.      int _rename(const char *oldname, const char *newname);
  19494.  
  19495. Description
  19496. -----------
  19497.  
  19498. This function renames an existing file or directory OLDNAME to NEWNAME.
  19499. It is much smaller that `rename' (*note rename::.), but it can only
  19500. rename a directory so it stays under the same perent, it cannot move
  19501. directories between different branches of the directory tree.  This
  19502. means that in the following example, the first call will succeed, while
  19503. the second will fail:
  19504.  
  19505.      _rename("c:/path1/mydir", "c:/path1/yourdir");
  19506.      _rename("c:/path1/mydir", "c:/path2");
  19507.  
  19508. On systems that support long filenames (*note _use_lfn::.), `_rename'
  19509. can also move directories (so that both calls in the above example
  19510. succeed there), unless the `LFN' environment variable is set to `n', or
  19511. the `_CRT0_FLAG_NO_LFN' is set in the `_crt0_startup_flags' variable,
  19512. *Note _crt0_startup_flags::.
  19513.  
  19514. If you don't need the extra functionality offered by `rename' (which
  19515. usually is only expected by Unix-born programs), you can use `_rename'
  19516. instead and thus make your program a lot smaller.
  19517.  
  19518. Return Value
  19519. ------------
  19520.  
  19521. Zero on success, nonzero on failure.
  19522.  
  19523. 
  19524. File: libc.inf,  Node: rename,  Next: rewind,  Prev: _rename,  Up: Alphabetical List
  19525.  
  19526. rename
  19527. ======
  19528.  
  19529. Syntax
  19530. ------
  19531.  
  19532.      #include <stdio.h>
  19533.      
  19534.      int rename(const char *oldname, const char *newname);
  19535.  
  19536. Description
  19537. -----------
  19538.  
  19539. This function renames an existing file or directory OLDNAME to NEWNAME.
  19540. If NEWNAME exists, then it is first removed.  If NEWNAME is a
  19541. directory, it must be empty (or else ERRNO will be set to `ENOTEMPTY'),
  19542. and must not include OLDNAME in its path prefix (otherwise, ERRNO will
  19543. be set to `EINVAL').  If NEWNAME exists, both OLDNAME and NEWNAME must
  19544. be of the same type (both directories or both regular files) (or else
  19545. ERRNO will be set to `ENOTDIR' or `EISDIR'), and must reside on the
  19546. same logical device (otherwise, ERRNO will be set to `EXDEV').
  19547. Wildcards are not allowed in either OLDNAME or NEWNAME.  DOS won't
  19548. allow renaming a current directory even on a non-default drive (you
  19549. will get the `EBUSY' or `EINVAL' in ERRNO).  `ENAMETOOLONG' will be
  19550. returned for pathnames which are longer than the limit imposed by DOS.
  19551. If OLDNAME doesn't exist, ERRNO will be set to `ENOENT'.  For most of
  19552. the other calamities, DOS will usually set ERRNO to `EACCES'.
  19553.  
  19554. If anything goes wrong during the operation of `rename()', the function
  19555. tries very hard to leave the things as ther were before it was invoked,
  19556. but it might not always succeed.
  19557.  
  19558. Return Value
  19559. ------------
  19560.  
  19561. Zero on success, nonzero on failure.
  19562.  
  19563. Example
  19564. -------
  19565.  
  19566.      rename("c:/mydir/some.doc", "c:/yourdir/some.sav");
  19567.      rename("c:/path1/mydir", "c:/path2");
  19568.  
  19569. 
  19570. File: libc.inf,  Node: rewind,  Next: rewinddir,  Prev: rename,  Up: Alphabetical List
  19571.  
  19572. rewind
  19573. ======
  19574.  
  19575. Syntax
  19576. ------
  19577.  
  19578.      #include <stdio.h>
  19579.      
  19580.      void rewind(FILE *file);
  19581.  
  19582. Description
  19583. -----------
  19584.  
  19585. This function repositions the file pointer to the beginning of the file
  19586. and clears the error indicator.
  19587.  
  19588. Return Value
  19589. ------------
  19590.  
  19591. None.
  19592.  
  19593. Example
  19594. -------
  19595.  
  19596.      rewind(stdin);
  19597.  
  19598. 
  19599. File: libc.inf,  Node: rewinddir,  Next: rindex,  Prev: rewind,  Up: Alphabetical List
  19600.  
  19601. rewinddir
  19602. =========
  19603.  
  19604. Syntax
  19605. ------
  19606.  
  19607.      #include <dirent.h>
  19608.      
  19609.      void rewinddir(DIR *dir);
  19610.  
  19611. Description
  19612. -----------
  19613.  
  19614. This function resets the position of the DIR so that the next call to
  19615. `readdir' (*note readdir::.) starts at the beginning again.
  19616.  
  19617. Return Value
  19618. ------------
  19619.  
  19620. None.
  19621.  
  19622. Example
  19623. -------
  19624.  
  19625.      DIR *d = opendir(".");
  19626.      rewinddir(d);
  19627.  
  19628. 
  19629. File: libc.inf,  Node: rindex,  Next: rmdir,  Prev: rewinddir,  Up: Alphabetical List
  19630.  
  19631. rindex
  19632. ======
  19633.  
  19634. Syntax
  19635. ------
  19636.  
  19637.      #include <strings.h>
  19638.      
  19639.      char *rindex(const char *string, int ch);
  19640.  
  19641. Description
  19642. -----------
  19643.  
  19644. Returns a pointer to the last occurrence of CH in STRING.  Note that
  19645. the `NULL' character counts, so if you pass zero as CH you'll get a
  19646. pointer to the end of the string back.
  19647.  
  19648. Return Value
  19649. ------------
  19650.  
  19651. A pointer to the character, or `NULL' if it wasn't found.
  19652.  
  19653. Example
  19654. -------
  19655.  
  19656.      char *last_slash = rindex(filename, '/');
  19657.  
  19658. 
  19659. File: libc.inf,  Node: rmdir,  Next: sbrk,  Prev: rindex,  Up: Alphabetical List
  19660.  
  19661. rmdir
  19662. =====
  19663.  
  19664. Syntax
  19665. ------
  19666.  
  19667.      #include <unistd.h>
  19668.      
  19669.      int rmdir(const char *dirname);
  19670.  
  19671. Description
  19672. -----------
  19673.  
  19674. This function removes directory DIRNAME.  The directory must be empty.
  19675.  
  19676. Return Value
  19677. ------------
  19678.  
  19679. Zero if the directory was removed, nonzero on failure.
  19680.  
  19681. Example
  19682. -------
  19683.  
  19684.      rmdir("/tmp/datadir");
  19685.  
  19686. 
  19687. File: libc.inf,  Node: sbrk,  Next: scanf,  Prev: rmdir,  Up: Alphabetical List
  19688.  
  19689. sbrk
  19690. ====
  19691.  
  19692. Syntax
  19693. ------
  19694.  
  19695.      #include <unistd.h>
  19696.      
  19697.      void *sbrk(int delta)
  19698.  
  19699. Description
  19700. -----------
  19701.  
  19702. This function changes the "break" of the program by adding DELTA to it.
  19703. This is the highest address that your program can access without
  19704. causing a violation.  Since the heap is the region under the break, you
  19705. can expand the heap (where `malloc' gets memory from) by increasing the
  19706. break.
  19707.  
  19708. This function is normally accessed only bu `malloc' (*note malloc::.).
  19709.  
  19710. Return Value
  19711. ------------
  19712.  
  19713. The address of the first byte outside of the previous valid address
  19714. range, or -1 if no more memory could be accessed.  In other words, a
  19715. pointer to the chunk of heap you just allocated, if you had passed a
  19716. positive number.
  19717.  
  19718. Example
  19719. -------
  19720.  
  19721.      char *buf;
  19722.      buf = sbrk(1000); /* allocate space */
  19723.  
  19724. 
  19725. File: libc.inf,  Node: scanf,  Next: Screen Variables,  Prev: sbrk,  Up: Alphabetical List
  19726.  
  19727. scanf
  19728. =====
  19729.  
  19730. Syntax
  19731. ------
  19732.  
  19733.      #include <stdio.h>
  19734.      
  19735.      int scanf(const char *format, ...);
  19736.  
  19737. Description
  19738. -----------
  19739.  
  19740. This function scans formatted text from `stdin' and stores it in the
  19741. variables pointed to by the arguments.  *Note scanf::.
  19742.  
  19743. The format string contains regular characters which much match the input
  19744. exactly as well as a conversion specifiers, which begin with a percent
  19745. symbol.  Any whitespace in the format string matches zero or more of any
  19746. whitespace characters in the input.  Thus, a single space may match a
  19747. newline and two tabs in the input.  All conversions except `c' and `['
  19748. also skip leading whitespace automatically.  Each conversion specifier
  19749. contains the following fields:
  19750.  
  19751.    *  An asterisk (`*') which indicates that the input should be
  19752.      converted according to the conversion spec, but not stored
  19753.      anywhere.
  19754.  
  19755.    *  A width specifier, which specifies the maximum number of input
  19756.      characters to use in the conversion.
  19757.  
  19758.    *  An optional conversion qualifier, which may be `h' to specify
  19759.      `short', `l' to specify long ints, or `L' to specify long doubles.
  19760.      Long long type can be specified by `L' or `ll'.
  19761.  
  19762.    *  The conversion type specifier:
  19763.  
  19764.     `c'
  19765.           Copy the next character (or WIDTH characters) to the given
  19766.           buffer.
  19767.  
  19768.     `d'
  19769.           Convert the input to a signed integer.
  19770.  
  19771.     `e'
  19772.     `E'
  19773.     `f'
  19774.     `g'
  19775.     `G'
  19776.           Convert the input to a floating point number.
  19777.  
  19778.     `i'
  19779.           Convert the input, determining base automatically by the
  19780.           presence of `0x' or `0' prefixes.  *Note strtol::.
  19781.  
  19782.     `n'
  19783.           Store the number of characters scanned so far into the
  19784.           integer pointed to.
  19785.  
  19786.     `o'
  19787.           Convert the input to a signed integer, using base 8.
  19788.  
  19789.     `p'
  19790.           Convert the input to a pointer.  This is like using the `x'
  19791.           format.
  19792.  
  19793.     `s'
  19794.           Copy the input to the given string, skipping leading
  19795.           whitespace and copying non-whitespace characters up to the
  19796.           next whitespace.  The string stored is then `NULL'-terminated.
  19797.  
  19798.     `u'
  19799.           Convert the input to an unsigned integer.
  19800.  
  19801.     `x'
  19802.     `X'
  19803.           Convert the input to an unsigned integer, using base 16.
  19804.  
  19805.     `[...]'
  19806.           Like the `c' format, except only certain characters are
  19807.           copied.  The characters between the brackets determine which
  19808.           characters are allowed, and thus when the copying stops.
  19809.           These characters may be regular characters (example:
  19810.           `[abcd]') or a range of characters (example: `[a-d]').  If
  19811.           the first character is a caret (`^'), then the set specifies
  19812.           the set of characters that do not get copied (i.e.  the set
  19813.           is negated).  To specify that the set contains a
  19814.           close-bracket (`]'), list that as the first regular character.
  19815.  
  19816.     `%'
  19817.           This must match a percent character in the input.
  19818.  
  19819. Most conversions make use of `strtol' or `strtoul' to perform the
  19820. actual conversions.
  19821.  
  19822. Return Value
  19823. ------------
  19824.  
  19825. The number of items successfully matched and assigned. If input ends
  19826. before first item is assigned, EOF is returned.
  19827.  
  19828. Example
  19829. -------
  19830.  
  19831.      int x, y;
  19832.      char buf[100];
  19833.      scanf("%d %d %s", &x, &y, buf);
  19834.      
  19835.      /* read to end-of-line */
  19836.      scanf("%d %[^\n]\n", &x, buf);
  19837.      /* read letters only */
  19838.      scanf("[a-zA-Z]", buf);
  19839.  
  19840. 
  19841. File: libc.inf,  Node: Screen Variables,  Next: ScreenClear,  Prev: scanf,  Up: Alphabetical List
  19842.  
  19843. Screen Variables
  19844. ================
  19845.  
  19846. Syntax
  19847. ------
  19848.  
  19849.      #include <go32.h>
  19850.      #include <pc.h>
  19851.      
  19852.      unsigned long ScreenPrimary;
  19853.      unsigned long ScreenSecondary;
  19854.      extern unsigned char ScreenAttrib;
  19855.  
  19856. Description
  19857. -----------
  19858.  
  19859. The first two variables (actually, they are #define'd aliases to fields
  19860. in the _GO32_INFO_BLOCK structure *note _go32_info_block::.) allow
  19861. access to the video memory of the primary and secondary screens as if
  19862. they were arrays.  To reference them, you must use
  19863. dosmemget()/dosmemput() functions (*Note dosmemget::, *Note
  19864. dosmemput::) or any one of the far pointer functions (*note _far*::.),
  19865. as the video memory is *not* mapped into your default address space.
  19866.  
  19867. The variable ScreenAttrib holds the current attribute which is in use by
  19868. the text screen writes.  The attribute is constructed as follows:
  19869.  
  19870. bits 0-3  - foreground color;
  19871.  
  19872. bits 4-6  - background color;
  19873.  
  19874. bit  7    - blink on (1) or off (0).
  19875.  
  19876. Example
  19877. -------
  19878.  
  19879. _farpokew(_dos_ds, ScreenPrimary, ( ((unsigned short) attr) << 8) +
  19880. char ));
  19881.  
  19882.  
  19883. 
  19884. File: libc.inf,  Node: ScreenClear,  Next: ScreenCols,  Prev: Screen Variables,  Up: Alphabetical List
  19885.  
  19886. ScreenClear
  19887. ===========
  19888.  
  19889. Syntax
  19890. ------
  19891.  
  19892.      #include <pc.h>
  19893.      
  19894.      void  ScreenClear(void);
  19895.  
  19896. Description
  19897. -----------
  19898.  
  19899. This function clears the text screen.  It overwrites it by blanks with
  19900. the current background and foreground as specified by ScreenAttrib
  19901. (*note Screen Variables::.).
  19902.  
  19903. Return Value
  19904. ------------
  19905.  
  19906. None.
  19907.  
  19908. Example
  19909. -------
  19910.  
  19911.      ScreenClear();
  19912.  
  19913. 
  19914. File: libc.inf,  Node: ScreenCols,  Next: ScreenGetChar,  Prev: ScreenClear,  Up: Alphabetical List
  19915.  
  19916. ScreenCols
  19917. ==========
  19918.  
  19919. Syntax
  19920. ------
  19921.  
  19922.      #include <pc.h>
  19923.      
  19924.      int ScreenCols(void);
  19925.  
  19926. Description
  19927. -----------
  19928.  
  19929. This function returns the number of columns of the screen.  It does so
  19930. by looking at the byte at the absolute address 40:4Ah in the BIOS area.
  19931. In text modes, the meaning of number of columns is obvious; in graphics
  19932. modes, this value is the number of columns of text available when using
  19933. the video BIOS functions to write text.
  19934.  
  19935. Return Value
  19936. ------------
  19937.  
  19938. The number of columns.
  19939.  
  19940. Example
  19941. -------
  19942.  
  19943.  
  19944.      int available_columns = ScreenCols();
  19945.  
  19946. 
  19947. File: libc.inf,  Node: ScreenGetChar,  Next: ScreenGetCursor,  Prev: ScreenCols,  Up: Alphabetical List
  19948.  
  19949. ScreenGetChar
  19950. =============
  19951.  
  19952. Syntax
  19953. ------
  19954.  
  19955.      #include <pc.h>
  19956.      
  19957.      void  ScreenGetChar(int *ch, int *attr, int col, int row);
  19958.  
  19959. Description
  19960. -----------
  19961.  
  19962. This function stores the character and attribute of the current primary
  19963. screen at row given by ROW and column given by COL (these are
  19964. zero-based) into the integers whose address is specified by CH and
  19965. ATTR.  It does so by directly accessing the video memory, so it will
  19966. only work when the screen is in text mode.  You can pass the value
  19967. `NULL' in each of the pointers if you do not want to retrieve the the
  19968. corresponding information.
  19969.  
  19970. Return Value
  19971. ------------
  19972.  
  19973. None.
  19974.  
  19975. Example
  19976. -------
  19977.  
  19978.      int ch, attr;
  19979.      
  19980.      ScreenGetChar(&ch, &attr, 0, 0);
  19981.  
  19982. 
  19983. File: libc.inf,  Node: ScreenGetCursor,  Next: ScreenMode,  Prev: ScreenGetChar,  Up: Alphabetical List
  19984.  
  19985. ScreenGetCursor
  19986. ===============
  19987.  
  19988. Syntax
  19989. ------
  19990.  
  19991.      #include <pc.h>
  19992.      
  19993.      void  ScreenGetCursor(int *row, int *column);
  19994.  
  19995. Description
  19996. -----------
  19997.  
  19998. This function retrieves the current cursor position of the default video
  19999. page by calling function 3 of the interrupt 10h, and stores it in the
  20000. variables pointed by ROW and COLUMN.
  20001.  
  20002. Return Value
  20003. ------------
  20004.  
  20005. None.
  20006.  
  20007. Example
  20008. -------
  20009.  
  20010.      ScreenGetCursor(&wherex, &wherey);
  20011.  
  20012. 
  20013. File: libc.inf,  Node: ScreenMode,  Next: ScreenPutChar,  Prev: ScreenGetCursor,  Up: Alphabetical List
  20014.  
  20015. ScreenMode
  20016. ==========
  20017.  
  20018. Syntax
  20019. ------
  20020.  
  20021.      #include <pc.h>
  20022.      
  20023.      int  ScreenMode(void);
  20024.  
  20025. Description
  20026. -----------
  20027.  
  20028. This function reports the current video mode as known to the system
  20029. BIOS.  It does so by accessing the byte at absolute address 40:49h.
  20030.  
  20031. Return Value
  20032. ------------
  20033.  
  20034. The video mode.
  20035.  
  20036. Example
  20037. -------
  20038.  
  20039.      video_mode = ScreenMode();
  20040.  
  20041. 
  20042. File: libc.inf,  Node: ScreenPutChar,  Next: ScreenPutString,  Prev: ScreenMode,  Up: Alphabetical List
  20043.  
  20044. ScreenPutChar
  20045. =============
  20046.  
  20047. Syntax
  20048. ------
  20049.  
  20050.      #include <pc.h>
  20051.      
  20052.      void  ScreenPutChar(int ch, int attr, int col, int row);
  20053.  
  20054. Description
  20055. -----------
  20056.  
  20057. This function writes the character whose value is specified in CH with
  20058. an attribute ATTR at row given by ROW and column given by COL, which
  20059. are zero-based.  It does so by directly accessing the video memory, so
  20060. it will only work when the screen is in text mode.
  20061.  
  20062. Return Value
  20063. ------------
  20064.  
  20065. None.
  20066.  
  20067. Example
  20068. -------
  20069.  
  20070.      ScreenPutChar('R', (BLUE << 4) | LIGHTMAGENTA, 75, 0);
  20071.  
  20072. 
  20073. File: libc.inf,  Node: ScreenPutString,  Next: ScreenRetrieve,  Prev: ScreenPutChar,  Up: Alphabetical List
  20074.  
  20075. ScreenPutString
  20076. ===============
  20077.  
  20078. Syntax
  20079. ------
  20080.  
  20081.      #include <pc.h>
  20082.      
  20083.      void  ScreenPutString(const char *str, int attr, int column, int row);
  20084.  
  20085. Description
  20086. -----------
  20087.  
  20088. Beginning at screen position given by COLUMN and ROW, this function
  20089. displays the string given by STR.  Each string character gets the
  20090. attribute given by ATTR.  If COLUMN or ROW have values outside legal
  20091. range for current video mode, nothing happens.  The variables ROW and
  20092. COLUMN are zero-based (e.g., the topmost row is row 0).
  20093.  
  20094. Return Value
  20095. ------------
  20096.  
  20097. None.
  20098.  
  20099. Example
  20100. -------
  20101.  
  20102.      ScreenPutString("Hello, world!", (BLUE << 4) | LIGHTBLUE, 20, 10);
  20103.  
  20104. 
  20105. File: libc.inf,  Node: ScreenRetrieve,  Next: ScreenRows,  Prev: ScreenPutString,  Up: Alphabetical List
  20106.  
  20107. ScreenRetrieve
  20108. ==============
  20109.  
  20110. Syntax
  20111. ------
  20112.  
  20113.      #include <pc.h>
  20114.      
  20115.      void  ScreenRetrieve(void *buf);
  20116.  
  20117. Description
  20118. -----------
  20119.  
  20120. This function stores a replica of the current primary screen contents in
  20121. the buffer pointed to by BUF.  It assumes without checking that BUF has
  20122. enough storage to hold the data.  The required storage can be computed
  20123. as `ScreenRows()*ScreenCols()*2' (*Note ScreenRows::, *Note
  20124. ScreenCols::).
  20125.  
  20126. Return Value
  20127. ------------
  20128.  
  20129. None.
  20130.  
  20131. Example
  20132. -------
  20133.  
  20134.      unsigned *saved_screen = (unsigned *)alloca(ScreenRows()*ScreenCols()*2;
  20135.      
  20136.      ScreenRetrieve(saved_screen);
  20137.  
  20138. 
  20139. File: libc.inf,  Node: ScreenRows,  Next: ScreenSetCursor,  Prev: ScreenRetrieve,  Up: Alphabetical List
  20140.  
  20141. ScreenRows
  20142. ==========
  20143.  
  20144. Syntax
  20145. ------
  20146.  
  20147.      #include <pc.h>
  20148.      
  20149.      int ScreenRows(void);
  20150.  
  20151. Description
  20152. -----------
  20153.  
  20154. This function returns the number of rows of the text screen.  It does so
  20155. by looking at the byte at the absolute address 40:84h in the BIOS area.
  20156. This method works only for video adapters with their own BIOS
  20157. extensions, like EGA, VGA, SVGA etc.
  20158.  
  20159. Return Value
  20160. ------------
  20161.  
  20162. The number of rows.
  20163.  
  20164. Example
  20165. -------
  20166.  
  20167.  
  20168.      int rows = ScreenRows();
  20169.  
  20170. 
  20171. File: libc.inf,  Node: ScreenSetCursor,  Next: ScreenUpdate,  Prev: ScreenRows,  Up: Alphabetical List
  20172.  
  20173. ScreenSetCursor
  20174. ===============
  20175.  
  20176. Syntax
  20177. ------
  20178.  
  20179.      #include <pc.h>
  20180.      
  20181.      void  ScreenSetCursor(int  row, int  column);
  20182.  
  20183. Description
  20184. -----------
  20185.  
  20186. This function moves the cursor position on the default video page to the
  20187. point given by (zero-based) ROW and COLUMN, by calling function 2 of
  20188. interrupt 10h.
  20189.  
  20190. Return Value
  20191. ------------
  20192.  
  20193. None.
  20194.  
  20195. Example
  20196. -------
  20197.  
  20198.      ScreenSetCursor(0, 0);   /* home the cursor */
  20199.  
  20200. 
  20201. File: libc.inf,  Node: ScreenUpdate,  Next: ScreenUpdateLine,  Prev: ScreenSetCursor,  Up: Alphabetical List
  20202.  
  20203. ScreenUpdate
  20204. ============
  20205.  
  20206. Syntax
  20207. ------
  20208.  
  20209.      #include <pc.h>
  20210.      
  20211.      void  ScreenUpdate(void *buf);
  20212.  
  20213. Description
  20214. -----------
  20215.  
  20216. This function writes the contents of the buffer BUF to the primary
  20217. screen.  The buffer should contain an exact replica of the video memory,
  20218. including the characters and their attributes.
  20219.  
  20220. Return Value
  20221. ------------
  20222.  
  20223. None.
  20224.  
  20225. Example
  20226. -------
  20227.  
  20228.      ScreenUpdate(saved_screen);
  20229.  
  20230. 
  20231. File: libc.inf,  Node: ScreenUpdateLine,  Next: ScreenVisualBell,  Prev: ScreenUpdate,  Up: Alphabetical List
  20232.  
  20233. ScreenUpdateLine
  20234. ================
  20235.  
  20236. Syntax
  20237. ------
  20238.  
  20239.      #include <pc.h>
  20240.      
  20241.      void  ScreenUpdateLine(void *buf, int row);
  20242.  
  20243. Description
  20244. -----------
  20245.  
  20246. This function writes the contents of BUF to the screen line number
  20247. given in ROW (the topmost line is row 0), on the primary screen.
  20248.  
  20249. Return Value
  20250. ------------
  20251.  
  20252. None.
  20253.  
  20254. Example
  20255. -------
  20256.  
  20257.      ScreenUpdateLine(line_buf, 10);
  20258.  
  20259. 
  20260. File: libc.inf,  Node: ScreenVisualBell,  Next: searchpath,  Prev: ScreenUpdateLine,  Up: Alphabetical List
  20261.  
  20262. ScreenVisualBell
  20263. ================
  20264.  
  20265. Syntax
  20266. ------
  20267.  
  20268.      #include <pc.h>
  20269.      
  20270.      void  ScreenVisualBell(void);
  20271.  
  20272. Description
  20273. -----------
  20274.  
  20275. This function flashes the screen colors to produce the effect of "visual
  20276. bell'.  It does so by momentarily inverting the colors of every
  20277. character on the screen.
  20278.  
  20279. Return Value
  20280. ------------
  20281.  
  20282. None.
  20283.  
  20284. Example
  20285. -------
  20286.  
  20287.      ScreenVisualBell();
  20288.  
  20289. 
  20290. File: libc.inf,  Node: searchpath,  Next: seekdir,  Prev: ScreenVisualBell,  Up: Alphabetical List
  20291.  
  20292. searchpath
  20293. ==========
  20294.  
  20295. Syntax
  20296. ------
  20297.  
  20298.      #include <dir.h>
  20299.      
  20300.      char * searchpath(const char *file);
  20301.  
  20302. Description
  20303. -----------
  20304.  
  20305. Given a name of a file in FILE, searches for that file in a list of
  20306. directories, including the current working directory and those defined
  20307. in the PATH environment variable.
  20308.  
  20309. Return Value
  20310. ------------
  20311.  
  20312. When successfull, the function returns a pointer to a static buffer
  20313. where the full pathname of the found file is stored.  Otherwise, it
  20314. returns NULL.
  20315.  
  20316. Example
  20317. -------
  20318.  
  20319.        printf("%s was found as %s\n", argv[1], searchpath(argv[1]));
  20320.  
  20321. 
  20322. File: libc.inf,  Node: seekdir,  Next: select,  Prev: searchpath,  Up: Alphabetical List
  20323.  
  20324. seekdir
  20325. =======
  20326.  
  20327. Syntax
  20328. ------
  20329.  
  20330.      #include <dirent.h>
  20331.      
  20332.      void seekdir(DIR *dir, long loc);
  20333.  
  20334. Description
  20335. -----------
  20336.  
  20337. This function sets the location pointer in DIR to the specified LOC.
  20338. Note that the value used for LOC should be either zero or a value
  20339. returned by `telldir' (*note telldir::.).  The next call to `readdir'
  20340. (*note readdir::.) will read whatever entry follows that point in the
  20341. directory.
  20342.  
  20343. Return Value
  20344. ------------
  20345.  
  20346. None.
  20347.  
  20348. Example
  20349. -------
  20350.  
  20351.      int q = telldir(dir);
  20352.      do_stuff();
  20353.      seekdir(dir, q);
  20354.  
  20355. 
  20356. File: libc.inf,  Node: select,  Next: _set_screen_lines,  Prev: seekdir,  Up: Alphabetical List
  20357.  
  20358. select
  20359. ======
  20360.  
  20361. Syntax
  20362. ------
  20363.  
  20364.      #include <time.h>
  20365.      
  20366.      int
  20367.      select(int nfds,
  20368.          fd_set *readfds,
  20369.          fd_set *writefds,
  20370.          fd_set *exceptfds,
  20371.          struct timeval *timeout)
  20372.  
  20373. Description
  20374. -----------
  20375.  
  20376. This function waits for files to be ready for input or output, or for a
  20377. timeout.  Each fd_set represents a set of bits representing file
  20378. descriptors.  The following macros shall be used to deal with these
  20379. sets:
  20380.  
  20381. `FD_ZERO(p)'
  20382.      Initialize the set to all zeros.
  20383.  
  20384. `FD_SET(n, p)'
  20385.      Set member N in set P.
  20386.  
  20387. `FD_CLR(n, p)'
  20388.      Clear member N in set P.
  20389.  
  20390. `FD_ISSET(n, p)'
  20391.      Return the value of member N in set P.
  20392.  
  20393. The TIMEOUT value may be a NULL pointer (no timeout), a pointer to a
  20394. zero-value structure (poll mode), or a pointer to an interval-filled
  20395. structure (timeout).
  20396.  
  20397. Return Value
  20398. ------------
  20399.  
  20400. The number of files ready.  The input sets are replaced with sets that
  20401. describe which files are ready for which operations.
  20402.  
  20403. 
  20404. File: libc.inf,  Node: _set_screen_lines,  Next: setbuf,  Prev: select,  Up: Alphabetical List
  20405.  
  20406. _set_screen_lines
  20407. =================
  20408.  
  20409. Syntax
  20410. ------
  20411.  
  20412.      #include <conio.h>
  20413.      void _set_screen_lines(int nlines);
  20414.  
  20415. Description
  20416. -----------
  20417.  
  20418. This function sets the text screen width to 80 and its height to the
  20419. value given by NLINES, which can be one of the following: 25, 28, 35,
  20420. 40, 43 or 50.  On a CGA, only 25-line screen is supported.  On an EGA,
  20421. you can use 25, 35 and 43.  VGA, PGA and MCGA support all of the
  20422. possible dimensions.  The number of columns (i.e., screen width) is 80
  20423. for all of the above resolutions, because the standard EGA/VGA has no
  20424. way of changing it.  After this function returns, calls to
  20425. `gettextinfo()' will return the actual screen dimensions as set by
  20426. `_set_screen_lines()'.  That is, you can e.g. test whether
  20427. `_set_screen_lines()' succeeded by checking the screen height returned
  20428. by `gettextinfo()' against the desired height.  This function has a
  20429. side effect of erasing the screen contents, so application programs
  20430. which use it should make their own arrangements to redisplay it.
  20431.  
  20432. 
  20433. File: libc.inf,  Node: setbuf,  Next: setbuffer,  Prev: _set_screen_lines,  Up: Alphabetical List
  20434.  
  20435. setbuf
  20436. ======
  20437.  
  20438. Syntax
  20439. ------
  20440.  
  20441.      #include <stdio.h>
  20442.      
  20443.      void setbuf(FILE *file, char *buffer);
  20444.  
  20445. Description
  20446. -----------
  20447.  
  20448. This function modifies the buffering characteristics of FILE.  First,
  20449. if the file already has a buffer, it is freed.  If there was any
  20450. pending data in it, it is lost, so this function should only be used
  20451. immediately after a call to `fopen'.
  20452.  
  20453. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  20454. non-`NULL' buffer is passed, it must be at least `BUFSIZ' bytes in
  20455. size, and the file is set to fully buffered.
  20456.  
  20457. *Note setbuffer::.  *Note setlinebuf::.  *Note setvbuf::.
  20458.  
  20459. Return Value
  20460. ------------
  20461.  
  20462. None.
  20463.  
  20464. Example
  20465. -------
  20466.  
  20467.      setbuf(stdout, malloc(BUFSIZ));
  20468.  
  20469. 
  20470. File: libc.inf,  Node: setbuffer,  Next: setcbrk,  Prev: setbuf,  Up: Alphabetical List
  20471.  
  20472. setbuffer
  20473. =========
  20474.  
  20475. Syntax
  20476. ------
  20477.  
  20478.      #include <stdio.h>
  20479.      
  20480.      void setbuffer(FILE *file, char *buffer, int length);
  20481.  
  20482. Description
  20483. -----------
  20484.  
  20485. This function modifies the buffering characteristics of FILE.  First,
  20486. if the file already has a buffer, it is freed.  If there was any
  20487. pending data in it, it is lost, so this function should only be used
  20488. immediately after a call to `fopen'.
  20489.  
  20490. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  20491. non-`NULL' buffer is passed, it must be at least SIZE bytes in size,
  20492. and the file is set to fully buffered.
  20493.  
  20494. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  20495.  
  20496. Return Value
  20497. ------------
  20498.  
  20499. None.
  20500.  
  20501. Example
  20502. -------
  20503.  
  20504.      setbuffer(stdout, malloc(10000), 10000);
  20505.  
  20506. 
  20507. File: libc.inf,  Node: setcbrk,  Next: _setcursortype,  Prev: setbuffer,  Up: Alphabetical List
  20508.  
  20509. setcbrk
  20510. =======
  20511.  
  20512. Syntax
  20513. ------
  20514.  
  20515.      #include <dos.h>
  20516.      
  20517.      void setcbrk(int check);
  20518.  
  20519. Description
  20520. -----------
  20521.  
  20522. Set the setting of the Ctrl-Break checking flag in MS-DOS.  If CHECK is
  20523. zero, checking is not done.  If nonzero, checking is done.
  20524.  
  20525. Return Value
  20526. ------------
  20527.  
  20528. None.
  20529.  
  20530. 
  20531. File: libc.inf,  Node: _setcursortype,  Next: setdate,  Prev: setcbrk,  Up: Alphabetical List
  20532.  
  20533. _setcursortype
  20534. ==============
  20535.  
  20536. Syntax
  20537. ------
  20538.  
  20539.      #include <conio.h>
  20540.      
  20541.      void _setcursortype(int _type);
  20542.  
  20543. Description
  20544. -----------
  20545.  
  20546. Sets the cursor type.  _TYPE is one of the following:
  20547.  
  20548. `_NOCURSOR'
  20549.      No cursor is displayed.
  20550.  
  20551. `_SOLIDCURSOR'
  20552.      A solid block is displayed.
  20553.  
  20554. `_NORMALCURSOR'
  20555.      An underline cursor is displayed.
  20556.  
  20557. 
  20558. File: libc.inf,  Node: setdate,  Next: setdisk,  Prev: _setcursortype,  Up: Alphabetical List
  20559.  
  20560. setdate
  20561. =======
  20562.  
  20563. Syntax
  20564. ------
  20565.  
  20566.      #include <dos.h>
  20567.      
  20568.      void setdate(struct date *ptr);
  20569.  
  20570. Description
  20571. -----------
  20572.  
  20573. This function sets the current time.
  20574.  
  20575. *Note getdate::. *Note settime::.
  20576.  
  20577. Return Value
  20578. ------------
  20579.  
  20580. None.
  20581.  
  20582. Example
  20583. -------
  20584.  
  20585.      struct date d;
  20586.      setdate(&d);
  20587.  
  20588. 
  20589. File: libc.inf,  Node: setdisk,  Next: setenv,  Prev: setdate,  Up: Alphabetical List
  20590.  
  20591. setdisk
  20592. =======
  20593.  
  20594. Syntax
  20595. ------
  20596.  
  20597.      #include <dir.h>
  20598.      
  20599.      int setdisk(int drive);
  20600.  
  20601. Description
  20602. -----------
  20603.  
  20604. This function sets the current disk (0=A).
  20605.  
  20606. *Note getdisk::
  20607.  
  20608. Return Value
  20609. ------------
  20610.  
  20611. The total number of possible drives.
  20612.  
  20613. Example
  20614. -------
  20615.  
  20616.      printf("There are %d drives\n", setdisk(getdisk()));
  20617.  
  20618. 
  20619. File: libc.inf,  Node: setenv,  Next: setftime,  Prev: setdisk,  Up: Alphabetical List
  20620.  
  20621. setenv
  20622. ======
  20623.  
  20624. Syntax
  20625. ------
  20626.  
  20627.      #include <stdlib.h>
  20628.      
  20629.      int setenv(const char *name, const char *value, int rewrite);
  20630.  
  20631. Description
  20632. -----------
  20633.  
  20634. This function sets the environment variable NAME to VALUE.  If REWRITE
  20635. is set, then this function will replace any existing value.  If it is
  20636. not set, it will only put the variable into the environment if that
  20637. variable isn't already defined.
  20638.  
  20639. Return Value
  20640. ------------
  20641.  
  20642. Zero on success, -1 on failure.
  20643.  
  20644. 
  20645. File: libc.inf,  Node: setftime,  Next: setgrent,  Prev: setenv,  Up: Alphabetical List
  20646.  
  20647. setftime
  20648. ========
  20649.  
  20650. Syntax
  20651. ------
  20652.  
  20653.      #include <dos.h>
  20654.      
  20655.      int setftime(int handle, struct ftime *ftimep);
  20656.  
  20657. Description
  20658. -----------
  20659.  
  20660. This function sets the modification time of a file.  Note that since
  20661. writing to a file, and closing a file opened for writing, also sets the
  20662. modification time, you should only use this function on files opened for
  20663. reading.
  20664.  
  20665. *Note getftime::.
  20666.  
  20667. Return Value
  20668. ------------
  20669.  
  20670. Zero on success, nonzero on failure.
  20671.  
  20672. Example
  20673. -------
  20674.  
  20675.      int q = open("data.txt", O_RDONLY);
  20676.      struct ftime f;
  20677.      f.ft_sec = f.ft_min = f.ft_hour = f.ft_day = f.ft_month = f.ft_year = 0;
  20678.      setftime(q, &f);
  20679.      close(q);
  20680.  
  20681. 
  20682. File: libc.inf,  Node: setgrent,  Next: setitimer,  Prev: setftime,  Up: Alphabetical List
  20683.  
  20684. setgrent
  20685. ========
  20686.  
  20687. Syntax
  20688. ------
  20689.  
  20690.      #include <grp.h>
  20691.      
  20692.      void setgrent(void);
  20693.  
  20694. Description
  20695. -----------
  20696.  
  20697. This function should be called before any call to `getgrent',
  20698. `getgrgid', or `getgrnam', to start searching the groups' list from the
  20699. beginning.  *Note getgrent::.
  20700.  
  20701. Return Value
  20702. ------------
  20703.  
  20704. None.
  20705.  
  20706. 
  20707. File: libc.inf,  Node: setitimer,  Next: setjmp,  Prev: setgrent,  Up: Alphabetical List
  20708.  
  20709. setitimer
  20710. =========
  20711.  
  20712. Syntax
  20713. ------
  20714.  
  20715.      #include <sys/time.h>
  20716.      
  20717.      struct itimerval {
  20718.        struct timeval it_interval;    /* timer interval */
  20719.        struct timeval it_value;       /* current value */
  20720.      };
  20721.      
  20722.      int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
  20723.  
  20724. Description
  20725. -----------
  20726.  
  20727. Each process has two interval timers, ITIMER_REAL and ITIMER_PROF, which
  20728. signal SIGALRM and SIGPROF respectively.  These are typically used to
  20729. provide alarm() and profiling capabilities.
  20730.  
  20731. This function changes the current value of the interval timer specified
  20732. by WHICH to the values in structure VALUE.  The previous value of the
  20733. timer is returned if OVALUE is not NULL.  When the timer expires the
  20734. appropriate signal is raised.
  20735.  
  20736. A timer is defined by the itimerval structure.  If it_value is non-zero
  20737. it specifies the time to the next timer expiration.  If it_interval is
  20738. non-zero it specifies the value to reload into it_value on timer
  20739. expiration.  Setting it_value to zero disables a timer.  Setting
  20740. it_interval to zero causes the timer to only happen once instead of
  20741. repeating.
  20742.  
  20743. Return Value
  20744. ------------
  20745.  
  20746. Returns 0 on success, -1 on failure (and sets errno).
  20747.  
  20748. 
  20749. File: libc.inf,  Node: setjmp,  Next: setlinebuf,  Prev: setitimer,  Up: Alphabetical List
  20750.  
  20751. setjmp
  20752. ======
  20753.  
  20754. Syntax
  20755. ------
  20756.  
  20757.      #include <setjmp.h>
  20758.      
  20759.      int setjmp(jmp_buf j);
  20760.  
  20761. Description
  20762. -----------
  20763.  
  20764. This function stores the complete CPU state into J.  This information
  20765. is complete enough that `longjmp' (*note longjmp::.) can return the
  20766. program to that state.  It is also complete enough to implement
  20767. coroutines.
  20768.  
  20769. Return Value
  20770. ------------
  20771.  
  20772. This function will return zero if it is returning from it's own call.
  20773. If longjmp is used to restore the state, it will return whatever value
  20774. was passed to longjmp, except if zero is passed to longjmp it will
  20775. return one.
  20776.  
  20777. Example
  20778. -------
  20779.  
  20780.      jmp_buf j;
  20781.      if (setjmp(j))
  20782.        return;
  20783.      do_something();
  20784.      longjmp(j);
  20785.  
  20786. 
  20787. File: libc.inf,  Node: setlinebuf,  Next: setlocale,  Prev: setjmp,  Up: Alphabetical List
  20788.  
  20789. setlinebuf
  20790. ==========
  20791.  
  20792. Syntax
  20793. ------
  20794.  
  20795.      #include <stdio.h>
  20796.      
  20797.      void setlinebuf(FILE *file);
  20798.  
  20799. Description
  20800. -----------
  20801.  
  20802. This function modifies the buffering characteristics of FILE.  First,
  20803. if the file already has a buffer, it is freed.  If there was any
  20804. pending data in it, it is lost, so this function should only be used
  20805. immediately after a call to `fopen'.
  20806.  
  20807. Next, a buffer is allocated and the file is set to line buffering.
  20808.  
  20809. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  20810.  
  20811. Return Value
  20812. ------------
  20813.  
  20814. None.
  20815.  
  20816. Example
  20817. -------
  20818.  
  20819.      setlinebuf(stderr);
  20820.  
  20821. 
  20822. File: libc.inf,  Node: setlocale,  Next: setmntent,  Prev: setlinebuf,  Up: Alphabetical List
  20823.  
  20824. setlocale
  20825. =========
  20826.  
  20827. Syntax
  20828. ------
  20829.  
  20830.      #include <locale.h>
  20831.      
  20832.      char *setlocale(int category, const char *locale);
  20833.  
  20834. Description
  20835. -----------
  20836.  
  20837. This function sets part or all of the current locale.  The CATEGORY is
  20838. one of the following:
  20839.  
  20840. `LC_ALL'
  20841.      Set all parts of the locale.
  20842.  
  20843. `LC_COLLATE'
  20844.      Set the collating information.
  20845.  
  20846. `LC_CTYPE'
  20847.      Set the character type information.
  20848.  
  20849. `LC_MONETARY'
  20850.      Set the monetary formatting information.
  20851.  
  20852. `LC_NUMERIC'
  20853.      Set the numeric formatting information.
  20854.  
  20855. `LC_TIME'
  20856.      Set the time formatting information.
  20857.  
  20858. The LOCALE should be the name of the current locale.  Currently, only
  20859. the "C" and "POSIX" locales are supported.  If the LOCALE is NULL, no
  20860. action is performed.  If LOCALE is "", the locale is identified by
  20861. environment variables (currently not supported).
  20862.  
  20863. *Note localeconv::.
  20864.  
  20865. Return Value
  20866. ------------
  20867.  
  20868. A static string naming the current locale for the given category, or
  20869. NULL if the requested locale is not supported.
  20870.  
  20871. Example
  20872. -------
  20873.  
  20874.      setlocale(LC_ALL, "C");
  20875.  
  20876. 
  20877. File: libc.inf,  Node: setmntent,  Next: setmode,  Prev: setlocale,  Up: Alphabetical List
  20878.  
  20879. setmntent
  20880. =========
  20881.  
  20882. Syntax
  20883. ------
  20884.  
  20885.      #include <mntent.h>
  20886.      
  20887.      FILE *setmntent(char *filename, const char *mode);
  20888.  
  20889. Description
  20890. -----------
  20891.  
  20892. This function returns an open FILE* pointer which can be used by
  20893. getmntent (*note getmntent::.).  The arguments FILENAME and MODE are
  20894. always ignored under MS-DOS, but for portability should be set,
  20895. accordingly, to the name of the file which describes the mounted
  20896. filesystems and the open mode of that file (like the MODE argument to
  20897. `fopen', *Note fopen::).  (There is no single standard for the name of
  20898. the file that keeps the mounted filesystems, but it is usually,
  20899. although not always, listed in the header `<mntent.h>'.)
  20900.  
  20901. Return Value
  20902. ------------
  20903.  
  20904. The FILE* pointer is returned.  For MS-DOS, this FILE* is not a real
  20905. pointer and may only be used by `getmntent'.
  20906.  
  20907. Example
  20908. -------
  20909.  
  20910.      #include <mntent.h>
  20911.      #if defined(MNT_MNTTAB)
  20912.      #define MNTTAB_FILE MNT_MNTTAB
  20913.      #elif defined(MNTTABNAME)
  20914.      #define MNTTAB_FILE MNTTABNAME
  20915.      #else
  20916.      #define MNTTAB_FILE "/etc/mnttab"
  20917.      #endif
  20918.      
  20919.        FILE *mnt_fp = setmntent (MNTTAB_FILE, "r");
  20920.  
  20921. 
  20922. File: libc.inf,  Node: setmode,  Next: setpgid,  Prev: setmntent,  Up: Alphabetical List
  20923.  
  20924. setmode
  20925. =======
  20926.  
  20927. Syntax
  20928. ------
  20929.  
  20930.      #include <io.h>
  20931.      
  20932.      int setmode(int file, int mode);
  20933.  
  20934. Description
  20935. -----------
  20936.  
  20937. This function sets the mode of the given FILE to MODE, which is either
  20938. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  20939. or raw mode accordingly, and set any `FILE*' objects that use this file
  20940. into text or binary mode.
  20941.  
  20942. When called to put FILE that refers to the console into binary mode,
  20943. `setmode' will disable the generation of `SIGINT' when you press
  20944. `Ctrl-C' (`Ctrl-Break' will still cause `SIGINT'), because many
  20945. programs that use binary reads from the console will also want to get
  20946. the `^C' characters.  You can use the `__djgpp_set_ctrl_c' library
  20947. function (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to generate
  20948. interrupts while console is read in binary mode.
  20949.  
  20950. Note that, for buffered streams (`FILE*'), you must call `fflush'
  20951. (*note fflush::.) before `setmode', or call `setmode' before writing
  20952. anything to the file, for proper operation.
  20953.  
  20954. Return Value
  20955. ------------
  20956.  
  20957. When successful, the function will return the previous mode of the
  20958. given FILE.  In case of failure, -1 is returned and ERRNO is set.
  20959.  
  20960. Example
  20961. -------
  20962.  
  20963.      setmode(0, O_BINARY);
  20964.  
  20965. 
  20966. File: libc.inf,  Node: setpgid,  Next: setpwent,  Prev: setmode,  Up: Alphabetical List
  20967.  
  20968. setpgid
  20969. =======
  20970.  
  20971. Syntax
  20972. ------
  20973.  
  20974.      #include <unistd.h>
  20975.      
  20976.      int setpgid(pid_t _pid, pid_t _pgid);
  20977.  
  20978. Return Value
  20979. ------------
  20980.  
  20981. -1 (EPERM) if _pgid is not your current pid, else zero.
  20982.  
  20983. 
  20984. File: libc.inf,  Node: setpwent,  Next: setrlimit,  Prev: setpgid,  Up: Alphabetical List
  20985.  
  20986. setpwent
  20987. ========
  20988.  
  20989. Syntax
  20990. ------
  20991.  
  20992.      #include <pwd.h>
  20993.      
  20994.      void setpwent(void);
  20995.  
  20996. Description
  20997. -----------
  20998.  
  20999. This function reinitializes `getpwent' so that scanning will start from
  21000. the start of the list.  *Note getpwent::.
  21001.  
  21002. Return Value
  21003. ------------
  21004.  
  21005. None.
  21006.  
  21007. 
  21008. File: libc.inf,  Node: setrlimit,  Next: settime,  Prev: setpwent,  Up: Alphabetical List
  21009.  
  21010. setrlimit
  21011. =========
  21012.  
  21013. Syntax
  21014. ------
  21015.  
  21016.      #include <sys/resource.h>
  21017.      
  21018.      int setrlimit (int rltype, const struct rlimit *rlimitp);
  21019.  
  21020. Description
  21021. -----------
  21022.  
  21023. This function sets new limit pointed to by RLIMITP on the resourece
  21024. limit specified by RLTYPE.  Note that currently it always fail.
  21025.  
  21026. Return Value
  21027. ------------
  21028.  
  21029. Zero on success, nonzero on failure.
  21030.  
  21031. 
  21032. File: libc.inf,  Node: settime,  Next: settimeofday,  Prev: setrlimit,  Up: Alphabetical List
  21033.  
  21034. settime
  21035. =======
  21036.  
  21037. Syntax
  21038. ------
  21039.  
  21040.      #include <dos.h>
  21041.      
  21042.      void settime(struct time *ptr);
  21043.  
  21044. Description
  21045. -----------
  21046.  
  21047. This function sets the current time.
  21048.  
  21049. *Note gettime::. *Note setdate::.
  21050.  
  21051. Return Value
  21052. ------------
  21053.  
  21054. None.
  21055.  
  21056. Example
  21057. -------
  21058.  
  21059.      struct time t;
  21060.      settime(&t);
  21061.  
  21062. 
  21063. File: libc.inf,  Node: settimeofday,  Next: setvbuf,  Prev: settime,  Up: Alphabetical List
  21064.  
  21065. settimeofday
  21066. ============
  21067.  
  21068. Syntax
  21069. ------
  21070.  
  21071.      #include <time.h>
  21072.      
  21073.      int settimeofday(struct timeval *tp, ...);
  21074.  
  21075. Description
  21076. -----------
  21077.  
  21078. Sets the current GMT time.  For compatibility, a second argument is
  21079. accepted.  *Note gettimeofday:: for information on the structure types.
  21080.  
  21081. Return Value
  21082. ------------
  21083.  
  21084. Zero if the time was set, nonzero on error.
  21085.  
  21086. 
  21087. File: libc.inf,  Node: setvbuf,  Next: siglongjmp,  Prev: settimeofday,  Up: Alphabetical List
  21088.  
  21089. setvbuf
  21090. =======
  21091.  
  21092. Syntax
  21093. ------
  21094.  
  21095.      #include <stdio.h>
  21096.      
  21097.      int setvbuf(FILE *file, char *buffer, int type, int length);
  21098.  
  21099. Description
  21100. -----------
  21101.  
  21102. This function modifies the buffering characteristics of FILE.  First,
  21103. if the file already has a buffer, it is freed.  If there was any
  21104. pending data in it, it is lost, so this function should only be used
  21105. immediately after a call to `fopen'.
  21106.  
  21107. If the TYPE is `_IONBF', the BUFFER and LENGTH are ignored and the file
  21108. is set to unbuffered mode.
  21109.  
  21110. If the TYPE is `_IOLBF' or `_IOFBF', then the file is set to line or
  21111. fully buffered, respectively.  If BUFFER is `NULL', a buffer of size
  21112. SIZE is created and used as the buffer.  If BUFFER is non-`NULL', it
  21113. must point to a buffer of at least size SIZE and will be used as the
  21114. buffer.
  21115.  
  21116. *Note setbuf::.  *Note setbuffer::.  *Note setlinebuf::.
  21117.  
  21118. Return Value
  21119. ------------
  21120.  
  21121. Zero on success, nonzero on failure.
  21122.  
  21123. Example
  21124. -------
  21125.  
  21126.      setbuf(stderr, NULL, _IOLBF, 1000);
  21127.  
  21128. 
  21129. File: libc.inf,  Node: siglongjmp,  Next: signal,  Prev: setvbuf,  Up: Alphabetical List
  21130.  
  21131. siglongjmp
  21132. ==========
  21133.  
  21134. Syntax
  21135. ------
  21136.  
  21137.      #include <setjmp.h>
  21138.      
  21139.      int    siglongjmp(sigjmp_buf env, int val);
  21140.  
  21141. Description
  21142. -----------
  21143.  
  21144. *Note longjmp::.
  21145.  
  21146. 
  21147. File: libc.inf,  Node: signal,  Next: sigsetjmp,  Prev: siglongjmp,  Up: Alphabetical List
  21148.  
  21149. signal
  21150. ======
  21151.  
  21152. Syntax
  21153. ------
  21154.  
  21155.      #include <signal.h>
  21156.      
  21157.      void    (*signal(int sig, void (*func)(int)))(int);
  21158.  
  21159. Description
  21160. -----------
  21161.  
  21162. Signals are generated in response to some exceptional behavior of the
  21163. program, such as division by 0.  A signal can also report some
  21164. asynchronous event outside the program, such as someone pressing a
  21165. Ctrl-Break key combination.
  21166.  
  21167. Signals are numbered 0..255 for software interrupts and 256..287 for
  21168. exceptions (exception number plus 256); other implementation-specific
  21169. codes are specified in `<signal.h>' (see below).  Every signal is given
  21170. a mnemonic which you should use for portable programs.
  21171.  
  21172. The default handling for all the signals is to print a traceback (a
  21173. stack dump which describes the sequence of function calls leading to the
  21174. generation of the signal) and abort the program.
  21175.  
  21176. This function allows you to change the default behavior for a specific
  21177. signal.  It registers FUNC as a signal handler for signal number SIG.
  21178. After you register your function as the handler for a particular
  21179. signal, it will be called when that signal occurs.  The execution of
  21180. the program will be suspended until the handler returns or calls
  21181. `longjmp' (*note longjmp::.).
  21182.  
  21183. You may pass SIG_DFL as the value of FUNC to reset the signal handling
  21184. for the signal SIG to default (also *Note __djgpp_exception_toggle::,
  21185. for a quick way to restore all the signals' handling to default),
  21186. SIG_ERR to force an error when that signal happens, or SIG_IGN to
  21187. ignore that signal.  Signal handlers that you write are regular C
  21188. functions, and may call any function that the ANSI/POSIX specs say are
  21189. valid for signal handlers.  For maximum portability, a handler for
  21190. hardware interrupts and processor exceptions should only make calls to
  21191. `signal', assign values to data objects of type `volatile sig_atomic_t'
  21192. (defined as `int' on `<signal.h>') and return.  Handlers for hardware
  21193. interrupts need also be locked in memory (so that the operation of
  21194. virtual memory mechanism won't swap them out), *Note locking memory
  21195. regions: __dpmi_lock_linear_region.  Handlers for software interrupts
  21196. can also terminate by calling `abort', `exit' or `longjmp'.
  21197.  
  21198. The following signals are defined on `<signal.h>':
  21199.  
  21200. `SIGABRT'
  21201.      The Abort signal.  Currently only used by the `assert' macro to
  21202.      terminate the program when an assertion fails (*note assert::.).
  21203.  
  21204. `SIGFPE'
  21205.      The Floating Point Error signal.  Generated in case of divide by
  21206.      zero exception (Int 00h), overflow exception (Int 04h), and any x87
  21207.      co-processor exception, either generated by the CPU (Int 10h), or
  21208.      by the co-processor itself (Int 75h).
  21209.  
  21210. `SIGILL'
  21211.      The Invalid Execution signal.  Currently only generated for
  21212.      unknown/invalid exceptions.
  21213.  
  21214. `SIGINT'
  21215.      The Interrupt signal.  Generated when a `Ctrl-C' or `Ctrl-Break'
  21216.      (Int 1Bh) key is hit.  Note that when you open the console in
  21217.      binary mode, or switch it to binary mode by a call to `setmode'
  21218.      (*note setmode::.), generation of `SIGINT' as result of `Ctrl-C'
  21219.      key is disabled.  This is so for programs (such as Emacs) which
  21220.      want to be able to read the `^C' character as any other character.
  21221.      Use the library function `__djgpp_set_ctrl_c' to restore `SIGINT'
  21222.      generation when `Ctrl-C' is hit, if you need this.  *Note
  21223.      __djgpp_set_ctrl_c::, for details on how this should be done.
  21224.      `Ctrl-Break' always generates `SIGINT'.
  21225.  
  21226.      DJGPP hooks the keyboard hardware interrupt (Int 09h) to be able to
  21227.      generate `SIGINT' in response to `Ctrl-C' key; you should be aware
  21228.      of this when you install a handler for the keyboard interrupt.
  21229.  
  21230. `SIGSEGV'
  21231.      The invalid storage access (Segmentation Violation) signal.
  21232.      Generated in response to any of the following exceptions: Bound
  21233.      range exceeded in BOUND instruction (Int 05h), Double Exception or
  21234.      an exception in the exception handler (Int 08h), Segment Boundary
  21235.      violation by co-processor (Int 09h), Segment Not Present (Int
  21236.      0Bh), Stack Fault (Int 0Ch), General Protection Violation (Int
  21237.      0Dh), or Page Fault (Int 0Eh).  Note that Int 09h is only
  21238.      generated on 80386 processor; i486 and later CPUs cause Int 0Dh
  21239.      when the co-processor accesses memory out of bounds.
  21240.  
  21241. `SIGTERM'
  21242.      The Termination Request signal.  Currently unused.
  21243.  
  21244.      The signals below this are not defined by ANSI C, and cannot be
  21245.      used when compiling under `-ansi' option to `gcc'.
  21246.  
  21247. `SIGALRM'
  21248.      The Alarm signal.  Generated after certain time period has passed
  21249.      after a call to `alarm' library function (*note alarm::.).
  21250.  
  21251. `SIGHUP'
  21252.      The Hang-up signal.  Currently unused.
  21253.  
  21254. `SIGKILL'
  21255.      The Kill signal.  Currently unused.
  21256.  
  21257. `SIGPIPE'
  21258.      The Broken Pipe signal.  Currently unused.
  21259.  
  21260. `SIGQUIT'
  21261.      The Quit signal.  Currently unused.
  21262.  
  21263. `SIGUSR1'
  21264.      User-defined signal no. 1.
  21265.  
  21266. `SIGUSR2'
  21267.      User-defined signal no. 2.
  21268.  
  21269.      The signals below are not defined by ANSI C and POSIX, and cannot
  21270.      be used when compiling under either `-ansi' or `-posix' options to
  21271.      `gcc'.
  21272.  
  21273. `SIGTRAP'
  21274.      The Trap Instruction signal.  Generated in response to the Debugger
  21275.      Exception (Int 01h) or Breakpoint Exception (Int 03h).
  21276.  
  21277. `SIGNOFP'
  21278.      The No Co-processor signal.  Generated if a co-processor
  21279.      (floating-point) instruction is encountered when no co-processor
  21280.      is installed (Int 07h).
  21281.  
  21282. `SIGTIMR'
  21283.      The Timer signal.  Used by the `setitimer' and `alarm' functions
  21284.      (*Note setitimer::, *Note alarm::).
  21285.  
  21286. `SIGPROF'
  21287.      The Profiler signal.  Used by the execution profile gathering code
  21288.      in a program compiled with `-pg' option to `gcc'.
  21289.  
  21290. Return Value
  21291. ------------
  21292.  
  21293. The previous handler for signal SIG, or `SIG_ERR' if the value of SIG
  21294. is outside legal limits.
  21295.  
  21296. Signal Mechanism Implementation Notes
  21297. -------------------------------------
  21298.  
  21299. Due to subtle aspects of protected-mode programs operation under MS-DOS,
  21300. signal handlers cannot be safely called from hardware interrupt
  21301. handlers.  Therefore, DJGPP exception-handling mechanism arranges for
  21302. the signal handler to be called on the first occasion that the program
  21303. is in protected mode and touches any of its data.  This means that if
  21304. the exception occurs while the processor is in real mode, like when your
  21305. program calls some DOS service, the signal handler won't be called until
  21306. that call returns.  For instance, if you call `read' (or `scanf', or
  21307. `gets') to read text from the console and press `Ctrl-C', you will have
  21308. to press `Enter' to terminate the `read' call to cause the signal
  21309. handler for `SIGINT' to be called.  Another significant implication of
  21310. this implementation is that when the program isn't touching any of its
  21311. data (like in very tight loops which only use values in the registers),
  21312. it cannot be interrupted.
  21313.  
  21314. 
  21315. File: libc.inf,  Node: sigsetjmp,  Next: sin,  Prev: signal,  Up: Alphabetical List
  21316.  
  21317. sigsetjmp
  21318. =========
  21319.  
  21320. Syntax
  21321. ------
  21322.  
  21323.      #include <setjmp.h>
  21324.      
  21325.      int    sigsetjmp(sigjmp_buf env, int savemask);
  21326.  
  21327. Description
  21328. -----------
  21329.  
  21330. *Note setjmp::.
  21331.  
  21332. 
  21333. File: libc.inf,  Node: sin,  Next: sinh,  Prev: sigsetjmp,  Up: Alphabetical List
  21334.  
  21335. sin
  21336. ===
  21337.  
  21338. Syntax
  21339. ------
  21340.  
  21341.      #include <math.h>
  21342.      
  21343.      double sin(double x);
  21344.  
  21345. Return Value
  21346. ------------
  21347.  
  21348. The sine of X.
  21349.  
  21350. 
  21351. File: libc.inf,  Node: sinh,  Next: sleep,  Prev: sin,  Up: Alphabetical List
  21352.  
  21353. sinh
  21354. ====
  21355.  
  21356. Syntax
  21357. ------
  21358.  
  21359.      #include <math.h>
  21360.      
  21361.      double sinh(double x);
  21362.  
  21363. Return Value
  21364. ------------
  21365.  
  21366. The hyperbolic sine of X.
  21367.  
  21368. 
  21369. File: libc.inf,  Node: sleep,  Next: sound,  Prev: sinh,  Up: Alphabetical List
  21370.  
  21371. sleep
  21372. =====
  21373.  
  21374. Syntax
  21375. ------
  21376.  
  21377.      #include <unistd.h>
  21378.      
  21379.      unsigned sleep(unsigned seconds);
  21380.  
  21381. Description
  21382. -----------
  21383.  
  21384. This function causes the program to pause for SECONDS seconds.
  21385.  
  21386. Return Value
  21387. ------------
  21388.  
  21389. The number of seconds that haven't passed (i.e. always zero)
  21390.  
  21391. Example
  21392. -------
  21393.  
  21394.      sleep(5);
  21395.  
  21396. 
  21397. File: libc.inf,  Node: sound,  Next: spawn*,  Prev: sleep,  Up: Alphabetical List
  21398.  
  21399. sound
  21400. =====
  21401.  
  21402. Syntax
  21403. ------
  21404.  
  21405.      #include <pc.h>
  21406.      
  21407.      void        sound(int _frequency);
  21408.  
  21409. Description
  21410. -----------
  21411.  
  21412. Enables the PC speaker at the given frequency.
  21413.  
  21414. 
  21415. File: libc.inf,  Node: spawn*,  Next: sprintf,  Prev: sound,  Up: Alphabetical List
  21416.  
  21417. spawn*
  21418. ======
  21419.  
  21420. Syntax
  21421. ------
  21422.  
  21423.      #include <process.h>
  21424.      
  21425.      int spawnl(int mode, const char *path, const char *argv0, ...);
  21426.      int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  21427.      int spawnlp(int mode, const char *path, const char *argv0, ...);
  21428.      int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  21429.      
  21430.      int spawnv(int mode, const char *path, const char **argv);
  21431.      int spawnve(int mode, const char *path, const char **argv, const char **envp);
  21432.      int spawnvp(int mode, const char *path, const char **argv);
  21433.      int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  21434.  
  21435. Description
  21436. -----------
  21437.  
  21438. These functions run other programs.  The PATH points to the program to
  21439. run.  The extension is optional--if not given, and PATH is not found
  21440. neither in the current directly nor along the `PATH', the extensions
  21441. `.com', `.exe', `.bat', `.btm', `.sh', and `.ksh' are checked.  `.com'
  21442. programs are invoked via the usual DOS calls; DJGPP `.exe' programs are
  21443. invoked in a way that allows long command lines to be passed; other
  21444. `.exe' programs are invoked via DOS; `.bat' and `.btm' programs are
  21445. invoked via the command processor given by the `COMSPEC' environment
  21446. variable; `.sh', `.ksh' programs and programs with any other extensions
  21447. that have `#!' as their first two caharacters are assumed to be
  21448. Unix-style scripts and are invoked by calling a program whose pathname
  21449. immediately follows the first two characters.  (If the name of that
  21450. program is a Unix-style pathname, without a drive letter and without an
  21451. extension, like `/bin/sh', the `spawn' functions will additionally look
  21452. them up on the `PATH'; this allows to run Unix scripts without editing,
  21453. if you have a shell installed somewhere along your `PATH'.)
  21454.  
  21455. Note that built-in commands of the shells can *not* be invoked via
  21456. these functions; use `system' instead.
  21457.  
  21458. The programs are invoked with the arguments given.  The zeroth argument
  21459. is normally not used, since MS-DOS cannot pass it separately.  There are
  21460. two ways of passing arguments.  The `l' functions (like `spawnl') take
  21461. a list of arguments, with a zero at the end of the list.  This is
  21462. useful when you know how many argument there will be ahead of time.
  21463. The `v' functions (like `spawnv') take a pointer to a list of
  21464. arguments.  This is useful when you need to compute the number of
  21465. arguments at runtime.
  21466.  
  21467. In either case, you may also specify `e' to indicate that you will be
  21468. giving an explicit environment, else the current environment is used.
  21469. You may also specify `p' to indicate that you would like `spawn*' to
  21470. search the PATH (in either the environment you pass or the current
  21471. environment) for the executable, else it will only check the explicit
  21472. path given.
  21473.  
  21474. Note that these function understand about other DJGPP programs, and will
  21475. call them directly, so that you can pass command lines longer than 126
  21476. characters to them without any special code.  DJGPP programs called by
  21477. these functions will *not* glob the arguments passed to them; other
  21478. programs also won't glob the arguments if they suppress expansion when
  21479. given quoted filenames.
  21480.  
  21481. *Note exec*::.
  21482.  
  21483. Return Value
  21484. ------------
  21485.  
  21486. If successful and `mode' is `P_WAIT', these functions return the exit
  21487. code of the child process in the lower 8 bits of the return value.
  21488. Note that if the program is run by a command processor (e.g., if it's a
  21489. batch file), the exit code of that command processor will be returned.
  21490. `COMMAND.COM' is notorious for returning 0 even if it couldn't run the
  21491. command.
  21492.  
  21493. If successful and MODE is `P_OVERLAY', these functions will not return.
  21494.  
  21495. If there is an error (e.g., the program specified as `argv[0]' cannot
  21496. be run, or the command line is too long), these functions return -1 and
  21497. set `errno' to indicate the error.  If the child program was
  21498. interrupted by <Ctrl-C> or a Critical Device error, `errno' is set to
  21499. `EINTR' (even if the child's exit code is 0), and bits 8-17 of the
  21500. return value are set to `SIGINT' or `SIGABRT', accordingly.  Note that
  21501. you must set the signal handler for `SIGINT' to `SIG_IGN', or arrange
  21502. for the handler to return, or else your program will be aborted before
  21503. it will get chance to set the value of the return code.
  21504.  
  21505. Example
  21506. -------
  21507.  
  21508.  
  21509.      char *environ[] = {
  21510.        "PATH=c:\\dos;c:\\djgpp;c:\\usr\\local\\bin",
  21511.        "DJGPP=c:/djgpp",
  21512.        0
  21513.      };
  21514.      
  21515.      char *args[] = {
  21516.        "gcc",
  21517.        "-v",
  21518.        "hello.c",
  21519.        0
  21520.      };
  21521.      
  21522.      spawnvpe(P_WAIT, "gcc", args, environ);
  21523.  
  21524. 
  21525. File: libc.inf,  Node: sprintf,  Next: sqrt,  Prev: spawn*,  Up: Alphabetical List
  21526.  
  21527. sprintf
  21528. =======
  21529.  
  21530. Syntax
  21531. ------
  21532.  
  21533.      #include <stdio.h>
  21534.      
  21535.      int sprintf(char *buffer, const char *format, ...);
  21536.  
  21537. Description
  21538. -----------
  21539.  
  21540. Sends formatted output from the arguments (...) to the BUFFER.  *Note
  21541. printf::.
  21542.  
  21543. Return Value
  21544. ------------
  21545.  
  21546. The number of characters written.
  21547.  
  21548. 
  21549. File: libc.inf,  Node: sqrt,  Next: srandom,  Prev: sprintf,  Up: Alphabetical List
  21550.  
  21551. sqrt
  21552. ====
  21553.  
  21554. Syntax
  21555. ------
  21556.  
  21557.      #include <math.h>
  21558.      
  21559.      double sqrt(double x);
  21560.  
  21561. Return Value
  21562. ------------
  21563.  
  21564. The square root of X.
  21565.  
  21566. 
  21567. File: libc.inf,  Node: srandom,  Next: sscanf,  Prev: sqrt,  Up: Alphabetical List
  21568.  
  21569. srandom
  21570. =======
  21571.  
  21572. Syntax
  21573. ------
  21574.  
  21575.      #include <stdlib.h>
  21576.      
  21577.      int srandom(int seed);
  21578.  
  21579. Description
  21580. -----------
  21581.  
  21582. This function initialized the random number generator (*note random::.).
  21583. Passing the same SEED results in `random' returning predictable
  21584. sequences of numbers.
  21585.  
  21586. Return Value
  21587. ------------
  21588.  
  21589. Zero.
  21590.  
  21591. Example
  21592. -------
  21593.  
  21594.      srandom(45);
  21595.  
  21596. 
  21597. File: libc.inf,  Node: sscanf,  Next: stat,  Prev: srandom,  Up: Alphabetical List
  21598.  
  21599. sscanf
  21600. ======
  21601.  
  21602. Syntax
  21603. ------
  21604.  
  21605.      #include <stdio.h>
  21606.      
  21607.      int sscanf(const char *string, const char *format, ...);
  21608.  
  21609. Description
  21610. -----------
  21611.  
  21612. This function scans formatted text from the STRING and stores it in the
  21613. variables pointed to by the arguments.  *Note scanf::.
  21614.  
  21615. Return Value
  21616. ------------
  21617.  
  21618. The number of items successfully scanned.
  21619.  
  21620. 
  21621. File: libc.inf,  Node: stat,  Next: statfs,  Prev: sscanf,  Up: Alphabetical List
  21622.  
  21623. stat
  21624. ====
  21625.  
  21626. Syntax
  21627. ------
  21628.  
  21629.      #include <sys/stat.h>
  21630.      
  21631.      int stat(const char *file, struct stat *sbuf);
  21632.  
  21633. Description
  21634. -----------
  21635.  
  21636. This function obtains the status of the file FILE and stores it in
  21637. SBUF, which has this structure:
  21638.  
  21639.      struct  stat {
  21640.              time_t   st_atime;     /* time of last modification */
  21641.              time_t   st_ctime;     /*            ''             */
  21642.              dev_t    st_dev;       /* The drive number (0 = a:) */
  21643.              gid_t    st_gid;       /* getgid() */
  21644.              ino_t    st_ino;       /* starting cluster or a unique identifier */
  21645.              mode_t   st_mode;      /* file mode - S_IF* and S_IRUSR/S_IWUSR */
  21646.              time_t   st_mtime;     /*            ''             */
  21647.              nlink_t  st_nlink;     /* 2 + number of subdirs, or 1 for files */
  21648.              off_t    st_size;      /* size of file in bytes */
  21649.              off_t    st_blksize;   /* the size of transfer buffer */
  21650.              uid_t    st_uid;       /* getuid() */
  21651.      };
  21652.  
  21653. Return Value
  21654. ------------
  21655.  
  21656. Zero on success, nonzero on failure (and ERRNO set).
  21657.  
  21658. Example
  21659. -------
  21660.  
  21661.      struct stat s;
  21662.      stat("data.txt", &s);
  21663.      if (S_ISDIR(s.st_mode))
  21664.        printf("is directory\n");
  21665.  
  21666. Implementation Notes
  21667. --------------------
  21668.  
  21669. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  21670. implementation nightmare.  The following notes describe some of the
  21671. obscure points specific to their behavior in DJGPP.
  21672.  
  21673. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  21674. is returned as -1.  For drives networked by Novell Netware, it is
  21675. returned as -2.
  21676.  
  21677. 2. The starting cluster number of a file serves as its inode number.
  21678. For files whose starting cluster number is inaccessible (empty files,
  21679. files on networked drives, etc.) the `st_inode' field will be `invented'
  21680. in a way which guarantees that no two different files will get the same
  21681. inode number (thus it is unique).  This invented inode will also be
  21682. different from any real cluster number of any local file.  However, only
  21683. for local, non-empty files/directories the inode is guaranteed to be
  21684. consistent between `stat()' and `fstat()' function calls.
  21685.  
  21686. 3. The WRITE access mode bit is set only for the user (unless the file
  21687. is read-only, hidden or system).  EXECUTE bit is set for directories,
  21688. files which can be executed from the DOS prompt (batch files, .com,
  21689. .dll and .exe executables) or run by go32 extender.
  21690.  
  21691. 4. Size of directories is reported as the number of its files (sans `.'
  21692. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  21693. On FAT filesystems that support the LFN API (such as Windows 9x), the
  21694. reported size of the directory accounts for additional space used to
  21695. store the long filenames.
  21696.  
  21697. 5. Time stamp for root directories is taken from the volume label entry,
  21698. if that's available; otherwise, it is reported as 1-Jan-1980.
  21699.  
  21700. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  21701. of `struct stat' are needed by the application.
  21702.  
  21703. 7. `stat()' should not be used to get an up-to-date info about a file
  21704. which is open and has been written to, because `stat()' will only
  21705. return correct data after the file is closed.  Use *Note fstat:: while
  21706. the file is open.
  21707.  
  21708. 8. The number of links `st_nlink' is always 1 for files other than
  21709. directories.  For directories, it is the number of subdirectories plus
  21710. 2.  This is so that programs written for Unix that depend on this to
  21711. optimize recursive traversal of the directory tree, will still work.
  21712.  
  21713. 
  21714. File: libc.inf,  Node: statfs,  Next: _status87,  Prev: stat,  Up: Alphabetical List
  21715.  
  21716. statfs
  21717. ======
  21718.  
  21719. Syntax
  21720. ------
  21721.  
  21722.      #include <sys/vfs.h>
  21723.      
  21724.      int statfs(const char *filename, struct statfs *buf);
  21725.  
  21726. Description
  21727. -----------
  21728.  
  21729. This function returns information about the given "filesystem".  The
  21730. drive letter of the given FILENAME, or the default drive if none is
  21731. given, is used to retrieve the following structure:
  21732.  
  21733.      struct statfs
  21734.      {
  21735.          long    f_type;   /* 0 */
  21736.          long    f_bsize;  /* bytes per cluster */
  21737.          long    f_blocks; /* clusters on drive */
  21738.          long    f_bfree;  /* available clusters */
  21739.          long    f_bavail; /* available clusters */
  21740.          long    f_files;  /* clusters on drive */
  21741.          long    f_ffree;  /* available clusters */
  21742.          fsid_t    f_fsid;   /* [0]=drive_number, [1]=MOUNT_UFS
  21743.          long    f_magic;  /* FS_MAGIC */
  21744.      };
  21745.  
  21746. Return Value
  21747. ------------
  21748.  
  21749. Zero on success, nonzero on failure.
  21750.  
  21751. Example
  21752. -------
  21753.  
  21754.      struct statfs fs;
  21755.      statfs("anything", &fs);
  21756.      printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
  21757.  
  21758. 
  21759. File: libc.inf,  Node: _status87,  Next: _stklen,  Prev: statfs,  Up: Alphabetical List
  21760.  
  21761. _status87
  21762. =========
  21763.  
  21764. Syntax
  21765. ------
  21766.  
  21767.      #include <float.h>
  21768.      
  21769.      unsigned int _status87(void);
  21770.  
  21771. Description
  21772. -----------
  21773.  
  21774. Returns the status word of the FPU, which indicate the results of the
  21775. most recently completed FPU operation:
  21776.  
  21777.      ---- ---- ---- ---X = SW_INVALID - invalid operation
  21778.      ---- ---- ---- --X- = SW_DENORMAL - denormalized operand
  21779.      ---- ---- ---- -X-- = SW_ZERODIVIDE - division by zero
  21780.      ---- ---- ---- X--- = SW_OVERFLOW - overflow
  21781.      ---- ---- ---X ---- = SW_UNDERFLOW - underflow
  21782.      ---- ---- --X- ---- = SW_INEXACT - loss of precision
  21783.      ---- ---- -X-- ---- = SW_STACKFAULT - stack over/under flow
  21784.      ---- ---- X--- ---- = SW_ERRORSUMMARY - set if any errors
  21785.      -X-- -XXX ---- ---- = SW_COND - condition code
  21786.      ---- ---X ---- ---- = SW_C0
  21787.      ---- --X- ---- ---- = SW_C1
  21788.      ---- -X-- ---- ---- = SW_C2
  21789.      -X-- ---- ---- ---- = SW_C3
  21790.      --XX X--- ---- ---- = SW_TOP - top of stack (use SW_TOP_SHIFT to shift it)
  21791.      X--- ---- ---- ---- = SW_BUSY - fpu is busy
  21792.  
  21793. 
  21794. File: libc.inf,  Node: _stklen,  Next: stpcpy,  Prev: _status87,  Up: Alphabetical List
  21795.  
  21796. _stklen
  21797. =======
  21798.  
  21799. Syntax
  21800. ------
  21801.  
  21802.      extern int _stklen;
  21803.  
  21804. Description
  21805. -----------
  21806.  
  21807. This variable sets the minimum stack length that the program requires.
  21808. Note that the stack may be much larger than this.  This value should be
  21809. set statically, as it is only used at startup.
  21810.  
  21811. Example
  21812. -------
  21813.  
  21814.      int _stklen = 256000;
  21815.  
  21816. 
  21817. File: libc.inf,  Node: stpcpy,  Next: strcase,  Prev: _stklen,  Up: Alphabetical List
  21818.  
  21819. stpcpy
  21820. ======
  21821.  
  21822. Syntax
  21823. ------
  21824.  
  21825.      #include <string.h>
  21826.      
  21827.      char *stpcpy(char *_dest, const char *_src);
  21828.  
  21829. Description
  21830. -----------
  21831.  
  21832. Like `strcpy' (*note strcpy::.), but return value different.
  21833.  
  21834. Return Value
  21835. ------------
  21836.  
  21837. Returns a pointer to the trailing NUL in DEST.
  21838.  
  21839. 
  21840. File: libc.inf,  Node: strcase,  Next: strcasecmp,  Prev: stpcpy,  Up: Alphabetical List
  21841.  
  21842. strcase
  21843. =======
  21844.  
  21845. Syntax
  21846. ------
  21847.  
  21848.      #include <string.h>
  21849.      
  21850.      int strcase(const char *s1, const char *s2);
  21851.  
  21852. Description
  21853. -----------
  21854.  
  21855. This function compares the two strings, disregarding case.
  21856.  
  21857. Return Value
  21858. ------------
  21859.  
  21860. Zero if they're the same, nonzero if different, the sign indicates
  21861. "order".
  21862.  
  21863. Example
  21864. -------
  21865.  
  21866.      if (strcase(arg, "-i") == 0)
  21867.        do_include();
  21868.  
  21869. 
  21870. File: libc.inf,  Node: strcasecmp,  Next: strcat,  Prev: strcase,  Up: Alphabetical List
  21871.  
  21872. strcasecmp
  21873. ==========
  21874.  
  21875. Syntax
  21876. ------
  21877.  
  21878.      #include <string.h>
  21879.      
  21880.      int strcasecmp(const char *s1, const char *s2);
  21881.  
  21882. Description
  21883. -----------
  21884.  
  21885. This function compares the two strings, disregarding case.
  21886.  
  21887. Return Value
  21888. ------------
  21889.  
  21890. Zero if they're the same, nonzero if different, the sign indicates
  21891. "order".
  21892.  
  21893. Example
  21894. -------
  21895.  
  21896.      if (strcasecmp(arg, "-i") == 0)
  21897.        do_include();
  21898.  
  21899. 
  21900. File: libc.inf,  Node: strcat,  Next: strchr,  Prev: strcasecmp,  Up: Alphabetical List
  21901.  
  21902. strcat
  21903. ======
  21904.  
  21905. Syntax
  21906. ------
  21907.  
  21908.      #include <string.h>
  21909.      
  21910.      char *strcat(char *s1, const char *s2);
  21911.  
  21912. Description
  21913. -----------
  21914.  
  21915. This function concatenates S2 to the end of S1.
  21916.  
  21917. Return Value
  21918. ------------
  21919.  
  21920. S1
  21921.  
  21922. Example
  21923. -------
  21924.  
  21925.      char buf[100] = "hello";
  21926.      strcat(buf, " there");
  21927.  
  21928. 
  21929. File: libc.inf,  Node: strchr,  Next: strcmp,  Prev: strcat,  Up: Alphabetical List
  21930.  
  21931. strchr
  21932. ======
  21933.  
  21934. Syntax
  21935. ------
  21936.  
  21937.      #include <string.h>
  21938.      
  21939.      char *strchr(const char *s, int c);
  21940.  
  21941. Description
  21942. -----------
  21943.  
  21944. This function returns a pointer to the first occurrence of C in S.
  21945. Note that if C is `NULL', this will return a pointer to the end of the
  21946. string.
  21947.  
  21948. Return Value
  21949. ------------
  21950.  
  21951. A pointer to the character, or `NULL' if it wasn't found.
  21952.  
  21953. Example
  21954. -------
  21955.  
  21956.      char *slash = strchr(filename, '/');
  21957.  
  21958. 
  21959. File: libc.inf,  Node: strcmp,  Next: strcoll,  Prev: strchr,  Up: Alphabetical List
  21960.  
  21961. strcmp
  21962. ======
  21963.  
  21964. Syntax
  21965. ------
  21966.  
  21967.      #include <string.h>
  21968.      
  21969.      int strcmp(const char *s1, const char *s2);
  21970.  
  21971. Description
  21972. -----------
  21973.  
  21974. This function compares S1 and S2.
  21975.  
  21976. Return Value
  21977. ------------
  21978.  
  21979. Zero if the strings are equal, a positive number if S1 comes after S2
  21980. in the ASCII collating sequense, else a negative number.
  21981.  
  21982. Example
  21983. -------
  21984.  
  21985.      if (strcmp(arg, "-i") == 0)
  21986.        do_include();
  21987.  
  21988. 
  21989. File: libc.inf,  Node: strcoll,  Next: strcpy,  Prev: strcmp,  Up: Alphabetical List
  21990.  
  21991. strcoll
  21992. =======
  21993.  
  21994. Syntax
  21995. ------
  21996.  
  21997.      #include <string.h>
  21998.      
  21999.      int strcoll(const char *s1, const char *s2);
  22000.  
  22001. Description
  22002. -----------
  22003.  
  22004. This function compares S1 and S2, using the collating sequences from
  22005. the current locale.
  22006.  
  22007. Return Value
  22008. ------------
  22009.  
  22010. Zero if the strings are equal, a positive number if S1 comes after S2
  22011. in the collating sequense, else a negative number.
  22012.  
  22013. Example
  22014. -------
  22015.  
  22016.      while (strcoll(var, list[i]) < 0)
  22017.        i++;
  22018.  
  22019. 
  22020. File: libc.inf,  Node: strcpy,  Next: strcspn,  Prev: strcoll,  Up: Alphabetical List
  22021.  
  22022. strcpy
  22023. ======
  22024.  
  22025. Syntax
  22026. ------
  22027.  
  22028.      #include <string.h>
  22029.      
  22030.      char *strcpy(char *s1, const char *s2);
  22031.  
  22032. Description
  22033. -----------
  22034.  
  22035. This function copies S2 into S1.
  22036.  
  22037. Return Value
  22038. ------------
  22039.  
  22040. S1
  22041.  
  22042. Example
  22043. -------
  22044.  
  22045.      char buf[100];
  22046.      strcpy(buf, arg);
  22047.  
  22048. 
  22049. File: libc.inf,  Node: strcspn,  Next: strdup,  Prev: strcpy,  Up: Alphabetical List
  22050.  
  22051. strcspn
  22052. =======
  22053.  
  22054. Syntax
  22055. ------
  22056.  
  22057.      #include <string.h>
  22058.      
  22059.      size_t strcspn(const char *s1, const char *set);
  22060.  
  22061. Description
  22062. -----------
  22063.  
  22064. This function finds the first character in S1 that matches any
  22065. character in SET.  Note that the `NULL' bytes at the end of each string
  22066. counts, so you'll at least get a pointer to the end of the string if
  22067. nothing else.
  22068.  
  22069. Return Value
  22070. ------------
  22071.  
  22072. The index of the found character.
  22073.  
  22074. Example
  22075. -------
  22076.  
  22077.      int i = strcspn(command, "<>|");
  22078.      if (command[i])
  22079.        do_redirection();
  22080.  
  22081. 
  22082. File: libc.inf,  Node: strdup,  Next: strerror,  Prev: strcspn,  Up: Alphabetical List
  22083.  
  22084. strdup
  22085. ======
  22086.  
  22087. Syntax
  22088. ------
  22089.  
  22090.      #include <string.h>
  22091.      
  22092.      char * strdup (const char *source);
  22093.  
  22094. Description
  22095. -----------
  22096.  
  22097. Returns a newly allocated area of memory that contains a duplicate of
  22098. the string pointed to by SOURCE.  The memory returned by this call must
  22099. be freed by the caller.
  22100.  
  22101. Return Value
  22102. ------------
  22103.  
  22104. Returns the newly allocated string, or NULL if there is no more memory.
  22105.  
  22106. Example
  22107. -------
  22108.  
  22109.      char *foo()
  22110.      {
  22111.        return strdup("hello");
  22112.      }
  22113.  
  22114. 
  22115. File: libc.inf,  Node: strerror,  Next: strftime,  Prev: strdup,  Up: Alphabetical List
  22116.  
  22117. strerror
  22118. ========
  22119.  
  22120. Syntax
  22121. ------
  22122.  
  22123.      #include <string.h>
  22124.      
  22125.      char *strerror(int error);
  22126.  
  22127. Description
  22128. -----------
  22129.  
  22130. This function returns a string that describes the ERROR.
  22131.  
  22132. Return Value
  22133. ------------
  22134.  
  22135. A pointer to a static string that should not be modified or free'd.
  22136.  
  22137. Example
  22138. -------
  22139.  
  22140.      if (f=fopen("foo", "r") == 0)
  22141.        printf("Error! %s: %s\n", "foo", strerror(errno));
  22142.  
  22143. 
  22144. File: libc.inf,  Node: strftime,  Next: stricmp,  Prev: strerror,  Up: Alphabetical List
  22145.  
  22146. strftime
  22147. ========
  22148.  
  22149. Syntax
  22150. ------
  22151.  
  22152.      #include <time.h>
  22153.      
  22154.      size_t strftime(char *buf, size_t n, const char *format, const struct tm *time);
  22155.  
  22156. Description
  22157. -----------
  22158.  
  22159. This function formats the given TIME according to the given FORMAT and
  22160. stores it in BUF, not exceeding N bytes.
  22161.  
  22162. The format string is like `printf' in that any character other than `%'
  22163. is added to the output string, and for each character following a `%' a
  22164. pattern is added to the string as follows, with the examples as if the
  22165. time was Friday, October 1, 1993, at 03:30:34 PM EDT:
  22166.  
  22167. `%A'
  22168.      The full weekday name (`Friday')
  22169.  
  22170. `%a'
  22171.      The abbreviated weekday name (`Fri')
  22172.  
  22173. `%B'
  22174.      The full month name (`October')
  22175.  
  22176. `%b'
  22177. `%h'
  22178.      The abbreviated month name (`Oct')
  22179.  
  22180. `%C'
  22181.      Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct  1 15:30:34 1993')
  22182.  
  22183. `%c'
  22184.      Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
  22185.  
  22186. `%e'
  22187.      The day of the month, blank padded to two characters (` 2')
  22188.  
  22189. `%D'
  22190.      Short for `%m/%d/%y' (`10/01/93')
  22191.  
  22192. `%d'
  22193.      The day of the month, zero padded to two characters (`02')
  22194.  
  22195. `%H'
  22196.      The hour (0-24), zero padded to two characters (`15')
  22197.  
  22198. `%I'
  22199.      The hour (1-12), zero padded to two characters (`03')
  22200.  
  22201. `%j'
  22202.      The Julian day, zero padded to three characters (`275')
  22203.  
  22204. `%k'
  22205.      The hour (0-24), space padded to two characters (`15')
  22206.  
  22207. `%l'
  22208.      The hour (1-12), space padded to two characters(` 3')
  22209.  
  22210. `%M'
  22211.      The minutes, zero padded to two characters (`30')
  22212.  
  22213. `%m'
  22214.      The month (1-12), zero padded to two characters (`10')
  22215.  
  22216. `%n'
  22217.      A newline (`\n')
  22218.  
  22219. `%p'
  22220.      AM or PM (`PM')
  22221.  
  22222. `%R'
  22223.      Short for `%H:%M' (`15:30')
  22224.  
  22225. `%r'
  22226.      Short for `%I:%M:%S %p' (`03:30:35 PM')
  22227.  
  22228. `%S'
  22229.      The seconds, zero padded to two characters (`35')
  22230.  
  22231. `%T'
  22232. `%X'
  22233.      Short for `%H:%M:%S' (`15:30:35')
  22234.  
  22235. `%t'
  22236.      A tab (`\t')
  22237.  
  22238. `%U'
  22239.      The week of the year, with the first week defined by the first
  22240.      Sunday of the year, zero padded to two characters (`39')
  22241.  
  22242. `%W'
  22243.      The week of the year, with the first week defined by the first
  22244.      Monday of the year, zero padded to two characters (`39')
  22245.  
  22246. `%w'
  22247.      The day of the week (0-6) (`5')
  22248.  
  22249. `%x'
  22250.      Short for `%m/%d/%y' (`10/01/93')
  22251.  
  22252. `%y'
  22253.      The year (00-99) of the century (`93')
  22254.  
  22255. `%Y'
  22256.      The year, zero padded to four digits (`1993')
  22257.  
  22258. `%Z'
  22259.      The timezone abbreviation (`EDT')
  22260.  
  22261. `%%'
  22262.      A percent symbol (`%')
  22263.  
  22264. Return Value
  22265. ------------
  22266.  
  22267. The number of characters stored.
  22268.  
  22269. Example
  22270. -------
  22271.  
  22272.      struct tm t;
  22273.      char buf[100];
  22274.      strftime(buf, 100, "%B %d, %Y", &t);
  22275.  
  22276. 
  22277. File: libc.inf,  Node: stricmp,  Next: strlen,  Prev: strftime,  Up: Alphabetical List
  22278.  
  22279. stricmp
  22280. =======
  22281.  
  22282. Syntax
  22283. ------
  22284.  
  22285.      #include <string.h>
  22286.      
  22287.      int stricmp(const char *s1, const char *s2);
  22288.  
  22289. Description
  22290. -----------
  22291.  
  22292. This function compares the two strings, disregarding case.
  22293.  
  22294. Return Value
  22295. ------------
  22296.  
  22297. Zero if they're the same, nonzero if different, the sign indicates
  22298. "order".
  22299.  
  22300. Example
  22301. -------
  22302.  
  22303.      if (stricmp(arg, "-i") == 0)
  22304.        do_include();
  22305.  
  22306. 
  22307. File: libc.inf,  Node: strlen,  Next: strlwr,  Prev: stricmp,  Up: Alphabetical List
  22308.  
  22309. strlen
  22310. ======
  22311.  
  22312. Syntax
  22313. ------
  22314.  
  22315.      #include <string.h>
  22316.      
  22317.      size_t strlen(const char *string);
  22318.  
  22319. Description
  22320. -----------
  22321.  
  22322. This function returns the number of characters in STRING.
  22323.  
  22324. Return Value
  22325. ------------
  22326.  
  22327. The length of the string.
  22328.  
  22329. Example
  22330. -------
  22331.  
  22332.      if (strlen(fname) > PATH_MAX)
  22333.        invalid_file(fname);
  22334.  
  22335. 
  22336. File: libc.inf,  Node: strlwr,  Next: strncase,  Prev: strlen,  Up: Alphabetical List
  22337.  
  22338. strlwr
  22339. ======
  22340.  
  22341. Syntax
  22342. ------
  22343.  
  22344.      #include <string.h>
  22345.      
  22346.      char *strlwr(char *string);
  22347.  
  22348. Description
  22349. -----------
  22350.  
  22351. This function replaces all upper case letters in STRING with lower case
  22352. letters.
  22353.  
  22354. Return Value
  22355. ------------
  22356.  
  22357. The string.
  22358.  
  22359. Example
  22360. -------
  22361.  
  22362.      char buf[100] = "Hello";
  22363.      strlwr(buf);
  22364.  
  22365. 
  22366. File: libc.inf,  Node: strncase,  Next: strncasecmp,  Prev: strlwr,  Up: Alphabetical List
  22367.  
  22368. strncase
  22369. ========
  22370.  
  22371. Syntax
  22372. ------
  22373.  
  22374.      #include <string.h>
  22375.      
  22376.      int strncase(const char *s1, const char *s2, size_t max);
  22377.  
  22378. Description
  22379. -----------
  22380.  
  22381. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  22382. characters.
  22383.  
  22384. Return Value
  22385. ------------
  22386.  
  22387. Zero if the strings are equal, a positive number if S1 comes after S2
  22388. in the ASCII collating sequense, else a negative number.
  22389.  
  22390. Example
  22391. -------
  22392.  
  22393.      if (strncase(foo, "-i", 2) == 0)
  22394.        do_include();
  22395.  
  22396. 
  22397. File: libc.inf,  Node: strncasecmp,  Next: strncat,  Prev: strncase,  Up: Alphabetical List
  22398.  
  22399. strncasecmp
  22400. ===========
  22401.  
  22402. Syntax
  22403. ------
  22404.  
  22405.      #include <string.h>
  22406.      
  22407.      int strncasecmp(const char *s1, const char *s2, size_t max);
  22408.  
  22409. Description
  22410. -----------
  22411.  
  22412. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  22413. characters.
  22414.  
  22415. Return Value
  22416. ------------
  22417.  
  22418. Zero if the strings are equal, a positive number if S1 comes after S2
  22419. in the ASCII collating sequense, else a negative number.
  22420.  
  22421. Example
  22422. -------
  22423.  
  22424.      if (strncasecmp(foo, "-i", 2) == 0)
  22425.        do_include();
  22426.  
  22427. 
  22428. File: libc.inf,  Node: strncat,  Next: strncmp,  Prev: strncasecmp,  Up: Alphabetical List
  22429.  
  22430. strncat
  22431. =======
  22432.  
  22433. Syntax
  22434. ------
  22435.  
  22436.      #include <string.h>
  22437.      
  22438.      char *strncat(char *s1, const char *s2, size_t max);
  22439.  
  22440. Description
  22441. -----------
  22442.  
  22443. This function concatenates up to MAX characters of S2 to the end of S1.
  22444.  
  22445. Return Value
  22446. ------------
  22447.  
  22448. S1
  22449.  
  22450. Example
  22451. -------
  22452.  
  22453.      strncat(fname, extension, 4);
  22454.  
  22455. 
  22456. File: libc.inf,  Node: strncmp,  Next: strncpy,  Prev: strncat,  Up: Alphabetical List
  22457.  
  22458. strncmp
  22459. =======
  22460.  
  22461. Syntax
  22462. ------
  22463.  
  22464.      #include <string.h>
  22465.      
  22466.      int strncmp(const char *s1, const char *s2, size_t max);
  22467.  
  22468. Description
  22469. -----------
  22470.  
  22471. This function compares upto MAX characters of S1 and S2.
  22472.  
  22473. Return Value
  22474. ------------
  22475.  
  22476. Zero if the strings are equal, a positive number if S1 comes after S2
  22477. in the ASCII collating sequense, else a negative number.
  22478.  
  22479. Example
  22480. -------
  22481.  
  22482.      if (strncmp(arg, "-i", 2) == 0)
  22483.        do_include();
  22484.  
  22485. 
  22486. File: libc.inf,  Node: strncpy,  Next: strnicmp,  Prev: strncmp,  Up: Alphabetical List
  22487.  
  22488. strncpy
  22489. =======
  22490.  
  22491. Syntax
  22492. ------
  22493.  
  22494.      #include <string.h>
  22495.      
  22496.      char *strncpy(char *s1, const char *s2, size_t max);
  22497.  
  22498. Description
  22499. -----------
  22500.  
  22501. This function copies up to MAX characters of S2 into S1.
  22502.  
  22503. Return Value
  22504. ------------
  22505.  
  22506. S1
  22507.  
  22508. Example
  22509. -------
  22510.  
  22511.      char buf[100];
  22512.      strcpy(buf, arg, 99);
  22513.  
  22514. 
  22515. File: libc.inf,  Node: strnicmp,  Next: strpbrk,  Prev: strncpy,  Up: Alphabetical List
  22516.  
  22517. strnicmp
  22518. ========
  22519.  
  22520. Syntax
  22521. ------
  22522.  
  22523.      #include <string.h>
  22524.      
  22525.      int strnicmp(const char *s1, const char *s2, size_t max);
  22526.  
  22527. Description
  22528. -----------
  22529.  
  22530. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  22531. characters.
  22532.  
  22533. Return Value
  22534. ------------
  22535.  
  22536. Zero if the strings are equal, a positive number if S1 comes after S2
  22537. in the ASCII collating sequense, else a negative number.
  22538.  
  22539. Example
  22540. -------
  22541.  
  22542.      if (strnicmp(foo, "-i", 2) == 0)
  22543.        do_include();
  22544.  
  22545. 
  22546. File: libc.inf,  Node: strpbrk,  Next: strrchr,  Prev: strnicmp,  Up: Alphabetical List
  22547.  
  22548. strpbrk
  22549. =======
  22550.  
  22551. Syntax
  22552. ------
  22553.  
  22554.      #include <string.h>
  22555.      
  22556.      char *strpbrk(const char *s1, const char *set);
  22557.  
  22558. Description
  22559. -----------
  22560.  
  22561. This function finds the first character in S1 that matches any
  22562. character in SET.
  22563.  
  22564. Return Value
  22565. ------------
  22566.  
  22567. A pointer to the first match, or `NULL' if none are found.
  22568.  
  22569. Example
  22570. -------
  22571.  
  22572.      if (strpbrk(command, "<>|"))
  22573.        do_redirection();
  22574.  
  22575. 
  22576. File: libc.inf,  Node: strrchr,  Next: strsep,  Prev: strpbrk,  Up: Alphabetical List
  22577.  
  22578. strrchr
  22579. =======
  22580.  
  22581. Syntax
  22582. ------
  22583.  
  22584.      #include <string.h>
  22585.      
  22586.      char *strrchr(const char *s1, int c);
  22587.  
  22588. Description
  22589. -----------
  22590.  
  22591. This function finds the last occurrence of `c' in `s1'.
  22592.  
  22593. Return Value
  22594. ------------
  22595.  
  22596. A pointer to the last match, or `NULL' if the character isn't in the
  22597. string.
  22598.  
  22599. Example
  22600. -------
  22601.  
  22602.      char *last_slash = strrchr(filename, '/');
  22603.  
  22604. 
  22605. File: libc.inf,  Node: strsep,  Next: strspn,  Prev: strrchr,  Up: Alphabetical List
  22606.  
  22607. strsep
  22608. ======
  22609.  
  22610. Syntax
  22611. ------
  22612.  
  22613.      #include <string.h>
  22614.      
  22615.      char *strsep(char **stringp, char *delim);
  22616.  
  22617. Description
  22618. -----------
  22619.  
  22620. This function retrieves the next token from the given string, where
  22621. STRINGP points to a variable holding, initially, the start of the
  22622. string.  Tokens are delimited by a character from DELIM.  Each time the
  22623. function is called, it returns a pointer to the next token, and sets
  22624. *STRINGP to the next spot to check, or `NULL'.
  22625.  
  22626. Return Value
  22627. ------------
  22628.  
  22629. The next token, or NULL.
  22630.  
  22631. Example
  22632. -------
  22633.  
  22634.      main()
  22635.      {
  22636.        char *buf = "Hello  there,stranger";
  22637.        char **bp = &buf;
  22638.        char *tok;
  22639.        while (tok = strsep(bp, " ,"))
  22640.          printf("tok = `%s'\n", tok);
  22641.      }
  22642.      
  22643.      tok = `Hello'
  22644.      tok = `'
  22645.      tok = `there'
  22646.      tok = `stranger'
  22647.  
  22648. 
  22649. File: libc.inf,  Node: strspn,  Next: strstr,  Prev: strsep,  Up: Alphabetical List
  22650.  
  22651. strspn
  22652. ======
  22653.  
  22654. Syntax
  22655. ------
  22656.  
  22657.      #include <string.h>
  22658.      
  22659.      size_t strspn(const char *s1, const char *set);
  22660.  
  22661. Description
  22662. -----------
  22663.  
  22664. This function finds the first character in S1 that does not match any
  22665. character in SET.  Note that the `NULL' bytes at the end of S1 counts,
  22666. so you'll at least get a pointer to the end of the string if nothing
  22667. else.
  22668.  
  22669. Return Value
  22670. ------------
  22671.  
  22672. The index of the found character.
  22673.  
  22674. Example
  22675. -------
  22676.  
  22677.      int i = strcspn(entry, " \t\b");
  22678.      if (entry[i])
  22679.        do_something();
  22680.  
  22681. 
  22682. File: libc.inf,  Node: strstr,  Next: strtod,  Prev: strspn,  Up: Alphabetical List
  22683.  
  22684. strstr
  22685. ======
  22686.  
  22687. Syntax
  22688. ------
  22689.  
  22690.      #include <string.h>
  22691.      
  22692.      char *strstr(const char *s1, const char *s2);
  22693.  
  22694. Description
  22695. -----------
  22696.  
  22697. This function finds the first occurrence of S2 in S1.
  22698.  
  22699. Return Value
  22700. ------------
  22701.  
  22702. A pointer within S1, or `NULL' if S2 wasn't found.
  22703.  
  22704. Example
  22705. -------
  22706.  
  22707.      if (strstr(command, ".exe"))
  22708.        do_exe();
  22709.  
  22710. 
  22711. File: libc.inf,  Node: strtod,  Next: strtok,  Prev: strstr,  Up: Alphabetical List
  22712.  
  22713. strtod
  22714. ======
  22715.  
  22716. Syntax
  22717. ------
  22718.  
  22719.      #include <stdlib.h>
  22720.      
  22721.      double strtod(const char *s, char **endp);
  22722.  
  22723. Description
  22724. -----------
  22725.  
  22726. This function converts as many characters of S that look like a
  22727. floating point number into one, and sets *ENDP to point to the first
  22728. unused character.
  22729.  
  22730. Return Value
  22731. ------------
  22732.  
  22733. The value the string represented.
  22734.  
  22735. Example
  22736. -------
  22737.  
  22738.      char *buf = "123ret";
  22739.      char *bp;
  22740.      double x = strtod(buf, &bp);
  22741.  
  22742. 
  22743. File: libc.inf,  Node: strtok,  Next: strtol,  Prev: strtod,  Up: Alphabetical List
  22744.  
  22745. strtok
  22746. ======
  22747.  
  22748. Syntax
  22749. ------
  22750.  
  22751.      #include <string.h>
  22752.      
  22753.      char *strtok(char *s1, const char *s2);
  22754.  
  22755. Description
  22756. -----------
  22757.  
  22758. This function retrieves tokens from S1 which are delimited by
  22759. characters from S2.
  22760.  
  22761. To initiate the search, pass the string to be searched as S1.  For the
  22762. remaining tokens, pass `NULL' instead.
  22763.  
  22764. Return Value
  22765. ------------
  22766.  
  22767. A pointer to the token, or `NULL' if no more are found.
  22768.  
  22769. Example
  22770. -------
  22771.  
  22772.      main()
  22773.      {
  22774.        char *buf = "Hello there, stranger";
  22775.        char *tok;
  22776.        for (tok = strtok(buf, " ,");
  22777.             tok;
  22778.             tok=strtok(0, " ,"))
  22779.          printf("tok = `%s'\n", tok);
  22780.      }
  22781.      
  22782.      tok = `Hello'
  22783.      tok = `there'
  22784.      tok = `stranger'
  22785.  
  22786. 
  22787. File: libc.inf,  Node: strtol,  Next: _strtold,  Prev: strtok,  Up: Alphabetical List
  22788.  
  22789. strtol
  22790. ======
  22791.  
  22792. Syntax
  22793. ------
  22794.  
  22795.      #include <stdlib.h>
  22796.      
  22797.      long strtol(const char *s, char **endp, int base);
  22798.  
  22799. Description
  22800. -----------
  22801.  
  22802. This function converts as much of S as looks like an appropriate number
  22803. into the value of that number, and sets *ENDP to point to the first
  22804. unused character.
  22805.  
  22806. The BASE argument indicates what base the digits (or letters) should be
  22807. treated as.  If BASE is zero, the base is determined by looking for
  22808. `0x', `0X', or `0' as the first part of the string, and sets the base
  22809. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  22810. of those prefixes are found.
  22811.  
  22812. Return Value
  22813. ------------
  22814.  
  22815. The value.
  22816.  
  22817. Example
  22818. -------
  22819.  
  22820.      printf("Enter a number: "); fflush(stdout);
  22821.      gets(buf);
  22822.      char *bp;
  22823.      printf("The value is %d\n", strtol(buf, &bp, 0));
  22824.  
  22825. 
  22826. File: libc.inf,  Node: _strtold,  Next: strtoll,  Prev: strtol,  Up: Alphabetical List
  22827.  
  22828. _strtold
  22829. ========
  22830.  
  22831. Syntax
  22832. ------
  22833.  
  22834.      #include <stdlib.h>
  22835.      
  22836.      long double _strtold(const char *s, char **endp);
  22837.  
  22838. Description
  22839. -----------
  22840.  
  22841. This function converts as many characters of S that look like a
  22842. floating point number into one, and sets *ENDP to point to the first
  22843. unused character.
  22844.  
  22845. Return Value
  22846. ------------
  22847.  
  22848. The value the string represented.
  22849.  
  22850. Example
  22851. -------
  22852.  
  22853.      char *buf = "123ret";
  22854.      char *bp;
  22855.      long double x = _strtold(buf, &bp);
  22856.  
  22857. 
  22858. File: libc.inf,  Node: strtoll,  Next: strtoul,  Prev: _strtold,  Up: Alphabetical List
  22859.  
  22860. strtoll
  22861. =======
  22862.  
  22863. Syntax
  22864. ------
  22865.  
  22866.      #include <stdlib.h>
  22867.      
  22868.      long long strtoll(const char *s, char **endp, int base);
  22869.  
  22870. Description
  22871. -----------
  22872.  
  22873. This function converts as much of S as looks like an appropriate number
  22874. into the value of that number, and sets *ENDP to point to the first
  22875. unused character.
  22876.  
  22877. The BASE argument indicates what base the digits (or letters) should be
  22878. treated as.  If BASE is zero, the base is determined by looking for
  22879. `0x', `0X', or `0' as the first part of the string, and sets the base
  22880. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  22881. of those prefixes are found.
  22882.  
  22883. Return Value
  22884. ------------
  22885.  
  22886. The value.
  22887.  
  22888. Example
  22889. -------
  22890.  
  22891.      printf("Enter a number: "); fflush(stdout);
  22892.      gets(buf);
  22893.      char *bp;
  22894.      printf("The value is %lld\n", strtoll(buf, &bp, 0));
  22895.  
  22896. 
  22897. File: libc.inf,  Node: strtoul,  Next: strtoull,  Prev: strtoll,  Up: Alphabetical List
  22898.  
  22899. strtoul
  22900. =======
  22901.  
  22902. Syntax
  22903. ------
  22904.  
  22905.      #include <stdlib.h>
  22906.      
  22907.      unsigned long strtoul(const char *s, char **endp, int base);
  22908.  
  22909. Description
  22910. -----------
  22911.  
  22912. This is just like `strtol' (*note strtol::.) except that the result is
  22913. unsigned.
  22914.  
  22915. Return Value
  22916. ------------
  22917.  
  22918. The value.
  22919.  
  22920. Example
  22921. -------
  22922.  
  22923.      printf("Enter a number: "); fflush(stdout);
  22924.      gets(buf);
  22925.      char *bp;
  22926.      printf("The value is %u\n", strtoul(buf, &bp, 0));
  22927.  
  22928. 
  22929. File: libc.inf,  Node: strtoull,  Next: strupr,  Prev: strtoul,  Up: Alphabetical List
  22930.  
  22931. strtoull
  22932. ========
  22933.  
  22934. Syntax
  22935. ------
  22936.  
  22937.      #include <stdlib.h>
  22938.      
  22939.      unsigned long long strtoull(const char *s, char **endp, int base);
  22940.  
  22941. Description
  22942. -----------
  22943.  
  22944. This is just like `strtoll' (*note strtoll::.) except that the result
  22945. is unsigned.
  22946.  
  22947. Return Value
  22948. ------------
  22949.  
  22950. The value.
  22951.  
  22952. Example
  22953. -------
  22954.  
  22955.      printf("Enter a number: "); fflush(stdout);
  22956.      gets(buf);
  22957.      char *bp;
  22958.      printf("The value is %llu\n", strtoull(buf, &bp, 0));
  22959.  
  22960. 
  22961. File: libc.inf,  Node: strupr,  Next: strxfrm,  Prev: strtoull,  Up: Alphabetical List
  22962.  
  22963. strupr
  22964. ======
  22965.  
  22966. Syntax
  22967. ------
  22968.  
  22969.      #include <string.h>
  22970.      
  22971.      char *strupr(char *string);
  22972.  
  22973. Description
  22974. -----------
  22975.  
  22976. This function converts all lower case characters in STRING to upper
  22977. case.
  22978.  
  22979. Return Value
  22980. ------------
  22981.  
  22982. STRING
  22983.  
  22984. Example
  22985. -------
  22986.  
  22987.      char buf[] = "Foo!";
  22988.      strupr(buf);
  22989.  
  22990. 
  22991. File: libc.inf,  Node: strxfrm,  Next: swab,  Prev: strupr,  Up: Alphabetical List
  22992.  
  22993. strxfrm
  22994. =======
  22995.  
  22996. Syntax
  22997. ------
  22998.  
  22999.      #include <string.h>
  23000.      
  23001.      size_t strxfrm(char *s1, const char *s2, size_t max);
  23002.  
  23003. Description
  23004. -----------
  23005.  
  23006. This copies characters from S2 to S1, which must be able to hold MAX
  23007. characters.  Each character is transformed according to the locale such
  23008. that `strcmp(s1b, s2b)' is just like `strcoll(s1, s2)' where `s1b' and
  23009. `s2b' are the transforms of `s1' and `s2'.
  23010.  
  23011. Return Value
  23012. ------------
  23013.  
  23014. The actual number of bytes required to transform S2, including the
  23015. `NULL'.
  23016.  
  23017. 
  23018. File: libc.inf,  Node: swab,  Next: symlink,  Prev: strxfrm,  Up: Alphabetical List
  23019.  
  23020. swab
  23021. ====
  23022.  
  23023. Syntax
  23024. ------
  23025.  
  23026.      #include <stdlib.h>
  23027.      
  23028.      void swab(const void *from, void *to, int nbytes);
  23029.  
  23030. Description
  23031. -----------
  23032.  
  23033. This function copies NBYTES bytes from the address pointed to by FROM
  23034. to the address pointed by TO, exchanging adjacent even and odd bytes.
  23035. It is useful for carrying binary data between little-endian and
  23036. big-endian machines.  The argument NBYTES should be even, and the
  23037. buffers FROM and TO should not overlap.
  23038.  
  23039. Return Value
  23040. ------------
  23041.  
  23042. None.
  23043.  
  23044. 
  23045. File: libc.inf,  Node: symlink,  Next: sync,  Prev: swab,  Up: Alphabetical List
  23046.  
  23047. symlink
  23048. =======
  23049.  
  23050. Syntax
  23051. ------
  23052.  
  23053.      #include <unistd.h>
  23054.      
  23055.      int symlink(const char *exists, const char *new);
  23056.  
  23057. Description
  23058. -----------
  23059.  
  23060. MSDOS doesn't support symbolic links.  However, DJGPP supports
  23061. "symlinks" to DJGPP programs.  This function simulates a symlink
  23062. between two `.exe' files in the DJGPP style.  It creates a program
  23063. whose name is given by *NEW which, when run, will actually execute the
  23064. program *EXISTS passing it *NEW in `argv[0]' (some programs change
  23065. their behavior depending on what's passed in `argv[0]').  The file
  23066. referred to by EXISTS doesn't really have to exist when this function
  23067. is called.  Both *NEW and *EXISTS can point to a name with or without
  23068. the `.exe' extension.
  23069.  
  23070. Note that both *EXISTS and *NEW must reside in the same directory (this
  23071. is a restriction of the DJGPP "symlinks"); the function will fail and
  23072. set `errno' to `EXDEV' if they aren't.  Also note that this function
  23073. does nothing to ensure that *EXISTS is actually a DJGPP program.
  23074.  
  23075. This functions runs the `stubify' and `stubedit' programs, so they
  23076. should be somewhere on your `PATH' for the function to succeed.  (These
  23077. programs come with the DJGPP development distribution.)
  23078.  
  23079. Return Value
  23080. ------------
  23081.  
  23082. Zero in case of success, -1 in case of failure (and `errno' set to the
  23083. appropriate error code).
  23084.  
  23085. Example
  23086. -------
  23087.  
  23088.      symlink ("c:/djgpp/bin/grep", "c:/djgpp/bin/fgrep");
  23089.  
  23090. 
  23091. File: libc.inf,  Node: sync,  Next: sys_errlist,  Prev: symlink,  Up: Alphabetical List
  23092.  
  23093. sync
  23094. ====
  23095.  
  23096. Description
  23097. -----------
  23098.  
  23099. This function is provided only to assist in porting from Unix.  It
  23100. always returns zero.
  23101.  
  23102. 
  23103. File: libc.inf,  Node: sys_errlist,  Next: sys_nerr,  Prev: sync,  Up: Alphabetical List
  23104.  
  23105. sys_errlist
  23106. ===========
  23107.  
  23108. Syntax
  23109. ------
  23110.  
  23111.      #include <errno.h>
  23112.      
  23113.      extern char *sys_errlist[];
  23114.  
  23115. Description
  23116. -----------
  23117.  
  23118. This array contains error messages, indexed by `errno', that describe
  23119. the errors.
  23120.  
  23121. Example
  23122. -------
  23123.  
  23124.      printf("Error: %s\n", sys_errlist[errno]);
  23125.  
  23126. 
  23127. File: libc.inf,  Node: sys_nerr,  Next: sysconf,  Prev: sys_errlist,  Up: Alphabetical List
  23128.  
  23129. sys_nerr
  23130. ========
  23131.  
  23132. Syntax
  23133. ------
  23134.  
  23135.      #include <errno.h>
  23136.      
  23137.      extern int sys_nerr;
  23138.  
  23139. Description
  23140. -----------
  23141.  
  23142. This variable gives the number of error messages in `sys_errlist'
  23143. (*note sys_errlist::.).
  23144.  
  23145. Example
  23146. -------
  23147.  
  23148.      if (errno < sys_nerr)
  23149.        printf("Error: %s\n", sys_errlist[errno]);
  23150.  
  23151. 
  23152. File: libc.inf,  Node: sysconf,  Next: system,  Prev: sys_nerr,  Up: Alphabetical List
  23153.  
  23154. sysconf
  23155. =======
  23156.  
  23157. Syntax
  23158. ------
  23159.  
  23160.      #include <unistd.h>
  23161.      
  23162.      long sysconf(int which);
  23163.  
  23164. Description
  23165. -----------
  23166.  
  23167. This function returns various system configuration values, based on
  23168. WHICH:
  23169.  
  23170.        case _SC_ARG_MAX:    return ARG_MAX;
  23171.        case _SC_CHILD_MAX:    return CHILD_MAX;
  23172.        case _SC_CLK_TCK:    return CLOCKS_PER_SEC;
  23173.        case _SC_NGROUPS_MAX:    return NGROUPS_MAX;
  23174.        case _SC_OPEN_MAX:    return 255;
  23175.        case _SC_JOB_CONTROL:    return -1;
  23176.        case _SC_SAVED_IDS:    return -1;
  23177.        case _SC_STREAM_MAX:    return _POSIX_STREAM_MAX;
  23178.        case _SC_TZNAME_MAX:    return TZNAME_MAX;
  23179.        case _SC_VERSION:    return _POSIX_VERSION;
  23180.  
  23181. Return Value
  23182. ------------
  23183.  
  23184. The value.
  23185.  
  23186. 
  23187. File: libc.inf,  Node: system,  Next: tan,  Prev: sysconf,  Up: Alphabetical List
  23188.  
  23189. system
  23190. ======
  23191.  
  23192. Syntax
  23193. ------
  23194.  
  23195.      #include <stdlib.h>
  23196.      
  23197.      int system(const char *cmd);
  23198.  
  23199. Description
  23200. -----------
  23201.  
  23202. This function runs the command or program specified by CMD.  When
  23203. calling programs compiled by DJGPP this function will not use
  23204. `command.com' and so will not be subject to its 126 character limit on
  23205. command lines.
  23206.  
  23207. Command lines and pipes( i.e., the use of "<", ">", ">>", and "|") will
  23208. be simulated internally in this function; this means that you can have
  23209. both long command lines and redirection/pipes when running DJGPP
  23210. programs with this function.
  23211.  
  23212. By default, `command.com' will only be invoked to run commands internal
  23213. to it, or to run batch files (but this can be changed, see below).  In
  23214. these cases, the returned error code will always be zero, since
  23215. `command.com' always exits with code 0.
  23216.  
  23217. Certain commands internal to `command.com' that don't make sense or
  23218. cause no effect in the context of `system' are ignored by this
  23219. function.  These are `REM', `EXIT', `GOTO', `SHIFT'; `SET', `PATH' and
  23220. `PROMPT' are ignored only if called with an argument.  You can disable
  23221. this feature if you need, see below.
  23222.  
  23223. Some commands are emulated internally by `system', because the
  23224. emulation is better than the original.  Currently, the only emulated
  23225. command is `CD' or `CHDIR': the emulation knows about forward slashes
  23226. and also switches the current drive.  This emulation can also be
  23227. switched off, as explained below.
  23228.  
  23229. When `system' is presented with an internal shell command, it checks
  23230. the environment variables `SHELL' and `COMSPEC' (in that order) and
  23231. invokes the program that they point to.  If the shell thus found is one
  23232. of the DOS shells (`command.com', `4DOS' or `NDOS'), they are called
  23233. with the `/c' switch prepended to the command line.  Otherwise,
  23234. `system' assumes that the shell is a Unix-style shell and invokes it
  23235. with a `-c' switch, passing the entire command line via a response file
  23236. (this should work with any shell compiled with DJGPP, and with the
  23237. `ms_sh' shell).
  23238.  
  23239. Shell scripts and batch files are invoked by calling either the program
  23240. whose name appears on the first line (like in `#! /bin/sh'), or the
  23241. default shell if none is specified by the script.  If the name of the
  23242. shell specified by the script is a Unix-style pathname, without a drive
  23243. letter and with no extension, `system' will additionally search for it
  23244. on the `PATH'.  This allows to invoke Unix shell scripts unmodified, if
  23245. you have a ported shell installed on your system.
  23246.  
  23247. You can customize the behavior of `system' using a bit-mapped variable
  23248. __SYSTEM_FLAGS, defined on `<stdlib.h>'.  The following bits are
  23249. currently defined:
  23250.  
  23251. `__system_redirect'
  23252.      When set (the default), specifies that `system' can use its
  23253.      internal redirection and pipe code.  If reset, any command line
  23254.      that includes an unquoted redirection symbol will be passed to the
  23255.      shell.
  23256.  
  23257. `__system_call_cmdproc'
  23258.      When set, `system' will always call the shell to execute the
  23259.      command line.  If reset (the default), the shell will only be
  23260.      called when needed, as described above.
  23261.  
  23262.      You should *always* set this bit if you use a real, Unix-style
  23263.      shell (also, set `__system_use_shell', described below, and the
  23264.      `SHELL' environment variable).
  23265.  
  23266. `__system_use_shell'
  23267.      When set (the default), the `SHELL' environment variable will take
  23268.      precedence upon `COMSPEC'; this allows you to specify a special
  23269.      shell for `system' that doesn't affect the rest of DOS.  If reset,
  23270.      only `COMSPEC' is used to find the name of the command processor.
  23271.  
  23272. `__system_allow_multiple_cmds'
  23273.      When set, you can put multiple commands together separated by the
  23274.      `;' character.  If reset (the default), the command line passed to
  23275.      `system' is executed as a single command and `;' has no special
  23276.      meaning.
  23277.  
  23278. `__system_allow_long_cmds'
  23279.      When set (the default), `system' will handle command lines longer
  23280.      than the DOS 126-character limit; this might crash your program in
  23281.      some cases, as the low-level functions that invoke the child
  23282.      program will only pass them the first 126 characters.  When reset,
  23283.      `system' will detect early that the command line is longer than
  23284.      126 characters and refuse to run it, but you will not be able to
  23285.      call DJGPP programs with long command lines.
  23286.  
  23287. `__system_emulate_command'
  23288.      If reset (the default), `system' will pass the entire command line
  23289.      to the shell if its name is one of the following: `sh.exe',
  23290.      `sh16.exe', `sh32.exe', `bash.exe', `tcsh.exe'.  When set,
  23291.      `system' will attempt to emulate redirection and pipes internally,
  23292.      even if `COMSPEC' or `SHELL' point to a Unix-style shell.
  23293.  
  23294. `__system_handle_null_commands'
  23295.      When set (the default), commands internal to `COMMAND.COM' and
  23296.      compatible shells which have no effect in the context of `system',
  23297.      are ignored (the list of these commands was given above).  If
  23298.      reset, these commands are processed as all others, which means
  23299.      `COMMAND.COM' will be called to execute them.
  23300.  
  23301.      Note that this bit shouldn't be used with a Unix-style shell,
  23302.      because it does the wrong thing then.  With Unix-style shells, you
  23303.      are supposed to set the `__system_call_cmdproc' bit which will
  23304.      always call the shell.
  23305.  
  23306. `__system_ignore_chdir'
  23307.      If set, the `CD' and `CHDIR' commands are ignored.  When reset
  23308.      (the default), the processing of these commands depends on the
  23309.      `__system_emulate_chdir' bit, see below.
  23310.  
  23311.      This bit is for compatibility with Unix, where a single `cd dir'
  23312.      command has no effect, because the current working directory there
  23313.      is not a global notion (as on MSDOS).  Don't set this bit if you
  23314.      use multiple commands (see `__system_allow_multiple_cmds' above).
  23315.  
  23316. `__system_emulate_chdir'
  23317.      When set, the `CD' and `CHDIR' commands are emulated internally:
  23318.      they change the drive when the argument specifies a drive letter,
  23319.      and they support both forward slashes and backslashes in
  23320.      pathnames.  When `CD' is called without an argument, it prints the
  23321.      current working directory with forward slashes and down-cases DOS
  23322.      8+3 names.  If this bit is reset (the default), `CD' and `CHDIR'
  23323.      are passed to the shell.
  23324.  
  23325. The behavior of `system' can be customized at run time by defining the
  23326. variable `DJSYSFLAGS' in the environment.  The value of that variable
  23327. should be the numerical value of `__system_flags' that you'd like to
  23328. set; it will override the value of `__system_flags' specified when the
  23329. program was compiled.
  23330.  
  23331. Return Value
  23332. ------------
  23333.  
  23334. The exit status of the child process in the lower 8 bits of the return
  23335. value; bits 8-17 of the return value will hold `SIGINT' or `SIGABRT' if
  23336. the child process was aborted by `Ctrl-C' or Critical Device Error,
  23337. respectively; otherwise it will be zero.  If the child couldn't be run,
  23338. `system' will return -1 and set `errno' to an appropriate value.  Note
  23339. that if `COMMAND.COM' was used to run the child, it will always return
  23340. a 0 status, even if the command didn't run successfully.  However,
  23341. `system' only calls `COMMAND.COM' when it needs to run commands
  23342. internal to it.
  23343.  
  23344. Example
  23345. -------
  23346.  
  23347.      system("cc1plus.exe @cc123456.gp");
  23348.  
  23349. 
  23350. File: libc.inf,  Node: tan,  Next: tanh,  Prev: system,  Up: Alphabetical List
  23351.  
  23352. tan
  23353. ===
  23354.  
  23355. Syntax
  23356. ------
  23357.  
  23358.      #include <math.h>
  23359.      
  23360.      double tan(double x);
  23361.  
  23362. Return Value
  23363. ------------
  23364.  
  23365. The tangent of X.
  23366.  
  23367. 
  23368. File: libc.inf,  Node: tanh,  Next: tcdrain,  Prev: tan,  Up: Alphabetical List
  23369.  
  23370. tanh
  23371. ====
  23372.  
  23373. Syntax
  23374. ------
  23375.  
  23376.      #include <math.h>
  23377.      
  23378.      double tanh(double x);
  23379.  
  23380. Return Value
  23381. ------------
  23382.  
  23383. The hyperbolic tangent of X.
  23384.  
  23385. 
  23386. File: libc.inf,  Node: tcdrain,  Next: tcflow,  Prev: tanh,  Up: Alphabetical List
  23387.  
  23388. tcdrain
  23389. =======
  23390.  
  23391. Syntax
  23392. ------
  23393.  
  23394.      #include <termios.h>
  23395.      
  23396.      int tcdrain (int fd);
  23397.  
  23398. Description
  23399. -----------
  23400.  
  23401. This function waits finishing writing queued buffer to FD. It is
  23402. provided for compatibility only.  Note that the termios emulation
  23403. handles console only.
  23404.  
  23405. Return Value
  23406. ------------
  23407.  
  23408. Zero on success, nonzero on failure.
  23409.  
  23410. 
  23411. File: libc.inf,  Node: tcflow,  Next: tcflush,  Prev: tcdrain,  Up: Alphabetical List
  23412.  
  23413. tcflow
  23414. ======
  23415.  
  23416. Syntax
  23417. ------
  23418.  
  23419.      #include <termios.h>
  23420.      
  23421.      int tcflow (int fd, int action);
  23422.  
  23423. Description
  23424. -----------
  23425.  
  23426. This function performs flow control specified by ACTION on FD.  It is
  23427. provided for compatibility only.  Note that the termios emulation
  23428. handles console only.
  23429.  
  23430. Return Value
  23431. ------------
  23432.  
  23433. Zero on success, nonzero on failure.
  23434.  
  23435. 
  23436. File: libc.inf,  Node: tcflush,  Next: tcgetattr,  Prev: tcflow,  Up: Alphabetical List
  23437.  
  23438. tcflush
  23439. =======
  23440.  
  23441. Syntax
  23442. ------
  23443.  
  23444.      #include <termios.h>
  23445.      
  23446.      int tcflush (int fd, int which);
  23447.  
  23448. Description
  23449. -----------
  23450.  
  23451. This function clears the input and/or output queues on FD. It is
  23452. provided for compatibility only.  Note that the termios emulation
  23453. handles console only.
  23454.  
  23455. Return Value
  23456. ------------
  23457.  
  23458. Zero on success, nonzero on failure.
  23459.  
  23460. 
  23461. File: libc.inf,  Node: tcgetattr,  Next: tcsendbreak,  Prev: tcflush,  Up: Alphabetical List
  23462.  
  23463. tcgetattr
  23464. =========
  23465.  
  23466. Syntax
  23467. ------
  23468.  
  23469.      #include <termios.h>
  23470.      
  23471.      int tcgetattr (int fd, struct termios *termiosp);
  23472.  
  23473. Description
  23474. -----------
  23475.  
  23476. This function gets termios structure from device FD and stores it in
  23477. the structure TERMIOSP.  Note that the termios emulation handles
  23478. console only.
  23479.  
  23480. Return Value
  23481. ------------
  23482.  
  23483. Zero on success, nonzero on failure.
  23484.  
  23485. Example
  23486. -------
  23487.  
  23488.      struct termios termiosbuf;
  23489.      int rc = tcgetattr (0, &termiosbuf);
  23490.  
  23491. 
  23492. File: libc.inf,  Node: tcsendbreak,  Next: tcsetattr,  Prev: tcgetattr,  Up: Alphabetical List
  23493.  
  23494. tcsendbreak
  23495. ===========
  23496.  
  23497. Syntax
  23498. ------
  23499.  
  23500.      #include <termios.h>
  23501.      
  23502.      int tcsendbreak (int fd, int duration);
  23503.  
  23504. Description
  23505. -----------
  23506.  
  23507. This function generates a break condition. It is provided for
  23508. compatibility only.  Note that the termios emulation handles console
  23509. only.
  23510.  
  23511. Return Value
  23512. ------------
  23513.  
  23514. Zero on success, nonzero on failure.
  23515.  
  23516. 
  23517. File: libc.inf,  Node: tcsetattr,  Next: tell,  Prev: tcsendbreak,  Up: Alphabetical List
  23518.  
  23519. tcsetattr
  23520. =========
  23521.  
  23522. Syntax
  23523. ------
  23524.  
  23525.      #include <termios.h>
  23526.      
  23527.      int tcsetattr (int fd, int action, const struct termios *termiosp);
  23528.  
  23529. Description
  23530. -----------
  23531.  
  23532. This function sets termios structure for device FD from the structure
  23533. TERMIOSP.  Note that the termios emulation handles console only.
  23534.  
  23535. Return Value
  23536. ------------
  23537.  
  23538. Zero on success, nonzero on failure.
  23539.  
  23540. Example
  23541. -------
  23542.  
  23543.      tcsetattr (0, TCSANOW, &termiosbuf);
  23544.  
  23545. 
  23546. File: libc.inf,  Node: tell,  Next: telldir,  Prev: tcsetattr,  Up: Alphabetical List
  23547.  
  23548. tell
  23549. ====
  23550.  
  23551. Syntax
  23552. ------
  23553.  
  23554.      #include <io.h>
  23555.      
  23556.      off_t tell(int file);
  23557.  
  23558. Description
  23559. -----------
  23560.  
  23561. This function returns the location of the file pointer for FILE.
  23562.  
  23563. Return Value
  23564. ------------
  23565.  
  23566. The file pointer, or -1 on error.
  23567.  
  23568. Example
  23569. -------
  23570.  
  23571.      off_t q = tell(fd);
  23572.  
  23573. 
  23574. File: libc.inf,  Node: telldir,  Next: textattr,  Prev: tell,  Up: Alphabetical List
  23575.  
  23576. telldir
  23577. =======
  23578.  
  23579. Syntax
  23580. ------
  23581.  
  23582.      #include <dirent.h>
  23583.      
  23584.      long telldir(DIR *dir);
  23585.  
  23586. Description
  23587. -----------
  23588.  
  23589. This function returns a value which indicates the position of the
  23590. pointer in the given directory.  This value is only useful as an
  23591. argument to `seekdir' (*note seekdir::.).
  23592.  
  23593. Return Value
  23594. ------------
  23595.  
  23596. The directory pointer.
  23597.  
  23598. Example
  23599. -------
  23600.  
  23601.      DIR *dir;
  23602.      long q = telldir(dir);
  23603.      do_something();
  23604.      seekdir(dir, q);
  23605.  
  23606. 
  23607. File: libc.inf,  Node: textattr,  Next: textbackground,  Prev: telldir,  Up: Alphabetical List
  23608.  
  23609. textattr
  23610. ========
  23611.  
  23612. Syntax
  23613. ------
  23614.  
  23615.      #include <conio.h>
  23616.      
  23617.      void textattr(int _attr);
  23618.  
  23619. Description
  23620. -----------
  23621.  
  23622. Sets the attribute used for future writes to the screen:
  23623.  
  23624.      ---- XXXX = foreground color
  23625.      -XXX ---- = background color
  23626.      X--- ---- = 1=blink 0=steady
  23627.  
  23628. 
  23629. File: libc.inf,  Node: textbackground,  Next: textcolor,  Prev: textattr,  Up: Alphabetical List
  23630.  
  23631. textbackground
  23632. ==============
  23633.  
  23634. Syntax
  23635. ------
  23636.  
  23637.      #include <conio.h>
  23638.      
  23639.      void textbackground(int _color);
  23640.  
  23641. Description
  23642. -----------
  23643.  
  23644. Sets just the background of the text attribute. *Note textattr::.
  23645.  
  23646. 
  23647. File: libc.inf,  Node: textcolor,  Next: textmode,  Prev: textbackground,  Up: Alphabetical List
  23648.  
  23649. textcolor
  23650. =========
  23651.  
  23652. Syntax
  23653. ------
  23654.  
  23655.      #include <conio.h>
  23656.      
  23657.      void textcolor(int _color);
  23658.  
  23659. Description
  23660. -----------
  23661.  
  23662. Sets just the foreground of the text attribute. *Note textattr::.
  23663.  
  23664. 
  23665. File: libc.inf,  Node: textmode,  Next: time,  Prev: textcolor,  Up: Alphabetical List
  23666.  
  23667. textmode
  23668. ========
  23669.  
  23670. Syntax
  23671. ------
  23672.  
  23673.      #include <conio.h>
  23674.      
  23675.      void textmode(int _mode);
  23676.  
  23677. Description
  23678. -----------
  23679.  
  23680. Sets the text mode of the screen.  _MODE is one of the following:
  23681.  
  23682. `LASTMODE'
  23683.      The text mode which was in effect *before* the last call to
  23684.      `textmode()'.
  23685.  
  23686. `BW40'
  23687.      40-column black and white (on a color screen)
  23688.  
  23689. `C40'
  23690.      40-color color.
  23691.  
  23692. `BW80'
  23693.      80-column black and white (on a color screen)
  23694.  
  23695. `C80'
  23696.      80-column color
  23697.  
  23698. `MONO'
  23699.      The monochrome monitor
  23700.  
  23701. `C4350'
  23702.      80-column, 43- (on EGAs) or 50-row (on VGAs) color
  23703.  
  23704. *Note _set_screen_lines::, for a more versatile method of setting text
  23705. screen dimensions.
  23706.  
  23707. 
  23708. File: libc.inf,  Node: time,  Next: times,  Prev: textmode,  Up: Alphabetical List
  23709.  
  23710. time
  23711. ====
  23712.  
  23713. Syntax
  23714. ------
  23715.  
  23716.      #include <time.h>
  23717.      
  23718.      time_t time(time_t *t);
  23719.  
  23720. Description
  23721. -----------
  23722.  
  23723. If T is not `NULL', the current time is stored in `*t'.
  23724.  
  23725. Return Value
  23726. ------------
  23727.  
  23728. The current time is returned.
  23729.  
  23730. Example
  23731. -------
  23732.  
  23733.      printf("Time is %d\n", time(0));
  23734.  
  23735. 
  23736. File: libc.inf,  Node: times,  Next: tmpfile,  Prev: time,  Up: Alphabetical List
  23737.  
  23738. times
  23739. =====
  23740.  
  23741. Syntax
  23742. ------
  23743.  
  23744.      #include <sys/times.h>
  23745.      
  23746.      clock_t times(struct tms *buf);
  23747.  
  23748. Description
  23749. -----------
  23750.  
  23751. This function returns the number of clock ticks used by the current
  23752. process and all of its children until the moment of call.  The number
  23753. of tics per second is `CLOCKS_PER_SEC', defined on time.h.
  23754.  
  23755. This is the structure in which `times' returns its info:
  23756.  
  23757.      struct  tms {
  23758.        clock_t tms_cstime;
  23759.        clock_t tms_cutime;
  23760.        clock_t tms_stime;
  23761.        clock_t tms_utime;
  23762.      };
  23763.  
  23764. Currently, the elapsed time of the running program is returned in the
  23765. `tms_utime' field, and all other fields return as zero.
  23766.  
  23767. Return Value
  23768. ------------
  23769.  
  23770. The number of elapsed tics since the program started.
  23771.  
  23772. Example
  23773. -------
  23774.  
  23775.      printf("We used %d seconds of elapsed time\n", times(&buf)/CLOCKS_PER_SEC);
  23776.  
  23777. 
  23778. File: libc.inf,  Node: tmpfile,  Next: tmpnam,  Prev: times,  Up: Alphabetical List
  23779.  
  23780. tmpfile
  23781. =======
  23782.  
  23783. Syntax
  23784. ------
  23785.  
  23786.      #include <stdio.h>
  23787.      
  23788.      FILE *tmpfile(void);
  23789.  
  23790. Description
  23791. -----------
  23792.  
  23793. This function opens a temporary file.  It will automatically be removed
  23794. if the file is closed or when the program exits.  The name of the file
  23795. is generated by the same algorithm as described under tmpnam() (*note
  23796. tmpnam::.).
  23797.  
  23798. Return Value
  23799. ------------
  23800.  
  23801. A newly opened file.
  23802.  
  23803. Example
  23804. -------
  23805.  
  23806.      FILE *tmp = tmpfile();
  23807.  
  23808. 
  23809. File: libc.inf,  Node: tmpnam,  Next: toascii,  Prev: tmpfile,  Up: Alphabetical List
  23810.  
  23811. tmpnam
  23812. ======
  23813.  
  23814. Syntax
  23815. ------
  23816.  
  23817.      #include <stdio.h>
  23818.      
  23819.      char *tmpnam(char *s);
  23820.  
  23821. Description
  23822. -----------
  23823.  
  23824. This functions generates a string that is a valid file name and that is
  23825. not the same as the name of an existing file.  A different string is
  23826. guaranteed to be produced each time it is called, up to `TMP_MAX' times
  23827. (`TMP_MAX' is defined on stdio.h).  If `tmpnam' is called more than
  23828. TMP_MAX times, the behavior is implementation-dependent (ours just
  23829. wraps around and tries to reuse the same file names from the beginning).
  23830.  
  23831. This function examines the environment to determine the directory in
  23832. which the temporary file will be opened.  It looks for one of the
  23833. variables `"TMPDIR"', `"TEMP"' and `"TMP"', in that order.  The first
  23834. one which is found in the environment will be used on the assumption
  23835. that it points to a directory.  If neither of the above variables is
  23836. defined, `tmpnam' defaults to the "c:/" directory (which under MS-DOS
  23837. might mean that it fails to generate TMP_MAX unique names, because DOS
  23838. root directories cannot grow beyond certain limits).
  23839.  
  23840. Return Value
  23841. ------------
  23842.  
  23843. If S is a null pointer, `tmpnam' leaves its result in an internal
  23844. static buffer and returns a pointer to that buffer.  If S is not a null
  23845. pointer, it is assumed to point to an array of at least `L_tmpnam'
  23846. characters, and `tmpnam' writes its result in that array and returns a
  23847. pointer to it as its value.
  23848.  
  23849. Example
  23850. -------
  23851.  
  23852.      char buf[L_tmpnam];
  23853.      char *s = tmpname(buf);
  23854.  
  23855. 
  23856. File: libc.inf,  Node: toascii,  Next: tolower,  Prev: tmpnam,  Up: Alphabetical List
  23857.  
  23858. toascii
  23859. =======
  23860.  
  23861. Syntax
  23862. ------
  23863.  
  23864.      #include <ctype.h>
  23865.      
  23866.      int toascii(int c);
  23867.  
  23868. Description
  23869. -----------
  23870.  
  23871. This function strips the high bit of C, forcing it to be an ASCII
  23872. character.
  23873.  
  23874. Return Value
  23875. ------------
  23876.  
  23877. The ASCII character.
  23878.  
  23879. Example
  23880. -------
  23881.  
  23882.      for (i=0; buf[i]; i++)
  23883.        buf[i] = toascii(buf[i]);
  23884.  
  23885. 
  23886. File: libc.inf,  Node: tolower,  Next: toupper,  Prev: toascii,  Up: Alphabetical List
  23887.  
  23888. tolower
  23889. =======
  23890.  
  23891. Syntax
  23892. ------
  23893.  
  23894.      #include <ctype.h>
  23895.      
  23896.      int tolower(int c);
  23897.  
  23898. Description
  23899. -----------
  23900.  
  23901. This function returns C, converting it to lower case if it is upper
  23902. case.  *Note toupper::.
  23903.  
  23904. Return Value
  23905. ------------
  23906.  
  23907. The lower case letter.
  23908.  
  23909. Example
  23910. -------
  23911.  
  23912.      for (i=0; buf[i]; i++)
  23913.        buf[i] = tolower(buf[i]);
  23914.  
  23915. 
  23916. File: libc.inf,  Node: toupper,  Next: _truename,  Prev: tolower,  Up: Alphabetical List
  23917.  
  23918. toupper
  23919. =======
  23920.  
  23921. Syntax
  23922. ------
  23923.  
  23924.      #include <ctype.h>
  23925.      
  23926.      int toupper(int c);
  23927.  
  23928. Description
  23929. -----------
  23930.  
  23931. This function returns C, converting it to upper case if it is lower
  23932. case. *Note tolower::.
  23933.  
  23934. Return Value
  23935. ------------
  23936.  
  23937. The upper case letter.
  23938.  
  23939. Example
  23940. -------
  23941.  
  23942.      for (i=0; buf[i]; i++)
  23943.        buf[i] = toupper(buf[i]);
  23944.  
  23945. 
  23946. File: libc.inf,  Node: _truename,  Next: truncate,  Prev: toupper,  Up: Alphabetical List
  23947.  
  23948. _truename
  23949. =========
  23950.  
  23951. Syntax
  23952. ------
  23953.  
  23954.      #include <sys/stat.h>
  23955.      
  23956.      char * _truename(const char *path, char *true_path);
  23957.  
  23958. Description
  23959. -----------
  23960.  
  23961. Given a PATH of a file, returns in TRUE_PATH its canonicalized
  23962. pathname, with all letters uppercased, default drive and directory made
  23963. explicit, forward slashes converted to backslashes, asterisks converted
  23964. to appropriate number of of question marks, file and directory names
  23965. truncated to 8.3 if necessary, "." and ".." resolved, extra slashes (but
  23966. the last, if present) removed, SUBSTed, JOINed and ASSIGNed drives
  23967. resolved.  Character devices return as "X:/DEVNAME" (note the forward
  23968. slash!), where X is the CURRENT drive and DEVNAME is the device name
  23969. (e.g.  CON).  This is exactly what DOS TRUENAME command does.  See
  23970. Ralph Brown's Interrupt List for more details.
  23971.  
  23972. The named PATH doesn't have to exist, but the drive, if given as part
  23973. of it, should be a legal DOS drive, as this function hits the disk.
  23974.  
  23975. The function will fail if given a PATH which (1) is an empty string; or
  23976. (2) contains only the drive letter (e.g. "c:"); or (3) has leading
  23977. whitespace.  It will also fail if it couldn't allocate memory required
  23978. for its communication with DOS or for TRUE_PATH (see below).
  23979.  
  23980. Upon success, the function will place the result in TRUE_PATH, if
  23981. that's non-NULL; the buffer should be large enough to contain the
  23982. largest possible pathname (PATH_MAX characters).  If TRUE_PATH is a
  23983. NULL pointer, the space to hold the result will be allocated by calling
  23984. *Note malloc::; it is up to the caller to release the buffer by calling
  23985. *Note free::.
  23986.  
  23987. Return Value
  23988. ------------
  23989.  
  23990. The function returns the pointer to the result.  In case of any failure,
  23991. a NULL pointer is returned, and ERRNO is set.
  23992.  
  23993. Example
  23994. -------
  23995.  
  23996.        fprintf(stderr,
  23997.                "True name of %s is %s\n", path, _truename(path, (char *)0));
  23998.  
  23999. 
  24000. File: libc.inf,  Node: truncate,  Next: ttyname,  Prev: _truename,  Up: Alphabetical List
  24001.  
  24002. truncate
  24003. ========
  24004.  
  24005. Syntax
  24006. ------
  24007.  
  24008.      #include <unistd.h>
  24009.      
  24010.      int truncate(const char *file, off_t size);
  24011.  
  24012. Description
  24013. -----------
  24014.  
  24015. This function truncates FILE to SIZE bytes.
  24016.  
  24017. Return Value
  24018. ------------
  24019.  
  24020. Zero on success, nonzero on failure.
  24021.  
  24022. Example
  24023. -------
  24024.  
  24025.      ftruncate("/tmp/data.txt", 400);
  24026.  
  24027. 
  24028. File: libc.inf,  Node: ttyname,  Next: uclock,  Prev: truncate,  Up: Alphabetical List
  24029.  
  24030. ttyname
  24031. =======
  24032.  
  24033. Syntax
  24034. ------
  24035.  
  24036.      #include <unistd.h>
  24037.      
  24038.      char *ttyname(int file);
  24039.  
  24040. Description
  24041. -----------
  24042.  
  24043. Gives the name of the terminal associated with FILE.
  24044.  
  24045. Return Value
  24046. ------------
  24047.  
  24048. Returns "con" if FILE is a device, else `NULL'.
  24049.  
  24050. Example
  24051. -------
  24052.  
  24053.      char *tty = ttyname(0);
  24054.  
  24055. 
  24056. File: libc.inf,  Node: uclock,  Next: umask,  Prev: ttyname,  Up: Alphabetical List
  24057.  
  24058. uclock
  24059. ======
  24060.  
  24061. Syntax
  24062. ------
  24063.  
  24064.      #include <time.h>
  24065.      
  24066.      uclock_t uclock(void);
  24067.  
  24068. Description
  24069. -----------
  24070.  
  24071. This function returns the number of uclock ticks since an arbitrary
  24072. time, actually, since the first call to `uclock', which itself returns
  24073. zero.  The number of tics per second is UCLOCKS_PER_SEC.
  24074.  
  24075. `uclock' is provided for very high-resulution timing.  It is currently
  24076. accurate to better than 1 microsecond (actually about 840 nanoseconds).
  24077. You cannot time across two midnights with this implementation, giving
  24078. a maximum useful period of 48 hours and an effective limit of 24 hours.
  24079. Casting to a 32-bit integer limits its usefulness to about an hour
  24080. before 32 bits will wrap.
  24081.  
  24082. Note that `printf' cannot print a value of type `uclock_t', even though
  24083. it is an integer value, because it is a 64-bit integer.
  24084.  
  24085. Also note that `uclock' reprograms the interval timer in your PC to act
  24086. as a rate generator rather than a square wave generator.  I've had no
  24087. problems running in this mode all the time, but if you notice strange
  24088. things happening with the clock (losing time) after using `uclock',
  24089. check to see if this is the cause of the problem.
  24090.  
  24091. Return Value
  24092. ------------
  24093.  
  24094. The number of tics.
  24095.  
  24096. Example
  24097. -------
  24098.  
  24099.      printf("%d seconds have elapsed\n", (int)(uclock()/UCLOCKS_PER_SEC));
  24100.  
  24101. 
  24102. File: libc.inf,  Node: umask,  Next: uname,  Prev: uclock,  Up: Alphabetical List
  24103.  
  24104. umask
  24105. =====
  24106.  
  24107.      #include <sys/stat.h>
  24108.      
  24109.      mode_t umask(mode_t cmask);
  24110.  
  24111. Description
  24112. -----------
  24113.  
  24114. This function does nothing.  It exists to assist porting.
  24115.  
  24116. 
  24117. File: libc.inf,  Node: uname,  Next: ungetc,  Prev: umask,  Up: Alphabetical List
  24118.  
  24119. uname
  24120. =====
  24121.  
  24122. Syntax
  24123. ------
  24124.  
  24125.      #include <sys/utsname.h>
  24126.      
  24127.      #int uname(struct utsname *u);
  24128.  
  24129. Description
  24130. -----------
  24131.  
  24132. Fills in the structure with information about the system.
  24133.  
  24134.      struct utsname {
  24135.        char machine[9];
  24136.        char nodename[32];
  24137.        char release[9];
  24138.        char sysname[9];
  24139.        char version[9];
  24140.      };
  24141.  
  24142. `machine'
  24143.      "pc"
  24144.  
  24145. `nodename'
  24146.      The name of your PC (if networking is installed), else "pc".
  24147.  
  24148. `release'
  24149.      The minor release of dos.  For example, dos 1.23 would return "23"
  24150.      here.
  24151.  
  24152. `sysname'
  24153.      The flavor of the OS.
  24154.  
  24155. `version'
  24156.      The major release of dos.  For example, dos 1.23 would return "1"
  24157.      here.
  24158.  
  24159. Return Value
  24160. ------------
  24161.  
  24162. Zero on success, else nonzero.
  24163.  
  24164. 
  24165. File: libc.inf,  Node: ungetc,  Next: ungetch,  Prev: uname,  Up: Alphabetical List
  24166.  
  24167. ungetc
  24168. ======
  24169.  
  24170. Syntax
  24171. ------
  24172.  
  24173.      #include <stdio.h>
  24174.      
  24175.      int ungetc(int c, FILE *file);
  24176.  
  24177. Description
  24178. -----------
  24179.  
  24180. This function pushes C back into the FILE.  You can only push back one
  24181. character at a time.
  24182.  
  24183. Return Value
  24184. ------------
  24185.  
  24186. The pushed-back character, or `EOF' on error.
  24187.  
  24188. Example
  24189. -------
  24190.  
  24191.      int q;
  24192.      while (q = getc(stdin) != 'q');
  24193.      ungetc(q);
  24194.  
  24195. 
  24196. File: libc.inf,  Node: ungetch,  Next: unlink,  Prev: ungetc,  Up: Alphabetical List
  24197.  
  24198. ungetch
  24199. =======
  24200.  
  24201. Syntax
  24202. ------
  24203.  
  24204.      #include <conio.h>
  24205.      
  24206.      int ungetch(int);
  24207.  
  24208. Description
  24209. -----------
  24210.  
  24211. Puts a character back, so that *Note getch:: will return it instead of
  24212. actually reading the console.
  24213.  
  24214. Return Value
  24215. ------------
  24216.  
  24217. The charater is returned.
  24218.  
  24219. 
  24220. File: libc.inf,  Node: unlink,  Next: unlock,  Prev: ungetch,  Up: Alphabetical List
  24221.  
  24222. unlink
  24223. ======
  24224.  
  24225. Syntax
  24226. ------
  24227.  
  24228.      #include <unistd.h>
  24229.      
  24230.      int unlink(const char *file);
  24231.  
  24232. Description
  24233. -----------
  24234.  
  24235. This function removes a file from the file system.
  24236.  
  24237. Return Value
  24238. ------------
  24239.  
  24240. Zero on success, nonzero on failure.
  24241.  
  24242. Example
  24243. -------
  24244.  
  24245.      unlink("data.txt");
  24246.  
  24247. 
  24248. File: libc.inf,  Node: unlock,  Next: _use_lfn,  Prev: unlink,  Up: Alphabetical List
  24249.  
  24250. unlock
  24251. ======
  24252.  
  24253. Syntax
  24254. ------
  24255.  
  24256.      #include <io.h>
  24257.      
  24258.      int unlock(int fd, long offset, long length);
  24259.  
  24260. Description
  24261. -----------
  24262.  
  24263. Unlocks a region previously locked by `lock'.
  24264.  
  24265. *Note lock::.
  24266.  
  24267. Return Value
  24268. ------------
  24269.  
  24270. Zero if successful, nonzero if not.
  24271.  
  24272. 
  24273. File: libc.inf,  Node: _use_lfn,  Next: usleep,  Prev: unlock,  Up: Alphabetical List
  24274.  
  24275. _use_lfn
  24276. ========
  24277.  
  24278. Syntax
  24279. ------
  24280.  
  24281.      #include <fcntl.h>
  24282.      
  24283.      char _use_lfn(const char *path);
  24284.  
  24285. Description
  24286. -----------
  24287.  
  24288. The `_use_lfn' function returns a nonzero value if the low level libc
  24289. routines will use the "Long File Name" (LFN) functions provided with
  24290. Windows 9x (and other advanced filesystems), when accessing files and
  24291. directories on the same filesystem as PATH.  PATH may be any legal
  24292. pathname; however, the function only needs the name of the root
  24293. directory on the particular drive in question.  If PATH is a `NULL'
  24294. pointer, the function assumes that all the filesystems support (or do
  24295. not support) LFN in the same manner, and returns the info pertinent to
  24296. the last filesystem that was queried; this usually makes the call
  24297. faster.  Note that on Windows 95 you don't need to distinguish between
  24298. different drives: they all support LFN API.  If PATH does not specify
  24299. the drive explicitly, the current drive is used.
  24300.  
  24301. The header `fcntl.h' defines a macro `_USE_LFN'; applications should
  24302. use this macro instead of calling `_use_lfn' directly.  That is so this
  24303. routine could be replaced with one which always returns 0 to disable
  24304. using long file names.  Calling `_USE_LFN' also makes the code more
  24305. portable to other operating systems, where the macro can be redefined
  24306. to whatever is appropriate for that environment (e.g., it should be a
  24307. constant 1 on Unix systems and constant 0 for environments that don't
  24308. support LFN API, like some other MSDOS compilers).  Currently,
  24309. `_USE_LFN' assumes that LFN API does *not* depend on a drive.
  24310.  
  24311. Long file names can also be disabled by setting the flag
  24312. `_CRT0_FLAG_NO_LFN' in `_crt0_startup_flags' for an image which should
  24313. not allow use of long file names.  Long names can be suppressed at
  24314. runtime on a global basis by setting the environment variable `LFN' to
  24315. `N', i.e. `SET LFN=N'.  This might be needed if a distribution expected
  24316. the truncation of long file names to 8.3 format to work.  For example,
  24317. if a C source routine included the file exception.h (9 letters) and the
  24318. file was unzipped as exceptio.h, then GCC would not find the file
  24319. unless you set `LFN=n'.  The environment variable can be set in the
  24320. `DJGPP.ENV' file to always disable LFN support on any system, or can be
  24321. set in the DOS environment for a short term (single project) basis.  If
  24322. you dual boot a system between Windows 95 and DOS, you probably should
  24323. set `LFN=n' in your `DJGPP.ENV' file, since long file names would not
  24324. be visible under DOS, and working with the short names under DOS will
  24325. damage the long names when returning to Windows 95.
  24326.  
  24327. Return Value
  24328. ------------
  24329.  
  24330. If LFN APIs are supported and should be used, it returns 1, else 0.
  24331.  
  24332. Note that if the `_CRT0_FLAG_NO_LFN' bit is set, or `LFN' is set to `N'
  24333. or `n' in the environment, both `_use_lfn' and `_USE_LFN' will always
  24334. return 0 without querying the filesystem.  You can reset the
  24335. `_CRT0_FLAG_NO_LFN' bit at runtime to force filesystem to be queried.
  24336.  
  24337. Example
  24338. -------
  24339.  
  24340.  
  24341.      #include <fcntl.h>
  24342.      #include <sys/stat.h>
  24343.      
  24344.        int fd = creat (_USE_LFN ? "MyCurrentJobFile.Text" : "currjob.txt",
  24345.                        S_IRUSR | S_IWUSR);
  24346.  
  24347. 
  24348. File: libc.inf,  Node: usleep,  Next: utime,  Prev: _use_lfn,  Up: Alphabetical List
  24349.  
  24350. usleep
  24351. ======
  24352.  
  24353. Syntax
  24354. ------
  24355.  
  24356.      #include <unistd.h>
  24357.      
  24358.      unsigned usleep(unsigned usec);
  24359.  
  24360. Description
  24361. -----------
  24362.  
  24363. This function pauses the program for USEC microseconds.
  24364.  
  24365. Return Value
  24366. ------------
  24367.  
  24368. The number of unslept microseconds (i.e. zero).
  24369.  
  24370. Example
  24371. -------
  24372.  
  24373.      usleep(500000);
  24374.  
  24375. 
  24376. File: libc.inf,  Node: utime,  Next: utimes,  Prev: usleep,  Up: Alphabetical List
  24377.  
  24378. utime
  24379. =====
  24380.  
  24381. Syntax
  24382. ------
  24383.  
  24384.      #include <utime.h>
  24385.      
  24386.      int utime(const char *file, const struct utimbuf *time);
  24387.  
  24388. Description
  24389. -----------
  24390.  
  24391. This function sets the modification timestamp on the FILE.  The new
  24392. time is stored in this structure:
  24393.  
  24394.      struct utimbuf
  24395.      {
  24396.          time_t  actime;  /* access time (unused on FAT filesystems) */
  24397.          time_t  modtime; /* modification time */
  24398.      };
  24399.  
  24400. Note that, as under DOS a file only has a single timestamp, the
  24401. `actime' field of `struct utimbuf' is ignored by this function, and
  24402. only `modtime' field is used.  On filesystems which support long
  24403. filenames, both fields are used and both access and modification times
  24404. are set.
  24405.  
  24406. Return Value
  24407. ------------
  24408.  
  24409. Zero for success, nonzero for failure.
  24410.  
  24411. Example
  24412. -------
  24413.  
  24414.      struct utimbuf t;
  24415.      t.modtime = time(0);
  24416.      utime("data.txt", &t);
  24417.  
  24418. 
  24419. File: libc.inf,  Node: utimes,  Next: vfprintf,  Prev: utime,  Up: Alphabetical List
  24420.  
  24421. utimes
  24422. ======
  24423.  
  24424. Syntax
  24425. ------
  24426.  
  24427.      #include <sys/time.h>
  24428.      
  24429.      int utimes(const char *file, struct timeval tvp[2]);
  24430.  
  24431. Description
  24432. -----------
  24433.  
  24434. This function sets the timestamp of the file to `tvp[1].tv_sec'.
  24435.  
  24436. Return Value
  24437. ------------
  24438.  
  24439. Zero on success, nonzero on failure.
  24440.  
  24441. Example
  24442. -------
  24443.  
  24444.      time_t now;
  24445.      struct timeval tvp[2];
  24446.      time(&now);
  24447.      tvp[0].tv_sec = now + 100;
  24448.      utimes("foo.dat", tvp);
  24449.  
  24450. 
  24451. File: libc.inf,  Node: vfprintf,  Next: vprintf,  Prev: utimes,  Up: Alphabetical List
  24452.  
  24453. vfprintf
  24454. ========
  24455.  
  24456. Syntax
  24457. ------
  24458.  
  24459.      #include <stdio.h>
  24460.      #include <stdarg.h>
  24461.      
  24462.      int vfprintf(FILE *file, const char *format, va_list arguments);
  24463.  
  24464. Description
  24465. -----------
  24466.  
  24467. Sends formatted output from the ARGUMENTS to the FILE.  *Note printf::.
  24468.  
  24469. Return Value
  24470. ------------
  24471.  
  24472. The number of characters written.
  24473.  
  24474. Example
  24475. -------
  24476.  
  24477.      void my_errmsg(char *format, ...)
  24478.      {
  24479.        va_list arg;
  24480.      
  24481.        va_start(arg, format);
  24482.        fprintf(stderr, "my_errmsg: ");
  24483.        vfprintf(stderr, format, arg);
  24484.        va_end(arg);
  24485.      }
  24486.  
  24487. 
  24488. File: libc.inf,  Node: vprintf,  Next: vsprintf,  Prev: vfprintf,  Up: Alphabetical List
  24489.  
  24490. vprintf
  24491. =======
  24492.  
  24493. Syntax
  24494. ------
  24495.  
  24496.      #include <stdio.h>
  24497.      #include <stdarg.h>
  24498.      
  24499.      int vprintf(const char *format, va_list arguments);
  24500.  
  24501. Description
  24502. -----------
  24503.  
  24504. Sends formatted output from the ARGUMENTS to `stdout'.  *Note printf::.
  24505. *Note vfprintf::.
  24506.  
  24507. Return Value
  24508. ------------
  24509.  
  24510. The number of characters written.
  24511.  
  24512. 
  24513. File: libc.inf,  Node: vsprintf,  Next: wait,  Prev: vprintf,  Up: Alphabetical List
  24514.  
  24515. vsprintf
  24516. ========
  24517.  
  24518. Syntax
  24519. ------
  24520.  
  24521.      #include <stdio.h>
  24522.      #include <stdarg.h>
  24523.      
  24524.      int vsprintf(char *buffer, const char *format, va_list arguments);
  24525.  
  24526. Description
  24527. -----------
  24528.  
  24529. Sends formatted output from the ARGUMENTS to the BUFFER.  *Note
  24530. printf::. *Note vfprintf::.
  24531.  
  24532. Return Value
  24533. ------------
  24534.  
  24535. The number of characters written.
  24536.  
  24537. 
  24538. File: libc.inf,  Node: wait,  Next: waitpid,  Prev: vsprintf,  Up: Alphabetical List
  24539.  
  24540. wait
  24541. ====
  24542.  
  24543. Syntax
  24544. ------
  24545.  
  24546.      #include <sys/wait.h>
  24547.      
  24548.      pid_t pid = wait(int *status);
  24549.  
  24550. Description
  24551. -----------
  24552.  
  24553. This function causes its caller to delay its execution until a signal
  24554. is received or one of its child processes terminates.  If any child has
  24555. terminated, return is immediate, returning the process ID and its exit
  24556. status, if that's available.  If no children processes were called since
  24557. the last call, then -1 is returned and `errno' is set.
  24558.  
  24559. Return Value
  24560. ------------
  24561.  
  24562. If successful, this function returns the exit status of the child.  If
  24563. there is an error, these functions return -1 and set `errno' to
  24564. indicate the error type.
  24565.  
  24566. Bugs
  24567. ----
  24568.  
  24569. Currently, this function always fails.
  24570.  
  24571. 
  24572. File: libc.inf,  Node: waitpid,  Next: wcstombs,  Prev: wait,  Up: Alphabetical List
  24573.  
  24574. waitpid
  24575. =======
  24576.  
  24577. Syntax
  24578. ------
  24579.  
  24580.      #include <sys/wait.h>
  24581.      
  24582.      pid_t pid = waitpid((pid_t pid, int *status, int options);
  24583.  
  24584. Description
  24585. -----------
  24586.  
  24587. Currently, this function always fails. A -1 is returned and `errno' is
  24588. set to indicate there are no children.
  24589.  
  24590. Return Value
  24591. ------------
  24592.  
  24593. If successful, this function returns the exit status of the child.  If
  24594. there is an error, these functions return -1 and set `errno' to
  24595. indicate the error type.
  24596.  
  24597. Bugs
  24598. ----
  24599.  
  24600. Currently, this function always fails.
  24601.  
  24602. 
  24603. File: libc.inf,  Node: wcstombs,  Next: wctomb,  Prev: waitpid,  Up: Alphabetical List
  24604.  
  24605. wcstombs
  24606. ========
  24607.  
  24608. Syntax
  24609. ------
  24610.  
  24611.      #include <stdlib.h>
  24612.      
  24613.      size_t wcstombs(char *s, const wchar_t *wcs, size_t n);
  24614.  
  24615. Description
  24616. -----------
  24617.  
  24618. Converts a wide character string to a multibyte string.  At most N
  24619. characters are stored.
  24620.  
  24621. Return Value
  24622. ------------
  24623.  
  24624. The number of characters stored.
  24625.  
  24626. Example
  24627. -------
  24628.  
  24629.      int len = wcstombs(buf, wstring, sizeof(buf));
  24630.  
  24631. 
  24632. File: libc.inf,  Node: wctomb,  Next: wherex,  Prev: wcstombs,  Up: Alphabetical List
  24633.  
  24634. wctomb
  24635. ======
  24636.  
  24637. Syntax
  24638. ------
  24639.  
  24640.      #include <stdlib.h>
  24641.      
  24642.      int wctomb(char *s, wchar_t wchar);
  24643.  
  24644. Description
  24645. -----------
  24646.  
  24647. Convert a wide character to a multibyte character.  The string S must
  24648. be at least `MB_LEN_MAX' bytes long.
  24649.  
  24650. Return Value
  24651. ------------
  24652.  
  24653. The number of characters stored.
  24654.  
  24655. Example
  24656. -------
  24657.  
  24658.      char s[MB_LEN_MAX];
  24659.      int mlen = wctomb(s, wc);
  24660.  
  24661. 
  24662. File: libc.inf,  Node: wherex,  Next: wherey,  Prev: wctomb,  Up: Alphabetical List
  24663.  
  24664. wherex
  24665. ======
  24666.  
  24667. Syntax
  24668. ------
  24669.  
  24670.      #include <conio.h>
  24671.      
  24672.      int wherex(void);
  24673.  
  24674. Return Value
  24675. ------------
  24676.  
  24677. The column the cursor is on.  The leftmost column is 1.
  24678.  
  24679. 
  24680. File: libc.inf,  Node: wherey,  Next: window,  Prev: wherex,  Up: Alphabetical List
  24681.  
  24682. wherey
  24683. ======
  24684.  
  24685. Syntax
  24686. ------
  24687.  
  24688.      #include <conio.h>
  24689.      
  24690.      int     wherey(void);
  24691.  
  24692. Return Value
  24693. ------------
  24694.  
  24695. The row the cursor is on.  The topmost row is 1.
  24696.  
  24697. 
  24698. File: libc.inf,  Node: window,  Next: write,  Prev: wherey,  Up: Alphabetical List
  24699.  
  24700. window
  24701. ======
  24702.  
  24703. Syntax
  24704. ------
  24705.  
  24706.      #include <conio.h>
  24707.      
  24708.      void    window(int _left, int _top, int _right, int _bottom);
  24709.  
  24710. Description
  24711. -----------
  24712.  
  24713. Specifies the window on the screen to be used for future output
  24714. requests.  The upper left corner of the physical screen is (1,1).
  24715.  
  24716. 
  24717. File: libc.inf,  Node: write,  Next: _write,  Prev: window,  Up: Alphabetical List
  24718.  
  24719. write
  24720. =====
  24721.  
  24722. Syntax
  24723. ------
  24724.  
  24725.      #include <unistd.h>
  24726.      
  24727.      int write(int file, const void *buffer, unsigned count);
  24728.  
  24729. Description
  24730. -----------
  24731.  
  24732. This function writes COUNT bytes from BUFFER to FILE.  It returns the
  24733. number of bytes actually written.  It will return zero if the disk is
  24734. full, and may return less than COUNT even under valid conditions.
  24735.  
  24736. Note that if FILE is a text file, `write' may write more bytes than it
  24737. reports.
  24738.  
  24739. If COUNT is zero, the function does nothing and returns zero.  Use
  24740. _write if you want to actually ask dos to write zero bytes.
  24741.  
  24742. Return Value
  24743. ------------
  24744.  
  24745. The number of bytes written, zero at EOF, or -1 on error.
  24746.  
  24747. Example
  24748. -------
  24749.  
  24750.      write(fd, "hello", 5);
  24751.  
  24752. 
  24753. File: libc.inf,  Node: _write,  Next: xfree,  Prev: write,  Up: Alphabetical List
  24754.  
  24755. _write
  24756. ======
  24757.  
  24758. Syntax
  24759. ------
  24760.  
  24761.      #include <io.h>
  24762.      
  24763.      ssize_t _write(int fildes, void *buf, size_t nbyte);
  24764.  
  24765. Description
  24766. -----------
  24767.  
  24768. This is a direct connection to the MS-DOS write function call, int
  24769. 0x21, %ah = 0x40.  No conversion is done on the data; it is written as
  24770. raw binary data.
  24771.  
  24772. Return Value
  24773. ------------
  24774.  
  24775. The number of bytes written.
  24776.  
  24777. 
  24778. File: libc.inf,  Node: xfree,  Next: xmalloc,  Prev: _write,  Up: Alphabetical List
  24779.  
  24780. xfree
  24781. =====
  24782.  
  24783. Syntax
  24784. ------
  24785.  
  24786.      #include <stdlib.h>
  24787.      
  24788.      void xfree(void *ptr);
  24789.  
  24790. Description
  24791. -----------
  24792.  
  24793. Frees memory allocated by `xmalloc' (*note xmalloc::.).  This function
  24794. guarantees that a NULL pointer is handled gracefully.
  24795.  
  24796. Example
  24797. -------
  24798.  
  24799.      void *f = xmalloc(100);
  24800.      xfree(f);
  24801.  
  24802. 
  24803. File: libc.inf,  Node: xmalloc,  Next: xrealloc,  Prev: xfree,  Up: Alphabetical List
  24804.  
  24805. xmalloc
  24806. =======
  24807.  
  24808. Syntax
  24809. ------
  24810.  
  24811.      #include <stdlib.h>
  24812.      
  24813.      void *xmalloc(size_t size);
  24814.  
  24815. Description
  24816. -----------
  24817.  
  24818. This function is just like `malloc' (*note malloc::.), except that if
  24819. there is no more memory, it prints an error message and exits.
  24820.  
  24821. Return Value
  24822. ------------
  24823.  
  24824. A pointer to the newly allocated memory.
  24825.  
  24826. Example
  24827. -------
  24828.  
  24829.      char *f = xmalloc(100);
  24830.  
  24831. 
  24832. File: libc.inf,  Node: xrealloc,  Prev: xmalloc,  Up: Alphabetical List
  24833.  
  24834. xrealloc
  24835. ========
  24836.  
  24837. Syntax
  24838. ------
  24839.  
  24840.      #include <stdlib.h>
  24841.      
  24842.      void *xrealloc(void *ptr, size_t size);
  24843.  
  24844. Description
  24845. -----------
  24846.  
  24847. This function is just like `realloc' (*note realloc::.), except that if
  24848. there is no more memory, it prints an error message and exits.  It can
  24849. also properly handle PTR being `NULL'.
  24850.  
  24851. Return Value
  24852. ------------
  24853.  
  24854. A pointer to a possibly new block.
  24855.  
  24856. Example
  24857. -------
  24858.  
  24859.      char *buf;
  24860.      buf = (char *)xrealloc(buf, new_size);
  24861.  
  24862. 
  24863. File: libc.inf,  Node: Index,  Up: Top
  24864.  
  24865. * Menu:
  24866. *Note Alphabetical List::
  24867.  
  24868.  
  24869. 
  24870. Tag Table:
  24871. Node: Top176
  24872. Node: Introduction480
  24873. Node: Functional Categories1690
  24874. Node: bios functions2426
  24875. Node: conio functions2814
  24876. Node: cpu functions3665
  24877. Node: ctype functions4180
  24878. Node: dos functions4518
  24879. Node: dpmi functions5231
  24880. Node: environment functions9182
  24881. Node: file system functions9388
  24882. Node: go32 functions10310
  24883. Node: io functions10717
  24884. Node: locale functions11196
  24885. Node: math functions11467
  24886. Node: memory functions11937
  24887. Node: misc functions12693
  24888. Node: mono functions13083
  24889. Node: posix functions13288
  24890. Node: process functions13493
  24891. Node: random number functions13859
  24892. Node: shell functions14078
  24893. Node: signal functions14270
  24894. Node: sound functions14507
  24895. Node: startup functions14693
  24896. Node: stdio functions14981
  24897. Node: stdlib functions15866
  24898. Node: string functions16042
  24899. Node: termios functions16702
  24900. Node: time functions17065
  24901. Node: unix functions17464
  24902. Node: Alphabetical List18070
  24903. Node: abort29303
  24904. Node: abs29722
  24905. Node: access30020
  24906. Node: acos30917
  24907. Node: acosh31134
  24908. Node: addmntent31368
  24909. Node: alarm31793
  24910. Node: alloca32392
  24911. Node: asctime32907
  24912. Node: asin33625
  24913. Node: asinh33841
  24914. Node: assert34070
  24915. Node: atan34954
  24916. Node: atan235172
  24917. Node: atanh35451
  24918. Node: atexit35684
  24919. Node: atof36411
  24920. Node: atoi36980
  24921. Node: atol37535
  24922. Node: _atold38094
  24923. Node: bcmp38690
  24924. Node: bcopy39293
  24925. Node: bdos39768
  24926. Node: bdosptr40544
  24927. Node: _bios_disk41674
  24928. Node: _bios_equiplist46476
  24929. Node: _bios_keybrd47686
  24930. Node: _bios_memsize50279
  24931. Node: _bios_printer50744
  24932. Node: _bios_serialcom52058
  24933. Node: _bios_timeofday54926
  24934. Node: bioscom55906
  24935. Node: biosdisk58003
  24936. Node: biosequip59867
  24937. Node: bioskey61202
  24938. Node: biosmemory62057
  24939. Node: biosprint62605
  24940. Node: biostime63389
  24941. Node: blinkvideo63872
  24942. Node: brk64817
  24943. Node: bsearch65455
  24944. Node: bzero66709
  24945. Node: calloc67068
  24946. Node: ceil67794
  24947. Node: cfgetispeed68051
  24948. Node: cfgetospeed68558
  24949. Node: cfmakeraw69072
  24950. Node: cfree69537
  24951. Node: cfsetispeed69947
  24952. Node: cfsetospeed70449
  24953. Node: cfsetspeed70957
  24954. Node: cgets71465
  24955. Node: chdir72054
  24956. Node: chmod72678
  24957. Node: _chmod73348
  24958. Node: chown74472
  24959. Node: chsize74869
  24960. Node: _clear8775184
  24961. Node: clearerr75509
  24962. Node: clock75870
  24963. Node: close76391
  24964. Node: _close76804
  24965. Node: closedir77157
  24966. Node: clreol77510
  24967. Node: clrscr77766
  24968. Node: _conio_kbhit77995
  24969. Node: _control8778525
  24970. Node: cos80055
  24971. Node: cosh80267
  24972. Node: cprintf80490
  24973. Node: cputs80980
  24974. Node: creat81297
  24975. Node: _creat82029
  24976. Node: crlf2nl82436
  24977. Node: __crt0_glob_function82793
  24978. Node: __crt0_load_environment_file83573
  24979. Node: __crt0_setup_arguments84230
  24980. Node: _crt0_startup_flags85193
  24981. Node: cscanf90216
  24982. Node: ctime90574
  24983. Node: delay91000
  24984. Node: delline91432
  24985. Node: difftime91702
  24986. Node: disable92196
  24987. Node: div92743
  24988. Node: __djgpp_exception_toggle93464
  24989. Node: __djgpp_map_physical_memory94372
  24990. Node: __djgpp_memory_handle95968
  24991. Node: __djgpp_memory_handle_list96608
  24992. Node: __djgpp_nearptr_disable97190
  24993. Node: __djgpp_nearptr_enable97596
  24994. Node: __djgpp_set_ctrl_c99204
  24995. Node: __djgpp_set_page_attributes101060
  24996. Node: _djstat_describe_lossage102368
  24997. Node: _djstat_fail_bits104551
  24998. Node: _djstat_flags108047
  24999. Node: _doprnt110296
  25000. Node: _dos_close110944
  25001. Node: _dos_commit111615
  25002. Node: _dos_creat112202
  25003. Node: _dos_creatnew113343
  25004. Node: _dos_findfirst114495
  25005. Node: _dos_findnext116071
  25006. Node: _dos_getdate116528
  25007. Node: _dos_getdiskfree117291
  25008. Node: _dos_getdrive118286
  25009. Node: _dos_getfileattr118881
  25010. Node: _dos_getftime120299
  25011. Node: _dos_gettime122215
  25012. Node: _dos_lock122927
  25013. Node: _dos_open123302
  25014. Node: _dos_read124841
  25015. Node: _dos_setdate126224
  25016. Node: _dos_setdrive127214
  25017. Node: _dos_setfileattr127960
  25018. Node: _dos_setftime128969
  25019. Node: _dos_settime130438
  25020. Node: _dos_unlock131348
  25021. Node: _dos_write131737
  25022. Node: _doscan133157
  25023. Node: dosexterr133861
  25024. Node: dosmemget139491
  25025. Node: dosmemgetb140366
  25026. Node: dosmemgetl141285
  25027. Node: dosmemgetw142223
  25028. Node: dosmemput143157
  25029. Node: dosmemputb143999
  25030. Node: dosmemputl144892
  25031. Node: dosmemputw145794
  25032. Node: DPMI Overview146702
  25033. Node: DPMI Specification151753
  25034. Node: __dpmi_allocate_dos_memory152092
  25035. Node: __dpmi_allocate_ldt_descriptors153028
  25036. Node: __dpmi_allocate_linear_memory153801
  25037. Node: __dpmi_allocate_memory154586
  25038. Node: __dpmi_allocate_real_mode_callback155213
  25039. Node: __dpmi_allocate_shared_memory156129
  25040. Node: __dpmi_allocate_specific_ldt_descriptor156750
  25041. Node: __dpmi_clear_debug_watchpoint157402
  25042. Node: __dpmi_create_alias_descriptor158015
  25043. Node: __dpmi_discard_page_contents158663
  25044. Node: __dpmi_free_dos_memory159350
  25045. Node: __dpmi_free_ldt_descriptor160022
  25046. Node: __dpmi_free_memory160699
  25047. Node: __dpmi_free_physical_address_mapping161273
  25048. Node: __dpmi_free_real_mode_callback161988
  25049. Node: __dpmi_free_serialization_on_shared_memory162638
  25050. Node: __dpmi_free_shared_memory163305
  25051. Node: __dpmi_get_and_disable_virtual_interrupt_state163925
  25052. Node: __dpmi_get_and_enable_virtual_interrupt_state164624
  25053. Node: __dpmi_get_and_set_virtual_interrupt_state165343
  25054. Node: __dpmi_get_capabilities166150
  25055. Node: __dpmi_get_coprocessor_status167281
  25056. Node: __dpmi_get_descriptor167870
  25057. Node: __dpmi_get_descriptor_access_rights169170
  25058. Node: __dpmi_get_extended_exception_handler_vector_pm169875
  25059. Node: __dpmi_get_extended_exception_handler_vector_rm170640
  25060. Node: __dpmi_get_free_memory_information171398
  25061. Node: __dpmi_get_memory_block_size_and_base172140
  25062. Node: __dpmi_get_memory_information172821
  25063. Node: __dpmi_get_multiple_descriptors173479
  25064. Node: __dpmi_get_page_attributes174436
  25065. Node: __dpmi_get_page_size175191
  25066. Node: __dpmi_get_processor_exception_handler_vector175781
  25067. Node: __dpmi_get_protected_mode_interrupt_vector176540
  25068. Node: __dpmi_get_raw_mode_switch_addr177334
  25069. Node: __dpmi_get_real_mode_interrupt_vector177985
  25070. Node: __dpmi_get_segment_base_address178841
  25071. Node: __dpmi_get_segment_limit179617
  25072. Node: __dpmi_get_selector_increment_value180185
  25073. Node: __dpmi_get_state_of_debug_watchpoint180848
  25074. Node: __dpmi_get_state_save_restore_addr181577
  25075. Node: __dpmi_get_vendor_specific_api_entry_point182252
  25076. Node: __dpmi_get_version182952
  25077. Node: __dpmi_get_virtual_interrupt_state183822
  25078. Node: __dpmi_install_resident_service_provider_callback184447
  25079. Node: __dpmi_int185125
  25080. Node: __dpmi_lock_linear_region186132
  25081. Node: __dpmi_map_conventional_memory_in_memory_block186812
  25082. Node: __dpmi_map_device_in_memory_block187626
  25083. Node: __dpmi_mark_page_as_demand_paging_candidate188443
  25084. Node: __dpmi_mark_real_mode_region_as_pageable189191
  25085. Node: __dpmi_physical_address_mapping189941
  25086. Node: __dpmi_relock_real_mode_region190708
  25087. Node: __dpmi_reset_debug_watchpoint191421
  25088. Node: __dpmi_resize_dos_memory191990
  25089. Node: __dpmi_resize_linear_memory192743
  25090. Node: __dpmi_resize_memory193529
  25091. Node: __dpmi_segment_to_descriptor194262
  25092. Node: __dpmi_serialize_on_shared_memory195082
  25093. Node: __dpmi_set_coprocessor_emulation195718
  25094. Node: __dpmi_set_debug_watchpoint196313
  25095. Node: __dpmi_set_descriptor197032
  25096. Node: __dpmi_set_descriptor_access_rights197665
  25097. Node: __dpmi_set_extended_exception_handler_vector_pm198922
  25098. Node: __dpmi_set_extended_exception_handler_vector_rm199688
  25099. Node: __dpmi_set_multiple_descriptors200445
  25100. Node: __dpmi_set_page_attributes201271
  25101. Node: __dpmi_set_processor_exception_handler_vector202030
  25102. Node: __dpmi_set_protected_mode_interrupt_vector202814
  25103. Node: __dpmi_set_real_mode_interrupt_vector203798
  25104. Node: __dpmi_set_segment_base_address204605
  25105. Node: __dpmi_set_segment_limit205269
  25106. Node: __dpmi_simulate_real_mode_interrupt206107
  25107. Node: __dpmi_simulate_real_mode_procedure_iret206944
  25108. Node: __dpmi_simulate_real_mode_procedure_retf207755
  25109. Node: __dpmi_simulate_real_mode_procedure_retf_stack208606
  25110. Node: __dpmi_terminate_and_stay_resident209785
  25111. Node: __dpmi_unlock_linear_region210447
  25112. Node: __dpmi_yield211076
  25113. Node: dup211610
  25114. Node: dup2212030
  25115. Node: _dxe_load212570
  25116. Node: enable213274
  25117. Node: endgrent213824
  25118. Node: endmntent214190
  25119. Node: endpwent214559
  25120. Node: errno214883
  25121. Node: exec*216757
  25122. Node: __exit217829
  25123. Node: _exit218448
  25124. Node: exit219112
  25125. Node: exp219631
  25126. Node: fabs219838
  25127. Node: _far*220127
  25128. Node: fclose222737
  25129. Node: fcntl223129
  25130. Node: fdopen223672
  25131. Node: feof224218
  25132. Node: ferror224630
  25133. Node: fflush225063
  25134. Node: ffs225594
  25135. Node: fgetc226063
  25136. Node: fgetgrent226502
  25137. Node: fgetpos226806
  25138. Node: fgets227214
  25139. Node: File System Extensions227988
  25140. Node: __file_exists231217
  25141. Node: file_tree_walk231930
  25142. Node: filelength234618
  25143. Node: fileno235322
  25144. Node: findfirst235665
  25145. Node: findnext237871
  25146. Node: _fixpath238246
  25147. Node: floor239282
  25148. Node: _flush_disk_cache239547
  25149. Node: fmod239899
  25150. Node: _fmode240139
  25151. Node: fnmatch240589
  25152. Node: fnmerge242143
  25153. Node: fnsplit242979
  25154. Node: fopen244249
  25155. Node: fork246290
  25156. Node: fpathconf246573
  25157. Node: _fpreset247022
  25158. Node: fprintf247259
  25159. Node: fpurge247615
  25160. Node: fputc247947
  25161. Node: fputs248333
  25162. Node: fread248767
  25163. Node: free249232
  25164. Node: freopen249628
  25165. Node: frexp250183
  25166. Node: fscanf250631
  25167. Node: fseek251048
  25168. Node: fsetpos252126
  25169. Node: __FSEXT_add_open_handler252562
  25170. Node: __FSEXT_alloc_fd253241
  25171. Node: __FSEXT_call_open_handlers254158
  25172. Node: __FSEXT_get_function254714
  25173. Node: __FSEXT_set_function255419
  25174. Node: fstat257257
  25175. Node: fsync260219
  25176. Node: ftell260604
  25177. Node: ftime261006
  25178. Node: ftruncate261741
  25179. Node: ftw262234
  25180. Node: _fwalk266656
  25181. Node: fwrite267095
  25182. Node: _get_dev_info267579
  25183. Node: _get_dos_version268040
  25184. Node: _get_volume_info269907
  25185. Node: getc271643
  25186. Node: getcbrk272047
  25187. Node: getch272378
  25188. Node: getchar272833
  25189. Node: getche273131
  25190. Node: getcwd273581
  25191. Node: getdate274299
  25192. Node: getdfree274801
  25193. Node: getdisk275538
  25194. Node: getdtablesize275917
  25195. Node: getegid276246
  25196. Node: getenv276514
  25197. Node: geteuid276954
  25198. Node: getftime277213
  25199. Node: getgid277940
  25200. Node: getgrent278199
  25201. Node: getgrgid279297
  25202. Node: getgrnam279711
  25203. Node: gethostname280131
  25204. Node: getitimer281010
  25205. Node: getkey281524
  25206. Node: getlogin282099
  25207. Node: getlongpass282539
  25208. Node: getmntent283403
  25209. Node: getopt287363
  25210. Node: getpagesize288842
  25211. Node: getpass289186
  25212. Node: getpgrp290006
  25213. Node: getpid290320
  25214. Node: getpwent290647
  25215. Node: getpwnam291531
  25216. Node: getpwuid291912
  25217. Node: getrlimit292286
  25218. Node: getrusage292812
  25219. Node: gets293538
  25220. Node: gettext294119
  25221. Node: gettextinfo294465
  25222. Node: gettime295295
  25223. Node: gettimeofday295860
  25224. Node: getuid296658
  25225. Node: getw296912
  25226. Node: getwd297392
  25227. Node: getxkey297799
  25228. Node: glob298365
  25229. Node: globfree304719
  25230. Node: gmtime304975
  25231. Node: _go32_conventional_mem_selector306151
  25232. Node: _go32_dpmi_allocate_dos_memory307250
  25233. Node: _go32_dpmi_allocate_iret_wrapper308465
  25234. Node: _go32_dpmi_allocate_real_mode_callback_iret309668
  25235. Node: _go32_dpmi_allocate_real_mode_callback_retf311438
  25236. Node: _go32_dpmi_chain_protected_mode_interrupt_vector312630
  25237. Node: _go32_dpmi_free_dos_memory313631
  25238. Node: _go32_dpmi_free_iret_wrapper314397
  25239. Node: _go32_dpmi_free_real_mode_callback315047
  25240. Node: _go32_dpmi_get_free_memory_information315754
  25241. Node: _go32_dpmi_get_protected_mode_interrupt_vector317062
  25242. Node: _go32_dpmi_get_real_mode_interrupt_vector317929
  25243. Node: _go32_dpmi_lock_code318638
  25244. Node: _go32_dpmi_lock_data319322
  25245. Node: _go32_dpmi_remaining_physical_memory319942
  25246. Node: _go32_dpmi_remaining_virtual_memory320437
  25247. Node: _go32_dpmi_resize_dos_memory320936
  25248. Node: _go32_dpmi_set_protected_mode_interrupt_vector321891
  25249. Node: _go32_dpmi_set_real_mode_interrupt_vector323787
  25250. Node: _go32_dpmi_simulate_fcall324508
  25251. Node: _go32_dpmi_simulate_fcall_iret325633
  25252. Node: _go32_dpmi_simulate_int326769
  25253. Node: _go32_info_block327906
  25254. Node: _go32_interrupt_stack_size331282
  25255. Node: _go32_my_cs331653
  25256. Node: _go32_my_ds332012
  25257. Node: _go32_my_ss332341
  25258. Node: _go32_rmcb_stack_size332680
  25259. Node: _go32_want_ctrl_break333045
  25260. Node: _go32_was_ctrl_break_hit333964
  25261. Node: gotoxy334748
  25262. Node: gppconio_init335070
  25263. Node: hasmntopt335550
  25264. Node: highvideo336055
  25265. Node: htonl336325
  25266. Node: htons336834
  25267. Node: hypot337336
  25268. Node: inb337678
  25269. Node: index337940
  25270. Node: inp338488
  25271. Node: inportb338753
  25272. Node: inportl339205
  25273. Node: inportsb339675
  25274. Node: inportsl339996
  25275. Node: inportsw340319
  25276. Node: inportw340642
  25277. Node: inpw341098
  25278. Node: insline341370
  25279. Node: insque341678
  25280. Node: int386342271
  25281. Node: int386x342649
  25282. Node: int86343043
  25283. Node: int86x345329
  25284. Node: intdos346004
  25285. Node: intdosx346356
  25286. Node: intensevideo346735
  25287. Node: ioctl (DOS)347721
  25288. Node: ioctl (General description)351956
  25289. Node: ioctl (UNIX)352541
  25290. Node: _is_executable352984
  25291. Node: isalnum354865
  25292. Node: isalpha355202
  25293. Node: isascii355495
  25294. Node: isatty355809
  25295. Node: iscntrl356218
  25296. Node: isdigit356532
  25297. Node: isgraph356823
  25298. Node: islower357180
  25299. Node: isprint357484
  25300. Node: ispunct357837
  25301. Node: isspace358193
  25302. Node: isupper358565
  25303. Node: isxdigit358883
  25304. Node: itoa359234
  25305. Node: kbhit360120
  25306. Node: kill360892
  25307. Node: labs361212
  25308. Node: ldexp361493
  25309. Node: ldiv361795
  25310. Node: _lfn_gen_short_fname362527
  25311. Node: _lfn_get_ftime364794
  25312. Node: __libc_termios_init366447
  25313. Node: link366976
  25314. Node: llabs367486
  25315. Node: lldiv367781
  25316. Node: localeconv368537
  25317. Node: localtime371372
  25318. Node: lock371805
  25319. Node: log372570
  25320. Node: log10372788
  25321. Node: log2373012
  25322. Node: longjmp373236
  25323. Node: lowvideo374009
  25324. Node: lseek374273
  25325. Node: malloc374981
  25326. Node: mblen375560
  25327. Node: mbstowcs376139
  25328. Node: mbtowc376641
  25329. Node: memccpy377229
  25330. Node: memchr378200
  25331. Node: memcmp378693
  25332. Node: memcpy379097
  25333. Node: memmove379476
  25334. Node: memset380028
  25335. Node: mkdir380477
  25336. Node: mkfifo380914
  25337. Node: mknod381142
  25338. Node: mkstemp381370
  25339. Node: mktemp382114
  25340. Node: mktime382880
  25341. Node: modf383345
  25342. Node: modfl383734
  25343. Node: _mono_clear384146
  25344. Node: _mono_printf384403
  25345. Node: _mono_putc384712
  25346. Node: movedata384987
  25347. Node: movedatab386568
  25348. Node: movedatal386907
  25349. Node: movedataw387298
  25350. Node: movetext387688
  25351. Node: mprotect388079
  25352. Node: _my_cs389228
  25353. Node: _my_ds389559
  25354. Node: _my_ss389888
  25355. Node: nice390215
  25356. Node: normvideo390542
  25357. Node: nosound390820
  25358. Node: ntohl391045
  25359. Node: ntohs391549
  25360. Node: open392047
  25361. Node: _open394225
  25362. Node: opendir394626
  25363. Node: outb395734
  25364. Node: outp396014
  25365. Node: outportb396296
  25366. Node: outportl396710
  25367. Node: outportsb397129
  25368. Node: outportsl397443
  25369. Node: outportsw397759
  25370. Node: outportw398076
  25371. Node: outpw398494
  25372. Node: pathconf398784
  25373. Node: pause400059
  25374. Node: pclose400386
  25375. Node: perror400957
  25376. Node: pipe401495
  25377. Node: popen401718
  25378. Node: pow402977
  25379. Node: pow10403203
  25380. Node: pow2403425
  25381. Node: _preserve_fncase403656
  25382. Node: printf405198
  25383. Node: putc408568
  25384. Node: putch408952
  25385. Node: putchar409416
  25386. Node: putenv409797
  25387. Node: puts410629
  25388. Node: puttext411028
  25389. Node: putw411370
  25390. Node: qsort411842
  25391. Node: raise413312
  25392. Node: rand413665
  25393. Node: random414021
  25394. Node: rawclock414308
  25395. Node: read414734
  25396. Node: _read415374
  25397. Node: readdir415803
  25398. Node: realloc416558
  25399. Node: regcomp417363
  25400. Node: regerror430742
  25401. Node: regexec433068
  25402. Node: regfree438264
  25403. Node: remove438737
  25404. Node: remque439202
  25405. Node: _rename439764
  25406. Node: rename441034
  25407. Node: rewind442584
  25408. Node: rewinddir442967
  25409. Node: rindex443411
  25410. Node: rmdir443963
  25411. Node: sbrk444370
  25412. Node: scanf445253
  25413. Node: Screen Variables448711
  25414. Node: ScreenClear449845
  25415. Node: ScreenCols450314
  25416. Node: ScreenGetChar450976
  25417. Node: ScreenGetCursor451794
  25418. Node: ScreenMode452326
  25419. Node: ScreenPutChar452783
  25420. Node: ScreenPutString453424
  25421. Node: ScreenRetrieve454166
  25422. Node: ScreenRows454874
  25423. Node: ScreenSetCursor455442
  25424. Node: ScreenUpdate455962
  25425. Node: ScreenUpdateLine456478
  25426. Node: ScreenVisualBell456965
  25427. Node: searchpath457454
  25428. Node: seekdir458129
  25429. Node: select458754
  25430. Node: _set_screen_lines459800
  25431. Node: setbuf460915
  25432. Node: setbuffer461718
  25433. Node: setcbrk462534
  25434. Node: _setcursortype462915
  25435. Node: setdate463353
  25436. Node: setdisk463736
  25437. Node: setenv464142
  25438. Node: setftime464688
  25439. Node: setgrent465423
  25440. Node: setitimer465830
  25441. Node: setjmp467119
  25442. Node: setlinebuf467898
  25443. Node: setlocale468563
  25444. Node: setmntent469692
  25445. Node: setmode470898
  25446. Node: setpgid472196
  25447. Node: setpwent472478
  25448. Node: setrlimit472834
  25449. Node: settime473287
  25450. Node: settimeofday473670
  25451. Node: setvbuf474123
  25452. Node: siglongjmp475184
  25453. Node: signal475435
  25454. Node: sigsetjmp482277
  25455. Node: sin482524
  25456. Node: sinh482733
  25457. Node: sleep482952
  25458. Node: sound483345
  25459. Node: spawn*483593
  25460. Node: sprintf488223
  25461. Node: sqrt488597
  25462. Node: srandom488818
  25463. Node: sscanf489251
  25464. Node: stat489683
  25465. Node: statfs493265
  25466. Node: _status87494341
  25467. Node: _stklen495451
  25468. Node: stpcpy495861
  25469. Node: strcase496224
  25470. Node: strcasecmp496692
  25471. Node: strcat497172
  25472. Node: strchr497551
  25473. Node: strcmp498059
  25474. Node: strcoll498545
  25475. Node: strcpy499080
  25476. Node: strcspn499427
  25477. Node: strdup500041
  25478. Node: strerror500606
  25479. Node: strftime501085
  25480. Node: stricmp503683
  25481. Node: strlen504149
  25482. Node: strlwr504558
  25483. Node: strncase504955
  25484. Node: strncasecmp505520
  25485. Node: strncat506098
  25486. Node: strncmp506496
  25487. Node: strncpy507026
  25488. Node: strnicmp507418
  25489. Node: strpbrk507980
  25490. Node: strrchr508459
  25491. Node: strsep508908
  25492. Node: strspn509794
  25493. Node: strstr510398
  25494. Node: strtod510826
  25495. Node: strtok511356
  25496. Node: strtol512150
  25497. Node: _strtold513043
  25498. Node: strtoll513594
  25499. Node: strtoul514500
  25500. Node: strtoull515021
  25501. Node: strupr515554
  25502. Node: strxfrm515936
  25503. Node: swab516529
  25504. Node: symlink517100
  25505. Node: sync518564
  25506. Node: sys_errlist518780
  25507. Node: sys_nerr519150
  25508. Node: sysconf519547
  25509. Node: system520320
  25510. Node: tan527602
  25511. Node: tanh527811
  25512. Node: tcdrain528035
  25513. Node: tcflow528457
  25514. Node: tcflush528896
  25515. Node: tcgetattr529334
  25516. Node: tcsendbreak529885
  25517. Node: tcsetattr530329
  25518. Node: tell530850
  25519. Node: telldir531216
  25520. Node: textattr531751
  25521. Node: textbackground532131
  25522. Node: textcolor532438
  25523. Node: textmode532730
  25524. Node: time533470
  25525. Node: times533837
  25526. Node: tmpfile534745
  25527. Node: tmpnam535267
  25528. Node: toascii536834
  25529. Node: tolower537242
  25530. Node: toupper537668
  25531. Node: _truename538095
  25532. Node: truncate540046
  25533. Node: ttyname540445
  25534. Node: uclock540831
  25535. Node: umask542208
  25536. Node: uname542457
  25537. Node: ungetc543263
  25538. Node: ungetch543722
  25539. Node: unlink544077
  25540. Node: unlock544447
  25541. Node: _use_lfn544796
  25542. Node: usleep548020
  25543. Node: utime548404
  25544. Node: utimes549337
  25545. Node: vfprintf549844
  25546. Node: vprintf550478
  25547. Node: vsprintf550893
  25548. Node: wait551323
  25549. Node: waitpid552113
  25550. Node: wcstombs552706
  25551. Node: wctomb553170
  25552. Node: wherex553630
  25553. Node: wherey553885
  25554. Node: window554137
  25555. Node: write554507
  25556. Node: _write555288
  25557. Node: xfree555727
  25558. Node: xmalloc556115
  25559. Node: xrealloc556576
  25560. Node: Index557111
  25561. 
  25562. End Tag Table
  25563.