Esempio n. 1
0
static const char *get_basename(const char *filename)
{
    const char *basename = strrpbrk(filename, TY_PATH_SEPARATORS);
    if (!basename)
        return filename;

    return basename + 1;
}
Esempio n. 2
0
int vnodeSetMLSTfacts(PCStr(file),PCStr(facts)){
	CStr(vdir,1024);
	refQStr(vp,vdir);
	CStr(vnode,1024);
	CStr(line,1024);
	CStr(ofacts,1024);
	CStr(fval,1024);
	FILE *pfp;
	FILE *nfp;

	strcpy(vdir,file);
	if( vp = strrpbrk(vdir,"/\\") ){
		truncVStr(vp);
		if( !File_is(vdir) ){
			if( mkdir(vdir,0750) != 0 ){
				return 0;
			}
fprintf(stderr,"--- created %s\n",vdir);
		}
	}
	sprintf(vnode,"%s%s",file,VNODE_EXT);

	if( (pfp = fopen(vnode,"r")) && (nfp = fopen(vnode,"r+")) ){
		while( fgets(line,sizeof(line),pfp) ){
			if( strncaseeq(line,"VNO-Version:",12) ){
			}else
			if( strncaseeq(line,"VNO-Permit:",11) ){
				lineScan(line+11,fval);
				if( streq(fval,"read-only") ){
					fclose(pfp);
					fclose(nfp);
					return -1;
				}
			}else
			if( strncaseeq(line,"MLST-Facts:",11) ){
				lineScan(line+11,ofacts);
				if( streq(ofacts,facts) ){
					fclose(pfp);
					fclose(nfp);
					return 0;
				}
			}else{
				fputs(line,nfp);
			}
		}
		fclose(pfp);
fprintf(stderr,"--- CHANGED %s %s\n",vnode,facts);
	}else{
		nfp = fopen(vnode,"w+");
		if( nfp == NULL )
			return -1;
fprintf(stderr,"--- CREATED %s %s\n",vnode,facts);
	}
	fprintf(nfp,"MLST-Facts: %s\r\n",facts);
	Ftruncate(nfp,0,1);
	fclose(nfp);
	return 1;
}
Esempio n. 3
0
int asFunc(PCStr(arg1)){
	CStr(name,128);
	refQStr(dp,name);
	int fi;
	const char *n1;

	strcpy(name,arg1);
	if( dp = strrpbrk(name,"\\/") )
		ovstrcpy(name,dp+1);
	if( dp = strtailstrX(name,".exe",1) )
		setVStrEnd(dp,0);
	for( fi = 0; n1 = subfuncs[fi].f_name; fi++ ){
		if( strcaseeq(name,n1) )
			return fi+1;
		if( strncaseeq(name,"dg",2) && strcaseeq(name+2,n1) )
			return fi+1;
	}
	return 0;
}
Esempio n. 4
0
int psf_load( const char * uri, const psf_file_callbacks * file_callbacks, uint8_t allowed_version,
              psf_load_callback load_target, void * load_context, psf_info_callback info_target, void * info_context, int info_want_nested_tags )
{
    int rval;

    psf_load_state state;

    const char * file_name;

    if ( !uri || !*uri || !file_callbacks || !file_callbacks->path_separators || !*file_callbacks->path_separators || !file_callbacks->fopen ||
         !file_callbacks->fread || !file_callbacks->fseek || !file_callbacks->fclose || !file_callbacks->ftell ) return -1;

    state.depth = 0;
    state.allowed_version = allowed_version;
    state.file_callbacks = file_callbacks;
    state.load_target = load_target;
    state.load_context = load_context;
    state.info_target = info_target;
    state.info_context = info_context;
    state.info_want_nested_tags = info_want_nested_tags;

    state.base_path = strdup( uri );
    if ( !state.base_path ) return -1;

    file_name = strrpbrk( uri, file_callbacks->path_separators );

    if ( file_name )
    {
        ++file_name;
        state.base_path[ file_name - uri ] = '\0';
    }
    else
    {
        state.base_path[ 0 ] = '\0';
        file_name = uri;
    }

    rval = psf_load_internal( &state, file_name );

    free( state.base_path );

    return rval;
}
Esempio n. 5
0
int32_t timecode_parse_time (TimecodeTime * const t, TimecodeRate const * const r, const char *val) {
	int i = 0;
	char *buf = strdup(val);
	char *pe;
	int32_t * const bcd[5] = {&t->frame, &t->second, &t->minute, &t->hour, NULL };

	t->subframe = 0;
	for (i=0; i<4; i++) {
		*bcd[i] = 0;
	}

	if ((pe= strrchr(buf, '.'))) {
		t->subframe = atoi(pe+1);
		*pe = '\0';
	}

	i=0;
	while (i < 4 && (pe= (char*) strrpbrk(buf,":;"))) {
		*bcd[i] = (int) atoi(pe+1);
		*pe = '\0';
		i++;
	}

	if (i < 4 && *buf) {
		*bcd[i]= (int) atoi(buf);
	}

	free(buf);

	int32_t rv = timecode_move_time_overflow(t, r);

	if (r->drop && (t->minute%10 != 0) && (t->second == 0) && (t->frame == 0)) {
		t->frame=2;
	}

	return rv;
}
Esempio n. 6
0
char *buildfilename(char *old, char *sub, char *name) {
  /* Here's how we construct many filenames. If the "name" contains one of the
     PATHSEPS, then just use the "name" (i.e., relative to the working dir).
     Otherwise, put it in the same directory as "old". If "old" is NULL, then
     use the subdirectory "sub" of the location of the analog binary as "old".
     We always malloc new space to hold the name. */
  /* The calling routine should check any special cases appropriate to that
     type of file, e.g., "none", "-", "stdin" or "stdout". */
  extern char *commandpath;
  size_t t = 0, u;
  /* t is the length of sub, u of the directory of old */
  char *s, *ans;

  if (strpbrk(name, PATHSEPS) != NULL) {
    ans = (char *)xmalloc(strlen(name) + 1);
    strcpy(ans, name);
    return(ans);
  }
  if (old == NULL) {
    old = commandpath;
    t = strlen(sub);
  }
  if ((s = strrpbrk(old, PATHSEPS)) == NULL)
    u = 0;
  else
    u = ((s - old) + 1);
  ans = (char *)xmalloc(t + u + strlen(name) + 2);
  if (u != 0)
    strncpy(ans, old, u);
  if (t != 0) {
    sprintf(ans + u, "%s%c", sub, DIRSEP);
    t++;
  }
  strcpy(ans + t + u, name);
  return(ans);
}
Esempio n. 7
0
static int ls1(PCStr(file),LsArg *lsa)
{	const char *dir = lsa->l_dir;
	const char *fmt = lsa->l_fmt;
	const char *oline = lsa->l_buf;
	const char *sp;
	char sc;
	FileStat st;
	int rcode;
	int st_ok;
	int width;
	CStr(path,1024);
	CStr(name,1024);
	CStr(buf,1024);
	refQStr(op,lsa->l_buf); /**/
	const char *tail;
	/*
	char *tfmt = 0;
	*/
	const char *tfmt = lsa->l_tfmt;

	((char*)oline)[0] = 0;
	lsa->l_ikey = 0;
	if( file[0] == '.' && !lsa->l_all )
		return 0;

	if( lsa->l_maskrexp ){
		tail = frex_match(lsa->l_maskrexp,file);
		if( tail == NULL || *tail != 0 )
			return 0;
	}

	st_ok = 0;
	path[0] = 0;
	if( dir && dir[0] )
		strcpy(path,dir);
	if( *path )
	if( strtailchr(path) != '/' )
	if( *file != '/' )
		strcat(path,"/");
	strcat(path,file);

	if( lsa->l_stp ){
		st = *lsa->l_stp;
		st_ok = 1;
	}

	op = (char*)oline;
	for( sp = fmt; sc = *sp; sp++ ){
		assertVStr(lsa->l_buf,op+1);
		if( op[0] != 0 )
			op += strlen(op);

		if( sc != '%' || sp[1] == 0 ){
			setVStrPtrInc(op,sc); setVStrEnd(op,0);
			continue;
		}
		sp++;
		width = numscan(&sp);
		sc = *sp;

		if( sc == 'V' ){
			const char *rp;
			if( dir == 0 || dir[0] == 0 ){
				strcpy(op,lsa->l_vbase);
				continue;
			}
			strcpy(op,lsa->l_vbase);
			rp = strrpbrk(file,"/\\");
			if( rp && rp != file && rp[1] )
				rp += 1;
			else	rp = file;
			if( *op && strtailchr(op) != '/' && *rp != '/' )
				strcat(op,"/");
			strcat(op,rp);
			continue;
		}
		if( st_ok == 0 && lsa->l_virtual ){
			if( Vstat(file,AVStr(path),AVStr(name),0,0,&st)==0 ){
				file = name;
				st_ok = 1;
			}else{
				CStr(xpath,1024);
				sprintf(xpath,"%s%s",path,VNODE_EXT);
				if( File_is(xpath) ){
					truncVStr(oline);
					break;
				}
			}
		}
		if( sc == 'N' ){
			strcpy(op,file);
			continue;
		}
		if( sc == 'A' ){
			strcpy(op,path);
			continue;
		}
		if( st_ok == 0 ){
			errno = 0;
			if( lsa->l_reflink || !INHERENT_lstat() )
				rcode = stat(path,&st);
			else	rcode = lstat(path,&st);
			if( rcode != 0 ){
				/* maybe errno=EOVERFLOW */
				fprintf(stderr,"FAILED stat(%s), errno=%d\n",
					path,errno);
				((char*)oline)[0] = 0;
				break;
			}
			st_ok = 1;
		}
		if( sc == 'x' ){
			sc = *++sp;
			switch( sc ){
			    case 0: return 0;
			    case 'P':
				mlstPerm(AVStr(op),&st);
				continue;
			    case 'Y':
				if( S_ISDIR(st.st_mode) ){
					if( streq(file,".") )
						sprintf(op,"cdir");
					else
					if( streq(file,"..") )
						sprintf(op,"pdir");
					else	sprintf(op,"dir");
				}else
				if( S_ISREG(st.st_mode) )
					sprintf(op,"file");
				else	sprintf(op,"unknown");
				continue;
				break;
			    default:
				continue;
			    case 'T':
				tfmt = "%Y%m%d%H%M%S";
				sc = *++sp;
				break;
			    case 'U':
			    {
				struct {
					int u_dev;
					int u_ino;
				} u;
				u.u_dev = st.st_dev;
				u.u_ino = st.st_ino;
				str_to64((char*)&u,sizeof(u),AVStr(buf),sizeof(buf),1);
				Xsscanf(buf,"%[a-zA-Z0-9/+]",AVStr(op));
				continue;
			    }
			    break;
			}
		}

		switch( sc ){
			case 'd': {
				void ftoMD5(FILE *fp,char md5[]);
				FILE *fp;
				CStr(digest,64);
				if( fp = fopen(path,"r") ){
					ftoMD5(fp,(char*)digest);
					fclose(fp);
				}else	strcpy(digest,"-");
				sprintf(op,"%*s",width,digest);
				break;
			}
			case 'm': lsa->l_ikey = st.st_mtime; break;
			case 'a': lsa->l_ikey = st.st_atime; break;
			case 'z': lsa->l_ikey = st.st_size; break;
			case 'I': sprintf(op,"%*d",width,ll2i(st.st_ino)); break;
			case 'T': setVStrPtrInc(op,Ftypec(st)); setVStrEnd(op,0); break;
			case 'M': strcpy(op,Fmodes(st)); break;
			case 'L': sprintf(op,"%*d",width,ll2i(Fnlink(st))); break;
			case 'O': sprintf(op,"%*s",width,Fowner(st,AVStr(buf))); break;
			case 'G': sprintf(op,"%*s",width,Fgroup(st,AVStr(buf))); break;
			/*
			case 'S': sprintf(op,"%*d",width,Fbytes(st)); break;
			*/
			/*
			case 'S': sprintf(op,"%*u",width,Fbytes(st)); break;
			*/
			case 'S': sprintf(op,"%*lld",width,Fbytes(st)); break;
			case 'K': sprintf(op,"%*d",width,Fkbytes(st)); break;
			/*
			case 'D': sprintf(op,"%*s",width,rsctime(st.st_mtime,AVStr(buf))); break;
			case 'U': sprintf(op,"%*s",width,rsctime(st.st_atime,AVStr(buf))); break;
			*/
			case 'C': printTime(op,width,tfmt,st.st_ctime); break;
			case 'D': printTime(op,width,tfmt,st.st_mtime); break;
			case 'U': printTime(op,width,tfmt,st.st_atime); break;
		}
	}
	return 0;
}
Esempio n. 8
0
/*
 * name can be defined
 */
int Vstat(PCStr(file),PVStr(path),PVStr(name),int isDGV,int lev,FileStat *st){
	refQStr(dp,path);
	refQStr(ep,name);
	FILE *fp;
	CStr(line,4096);
	CStr(facts,4096);
	CStr(fact1,128);
	const char *fcp;
	int rcc;
	int isdgv;

	if( 8 < lev ){
		return -1;
	}
	if( isDGV ){
		dp = 0;
	}else{
		dp = strrchr(path,'.');
		if( dp == 0 || !strcaseeq(dp,VNODE_EXT) )
			return -2;
	}
	if( (fp = fopen(path,"r+")) == 0 ){
		return -3;
	}
	truncVStr(facts);
	while( fgets(line,sizeof(line),fp) != NULL ){
		if( strncaseeq(line,"MLST-Facts:",11) ){
			lineScan(line+11,facts);
			break;
		}
		if( *line == ' ' && strcasestr(line,"Type=") ){
			lineScan(line+1,facts);
			break;
		}
	}

	if( lev == 0 ){
		FileStat vst;

		if( dp ){
			setVStrEnd(dp,0);
		}
		strcpy(name,file);
		if( ep = strrchr(name,'.') )
			setVStrEnd(ep,0);
		bzero(st,sizeof(FileStat));
		st->st_mode |= S_IFDIR;
		st->st_nlink = 1;
		if( stat(path,&vst) == 0 ){
			st->st_dev = vst.st_dev;
			st->st_ino = vst.st_ino;
		}
	}

	isdgv = 0;
	for( fcp = facts; *fcp; ){
		refQStr(f1,fact1);
		fcp = scan_ListElem1(fcp,';',AVStr(fact1));
		if( f1 = strpbrk(fact1,"\r\n") )
			setVStrEnd(f1,0);
		if( *fact1 == ' ' ){
			break;
		}else
		if( strncaseeq(fact1,"x-ref=",6) ){
			CStr(xpath,1024);
			refQStr(xp,xpath);
			strcpy(xpath,path);
			if( xp = strrpbrk(xpath,"/\\") ){
				truncVStr(xp);
			}
			chdir_cwd(AVStr(xpath),fact1+6,0);
			if( File_is(xpath) ){
				if( isdgv ){
fprintf(stderr,"--->>>> dgv ... %s\n",xpath);
				Vstat(file,AVStr(xpath),BVStr(name),1,lev+1,st);
				}else
				stat(xpath,st);
			}else{
				strcat(xpath,VNODE_EXT);
				Vstat(file,AVStr(xpath),BVStr(name),1,lev+1,st);
			}
		}else
		if( strncaseeq(fact1,"type=",5) ){
			if( strcaseeq(fact1+5,"file") )
				st->st_mode |= S_IFREG;
			else
			if( strcaseeq(fact1+5,"dir") )
				st->st_mode |= S_IFDIR;
			else
			if( strcaseeq(fact1+5,"vno") )
				isdgv = 1;
			else
			if( strcaseeq(fact1+5,"MLST") )
				isdgv = 2;
		}else
		if( strncaseeq(fact1,"perm=",5) ){
			st->st_mode |= permMode(fact1+5);
		}else
		if( strncaseeq(fact1,"size=",5) ){
			st->st_size = atoi(fact1+5);
		}else
		if( strncaseeq(fact1,"modify=",7) ){
			st->st_mtime = scanYmdHMS_GMT(fact1+7);
		}
	}
	fclose(fp);
	return 0;
}
Esempio n. 9
0
/* main is a simple routine that provides an entry point to the program.  It
checks the command line arguments, prints a greeting, inputs the configuration
file name from the user, and then calls setupsim to load the configuration
file and set up all the structures.  If all goes well, it calls simulate or
simulategl to run the simulation. */
int main(int argc,char **argv) {
  simptr sim;
  int i,er,pflag,qflag,wflag,tflag,Vflag,oflag;
  char root[STRCHAR],fname[STRCHAR],flags[STRCHAR],*cptr;

	for(i=0;i<STRCHAR;i++) root[i]=fname[i]=flags[i]='\0';
	er=0;
	if(argc<=1) {
		fprintf(stderr,"Welcome to Smoldyn version %s.\n\n",VERSION);
		fprintf(stderr,"Enter name of configuration file: ");
		fgets(root,STRCHAR,stdin);
		if(strchr(root,'\n')) *(strchr(root,'\n'))='\0';
		fprintf(stderr,"Enter runtime flags (q=quiet, p=parameters only), or '-'=none: ");
		fgets(flags,STRCHAR,stdin);
		if(strchr(flags,'\n')) *(strchr(flags,'\n'))='\0'; }
	if(argc>1) {
		strncpy(root,argv[1],STRCHAR-1);
		root[STRCHAR-1]='\0';
		argc--;
		argv++; }
	er=Parse_CmdLineArg(&argc,argv,NULL);
	if(er) {
		if(er==1) fprintf(stderr,"Out of memory");
		else fprintf(stderr,"Follow command line '--define' options with key=replacement\n");
		return 0; }
	if(argc>1) {
		if(argv[1][0]=='-') {
			strncpy(flags,argv[1],STRCHAR-1);
			flags[STRCHAR-1]='\0';
			argc--;
			argv++; }
		else {
			fprintf(stderr,"Command line format: smoldyn [config_file] [-options] [-OpenGL_options]\n");
			return 0; }}

	cptr=strrpbrk(root,":\\/");
	if(cptr) cptr++;
	else cptr=root;
	strcpy(fname,cptr);
	*cptr='\0';

	oflag=strchr(flags,'o')?1:0;
	pflag=strchr(flags,'p')?1:0;
	qflag=strchr(flags,'q')?1:0;
	Vflag=strchr(flags,'V')?1:0;
	if(!strcmp(fname,"-V")) Vflag=1;
	wflag=strchr(flags,'w')?1:0;
	tflag=strchr(flags,'t')?1:0;

	if(Vflag) {
		printf("%s\n",VERSION);
		return 0; }
	sim=NULL;

	er=setupsim(root,fname,&sim,flags);
	if(!oflag && !pflag && !er) er=scmdopenfiles(sim->cmds,wflag);
	
	if(pflag || er) {
	      if(!qflag) printf("Simulation skipped\n"); }
	else { 
	      fflush(stdout);
	      fflush(stderr);
	      if(tflag || !sim->graphss || sim->graphss->graphics==0) {
    	
		      er=smolsimulate(sim);
		      endsimulate(sim,er); }
	      else {
		      gl2glutInit(&argc,argv);
		      smolsimulategl(sim); }}
	simfree(sim);

	cptr=getenv("OS");
	if(cptr!=NULL && strstr(cptr,"Windows")) {			// true for a Windows system
		printf("Press ENTER to close window\n");
		getchar(); }
  return 0; }
Esempio n. 10
0
static void imap_change_server(Connection *Conn,PVStr(login))
{	const char *dp;
	IStr(proto,64);
	CStr(host,LNSIZE);
	const char *opts;
	CStr(user,LNSIZE);
	CStr(tmp,LNSIZE);
	int port;

	if( *login == '"' )
		wordScanY(login+1,user,"^\"");
	else	wordScan(login,user);
	if( dp = strrpbrk(user,"@%") ){
		truncVStr(dp);
		strcpy(tmp,user);
		wordScan(dp+1,host);
		sprintf(user,"//%s/%s",host,tmp);
	}
	opts = CTX_mount_url_to(Conn,NULL,"GET",AVStr(user));
	strcpy(proto,"imap");
	if( strncasecmp(user,"imap://",7) == 0 )
	{
		ovstrcpy(user,user+5);
	}
	if( strncasecmp(user,"imaps://",8) == 0 )
	{
		strcpy(proto,"imaps");
		ovstrcpy(user,user+6);
	}

	if( Xsscanf(user,"//%[^/]/%s",AVStr(tmp),AVStr(user)) == 2 ){
		/*
		port = scan_hostportX("imap",tmp,AVStr(host),sizeof(host));
		*/
		port = scan_hostportX(proto,tmp,AVStr(host),sizeof(host));
		sprintf(login,"\"%s\"",user);
		goto SWSERV;
	}

	dp = strrpbrk(login,"@%");
	if( dp == 0 )
		return;

	/*
	port = scan_hostportX("imap",dp+1,AVStr(host),sizeof(host));
	*/
	port = scan_hostportX(proto,dp+1,AVStr(host),sizeof(host));
	if( strtailchr(login) == '"' )
		*(char*)dp++ = '"'; /**/
	truncVStr(dp);

SWSERV:
	sv1log("IMAP LOGIN  %s @ %s:%d\n",login,host,port);
	/*
	set_realserver(Conn,"imap",host,port);
	*/
	set_realserver(Conn,proto,host,port);
	if( streq(CLNT_PROTO,"imaps") && (ClientFlags & PF_MITM_DO) ){
		ServerFlags |= (PF_SSL_IMPLICIT | PF_STLS_DO);
	}
	connect_to_serv(Conn,FromC,ToC,0);
}
Esempio n. 11
0
static scanDirFunc find1(PCStr(file),DA *da)
{	int isdir,mtime,atime,size,blocks,dev,ino;
	int cnt;
	int match,rcode,cblocks;
	CStr(path,1024);
	FILE *out = da->d_out;
	FileStat st;
	const char *ftype;

	if( !da->d_top && file[0] == '.' )
		if( file[1] == 0 || file[1] == '.' && file[2] == 0 )
			return 0;
	da->d_nch++;
	mkabspath(AVStr(path),da->d_cwd,file);

	CNT++;
	match = 0;
	rcode = 0;

	if( da->d_Root ){
	isdir = file_stats(da->d_dev,da->d_ino,AVStr(path),path,&st,&blocks);
	}else
	isdir = file_stats(da->d_dev,da->d_ino,AVStr(path),file,&st,&blocks);
	dev = st.st_dev;
	ino = st.st_ino;
	mtime = st.st_mtime;
	atime = st.st_atime;
	size = st.st_size;
	
	if( isdir < 0 ){
		errlog("can't access: %s\n",path);
		return 0;
	}

	if( !F_FOLLOW_MOUNT && dev != ROOT_DEV ){
		if( ROOT_DEV == 0 )
			ROOT_DEV = dev;
		else	return 0;
	}

	N_BLK += blocks;

	if( isdir ){
		N_DIR++;
		/*
		match = 0 < dir1(da->d_cwd,path,file,dev,ino,out,&cblocks);
		*/
		match = 0 < dir1(da,da->d_cwd,path,file,dev,ino,out,&cblocks);
		if( F_REMOVE ){
			match = match && (0 < N_REM);
		}else
		if( (A_FROM==0||A_FROM<=atime) && (A_TILL==0||atime<=A_TILL) )
		if( (M_FROM==0||M_FROM<=mtime) && (M_TILL==0||mtime<=M_TILL) )
			match = 1;
		else	match = 0;
	}else{
		N_REG++;
		if( (A_FROM==0||A_FROM<=atime) && (A_TILL==0||atime<=A_TILL) )
		if( (M_FROM==0||M_FROM<=mtime) && (M_TILL==0||mtime<=M_TILL) )
			match = 1;
	}

	if( F_TYPE ){
		switch( *F_TYPE ){
			case 'f': if(  isdir ){ match = 0; } break;
			case 'd': if( !isdir ){ match = 0; } break;
		}
	}
	if( F_NAME ){
		CStr(fnam,1024);
		const char *np;
		if( np = strrpbrk(file,"/") ){
			np++;
		}else{
			np = file;
		}
		if( rexpmatch(F_NAME,np) ){
			if(  F_NAME_NOT ) match = 0;
		}else{
			if( !F_NAME_NOT ) match = 0;
		}
	}

	if( match && F_REMOVE && !da->d_top ){
		if( isdir )
			rcode = rmdir(file);
		else	rcode = unlink(file);
		if( rcode == 0 ){
			da->d_nrm++;
			N_BLKREM += blocks;
			N_REM++;
		}else	N_ERR++;
	}
	if( match || F_DU ){
		da->d_blocks += blocks;
		if( isdir ) da->d_blocks += cblocks;
	}

	if( !match && (F_TYPE || F_NAME) ){
	}else
	if( match && (F_PRINT || F_LSFORM)
	 || da->d_top && !F_REMOVE
	 || isdir && F_DIR
	/* || isdir && match_in_child */
	){
		fseek(out,0,2);
		if( F_DU ){
			if( isdir )
				fprintf(out,"%-7d ",(blocks+cblocks)/2);
			else	fprintf(out,"%-7d ",blocks/2);
		}
		if( F_LSFORM ){
			ls_unix(out,ls_opts,CVStr(NULL),path,&st);
		}else{
			ftype = "";
			if( isdir && path[strlen(path)-1] != '/' )
				ftype = "/";
			if( da->d_Root
			 && strneq(path,da->d_Root,da->d_Rlen) ){
				fprintf(out,"%s%s\n",path+da->d_Rlen,ftype);
			}else
			fprintf(out,"%s%s\n",path,ftype);
		}
	}
	return 0;
}