A deeper discussion about USER

Bob Stockler bob at trebor.iglou.com
Fri Apr 22 11:14:44 PDT 2005


Tom Pancero wrote (on Fri, Apr 22, 2005 at 12:40:59PM -0400):
[snip]
| It has been my experience that the NULL character will NEVER
| make it through the USER command as it will be stripped off
| either by the shell, or by the USER command. (I am not sure
| which).  Is this correct?

If your utility sends a NUL to filePro's USER routine, the
NUL character won't be read, but it will be an empty string.

I wrote a processing table and shell script to play with:

  @MENU    If: 
      1  Then: ' excute with: dclerk fPfile -sAny -y '' -z TableName
      2  Then: USER tom = /tmp/tom
      3  Then: tom = "1"
  loop     If: 
      4  Then: tm = tom
           If: tm eq chr("0")
      5  Then: show "I read NUL." ; wk = waitkey ; exit
           If: tm eq ""
      6  Then: show "I read \"\"." ; wk = waitkey ; exit
      7  Then: show tm ; wk = waitkey ; goto loop

  #!/bin/ksh
  while :      # /tmp/tom
  do read tom
     [[ "$tom" = "quit" ]] && exit
     echo $tom | gawk '{
       print "123"
       print "456"
       print "789"
       # printf("%c\n",0) # prints a NUL followed by a newline
       printf("%c",0)     # prints a NUL not followed by a newline
       exit }'
  done

Play with them.  If your utility doesn't send any blank lines
followed by newlines (interspersed among the data it sends),
it seems to me that testing for "" will serve to tell you when
it's done.

Note that the NUL it sends doesn't have to be followed by a
newline (but it's OK if it is).

Bob

-- 
Bob Stockler - bob at trebor.iglou.com
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).


More information about the Filepro-list mailing list