mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
* More control chars that needs binary output.
This commit is contained in:
parent
e4305295f7
commit
7993f46e76
24
tools/scat.c
24
tools/scat.c
@ -26,7 +26,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: scat.c,v 1.2 2006/12/27 14:19:22 bg- Exp $
|
||||
* $Id: scat.c,v 1.3 2007/01/05 18:05:21 bg- Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -101,10 +101,8 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int slipfd;
|
||||
int ret;
|
||||
FILE *inslip;
|
||||
const char *siodev;
|
||||
int c;
|
||||
|
||||
if (argc != 2)
|
||||
err(1, "usage: scat device-file");
|
||||
@ -128,10 +126,28 @@ main(int argc, char **argv)
|
||||
else if (c == SLIP_ESC_END)
|
||||
c = SLIP_END;
|
||||
}
|
||||
if (isprint(c) || c == '\n' || c == '\t' || c == '\r')
|
||||
switch (c) {
|
||||
case EOF:
|
||||
err(1, "getc(inslip)");
|
||||
break;
|
||||
|
||||
case '\007':
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\v':
|
||||
putchar(c);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isprint(c))
|
||||
putchar(c);
|
||||
else
|
||||
printf("%02x ", c);
|
||||
break;
|
||||
}
|
||||
c = getc(inslip);
|
||||
} while (c != SLIP_END);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user