Chinaunix首页 | 论坛 | 博客
  • 博客访问: 898950
  • 博文数量: 194
  • 博客积分: 7991
  • 博客等级: 少将
  • 技术积分: 2067
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-09 22:03
文章分类

全部博文(194)

文章存档

2010年(8)

2009年(71)

2008年(109)

2007年(6)

我的朋友

分类: LINUX

2009-05-11 11:32:53

In the following days, or maybe years, I will go through the source code of all linux commands, to present you the principle of it's internal workflow.
 
Now the first one come here - watch:
 
Watch utility executes a program periodically, showing output fullscreen:
 

for(;;){
    if (!(p = popen(command, "r"))) {...}
    //… print output of the command to terminal, using ncurses
    usleep(interval * 1000000);
}

阅读(882) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~