finish network
Some checks failed
Test and Deploy / test (push) Failing after 9s
Test and Deploy / docs (push) Has been skipped

This commit is contained in:
2024-07-09 09:38:31 -07:00
parent 8d67851767
commit 7a82072539
8 changed files with 180 additions and 77 deletions

View File

@ -92,7 +92,8 @@ printf("%s\n", sp[0]); // Prints "Split"
### del_split
Frees all memory used by `split()`. Just like `split`, it does not touch the original string
Frees all memory used by `split()`. Just like `split`, it does not touch the original string.
```c
void del_split(char **sp);
@ -101,3 +102,19 @@ size_t sp_sz = 0;
char **sp = split("Delete Me!", &sp_sz, " ");
void del_split(sp);
```
### capture_system
Runs a command on the system shell and returns stdout as a string. `buffsize` is the size of
the returned buffer that holds `stdout`. Passing `0` to `buffsize` will use the default buffer size of `1024`.
User is responsible for freeing the returned string.
```c
const char *capture_system(const char *cmd, int buffsize);
/* Usage */
const char *cap = capture_system("ls $HOME", 0);
printf("%s\n", cap);
free(cap);
```