[fpc-pascal]POpen problem

Michael Kochiashvili kochini at iberiapac.ge
Mon Sep 16 10:31:46 CEST 2002


trying run this code on FreeBSD

program sendm;
uses linux;
  F : text;
  i : longint;
  POpen( F, '/usr/sbin/sendmail -t', 'W');
  writeln( linuxerror);
  writeln( F);
  writeln( F, 'To: kochini at iberiapac.ge');
  writeln( F, 'From: falcon at iberiapac.ge');
  writeln( F, 'Subject: nothing');
  writeln( F);
  writeln( F, 'test');
  writeln( F);
  flush( F);

  i := PClose( F);
  writeln( i);

with this line
  POpen( F, '/usr/sbin/sendmail kochini at iberiapac.ge', 'W');
and without
  writeln( F, 'To: kochini at iberiapac.ge');

In both cases this program launches sendmail and waits for keyboard input ( as you launch
it from command line). Return codes after POpen and PClose = 0.
When I enter "." and <Enter>:
in first case - sendmail exits with message "No receipient addresses found in header"
in second case - it sends mail to receipient with blank body, "From" and "Subject" lines

Seems that pipe don't receives input from "Writeln( F, 'any string')"

Please, any suggestions

Thank you

Michael Kochiashvili

More information about the fpc-pascal mailing list