; UUENCODE
;
; Program for Proteus
;
; (C) 1998-2004 Simone Zanella Productions
;
; This program writes to output a UUENCODED version of the first file specified.
IF ISEMPTY(ARGV(5))
CONSOLELN "Syntax: " ARGV(1) " " ARGV(2) \
" .. destination [filename]"
CONSOLELN ""
CONSOLELN "Purpose: writes to destination a UUENCODED version of filename"
ABORT 0
FI
SET H = FOPEN(ARGV(5), 1)
IF EQ(H, -1)
CONSOLELN "File \"" ARGV(5) "\" not found."
ABORT 1
FI
PRINTLN "begin " Attribs(ARGV(5)) " \"" QualifyName(ARGV(5)) "\""
WHILE NOT(FEOF(H))
SET S = FREAD(H, 45)
IF STRLEN(S)
PRINTLN UUENCODE(S)
FI
LOOP
PRINTLN "`"
PRINTLN "end"
ABORT 0
FUNCTION QualifyName(s)
!ifdef UNIX
SET p = STRRSTR(s, "/")
!else
SET p = STRRSTR(s, "\\")
!endif
IF p
SET s = RESTFROM(s, INC(p))
FI
RETURN s
FUNCTION Attribs(s)
!ifndef UNIX
RETURN "644"
!else
SET fa = FATTRIB(s)
RETURN NAND(fa, 7) NAND(SHIFTRT(fa, 5), 7) \
NAND(SHIFTRT(fa, 8), 7)
!endif