home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / ixemul-39.47-env-bin.lha / man / cat3 / getcwd.0 < prev    next >
Text File  |  1993-12-07  |  3KB  |  133 lines

  1.  
  2. GETWD(3)                   UNIX Programmer's Manual                   GETWD(3)
  3.  
  4. NNAAMMEE
  5.      ggeettwwdd - get working directory pathname
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssttddiioo..hh>>
  9.  
  10.      _c_h_a_r _*
  11.      ggeettccwwdd(_c_h_a_r _*_b_u_f, _s_i_z_e___t _s_i_z_e)
  12.  
  13.      _c_h_a_r _*
  14.      ggeettwwdd(_c_h_a_r _*_b_u_f)
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The ggeettccwwdd() function copies the absolute pathname of the current working
  18.      directory into the memory referenced by _b_u_f and returns a pointer to _b_u_f.
  19.      The _s_i_z_e argument is the size, in bytes, of the array referenced by _b_u_f.
  20.  
  21.      If _b_u_f is NULL, space is allocated as necessary to store the pathname.
  22.      This space may later be free(3)'d.
  23.  
  24.      The function ggeettwwdd() is a compatibility routine which calls ggeettccwwdd() with
  25.      its _b_u_f argument and a size of MAXPATHLEN (as defined in the include file
  26.      <_s_y_s_/_p_a_r_a_m_._h>). Obviously, _b_u_f should be at least MAXPATHLEN bytes in
  27.      length.
  28.  
  29.      These routines have traditionally been used by programs to save the name
  30.      of a working directory for the purpose of returning to it.  A much faster
  31.      and less error­prone method of accomplishing this is to open the current
  32.      directory (`.') and use the fchdir(2) function to return.
  33.  
  34. RREETTUURRNN VVAALLUUEESS
  35.      Upon successful completion, a pointer to the pathname is returned.  Oth­
  36.      erwise a NULL pointer is returned and the global variable _e_r_r_n_o is set to
  37.      indicate the error.  In addition, ggeettwwdd() copies the error message asso­
  38.      ciated with _e_r_r_n_o into the memory referenced by _b_u_f.
  39.  
  40. EERRRROORRSS
  41.      The ggeettccwwdd() function will fail if:
  42.  
  43.      [EACCESS]  Read or search permission was denied for a component of the
  44.                 pathname.
  45.  
  46.      [EINVAL]   The _s_i_z_e argument is zero.
  47.  
  48.      [ENOENT]   A component of the pathname no longer exists.
  49.  
  50.      [ENOMEM]   Insufficient memory is available.
  51.  
  52.      [ERANGE]   The _s_i_z_e argument is greater than zero but smaller than the
  53.                 length of the pathname plus 1.
  54.  
  55. SSEEEE AALLSSOO
  56.      chdir(2),  fchdir(2),  malloc(3),  strerror(3)
  57.  
  58. SSTTAANNDDAARRDDSS
  59.      The ggeettccwwdd() function conforms to ANSI C3.159­1989 (``ANSI C''). The
  60.      ability to specify a NULL pointer and have ggeettccwwdd() allocate memory as
  61.      necessary is an extension.
  62.  
  63. HHIISSTTOORRYY
  64.      The ggeettwwdd() function appeared in 4.0BSD.
  65.  
  66. BBUUGGSS
  67.      The ggeettwwdd() function does not do sufficient error checking and is not
  68.      able to return very long, but valid, paths.  It is provided for compati­
  69.      bility.
  70.  
  71. 4.2 Berkeley Distribution       April 19, 1991                               2
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.