$! ...................... Cut between dotted lines and save. ..................... $!............................................................................. $! VAX/VMS archive file created by VMS_SHARE V06.03 20-Oct-1988. $! $! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from $! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au). $! $! To unpack, simply save, concatinate all parts into one file and $! execute (@) that file. $! $! This archive was created by user GJC $! on 6-NOV-1990 17:06:50.03. $! $! It contains the following 4 files: $! AUTODIAL.C $! AUTODIAL.LINK $! AUTODIAL.DOC $! NBS.COM $! $!============================================================================== $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK $ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", - "VMS_SHARE V06.03 20-Oct-1988 requires VMS V4.4 or higher." $ EXIT 44 $VERSION_OK: $ GOTO START $ $UNPACK_FILE: $ WRITE SYS$OUTPUT "Creating ''FILE_IS'" $ DEFINE/USER_MODE SYS$OUTPUT NL: $ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION - VMS_SHARE_DUMMY.DUMMY b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) ); s_file_spec := GET_INFO( COMMAND_LINE, "output_file" );SET( OUTPUT_FILE , b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" );i_errors := 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; pat_trail := " " & LINE_END;POSITION( BEGINNING_OF( b_part ) ); LOOP b := SEARCH( pat_trail, FORWARD); EXITIF b=0; POSITION( END_OF( b ) ) ; LOOP MOVE_HORIZONTAL( -1 ); EXITIF CURRENT_CHARACTER <> ' '; ERASE_CHARACTER ( 1 ); EXITIF CURRENT_OFFSET=0; ENDLOOP; ENDLOOP; POSITION( BEGINNING_OF ( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE ) = END_OF( b_part ) ; s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip < > 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip < > 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE ) ; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION ( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 ) ; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE ( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL ( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL ( -CURRENT_OFFSET ); ENDIF; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION ( b_errors ); COPY_TEXT( "The following line could not be unpacked properly:" ) ; SPLIT_LINE; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ) ; MOVE_VERTICAL( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ) ; ERASE_CHARACTER( 1 ); IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII ( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET ( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS" , i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" );ENDIF; EXIT; $ DELETE VMS_SHARE_DUMMY.DUMMY;* $ CHECKSUM 'FILE_IS $ WRITE SYS$OUTPUT " CHECKSUM ", - F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." ) $ RETURN $ $START: $ FILE_IS = "AUTODIAL.C" $ CHECKSUM_IS = 1501123813 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* stand-alone autodialer, takes TTY as arg1, full scriptname as arg2 X and executes it. Calls routines from sysdep.c and call.c X that would be called from UUCICO.C X `032 X Duplicates and/or has hacked versions of some routines from UUMISC.C X X2-NOV-1990 -GJC@MITECH.COM (George Carrette) X5-NOV-1990 -GJC. Added multiple-script and script-argument capability. X XModem line should already have been allocated, otherwise the Xassigning and deassigning of the device that this program does Xwill cause DTR to cycle. X X*/ X X#include "includes.h"`009`009/* System include files, system dependent */ X#include "uucp.h"`009`009/* Uucp definitions and parameters */ X#include "sysdep.h"`009`009/* System dependent parts of gnuucp */ X Xstatic char *doc_string = X "autodial [-dphone] [-xN] [-sScript ...args..]\n"; X Xmain(argc,argv) X int argc; X char **argv; X`123char *tty_name,*script_name; X struct script *Sc_dial; X FILE *fd_script; X long baud,j,k,n; X if (argc < 3) X `123fprintf(stderr,"%s\n",doc_string); X exit(SS$_ABORT);`125 X tty_name = argv[1]; X baud = atoi(argv[2]); X Sys_telno = ""; X Sys_prm0 = ""; X Sys_prm1 = ""; X Sys_prm2 = ""; X Sys_prm3 = ""; X Sys_prm4 = ""; X Sys_prm5 = ""; X Sys_prm6 = ""; X Sys_prm7 = ""; X Debug = (1 << DB_LOG); X if (open_tty_out(tty_name, baud) != SUCCESS) X `123fprintf(stderr,"Could not open tty\n"); X exit(SS$_ABORT);`125 X for(j=3;j MAXLOGWID - dsclen) `123 X`009`009`009`009printf("\n"); X`009`009`009`009logcnt = 0; X`009`009`009`009dsclen = 0; X`009`009`009`125 X`009`009`125 X`009`009if (dscrp != (char *)NULL && logcnt != 0) X`009`009`009printf("\n"); X`009`125 X`125 X X X Xchar * Xparse_int(result, c, base) Xint *result; Xchar *c; Xint base; X`123 X`009char *ic, *next; X`009ic = c;`009`009`009`009/* make local copy of pointer */ X`009if (*ic) `123`009`009`009/* if not already at end of string */ X`009`009ic++;`009`009`009/* skip over nondigit */ X`009`009*result = strtol(ic, &next, base); X`009`125 X`009return (next); X`125 X X/* converts the string pointed to by str to lowercase. */ X Xint Xstrtolower(str) Xchar *str; X`123 X`009char`009*p; X X`009for (p=str; *p; p++) X`009`009if (isupper(*p)) *p = tolower(*p); X`009return SUCCESS; X`125 X X/* stuff from UUMISC that we needed, with modifications */ X XFILE *logit_file = NULL; X Xlogit(one, two) X`009char *one, *two; X`123printf("%s %s\n",one,two); X if (logit_file == NULL) X logit_file = fopen("AUTODIAL.LOG","w"); X if (logit_file) X fprintf(logit_file,"%s %s\n",one,two);`125 X X/* Stuff that is not called, just to remove link errors */ X Xinterp_status_file() X`123printf("should not be called\n"); X lib$signal(44);`125 X Xread_ctl() X`123printf("should not be called\n"); X lib$signal(44);`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "AUTODIAL.LINK" $ CHECKSUM_IS = 1511549885 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$link/map autodial,sysdep,call,sys$Input:/opt Xsys$library:vaxcrtl/share X$! X$ autodial == "$" + f$env("DEFAULT") + "AUTODIAL" $ GOSUB UNPACK_FILE $ FILE_IS = "AUTODIAL.DOC" $ CHECKSUM_IS = 458568260 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XCompile AUTODIAL.C and then link it using @AUTODIAL.LINK X XExample: X X$ allocate TTA2: X X$ autodial TTA2: 2400 -d18002341998 -suucp_cfg:dial.hayes`032 X X$ set host/dte TTA2: X XThis code illustrates that the routines used by UUCICO for autodialing Xmay be easily used by a non-prived user-mode stand-alone program. X XAUTODIAL.C as it stands duplicates code from UUMISC.C but instead Xa slight modification to the routine logit is all that is needed. XThere should be a flag logit_ignore_logfile which is default 0, Xbut if set to 1 causes logit skip everything having to do Xwith log file and the locks on it. X X2-NOV-1990 -GJC@MITECH.COM George Carrette X5-NOV-1990 updated. X $ GOSUB UNPACK_FILE $ FILE_IS = "NBS.COM" $ CHECKSUM_IS = 1095633442 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ DEFINE MODEM TTA2: X$ NBS = "$user$disk:[gjc.nbstime]NBS" X$ AUTODIAL = "$USER$DISK:[GJC.UUCP.SRC]AUTODIAL" X$! X$ ON ERROR THEN GOTO DONE X$ ON CONTROL_Y THEN GOTO DONE X$ ALLOCATE MODEM X$ SET TERM/SPEED=1200 MODEM X$ AUTODIAL MODEM 1200 -d1-303-494-4774 -suucp_cfg:dial.myhayes X$ OPEN/READ IN MODEM X$ J = 0 X$LOOP: X$ J = J + 1 X$ IF J .GT. 9 THEN GOTO NBS X$ READ IN REC X$ WRITE SYS$OUTPUT REC X$ GOTO LOOP X$NBS: X$ CLOSE IN X$ nbs -d -c X$done: X$ deallocate modem X$ deassign modem $ GOSUB UNPACK_FILE $ EXIT