Annotation of 43BSD/contrib/emacs/shortnames/dups.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Quick and dirty program to select adjacent records that are common
                      3:  *     in the first <arg> character positions.
                      4:  *
                      5:  */
                      6:  
                      7: #include <stdio.h>
                      8: 
                      9: #define MAXSIZE 512
                     10: 
                     11: char ping[MAXSIZE];
                     12: char pong[MAXSIZE];
                     13: 
                     14: int flipflop = 0;
                     15: int size = MAXSIZE-1;
                     16: 
                     17: main (argc, argv)
                     18:      int argc;
                     19:      char *argv[];
                     20: {
                     21:     register int index;
                     22:     char *newbuf();
                     23:     
                     24:     if (argc == 2)
                     25:       {
                     26:        size = atoi (argv[1]);
                     27:       }
                     28:     while (newbuf() != NULL)
                     29:       {
                     30:        for (index=0; index < size; index++)
                     31:          {
                     32:            if (ping[index] != pong[index])
                     33:              {
                     34:                break;
                     35:              }
                     36:          }
                     37:        if (index == size)
                     38:          {
                     39:            printf ("%s\n", ping);
                     40:            printf ("%s\n", pong);
                     41:          }
                     42:       }
                     43:     return (0);
                     44: }
                     45: 
                     46: char *
                     47: newbuf ()
                     48: {
                     49:   char *bufp;
                     50: 
                     51:   if (flipflop)
                     52:     {
                     53:       bufp = ping;
                     54:       flipflop = 0;
                     55:     }
                     56:   else
                     57:     {
                     58:       bufp = pong;
                     59:       flipflop = 1;
                     60:     }
                     61:   return (gets (bufp));
                     62: }

unix.superglobalmegacorp.com

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