1: #include "parms.h"
   2: #include "structs.h"
   3: 
   4: #ifdef  RCSIDENT
   5: static char rcsid[] = "$Header: pattern.c,v 1.7 85/01/18 15:34:07 notes Rel $";
   6: #endif	RCSIDENT
   7: 
   8: /*
   9:  *	dopat - matches notesfile names and calls the desired routine with
  10:  *	each matched arguement!
  11:  *
  12:  *	Ray Essick			Feb 25, 1982
  13:  */
  14: 
  15: FILE * popen ();                    /* declare the function! */
  16: 
  17: dopat (p, what)
  18: char   *p;                      /* the pattern to match */
  19: int     (*what) ();                 /* routine to be called */
  20: {
  21:     char    cmd[CMDLEN];
  22:     int     c,
  23:             i;
  24:     FILE * zfile;
  25: 
  26:     sprintf (cmd, "(cd %s;echo %s)", Mstdir, p);
  27:     zfile = popen (cmd, "r");               /* read the output */
  28:     if (zfile == (FILE *) NULL)
  29:     return (0);                 /* failed somewhere */
  30:                             /* pseudo-failure */
  31: 
  32:     do
  33:     {
  34:     i = 0;
  35:     while ((c = getc (zfile)) != ' ' && (c != '\n') && (c != EOF))
  36:         cmd[i++] = c;
  37:     if (i == 0)
  38:         break;
  39:     cmd[i++] = '\0';
  40:     i = (*what) (cmd);              /* call his routine for him */
  41:     } while ((c != EOF) && (i != QUITFAST) && (i != QUITUPD));
  42:     pclose (zfile);                 /* close that pipe! */
  43: 
  44:     return i;                       /* return the return code */
  45: }

Defined functions

dopat defined in line 17; used 2 times

Defined variables

rcsid defined in line 5; never used
Last modified: 1985-10-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 856
Valid CSS Valid XHTML 1.0 Strict