| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | gpmain.c -- general purpose main program
|
|---|
| 4 | Version 1 -- 1987-10-14 -- D.N. Lynx Crowe
|
|---|
| 5 | =============================================================================
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "stddefs.h"
|
|---|
| 9 |
|
|---|
| 10 | extern int gp_init(); /* application initialization */
|
|---|
| 11 |
|
|---|
| 12 | int (*gp_clin)(), /* command line processor */
|
|---|
| 13 | (*gp_btch)(), /* batch processor */
|
|---|
| 14 | (*gp_intr)(), /* interactive processor */
|
|---|
| 15 | (*gp_exit)(); /* exit processor */
|
|---|
| 16 |
|
|---|
| 17 | /* |
|---|
| 18 |
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | /*
|
|---|
| 22 | =============================================================================
|
|---|
| 23 | gp_null() -- null SUCCESS function
|
|---|
| 24 | =============================================================================
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | int
|
|---|
| 28 | gp_null()
|
|---|
| 29 | {
|
|---|
| 30 | return(SUCCESS); /* return a SUCCESS response */
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | /*
|
|---|
| 34 | =============================================================================
|
|---|
| 35 | gp_fail() -- null FAILURE function
|
|---|
| 36 | =============================================================================
|
|---|
| 37 | */
|
|---|
| 38 |
|
|---|
| 39 | int
|
|---|
| 40 | gp_fail()
|
|---|
| 41 | {
|
|---|
| 42 | return(FAILURE); /* return a FAILURE response */
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | /*
|
|---|
| 46 | =============================================================================
|
|---|
| 47 | gp_pass() -- null argument pass function
|
|---|
| 48 | =============================================================================
|
|---|
| 49 | */
|
|---|
| 50 |
|
|---|
| 51 | int
|
|---|
| 52 | gp_pass(arg)
|
|---|
| 53 | int arg;
|
|---|
| 54 | {
|
|---|
| 55 | return(arg); /* just pass along the input argument */
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | /* |
|---|
| 59 |
|
|---|
| 60 | */
|
|---|
| 61 |
|
|---|
| 62 | /*
|
|---|
| 63 | =============================================================================
|
|---|
| 64 | gp_main() -- general purpose main program driver
|
|---|
| 65 | =============================================================================
|
|---|
| 66 | */
|
|---|
| 67 |
|
|---|
| 68 | gp_main(argc, argv)
|
|---|
| 69 | int argc;
|
|---|
| 70 | char *argv[];
|
|---|
| 71 | {
|
|---|
| 72 | register int rc; /* return code */
|
|---|
| 73 |
|
|---|
| 74 | gp_clin = gp_null; /* initialize pointers to functions */
|
|---|
| 75 | gp_btch = gp_null;
|
|---|
| 76 | gp_intr = gp_null;
|
|---|
| 77 | gp_exit = gp_pass;
|
|---|
| 78 |
|
|---|
| 79 | if (rc = gp_init(argc, argv)) /* application initialization */
|
|---|
| 80 | exit(rc);
|
|---|
| 81 |
|
|---|
| 82 | if ((*gp_clin)(argc, argv)) /* command line processing */
|
|---|
| 83 | rc = (*gp_btch)(argc, argv); /* batch processing */
|
|---|
| 84 | else
|
|---|
| 85 | rc = (*gp_intr)(argc, argv); /* interactive processing */
|
|---|
| 86 |
|
|---|
| 87 | rc = (*gp_exit)(rc); /* exit processing */
|
|---|
| 88 |
|
|---|
| 89 | exit(rc); /* exit back to system */
|
|---|
| 90 | }
|
|---|