这是笑书亭上hunan大侠贴的代码,你可以参考一下,good luck!
void
x_bbsnet()
{
int my_handle;
char my_commd[256];
clear();
move(1,2);
outs(" A) 水木清华 B)浙江大学笑书亭");
switch (vans("请输入你的选择:"))
{
case 'a':
sprintf(my_commd, "/usr/bin/telnet %s %s", "smth.org", "23");
break;
case 'b':
sprintf(my_commd, "/usr/bin/telnet %s %s", "210.35.151.66", "23");
break;
}
my_handle = dup(0);
if (my_handle > 0)
{
clear();
system(my_commd, NULL, NULL);
close(my_handle);
clear();
more("etc/bbsnetlogout", NULL);
}
else
{
clear();
more("etc/notbbsnet", NULL);
}
vmsg(NULL);
}
【 在 Aiolia (Ironmine) 的大作中提到: 】
: 在maple BBS上的xyz.c中我加了一项
: void
: smth()
: {
: //int pid, status;
: //if (pid = vfork())
: // waitpid(pid, &status, 0);
: //else {
: prints("Connecting to SMTH...");
: execve("/home/bbs/bin/telnet smth.org 23", NULL, NULL);
: vmsg("按Ctrl+] exit");
: ...................
--
FROM 166.111.60.149