{
    "content": [
        {
            "type": "text",
            "text": "# readdir(3) (man)\n\n**Summary:** readdir - directory input parser for gawk\n\n**Synopsis:** @load \"readdir\"\n\n## Examples\n\n- `@load \"readdir\"`\n- `...`\n- `BEGIN { FS = \"/\" }`\n- `{ print \"file name is\", $2 }`\n\n## See Also\n\n- filefuncs(3am)\n- fnmatch(3am)\n- fork(3am)\n- inplace(3am)\n- chr(3am)\n- readfile(3am)\n- revoutput(3am)\n- rwarray(3am)\n- time(3am)\n- opendir(3)\n- stat(2)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (18 lines)\n- **EXAMPLE** (5 lines)\n- **SEE ALSO** (5 lines)\n- **AUTHOR** (2 lines)\n- **COPYING PERMISSIONS** (16 lines)\n\n## Full Content\n\n### NAME\n\nreaddir - directory input parser for gawk\n\n### SYNOPSIS\n\n@load \"readdir\"\n\n### DESCRIPTION\n\nThe readdir extension adds an input parser for directories.\n\nWhen  this extension is in use, instead of skipping directories named on the command line (or\nwith getline), they are read, with each entry returned as a record.\n\nThe record consists of three fields. The first two are the inode  number  and  the  filename,\nseparated  by  a  forward slash character.  On systems where the directory entry contains the\nfile type, the record has a third field which is a single letter indicating the type  of  the\nfile:  f  for  file, d for directory, b for a block device, c for a character device, p for a\nFIFO, l for a symbolic link, s for a socket.\n\nOn systems without the file type information, the extension falls back to calling stat(2), in\norder to provide the information.  Thus the third field should never be u.\n\nBy  default,  if a directory cannot be opened (due to permission problems, for example), gawk\nwill exit.  As with regular files, this situation can be handled using a BEGINFILE rule  that\nchecks ERRNO and prints an error or otherwise handles the problem.\n\n### EXAMPLE\n\n@load \"readdir\"\n...\nBEGIN { FS = \"/\" }\n{ print \"file name is\", $2 }\n\n### SEE ALSO\n\nGAWK:  Effective AWK Programming, filefuncs(3am), fnmatch(3am), fork(3am), inplace(3am), ord‐\nchr(3am), readfile(3am), revoutput(3am), rwarray(3am), time(3am).\n\nopendir(3), readdir(3), stat(2).\n\n### AUTHOR\n\nArnold Robbins, arnold@skeeve.com.\n\n### COPYING PERMISSIONS\n\nCopyright © 2012, 2013, 2018, 2019 Free Software Foundation, Inc.\n\nPermission is granted to make and distribute verbatim copies of this manual page provided the\ncopyright notice and this permission notice are preserved on all copies.\n\nPermission  is granted to copy and distribute modified versions of this manual page under the\nconditions for verbatim copying, provided that the entire resulting derived work is  distrib‐\nuted under the terms of a permission notice identical to this one.\n\nPermission  is  granted  to copy and distribute translations of this manual page into another\nlanguage, under the above conditions for modified versions, except that this  permission  no‐\ntice may be stated in a translation approved by the Foundation.\n\n\n\nFree Software Foundation                     Oct 30 2019                                READDIR(3am)\n\n"
        }
    ],
    "structuredContent": {
        "command": "readdir",
        "section": "3",
        "mode": "man",
        "summary": "readdir - directory input parser for gawk",
        "synopsis": "@load \"readdir\"",
        "flags": [],
        "examples": [
            "@load \"readdir\"",
            "...",
            "BEGIN { FS = \"/\" }",
            "{ print \"file name is\", $2 }"
        ],
        "see_also": [
            {
                "name": "filefuncs",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/filefuncs/3am/json"
            },
            {
                "name": "fnmatch",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/fnmatch/3am/json"
            },
            {
                "name": "fork",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/fork/3am/json"
            },
            {
                "name": "inplace",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/inplace/3am/json"
            },
            {
                "name": "chr",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/chr/3am/json"
            },
            {
                "name": "readfile",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/readfile/3am/json"
            },
            {
                "name": "revoutput",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/revoutput/3am/json"
            },
            {
                "name": "rwarray",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/rwarray/3am/json"
            },
            {
                "name": "time",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/time/3am/json"
            },
            {
                "name": "opendir",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/opendir/3/json"
            },
            {
                "name": "stat",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/stat/2/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYING PERMISSIONS",
                "lines": 16,
                "subsections": []
            }
        ]
    }
}