[comp.unix.questions] Making EXECL Unix call from Ada

cstein@jarthur.claremont.edu (Clifford Stein) (12/10/90)

I'm trying to laser print a file from an ada program by calling the program
enscript with the execl function.  I've been having problems, though.
Sometimes I can print a file, other times I cannot (if it doesn't
print, it [enscript] will give me a file not found message).

When enscript does print, however, it prints garbage which doesn't resemble
my file at all, and it [enscript] won't even print a filename at the top of
the printout like it usually does.

I've included the source code here, does anyone have any suggestions?
(I'm using VADS serial on a Sequent running Dynix)

If I compile this program the way it is right now I will get a 

"/hmc2/guest/lsdada/cliffie/hello4: file not found"

even though hello does exist.

Please respond via email.

			Thank you for any help.

				Clifford Stein


with c_strings; use c_strings;
with a_strings;use a_strings;
with unix_prcs; use unix_prcs;
with text_io; use text_io;
procedure print is
status:integer;
name:string(1..23);
argv:string(1..33);
a_name:c_string;
the_name:a_string;
nll:character;
begin

	argv(1..33):="/hmc2/guests/lsdada/cliffie/hello";
	nll:=ascii.nul;
	name:="/usr/local/bin/enscript";
	status:=execl(name'address,argv'address,nll'address);
	if status/=0 then
		put_line("True.");
	else
		put_line("False");
	end if;
end print;