shtest: remove garbage
This commit is contained in:
parent
504f1374bc
commit
174c1e7bf0
1 changed files with 2 additions and 75 deletions
|
|
@ -28,13 +28,12 @@ void _start()
|
||||||
if (term < 0)
|
if (term < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* FIFOs!!!!!!!!! */
|
/* FIFOs!!!!!!!!! */
|
||||||
write(term, "mknod\n", 5);
|
write(term, "mknod\n", 5);
|
||||||
int r = mknod("/dev/pts", S_IFIFO, 0);
|
mknod("/dev/pts", S_IFIFO, 0);
|
||||||
write(term, "open\n", 5);
|
write(term, "open\n", 5);
|
||||||
int fifofd = open("/dev/pts", 0);
|
int fifofd = open("/dev/pts", 0);
|
||||||
|
|
||||||
|
|
@ -58,79 +57,7 @@ void _start()
|
||||||
while ((n = read(term, buf, 256)) > 0) {
|
while ((n = read(term, buf, 256)) > 0) {
|
||||||
write(term, buf, n);
|
write(term, buf, n);
|
||||||
|
|
||||||
if(buf[0] == 'q')
|
if (buf[0] == 'q')
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(1234);
|
|
||||||
}
|
|
||||||
void end()
|
|
||||||
{
|
|
||||||
int term = open("/dev/tty0", 0);
|
|
||||||
if (term < 0)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
|
|
||||||
char buf[256];
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* FIFOs!!!!!!!!! */
|
|
||||||
int r = mknod("/dev/pts", S_IFIFO, 0);
|
|
||||||
int fifofd = open("/dev/pts", 0);
|
|
||||||
if (fifofd < 0)
|
|
||||||
write(term, "open failed\n", 12);
|
|
||||||
|
|
||||||
/* write hello to fifo */
|
|
||||||
int i = write(fifofd, "hello\n", 6);
|
|
||||||
/* read back from fifo */
|
|
||||||
i = read(fifofd, buf, 6);
|
|
||||||
|
|
||||||
/* print output to terminal */
|
|
||||||
write(term, "read back from fifo: ", 22);
|
|
||||||
write(term, buf, i);
|
|
||||||
promptfd(term);
|
|
||||||
|
|
||||||
/* fork test */
|
|
||||||
while ((n = read(term, buf, 256)) > 0) {
|
|
||||||
write(term, buf, n);
|
|
||||||
|
|
||||||
if(buf[0] == 'q')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(1234);
|
|
||||||
}
|
|
||||||
void lol()
|
|
||||||
{
|
|
||||||
int term = open("/dev/tty0", 0);
|
|
||||||
if (term < 0)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
|
|
||||||
char buf[256];
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* FIFOs!!!!!!!!! */
|
|
||||||
int r = mknod("/dev/pts", S_IFIFO, 0);
|
|
||||||
int fifofd = open("/dev/pts", 0);
|
|
||||||
if (fifofd < 0)
|
|
||||||
write(term, "open failed\n", 12);
|
|
||||||
|
|
||||||
/* write hello to fifo */
|
|
||||||
int i = write(fifofd, "hello\n", 6);
|
|
||||||
/* read back from fifo */
|
|
||||||
i = read(fifofd, buf, 6);
|
|
||||||
|
|
||||||
/* print output to terminal */
|
|
||||||
write(term, "read back from fifo: ", 22);
|
|
||||||
write(term, buf, i);
|
|
||||||
promptfd(term);
|
|
||||||
|
|
||||||
/* fork test */
|
|
||||||
while ((n = read(term, buf, 256)) > 0) {
|
|
||||||
write(term, buf, n);
|
|
||||||
|
|
||||||
if(buf[0] == 'q')
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue