# include "basic.h"

int file (int argc, char **argv) {
  
  /* usage: file (filename) [var] */

  int status, vstat;
  struct stat fstats;

  if (argc < 2) {
    fprintf (stderr, "USAGE: file (filename) [var]\n");
    return (FALSE);
  }

  status = stat (argv[1], &fstats);

  vstat = !status;

  if (argc == 3) {
      
    set_int_variable (argv[2], vstat);

  } else {

    fprintf (stderr, "file %s is ", argv[1]);
    if (!vstat) fprintf (stderr, "not ");
    fprintf (stderr, "found\n");
    
  }
  return (TRUE);
}

