futility/updater_archive.c
/* Callback for archive_walk on a general file system. */
Callback for archive_walk on a general file system.
Callback for archive_walk on a general file system .
static int archive_fallback_walk(
		void *handle, void *arg,
		int (*callback)(const char *path, void *arg))
{
	FTS *fts_handle;
	FTSENT *ent;
	char *fts_argv[2] = {};
	char default_path[] = ".";
	char *root = default_path;
	size_t root_len;
	if (handle)
		root = (char *)handle;
	root_len = strlen(root);
	fts_argv[0] = root;
	fts_handle = fts_open(fts_argv, FTS_NOCHDIR, NULL);
	if (!fts_handle)
		return -1;
	while ((ent = fts_read(fts_handle)) != NULL) {
		char *path = ent->fts_path + root_len;
		if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL)
			continue;
		while (*path == '/')
			path++;
		if (!*path)
			continue;
		if (callback(path, arg))
			break;
	}
	return 0;
}
static int archive_fallback_walk ( void * handle , void * arg , int ( * callback ) ( const char * path , void * arg ) ) { FTS * fts_handle ; FTSENT * ent ; char * fts_argv [ 2 ] = { } ; char default_path [ ] = " " ; char * root = default_path ; size_t root_len ; if ( handle ) root = ( char * ) handle ; root_len = strlen ( root ) ; fts_argv [ 0 ] = root ; fts_handle = fts_open ( fts_argv , FTS_NOCHDIR , NULL ) ; if ( ! fts_handle ) return -1 ; while ( ( ent = fts_read ( fts_handle ) ) != NULL ) { char * path = ent -> fts_path + root_len ; if ( ent -> fts_info != FTS_F && ent -> fts_info != FTS_SL ) continue ; while ( * path == ' ' ) path ++ ; if ( ! * path ) continue ; if ( callback ( path , arg ) ) break ; } return 0 ; }
Callback for archive_walk on a general file system.
Callback for archive_walk on a general file system .