mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Refactor the pty implementation
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
40056f0692
commit
038c19b693
@ -15,8 +15,6 @@ int main() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("master fd: %d\n", master);
|
||||
printf("slave fd: %d\n", slave);
|
||||
printf("slave name: %s\n", name);
|
||||
|
||||
// Set pty slave terminal attributes
|
||||
@ -33,7 +31,7 @@ int main() {
|
||||
char buf[256];
|
||||
ssize_t n = read(master, buf, sizeof(buf));
|
||||
if (n > 0) {
|
||||
printf("read %ld bytes from slave: %.*s\n", n, (int)n, buf);
|
||||
printf("read %ld bytes from slave: %.*s", n, (int)n, buf);
|
||||
}
|
||||
|
||||
// Write to pty master
|
||||
@ -43,7 +41,7 @@ int main() {
|
||||
char nbuf[256];
|
||||
ssize_t nn = read(slave, nbuf, sizeof(nbuf));
|
||||
if (nn > 0) {
|
||||
printf("read %ld bytes from master: %.*s\n", nn, (int)nn, nbuf);
|
||||
printf("read %ld bytes from master: %.*s", nn, (int)nn, nbuf);
|
||||
}
|
||||
|
||||
close(master);
|
||||
|
@ -6,7 +6,7 @@ SCRIPT_DIR=/regression
|
||||
cd ${SCRIPT_DIR}/..
|
||||
|
||||
echo "Running tests......"
|
||||
tests="hello_world/hello_world fork/fork execve/execve fork_c/fork signal_c/signal_test pthread/pthread_test hello_pie/hello"
|
||||
tests="hello_world/hello_world fork/fork execve/execve fork_c/fork signal_c/signal_test pthread/pthread_test hello_pie/hello pty/open_pty"
|
||||
for testcase in ${tests}
|
||||
do
|
||||
echo "Running test ${testcase}......"
|
||||
|
Reference in New Issue
Block a user