Ejemplo n.º 1
0
long ixsfirst(char *name, register WORD att, register DTAINFO *addr)
{
    const char *s;              /*  M01.01.03                   */
    DND *dn;
    FCB *f;
    long pos;

    if (att != FA_VOL)
        att |= (FA_ARCHIVE|FA_RO);


#if     M0101071401
    if ( (long)(dn = findit(name,&s,0))  < 0 )          /* M01.01.1212.01 */
        return( (long)dn );

    if ( dn == (DND*)NULLPTR )                                  /* M01.01.1214.01 */
        return( EFILNF );
#else
    if ((long)(dn = findit(name,&s,0)) < 0)             /* M01.01.1212.01 */
        return( dn );
    if (!dn)                                            /* M01.01.1214.01 */
        return( EFILNF );
#endif

    /* now scan for filename from start of directory */

    pos = 0;

#if     M0101071401
    if(  (f = scan(dn,s,att,&pos))      ==  (FCB*)NULLPTR  )
        return(EFILNF);
#else
    if (dn)
    {
        if (!(f = scan(dn,s,att,&pos)))
            return(EFILNF);
    }
    else
        return(EFILNF);
#endif

#if DBGFSDIR
    kprintf("\nixfirst(%s, DND=%08lx, DTA=%08lx)", s, (long)dn, (long)addr);
#endif
    if (addr)
    {
        memcpy(&addr->dt_name[0], s, 12);
        addr->dt_attr = att ;
        addr->dt_pos = pos ;
        addr->dt_dnd = dn ;

        makbuf( f , addr ) ;

    }

    return(E_OK);
}
Ejemplo n.º 2
0
/*
 *  xunlink - unlink (delete) a file
 *
 *  Function 0x41   Fdelete
 *
 *  returns     EFILNF, EACCDN, ixdel()
 */
long xunlink(char *name)
{
    DND *dn;
    FCB *f;
    const char *s;
    long pos;

    /* first find path */

    if ((long)(dn = findit(name,&s,0)) < 0)                 /* M01.01.1212.01 */
        return (long)dn;
    if (!dn)                                                /* M01.01.1214.01 */
        return EFILNF;

    /* now scan for filename */

    pos = 0;
    if (!(f = scan(dn,s,FA_NORM,&pos)))
        return EFILNF;

    if (f->f_attrib & FA_RO)
        return EACCDN;

    pos -= 32;

    return ixdel(dn,f,pos);
}
Ejemplo n.º 3
0
/*
**  ixopen - open a file
**
**  returns
**      <0 = error
**      >0 = file handle
*/
static long ixopen(char *name, int mod)
{
    FCB *f;
    DND *dn;
    const char *s;
    long pos;

    /* first find path */
    if ((long)(dn = findit(name,&s,0)) < 0)         /* M01.01.1212.01 */
        return (long)dn;
    if (!dn)                                        /* M01.01.1214.01 */
        return EFILNF;

    /*
     **  now scan the directory file for a matching filename
     */

    pos = 0;
    if (!(f = scan(dn,s,FA_NORM,&pos)))
        return EFILNF;

    /* Check to see if the file is read only */
    if ((f -> f_attrib & FA_RO) && (mod != 0))
        return EACCDN;

    return opnfil(f, dn, mod);
}
Ejemplo n.º 4
0
void handler2(int sig)
{
    pid_t pid;
    pid=waitpid(WAIT_ANY,NULL,WNOHANG);
    int i2;
    if(pid>0&&!ch)
    {
	i2=0;
	while(i2<p5)
	{
	    if(list[i2].pid==pid)//check if pid matches
	    {
		list[i2].back=0;
		break;
	    }
	    i2++;
	}
	char path[100];
	getcwd(path,100);
	printf("\n process : %s has exited with pid : %d\n", list[i2].process, pid);//print process name and pid if the process has terminated
	findit(path);
	fflush(stdout);
    }
    signal(SIGCHLD,handler2);
}
Ejemplo n.º 5
0
long xchmod(char *p, int wrt, char mod)
{
        OFD *fd;
        DND *dn;                                        /*  M01.01.03   */
        const char *s;
        long pos;

        if ((long)(dn = findit(p,&s,0)) < 0)            /* M01.01.1212.01 */
                return( (long)dn );
        if (!(long)dn)                                  /* M01.01.1214.01 */
                return( EPTHNF );

        pos = 0;


        if( ! scan( dn , s , FA_NORM , &pos )  )        /*  M01.01.03   */
                return( EFILNF ) ;


        pos -= 21;                           /* point at attribute in file */
        fd = dn->d_ofd;
        ixlseek(fd,pos);
        if (!wrt)
                ixread(fd,1L,&mod);
        else
        {
                ixwrite(fd,1L,&mod);
                ixclose(fd,CL_DIR); /* for flush */
        }
        return(mod);
}
Ejemplo n.º 6
0
 void scan()
 {
     int tmp1,tmp2;
     char tmp[100],tmp3[100],tmp4[100],tmp5[100],tmp6[100];
     scanf("%s",tmp);
     scanf("%d %d %d %d %d %d %d %d %d %d %d %d %s %d %d\n",
     &atk,&def,&psi,&dex,&luk,&Str,&Cmd,&Int,&Dex,&Luk,&tmp1,&mp,tmp3,&lv,&xp);
     hp1=tmp1%256,hp2=tmp1/256;
     cl=find(cla,cln,tmp3);
     scanf("%s %d %d %s %d %d %s\n",tmp4,&wl,&wxp,tmp5,&al,&axp,tmp6);
     wp=findit(tmp4);
     ar=findit(tmp5);
     sp=findit(tmp6);
     for(int i=0;i<7;i++)
         scanf("%X ",_u+i);
 }
Ejemplo n.º 7
0
void handler(int sig)
{
    char path[100];
    getcwd(path, 100);//get the current path in path character array
    printf("\n");
    findit(path);
    fflush(stdout);
    signal(SIGINT,handler);
    signal(SIGINT,handler);
    signal(SIGINT,handler);
}
Ejemplo n.º 8
0
int main(int argc, char *argv[])
{
	int size;
	
	if (argc < 2) {
		fprintf(stderr,"%s: <dir>\n", argv[0]);
		exit(1);
	}
	
	findit(argv[1]);
	return 0;
}
Ejemplo n.º 9
0
int main(int argc, char *argv[])
{
  int size;

  if (argc < 3) {
    fprintf(stderr,"%s: <minsize> <dir>\n", argv[0]);
    exit(1);
  }

  size = atoi(argv[1]);

  findit(size, argv[2]);
  return 0;
}
Ejemplo n.º 10
0
int main ()
{
    gethostname(hostname2,51);
    int f1=0;
    sprintf(uname,"%s",getenv("USER"));
    sprintf(homepath,"%s",getenv("PWD"));
    signal(SIGCHLD,SIG_IGN);//all signals that are to be handled
    signal(SIGCHLD,handler2);
    signal(SIGINT,SIG_IGN);
    signal(SIGINT,handler);
    signal(SIGTSTP,SIG_IGN);
    signal(SIGTSTP,handler);
    signal(SIGQUIT,SIG_IGN);
    signal(SIGQUIT,handler);
    int i2,i1=0,i3=0;
    char cur_dir[101];
    p5=0;
    while(1)
    {
	getcwd(cur_dir,101);//get path of current working directory
	back=0;
	p1=0;
	in1[0]='\0';
	if(!ch)
	{
	    findit(cur_dir);
	    scanf("%[^\n]",in1);
	    getchar();
	    if(in1[0]=='\0') 
		continue;
	}
	i2=0;
	argvals=0;
	while(i2<argvals)
	{
	    command[i2][0]='\0';
	    i2++;
	    i3++;
	}
	redir_in=0;
	redir_out=0;
	fun();//call function
	if(p1)
            exe();
	else
	    execute();
	i1++;
    }
    return 0;
}
Ejemplo n.º 11
0
static void findit(char *dir)
{
	DIR *d;
	struct dirent *de;
	
	d = opendir(dir);
	if (!d) return;
	
	
	while ((de = readdir(d))) {
		char *fname;
		struct stat st, st2;
		
		if (strcmp(de->d_name,".")==0) continue;
		if (strcmp(de->d_name,"..")==0) continue;
		
		fname = (char *)malloc(strlen(dir) + strlen(de->d_name) + 2);
		if (!fname) {
			fprintf(stderr,"out of memory\n");
			exit(1);
		}
		sprintf(fname,"%s/%s", dir, de->d_name);
		
		if (lstat(fname, &st)) {
			perror(fname);
			continue;
		}
		
		if (S_ISLNK(st.st_mode) && 
		    (stat(fname,&st2) || st2.st_uid != st.st_uid)) {
			char buf[1024];
			readlink(fname, buf, sizeof(buf)-1);
			printf("%s -> %s\n", fname, buf);
		}
		
		if (S_ISDIR(st.st_mode)) {
			findit(fname);
		}
		
		free(fname);
	}
	
	closedir(d);
}
Ejemplo n.º 12
0
Entity* Login::operator() (void)
{
  Entity* ent;
  
  ent = DB_FindEntity(this);
  if (!ent)
    return 0;
  
  ent->sock = this->sock;
  ent->isConnected = 1;
	
  if (ent->InitData() == -1) {
    delete ent;
    globals.erase(findit(ent, globals));
    return 0;
  } 
  
  return ent;
}
Ejemplo n.º 13
0
void findit(int size, char *dir)
{
  DIR *d;
  struct dirent *de;

  d = opendir(dir);
  if (!d) return;


  while ((de = readdir(d))) {
    char *fname;
    struct stat st;

    if (strcmp(de->d_name,".")==0) continue;
    if (strcmp(de->d_name,"..")==0) continue;

    fname = (char *)malloc(strlen(dir) + strlen(de->d_name) + 2);
    if (!fname) {
      fprintf(stderr,"out of memory\n");
      exit(1);
    }
    sprintf(fname,"%s/%s", dir, de->d_name);

    if (lstat(fname, &st)) {
      perror(fname);
      continue;
    }

    if (st.st_size >= size) {
      printf("%s %dk\n", fname, (int)(st.st_size/1024));
    }

    if (S_ISDIR(st.st_mode)) {
      findit(size, fname);
    }

    free(fname);
  }

  closedir(d);
  
}
Ejemplo n.º 14
0
int step(char *deck)
{
  int c;
  int b;
  int a;
  char tmp[54];

  do {

    /* step 1 */

    c = findit(deck, 53, 54);
    if (c < 53)
      {
	a = c + 1;
	deck[c] = deck[a];
      }
    else
      {
	for (a = 53; a > 1; a--)
	  deck[a] = deck[a - 1];
	a = 1;
      }
    deck[a] = 53;

    /* step 2 */

    b = findit(deck, 54, 54);
    if (b < 52)
      {
	c = b + 1;
	deck[b] = deck[c];
	if (a == c)
	  a = b;
	b = c + 1;
	deck[c] = deck[b];
	if (a == b)
	  a = c;
      }
    else
      {
	c = b;
	b = b - 51;
	for (; c > b; c--)
	  {
	    deck[c] = deck[c - 1];
	    if (a == c - 1)
	      a = c;
	  }
      }
    deck[b] = 54;

    /* step 3 */

    if (a > b)
      {
	c = a;
	a = b;
	b = c;
      }
    tmp[53] = deck[b++];

    c = 0;
    while (b < 54)
      tmp[c++] = deck[b++];

    b = a;
    while (deck[b] != tmp[53])
      tmp[c++] = deck[b++];

    tmp[c++] = tmp[53];
    b = 0;
    while (b < a)
      tmp[c++] = deck[b++];

    assert(c == 54);

    /* step 4 */

    b = tmp[53];
    if (b == 54)
      b = 53;

    a = 0;
    for (c = b; c < 53; c++)
      deck[a++] = tmp[c];
    for (c = 0; c < b; c++)
      deck[a++] = tmp[c];
    assert(a == 53);

    deck[53] = tmp[53];

    /* step 5 */

    a = deck[0];
    if (a == 54)
      a = 53;
    a = deck[a];
  } while (a > 52);
  return (a - 1) % 26 + 1;
}
Ejemplo n.º 15
0
int
dozap(void)
{
	struct obj *obj;
	xchar zx,zy;

	obj = getobj("/", "zap");
	if(!obj) return(0);
	if(obj->spe < 0 || (obj->spe == 0 && rn2(121))) {
		pline("Nothing Happens.");
		return(1);
	}
	if(obj->spe == 0)
		pline("You wrest one more spell from the worn-out wand.");
	if(!(objects[obj->otyp].bits & NODIR) && !getdir(1))
		return(1);	/* make him pay for knowing !NODIR */
	obj->spe--;
	if(objects[obj->otyp].bits & IMMEDIATE) {
		if(u.uswallow)
			bhitm(u.ustuck, obj);
		else if(u.dz) {
			if(u.dz > 0) {
				struct obj *otmp = o_at(u.ux, u.uy);
				if(otmp)
					bhito(otmp, obj);
			}
		} else
			bhit(u.dx,u.dy,rn1(8,6),0,bhitm,bhito,obj);
	} else {
	    switch(obj->otyp){
		case WAN_LIGHT:
			litroom(TRUE);
			break;
		case WAN_SECRET_DOOR_DETECTION:
			if(!findit()) return(1);
			break;
		case WAN_CREATE_MONSTER:
			{ int cnt = 1;
			if(!rn2(23)) cnt += rn2(7) + 1;
			while(cnt--)
			    makemon(NULL, u.ux, u.uy);
			}
			break;
		case WAN_WISHING:
			{ char buf[BUFSZ];
			  struct obj *otmp;
		      if(u.uluck + rn2(5) < 0) {
			pline("Unfortunately, nothing happens.");
			break;
		      }
		      pline("You may wish for an object. What do you want? ");
		      getlin(buf);
		      if(buf[0] == '\033') buf[0] = 0;
		      otmp = readobjnam(buf);
		      otmp = addinv(otmp);
		      prinv(otmp);
		      break;
			}
		case WAN_DIGGING:
			/* Original effect (approximately):
			 * from CORR: dig until we pierce a wall
			 * from ROOM: piece wall and dig until we reach
			 * an ACCESSIBLE place.
			 * Currently: dig for digdepth positions;
			 * also down on request of Lennart Augustsson.
			 */
			{ struct rm *room;
			  int digdepth;
			if(u.uswallow) {
				struct monst *mtmp = u.ustuck;

				pline("You pierce %s's stomach wall!",
					monnam(mtmp));
				mtmp->mhp = 1;	/* almost dead */
				unstuck(mtmp);
				mnexto(mtmp);
				break;
			}
			if(u.dz) {
			    if(u.dz < 0) {
				pline("You loosen a rock from the ceiling.");
				pline("It falls on your head!");
				losehp(1, "falling rock");
				mksobj_at(ROCK, u.ux, u.uy);
				fobj->quan = 1;
				stackobj(fobj);
				if(Invisible) newsym(u.ux, u.uy);
			    } else {
				dighole();
			    }
			    break;
			}
			zx = u.ux+u.dx;
			zy = u.uy+u.dy;
			digdepth = 8 + rn2(18);
			Tmp_at(-1, '*');	/* open call */
			while(--digdepth >= 0) {
				if(!isok(zx,zy)) break;
				room = &levl[zx][zy];
				Tmp_at(zx,zy);
				if(!xdnstair){
					if(zx < 3 || zx > COLNO-3 ||
					    zy < 3 || zy > ROWNO-3)
						break;
					if(room->typ == HWALL ||
					    room->typ == VWALL){
						room->typ = ROOM;
						break;
					}
				} else
				if(room->typ == HWALL || room->typ == VWALL ||
				   room->typ == SDOOR || room->typ == LDOOR){
					room->typ = DOOR;
					digdepth -= 2;
				} else
				if(room->typ == SCORR || !room->typ) {
					room->typ = CORR;
					digdepth--;
				}
				mnewsym(zx,zy);
				zx += u.dx;
				zy += u.dy;
			}
			mnewsym(zx,zy);	/* not always necessary */
			Tmp_at(-1,-1);	/* closing call */
			break;
			}
		default:
			buzz((int) obj->otyp - WAN_MAGIC_MISSILE,
				u.ux, u.uy, u.dx, u.dy);
			break;
		}
	}
	return(1);
}
Ejemplo n.º 16
0
/*ARGSUSED*/
long xrename(int n, char *p1, char *p2)
{
        register OFD *fd2;
        OFD     *f1,*fd;
        FCB     *f;
        DND     *dn1,*dn2;
        const char *s1,*s2;
        char    buf[11];
        int     hnew,att;
        long    rc, h1;

        if (!ixsfirst(p2,0,(DTAINFO *)0L))
                return(EACCDN);

        if ((long)(dn1 = findit(p1,&s1,0)) < 0)          /* M01.01.1212.01 */
                return( (long)dn1 );
        if (!dn1)                                        /* M01.01.1214.01 */
                return( EPTHNF );

        if ((long)(dn2 = findit(p2,&s2,0)) < 0)          /* M01.01.1212.01 */
                return( (long)dn2 );
        if (!dn2)                                        /* M01.01.1214.01 */
                return( EPTHNF );

        if (contains_illegal_characters(s2))
                return( EACCDN ) ;

        if ((h1 = xopen(p1, 2)) < 0L)
                return (h1);

        f1 = getofd ((int)h1);

        fd = f1->o_dirfil;
        buf[0] = 0xe5;
        ixlseek(fd,f1->o_dirbyt);

        if (dn1 != dn2)
        {
                /* get old attribute */
                f = (FCB *) ixread(fd,32L,NULLPTR);
                att = f->f_attrib;
                /* erase (0xe5) old file */
                ixlseek(fd,f1->o_dirbyt);
                ixwrite(fd,1L,buf);

                /* copy time/date/clust, etc. */

                ixlseek(fd,f1->o_dirbyt + 22);
                ixread(fd,10L,buf);
                hnew = xcreat(p2,att);
                fd2 = getofd(hnew);
                ixlseek(fd2->o_dirfil,fd2->o_dirbyt + 22);
                ixwrite(fd2->o_dirfil,10L,buf);
                fd2->o_flag &= ~O_DIRTY;
                xclose(hnew);
                ixclose(fd2->o_dirfil,CL_DIR);
        }
        else
        {
                builds(s2,buf);
                ixwrite(fd,11L,buf);
        }

        if ((rc = xclose((int)h1)) < 0L)
                return(rc);

        return(ixclose(fd,CL_DIR));
}
Ejemplo n.º 17
0
long xchdir(char *p)
{
        register int dr, i ;
        long    l;
        int     dphy,dlog,flg;
        const char *s;

        dlog = 0; /* dummy, to avoid warning */
        flg = 1;

xch:    if (p[1] == ':')
                dphy = uc(p[0]) - 'A';
        else
                dphy = run->p_curdrv;

        if (flg)
        {
                dlog = dphy;
                if (p[2] == '=')
                {
                        flg = 0;
                        p += 3;
                        goto xch;
                }
        }

        if ((l=ckdrv(dphy)) < 0)
                return(l);

        /* find space in dirtbl */
        if ( (dr = run->p_curdir[dlog]) )
        {
                --diruse[dr]; /* someone is still using it */
                if( diruse[dr] < 0 )            /*  M01.01.0721.02  */
                        diruse[dr] = 0 ;
        }

        for (i = 0; i < NCURDIR; i++, dr++)
        {
                if (dr == NCURDIR)
                        dr = 0;
                if (!diruse[dr])
                        break;
        }

        if (i == NCURDIR)
                return(EPTHNF);

        diruse[dr]++;

        if ((l = (long) findit(p,&s,1)) < 0)                    /* M01.01.1212.01 */
                return( l );
        if (!l)                                                 /* M01.01.1214.01 */
                return( EPTHNF );

        drvsel |= 1L << dlog ;          /*  M01.01.SCC.FS.03  */

        dirtbl[dr] = (DND *) l;

        run->p_curdir[dlog] = dr;

        return(E_OK);
}
Ejemplo n.º 18
0
/*  name: path name of file
 *  attr: atttributes
 */
long ixcreat(char *name, char attr)
{
    DND *dn;
    OFD *fd;
    FCB *f;
    const char *s;
    char n[2], a[11];                       /*  M01.01.03   */
    int i, f2;                              /*  M01.01.03   */
    long pos, rc;

    n[0] = (char)ERASE_MARKER; n[1] = 0;

    /* first find path */

    if ((long)(dn = findit(name,&s,0)) < 0) /* M01.01.1212.01 */
        return (long)dn;
    if (!dn)                                /* M01.01.1214.01 */
        return EPTHNF;

    if (!*s || (*s == '.'))         /*  no file name || '.' || '..' */
        return EPTHNF;

    /*  M01.01.0721.01  */
    if (contains_illegal_characters(s))
        return EACCDN;

    /*
     * if the volume label attribute is set, no others are allowed
     */
    if ((attr&FA_VOL) && (attr != FA_VOL))
        return EACCDN;

    /*
     * volume labels may only be created in the root
     */
    if ((attr == FA_VOL) && dn->d_parent)
        return EACCDN;

    if (!(fd = dn->d_ofd))
        fd = makofd(dn);            /* makofd() also updates dn->d_ofd */

    /*
     * if a matching file already exists, we delete it first.  note
     * that the definition of matching, and the action taken, differs
     * depending on whether the file is a volume label or not:
     *  . for a volume label, *any* existing volume label matches
     *    and will be deleted (reference: Rainbow TOS Release Notes)
     *  . for other files, the name must match, and the existing
     *    file will be deleted unless (a) it's read-only or a folder
     *    or (b) the file being created is a folder.
     */
    pos = 0;
    if (attr == FA_VOL)
        f = scan(dn,"*.*",FA_VOL,&pos);
    else f = scan(dn,s,FA_NORM|FA_SUBDIR,&pos);

    if (f)                  /* found matching file / label */
    {
        if (attr != FA_VOL) /* for normal files, need to check more stuff */
        {
                                        /* M01.01.0730.01   */
            if ((f->f_attrib & (FA_SUBDIR | FA_RO)) || (attr == FA_SUBDIR))
                return EACCDN;          /*  subdir or read only  */
        }
        pos -= 32;
        ixdel(dn,f,pos);
    }
    else
        pos = 0;

    /* now scan for empty space */

    /*  M01.01.SCC.FS.02  */
    while( !( f = scan(dn,n,0xff,&pos) ) )
    {
        /*  not in current dir, need to grow  */
        if (!fd->o_dnode)           /*  but can't grow root  */
            return EACCDN;

        if ( nextcl(fd,1) )
            return EACCDN;

        f = dirinit(dn);
        pos = 0;
    }

    builds(s,a);
    pos -= 32;
    f->f_attrib = attr;
    for (i = 0; i < 10; i++)
        f->f_fill[i] = 0;
    f->f_td.time = current_time;
    swpw(f->f_td.time);
    f->f_td.date = current_date;
    swpw(f->f_td.date);
    f->f_clust = 0;
    f->f_fileln = 0;
    ixlseek(fd,pos);
    ixwrite(fd,11L,a);              /* write name, set dirty flag */
    ixclose(fd,CL_DIR);             /* partial close to flush */
    ixlseek(fd,pos);
    s = (char*) ixread(fd,32L,NULL);
    f2 = rc = opnfil((FCB*)s,dn,(f->f_attrib&FA_RO)?RO_MODE:RW_MODE);

    if (rc < 0)
        return rc;

    getofd(f2)->o_flag |= O_DIRTY;

    return f2;
}
Ejemplo n.º 19
0
long xrmdir(char *p)
{
        register DND *d;
        DND     *d1,**q;
        FCB     *f;
        OFD     *fd,*f2;                /* M01.01.03 */
        long    pos;
        const char *s;
        register int i;

        if ((long)(d = findit(p,&s,1)) < 0)             /* M01.01.1212.01 */
                return( (long)d );
        if (!d)                                                 /* M01.01.1214.01 */
                return( EPTHNF );

        /*  M01.01.SCC.FS.09  */
        if( ! d->d_parent )                     /*  Can't delete root  */
                return( EACCDN ) ;

        for( i = 1 ; i <= NCURDIR ; i++ )       /*  Can't delete in use  */
                if( diruse[i] && dirtbl[i] == d )
                    return( EACCDN ) ;
         
        /*  end M01.01.SCC.FS.09  */

        if (!(fd = d->d_ofd))
                if (!(fd = makofd(d))) 
                        return (ENSMEM);

        ixlseek(fd,0x40L);
        do
        {
                if (!(f = (FCB *) ixread(fd,32L,NULLPTR)))
                        break;
        } while (f->f_name[0] == (char)0x0e5 || f->f_attrib == FA_LFN);


        if( f != (FCB*)NULLPTR  &&  f->f_name[0] != 0 )
                return(EACCDN);

        for(d1 = *(q = &d->d_parent->d_left); d1 != d; d1 = *(q = &d1->d_right))
                ; /* follow sib-links */

        if( d1 != d )
                return(EINTRN);         /* internal error */

        if (d->d_files)
                return(EINTRN);         /* open files ? - internal error */

        if (d->d_left)
                return(EINTRN);         /* subdir - internal error */


        /* take him out ! */

        *q = d->d_right;

        if (d->d_ofd)
        {
                xmfreblk((char *)d->d_ofd);             
        }

        d1 = d->d_parent;
        xmfreblk((char *)d);
        ixlseek((f2 = fd->o_dirfil),(pos = fd->o_dirbyt));
        f = (FCB *) ixread(f2,32L,NULLPTR);

        return(ixdel(d1,f,pos));
}