aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_pager.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-03 19:33:14 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-03 19:33:14 +1000
commit264c06500643124d8d3f9f8e5b40e8cd0e4efc47 (patch)
tree3f5097e5fe41abe95da672891ec472de008c7669 /fish_pager.c
parent07c89c71d8d799756725b1b7cf3e03d5ed79826f (diff)
Remove old unneeded code that makes fish_pager wait to become owner of the terminal
darcs-hash:20060203093314-ac50b-537c521093e85a110f822cde37b022d7706e8cb0.gz
Diffstat (limited to 'fish_pager.c')
-rw-r--r--fish_pager.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/fish_pager.c b/fish_pager.c
index ffbe725d..2aefdb97 100644
--- a/fish_pager.c
+++ b/fish_pager.c
@@ -564,7 +564,7 @@ static int completion_try_print( int cols,
memset( pref_width, 0, sizeof(pref_width) );
memset( min_width, 0, sizeof(min_width) );
- /* Calculated how wide the list would be */
+ /* Calculate how wide the list would be */
for( j = 0; j < cols; j++ )
{
for( i = 0; i<rows; i++ )
@@ -814,7 +814,7 @@ static void mangle_descriptions( array_list_t *l )
{
wchar_t *next = (wchar_t *)al_get(l, i);
wchar_t *in, *out;
- skip=0;
+ skip=1;
while( *next != COMPLETE_SEP && *next )
next++;
@@ -865,7 +865,11 @@ static void init()
struct sigaction act;
program_name = L"fish_pager";
wsetlocale( LC_ALL, L"" );
-
+
+ /*
+ Make fd 1 output to screen, and use some other fd for writing
+ the resulting output back to the caller
+ */
int out = dup( 1 );
close(1);
if( open( ttyname(0), O_WRONLY ) != 1 )
@@ -877,6 +881,10 @@ static void init()
}
}
out_file = fdopen( out, "w" );
+
+ /**
+ Init the stringbuffer used to keep any output in
+ */
sb_init( &out_buff );
output_init();
@@ -894,33 +902,6 @@ static void init()
exit(1);
}
- /* Loop until we are in the foreground. */
- while (tcgetpgrp( 0 ) != getpid())
- {
- kill (- getpid(), SIGTTIN);
- }
-
- /* Put ourselves in our own process group. */
- if( getpgrp() != getpid() )
- {
- if (setpgid (getpid(), getpid()) < 0)
- {
- debug( 1,
- L"Couldn't put the shell in its own process group");
- wperror( L"setpgid" );
- exit (1);
- }
- }
-
- /* Grab control of the terminal. */
- if( tcsetpgrp (STDIN_FILENO, getpid()) )
- {
- debug( 1,
- L"Couldn't grab control of terminal" );
- wperror( L"tcsetpgrp" );
- exit(1);
- }
-
handle_winch( 0 ); /* Set handler for window change events */
tcgetattr(0,&pager_modes); /* get the current terminal modes */