home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / sqdev200.zip / features / template.c < prev    next >
C/C++ Source or Header  |  1994-05-23  |  6KB  |  133 lines

  1. #define INCL_DOS
  2. #include <string.h>
  3. #include <os2.h>
  4. #include "msgapi.h"
  5. #include "sqfeat.h"
  6.  
  7. static char szAppName[]="Template";
  8.  
  9. /****************************************************************************
  10.  * FeatureInit:                                                             *
  11.  ****************************************************************************
  12.  *                                                                          *
  13.  * This is called at Squish startup, when the "Feature" line in SQUISH.CFG  *
  14.  * is processed.  This routine can be used to perform feature-specific      *
  15.  * initialization needs.                                                    *
  16.  *                                                                          *
  17.  * The only action that this function must perform is to fill out the       *
  18.  * 'feature information' structure that is passed to it by Squish.          *
  19.  * At present, the only field in this structure is the 'Config Name'        *
  20.  * option.  This can be used to register keywords for which the             *
  21.  * FeatureConfig function will be called.  This can be used to              *
  22.  * implement feature-specific keywords in the configuration file.           *
  23.  *                                                                          *
  24.  * NOTE:  External features should NOT display anything on the screen       *
  25.  * in this function.                                                        *
  26.  *                                                                          *
  27.  * A return value of 0 indicates that the feature initialized successfully. *
  28.  * A non-zero return value indicates failure and instructs Squish to        *
  29.  * terminate.                                                               *
  30.  *                                                                          *
  31.  ****************************************************************************/
  32.  
  33. word FEATENTRY _export FeatureInit(struct _feat_init far *pfi)
  34. {
  35.   /* The szConfigName field should contain a list of the keywords           *
  36.    * for which FeatureConfig should be called.  These tokens are only       *
  37.    * matched if they are the first word on a given line.  More than one     *
  38.    * token can be given, as long as a "\r" is used to separate adjacent     *
  39.    * tokens, such as "Killrcat\rKillrdog\rKillrbird".                       */
  40.  
  41.   strcpy(pfi->szConfigName, szAppName);
  42.   return 0;
  43. }
  44.  
  45.  
  46. /****************************************************************************
  47.  * FeatureConfig                                                            *
  48.  ****************************************************************************
  49.  *                                                                          *
  50.  * This function is called when Squish detects one of the specified         *
  51.  * feature configuration keywords in SQUISH.CFG.  The feature should        *
  52.  * the information on this line as required, and then return to Squish.     *
  53.  *                                                                          *
  54.  * A return value of 0 indicates success.  A non-zero return value          *
  55.  * instructs Squish to abort.                                               *
  56.  *                                                                          *
  57.  ****************************************************************************/
  58.  
  59. word FEATENTRY _export FeatureConfig(struct _feat_config far *pfc)
  60. {
  61.   char *p;
  62.  
  63.   printf("Config: got args: \"");
  64.  
  65.   for (p=pfc->ppszArgs[1]; p && *p; p++)
  66.     printf("%s ", p);
  67.  
  68.   printf("\"\n");
  69.  
  70.   return 0;
  71. }
  72.  
  73.  
  74.  
  75. /****************************************************************************
  76.  * FeatureNetMsg                                                            *
  77.  ****************************************************************************
  78.  *                                                                          *
  79.  * This function is called just before Squish packs a mesage from a         *
  80.  * netmail area.  Squish will call this function for each netmail message,  *
  81.  * regardless of the status of the MSGSENT bit, unless otherwise defined    *
  82.  * in the feature initialization structure (see FeatureInit).               *
  83.  *                                                                          *
  84.  * Information in the feat_netmsg structure describes the current message   *
  85.  * being processed, in addition to pointers to the message header, body     *
  86.  * text, and control information.                                           *
  87.  *                                                                          *
  88.  * If any special actions are necessary, the feature should fill out the    *
  89.  * ulAction field in the structure before this function terminates.         *
  90.  *                                                                          *
  91.  * A return value of 0 indicates success.  A non-zero return value          *
  92.  * instructs Squish to terminate execution.                                 *
  93.  *                                                                          *
  94.  ****************************************************************************/
  95.  
  96.  
  97. word FEATENTRY _export FeatureNetMsg(struct _feat_netmsg far *pfn)
  98. {
  99.   printf("Packed message to \"%s\"\n", pfn->pMsg->to);
  100.   return 0;
  101. }
  102.  
  103.  
  104. word FEATENTRY _export FeatureTossMsg(struct _feat_toss far *pft)
  105. {
  106.   printf("Tossed message to \"%s\"\n", pft->pMsg->to);
  107.   return 0;
  108. }
  109.  
  110.  
  111. word FEATENTRY _export FeatureScanMsg(struct _feat_scan far *pfs)
  112. {
  113.   printf("Scanned message to \"%s\"\n", pfs->pMsg->to);
  114.   return 0;
  115. }
  116.  
  117. word FEATENTRY _export FeatureTerm(struct _feat_term far *pft)
  118. {
  119.   printf("Feature termination.\n");
  120.   (void)pft;
  121.   return 0;
  122. }
  123.  
  124.  
  125. #ifdef __FLAT__
  126. void FEATENTRY _export Feature32Bit(void)
  127. #else
  128. void FEATENTRY _export Feature16Bit(void)
  129. #endif
  130. {
  131. }
  132.  
  133.