home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / GENSUP / SINGLE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  965 b   |  47 lines

  1. # include <stdio.h>
  2. # include <bench.h>
  3. # include <proc.io>
  4. # include "field.h"
  5. # include "screen.h"
  6. # include "iodef.h"
  7. # include "sup.h"
  8.  
  9. #define VNULL (void (*)())0
  10.  
  11. /*
  12. * the following routine checks to see if there is only one function defined
  13. * for the current screen
  14. * if more than 1 function it returns -1 else it returns the function index
  15. */
  16. int check_single(tab, apps)
  17. struct _table *tab;
  18. # ifdef ANSI
  19. int (*apps[])(struct _table *tab, struct a_line **head, struct a_line **lptr, int table);
  20. # else
  21. int (*apps[])();
  22. # endif
  23. {
  24.     int i, func, num_apps;
  25.  
  26.     for (i = num_apps = 0, func = -1; i < 9; i++)
  27.     {
  28.         if (apps[i] != (int (*)())0)
  29.         {
  30.             num_apps++;
  31.             func = i;
  32.         }
  33.     }
  34.  
  35.     if (num_apps > 1 )
  36.         return(-1); /* more than 1 function found ! */
  37.  
  38.    /*
  39.     * Display Date & Time (if the function is defined)
  40.    */
  41.    if (tab->key_fn != VNULL && tab->extra_fn != VNULL)
  42.       (*tab->extra_fn)();
  43.  
  44.     return(func);
  45. }
  46.  
  47.