To: Unix gurus: xterm lack important feature (?)

To: Unix gurus: xterm lack important feature (?)

Post by Neil Zanell » Mon, 17 Aug 1998 04:00:00



Hello,

I have posted this already but with no successful reply:

I dial up as a normal user with

su -c /usr/sbin/dip /stuff/dialup.dip

enter the root password, and get connected, all within an xterm.

However,

/usr/X11R6/bin/xterm -e su -c "/usr/sbin/dip /stuff/dialup.dip"

does not seem to work for some (stupid?) reason. I need to do this to be able to

bind the action to a button on my window manager's buttonbox.

Hence dialing up becomes as easy as clicking a button and entering the root password.

(i) Why does ot not work? The script seems to run fine but just before it is done the window

    exits and I hear the modem clicking a second time, hence disconnecting.

(ii) Is there an xterm option similar to -e which DOES NOT close the window after termination of the
     program being executed?

Thanks for your advice,

(any alternative solutions to my problem are very appreciated)

Neil Zanella

 
 
 

To: Unix gurus: xterm lack important feature (?)

Post by Paul » Wed, 19 Aug 1998 04:00:00


Hi Neil,

To the best of my knowledge there is no option for xterm to stay open , but there is
an alternative solution !!

all you need to do is have the xterm -e call a shell script with your commands in this will
execute as normal , to stop the xterm from exiting add this to the end of the shell script : -

echo "Press <cr> To Continue"

read return

The xterm will now sit there waiting for you to press another key , you can then minimize your xterm and
get on with whatever you want !!

To close the xterm just open it up and press a key !

Regards

Paul.

 
 
 

To: Unix gurus: xterm lack important feature (?)

Post by Neil Zanell » Wed, 19 Aug 1998 04:00:00


Hi!

Not a bad idea. In fact, by the time I read this I had come up with a similar alternative:

I use a shell script just like you suggest and at the end of my script I put a:

sleep 7

This allows some time for my program to finish executing after it returns the shell prompt

(this might sound incorrect since you may think that when the shell prompt appears a program

does terminate.) However there seem to be some somewhat unfortunate circumstances (see below

concerning dip and "mode CSLIP" on comp.os.linux.networking:

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

I am working on allowing users to dialup by pressing a button on a
buttonbox running under X.

Here is my usual SLIP dialup script which works when invoked as

su -c "/usr/sbin/dip /stuff/dialup.dip"

... dip script follows ...

main:
   get $mtu 1500
   get $remote 134.153.98.254
   netmask 255.255.255.0
   default
   port cua1
   speed 38400

prepare:
   #echo on
   # Reset the modem with the ATZ command.
   # Hangs up if necessary.
   reset
   # The minicom program initializes my modem with
   # the following string each time I run it.
   #init AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
   init ATS7=45S0=0L1V1X4&c1E1Q0
   # Turn speaker permanently off.
   send ATM\r

account:
   print Possible values for variable MYACCOUNT are:
   print
   print 1 (option1)
   print 2 (option2)
   print
   get $MYACCOUNT ask
   if $MYACCOUNT == 1 goto option1
   if $MYACCOUNT == 2 goto option2
   print
   goto account

option1:
   get $MYUSERNAME <my username1>
   get $MYPASSWORD <my password1>
   goto dial

option2:
   get $MYUSERNAME <my username2>
   get $MYPASSWORD <my password2>
   goto dial

dial:
   dial 737-2168
   if $errlvl == 1 goto connected
   if $errlvl == 3 goto busy
   if $errlvl == 5 goto nodialtone

connected:
   wait Memorial: 5
   send login\n
   wait Username: 5
   send $MYUSERNAME
   send \n
   wait Password: 5
   send $MYPASSWORD
   send \n
   wait Memorial:
   send slip\n
   wait Entering 5
   get $locip remote
#  get $local remote
   print
   print Your dynamically allocated IP address is $locip
   print
   mode CSLIP
   exit

busy:
   print
   print All lines are currently busy. Do you wish to retry?
   print
   print 1 (retry)
   print 2 (exit program retry)
   print
   get $RETRY ask
   if $RETRY == 1 goto prepare
   if $RETRY == 2 goto busy
   goto busy

busy:
   print
   print All lines are currently busy. Do you wish to retry?
   print
   print 1 (retry)
   print 2 (exit program)
   print
   get $RETRY ask
   if $RETRY == 1 goto prepare
   if $RETRY == 2 goto exit
   goto busy

nodialtone:
   print There was no dialtone. Make sure your computer is
   print connected to a phoneline and that the line is not
   print in use and then retry.
   quit

exit:
   exit

...

end of script.

Now, if I invoke the script as

xterm -e "/usr/sbin/dip /stuff/dialup.dip"

then the script connects but fails at the mode CSLIP location.

(I've done some tedious debugging so I know that's where it fails).

If I run dip in test mode with /usr/sbin/dip -tv

then I see that after I get to "mode CSLIP" the "exit" command is

not reached. Rather, "mode CSLIP" seems to kick me out of the dip program.

Even though "mode CSLIP" does kick me out of the dip program, about 6

seconds after I get my shell prompt back I am usually connected.

However, not with xterm -e "/usr/sbin/dip /stuff/dialup.dip" since getting

my shell prompt back means exiting the window that was spawned.

So there seems to be a small problem in either the dip program itself or

more likely the dip script.

So, I managed to fix the problem in an ugly way, and as I said it is ugly

and would rather not have to invoke the following shell script to fix the

problem:

#!/bin/sh

su -c "/usr/sbin/dip /stuff/dialup.dip"

sleep 20

... end of shell script.

The sleep 20 at the end of the script seems to fix the problem but I really

don't like it.

Since as I said, the "mode CSLIP" command kicks me out of the dip program it

is impossible for me to use the built in "sleep" command (the one built into

the dip program) for placing it after "mode CSLIP" will cause it to never

be executed.

So, what is wrong with my script/ with dip/ etc... ?

TIA,

Neil Zanella


> Hi Neil,

> To the best of my knowledge there is no option for xterm to stay open , but there is
> an alternative solution !!

> all you need to do is have the xterm -e call a shell script with your commands in this will
> execute as normal , to stop the xterm from exiting add this to the end of the shell script : -

> echo "Press <cr> To Continue"

> read return

> The xterm will now sit there waiting for you to press another key , you can then minimize your xterm and
> get on with whatever you want !!

> To close the xterm just open it up and press a key !

> Regards

> Paul.

 
 
 

To: Unix gurus: xterm lack important feature (?)

Post by Bill Tott » Fri, 21 Aug 1998 04:00:00




Quote:>/usr/X11R6/bin/xterm -e su -c "/usr/sbin/dip /stuff/dialup.dip"

>does not seem to work for some (stupid?) reason. I need to do this [...]
>bind the action to a button on my window manager's buttonbox.
>Hence dialing up becomes as easy as clicking a button and entering the [...]
>(i) Why does ot not work? The script seems to run fine but just before [...]
>    exits and I hear the modem clicking a second time, hence disconnecting.

This is *most likely* because the xterm program is your parent process.  When
the parent dies, it takes it's children down with it.  There was an earlier
thread about a program which may fix this it is at:
ftp://www.mindspring.com/users/mwang/unix-prog/

However, I usually go about these kinds of things like so:
/usr/X11R6/bin/xterm -e su -c "(/usr/sbin/dip /stuff/dialup.dip &)"

Your /usr/sbin/dip program will not be connected to the xterm, so it
should allow your xterm process to die without taking the children
down with it.

Try it, it may work.
--
Totten, William David (Bill)              Computer and Information Sciences

http://pobox.com/~totten/               Friends don't let friends use emacs

 
 
 

1. I need an xterm Guru! xterm stopped running.

I am in serious need of an "xterm" expert.

Suddenly, yesterday I lost the ability to run
xterms.  I am running:

Linux ithink 0.99.13 #25 Mon Sep 20 18:42:38 GMT 1993 i486

I was trying to debug something else, restored some files
from a tape and may have modified some rc files, I just
don't remember. I don't think I did.

Here are my observations.
X is running with the fvwm window manager.
All seems to be OK.  I CAN run xclock, ical and xman
either from pop-up menus in fvwm or from a virtual
terminal.  They work fine.

If I start xterm, either from the pop-up ( which has
been working for a year ) or from a virtual console,
I SEE NOTHING on the X display.
PS indicates that all of these xterms are running,
but they don't seem to connect to my X server.
Again, xclock and friends have no trouble doing this.
I have run xterm right from CDROM, to make sure the
binary didn't get damaged, same results.

What is special about xterm, that it would run and not
connect to the X server??  How can I get debug information?

Could the wrong TERM setting do this, where is it normally
set, or is it set by the window manager?
Is there a way to run xterm such that it doesn't look for configuration
files? Has anyone ever seen this?
Does the Xserver have some device name, permissions ??
Again, I am confused that all other apps seem to run fine.

Several people have made obvious suggestions, which I
appreciate, the obvious is not always obvious.


2. "Unknown" drive error

3. ls feature lacking: whereami command(?)

4. Precompiled graphics viewers

5. Another Fvwm feature lacking in XP

6. what's it mean when thr_create(...) returns -1??

7. Lack of feature for 'date' cmd

8. Bison++ Flex++ where to get ?

9. Important Feature ... No editor has it yet?

10. Xterms lacking colour

11. xterm menus (or lack of menus)

12. xterm lacks arrow keys.

13. Need Bash Guru to add feature