]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/execcmd.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / execcmd.h
1 /*
2 * Copyright 1993, 1995 Christopher Seiwald.
3 *
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6
7 /*
8 * execcmd.h - execute a shell script.
9 *
10 * Defines the interface to be implemented in platform specific implementation
11 * modules as well as different shared utility functions prepared in the
12 * execcmd.c module.
13 */
14
15 #ifndef EXECCMD_H
16 #define EXECCMD_H
17
18 #include "lists.h"
19 #include "strings.h"
20 #include "timestamp.h"
21
22
23 typedef struct timing_info
24 {
25 double system;
26 double user;
27 timestamp start;
28 timestamp end;
29 } timing_info;
30
31 typedef void (* ExecCmdCallback)
32 (
33 void * const closure,
34 int const status,
35 timing_info const * const,
36 char const * const cmd_stdout,
37 char const * const cmd_stderr,
38 int const cmd_exit_reason
39 );
40
41 /* Status codes passed to ExecCmdCallback routines. */
42 #define EXEC_CMD_OK 0
43 #define EXEC_CMD_FAIL 1
44 #define EXEC_CMD_INTR 2
45
46 int exec_check
47 (
48 string const * command,
49 LIST * * pShell,
50 int * error_length,
51 int * error_max_length
52 );
53
54 /* exec_check() return codes. */
55 #define EXEC_CHECK_OK 101
56 #define EXEC_CHECK_NOOP 102
57 #define EXEC_CHECK_LINE_TOO_LONG 103
58 #define EXEC_CHECK_TOO_LONG 104
59
60 void exec_cmd
61 (
62 string const * command,
63 ExecCmdCallback func,
64 void * closure,
65 LIST * shell
66 );
67
68 void exec_wait();
69
70
71 /******************************************************************************
72 * *
73 * Utility functions defined in the execcmd.c module. *
74 * *
75 ******************************************************************************/
76
77 /* Constructs a list of command-line elements using the format specified by the
78 * given shell list.
79 */
80 void argv_from_shell( char const * * argv, LIST * shell, char const * command,
81 int const slot );
82
83 /* Interrupt routine bumping the internal interrupt counter. Needs to be
84 * registered by platform specific exec*.c modules.
85 */
86 void onintr( int disp );
87
88 /* Returns whether an interrupt has been detected so far. */
89 int interrupted( void );
90
91 /* Checks whether the given shell list is actually a request to execute raw
92 * commands without an external shell.
93 */
94 int is_raw_command_request( LIST * shell );
95
96 /* Utility worker for exec_check() checking whether all the given command lines
97 * are under the specified length limit.
98 */
99 int check_cmd_for_too_long_lines( char const * command, int const max,
100 int * const error_length, int * const error_max_length );
101
102 #endif