tools/include/nolibc/getopt.h
Source file repositories/reference/linux-study-clean/tools/include/nolibc/getopt.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/nolibc/getopt.h- Extension
.h- Size
- 2029 bytes
- Lines
- 102
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
nolibc.h
Detected Declarations
struct FILEfunction __attribute__
Annotated Snippet
if (optstring[0] == '-') {
optarg = argv[optind++];
return 1;
}
return -1;
}
if (!argv[optind][1])
return -1;
if (argv[optind][1] == '-' && !argv[optind][2])
return optind++, -1;
if (!__optpos)
__optpos++;
c = argv[optind][__optpos];
optchar = argv[optind] + __optpos;
__optpos++;
if (!argv[optind][__optpos]) {
optind++;
__optpos = 0;
}
if (optstring[0] == '-' || optstring[0] == '+')
optstring++;
i = 0;
d = 0;
do {
d = optstring[i++];
} while (d && d != c);
if (!d || d != c || c == ':') {
optopt = c;
if (optstring[0] != ':' && opterr)
fprintf(stderr, "%s: unrecognized option: %c\n", argv[0], *optchar);
return '?';
}
if (optstring[i] == ':') {
optarg = NULL;
if (optstring[i + 1] != ':' || __optpos) {
optarg = argv[optind++];
if (__optpos)
optarg += __optpos;
__optpos = 0;
}
if (optind > argc) {
optopt = c;
if (optstring[0] == ':')
return ':';
if (opterr)
fprintf(stderr, "%s: option requires argument: %c\n",
argv[0], *optchar);
return '?';
}
}
return c;
}
#endif /* _NOLIBC_GETOPT_H */
Annotation
- Immediate include surface: `nolibc.h`.
- Detected declarations: `struct FILE`, `function __attribute__`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.