Lines Matching +full:s +full:- +full:mode
1 /*-
28 * Limited test program for popen() as specified by IEEE Std. 1003.1-2008,
41 #include <atf-c.h>
52 check_cloexec(FILE *fp, const char *mode) in check_cloexec() argument
57 ATF_CHECK_MSG(flags != -1, "fcntl(F_GETFD) failed; errno=%d", errno); in check_cloexec()
58 if (flags == -1) in check_cloexec()
60 if (strchr(mode, 'e') != NULL) in check_cloexec()
73 const char *mode; in ATF_TC_BODY() local
77 mode = allmodes[i]; in ATF_TC_BODY()
78 fp = popen("exit 7", mode); in ATF_TC_BODY()
79 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
82 check_cloexec(fp, mode); in ATF_TC_BODY()
94 const char *mode; in ATF_TC_BODY() local
99 mode = rmodes[i]; in ATF_TC_BODY()
100 fp = popen("exit 9", mode); in ATF_TC_BODY()
101 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
104 check_cloexec(fp, mode); in ATF_TC_BODY()
116 mode = rmodes[i]; in ATF_TC_BODY()
117 fp = popen("echo hi there", mode); in ATF_TC_BODY()
118 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
121 check_cloexec(fp, mode); in ATF_TC_BODY()
138 const char *mode; in ATF_TC_BODY() local
143 mode = wmodes[i]; in ATF_TC_BODY()
144 fp = popen("read x && [ \"$x\" = abcd ]", mode); in ATF_TC_BODY()
145 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
148 check_cloexec(fp, mode); in ATF_TC_BODY()
159 ATF_CHECK_MSG(sigaction(SIGPIPE, &act, &oact) != -1, in ATF_TC_BODY()
162 mode = wmodes[i]; in ATF_TC_BODY()
163 fp = popen("exit 88", mode); in ATF_TC_BODY()
164 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
167 check_cloexec(fp, mode); in ATF_TC_BODY()
177 ATF_CHECK_MSG(sigaction(SIGPIPE, &oact, NULL) != -1, in ATF_TC_BODY()
182 mode = wmodes[i]; in ATF_TC_BODY()
183 fp = popen("read x", mode); in ATF_TC_BODY()
185 "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
188 mode = wmodes[j]; in ATF_TC_BODY()
189 fp2 = popen("read x", mode); in ATF_TC_BODY()
191 "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
196 /* If fp2 inherits fp's pipe, we will deadlock here. */ in ATF_TC_BODY()
212 const char *mode; in ATF_TC_BODY() local
218 mode = rwmodes[i]; in ATF_TC_BODY()
219 fp = popen("read x && printf '%s\\n' \"Q${x#a}\"", mode); in ATF_TC_BODY()
220 ATF_CHECK_MSG(fp != NULL, "popen(, \"%s\") failed", mode); in ATF_TC_BODY()
223 check_cloexec(fp, mode); in ATF_TC_BODY()