cntcostfn.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 36 行
C
36 行
#ifdef lintstatic char *sccsid = "@(#)cntcostfn.c 4.1 (ULTRIX) 7/2/90";#endif lint#include "curses.ext"static counter = 0;/* ARGSUSED */_countchar(ch)char ch;{ counter++;}/* * Figure out the _cost in characters to print this string. * Due to padding, we can't just use strlen, so instead we * feed it through tputs and trap the results. * Even if the terminal uses xon/xoff handshaking, count the * pad chars here since they estimate the real time to do the * operation, useful in calculating costs. */_cost_fn(str, affcnt)char *str;{ int save_xflag = xon_xoff; if (str == NULL) return INFINITY; counter = 0; xon_xoff = 0; tputs(str, affcnt, _countchar); xon_xoff = save_xflag; return counter;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?