Yes, you are right. I did confuse /bin/echo with the shell builtin.

On Jan 11, 2017 10:22 PM, "Daniel Dickman" <didick...@gmail.com> wrote:

>
>
> On Wed, Jan 11, 2017 at 10:09 PM, Pavan Maddamsetti <
> pavan.maddamse...@gmail.com> wrote:
>
>> 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?
>>
>>
>
> are you confusing the echo shell builtin with /bin/echo? these are two
> different things. see "man echo" vs. "man ksh" assuming your shell is ksh.
>
> in any case, what does this have to do with openbsd?

Reply via email to