Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #21462

Re: Which scripting for embedded automation?

From Les Cargill <lcargill99@comcast.com>
Newsgroups comp.arch.embedded
Subject Re: Which scripting for embedded automation?
Date 2015-07-23 12:18 -0500
Organization A noiseless patient Spider
Message-ID <mor7g0$vg2$1@dont-email.me> (permalink)
References <0e930740-22d8-4e2b-833f-bb5843437d0d@googlegroups.com>

Show all headers | View raw


abhishekkumardwivedi@gmail.com wrote:
> I was automating my home LAN. Need suggestion for automation
> scripting upon embedded Linux, to do some operations over LAN, such
> as scan and ping other devices, string like data transfer,etc. And
> there is need of some logic to parse received content. Perl, python,
> lua or simple shell scripting .. which one? There will be branch and
> loop operations, better to have more ready tools for network
> operations.
>
> Parser and LAN are the key here.
>

You can use any of those. I find Tcl still to be less cost
than the others, but I'm already past the learning curve.

If you tackle Tcl, you need the Brent Welch book.

Here is a rough schematic of a "ping" thing.


set pingresults ""

proc pingparser { s } {
     # will only partially wotk - proof left as exercise....
     if {[string first "eceive" $s] != -1} {
     	puts "got it <$s>"
     }
     variable pingresults
     set pingresults [ set pingresults ]\n[set s]
}

proc rd { args } {
	variable s
	if {[eof $s]} { puts "oh dear.\n" ; set ::FLAG 1  }
	set ib [ read $s ]
         #does not handle fragmentation.
         foreach a [ split $ib \n ] {
             pingparser $a
         }
}

set IP 127.0.0.1
set s [ open "| ping -n 3 -t 1 $IP " "r" ]
# may or may not want to use "-translation crlf"
fconfigure $s -translation binary -blocking 0 -buffering 1
fileevent $s readable ::rd

# enter the event loop
vwait ::FLAG
puts "Ping results for $IP are:"
puts $pingresults


-- END

A comparable Python program will be much larger.

There is also Expect but I use this sort of pattern in Tcl instead.

-- 
Les Cargill

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Which scripting for embedded automation? abhishekkumardwivedi@gmail.com - 2015-07-23 02:24 -0700
  Re: Which scripting for embedded automation? Les Cargill <lcargill99@comcast.com> - 2015-07-23 12:18 -0500
  Re: Which scripting for embedded automation? Don Y <this@is.not.me.com> - 2015-07-23 10:42 -0700
  Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-07-23 15:08 -0400
    Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-07-24 18:44 -0400
  Re: Which scripting for embedded automation? Paul Rubin <no.email@nospam.invalid> - 2015-07-23 22:00 -0700
    Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-07-24 12:19 -0400
      Re: Which scripting for embedded automation? Paul Rubin <no.email@nospam.invalid> - 2015-07-24 10:15 -0700
        Re: Which scripting for embedded automation? "WJ" <w_a_x_man@yahoo.com> - 2015-07-24 23:06 +0000
          Re: Which scripting for embedded automation? Don Y <this@is.not.me.com> - 2015-07-24 17:00 -0700
            Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-07-24 20:52 -0400
          Re: Which scripting for embedded automation? "WJ" <w_a_x_man@yahoo.com> - 2015-11-28 18:06 +0000
        Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-11-29 02:45 -0500
          Re: Which scripting for embedded automation? Paul Rubin <no.email@nospam.invalid> - 2015-11-29 23:02 -0800
            Re: Which scripting for embedded automation? rickman <gnuarm@gmail.com> - 2015-11-30 02:55 -0500

csiph-web