home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / lc / patch01 < prev    next >
Encoding:
Text File  |  1992-08-21  |  11.1 KB  |  408 lines

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