[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1952.0. "Risc Ultrix User Executive command parsing problem." by WPOMM2::ZAMBOTTI () Wed Dec 20 1989 02:56

Hi guys,

feels a little better when you discover a solution to a problem and can help
others rather than relying all the time.

The problem was this I was trying to get a small cc program I borrowed to fire
up vaxnotes on a vms node using objects.  I used a command like this :

	accessobject -node wpomm2/zambotti/######:: -object #128

This worked fine as object 128 on the vax node would fire up notes on a window
on my system.  Thanks to Jeff Michaud from Decnet-ultrix conference for this 
piece of code.

What went wrong was this would not work from the User Executive Application Menu
or any other menu.  The program would core dump.  Finally we resorted to having
accessobject print a list of all the arguements (real good K.& R. stuff).

When we done this it was found the last arguement was missing.  In fact anything
after the "#128" would go walk about as well.  Obviously the "#" meant something
to the UE command line parser so we fell back on the old faithful single quotes
to overcome this problem.

	accessobject -node wpomm2/zambotti/######:: -object '#128'

If anyone has problems with "#"'s try using singal quotes around them.

And if anyone is interested in the piece of code to access an object it follow
below :

#include <stdio.h>

main(argc, argv)

int argc;
char *argv[];

{
int NodPos, ObjPos ;

   if((NodPos = StrOpt("-node", argc, argv, 1)) && (ObjPos = StrOpt("-object", a
rgc, argv, 1))) {
      if(dnet_conn(argv[NodPos+1], argv[ObjPos+1], 0, 0,0,0,0) < 0) {
            nerror(argv[NodPos+1]) ;
            exit(1) ;
        }
        else {
            exit(0) ;
        }
    }
    else {
        fprintf(stderr, "%s : invalid arguements\n", argv[0]) ;
    }
}


StrOpt(Search, ArgC, ArgV, Start)
/* return position of search string in arglist or 0 */

char *Search, *ArgV[] ;
int  ArgC, Start ;

{
int Arg ;

    for(Arg = Start ; Arg < ArgC && strcmp(ArgV[Arg], Search) ; Arg++) ;

    return(Arg == ArgC ? 0 : Arg) ;
}

And then object from the VAX/VMS node looks like :

$ if f$trnlnm ("SYS$NET") .nes. ""
$ then
$    node = f$element (0, ":", f$trnlnm ("SYS$NET"))
$    set display /node='node'::0 /create
$    def /user sys$input nl:
$    notes
$ endif
$ exit

Walter Zambotti.
T.RTitleUserPersonal
Name
DateLines
1952.1FLUME::dikeWed Dec 20 1989 07:494
The problem is that dxue hands commands more or less verbatim to sh, and # is a
comment character to sh.  If the # begins a token, then the rest of the line
is taken as a comment.  Quoting the token, as you noted, fixes the problem.
				Jeff