#include <pushpop.h>

  int whandle,wread;
  char wpath[STKRECSIZE];
  char wpathfromroot[STKRECSIZE+1];	/* '\\' + wpath */
  long fsize,jzsekfil();
main()
{

  if ((whandle = jzopnfil(FNAME,2)) != -1) {
    fsize = jzsekfil(whandle,0L,2);	      /* seek to end of file */
    if (fsize) {
      fsize -= (long) STKRECSIZE;
      jzsekfil(whandle,fsize,0);		/* seek to eof - 1 record */
      jzredfil(whandle,wpath,STKRECSIZE);
      strcpy(wpathfromroot,"\\");               /* start from root dir */
      strcat(wpathfromroot,wpath);		/* add full path */
      chdir(wpathfromroot);
      chsize(whandle,fsize);			/* "pop" file (truncate) */
      jzclsfil(whandle);
      exit(0);
    }
    else
      exit(1);
  }
  else
    exit(1);
}

