v16i061: lc - Categorize and List Files In Columns, Patch1

Kent Landfield kent at sparky.imd.sterling.com
Wed Jan 9 14:48:19 AEST 1991


Submitted-by: kent at sparky.imd.sterling.com (Kent Landfield)
Posting-number: Volume 16, Issue 61
Archive-name: lc/patch1
Patch-To: lc: Volume 14, Issue 82-83

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix at uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
# Contents:  lc.patch
# Wrapped by kent at sparky on Tue Jan  8 21:39:52 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'lc.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lc.patch'\"
else
echo shar: Extracting \"'lc.patch'\" \(15399 characters\)
sed "s/^X//" >'lc.patch' <<'END_OF_FILE'
Xdiff -c ../lc.old/README ./README
X*** ../lc.old/README	Tue Jan  8 21:23:29 1991
X--- ./README	Tue Jan  8 21:22:27 1991
X***************
X*** 1,23 ****
X  
X  			LC
X  
X! 		"@(#)README	1.3 9/7/90 Kent Landfield"
X  
X  This directory contains the source to lc. lc is much like the ls 
X  command except it separates the types of files into groups and then
X  displays located file names to the user is a columnar fashion. 
X  
X! lc was initially implemented by myself after I became accustomed
X! to the lc command on a Mark Williams Coherent system I was running back
X! in 1984.  When I started moving to different systems I found that I did
X! not like the lack of information, flexibility and the general display 
X! that ls provided.  I have found that I am not the only one that has 
X! become feed up with ls and its jumbled output. All the people here use 
X! lc much more than they use ls. It is a locally well known fact that when
X! a new machine comes into the house, the first local software that is put 
X! on the machine is lc.  It is far from perfect but it is better than ls on 
X! a general use basis.
X  
X  lc uses three different environment variables COLS, CDPATH, and LC
X  allowing you to customize how you wish lc to perform on a default 
X  basis. COLS is used to switch the column width between 80 and 132 
X--- 1,29 ----
X  
X  			LC
X  
X! 		"@(#)README	1.4 1/8/91 Kent Landfield"
X  
X  This directory contains the source to lc. lc is much like the ls 
X  command except it separates the types of files into groups and then
X  displays located file names to the user is a columnar fashion. 
X  
X! "lc"'s history goes back to 1978 when it was originally developed at the
X! University of Waterloo on a Honeywell 66/60 system. It became so popular 
X! that it was ported to Waterloo's V7 Unix systems shortly thereafter.  
X! This version is a complete re-implementation of lc and contains no 
X! University of Waterloo code.
X  
X+ This version of lc was initially implemented by myself after I became 
X+ accustomed to the lc command on a Mark Williams Coherent system I was 
X+ running back in 1984.  When I started moving to different systems I 
X+ found that I did not like the lack of information, flexibility and the 
X+ general display that ls provided.  I have found that I am not the only 
X+ one that has become feed up with ls and its jumbled output. All the 
X+ people here use lc much more than they use ls. It is a locally well 
X+ known fact that when a new machine comes into the house, the first local 
X+ software that is put on the machine is lc.  It is far from perfect but 
X+ it is better than ls on a general use basis. 
X+ 
X  lc uses three different environment variables COLS, CDPATH, and LC
X  allowing you to customize how you wish lc to perform on a default 
X  basis. COLS is used to switch the column width between 80 and 132 
X***************
X*** 59,70 ****
X          -l      Mark symbolic links with '@'
X          -I      Suppress unresolved symbolic link messages.
X    
X!    The "only" options can not be combined.
X  
X     If there is no 'directory' specified, the current directory is used.
X  
X     Not all options are supported on every system. (e.g. no symbolic links
X!    on your system ? Options -s, -L or -l won't be available..)
X     If your system does not support shared memory name space entry files, 
X     then you cannot use the -m option...
X  
X--- 65,76 ----
X          -l      Mark symbolic links with '@'
X          -I      Suppress unresolved symbolic link messages.
X    
X!    The "only" options can be combined.
X  
X     If there is no 'directory' specified, the current directory is used.
X  
X     Not all options are supported on every system. (e.g. no symbolic links
X!    on your system ? Options -s, -I -L or -l won't be available..)
X     If your system does not support shared memory name space entry files, 
X     then you cannot use the -m option...
X  
X***************
X*** 87,93 ****
X--- 93,102 ----
X        Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
X        Tested with UTek on a Tektronix XD8810 in 1989.
X        Tested with AIX 3.+ on a Risc System/6000 in 1990.
X+       Ivan Fris added the ability to combine "only" options in 1990.
X+       Mike Peterson ported it to the Apollo Domain/OS SR10.2 in 1990.
X  
X+ 
X  The following is a todo list that may get done someday...
X  
X  1. Port to all flavors of unix on all platforms. Lofty goal but
X***************
X*** 95,101 ****
X  2. Need to modify lc so that one environment (or compile) option will
X     only let you see files you own or have access to.
X  3. Add spell checking code to CDPATH usage
X- 4. Allow combination of only options...
X                                                          
X                            *PLEASE!* 
X  If you have a problem, there's someone else out there who either has
X--- 104,109 ----
X***************
X*** 102,108 ****
X  had or will have the same problem.  Please send all "lc" ideas, patches, 
X  etc to 
X  
X! INTERNET: kent at sparky.IMD.Sterling.COM or UUCP: uunet!ssbell!sparky!kent
X  
X  so that I can continue to improve the functionality and portability of lc.
X  
X--- 110,116 ----
X  had or will have the same problem.  Please send all "lc" ideas, patches, 
X  etc to 
X  
X! INTERNET: kent at sparky.IMD.Sterling.COM or UUCP: uunet!sparky!kent
X  
X  so that I can continue to improve the functionality and portability of lc.
X  
Xdiff -c ../lc.old/lc.1 ./lc.1
X*** ../lc.old/lc.1	Tue Jan  8 21:23:34 1991
X--- ./lc.1	Tue Jan  8 21:22:27 1991
X***************
X*** 1,4 ****
X! .\" @(#)lc.1	1.1 9/7/90 Kent Landfield;
X  .TH LC 1 "Usenet Source"
X  .SH NAME
X  .B lc 
X--- 1,4 ----
X! .\" @(#)lc.1	1.2 1/8/91 Kent Landfield;
X  .TH LC 1 "Usenet Source"
X  .SH NAME
X  .B lc 
X***************
X*** 46,52 ****
X  is used to switch the column width between 80 and 132 column display.
X  .PP
X  .B lc 
X! has incorporated the minimal the spell checking routines found in the book,
X  The UNIX Programming Environment, by Brian Kernighan and Rob Pike.  
X  .PP
X  If the command line argument list contains more than one name, the 
X--- 46,52 ----
X  is used to switch the column width between 80 and 132 column display.
X  .PP
X  .B lc 
X! has incorporated the minimal spell checking routines found in the book,
X  The UNIX Programming Environment, by Brian Kernighan and Rob Pike.  
X  .PP
X  If the command line argument list contains more than one name, the 
X***************
X*** 127,133 ****
X  .IP "-1"
X  List files one per line instead of in columns.
X  .SH DIAGNOSTICS
X! The "only" options can not be combined at this time.
X  .PP
X  The spell checking does not work when the CDPATH is searched for a
X  file or directory not found in the current directory.
X--- 127,133 ----
X  .IP "-1"
X  List files one per line instead of in columns.
X  .SH DIAGNOSTICS
X! The "only" options can be combined.
X  .PP
X  The spell checking does not work when the CDPATH is searched for a
X  file or directory not found in the current directory.
X***************
X*** 142,147 ****
X  .SH AUTHOR
X  Kent Landfield <kent at sparky.IMD.Sterling.COM>
X  .SH CREDITS
X! Jeff Minnig <jeff at dsndata> and Rick Ohnemus <rick at sparky.IMD.Sterling.COM> 
X! were a *great* help with this program at different stages of its development...
X! Thanks!
X--- 142,160 ----
X  .SH AUTHOR
X  Kent Landfield <kent at sparky.IMD.Sterling.COM>
X  .SH CREDITS
X! 
X! .nr
X! Jeff Minnig <jeff at dsndata>, 
X! .nf
X! .nr
X! Rick Ohnemus <rick at sparky.IMD.Sterling.COM>, 
X! .nf
X! .nr
X! Mike Peterson <root at alchemy.chem.utoronto.ca> and
X! .nf
X! .nr
X! Ivan Fris <neumann.une.oz.au!ivan> 
X! .nf
X! .nf
X! were a *great* help with this program at different stages 
X! of its development...  Thanks!
Xdiff -c ../lc.old/lc.c ./lc.c
X*** ../lc.old/lc.c	Tue Jan  8 21:23:31 1991
X--- ./lc.c	Tue Jan  8 21:20:38 1991
X***************
X*** 48,54 ****
X  **               -l      Mark symbolic links with '@'
X  **               -I      Suppress unresolved symbolic link messages.
X  **
X! ** The "only" options can not be combined.
X  ** If there is no 'directory' specified, the current directory is used.
X  ** Not all options are supported on every system. (e.g. no symbolic links
X  ** on your system ? Options -s, -L or -l won't be available..)
X--- 48,54 ----
X  **               -l      Mark symbolic links with '@'
X  **               -I      Suppress unresolved symbolic link messages.
X  **
X! ** The "only" options can be combined.
X  ** If there is no 'directory' specified, the current directory is used.
X  ** Not all options are supported on every system. (e.g. no symbolic links
X  ** on your system ? Options -s, -L or -l won't be available..)
X***************
X*** 70,79 ****
X  **      Tested with AmigaDOS 1.3 on an Amiga 1000 in 1989.
X  **      Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
X  **      Tested with AIX 3.+ on a Risc System/6000 in 1990. 
X  **                                                               
X  */
X  #ifndef lint
X! static char *sccsid = "@(#)lc.c	1.23 9/7/90  Kent Landfield";
X  #endif
X  
X  #include <stdio.h>
X--- 70,80 ----
X  **      Tested with AmigaDOS 1.3 on an Amiga 1000 in 1989.
X  **      Tested with SunOS 4.0.3 on a Sparkstation 1 in 1989.
X  **      Tested with AIX 3.+ on a Risc System/6000 in 1990. 
X+ **      Ivan Fris added the ability to combine "only" options.
X  **                                                               
X  */
X  #ifndef lint
X! static char *sccsid = "@(#)lc.c	1.25 1/2/91  Kent Landfield";
X  #endif
X  
X  #include <stdio.h>
X***************
X*** 143,168 ****
X  #  define S_IXOTH       (S_IEXEC >> 6)
X  #endif
X  
X! #define DIR_ONLY        1
X! #define FILE_ONLY       2
X  #ifdef S_IFCHR
X! #  define CHAR_ONLY     3
X  #endif
X  #ifdef S_IFBLK
X! #  define BLOCK_ONLY    4
X  #endif
X  #ifdef S_IFIFO
X! #  define FIFO_ONLY     5
X  #endif
X  #ifdef S_IFLNK
X! #  define LNK_ONLY      6
X  #endif
X  #ifdef S_IFSOCK
X! #  define SOCK_ONLY     7
X  #endif
X  #ifdef S_IFNAM
X! #  define SEM_ONLY      8
X! #  define SD_ONLY       9
X  #endif
X  
X  #ifdef BSD
X--- 144,169 ----
X  #  define S_IXOTH       (S_IEXEC >> 6)
X  #endif
X  
X! #define DIR_ONLY        1<<0
X! #define FILE_ONLY       1<<2
X  #ifdef S_IFCHR
X! #  define CHAR_ONLY     1<<3
X  #endif
X  #ifdef S_IFBLK
X! #  define BLOCK_ONLY    1<<4
X  #endif
X  #ifdef S_IFIFO
X! #  define FIFO_ONLY     1<<5
X  #endif
X  #ifdef S_IFLNK
X! #  define LNK_ONLY      1<<6
X  #endif
X  #ifdef S_IFSOCK
X! #  define SOCK_ONLY     1<<7
X  #endif
X  #ifdef S_IFNAM
X! #  define SEM_ONLY      1<<8
X! #  define SD_ONLY       1<<9
X  #endif
X  
X  #ifdef BSD
X***************
X*** 499,504 ****
X--- 500,508 ----
X                ind++;
X           }
X           *frmt = '\0';
X+          while (*--frmt == ' ')  /* strip trailing blanks */
X+              *frmt = '\0';
X+         
X           (void) puts(out_str);
X      }
X      return (ind);
X***************
X*** 576,582 ****
X  
X      Current = 0;
X  
X!     if (Lnks.num > 0 && (Disp_links == TRUE || Only == LNK_ONLY)) {
X          ssing = Single;
X          Single = TRUE;
X          Current = LNK_ONLY;
X--- 580,586 ----
X  
X      Current = 0;
X  
X!     if (Lnks.num > 0 && (Disp_links == TRUE || Only & LNK_ONLY)) {
X          ssing = Single;
X          Single = TRUE;
X          Current = LNK_ONLY;
X***************
X*** 586,622 ****
X  #endif
X  
X  #ifdef S_IFSOCK
X!     if (Socks.num > 0 && (Only == 0 || Only == SOCK_ONLY))
X          flag = pr_info("Sockets: ", &Socks, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFNAM
X!     if (Sems.num > 0 && (Only == 0 || Only == SEM_ONLY))
X          flag = pr_info("Semaphore Files: ", &Sems, flag, Sort_wanted);
X  
X!     if (Sds.num > 0 && (Only == 0 || Only == SD_ONLY))
X          flag = pr_info("Shared Data Files: ", &Sds, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFIFO
X!     if (Fifos.num > 0 && (Only == 0 || Only == FIFO_ONLY))
X          flag = pr_info("Fifo Files: ", &Fifos, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFCHR
X!     if (Chrs.num > 0 && (Only == 0 || Only == CHAR_ONLY))
X          flag = pr_info("Character Special Files: ", &Chrs, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFBLK
X!     if (Blks.num > 0 && (Only == 0 || Only == BLOCK_ONLY))
X          flag = pr_info("Block Special Files: ", &Blks, flag, Sort_wanted);
X  #endif
X  
X!     if (Dirs.num > 0 && (Only == 0 || Only == DIR_ONLY))
X          flag = pr_info("Directories: ", &Dirs, flag, Sort_wanted);
X  
X!     if (Fls.num > 0 && (Only == 0 || Only == FILE_ONLY))
X          flag = pr_info("Files: ", &Fls, flag, Sort_wanted);
X  
X      return;
X--- 590,626 ----
X  #endif
X  
X  #ifdef S_IFSOCK
X!     if (Socks.num > 0 && (Only == 0 || Only & SOCK_ONLY))
X          flag = pr_info("Sockets: ", &Socks, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFNAM
X!     if (Sems.num > 0 && (Only == 0 || Only & SEM_ONLY))
X          flag = pr_info("Semaphore Files: ", &Sems, flag, Sort_wanted);
X  
X!     if (Sds.num > 0 && (Only == 0 || Only & SD_ONLY))
X          flag = pr_info("Shared Data Files: ", &Sds, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFIFO
X!     if (Fifos.num > 0 && (Only == 0 || Only & FIFO_ONLY))
X          flag = pr_info("Fifo Files: ", &Fifos, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFCHR
X!     if (Chrs.num > 0 && (Only == 0 || Only & CHAR_ONLY))
X          flag = pr_info("Character Special Files: ", &Chrs, flag, Sort_wanted);
X  #endif
X  
X  #ifdef S_IFBLK
X!     if (Blks.num > 0 && (Only == 0 || Only & BLOCK_ONLY))
X          flag = pr_info("Block Special Files: ", &Blks, flag, Sort_wanted);
X  #endif
X  
X!     if (Dirs.num > 0 && (Only == 0 || Only & DIR_ONLY))
X          flag = pr_info("Directories: ", &Dirs, flag, Sort_wanted);
X  
X!     if (Fls.num > 0 && (Only == 0 || Only & FILE_ONLY))
X          flag = pr_info("Files: ", &Fls, flag, Sort_wanted);
X  
X      return;
X***************
X*** 976,990 ****
X          break;
X  
X      case 'b':
X!         Only = BLOCK_ONLY;
X          break;
X  
X      case 'c':
X!         Only = CHAR_ONLY;
X          break;
X  
X      case 'd':
X!         Only = DIR_ONLY;
X          break;
X  
X      case 'D':
X--- 980,994 ----
X          break;
X  
X      case 'b':
X!         Only |= BLOCK_ONLY;
X          break;
X  
X      case 'c':
X!         Only |= CHAR_ONLY;
X          break;
X  
X      case 'd':
X!         Only |= DIR_ONLY;
X          break;
X  
X      case 'D':
X***************
X*** 996,1002 ****
X          break;
X  
X      case 'f':
X!         Only = FILE_ONLY;
X          break;
X  
X      case 'r':
X--- 1000,1006 ----
X          break;
X  
X      case 'f':
X!         Only |= FILE_ONLY;
X          break;
X  
X      case 'r':
X***************
X*** 1005,1011 ****
X  
X  #ifdef S_IFIFO
X      case 'F':
X!         Only = FIFO_ONLY;
X          break;
X  #endif
X  
X--- 1009,1015 ----
X  
X  #ifdef S_IFIFO
X      case 'F':
X!         Only |= FIFO_ONLY;
X          break;
X  #endif
X  
X***************
X*** 1015,1021 ****
X  
X  #ifdef S_IFLNK
X      case 's':
X!         Only = LNK_ONLY;
X          break;
X  
X      case 'l':
X--- 1019,1025 ----
X  
X  #ifdef S_IFLNK
X      case 's':
X!         Only |= LNK_ONLY;
X          break;
X  
X      case 'l':
X***************
X*** 1033,1049 ****
X  
X  #ifdef S_IFSOCK
X      case 'S':
X!         Only = SOCK_ONLY;
X          break;
X  #endif
X  
X  #ifdef S_IFNAM
X      case 'm':
X!         Only = SD_ONLY;
X          break;
X  
X      case 'M':
X!         Only = SEM_ONLY;
X          break;
X  #endif
X  
X--- 1037,1053 ----
X  
X  #ifdef S_IFSOCK
X      case 'S':
X!         Only |= SOCK_ONLY;
X          break;
X  #endif
X  
X  #ifdef S_IFNAM
X      case 'm':
X!         Only |= SD_ONLY;
X          break;
X  
X      case 'M':
X!         Only |= SEM_ONLY;
X          break;
X  #endif
X  
END_OF_FILE
if test 15399 -ne `wc -c <'lc.patch'`; then
    echo shar: \"'lc.patch'\" unpacked with wrong size!
fi
# end of 'lc.patch'
fi
echo shar: End of shell archive.
exit 0
-- 
Kent Landfield                   INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.



More information about the Comp.sources.misc mailing list