- 论坛徽章:
- 0
|
下面是我在网上看到一个小程序,锁屏的.但编译和执行都有问题.因此改了一些,并且加上了信号处理,不允许中断.程序在HP_UX上面测试通过.
编译:cc -o screen_lck screen_lock.c -l curses
#include
#include
int main()
{
int flag=1;
int i;
char passwd[4];
signal(SIGINT, SIG_IGN);
initscr();
refresh();
noecho();
move(20,20);
mvprintw(20,1,"input unlock pass:");
while(flag) {
for(i=0;i
if(passwd[0]=='l'&&passwd[1]=='i'&&passwd[2]=='u'&&passwd[3]=='j') {
move(20,20);
mvprintw(10,20,"input true");
flag=0;
}
move(20,20);
clrtoeol();
for(i=0;i
refresh();
endwin();
echo();
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/12158/showart_77300.html |
|