#include <sys/stat.h> #include <termios.h> #include <fcntl.h> static INT iOptionNoAbort, iOption; static void do_cancel_ctrlc (void) { ioctl(STD_IN, FIOGETOPTIONS, &iOption); iOptionNoAbort = (iOption & ~OPT_ABORT); /* 取消control+c */ ioctl(STD_IN, FIOSETOPTIONS, iOptionNoAbort); } static void do_resume_ctrlc (void) { ioctl(STD_IN, FIOSETOPTIONS, iOption); }