sprt.c
来自「项目描述: slsnif is a serial port logging ut」· C语言 代码 · 共 48 行
C
48 行
/* sprt.c: */#include <stdio.h>#include "xtdio.h"/* ------------------------------------------------------------------------- * Local Definitions: */#define BUFSIZE 261#define SFTY 5/* sprt: this routine makes string characters all visible */#ifdef __PROTOTYPE__char *sprt(const char *s)#else /* __PROTOTYPE__ */char *sprt(s)char *s;#endif /* __PROTOTYPE__ */{static char buf1[BUFSIZE];static char buf2[BUFSIZE];static char buf3[BUFSIZE];static char buf4[BUFSIZE];char *b,*bend;static char *buf=buf3;int ic;/* allows up to three sprt()s in one function call */if(buf == buf1) buf= buf2;else if(buf == buf2) buf= buf3;else if(buf == buf3) buf= buf4;else buf= buf1;buf[0]= '\0';bend = buf + BUFSIZE - SFTY;if(s) for(b= buf; *s && b < bend; ++s, b+= strlen(b)) { ic= (int) *s; if(ic < 31) sprintf(b,"^%c",(char) (ic + 64)); else if(ic >= 128) sprintf(b,"~%3d",ic); else { *b = *s; *(b+1)= '\0'; } b+= strlen(b); }return buf;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?