home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: biz.sco.general
- Path: sparky!uunet!world!apl
- From: apl@world.std.com (Anthony P Lawrence)
- Subject: Re: Capturing data from a RS232 Port
- Message-ID: <C057r1.Gyw@world.std.com>
- Organization: The World Public Access UNIX, Brookline, MA
- X-Newsreader: Tin 1.1 PL3
- References: <73@shady.UUCP>
- Date: Thu, 31 Dec 1992 21:30:36 GMT
- Lines: 44
-
- kevin@shady.UUCP (Kevin Smith) writes:
- : while :
- : do
- : read line
- : echo "$line" >>$LOGFILE
- : done
- :
- : # Note: If the input data is non-ascii but fixed length you
- : # could use dd instead of the read/echo combo. Remember to
- : # set -icanon on the port.
- : # while :
- : # do
- : # dd bs=?? count=1 >>$LOGFILE
- : # done
- : ) <$TTY
- :
-
- I think you've covered most of the problems he could run into here,
- except that of validating the data, and the possibility of variant
- record lengths (assuming non-line oriented data).
-
- If this is more than a casual grabbing (it sounds like it is), I
- would think he'd want to validate "on the fly" rather than later.
- I guess this could be done with shell tools (probably some perl
- hacker would just love to do it!), but I think I'd get pretty
- frustrated trying it!
-
- Varying record lengths present another problem easily handled in
- C (or whatever) but a little tougher in the shell. Well, maybe
- not tougher, but certainly messier.
-
- Other advantages would be that a C program could eliminate the
- need for cron, or could dump it's log on receipt of a signal (yeah,
- I know: you can do that in the shell, too), etc.
-
- I'm a fan of doing things with shell tools whenever possible, but
- this is a case where I would go with C.
-
-
- Tony apl@world.std.com
-
- Lawrence & Clark, Inc (617) 762-0707 (206) 323-2864
- Xenix/Unix support,etc Boston Seattle
- Kevin Clark is embarrassed by most of what I say.
-