#include <stdio.h>
#include "libsys.h"

/* probably a lot to improve... */

char __stat(void);
void __fname(const char *);

extern char __fnameidx;
extern char __fnamedev;

int remove(const char *name)
{
  char c;
  __fname(name);
  __setnam(0,0);
  __setlfs(15,__fnamedev,15);
  __open();
  __chkout(15);
  __chrout('s');
  __chrout('0');
  __chrout(':');
  c=name[__fnameidx];
  while(c){__chrout(c);c=name[++__fnameidx];}
  __clrchn();
  c=__stat();
  __close(15);

  if(c>=20) return 1;
  return 0;
}
