RetroBSD

2.11BSD operating system for microcontrollers
It is currently Tue Jan 16, 2018 7:23 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Jul 12, 2016 6:43 am 

Joined: Mon Feb 01, 2016 5:34 am
Posts: 6
Hi!! RetroBSD developpers,

Now I prepare RetroBSD and LiteBSD demonstration at OSC Kyoto (http://www.ospn.jp/osc2016-kyoto/ in Japanese) at K*BUG (Kansai *BSD Users Group: http://www.kbug.gr.jp/ in Japanese) booth.

So, I write some shell scripts using bc, awk, ... and so on.
I found that some command including bc, don't work find, I think.

For example,
# echo 1 + 1|bc
Other environment, same command runs below
% echo 1 + 1|bc
2

And some other example related awk
# echo abc def ghi|awk '{print $1}'
abc def ghi

I think that some yacc related command has broken.

Is anyone fix these problems?

Thanks in advance.


Top
 Profile  
 
PostPosted: Tue Jul 12, 2016 9:54 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
I'm not sure off hand, but I have a feeling those commands might be too big to fit into the memory on RetroBSD for execution.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Jul 13, 2016 4:35 pm 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
First, awesome that you're giving a talk about RetroBSD and LiteBSD!

As to awk(1) and bc(1), I'm sure there are bugs in both programs because of how old they are.

dc(1) works, for example. You can run `echo 1 1 + p | dc` and that will work.
I will look into it.

_________________
@__briancallahan on Twitter


Top
 Profile  
 
PostPosted: Wed Jul 13, 2016 5:03 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Finally got round to sorting out my build environment and installing RetroBSD on a Quick240. I can confirm that these programs, while they do load, don't work properly.

No idea why yet. BC is written in Yuck, so I don't have a hope in hell of debugging it :(

Awk was recently replaced IIRC with a very light version. It may have "features" ;)

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Jul 16, 2016 3:24 am 

Joined: Mon Feb 01, 2016 5:34 am
Posts: 6
ibara wrote:
dc(1) works, for example. You can run `echo 1 1 + p | dc` and that will work.
I will look into it.

Thank you for your advice.

I want to convert from decimal to binary for blinking LEDs, so I want to use this command:
% echo "obase=2; 10"|bc
1010

I can rewite it below!!
% echo "2 o 10 p"|dc
1010

Now, I will rewrite my script at https://github.com/610t/kbug/blob/maste ... BSD/led.sh .

By the way, echo -n works correct ?
% echo -n =;echo =
= =

Again, thanks a lot!!


Top
 Profile  
 
PostPosted: Thu Aug 04, 2016 8:15 am 

Joined: Mon Feb 01, 2016 5:34 am
Posts: 6
mutoh wrote:
By the way, echo -n works correct ?
% echo -n =;echo =
= =


I thought this problem occure at /bin/echo, but it's /bin/sh built-in echo's problem.
I found why extra space is print at -n option.

Fix is below:
Code:
diff --git a/src/cmd/sh/echo.c b/src/cmd/sh/echo.c
index c7c1c15..8884acb 100644
--- a/src/cmd/sh/echo.c
+++ b/src/cmd/sh/echo.c
@@ -81,7 +81,10 @@ char **argv;
                        }
                        prc_buff(*cp);
                }
-               if( nonl ) prc_buff( ' ' );
+               if( nonl )
+                {
+                       if ( i < argc ) prc_buff( ' ' );
+                }
                else       prc_buff(i == argc? '\n': ' ');
        }
        Exit(0);


If it's correct fix, please commit it.

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission