~emersion/mrsh

ref: 1c6cbcf40da4e92c3c4fc5a2bb86b86d60accef1 mrsh/include/shell/word.h -rw-r--r-- 823 bytes
1c6cbcf4emersion ci: add an optimized build 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SHELL_WORD_H
#define SHELL_WORD_H

#include <mrsh/shell.h>

enum tilde_expansion {
	// Don't perform tilde expansion at all
	TILDE_EXPANSION_NONE,
	// Only expand at the begining of words
	TILDE_EXPANSION_NAME,
	// Expand at the begining of words and after semicolons
	TILDE_EXPANSION_ASSIGNMENT,
};

/**
 * Performs tilde expansion. It leaves the string as-is in case of error.
 */
void expand_tilde(struct mrsh_state *state, char **str_ptr);
/**
 * Performs field splitting on `word`, writing fields to `fields`. This should
 * be done after expansions/substitutions.
 */
void split_fields(struct mrsh_array *fields, struct mrsh_word *word,
	const char *ifs);
/**
 * Performs pathname expansion on each item in `fields`.
 */
bool expand_pathnames(struct mrsh_array *expanded, struct mrsh_array *fields);


#endif