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: }

Defined functions

main defined in line 17; never used
newbuf defined in line 46; used 2 times

Defined variables

flipflop defined in line 14; used 3 times
ping defined in line 11; used 3 times
pong defined in line 12; used 3 times
size defined in line 15; used 3 times

Defined macros

MAXSIZE defined in line 9; used 3 times
Last modified: 1986-03-28
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1200
Valid CSS Valid XHTML 1.0 Strict