[comp.sys.amiga.programmer] Simple Lattice C front-end for the ARP File requestor

peter@sugar.hackercorp.com (Peter da Silva) (05/09/91)

I wish I'd thought of this for my file requestor sample program:

In article <m0ja9DE-0003FIC@meepmeep.pcs.com> jkh@MEEPMEEP.PCS.COM (Jordan K. Hubbard) writes:
> Seems like this might save folks some work, so here it is..

If you make the "main" look like this it'd actually be useful:

! main(ac, av)
+ int ac;
+ char **av;
> {
>      char file[64], dir[64];
>      char path[128];
> 
>      /* Set initial contents */
>      file[0] = '\0';
!      strcpy(dir, ac>2?av[2]:"SYS:");
> 
!      if (ArpRequestFile(0, ac>1?av[1]:"Enter file name", file, dir, path))
! 	  printf("%s\n", path);
>      else
! 	  return 5;
+      return 0;
> }

(changed lines marked with !, new lines with +)

This way you can use it as:

arprequest >t:tempfile "Prompt" [initial:directory]
if not warn
  do_something_with_tempfile
endif

Or even, for the courageous:

arprequest >env:tempfile ...
-- 
Peter da Silva.   `-_-'
<peter@sugar.hackercorp.com>.