|
zpmod
b19981f
High-performance Zsh module for script optimization and filesystem helpers
|
Utility functions for argument parsing and string handling. More...
#include "zpmod.mdh"#include "zpmod.pro"#include "zpmod_utils.h"#include "zpmod_vendor_shims.h"#include <string.h>Go to the source code of this file.
Functions | |
| int | zp_has_option (char **argv, char opt) |
| Lightweight argv short-option scanner (stops at "--"). More... | |
| int | zp_take_opt_with_arg (char ***argvp, char opt, char **out_arg) |
| Consume a short option with required argument from argv. More... | |
| char * | my_ztrdup_glen (const char *s, unsigned *len_ret) |
| zalloc-backed strdup with length out parameter. More... | |
| char * | zp_unmetafy_zalloc (const char *to_copy, int *new_len) |
| Duplicate and unmetafy a zsh string with zalloc; see header for details. More... | |
Utility functions for argument parsing and string handling.
Definition in file utils.c.
| char* my_ztrdup_glen | ( | const char * | s, |
| unsigned * | len_ret | ||
| ) |
zalloc-backed strdup with length out parameter.
Duplicate a C string using zalloc and report length.
Definition at line 63 of file utils.c.
References zalloc().
Referenced by zp_unmetafy_zalloc().
| int zp_has_option | ( | char ** | argv, |
| char | opt | ||
| ) |
| int zp_take_opt_with_arg | ( | char *** | argvp, |
| char | opt, | ||
| char ** | out_arg | ||
| ) |
Consume a short option with required argument from argv.
Consume a short option that requires an argument from argv.
Supports both attached (-oARG) and separate (-o ARG) forms.
Definition at line 35 of file utils.c.
Referenced by cmd_pathstat().
| char * zp_unmetafy_zalloc | ( | const char * | to_copy, |
| int * | new_len | ||
| ) |
Duplicate and unmetafy a zsh string with zalloc; see header for details.
Duplicate and unmetafy a zsh string using zsh allocators.
Definition at line 76 of file utils.c.
References my_ztrdup_glen(), unmetafy(), zalloc(), and zfree().
Referenced by cmd_report_append(), zp_dirlist_core(), zp_pathstat_core(), and zp_readfile_core().