Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Regina Rexx and Zenity on Ubuntu

20 views
Skip to first unread message

Bullet

unread,
Dec 8, 2009, 2:47:12 PM12/8/09
to
I am trying to use Zenity in a rexx script to obtain user's login
password via a Zenity dialog. The dialog works but spits the user
entered login password but to the terminal window. Can someone tell
me how to redirect the password output by Zenity so I can process
without it being seen to the user? Relevent code is on the d lines
below marked with 1>> and 2>> with the variable named "cmd". Any
suggestions for alternative approaches are appreciated. Thanks in
advance.

/* Updated 11/29/09 16:55:51 by rob */
/* rexx routine to display hardware list in firefox */
/* Uses Zenity to get user's login password */
/*
trace ?a
*/
parse source system invocation s_id rest
h=lastpos("/",s_id)+1 /* Getting source file name and extension */
l=length(s_id)-h+1
s_fid=substr(s_id,lastpos("/",s_id)+1,length(s_id)-h+1) /* strip out
directories to get source fileid */
if pos(".",s_fid)>0 then do
s_fn=substr(s_fid,1,pos(".",s_fid)-1) /* Source filename is
everything to left of . */
end
else s_fn=s_fid /* no file extension */
/*
cmd='printenv > cron_env.txt'
cmd
user=value('USER', ,'SYSTEM'); /* Should be the userid in
linux, but */
/* USER is not available to
Cron */
/* use LOGNAME
instead. */
*/
user=value('LOGNAME', ,'SYSTEM'); /* Should be the userid in
linux */
text="""To generate an html formatted hardware list for "user" for
display in Firefox please provide your password to sudo."""
1>> cmd='zenity --entry --title='s_fn' --entry-text=" " --hide-text --
text='||text
2>> cmd
rcs=rc /* return code save */
if rcs = 1 then do
say "Cancelled."
end
else if rcs = 0 then do
cmd="sudo lshw -html > ~/hardware_info.html && firefox ~/
hardware_info.html"
cmd
end
else if rcs = -1 then do
say "An unexpected error has occurred."
end
else if rcs = 5 then do
say s_fn" has timed out."
end
call exit rcs
exit:

procedure expose rcs

exit rcs

Mark Hessling

unread,
Dec 8, 2009, 5:12:47 PM12/8/09
to

Try one of the following:
/* call zenity as an external function*/
title = 'fred'
switches = '--entry --title="'title'" --hide-text'
ret = 'zenity'( switches )
Say ret

/* Use ADDRESS...WITH and write output to queue */
Address System 'zenity' switches With Output FIFO ''
Parse Pull ret
Say ret
/* Use Address...WITH and write output to stem variable */
Address System 'zenity' switches With Output STEM ret.
Say ret.1

Cheers, Mark

Bullet

unread,
Dec 9, 2009, 6:55:26 PM12/9/09
to

Thank you, Mark,
The 1st one still spits the user entry back to the terminal. The 2nd
two are what I wanted and was missing. I didn't try the stem
approach, but I am it will work the same as the stack approach.
Happy Trails, Rob

Mark Hessling

unread,
Dec 10, 2009, 2:57:03 AM12/10/09
to
On Wed, 09 Dec 2009 15:55:26 -0800, Bullet wrote:

[snip]

>
> Thank you, Mark,
> The 1st one still spits the user entry back to the terminal. The 2nd
> two are what I wanted and was missing. I didn't try the stem approach,
> but I am it will work the same as the stack approach. Happy Trails, Rob

Hmm, the first one works here. What version of Regina are you running?

Bullet

unread,
Dec 10, 2009, 12:19:18 PM12/10/09
to

rob@fargo:~$ rexx -v
REXX-Regina_3.4 5.00 30 Dec 2007
The first suggestion works here as well. I just tried it again.
Sorry for the misinformation.
Rob

0 new messages