Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with trap in terminal locking pgm Post 302322860 by Corona688 on Thursday 4th of June 2009 06:05:17 PM
Old 06-04-2009
Locking a terminal is an interesting question which has bugged me too.

Ctrl-D is not a signal, it just closes stdin. It's also a function of the terminal, hence controlled by stty. I'm not sure it even can be disabled. Not even 'su -' can ignore ctrl-D and it's the one thing that can ignore everything else... IGNOREEOF=-1 will stop the terminal from quitting from it at least.

If you're changing the terminal settings it'd be wise to save/restore them since they're global to the terminal.

Code:
TTYSAVE=`stty --save`

...

stty $TTYSAVE

-----Post Update-----

Setting the EOF char to something impossible may work. 'stty eof 255'

Last edited by Corona688; 06-04-2009 at 07:30 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Prompt User for Pgm Output Destination

SCO Open Server 5 A program that I am working with outputs data to a system or printer with the traditional output > lp This output line along with some other job output formatting information is stored as a defined output within the program so that the average user scrolls the list of... (0 Replies)
Discussion started by: termite
0 Replies

2. Shell Programming and Scripting

Building a better mouse trap, or How many lines of code does it take to trap a mouse?

Hello all, I'm hoping to get a little insight from some of the wily veterans amongst you. I've written a script to check for new outgoing files to our vendors located on our ssl server. It seems to be working ok, but the final question here, will be one of logic, and/or a better way to... (4 Replies)
Discussion started by: mph
4 Replies

3. Programming

Pgm Output is Interleaved with other pgms

Hi I have a shared object which is called from a third party tool. In my .so, I am using 'freopen(mylogfilename,"at",stderr)'. It is logging all my program output and it is also writing warning messages from the third party daemons also. How can I avoid these unwanted messages... (1 Reply)
Discussion started by: axes
1 Replies

4. UNIX for Dummies Questions & Answers

Which pgm write into a file ?

Hi! I'm looking for a command/script to be able to get the program who write into a file. I've a logfile who grow up but I don't find which program write on it :eek: thanks for your support&help. .fr. (2 Replies)
Discussion started by: Franzlebord
2 Replies

5. Shell Programming and Scripting

Cntl+z Trap is not detecting ??? Help required to add a trap detection ???

Hi folks, I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:.... The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies

6. UNIX for Advanced & Expert Users

how to check port already used in pcap pgm

hi, I am writing one packet receiving program using libpcap library. Now, I want to check port is already using or not. how to check in receiver program.. If normal program,using bind return value we can able to check the port is already using or not. but, in pcap program how can i... (1 Reply)
Discussion started by: ram.sj
1 Replies

7. Programming

File operations in C pgm

i am reading and writing to a a file in C language. the input file is described as follows 111 aaa descr1 222 bbb descr2 333 ccc <SPACE> {6 spaces are left after ccc i.e in 3rd column} 444 ddd descr4 when i read and write to a file, the space is not coming in the output file.... (8 Replies)
Discussion started by: vkca
8 Replies

8. Homework & Coursework Questions

VM trap may work differently than a pure install trap.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: That is the last reply I received from my instructor, and I'm looking for some alternatives. When using... (2 Replies)
Discussion started by: newuser45
2 Replies

9. Shell Programming and Scripting

Simpler crontab entry to execute pgm on last day of the month

The following bash command line works for the last day of the month. Test by replacing the 1 with tomorrows day of month number && echo "Day before tomorrow"Can it be used within crontab? As * * 28-31 * * && echo "Today ls last day of month" >>/tmp/crontabtestI tried to test crontab with... (1 Reply)
Discussion started by: lsatenstein
1 Replies

10. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies
term::ansi::ctrl::unix(3tcl)					 Terminal control				      term::ansi::ctrl::unix(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
term::ansi::ctrl::unix - Control operations and queries SYNOPSIS
package require Tcl 8.4 package require term::ansi::ctrl::unix ?0.1.1? ::term::ansi::ctrl::unix::import ?ns? ?arg...? ::term::ansi::ctrl::unix::raw ::term::ansi::ctrl::unix::raw ::term::ansi::ctrl::unix::columns ::term::ansi::ctrl::unix::rows _________________________________________________________________ DESCRIPTION
WARNING: This package is unix-specific and depends on the availability of two unix system commands for terminal control, i.e. stty and tput, both of which have to be found in the $PATH. If any of these two commands is missing the loading of the package will fail. The package provides commands to switch the standard input of the current process between raw and cooked input modes, and to query the size of terminals, i.e. the available number of columns and lines. API
INTROSPECTION ::term::ansi::ctrl::unix::import ?ns? ?arg...? This command imports some or all attribute commands into the namespace ns. This is by default the namespace ctrl. Note that this is relative namespace name, placing the imported command into a child of the current namespace. By default all commands are imported, this can howver be restricted by listing the names of the wanted commands after the namespace argument. OPERATIONS ::term::ansi::ctrl::unix::raw This command switches the standard input of the current process to raw input mode. This means that from then on all characters typed by the user are immediately reported to the application instead of waiting in the OS buffer until the Enter/Return key is received. ::term::ansi::ctrl::unix::raw This command switches the standard input of the current process to cooked input mode. This means that from then on all characters typed by the user are kept in OS buffers for editing until the Enter/Return key is received. ::term::ansi::ctrl::unix::columns This command queries the terminal connected to the standard input for the number of columns available for display. ::term::ansi::ctrl::unix::rows This command queries the terminal connected to the standard input for the number of rows (aka lines) available for display. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category term of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
ansi, columns, control, cooked, input mode, lines, raw, rows, terminal CATEGORY
Terminal control COPYRIGHT
Copyright (c) 2006-2011 Andreas Kupries <andreas_kupries@users.sourceforge.net> term 0.1.1 term::ansi::ctrl::unix(3tcl)
All times are GMT -4. The time now is 06:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy