-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
31 lines (24 loc) · 686 Bytes
/
Copy pathutils.h
File metadata and controls
31 lines (24 loc) · 686 Bytes
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
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef _UTILS_H
#define _UTILS_H
#include "../util/parser/parser.h"
/* Useful macro for handling error codes. */
#define DIE(assertion, call_description) \
do { \
if (assertion) { \
fprintf(stderr, "(%s, %s, %d): ", \
__FILE__, __func__, __LINE__); \
perror(call_description); \
exit(EXIT_FAILURE); \
} \
} while (0)
/**
* Concatenate parts of the word to obtain the command.
*/
char *get_word(word_t *s);
/**
* Concatenate command arguments in a NULL terminated list in order to pass
* them directly to execv.
*/
char **get_argv(simple_command_t *command, int *size);
#endif /* _UTILS_H */