Ejemplo n.º 1
0
int main( int argc, char** argv )
{
	int i;
	if( argc < 2 )
		return 1;

	for( i = 1; i < argc; ++i )
		purge_file( argv[ i] );

	return 0;
}
Ejemplo n.º 2
0
static void purge_dispatch(storage_t storage, strset_t objects, char *elem_str)
{
  char *type;
  char *hash;

  if ((type = strsep(&elem_str, " ")) == NULL)
    logger(LOG_ERROR, "invalid description file: %s", elem_str);

  if ((hash = strsep(&elem_str, " ")) == NULL)
    logger(LOG_ERROR, "invalid description file: %s", elem_str);

  strset_del(objects, hash);

  if (strcmp(type, "file") == 0)
    purge_file(storage, objects, hash);
  else if (strcmp(type, "tree") == 0)
    purge_tree(storage, objects, hash);
  else if (strcmp(type, "link") == 0)
    return; /* No need to recurse. */
  else
    logger(LOG_ERROR, "invalid description file: %s", elem_str);
}