/***************************************************************************
 *                                                                         *
 *   SORTSTGS.C                                                            *
 *                                                                         *
 *   Copyright (c) 1992-1997 Galacticomm, Inc.    All Rights Reserved.     *
 *                                                                         *
 *   This is the library function to do a simple sort on an array of       *
 *   strings.                                                              *
 *                                                                         *
 *                                             - Chris Robert 03/16/92     *
 *                                                                         *
 ***************************************************************************/

#include "gcomm.h"

#define FILREV "$Revision: 4 $"

VOID
sortstgs(                          /* quick shell-sort of strings          */
CHAR *stgs[],                      /*   array of strings to sort           */
INT num)                           /*   number of strings to sort          */
{
     CHAR *hold;
     INT mid,i,j;

     for (mid=num/2 ; mid > 0 ; mid=mid/2) {
          for (i=mid ; i < num ; i++) {
               for (j=i-mid ; j >= 0 ; j -=mid) {
                    if (strcmp(stgs[j],stgs[j+mid]) <= 0) {
                         break;
                    }
                    hold=stgs[j];
                    stgs[j]=stgs[j+mid];
                    stgs[j+mid]=hold;
               }
          }
     }
}
