* More control chars that needs binary output.
This commit is contained in:
parent
e4305295f7
commit
7993f46e76
1 changed files with 22 additions and 6 deletions
28
tools/scat.c
28
tools/scat.c
|
@ -26,7 +26,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int slipfd;
|
int slipfd;
|
||||||
int ret;
|
|
||||||
FILE *inslip;
|
FILE *inslip;
|
||||||
const char *siodev;
|
const char *siodev;
|
||||||
int c;
|
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
err(1, "usage: scat device-file");
|
err(1, "usage: scat device-file");
|
||||||
|
@ -128,10 +126,28 @@ main(int argc, char **argv)
|
||||||
else if (c == SLIP_ESC_END)
|
else if (c == SLIP_ESC_END)
|
||||||
c = SLIP_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);
|
putchar(c);
|
||||||
else
|
break;
|
||||||
printf("%02x ", c);
|
|
||||||
|
default:
|
||||||
|
if (isprint(c))
|
||||||
|
putchar(c);
|
||||||
|
else
|
||||||
|
printf("%02x ", c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
c = getc(inslip);
|
c = getc(inslip);
|
||||||
} while (c != SLIP_END);
|
} while (c != SLIP_END);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue