steve@wildcat.UUCP (Steve Holland) (01/28/91)
Here is another method for UUCP-Amiga auto-redial. This is a
small program (source) which does NOT require modifications to uucico. It
does not use the UUCP.lib, but it works fine. It has been
tested with UUCP 1.05D.
To use it, simply specify on its command line the system name(s) you
want it to dial. It supports multiple systems and if one does not work,
it will try the other. If you need command line options other than the
standard -sxxxxxx, you will have to make minor changes in the source.
It checks for success by identifying the "FAILED CALL TO xxxxxx" at the
end of the uucico logfile (UUSPOOL:LOGFILE)
This is the source:
BEGIN C SOURCE
#include <stdio.h>
#include <string.h>
#include <exec/types.h>
#include <libraries/dos.h>
#include <proto/dos.h>
#define FALSE 0
#define TRUE 1
#define CICOLOG "uuspool:LOGFILE"
#define MAXPLACES 150
#define CICONAME "uucico"
#define CICOARG "-s" /* Add space inside these quotes to add space before
system name */
#define MAXTIMES 30
#define CICOERRSTART "FAILED call to "
#define CICOERREND "\n"
int DoUucico(char *SysName)
{
char Name[500];
char Buf1[300],Buf2[300];
FILE *LogRead;
sprintf(Name,"%s %s%s",CICONAME,CICOARG,SysName);
Execute(Name,0,0);
sprintf(Buf1,"%s%s%s",CICOERRSTART,SysName,CICOERREND);
LogRead=fopen(CICOLOG,"ra");
fseek(LogRead,-strlen(Buf1),2);
fread(Buf2,strlen(Buf1),1,LogRead);
fclose(LogRead);
Buf2[strlen(Buf1)]='\0'; /* Add End of String */
#ifdef DEBUG
printf("Buf1 = \"%s\"\n",Buf1);
printf("Buf2 = \"%s\"\n",Buf2);
#endif
if (strcmp(Buf1,Buf2)==0) {
#ifdef DEBUG
printf("Buf1 and Buf2 are identical\n");
#endif
return(FALSE);
}
else {
#ifdef DEBUG
printf("Buf1 and Buf2 are not identical\n");
#endif
return(TRUE);
}
}
void main(int argc,char *argv[])
{
int counter,count2=0;
int Done=FALSE;
int Flags[MAXPLACES+1];
if (argc > MAXPLACES) {
printf("Too many arguments\n");
exit(21);
}
for (counter=1;counter < argc;counter++) {
Flags[counter]=FALSE;
}
while ((Done==FALSE) && (count2 < MAXTIMES)) {
Done=TRUE;
for (counter=1;counter < argc;counter ++) {
if (Flags[counter]==FALSE) {
Flags[counter]=DoUucico(argv[counter]);
if (Flags[counter]==FALSE) {
Done=FALSE;
#ifdef DEBUG
printf("Flags[%d]=FALSE\n",counter);
#endif
}
else {
#ifdef DEBUG
printf("Flags[%d]=TRUE\n",counter);
#endif
}
}
}
count2++;
}
#ifdef DEBUG
if (Done==FALSE)
printf("Done=FALSE\n");
else printf("Done=TRUE\n");
#endif
printf("Done.\n");
}
END C SOURCE
--
----------->Steve Holland<-----------
Internet: wildcat!steve@alfalfa.com | "To err is human, but to really foul
USENET: ..bu!alphalpha!wildcat!steve | things up requires a computer."
<if alfalfa doesn't work, try alphalpha>