Annotation of 42BSD/usr.bin/refer/shell.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char *sccsid = "@(#)shell.c     4.1 (Berkeley) 5/6/83";
                      3: #endif
                      4: /*
                      5:  * SORTS UP.
                      6:  * IF THERE ARE NO EXCHANGES (IEX=0) ON A SWEEP
                      7:  * THE COMPARISON GAP (IGAP) IS HALVED FOR THE NEXT SWEEP
                      8:  */
                      9: shell (n, comp, exch)
                     10: int (*comp)(), (*exch)();
                     11: {
                     12:        int igap, iplusg, iex, i, imax;
                     13:        igap=n;
                     14:        while (igap > 1)
                     15:        {
                     16:                igap /= 2;
                     17:                imax = n-igap;
                     18:                do
                     19:                    {
                     20:                        iex=0;
                     21:                        for(i=0; i<imax; i++)
                     22:                        {
                     23:                                iplusg = i + igap;
                     24:                                if ((*comp) (i, iplusg) ) continue;
                     25:                                (*exch) (i, iplusg);
                     26:                                iex=1;
                     27:                        }
                     28:                } 
                     29:                while (iex>0);
                     30:        }
                     31: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.