home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sources / misc / 3819 < prev    next >
Encoding:
Text File  |  1992-08-20  |  11.3 KB  |  413 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: kent@sparky.sterling.com (Kent Landfield)
  4. Subject:  v31i090:  lc - Categorize and List Files In Columns, Patch01
  5. Message-ID: <1992Aug20.165246.22059@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: fdc7d37c4f6af7e179ff93a9a695cc40
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. Date: Thu, 20 Aug 1992 16:52:46 GMT
  11. Approved: kent@sparky.imd.sterling.com
  12. Lines: 399
  13.  
  14. Submitted-by: kent@sparky.sterling.com (Kent Landfield)
  15. Posting-number: Volume 31, Issue 90
  16. Archive-name: lc/patch01
  17. Environment: UNIX, AmigaDOS, MINIX, Coherent, Cray
  18. Patch-To: lc: Volume 31, Issue 72-73
  19.  
  20. This patch to lc fixes two symbolic link problems that I let slip in, cleans
  21. up compilation on a couple platforms and cleans up the makefile a bit.
  22.  
  23. lc is much like the ls command except it separates the types of files into 
  24. groups and then displays located filenames to the user is a columnar fashion. 
  25. lc has incorporated minimal spell checking and transparently uses CDPATH to
  26. locate requested files that are not at the specified location or within the
  27. local directory. 
  28.  
  29. I'd like to publically thank those who contributed to this patch.
  30.  
  31.     James Cummings <james@homey.lonestar.org>
  32.         Randy Coulman <coulman@skdad.usask.ca>
  33.         Al Lilianstrom <alfredl@dcdsv0.fnal.gov>
  34.         Bjorn Nordgren <bcn@lulea.trab.se>
  35.         Marty Leisner <leisner@eso.mc.xerox.com>
  36.         Jeff Minnig <dsndata!jeff@sparky.sterling.com>
  37.  
  38. I would also like to thank Scott Bolte <scott@craycos.com> who took me up
  39. on my request to port lc to a Cray.   Thanks all!
  40.  
  41.             -Kent+
  42. --------------
  43. diff -cr ../lc2.0/History ./History
  44. *** ../lc2.0/History    Thu Aug 20 11:21:46 1992
  45. --- ./History    Thu Aug 20 10:45:27 1992
  46. ***************
  47. *** 1,5 ****
  48.   #
  49. ! # @(#)History    1.2 8/6/92
  50.   #
  51.   #  This file is a running history of the lc command.
  52.   #
  53. --- 1,5 ----
  54.   #
  55. ! # @(#)History    1.3 8/20/92
  56.   #
  57.   #  This file is a running history of the lc command.
  58.   #
  59. ***************
  60. *** 56,58 ****
  61. --- 56,60 ----
  62.             added the ability to display file which are inaccessible,
  63.             added the ability to display only those files accessible by the user,
  64.             added spell checking to the CDPATH.  Fantastic additions Jonathan!!
  65. +       - Scott Bolte ported it to a Cray running CSOS.  
  66. diff -cr ../lc2.0/lc.1 ./lc.1
  67. *** ../lc2.0/lc.1    Thu Aug 20 11:21:46 1992
  68. --- ./lc.1    Thu Aug 20 10:45:25 1992
  69. ***************
  70. *** 1,4 ****
  71. ! .\" @(#)lc.1    1.7 8/7/92 Kent Landfield;
  72.   .TH LC 1 "Usenet Source"
  73.   .SH NAME
  74.   .B lc 
  75. --- 1,4 ----
  76. ! .\" @(#)lc.1    1.8 8/20/92 Kent Landfield;
  77.   .TH LC 1 "Usenet Source"
  78.   .SH NAME
  79.   .B lc 
  80. ***************
  81. *** 170,172 ****
  82. --- 170,174 ----
  83.   .PP
  84.   Jonathan Bayer <jbayer@ispi.com> added several features, including the 
  85.   options -C -i -x -X and added spell checking to CDPATH usage.  Thanks Jonathan!
  86. + .PP
  87. + Scott Bolte <scott@craycos.com> ported lc to a Cray running CSOS. 
  88. diff -cr ../lc2.0/lc.c ./lc.c
  89. *** ../lc2.0/lc.c    Thu Aug 20 11:21:51 1992
  90. --- ./lc.c    Thu Aug 20 10:45:27 1992
  91. ***************
  92. *** 62,68 ****
  93.   ** on your system ? Options -s, -L or -l won't be available..)
  94.   **
  95.   */
  96. ! static char *sccsid = "@(#)lc.c    1.34 8/7/92  Kent Landfield";
  97.   #include "patchlevel.h"
  98.   
  99.   #include <stdio.h>
  100. --- 62,68 ----
  101.   ** on your system ? Options -s, -L or -l won't be available..)
  102.   **
  103.   */
  104. ! static char *sccsid = "@(#)lc.c    1.35 8/20/92 Kent Landfield";
  105.   #include "patchlevel.h"
  106.   
  107.   #include <stdio.h>
  108. ***************
  109. *** 285,301 ****
  110. --- 285,312 ----
  111.       extern int  geteuid();
  112.       extern int  getegid();
  113.   # else
  114. + #  ifndef _STDIO_H
  115.       extern int  sprintf();
  116. + #  endif
  117.       extern void free();
  118.       extern void qsort();
  119. + #  ifdef SYSV
  120. +     extern unsigned short getuid();
  121. +     extern unsigned short geteuid();
  122. +     extern unsigned short getgid();
  123. +     extern unsigned short getegid();
  124. + #  else /*!SYSV*/
  125.       extern uid_t getuid();
  126.       extern uid_t geteuid();
  127.       extern gid_t getgid();
  128.       extern gid_t getegid();
  129. + #  endif
  130.   # endif
  131. + # ifndef _STDIO_H
  132.    extern int fprintf();
  133.    extern int printf();
  134.    extern int sscanf();
  135. + # endif
  136.   #endif
  137.   
  138.   void lc();
  139. ***************
  140. *** 502,508 ****
  141.            prt_limit = (Screen_width - 4) / (Maxlen + 1);
  142.   
  143.            /*  sort by columns */
  144. ! #ifdef LNK_ONLY
  145.            if (Sort_down && Current != LNK_ONLY) {
  146.   #else       
  147.            if (Sort_down) {
  148. --- 513,519 ----
  149.            prt_limit = (Screen_width - 4) / (Maxlen + 1);
  150.   
  151.            /*  sort by columns */
  152. ! #ifdef S_IFLNK
  153.            if (Sort_down && Current != LNK_ONLY) {
  154.   #else       
  155.            if (Sort_down) {
  156. ***************
  157. *** 525,531 ****
  158.                          *frmt++ = *(*(files->names + ind) + i);
  159.                      i++;
  160.                 } while (i <= Maxlen);
  161. ! #ifdef LNK_ONLY
  162.                 if (Sort_down && Current != LNK_ONLY)
  163.   #else       
  164.                 if (Sort_down)
  165. --- 536,542 ----
  166.                          *frmt++ = *(*(files->names + ind) + i);
  167.                      i++;
  168.                 } while (i <= Maxlen);
  169. ! #ifdef S_IFLNK
  170.                 if (Sort_down && Current != LNK_ONLY)
  171.   #else       
  172.                 if (Sort_down)
  173. ***************
  174. *** 596,602 ****
  175.   
  176.       /* sort by columns */
  177.       Maxlen++; /* this is to force an extra space between columns */
  178. ! #ifdef LNK_ONLY
  179.       if (Sort_down && Current != LNK_ONLY) {
  180.   #else
  181.       if (Sort_down) {
  182. --- 607,613 ----
  183.   
  184.       /* sort by columns */
  185.       Maxlen++; /* this is to force an extra space between columns */
  186. ! #ifdef S_IFLNK
  187.       if (Sort_down && Current != LNK_ONLY) {
  188.   #else
  189.       if (Sort_down) {
  190. ***************
  191. *** 639,649 ****
  192.           ssing = Single;
  193.           Single = TRUE;
  194.           Current = LNK_ONLY;
  195. ! #ifdef NOTDEF
  196. !         flag = pr_info("Symbolic Links: ", &Lnks, flag, 0);
  197. ! #else
  198. !         flag = pr_info("Symbolic Links: ", &Lnks, flag, Sort_wanted);
  199. ! #endif
  200.           Single = ssing;
  201.           Current = 0;
  202.       }
  203. --- 650,656 ----
  204.           ssing = Single;
  205.           Single = TRUE;
  206.           Current = LNK_ONLY;
  207. !         flag = pr_info("Symbolic Links: ", &Lnks, flag, FALSE);
  208.           Single = ssing;
  209.           Current = 0;
  210.       }
  211. ***************
  212. *** 1574,1580 ****
  213.           (void) strcpy(buf, *argv);
  214.   skipit:
  215.   #ifdef S_IFLNK
  216. -         lnk_found = 0;
  217.           if (lstat(buf, &sbuf) == -1) {
  218.               lnk_found = 1;
  219.   #else
  220. --- 1581,1586 ----
  221. ***************
  222. *** 1593,1603 ****
  223.                   nl = TRUE;
  224.                   goto skipit;
  225.               }
  226. - #ifdef S_IFLNK
  227. -             else if (lnk_found) 
  228. -                 (void) fprintf(stderr,"%s: %s: can't resolve symbolic link\n",
  229. -                                Progname, *argv);
  230. - #endif 
  231.               else 
  232.                   (void)fprintf(stderr, "%s: can't find %s\n",
  233.                                 Progname, *argv);
  234. --- 1599,1604 ----
  235. diff -cr ../lc2.0/lc.mk ./lc.mk
  236. *** ../lc2.0/lc.mk    Thu Aug 20 11:21:47 1992
  237. --- ./lc.mk    Thu Aug 20 10:45:24 1992
  238. ***************
  239. *** 1,5 ****
  240.   #
  241. ! #    "@(#)lc.mk    1.10 8/6/92 
  242.   #
  243.   #  Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990,
  244.   #                1991, 1992 by Kent Landfield.
  245. --- 1,5 ----
  246.   #
  247. ! #    "@(#)lc.mk    1.11 8/20/92 
  248.   #
  249.   #  Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990,
  250.   #                1991, 1992 by Kent Landfield.
  251. ***************
  252. *** 12,26 ****
  253.   #  Have a favorite C compiler that is not cc... Too bad. ;-)
  254.   CC=cc
  255.   #CC=gcc
  256. ! #
  257.   # Specify the multiple of 512 that your du(1) reports blocksizes System V 
  258.   # du(1) gives the number of 512 byte blocks while BSD specifies kilobytes.
  259.   #RPTSIZ = -DBLK_MULTIPLE=1
  260.   RPTSIZ = -DBLK_MULTIPLE=2
  261.   
  262.   # If you want to specify the block size here uncomment the following line:
  263.   #BLKSIZE = -DBLOCKSIZE=512
  264. ! #
  265.   # If you are running on a BSD 4.2 box:
  266.   # (note - if compiling on a sequent in att environment...`ucb make -f lc.mk`)
  267.   # FLAGS = -DBSD -DDIRECT
  268. --- 12,32 ----
  269.   #  Have a favorite C compiler that is not cc... Too bad. ;-)
  270.   CC=cc
  271.   #CC=gcc
  272. ! # The number of columns displayed is be computed on a file type basis or by 
  273. ! # the length of the longest element in any type category. By defining the
  274. ! # LENS flag, the computation will be type independent.
  275. ! LENGTH=-DLENS
  276.   # Specify the multiple of 512 that your du(1) reports blocksizes System V 
  277.   # du(1) gives the number of 512 byte blocks while BSD specifies kilobytes.
  278.   #RPTSIZ = -DBLK_MULTIPLE=1
  279.   RPTSIZ = -DBLK_MULTIPLE=2
  280. + #RPTSIZ = -DBLK_MULTIPLE=8
  281.   
  282.   # If you want to specify the block size here uncomment the following line:
  283.   #BLKSIZE = -DBLOCKSIZE=512
  284.   # If you are running on a BSD 4.2 box:
  285.   # (note - if compiling on a sequent in att environment...`ucb make -f lc.mk`)
  286.   # FLAGS = -DBSD -DDIRECT
  287. ***************
  288. *** 27,38 ****
  289.   #         or
  290.   #
  291.   # If you are running on a BSD (4.3 or later), SunOS (4.0 or later),
  292. ! # or Ultrix (3.0 or later) box:
  293. ! FLAGS = -DBSD -DLENS
  294. ! #
  295. ! # FLAGS = -DBSD
  296.   #         or
  297.   #
  298.   # If you are running on an Ultrix box and using the POSIX environment:
  299.   # FLAGS = -DPOSIX
  300.   #         or
  301. --- 33,48 ----
  302.   #         or
  303.   #
  304.   # If you are running on a BSD (4.3 or later), SunOS (4.0 or later),
  305. ! # HPUX or Ultrix (3.0 or later) box:
  306. ! FLAGS = -DBSD
  307.   #         or
  308.   #
  309. + # If you are running Silicon Graphics such as the SGI Personal Iris:
  310. + # FLAGS = -DPOSIX -cckr
  311. + #
  312. + # If you are running on a Cray under CSOS: (and set RPTSIZ to 8)
  313. + # FLAGS = -DPOSIX
  314. + #
  315.   # If you are running on an Ultrix box and using the POSIX environment:
  316.   # FLAGS = -DPOSIX
  317.   #         or
  318. ***************
  319. *** 52,58 ****
  320.   #         or
  321.   #
  322.   # If you are running System V with Doug Gwyn's directory routines
  323. ! # or Silicon Graphics or Utek 3.2d:
  324.   # FLAGS = -DPOSIX
  325.   # 
  326.   #
  327. --- 62,68 ----
  328.   #         or
  329.   #
  330.   # If you are running System V with Doug Gwyn's directory routines
  331. ! # or Utek 3.2d:
  332.   # FLAGS = -DPOSIX
  333.   # 
  334.   #
  335. ***************
  336. *** 67,83 ****
  337.   # LDFLAGS = -lndir
  338.   # LDFLAGS = -lc_s
  339.   LDFLAGS = 
  340.   #
  341.   # 'qsort' function in C library
  342.   # QSORTO =
  343.   # QSORTC =
  344.   #
  345. ! # 'qsort' function not in C library Or Your qsort library
  346.   # function is slooow.
  347.   #
  348.   # QSORTO = qsort.o
  349.   # QSORTC = qsort.c
  350. ! #
  351.   # Installation ownership and directory. Customize
  352.   # for your installation. Warning, if you do not
  353.   # install this on your root partition, it will
  354. --- 77,94 ----
  355.   # LDFLAGS = -lndir
  356.   # LDFLAGS = -lc_s
  357.   LDFLAGS = 
  358.   #
  359.   # 'qsort' function in C library
  360.   # QSORTO =
  361.   # QSORTC =
  362.   #
  363. ! # 'qsort' function not in C library Or your qsort library
  364.   # function is slooow.
  365.   #
  366.   # QSORTO = qsort.o
  367.   # QSORTC = qsort.c
  368.   # Installation ownership and directory. Customize
  369.   # for your installation. Warning, if you do not
  370.   # install this on your root partition, it will
  371. ***************
  372. *** 95,102 ****
  373.   OWNER=bin
  374.   GROUP=bin
  375.   
  376. ! CFLAGS = $(OPTIM) $(FLAGS) $(BLKSIZE) $(RPTSIZ)
  377. ! LINTFLAGS = $(FLAGS) $(BLKSIZE) $(RPTSIZ)
  378.   SRCS = lc.c $(QSORTC)
  379.   OBJS = lc.o $(QSORTO)
  380.   
  381. --- 106,113 ----
  382.   OWNER=bin
  383.   GROUP=bin
  384.   
  385. ! CFLAGS = $(OPTIM) $(FLAGS) $(BLKSIZE) $(RPTSIZ) $(LENGTH)
  386. ! LINTFLAGS = $(FLAGS) $(BLKSIZE) $(RPTSIZ) $(LENGTH)
  387.   SRCS = lc.c $(QSORTC)
  388.   OBJS = lc.o $(QSORTO)
  389.   
  390. diff -cr ../lc2.0/patchlevel.h ./patchlevel.h
  391. *** ../lc2.0/patchlevel.h    Thu Aug 20 11:21:48 1992
  392. --- ./patchlevel.h    Thu Aug 20 10:45:24 1992
  393. ***************
  394. *** 1,5 ****
  395.   /*
  396. ! **    @(#)patchlevel.h    1.1 8/2/92
  397.   */
  398.   #define RELEASE 2
  399. ! #define PATCHLEVEL 0
  400. --- 1,5 ----
  401.   /*
  402. ! **    @(#)patchlevel.h    1.2 8/19/92
  403.   */
  404.   #define RELEASE 2
  405. ! #define PATCHLEVEL 1
  406. exit 0 # Just in case...
  407.