Chinaunix

标题: 标准C实现的shell里面有段不明白! [打印本页]

作者: shangxd    时间: 2003-06-17 13:47
标题: 标准C实现的shell里面有段不明白!

  1. if (WIFEXITED (statval))
  2.         {
  3.           if (WEXITSTATUS (statval))
  4.             fprintf (stderr, "%s: child exited with "
  5.                      "status %d\n", argv[0], WEXITSTATUS (statval));
  6.         }
  7.       else
  8.         {
  9.           fprintf (stderr, "%s: child died unexpectedly\n", argv[0]);
  10.         }
复制代码

里面的WIFEXITED和WEXITSTATUS是什么意思?
我看了定义,这是两个宏,可是我看不明白
#define __WEXITSTATUS(status)   (((status) & 0xff00) >;>; 8)
#define __WIFEXITED(status)     (__WTERMSIG(status) == 0)
这是什么意思,能解释一下吗?
谢谢了!
作者: 蓝色键盘    时间: 2003-06-17 13:49
标题: 标准C实现的shell里面有段不明白!
监测(子)进程退出终止状态。定义为宏。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2