[alt.sources] dls/describe patch 1

timcc@csv.viccol.edu.au (Tim Cook) (04/17/91)

Enclosed is a small patch for my dls/describe file description system.
Basically, I needed to add some sanity checks to my list manipulation
routines.

I have received many requests/suggestions for features to be added, and I
will be considering how dls can interact with the archie system and other
programs like ftpget.  Trust me, I will be working on dls/describe, but I
am rather busy at the moment because I am looking for a new place to live.

By the time you read this, the version of dls/describe in
pub/dls/dls.shar.Z in admin.viccol.edu.au's Anonymous FTP area will be
updated.

*** list.c.orig	Tue Apr 16 18:28:40 1991
--- list.c	Tue Apr 16 18:28:58 1991
***************
*** 36,40 ****
   */
  
! static char rcsid[] = "$Header: list.c 1.1 91/03/27 $" ;
  
  #define _LIST_C
--- 36,40 ----
   */
  
! static char rcsid[] = "$Header: list.c 1.2 91/04/16 $" ;
  
  #define _LIST_C
***************
*** 54,59 ****
     struct list *list ;
  {
!    free (list->s_start) ;
!    list->s_start = (VOID_PTR_PTR) NULL ;
     }
  
--- 54,61 ----
     struct list *list ;
  {
!    if (list->start != (VOID_PTR_PTR) NULL
!          && list->s_start != (VOID_PTR_PTR) NULL) {
!       free (list->s_start) ;
!       list_init (list) ; }		/* May as well */
     }
  
***************
*** 93,97 ****
        return (VOID_PTR) NULL ; }
     else
!       return *list->start++ ;
     }
  
--- 95,102 ----
        return (VOID_PTR) NULL ; }
     else
!       if (list->start == (VOID_PTR_PTR) NULL)
! 	 return (VOID_PTR) NULL ;
!       else
! 	 return *list->start++ ;
     }
  
***************
*** 117,122 ****
     register unsigned int x ;
  
!    x = (unsigned int) list->end - (unsigned int) list->start ;
!    x = x / sizeof (VOID_PTR)  + 1 ;
!    qsort (list->start, x, sizeof (VOID_PTR), compare) ;
     }
--- 122,128 ----
     register unsigned int x ;
  
!    if (list->start != (VOID_PTR_PTR) NULL) {
!       x = (unsigned int) list->end - (unsigned int) list->start ;
!       x = x / sizeof (VOID_PTR) + 1 ;
!       qsort (list->start, x, sizeof (VOID_PTR), compare) ; }
     }
*** list.h.orig	Tue Apr 16 18:28:48 1991
--- list.h	Tue Apr 16 18:29:00 1991
***************
*** 4,8 ****
   * Non-profit distribution allowed.  See README for details.
   *
!  * $Header: list.h 1.1 91/03/27 $
   */
  
--- 4,8 ----
   * Non-profit distribution allowed.  See README for details.
   *
!  * $Header: list.h 1.2 91/04/16 $
   */
  
***************
*** 22,27 ****
     } ;
  
- #ifndef _LIST_C
  #define list_init(l)	((l)->start = (VOID_PTR_PTR) 0)
  extern void list_push () ;
  extern VOID_PTR list_pop () ;
--- 22,28 ----
     } ;
  
  #define list_init(l)	((l)->start = (VOID_PTR_PTR) 0)
+ 
+ #ifndef _LIST_C
  extern void list_push () ;
  extern VOID_PTR list_pop () ;
***************
*** 32,34 ****
  
  #endif	/* _LIST_H */
- 
--- 33,34 ----