veerabad@buster.cps.msu.edu (Vibhu Veerabadrappa) (12/16/90)
Hi, I am a beginning programmer suing X windows, and so this may be stupid... I tried to set the shell variable XAPPLRESDIR to the pwd, and in my working directory, I have a file XHello which contains some resources for the application xhello.c (the example given in o'Reilly's book, p31). When I run the program, expecting it to take the resources from the said file, it simply refuses to do so. It still displays the default message "HELLO" ... again, I am assuming that you all know what program I am talking about ... it is the elementary program in p31 in O'Reilly and Nye's book. The exact commands I used are: <52 sapphire:~/project_X >set XAPPLRESDIR = `pwd`/ ^^^^^^^^^^^^^^^^^^^^^^^^ <53 sapphire:~/project_X >echo $XAPPLRESDIR ^^^^^^^^^^^^^^^^^ /usr/ua/ua/veerabad/project_X/ <54 sapphire:~/project_X >xhello ^^^^^^ and xhello did not read the XHello file. Another question is, I tried to change the font path fp using xset +fp as below and I got the error messagees shown: <57 sapphire:~/project_X >xset +fp /usr/ua/ua/veerabad/project_X/ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ X Error of failed request: BadValue (integer parameter out of range for operati on) Major opcode of failed request: 51 (X_SetFontPath) Minor opcode of failed request: 0 Resource id in failed request: 0x0 Serial number of failed request: 4 Current serial number in output stream: 6 <58 sapphire:~/project_X > Could someone tell me what it is, that I am doing wrong? e-mail would be better, as I may not catch the response on the news net. Thanks a lot, in advance. ---Vibhu. e-mail address: veerabad@buster.cps.msu.edu
mouse@LIGHTNING.MCRCIM.MCGILL.EDU (12/16/90)
> I tried to set the shell variable XAPPLRESDIR to the pwd, and in my > working directory, I have a file XHello which contains some resources > for the application xhello.c [...]. When I run the program, > expecting it to take the resources from the said file, it simply > refuses to do so. > <52 sapphire:~/project_X >set XAPPLRESDIR = `pwd`/ > <53 sapphire:~/project_X >echo $XAPPLRESDIR > /usr/ua/ua/veerabad/project_X/ > <54 sapphire:~/project_X >xhello > and xhello did not read the XHello file. You appear to be using the C-shell. If this is the case, you have two different sorts of variable available: shell variables and environment variables. There are several differences, but the relevant one here is that shell variables are not passed to commands, whereas environment variables are. As you may guess at this point, you are setting a shell variable called XAPPLRESDIR; you want to set an environment variable. (Both sorts of variable are understood by the $ expansion mechanism in the shell.) Try instead setenv XAPPLRESDIR `pwd` (using $cwd instead of `pwd` would probably be faster.) Note the lack of an = sign; the syntax is somewhat inconsistent. Bourne shells (and derivatives) have the same basic problem, but the terminology is different: all variables are considered to be the same sort of thing, but some are exported and some aren't. But that's irrelevant in your case; that set command would not have worked in sh. > Another question is, I tried to change the font path fp using xset > +fp as below and I got the error messagees shown: > <57 sapphire:~/project_X >xset +fp /usr/ua/ua/veerabad/project_X/ > X Error of failed request: BadValue (integer parameter out of range for operation) > Major opcode of failed request: 51 (X_SetFontPath) [...] > Could someone tell me what it is, that I am doing wrong? This one can't really be answered with surety without more information. I have two guesses, though. One is that your X server is running on an X terminal, another workstation, or some other machine which can't access the path you gave. (Your *clients* may be able to access the font directory, but that has nothing to do with it. The *server* has to be able to get at it in order for it to work in the font path.) The other is that you didn't run mkfontdir (or your server's analog) to create the fonts.dir (or analog) in that directory. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu