📄 tnotify.c
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved. */#include "sftest.h"static int Type;#if __STD_Cstatic void notify(Sfio_t* f, int type, int fd)#elsestatic void notify(f, type, fd)Sfio_t* f;int type;int fd;#endif{ switch(Type = type) { case SF_NEW: case SF_CLOSING: case SF_SETFD: case SF_READ: case SF_WRITE: return; default: terror("Unexpected nofity-type: %d\n",type); }}MAIN(){ Sfio_t* f; int fd; sfnotify(notify); if(!(f = sfopen(NIL(Sfio_t*), tstfile(0), "w")) && Type != SF_NEW) terror("Notify did not announce SF_NEW event\n"); fd = sffileno(f); close(fd+5); if(sfsetfd(f,fd+5) != fd+5 || Type != SF_SETFD) terror("Notify did not announce SF_SETFD event\n"); if(sfclose(f) < 0 || Type != SF_CLOSING) terror("Notify did not announce SF_CLOSING event\n"); if(sfputc(sfstdin,'a') >= 0 || Type != SF_WRITE) terror("Notify did not announce SF_WRITE event\n"); if(sfgetc(sfstdout) >= 0 || Type != SF_READ) terror("Notify did not announce SF_READ event\n"); TSTEXIT(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -