@enjoys/context-engine 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/commands/adb.json +322 -0
- package/data/commands/alembic.json +301 -0
- package/data/commands/artisan.json +277 -0
- package/data/commands/atlas.json +426 -0
- package/data/commands/auth0.json +648 -0
- package/data/commands/bat.json +84 -0
- package/data/commands/btop.json +59 -0
- package/data/commands/bundle.json +321 -0
- package/data/commands/composer.json +507 -0
- package/data/commands/dart.json +216 -0
- package/data/commands/dbmate.json +257 -0
- package/data/commands/docker-compose.json +384 -0
- package/data/commands/drizzle-kit.json +217 -0
- package/data/commands/expo.json +65 -0
- package/data/commands/fastlane.json +243 -0
- package/data/commands/fd.json +86 -0
- package/data/commands/flutter.json +298 -0
- package/data/commands/flyway.json +261 -0
- package/data/commands/fzf.json +103 -0
- package/data/commands/gem.json +267 -0
- package/data/commands/htop.json +56 -0
- package/data/commands/jq.json +100 -0
- package/data/commands/k9s.json +62 -0
- package/data/commands/linux.json +3007 -0
- package/data/commands/liquibase.json +399 -0
- package/data/commands/manifest.json +619 -0
- package/data/commands/minikube.json +60 -0
- package/data/commands/ng.json +64 -0
- package/data/commands/nuxt.json +60 -0
- package/data/commands/nvim.json +91 -0
- package/data/commands/php.json +157 -0
- package/data/commands/pm2.json +259 -0
- package/data/commands/pod.json +175 -0
- package/data/commands/prisma.json +257 -0
- package/data/commands/rails.json +372 -0
- package/data/commands/rake.json +360 -0
- package/data/commands/react-native.json +57 -0
- package/data/commands/rg.json +103 -0
- package/data/commands/rspec.json +257 -0
- package/data/commands/ruby.json +108 -0
- package/data/commands/screen.json +101 -0
- package/data/commands/sequelize.json +342 -0
- package/data/commands/snyk.json +442 -0
- package/data/commands/sonar-scanner.json +219 -0
- package/data/commands/stripe.json +314 -0
- package/data/commands/symfony.json +449 -0
- package/data/commands/tmux.json +197 -0
- package/data/commands/top.json +61 -0
- package/data/commands/trivy.json +367 -0
- package/data/commands/twilio.json +382 -0
- package/data/commands/typeorm.json +262 -0
- package/data/commands/vim.json +85 -0
- package/data/commands/vue.json +60 -0
- package/data/commands/wp.json +857 -0
- package/data/commands/xcodebuild.json +141 -0
- package/data/commands/yq.json +57 -0
- package/data/completion/bash.json +1184 -0
- package/data/completion/c.json +1067 -0
- package/data/completion/cpp.json +824 -0
- package/data/completion/csharp.json +860 -0
- package/data/completion/dockerfile.json +536 -0
- package/data/completion/go.json +1346 -0
- package/data/completion/html.json +806 -0
- package/data/completion/java.json +1112 -0
- package/data/completion/javascript.json +914 -0
- package/data/completion/lua.json +968 -0
- package/data/completion/php.json +1535 -0
- package/data/completion/python.json +1427 -0
- package/data/completion/ruby.json +1531 -0
- package/data/completion/rust.json +698 -0
- package/data/completion/sql.json +887 -0
- package/data/completion/toml.json +428 -0
- package/data/completion/typescript.json +338 -0
- package/data/completion/yaml.json +563 -0
- package/data/defination/bash.json +565 -0
- package/data/defination/c.json +865 -0
- package/data/defination/cpp.json +348 -0
- package/data/defination/csharp.json +144 -0
- package/data/defination/dockerfile.json +113 -0
- package/data/defination/go.json +561 -0
- package/data/defination/html.json +559 -0
- package/data/defination/java.json +184 -0
- package/data/defination/javascript.json +265 -0
- package/data/defination/lua.json +181 -0
- package/data/defination/php.json +726 -0
- package/data/defination/python.json +717 -0
- package/data/defination/ruby.json +670 -0
- package/data/defination/rust.json +207 -0
- package/data/defination/sql.json +473 -0
- package/data/defination/toml.json +251 -0
- package/data/defination/typescript.json +29 -0
- package/data/defination/yaml.json +197 -0
- package/data/hover/bash.json +245 -0
- package/data/hover/c.json +265 -0
- package/data/hover/cpp.json +210 -0
- package/data/hover/csharp.json +290 -0
- package/data/hover/dockerfile.json +145 -0
- package/data/hover/go.json +580 -0
- package/data/hover/html.json +250 -0
- package/data/hover/java.json +395 -0
- package/data/hover/javascript.json +330 -0
- package/data/hover/lua.json +265 -0
- package/data/hover/php.json +300 -0
- package/data/hover/python.json +380 -0
- package/data/hover/ruby.json +265 -0
- package/data/hover/rust.json +275 -0
- package/data/hover/sql.json +230 -0
- package/data/hover/toml.json +145 -0
- package/data/hover/typescript.json +120 -0
- package/data/hover/yaml.json +165 -0
- package/data/manifest.json +242 -0
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "bash",
|
|
3
|
+
"hovers": {
|
|
4
|
+
"echo": {
|
|
5
|
+
"contents": [
|
|
6
|
+
{ "value": "```bash\necho [-neE] [string ...]\n```\nDisplay a line of text to stdout. `-n` suppresses the trailing newline. `-e` enables interpretation of backslash escapes (`\\t`, `\\n`, `\\\\`, `\\a`, `\\b`, `\\c`, `\\0nnn`, `\\xHH`). `-E` disables escape interpretation (default)." }
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"printf": {
|
|
10
|
+
"contents": [
|
|
11
|
+
{ "value": "```bash\nprintf [-v var] format [arguments ...]\n```\nWrite formatted output to stdout. Format specifiers: `%s` (string), `%d` (decimal), `%f` (float), `%x` (hex), `%o` (octal), `%b` (backslash escapes), `%%` (literal %). `-v var` stores the result in a variable instead of printing." }
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"read": {
|
|
15
|
+
"contents": [
|
|
16
|
+
{ "value": "```bash\nread [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]\n```\nRead a line from stdin and split it into fields. `-r` disables backslash escaping. `-p` displays a prompt. `-t` sets a timeout in seconds. `-a` reads into an array. `-s` hides input (for passwords). `-d` sets an alternate delimiter." }
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"cd": {
|
|
20
|
+
"contents": [
|
|
21
|
+
{ "value": "```bash\ncd [-L|-P] [directory]\n```\nChange the shell working directory. Without arguments, changes to `$HOME`. `cd -` changes to `$OLDPWD` (previous directory). `-L` follows symbolic links (default). `-P` uses the physical directory structure (resolves symlinks)." }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"pwd": {
|
|
25
|
+
"contents": [
|
|
26
|
+
{ "value": "```bash\npwd [-LP]\n```\nPrint the absolute pathname of the current working directory. `-L` displays the logical path preserving symlinks (default). `-P` displays the physical path with all symlinks resolved." }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"export": {
|
|
30
|
+
"contents": [
|
|
31
|
+
{ "value": "```bash\nexport [-fn] [-p] [name[=value] ...]\n```\nSet environment variables for child processes. Variables marked for export are inherited by any subsequently executed commands. `-n` removes the export property. `-f` exports shell functions. `-p` lists all exported variables." }
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"source": {
|
|
35
|
+
"contents": [
|
|
36
|
+
{ "value": "```bash\nsource filename [arguments]\n# or: . filename [arguments]\n```\nRead and execute commands from a file in the **current** shell environment. Unlike executing a script (which runs in a subshell), sourced files can modify variables, functions, and aliases in the calling shell." }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"alias": {
|
|
40
|
+
"contents": [
|
|
41
|
+
{ "value": "```bash\nalias [-p] [name[=value] ...]\n```\nDefine or display command aliases. An alias substitutes a string for the first word of a simple command. Aliases are expanded when a command is read, not when it is executed. Use `\\command` to bypass an alias." }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"trap": {
|
|
45
|
+
"contents": [
|
|
46
|
+
{ "value": "```bash\ntrap [-lp] [action] [signal ...]\n```\nExecute a command when the shell receives a signal or on certain events. Common signals: `EXIT` (on shell exit), `ERR` (on command failure with `set -e`), `INT` (Ctrl+C), `TERM` (termination), `DEBUG` (before every command), `RETURN` (after function/source return). Use `trap - signal` to reset to default." }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"set": {
|
|
50
|
+
"contents": [
|
|
51
|
+
{ "value": "```bash\nset [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [arg ...]\n```\nSet or unset shell options and positional parameters. Common options:\n- `-e` — exit immediately if a command exits with non-zero status\n- `-u` — treat unset variables as an error\n- `-x` — print commands and arguments as they are executed\n- `-o pipefail` — return the exit status of the rightmost failed command in a pipeline\n- `--` — end of options; remaining args become positional parameters" }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"declare": {
|
|
55
|
+
"contents": [
|
|
56
|
+
{ "value": "```bash\ndeclare [-aAfFgiIlnrtux] [-p] [name[=value] ...]\n```\nDeclare variables and set their attributes. Flags: `-i` (integer), `-a` (indexed array), `-A` (associative array), `-r` (readonly), `-x` (export), `-l` (lowercase on assignment), `-u` (uppercase on assignment), `-n` (nameref), `-g` (global scope in functions). Inside functions, `declare` creates local variables unless `-g` is specified." }
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"local": {
|
|
60
|
+
"contents": [
|
|
61
|
+
{ "value": "```bash\nlocal [-aAfFgiIlnrtux] [name[=value] ...]\n```\nDeclare a variable as local to a function. The variable is visible only within the function and its child functions. Accepts the same attribute flags as `declare`. Can only be used within a function body." }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"test": {
|
|
65
|
+
"contents": [
|
|
66
|
+
{ "value": "```bash\ntest expression\n[ expression ]\n[[ expression ]]\n```\nEvaluate conditional expressions. Returns 0 (true) or 1 (false).\n\n**File tests:** `-f` (regular file), `-d` (directory), `-e` (exists), `-r` (readable), `-w` (writable), `-x` (executable), `-s` (non-empty), `-L` (symlink)\n\n**String tests:** `-z` (empty), `-n` (non-empty), `=` / `==` (equal), `!=` (not equal)\n\n**Integer tests:** `-eq`, `-ne`, `-gt`, `-lt`, `-ge`, `-le`\n\n**Logical:** `!` (not), `-a` / `&&` (and), `-o` / `||` (or)\n\nPrefer `[[ ]]` for safer word-splitting behavior and regex support (`=~`)." }
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"if": {
|
|
70
|
+
"contents": [
|
|
71
|
+
{ "value": "```bash\nif command-list; then\n command-list\n[elif command-list; then\n command-list] ...\n[else\n command-list]\nfi\n```\nConditional execution. The `if` command-list is executed; if its exit status is 0, the `then` block runs. Otherwise, each `elif` is tested in turn. If none match, the `else` block runs (if present). Note: `if` tests the **exit status** of a command, not a boolean expression directly." }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"for": {
|
|
75
|
+
"contents": [
|
|
76
|
+
{ "value": "```bash\n# List form:\nfor name [in word ...]; do\n command-list\ndone\n\n# C-style form:\nfor (( expr1; expr2; expr3 )); do\n command-list\ndone\n```\nIterate over a list of words or use arithmetic expressions. In the list form, if `in word ...` is omitted, iterates over `\"$@\"`. The variable `name` is set to each word in turn." }
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"while": {
|
|
80
|
+
"contents": [
|
|
81
|
+
{ "value": "```bash\nwhile command-list; do\n command-list\ndone\n```\nExecute commands repeatedly as long as the test command-list returns exit status 0. Commonly used with `read` to process files line by line: `while IFS= read -r line; do ... done < file`." }
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"until": {
|
|
85
|
+
"contents": [
|
|
86
|
+
{ "value": "```bash\nuntil command-list; do\n command-list\ndone\n```\nExecute commands repeatedly until the test command-list returns exit status 0. Logically equivalent to `while ! command-list; do ... done`." }
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"case": {
|
|
90
|
+
"contents": [
|
|
91
|
+
{ "value": "```bash\ncase word in\n pattern1 | pattern2) commands ;;\n pattern3) commands ;;&\n pattern4) commands ;&\n *) default-commands ;;\nesac\n```\nPattern matching construct. Each pattern is a glob pattern. `;;` terminates the clause. `;&` falls through to the next clause unconditionally. `;;&` tests the next pattern. `*` matches anything (default case). Patterns support `*`, `?`, `[...]`, and extended globs if `extglob` is set." }
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"select": {
|
|
95
|
+
"contents": [
|
|
96
|
+
{ "value": "```bash\nselect name [in word ...]; do\n command-list\ndone\n```\nCreate a numbered menu from `word` list. Displays items with numbers, prompts with `$PS3`, stores the chosen word in `name` and the user's raw input in `$REPLY`. Loops until `break` or EOF (Ctrl+D). If `in word ...` is omitted, uses positional parameters." }
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"function": {
|
|
100
|
+
"contents": [
|
|
101
|
+
{ "value": "```bash\n# Two forms:\nname() { command-list; }\nfunction name [()] { command-list; }\n```\nDefine a function that can be called by name. Arguments are accessed as `$1`, `$2`, etc. `$@` for all arguments, `$#` for count. Use `local` for local variables. Use `return [n]` to exit with a status. Functions can be exported with `export -f name`." }
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"shift": {
|
|
105
|
+
"contents": [
|
|
106
|
+
{ "value": "```bash\nshift [n]\n```\nShift positional parameters to the left by `n` positions (default 1). After `shift`, `$1` takes the value formerly in `$2`, `$2` takes `$3`, and so on. `$#` is decremented. Commonly used in argument-parsing loops." }
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"eval": {
|
|
110
|
+
"contents": [
|
|
111
|
+
{ "value": "```bash\neval [arg ...]\n```\nConcatenate all arguments into a single command string and execute it in the current shell. Useful for executing dynamically constructed commands. **Use with caution** — eval can introduce code injection vulnerabilities if used with untrusted input." }
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"exec": {
|
|
115
|
+
"contents": [
|
|
116
|
+
{ "value": "```bash\nexec [-cl] [-a name] [command [arguments ...]] [redirections ...]\n```\nReplace the current shell process with the specified command (no new process is created). If no command is given, redirections apply to the current shell. `-c` causes the command to execute with an empty environment. Commonly used for file descriptor manipulation: `exec 3>file`, `exec > >(tee log)`." }
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"return": {
|
|
120
|
+
"contents": [
|
|
121
|
+
{ "value": "```bash\nreturn [n]\n```\nReturn from a shell function or sourced script with exit status `n`. If `n` is omitted, returns the exit status of the last command executed. Only valid inside a function or a sourced (`.`/`source`) script." }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"exit": {
|
|
125
|
+
"contents": [
|
|
126
|
+
{ "value": "```bash\nexit [n]\n```\nExit the shell with status `n`. If `n` is omitted, the status is that of the last command executed. Convention: 0 = success, 1 = general error, 2 = misuse of built-in, 126 = not executable, 127 = command not found, 128+N = killed by signal N." }
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"readonly": {
|
|
130
|
+
"contents": [
|
|
131
|
+
{ "value": "```bash\nreadonly [-aAfp] [name[=value] ...]\n```\nMark variables or functions as read-only. Readonly variables cannot be reassigned or unset. `-a` for indexed arrays, `-A` for associative arrays, `-f` for functions. `-p` displays all readonly names." }
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"getopts": {
|
|
135
|
+
"contents": [
|
|
136
|
+
{ "value": "```bash\ngetopts optstring name [args]\n```\nParse command-line options. Each call processes one option. `optstring` lists valid option letters; append `:` for options requiring arguments. On success, stores the option in `name`, the argument in `$OPTARG`, and advances `$OPTIND`. Returns non-zero when all options are processed." }
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"wait": {
|
|
140
|
+
"contents": [
|
|
141
|
+
{ "value": "```bash\nwait [-fn] [-p varname] [id ...]\n```\nWait for background processes to finish. Without arguments, waits for all child processes. With a PID/job ID, waits for that specific process. `-n` waits for the next job to terminate and returns its exit status. `-p varname` stores the PID of the waited process (Bash 5.1+)." }
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"shopt": {
|
|
145
|
+
"contents": [
|
|
146
|
+
{ "value": "```bash\nshopt [-pqsu] [-o] [optname ...]\n```\nSet or unset shell optional behavior. `-s` enables, `-u` disables. Common options:\n- `extglob` — extended pattern matching (`?(pat)`, `*(pat)`, `+(pat)`, `@(pat)`, `!(pat)`)\n- `globstar` — `**` matches directories recursively\n- `nullglob` — unmatched globs expand to nothing\n- `dotglob` — globs match dotfiles\n- `nocasematch` — case-insensitive matching in `case` and `[[`" }
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"$?": {
|
|
150
|
+
"contents": [
|
|
151
|
+
{ "value": "```bash\n$?\n```\nThe exit status of the most recently executed foreground pipeline. `0` indicates success, non-zero indicates failure. After a pipeline, `$?` reflects the status of the last command (or rightmost failing command with `set -o pipefail`). Use `${PIPESTATUS[@]}` to access individual exit codes from each pipeline stage." }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"$#": {
|
|
155
|
+
"contents": [
|
|
156
|
+
{ "value": "```bash\n$#\n```\nThe number of positional parameters (command-line arguments). In a script, counts the arguments passed on invocation. Inside a function, counts the function's arguments. Does not include `$0`." }
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"$@": {
|
|
160
|
+
"contents": [
|
|
161
|
+
{ "value": "```bash\n$@\n\"$@\"\n```\nAll positional parameters. When quoted (`\"$@\"`), each parameter is preserved as a separate word, correctly handling arguments with spaces. This is almost always the correct way to forward arguments. Equivalent to `\"$1\" \"$2\" ...`." }
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"$*": {
|
|
165
|
+
"contents": [
|
|
166
|
+
{ "value": "```bash\n$*\n\"$*\"\n```\nAll positional parameters. When quoted (`\"$*\"`), expands to a single string with parameters joined by the first character of `$IFS` (default: space). Unquoted, behaves like `$@`. Rarely preferred over `\"$@\"`." }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"$$": {
|
|
170
|
+
"contents": [
|
|
171
|
+
{ "value": "```bash\n$$\n```\nThe process ID (PID) of the current shell. In a subshell `(...)`, `$$` still refers to the parent shell's PID. Use `$BASHPID` to get the actual PID of the current subshell (Bash 4.0+). Commonly used to create unique temporary filenames." }
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"$!": {
|
|
175
|
+
"contents": [
|
|
176
|
+
{ "value": "```bash\n$!\n```\nThe PID of the most recently backgrounded process (started with `&`). Useful for tracking background jobs: `command & pid=$!; wait $pid`." }
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"$0": {
|
|
180
|
+
"contents": [
|
|
181
|
+
{ "value": "```bash\n$0\n```\nThe name of the shell or the shell script being executed. In an interactive shell, typically `bash` or `-bash`. In a script, it is the path used to invoke the script. Use `${BASH_SOURCE[0]}` for the actual source file (works inside sourced scripts)." }
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"IFS": {
|
|
185
|
+
"contents": [
|
|
186
|
+
{ "value": "```bash\nIFS=$' \\t\\n' # default value\n```\nInternal Field Separator. Determines how the shell splits words after expansion and how `read` splits input. Default: space, tab, newline. Set `IFS=''` to disable splitting. Set `IFS=:` to split PATH-like variables. Often set locally in a subshell or function: `(IFS=,; echo \"${array[*]}\")`." }
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"PATH": {
|
|
190
|
+
"contents": [
|
|
191
|
+
{ "value": "```bash\nPATH=/usr/local/bin:/usr/bin:/bin\n```\nColon-separated list of directories the shell searches (left to right) when locating commands. Prepend directories for priority: `PATH=\"/my/bin:$PATH\"`. Append for fallback: `PATH=\"$PATH:/my/bin\"`. Empty components (`::`or leading/trailing `:`) refer to the current directory." }
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"HOME": {
|
|
195
|
+
"contents": [
|
|
196
|
+
{ "value": "```bash\nHOME=/home/username\n```\nThe home directory of the current user. Set at login from `/etc/passwd`. Used as the default directory for `cd` (no arguments), and for tilde expansion (`~` expands to `$HOME`, `~user` to that user's home)." }
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"BASH_SOURCE": {
|
|
200
|
+
"contents": [
|
|
201
|
+
{ "value": "```bash\nBASH_SOURCE # array variable\n```\nAn array whose members are the source filenames for each function in the call stack. `${BASH_SOURCE[0]}` is the file containing the currently executing code. Particularly useful for finding the script's own directory:\n```bash\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\n```" }
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"PIPESTATUS": {
|
|
205
|
+
"contents": [
|
|
206
|
+
{ "value": "```bash\nPIPESTATUS # array variable\n```\nAn array containing the exit statuses of the processes in the most recently executed foreground pipeline. `${PIPESTATUS[0]}` is the first command's status, `${PIPESTATUS[1]}` the second, etc. Useful for checking individual stages: `cmd1 | cmd2; echo \"${PIPESTATUS[@]}\"`." }
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
"RANDOM": {
|
|
210
|
+
"contents": [
|
|
211
|
+
{ "value": "```bash\nRANDOM\n```\nEach reference generates a random integer between 0 and 32767. Assigning a value seeds the generator for reproducible sequences. For a range 0 to N-1: `$((RANDOM % N))`. For better randomness in scripts, consider `/dev/urandom`." }
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
"SECONDS": {
|
|
215
|
+
"contents": [
|
|
216
|
+
{ "value": "```bash\nSECONDS\n```\nThe number of seconds since the shell was started. Assigning a value resets the counter:\n```bash\nSECONDS=0\n# ... operations ...\necho \"Elapsed: ${SECONDS}s\"\n```" }
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"FUNCNAME": {
|
|
220
|
+
"contents": [
|
|
221
|
+
{ "value": "```bash\nFUNCNAME # array variable\n```\nAn array of function names in the call stack. `${FUNCNAME[0]}` is the current function, `${FUNCNAME[1]}` is the caller, etc. The last element is `main` (for top-level code). Only meaningful inside functions." }
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"BASH_REMATCH": {
|
|
225
|
+
"contents": [
|
|
226
|
+
{ "value": "```bash\nBASH_REMATCH # array variable\n```\nPopulated by the `=~` operator in `[[ ]]`. Element 0 contains the entire match, elements 1+ contain capture group matches:\n```bash\nif [[ \"hello123\" =~ ^([a-z]+)([0-9]+)$ ]]; then\n echo \"${BASH_REMATCH[0]}\" # hello123\n echo \"${BASH_REMATCH[1]}\" # hello\n echo \"${BASH_REMATCH[2]}\" # 123\nfi\n```" }
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
"mapfile": {
|
|
230
|
+
"contents": [
|
|
231
|
+
{ "value": "```bash\nmapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]\n```\nRead lines from stdin into an indexed array. Default array is `MAPFILE`. `-t` strips trailing delimiters. `-n count` reads at most N lines. `-s count` skips the first N lines. Also available as `readarray`.\n```bash\nmapfile -t lines < file.txt\necho \"${lines[0]}\"\n```" }
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
"let": {
|
|
235
|
+
"contents": [
|
|
236
|
+
{ "value": "```bash\nlet expression [expression ...]\n```\nEvaluate arithmetic expressions. Each expression is an arithmetic expression using C-style operators: `+`, `-`, `*`, `/`, `%`, `**`, `++`, `--`, comparisons, bitwise and logical operators. Returns 0 if the last expression is non-zero, 1 otherwise. Equivalent to `(( expression ))`." }
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
"history": {
|
|
240
|
+
"contents": [
|
|
241
|
+
{ "value": "```bash\nhistory [-c] [-d offset] [n]\nhistory -anrw [filename]\n```\nDisplay or manipulate command history. `history n` shows the last N entries. `-c` clears the history list. `-d N` deletes entry N. `-a` appends new entries to the history file. `-r` reads the history file. `-w` writes the current history to the file. `HISTSIZE` controls the in-memory list size, `HISTFILESIZE` the file size." }
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "c",
|
|
3
|
+
"hovers": {
|
|
4
|
+
"printf": {
|
|
5
|
+
"contents": [
|
|
6
|
+
{ "value": "```c\nint printf(const char *format, ...)\n```\nPrint formatted output to stdout. Returns the number of characters written, or a negative value on error. Format specifiers: %d (int), %f (double), %s (string), %c (char), %p (pointer), %x (hex), %o (octal), %u (unsigned), %zu (size_t), %ld (long), %lld (long long). Width and precision: %10d (min width), %.2f (precision), %-20s (left-align).\n\n**Header:** `<stdio.h>`" }
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"scanf": {
|
|
10
|
+
"contents": [
|
|
11
|
+
{ "value": "```c\nint scanf(const char *format, ...)\n```\nRead formatted input from stdin. Arguments must be pointers — use `&` for non-array types. Returns the number of input items successfully matched and assigned, or EOF on input failure. Use field width to prevent buffer overflow: `%49s`.\n\n**Header:** `<stdio.h>`" }
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"fprintf": {
|
|
15
|
+
"contents": [
|
|
16
|
+
{ "value": "```c\nint fprintf(FILE *stream, const char *format, ...)\n```\nWrite formatted output to the specified file stream. Commonly used with `stderr` for error messages: `fprintf(stderr, \"Error: %s\\n\", msg)`. Returns the number of characters written.\n\n**Header:** `<stdio.h>`" }
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"sprintf": {
|
|
20
|
+
"contents": [
|
|
21
|
+
{ "value": "```c\nint sprintf(char *str, const char *format, ...)\n```\nWrite formatted output to a string buffer. **Warning:** No bounds checking — risk of buffer overflow. Prefer `snprintf()` for safe formatting. Returns the number of characters written (excluding null terminator).\n\n**Header:** `<stdio.h>`" }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"snprintf": {
|
|
25
|
+
"contents": [
|
|
26
|
+
{ "value": "```c\nint snprintf(char *str, size_t size, const char *format, ...)\n```\nWrite at most `size-1` characters to `str`, always null-terminating. Returns the number of characters that *would* have been written if the buffer were large enough (excluding null terminator). Safe alternative to `sprintf()`.\n\n**Header:** `<stdio.h>` (C99)" }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"fopen": {
|
|
30
|
+
"contents": [
|
|
31
|
+
{ "value": "```c\nFILE *fopen(const char *filename, const char *mode)\n```\nOpen a file and return a FILE pointer. Returns NULL on failure (check errno/perror). Modes: `\"r\"` (read), `\"w\"` (write/truncate), `\"a\"` (append), `\"r+\"` (read+write), `\"w+\"` (read+write/truncate), `\"a+\"` (read+append). Add `\"b\"` for binary mode on Windows.\n\n**Header:** `<stdio.h>`" }
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"fclose": {
|
|
35
|
+
"contents": [
|
|
36
|
+
{ "value": "```c\nint fclose(FILE *stream)\n```\nClose an open file stream and flush unwritten buffered data. Returns 0 on success, EOF on failure. Always close files when done to avoid resource leaks.\n\n**Header:** `<stdio.h>`" }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"fgets": {
|
|
40
|
+
"contents": [
|
|
41
|
+
{ "value": "```c\nchar *fgets(char *str, int n, FILE *stream)\n```\nRead at most `n-1` characters from stream, stopping at newline or EOF. Always null-terminates. The newline character is included in the string if read. Returns `str` on success, NULL on failure or EOF. Preferred over `gets()` (which is removed in C11).\n\n**Header:** `<stdio.h>`" }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"fread": {
|
|
45
|
+
"contents": [
|
|
46
|
+
{ "value": "```c\nsize_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)\n```\nRead up to `nmemb` elements of `size` bytes each from stream into buffer. Returns the number of elements successfully read (may be less than nmemb on EOF or error). Use `feof()` and `ferror()` to distinguish.\n\n**Header:** `<stdio.h>`" }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"fwrite": {
|
|
50
|
+
"contents": [
|
|
51
|
+
{ "value": "```c\nsize_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)\n```\nWrite `nmemb` elements of `size` bytes each from buffer to stream. Returns the number of elements successfully written. A short count indicates an error.\n\n**Header:** `<stdio.h>`" }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"malloc": {
|
|
55
|
+
"contents": [
|
|
56
|
+
{ "value": "```c\nvoid *malloc(size_t size)\n```\nAllocate `size` bytes of uninitialized heap memory. Returns a pointer to the allocated block, or NULL on failure. Always check the return value. The memory must be freed with `free()` to prevent leaks. Cast the return in C++, optional in C.\n\n**Header:** `<stdlib.h>`" }
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"calloc": {
|
|
60
|
+
"contents": [
|
|
61
|
+
{ "value": "```c\nvoid *calloc(size_t nmemb, size_t size)\n```\nAllocate memory for an array of `nmemb` elements of `size` bytes each, initialized to zero. Returns NULL on failure. Safer than malloc for arrays since it checks for multiplication overflow on some implementations.\n\n**Header:** `<stdlib.h>`" }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"realloc": {
|
|
65
|
+
"contents": [
|
|
66
|
+
{ "value": "```c\nvoid *realloc(void *ptr, size_t size)\n```\nResize a previously allocated memory block to `size` bytes. May move the block to a new address. Returns NULL on failure (original block is unchanged). **Never assign directly back to ptr** — use a temporary to avoid losing the original pointer on failure.\n\n**Header:** `<stdlib.h>`" }
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"free": {
|
|
70
|
+
"contents": [
|
|
71
|
+
{ "value": "```c\nvoid free(void *ptr)\n```\nDeallocate memory previously returned by `malloc()`, `calloc()`, or `realloc()`. Passing NULL is safe (no-op). Double-free and use-after-free cause undefined behavior. Best practice: set pointer to NULL after freeing.\n\n**Header:** `<stdlib.h>`" }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"exit": {
|
|
75
|
+
"contents": [
|
|
76
|
+
{ "value": "```c\nvoid exit(int status)\n```\nTerminate the program with the given exit status. Calls functions registered with `atexit()`, flushes and closes all open streams, removes temporary files. Use `EXIT_SUCCESS` (0) or `EXIT_FAILURE` (1). Does not return.\n\n**Header:** `<stdlib.h>`" }
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"atoi": {
|
|
80
|
+
"contents": [
|
|
81
|
+
{ "value": "```c\nint atoi(const char *nptr)\n```\nConvert a string to an integer. Skips leading whitespace, reads optional sign and digits. Returns 0 if no conversion is possible. **No error detection** — does not distinguish between \"0\" and invalid input. Prefer `strtol()` for robust parsing.\n\n**Header:** `<stdlib.h>`" }
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"strtol": {
|
|
85
|
+
"contents": [
|
|
86
|
+
{ "value": "```c\nlong strtol(const char *nptr, char **endptr, int base)\n```\nConvert string to long integer with error detection. `base` can be 0 (auto-detect: 0x=hex, 0=octal, else decimal) or 2–36. Sets `*endptr` to first unconverted char. Sets `errno` to `ERANGE` on overflow/underflow.\n\n**Header:** `<stdlib.h>`" }
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"qsort": {
|
|
90
|
+
"contents": [
|
|
91
|
+
{ "value": "```c\nvoid qsort(void *base, size_t nmemb, size_t size,\n int (*compar)(const void *, const void *))\n```\nSort an array in-place. The comparison function receives pointers to elements and must return <0, 0, or >0. Not guaranteed to be stable (equal elements may be reordered). Typical comparator: `return *(int*)a - *(int*)b;`.\n\n**Header:** `<stdlib.h>`" }
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"strlen": {
|
|
95
|
+
"contents": [
|
|
96
|
+
{ "value": "```c\nsize_t strlen(const char *s)\n```\nReturn the length of string `s`, not counting the terminating null byte. The string must be null-terminated — passing an unterminated buffer is undefined behavior. Returns a `size_t` (unsigned).\n\n**Header:** `<string.h>`" }
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"strcpy": {
|
|
100
|
+
"contents": [
|
|
101
|
+
{ "value": "```c\nchar *strcpy(char *dest, const char *src)\n```\nCopy the string `src` (including null terminator) to `dest`. The destination must be large enough to hold the result. **Unsafe** — no bounds checking. Prefer `strncpy()` or `snprintf()` to prevent buffer overflows.\n\n**Header:** `<string.h>`" }
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"strncpy": {
|
|
105
|
+
"contents": [
|
|
106
|
+
{ "value": "```c\nchar *strncpy(char *dest, const char *src, size_t n)\n```\nCopy up to `n` characters from `src` to `dest`. If `src` is shorter than `n`, pads with null bytes. **Warning:** Does NOT null-terminate if `src` has `n` or more characters. Always manually null-terminate: `dest[n-1] = '\\0';`.\n\n**Header:** `<string.h>`" }
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"strcmp": {
|
|
110
|
+
"contents": [
|
|
111
|
+
{ "value": "```c\nint strcmp(const char *s1, const char *s2)\n```\nCompare two null-terminated strings lexicographically. Returns 0 if equal, negative if `s1 < s2`, positive if `s1 > s2`. Comparison is based on unsigned char values. Use `strncmp()` for bounded comparison.\n\n**Header:** `<string.h>`" }
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"strcat": {
|
|
115
|
+
"contents": [
|
|
116
|
+
{ "value": "```c\nchar *strcat(char *dest, const char *src)\n```\nAppend string `src` to the end of `dest`. The destination must have enough space for both strings plus the null terminator. **Unsafe** — prefer `strncat()` to prevent buffer overflow.\n\n**Header:** `<string.h>`" }
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"strstr": {
|
|
120
|
+
"contents": [
|
|
121
|
+
{ "value": "```c\nchar *strstr(const char *haystack, const char *needle)\n```\nFind the first occurrence of substring `needle` in `haystack`. Returns a pointer to the beginning of the match, or NULL if not found. If `needle` is empty, returns `haystack`.\n\n**Header:** `<string.h>`" }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"memcpy": {
|
|
125
|
+
"contents": [
|
|
126
|
+
{ "value": "```c\nvoid *memcpy(void *dest, const void *src, size_t n)\n```\nCopy `n` bytes from `src` to `dest`. The memory regions **must not overlap** — use `memmove()` if they might. Returns `dest`. Commonly used for copying structs, arrays, and binary data.\n\n**Header:** `<string.h>`" }
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"memmove": {
|
|
130
|
+
"contents": [
|
|
131
|
+
{ "value": "```c\nvoid *memmove(void *dest, const void *src, size_t n)\n```\nCopy `n` bytes from `src` to `dest`, safely handling overlapping memory regions. Slower than `memcpy()` but always correct. Returns `dest`.\n\n**Header:** `<string.h>`" }
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"memset": {
|
|
135
|
+
"contents": [
|
|
136
|
+
{ "value": "```c\nvoid *memset(void *s, int c, size_t n)\n```\nFill the first `n` bytes of memory area `s` with byte value `c`. Commonly used to zero-initialize: `memset(buf, 0, sizeof(buf))`. Note: sets *bytes*, not ints — `memset(arr, 1, n)` does NOT set each int to 1.\n\n**Header:** `<string.h>`" }
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"memcmp": {
|
|
140
|
+
"contents": [
|
|
141
|
+
{ "value": "```c\nint memcmp(const void *s1, const void *s2, size_t n)\n```\nCompare the first `n` bytes of two memory areas. Returns 0 if equal, negative if `s1 < s2`, positive if `s1 > s2`. Compares bytes as unsigned char values.\n\n**Header:** `<string.h>`" }
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"strtok": {
|
|
145
|
+
"contents": [
|
|
146
|
+
{ "value": "```c\nchar *strtok(char *str, const char *delim)\n```\nTokenize a string by splitting at delimiter characters. First call: pass the string. Subsequent calls: pass NULL to continue. **Modifies the original string** by inserting null bytes. **Not thread-safe** — use `strtok_r()` for thread safety.\n\n**Header:** `<string.h>`" }
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"sqrt": {
|
|
150
|
+
"contents": [
|
|
151
|
+
{ "value": "```c\ndouble sqrt(double x)\n```\nCompute the non-negative square root of `x`. Domain error if `x` is negative. For float/long double variants, use `sqrtf()` / `sqrtl()` (C99). Link with `-lm`.\n\n**Header:** `<math.h>`" }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"pow": {
|
|
155
|
+
"contents": [
|
|
156
|
+
{ "value": "```c\ndouble pow(double base, double exp)\n```\nCompute `base` raised to the power `exp`. Domain error if `base` is negative and `exp` is not an integer. For integer exponents, consider manual multiplication for better performance. Link with `-lm`.\n\n**Header:** `<math.h>`" }
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"fabs": {
|
|
160
|
+
"contents": [
|
|
161
|
+
{ "value": "```c\ndouble fabs(double x)\n```\nReturn the absolute value of double `x`. Use `abs()` for integers, `fabsf()` for float, `fabsl()` for long double. Link with `-lm`.\n\n**Header:** `<math.h>`" }
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"sizeof": {
|
|
165
|
+
"contents": [
|
|
166
|
+
{ "value": "```c\nsizeof(type-or-expression)\n```\nCompile-time operator that returns the size in bytes of a type or expression as `size_t`. Can be applied to types: `sizeof(int)`, variables: `sizeof(x)`, or arrays: `sizeof(arr)/sizeof(arr[0])` for array length. For VLAs (C99), evaluated at runtime." }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"struct": {
|
|
170
|
+
"contents": [
|
|
171
|
+
{ "value": "```c\nstruct Name {\n type member1;\n type member2;\n};\n```\nDefine a composite data type that groups related variables. Access members with `.` (direct) or `->` (via pointer). Can be typedef'd: `typedef struct { int x, y; } Point;`. Commonly used with `malloc()` for dynamic allocation." }
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"enum": {
|
|
175
|
+
"contents": [
|
|
176
|
+
{ "value": "```c\nenum Name { VALUE1, VALUE2, VALUE3 };\n```\nDefine a set of named integer constants. By default, values start at 0 and increment by 1. Can assign explicit values: `enum { A = 1, B = 5, C = 10 };`. Values are of type `int`. Commonly typedef'd: `typedef enum { ... } Name;`." }
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"union": {
|
|
180
|
+
"contents": [
|
|
181
|
+
{ "value": "```c\nunion Name {\n type1 member1;\n type2 member2;\n};\n```\nDefine a type where all members share the same memory location. The size of the union equals the size of its largest member. Only one member should be active at a time. Reading a different member than the one last written is implementation-defined." }
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"typedef": {
|
|
185
|
+
"contents": [
|
|
186
|
+
{ "value": "```c\ntypedef existing_type new_name;\n```\nCreate an alias for an existing type. Common uses: `typedef unsigned long ulong;`, `typedef struct Node Node;`, `typedef void (*callback_t)(int);` (function pointer type). Does not create a new type — just an alias." }
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"static": {
|
|
190
|
+
"contents": [
|
|
191
|
+
{ "value": "```c\nstatic type variable;\nstatic return_type function(params);\n```\nTwo meanings depending on context: (1) At file scope: restricts visibility to the current translation unit (internal linkage). (2) Inside a function: the variable retains its value between calls (static storage duration). Initializes to zero if not explicitly initialized." }
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"extern": {
|
|
195
|
+
"contents": [
|
|
196
|
+
{ "value": "```c\nextern type variable;\nextern return_type function(params);\n```\nDeclare a variable or function that is defined in another translation unit. Tells the compiler the symbol exists elsewhere and will be resolved at link time. Typically placed in header files." }
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"const": {
|
|
200
|
+
"contents": [
|
|
201
|
+
{ "value": "```c\nconst type name = value;\n```\nDeclare a read-only variable. Attempting to modify a `const` variable is undefined behavior. Pointer-to-const: `const int *p` (data is const). Const pointer: `int *const p` (pointer is const). Const pointer to const: `const int *const p` (both const)." }
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"volatile": {
|
|
205
|
+
"contents": [
|
|
206
|
+
{ "value": "```c\nvolatile type name;\n```\nTell the compiler that the variable may change at any time (e.g., hardware registers, signal handlers, shared memory). Prevents the compiler from optimizing away reads/writes to this variable. Does NOT provide atomicity or memory ordering guarantees." }
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
"inline": {
|
|
210
|
+
"contents": [
|
|
211
|
+
{ "value": "```c\nstatic inline return_type function(params) { ... }\n```\nSuggest to the compiler that the function body be expanded at the call site instead of performing a function call. Only a hint — the compiler may ignore it. Typically used with `static` in headers. C99 feature." }
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
"NULL": {
|
|
215
|
+
"contents": [
|
|
216
|
+
{ "value": "```c\n#define NULL ((void *)0)\n```\nNull pointer constant representing a pointer that points to no valid object. Defined in `<stddef.h>`, `<stdio.h>`, `<stdlib.h>`, `<string.h>`, and others. Always check pointer return values against NULL." }
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"EOF": {
|
|
220
|
+
"contents": [
|
|
221
|
+
{ "value": "```c\n#define EOF (-1)\n```\nEnd-of-file indicator, a negative integer (typically -1). Returned by `getchar()`, `fgetc()`, `scanf()`, and other input functions to signal end of input or error. Important: Use `int` (not `char`) to store the return value to distinguish EOF from valid characters." }
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"size_t": {
|
|
225
|
+
"contents": [
|
|
226
|
+
{ "value": "```c\ntypedef unsigned long size_t; // typical\n```\nUnsigned integer type returned by `sizeof` and used for sizes and counts. Guaranteed to hold the size of any object. Use `%zu` format specifier for printf. Defined in `<stddef.h>`, `<stdlib.h>`, `<string.h>`, `<stdio.h>`." }
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
"FILE": {
|
|
230
|
+
"contents": [
|
|
231
|
+
{ "value": "```c\ntypedef struct _IO_FILE FILE;\n```\nOpaque type for file stream I/O. Created by `fopen()`, closed by `fclose()`. Standard streams: `stdin` (standard input), `stdout` (standard output), `stderr` (standard error). All stdio.h I/O functions operate on `FILE *`.\n\n**Header:** `<stdio.h>`" }
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
"#include": {
|
|
235
|
+
"contents": [
|
|
236
|
+
{ "value": "```c\n#include <header.h> // system headers\n#include \"header.h\" // local headers\n```\nPreprocessor directive that includes the contents of a file. Angle brackets search system include paths first; quotes search the current directory first. This is textual inclusion — the file contents replace the `#include` line." }
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
"#define": {
|
|
240
|
+
"contents": [
|
|
241
|
+
{ "value": "```c\n#define NAME value\n#define MACRO(x, y) ((x) + (y))\n```\nPreprocessor directive that defines a macro. Object-like macros substitute a value; function-like macros take parameters. Always parenthesize macro arguments and the entire expression to prevent operator precedence issues. Use `#undef` to undefine." }
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"errno": {
|
|
245
|
+
"contents": [
|
|
246
|
+
{ "value": "```c\nextern int errno;\n```\nThread-local error number set by system calls and library functions on error. Check immediately after a function call — it may be overwritten by subsequent calls. Common values: `EACCES`, `ENOENT`, `ENOMEM`, `EINVAL`, `EIO`. Use `perror()` or `strerror(errno)` for messages.\n\n**Header:** `<errno.h>`" }
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"assert": {
|
|
250
|
+
"contents": [
|
|
251
|
+
{ "value": "```c\nassert(expression);\n```\nRuntime assertion macro. If `expression` evaluates to 0 (false), prints a diagnostic message to stderr and calls `abort()`. Disabled when `NDEBUG` is defined before including `<assert.h>`. Use for documenting and checking invariants during development.\n\n**Header:** `<assert.h>`" }
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"time": {
|
|
255
|
+
"contents": [
|
|
256
|
+
{ "value": "```c\ntime_t time(time_t *tloc)\n```\nReturn the current calendar time as `time_t` (seconds since Unix epoch: 1970-01-01 00:00:00 UTC). Returns `(time_t)-1` on error. If `tloc` is not NULL, the value is also stored at `*tloc`. Convert to human-readable with `ctime()`, `localtime()`, or `gmtime()`.\n\n**Header:** `<time.h>`" }
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"signal": {
|
|
260
|
+
"contents": [
|
|
261
|
+
{ "value": "```c\nvoid (*signal(int signum, void (*handler)(int)))(int)\n```\nSet a signal handler for signal `signum`. Handler can be `SIG_DFL` (default), `SIG_IGN` (ignore), or a custom function. Returns the previous handler. Common signals: `SIGINT` (Ctrl+C), `SIGTERM` (termination), `SIGSEGV` (segfault), `SIGABRT` (abort).\n\n**Header:** `<signal.h>`" }
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|