BSD 4_4 development
[unix-history] / usr / share / man / cat3 / seekdir.0
index 8b38609..47019e2 100644 (file)
-
-
-
-DIRECTORY(3)                 1990                   DIRECTORY(3)
-
-
+DIRECTORY(3)                BSD Programmer's Manual               DIRECTORY(3)
 
 N\bNA\bAM\bME\bE
 
 N\bNA\bAM\bME\bE
-     opendir, readdir, telldir, seekdir, rewinddir, closedir,
-     dirfd - directory operations
+     o\bop\bpe\ben\bnd\bdi\bir\br, r\bre\bea\bad\bdd\bdi\bir\br, t\bte\bel\bll\bld\bdi\bir\br, s\bse\bee\bek\bkd\bdi\bir\br, r\bre\bew\bwi\bin\bnd\bdd\bdi\bir\br, c\bcl\blo\bos\bse\bed\bdi\bir\br, d\bdi\bir\brf\bfd\bd - directo-
+     ry operations
 
 S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
      #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
      #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<d\bdi\bir\bre\ben\bnt\bt.\b.h\bh>\b>
 
 
 S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
      #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
      #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<d\bdi\bir\bre\ben\bnt\bt.\b.h\bh>\b>
 
-     D\bDI\bIR\bR *\b*
-     o\bop\bpe\ben\bnd\bdi\bir\br(\b(c\bco\bon\bns\bst\bt c\bch\bha\bar\br *\b*f\bfi\bil\ble\ben\bna\bam\bme\be)\b);\b;
+     _\bD_\bI_\bR _\b*
+     o\bop\bpe\ben\bnd\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be);
 
 
-     s\bst\btr\bru\buc\bct\bt d\bdi\bir\bre\bec\bct\bt
-     *\b*r\bre\bea\bad\bdd\bdi\bir\br(\b(D\bDI\bIR\bR *\b* d\bdi\bir\brp\bp)\b);\b;
+     _\bs_\bt_\br_\bu_\bc_\bt _\bd_\bi_\br_\be_\bn_\bt _\b*
+     r\bre\bea\bad\bdd\bdi\bir\br(_\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp);
 
 
-     l\blo\bon\bng\bg
-     t\bte\bel\bll\bld\bdi\bir\br(\b(c\bco\bon\bns\bst\bt D\bDI\bIR\bR *\b*d\bdi\bir\brp\bp)\b);\b;
+     _\bl_\bo_\bn_\bg
+     t\bte\bel\bll\bld\bdi\bir\br(_\bc_\bo_\bn_\bs_\bt _\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp);
 
 
-     v\bvo\boi\bid\bd
-     s\bse\bee\bek\bkd\bdi\bir\br(\b(D\bDI\bIR\bR *\b*d\bdi\bir\brp\bp,\b, l\blo\bon\bng\bg l\blo\boc\bc)\b);\b;
+     _\bv_\bo_\bi_\bd
+     s\bse\bee\bek\bkd\bdi\bir\br(_\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp, _\bl_\bo_\bn_\bg _\bl_\bo_\bc);
 
 
-     v\bvo\boi\bid\bd
-     r\bre\bew\bwi\bin\bnd\bdd\bdi\bir\br(\b(D\bDI\bIR\bR *\b*d\bdi\bir\brp\bp)\b);\b;
+     _\bv_\bo_\bi_\bd
+     r\bre\bew\bwi\bin\bnd\bdd\bdi\bir\br(_\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp);
 
 
-     i\bin\bnt\bt
-     c\bcl\blo\bos\bse\bed\bdi\bir\br(\b(D\bDI\bIR\bR *\b*d\bdi\bir\brp\bp)\b);\b;
+     _\bi_\bn_\bt
+     c\bcl\blo\bos\bse\bed\bdi\bir\br(_\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp);
 
 
-     i\bin\bnt\bt
-     d\bdi\bir\brf\bfd\bd(\b(D\bDI\bIR\bR *\b*d\bdi\bir\brp\bp)\b)
+     _\bi_\bn_\bt
+     d\bdi\bir\brf\bfd\bd(_\bD_\bI_\bR _\b*_\bd_\bi_\br_\bp);
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-     _\bO_\bp_\be_\bn_\bd_\bi_\br opens the directory named by _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be and associates
-     a _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm with it.  _\bO_\bp_\be_\bn_\bd_\bi_\br returns a pointer to be
-     used to identify the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm in subsequent opera-
-     tions.  The pointer N\bNU\bUL\bLL\bL is returned if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be cannot be
-     accessed, or if it cannot _\bm_\ba_\bl_\bl_\bo_\bc(3) enough memory to hold
-     the whole thing.
-
-     _\bR_\be_\ba_\bd_\bd_\bi_\br returns a pointer to the next directory entry.  It
-     returns N\bNU\bUL\bLL\bL upon reaching the end of the directory or
-     detecting an invalid _\bs_\be_\be_\bk_\bd_\bi_\br operation.
-
-     _\bT_\be_\bl_\bl_\bd_\bi_\br returns the current location associated with the
-     named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm.
-
-     _\bS_\be_\be_\bk_\bd_\bi_\br sets the position of the next _\br_\be_\ba_\bd_\bd_\bi_\br operation on
-     the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm. The new position reverts to the one
-     associated with the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm when the _\bt_\be_\bl_\bl_\bd_\bi_\br opera-
-     tion was performed.  Values returned by _\bt_\be_\bl_\bl_\bd_\bi_\br are good
-     only for the lifetime of the DIR pointer from which they are
-     derived.  If the directory is closed and then reopened, the
-     _\bt_\be_\bl_\bl_\bd_\bi_\br value may be invalidated due to undetected directory
-     compaction.  It is safe to use a previous _\bt_\be_\bl_\bl_\bd_\bi_\br value
-
-
-
-Printed 7/27/90               June                             1
-
-
+     The o\bop\bpe\ben\bnd\bdi\bir\br() function opens the directory named by _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, associates
+     a _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm with it and returns a pointer to be used to identify
+     the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm in subsequent operations.  The pointer NULL is re-
+     turned if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be cannot be accessed, or if it cannot malloc(3) enough
+     memory to hold the whole thing.
 
 
+     The r\bre\bea\bad\bdd\bdi\bir\br() function returns a pointer to the next directory entry.  It
+     returns NULL upon reaching the end of the directory or detecting an in-
+     valid s\bse\bee\bek\bkd\bdi\bir\br() operation.
 
 
+     The t\bte\bel\bll\bld\bdi\bir\br() function returns the current location associated with the
+     named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm.
 
 
-
-DIRECTORY(3)                 1990                   DIRECTORY(3)
-
-
-
-     immediately after a call to _\bo_\bp_\be_\bn_\bd_\bi_\br and before any calls to
-     _\br_\be_\ba_\bd_\bd_\bi_\br.
-
-     _\bR_\be_\bw_\bi_\bn_\bd_\bd_\bi_\br resets the position of the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm
-     to the beginning of the directory.
-
-     _\bC_\bl_\bo_\bs_\be_\bd_\bi_\br closes the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm and frees the
-     structure associated with the DIR pointer, returning 0 on
-     success.  On failure, -1 is returned and errno is set to
-     indicate the error.
-
-     _\bD_\bi_\br_\bf_\bd returns the integer file descriptor associated with
+     The s\bse\bee\bek\bkd\bdi\bir\br() function sets the position of the next r\bre\bea\bad\bdd\bdi\bir\br() operation
+     on the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm. The new position reverts to the one associated
+     with the _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm when the t\bte\bel\bll\bld\bdi\bir\br() operation was performed.
+     Values returned by t\bte\bel\bll\bld\bdi\bir\br() are good only for the lifetime of the DIR
+     pointer, _\bd_\bi_\br_\bp, from which they are derived.  If the directory is closed
+     and then reopened, the t\bte\bel\bll\bld\bdi\bir\br() value may be invalidated due to unde-
+     tected directory compaction.  It is safe to use a previous t\bte\bel\bll\bld\bdi\bir\br() val-
+     ue immediately after a call to o\bop\bpe\ben\bnd\bdi\bir\br() and before any calls to
+     r\bre\bea\bad\bdd\bdi\bir\br().
+
+     The r\bre\bew\bwi\bin\bnd\bdd\bdi\bir\br() function resets the position of the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by
+     _\bs_\bt_\br_\be_\ba_\bm to the beginning of the directory.
+
+     The c\bcl\blo\bos\bse\bed\bdi\bir\br() function closes the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm and frees the
+     structure associated with the _\bd_\bi_\br_\bp pointer, returning 0 on success.  On
+     failure, -1 is returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate
+     the error.
+
+     The d\bdi\bir\brf\bfd\bd() function returns the integer file descriptor associated with
      the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm, see open(2).
 
      Sample code which searchs a directory for entry ``name'' is:
 
      the named _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by _\bs_\bt_\br_\be_\ba_\bm, see open(2).
 
      Sample code which searchs a directory for entry ``name'' is:
 
-         len = strlen(name);
-         dirp = opendir(".");
-         for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
-              if (dp->d_namlen == len && !strcmp(dp->d_name, name)) {
-                   (void)closedir(dirp);
-                   return FOUND;
-              }
-         (void)closedir(dirp);
-         return NOT_FOUND;
+           len = strlen(name);
+           dirp = opendir(".");
+           while ((dp = readdir(dirp)) != NULL)
+                   if (dp->d_namlen == len && !strcmp(dp->d_name, name)) {
+                           (void)closedir(dirp);
+                           return FOUND;
+                   }
+           (void)closedir(dirp);
+           return NOT_FOUND;
 
 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
 
 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
-     open(2), close(2), read(2), lseek(2), dir(5)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Printed 7/27/90               June                             2
-
+     open(2),  close(2),  read(2),  lseek(2),  dir(5)
 
 
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+     The o\bop\bpe\ben\bnd\bdi\bir\br(), r\bre\bea\bad\bdd\bdi\bir\br(), t\bte\bel\bll\bld\bdi\bir\br(), s\bse\bee\bek\bkd\bdi\bir\br(), r\bre\bew\bwi\bin\bnd\bdd\bdi\bir\br(), c\bcl\blo\bos\bse\bed\bdi\bir\br(),
+     and d\bdi\bir\brf\bfd\bd() functions appeared in 4.2BSD.
 
 
+4.2 Berkeley Distribution        June 4, 1993                                2