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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
/* Yash: yet another shell */
/* exec.h: command execution */
/* (C) 2007-2025 magicant */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef YASH_EXEC_H
#define YASH_EXEC_H
#include <stddef.h>
#include <sys/types.h>
#include "xgetopt.h"
/* options for `fork_and_reset' */
typedef enum sigtype_T {
t_quitint = 1 << 0,
t_tstp = 1 << 1,
t_leave = 1 << 2,
} sigtype_T;
#define Exit_SUCCESS 0
#define Exit_FAILURE 1
#define Exit_ERROR 2
#define Exit_NOEXEC 126
#define Exit_NOTFOUND 127
#define Exit_INPUTERR 128
#define Exit_SYNERROR (256 + Exit_ERROR)
#define Exit_EXPERROR Exit_ERROR
#define Exit_ASSGNERR Exit_ERROR
#define Exit_REDIRERR Exit_ERROR
extern int laststatus, savelaststatus, exitstatus;
extern pid_t lastasyncpid;
extern _Bool special_builtin_executed;
extern _Bool is_executing_auxiliary;
struct execstate_T;
extern void reset_execstate(_Bool reset_iteration);
extern struct execstate_T *save_execstate(void)
__attribute__((malloc,warn_unused_result));
extern void restore_execstate(struct execstate_T *save)
__attribute__((nonnull));
extern void disable_return(void);
extern void cancel_return(void);
extern void cancel_current_command(void);
extern void uncancel_current_command(void);
extern _Bool need_break(void)
__attribute__((pure));
struct and_or_T;
struct embedcmd_T;
extern void exec_and_or_lists(const struct and_or_T *a, _Bool finally_exit);
extern struct xwcsbuf_T *get_xtrace_buffer(void);
extern pid_t fork_and_reset(pid_t pgid, _Bool fg, sigtype_T sigtype);
extern wchar_t *exec_command_substitution(const struct embedcmd_T *cmdsub)
__attribute__((nonnull,malloc,warn_unused_result));
extern int exec_variable_as_commands(
const wchar_t *varname, const char *codename)
__attribute__((nonnull));
extern int exec_variable_as_auxiliary(
const wchar_t *varname, const char *codename)
__attribute__((nonnull));
#define exec_variable_as_auxiliary_(varname) \
exec_variable_as_auxiliary(L varname, "$" varname)
#if YASH_ENABLE_LINEEDIT
extern _Bool autoload_completion_function_file(
const wchar_t *filename, const wchar_t *cmdname)
__attribute__((nonnull(1)));
extern _Bool call_completion_function(const wchar_t *funcname)
__attribute__((nonnull));
#endif
extern const struct xgetopt_T iter_options[];
extern int return_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char return_help[], return_syntax[];
#endif
extern const struct xgetopt_T return_options[];
extern int break_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char break_help[], break_syntax[], continue_help[],
continue_syntax[];
#endif
extern int eval_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char eval_help[], eval_syntax[];
#endif
extern int dot_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char dot_help[], dot_syntax[];
#endif
extern const struct xgetopt_T dot_options[];
extern int exec_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char exec_help[], exec_syntax[];
#endif
extern const struct xgetopt_T exec_options[];
extern int command_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char command_help[], command_syntax[], type_help[], type_syntax[];
#endif
extern const struct xgetopt_T command_options[];
extern int times_builtin(int argc, void **argv)
__attribute__((nonnull));
#if YASH_ENABLE_HELP
extern const char times_help[], times_syntax[];
#endif
#endif /* YASH_EXEC_H */
/* vim: set ts=8 sts=4 sw=4 et tw=80: */
|