home *** CD-ROM | disk | FTP | other *** search
- #include <windows.h>
- #include <stdio.h>
- #include <io.h> // for access()
- #include <direct.h> // for getcwd()
- #include <string.h>
-
- /*
- Skeleton for beeper program.
-
- arg1 = UP or DN
- arg2 = beeper_phone_number
- arg3 = host_code
- arg4 = ip_address
- */
-
- char szIni[256];
- char szBuf[256];
-
- int CallBeeper(int nComPort,int nBaudRate,PSTR pszMessage)
- {
- // nComPort = 1 or 2
- // nBaudRate = 0=2400, 1=9600, 2=19200, 3=38400
- // pszMessage = "ATDTnumber,,,,code#"
-
-
- return TRUE;
- }
-
- int SetupBeeper(PSTR pszPhoneNumber,PSTR pszCode,int bDown,PSTR pszAddress)
- {
- // if you have an ALPHA pager it is possible to create a full
- // alpha text message and send to the pager. you have to add in
- // all the DDE or OLE stuff.
- char szBeepString[150];
- char szBeeperNumber[40];
- char szBeeperMessage[80];
- int nComPort;
- int nBaudRate;
-
- /*
- if(GetPrivateProfileInt("OPTS","BEEP_ENABLE",0,szIni)==0)
- return FALSE;
- */
-
- GetPrivateProfileString("OPTS","BEEP_STRING","ATDT%s,,,,,%s#",
- szBeepString,70,szIni);
- nComPort=GetPrivateProfileInt("OPTS","BEEP_PORT",1,szIni);
- nBaudRate=GetPrivateProfileInt("OPTS","BEEP_BAUD",1,szIni);
- if(!pszPhoneNumber || strlen(pszPhoneNumber)<4)
- GetPrivateProfileString("OPTS","BEEP_NUMBER","",
- szBeeperNumber,20,szIni);
- else
- strcpy(szBeeperNumber,pszPhoneNumber);
- wsprintf(szBuf,"%s%s",
- (LPSTR)((bDown==0) ? "000" : "999"),(LPSTR)pszCode);
- wsprintf(szBeeperMessage,szBeepString,
- (LPSTR)szBeeperNumber,(LPSTR)szBuf);
- return (CallBeeper(nComPort,nBaudRate,szBeeperMessage));
- }
-
- int main(int argc,char *argv[])
- {
- FILE *fp;
- int i;
-
- if((fp=fopen("logfile.out","a"))!=NULL)
- {
- for(i=0;i<argc;i++)
- fprintf(fp,"%u: %s ",i,argv[i]);
- fputs("\n",fp);
- fclose(fp);
- }
-
- if(access("ws_watch.ini",0)==0)
- wsprintf(szIni,"%s\\ws_watch.ini",(LPSTR)getcwd(szBuf,200));
- else
- strcpy(szIni,"ws_watch.ini");
-
- SetupBeeper(argv[2],argv[3],strcmp(argv[1],"DN"),argv[4]);
- return 0;
- }
-
-