Reposting: QNX6.1 Cross Development Kit- slinger & ds proble

Need a response to this. seems to have gotten barried. Thread started 8/28.

This code according to the developers demonstrates the problem.

Dennis Morehart
GE Indutrial Systems



\

ds Test Page

The value of "VME_SLOT_Number" is .

\ \ \ #include #include #include #include #include #include #include #include

#define VAR_LEN 60
int verbose=0;

// Usage data for use function
#ifdef __USAGE
%C [-v c l] varname [value]
Where:
-v Verbose.
-q quiet
-c Create variable
-f Set flags to DS_PERM (use with -c)
-l looptime Display variable every looptime seconds 0=single pass
#endif


int main(int argc, char **argv)
{
int c;
char varname[VAR_LEN+1];
char value[VAR_LEN+1];
int create=0, quiet = 0;
int looptime=0;
ds_t data_server;
char flag=0;

// Set default values
strcpy (varname, “”);
strcpy (value, “”);


// parse arguments
while( ( c = getopt( argc, argv, “fvqcl:” )) != -1 )
{
switch( c )
{
case ‘v’:
verbose++;
break;
case ‘q’:
quiet++;
break;
case ‘c’:
create=1;
break;
case ‘f’:
flag = DS_PERM;
break;
case ‘l’:
looptime=atoi (optarg);
break;
default :
if (!quiet)
printf ("\nInvalid argument %s\n", optarg);
exit (-1);
}
}
if (argv[optind] == NULL)
{
if (!quiet)
printf ("\nNo variable name given %s\n", argv[1]);
exit (-1);
}
strcpy (varname, argv[optind]);

if (argv[optind+1] != NULL)
strcpy (value, argv[optind+1]);


// Connect to the data server
if ((data_server= ds_register ( )) == -1)
{
if (!quiet)
printf ("\nUnable to open data server. Error:%s \n",strerror(errno));
exit (-1);
}
if (verbose)
printf ("\nConnected to Data server");

if (create) // Create the variable
{
if ((ds_create ( data_server, varname, flag ,0 )) == -1)
{
if (!quiet)
printf ("\nUnable to create data server name %s. Error:%s\n", varname,
strerror(errno));
exit (-1);
}
if (verbose)
printf ("\nCreated variable %s", varname);
}

if (strlen (value)) // Set the variable
{
if ((ds_set( data_server, varname, value, strlen(value))) == -1)
{
if (!quiet)
printf ("\nUnable to set data server name %s. Error: %s\n", varname,
strerror(errno));
exit (-1);
}
if (verbose)
printf ("\nSet Variable %s to %s", varname, value);
}

while (1)
{
if ((ds_get(data_server,varname,value, VAR_LEN )) == -1)
{
if (!quiet)
printf ("\nUnable to get data server name %s. Error: %s\n", varname,
strerror(errno));
exit (-1);
}
if (!quiet)
printf ("\nData Server Variable %s = %s", varname, value);
else
printf ("%s", value);

if (looptime==0)
break;

sleep (looptime);

}
}

Dennis Morehart <demorehart@earthlink.net> wrote:

Need a response to this. seems to have gotten barried. Thread started 8/28.
This code according to the developers demonstrates the problem.

It’s not barried Dennis, I’m still working on it for you. Currently I’m
narrowing the test case down to reproduce the issue. I’ll post my results
ASAP.

-Adam

Dennis Morehart <demorehart@earthlink.net> wrote:

html
head
title>ds Test Page</title
/head
body
p>The value of “VME_SLOT_Number” is
!–#qnxvar read=“VME_SLOT_Number 2” -->.</p
/body
/html

You require a formating string before the qnxvar read.
eg.



I can reproduce the issue with your program, but a quick workaround
is to disconnect from the dataserver, and then reconnect before doing
a “get” on the data.

I’ll submit a bug report for this behaviour from you test case.

-Adam
amallory@qnx.com

Dennis is on vacation, so I’m posting this reply.

I had already tried putting the “qnxvar format” tag in the html and it broke
the qnxvar tag processing. Adding this tag causes the “qnxvar read” tag not
to process, i.e. the tag shows up verbatim on the web page. Not having this
tag allows the “qnxvar read” tag to process and return nothing.

We have encountered another problem. We let our program create and set a ds
variable with length 60. As long as the program writes the null at the end
of the string in the set call, we can correctly get the value out of ds. If
we don’t write the null, an extra four or five characters come out of ds
with the next get. It seems slinger has a similar problem when it writes a
value to a ds variable. When we use the “qnxvar write” tag to change the
value of the ds variable, the same four or five characters are retrieved at
the end of the value when our program does the next ds get. The “qnxvar
write” tag does not take value length as a parameter where the ds set call
does.

Either way, the “qnxvar read” tag will not get a value from ds.

Rob Ahlers
ahlersrt@salem.ge.com

You require a formating string before the qnxvar read.
eg.

!–#qnxvar format="%s" –


-Adam
amallory@qnx.com

Thanks for your quick reply.

We’re using a very inefficient method right now to get around the problem
with “qnxvar read” not working. We’re using an SSI exec tag to execute a
program we wrote called dsutil which recieves the ds variable name as a
parameter and writes the value out to standard output. The SSI echo tag is
set to on and the proper values are displayed in our HTML. I know we have
our SSI functionality working correctly. We would like to replace this
cludge with the proper “qnxvar read” tags.

Our major problem now is the fact the the “qnxvar read” tags do not work.
Or perhaps, the “qnxvar format” tag does not work. If I put the “qnxvar
format” tag in, as you requested, the format tag is processed (doesn’t show
up in the browser html source). However, the read tag no longer processes
(shows up verbatim in the browser html source). If I take out the format
tag, the same read tag does process, it just returns nothing. This is very
frustrating.

As a reply to your comment about adding a null to the end of the string or
making sure the null gets written, does slinger do that? Our results
described in the previous post seem to make us believe that it doesn’t.
We’re not going to use “qnxvar write” tags now so this issue isn’t affecting
our design. We were using it to test the ds problem.

Its hard to post the actual results of the browser html source because my
company, in its infinite wisdom, will not allow news access to your news
server (or any news server). Therefore we have to send these posts from
home (on the outside of our firewall). I will save a sample for you on a
floppy disk and bring it home to post (if I can remember). Thanks for your
ongoing assistance.

Rob

“Robert Ahlers” <ahlersrt@salem.ge.com> wrote in message
news:9ockjn$ktk$1@inn.qnx.com

Dennis is on vacation, so I’m posting this reply.

I had already tried putting the “qnxvar format” tag in the html and it
broke
the qnxvar tag processing. Adding this tag causes the “qnxvar read” tag
not
to process, i.e. the tag shows up verbatim on the web page. Not having
this
tag allows the “qnxvar read” tag to process and return nothing.

In your browser, check to “View the HTML Source”, if you see the SSI tag -
it’s not formed properly or the variable name is wrong. Here is the exact
HTML source I use, and it prints the value out from the data server. Try it
out and post your results:

Data Server and Slinger Test case

YOU SHOULD NOT SEE THIS

You should see this line

Page was last modified,

The value of "VME_SLOT_Name" is .

---------------------------

Ensure that the name has the extension .shtml or slinger will not parse the
SSI tokens. I also start slinger with the command line options -e -c -s

We have encountered another problem. We let our program create and set a
ds
variable with length 60. As long as the program writes the null at the
end
of the string in the set call, we can correctly get the value out of ds.
If
we don’t write the null, an extra four or five characters come out of ds
with the next get.

When you use the ds library to stuff values into the Data server, if it’s a
“string” you will want to append a null on the end. Since it’s based on
lengths, all you do is copy Length bytes from the buffer you specify to the
data server. Data server doesn’t append anything to the buffer you provided
when it copies it back to you, as it could be non “string” data.

It seems slinger has a similar problem when it writes a
value to a ds variable. When we use the “qnxvar write” tag to change the
value of the ds variable, the same four or five characters are retrieved
at
the end of the value when our program does the next ds get. The “qnxvar
write” tag does not take value length as a parameter where the ds set call
does.

This seems strange, I’ll look into the issue for you.

-Adam