home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / PROCWRKB.ZIP / BENCH1.ZIP / GENSUP / SINGLE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-07  |  1.5 KB  |  60 lines

  1. /* ==( gensup/single.c )== */
  2. /* ----------------------------------------------- */
  3. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  4. /* Modification to this source is not supported    */
  5. /* by Vestronix Inc.                               */
  6. /*            All Rights Reserved                  */
  7. /* ----------------------------------------------- */
  8. /* Written   Nig   1-Jan-90                        */
  9. /* Modified  Nig   1-Jan-90                        */
  10. /* ----------------------------------------------- */
  11. /* %W%  (%H% %T%) */
  12.  
  13.  
  14. # include <stdio.h>
  15. # include <bench.h>
  16. # include <proc.io>
  17. # include "field.h"
  18. # include "iodef.h"
  19. # include "sup.h"
  20. # include "screen.h"
  21.  
  22. #define VNULL (void (*)())0
  23.  
  24. /*
  25. * the following routine checks to see if there is only one function defined
  26. * for the current screen
  27. * if more than 1 function it returns -1 else it returns the function index
  28. */
  29. int check_single(tab, apps)
  30. struct _table *tab;
  31. # ifdef ANSI
  32. int (*apps[])(struct _table *tab, struct a_line **head, struct a_line **lptr, int table);
  33. # else
  34. int (*apps[])();
  35. # endif
  36. {
  37.     int i, func, num_apps;
  38.  
  39.     for (i = num_apps = 0, func = -1; i < 9; i++)
  40.     {
  41.         if (apps[i] != (int (*)())0)
  42.         {
  43.             num_apps++;
  44.             func = i;
  45.         }
  46.     }
  47.  
  48.     if (num_apps > 1 )
  49.         return(-1); /* more than 1 function found ! */
  50.  
  51.    /*
  52.     * Display Date & Time (if the function is defined)
  53.    */
  54.    if (tab->key_fn != VNULL && tab->extra_fn != VNULL)
  55.       (*tab->extra_fn)();
  56.  
  57.     return(func);
  58. }
  59.  
  60.