int
main(int argc, char **argv)
{
while (argc > 1) {
puts(argv[1]);
argc--;
argv++;
}

return 0;
}

Here is an example of a program similar to echo, let's call it test.c,
where I want to input something like:

./test "hello world\05\05\05\05\05"

Now if I use echo to do the same thing, the octal characters do not print.

But in my program, and in fact if I just copy the source code for OpenBSD
echo into a new file and compile that, I see all the octal characters
printed out including backslashes. And if I use strlen() on the input it
will tell me the length is 26 instead of 16.

What is going on here, and how do I get the same behavior in my program as
the system echo?

Thanks.

Reply via email to