#include <string.h>
#include <process.h>

#include "extern.h"

extern int errno;

exeforward()

    {  
		int ret;
	   char port[2];	
	   fpw = fopen(BBSMAS,"r");
       while(1)
         {   if ( fgets(fbuff,255,fpw) == NULL ) break;
             if ( strncmp(hiscall,fbuff,8) != NULL ) continue;
             fclose(fpw);
			 sprintf(port,"%d",devdrv);
			 ret = spawnlp(P_WAIT,"forward.exe","forward",port,hiscall,NULL);
			 if ( ret > 0 )
				{ printf("\n\n 相手BBS接続失敗 %s\n\n",hiscall);
				  return(1);
				}				
			 if ( ret )
				{ printf("forward start err %d %d\n",ret,errno); return(-1); }
             return(-2);
         }
       fclose(fpw);
    return(0);
    }

