First let me state that I really don't know the proper place to be
putting this.  If this is the wrong list, I appologize, please let
me know the prefered method for submitting minor patches.  It seemed
that send-pr was just for reporting issues, not for fixing them also,
if this should've gone through send-pr....well...oops :P

this is just a fix for this:

a common way to look for pids
ps aux | grep myps

but even though stdout isn't a tty ps tries to use 79 col, and I
don't like typeing ps wwaux | grep myps.

so this patch just checks if stdout is a tty, if not it defaults to
UNLIMITED.

-Jordan
diff -crN /usr/src/bin/ps/ps.c ps/ps.c
*** /usr/src/bin/ps/ps.c        Sat Jul  8 05:14:43 2000
--- ps/ps.c     Fri Mar 16 10:56:18 2001
***************
*** 127,139 ****
  
        (void) setlocale(LC_ALL, "");
  
!       if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
!            ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
!            ioctl(STDIN_FILENO,  TIOCGWINSZ, (char *)&ws) == -1) ||
!            ws.ws_col == 0)
!               termwidth = 79;
!       else
!               termwidth = ws.ws_col - 1;
  
        if (argc > 1)
                argv[1] = kludge_oldps_options(argv[1]);
--- 127,143 ----
  
        (void) setlocale(LC_ALL, "");
  
!       if (isatty(STDOUT_FILENO)) {
!               if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
!                    ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
!                    ioctl(STDIN_FILENO,  TIOCGWINSZ, (char *)&ws) == -1) ||
!                    ws.ws_col == 0)
!                       termwidth = 79;
!               else
!                       termwidth = ws.ws_col - 1;
!       } else {
!               termwidth = UNLIMITED;
!       }
  
        if (argc > 1)
                argv[1] = kludge_oldps_options(argv[1]);

Reply via email to