Beispiel #1
0
void dir_list::load(char *p_ini)
{
  #define INI_LEVEL       "level_data"
  #define INI_GAME        "game_data"
  #define INI_GRAPHICS    "graphics_data"
  #define INI_LEVEL_USER  "level_data_user"
  #define INI_TMP         "tmp_data"

  ini_read_string(p_ini, INI_LEVEL, levels, sizeof(levels), "./Lihen/Levels");
  ini_read_string(p_ini, INI_GAME, gamedata, sizeof(gamedata), "./Lihen/GameData");
  ini_read_string(p_ini, INI_GRAPHICS, graphics, sizeof(graphics), "./Lihen/Graphics");
  ini_read_string(p_ini, INI_LEVEL_USER, levels_user, sizeof(levels_user), "./Lihen/User");
  ini_read_string(p_ini, INI_TMP, tmp, sizeof(tmp), "/var/tmp");

  getcwd(cwd,MAX_FILENAME);
  
  update_path(levels);
  update_path(gamedata);
  update_path(graphics);  
  update_path(levels_user);
  update_path(tmp);
  chdir(cwd);

  #define INI_BINARY      "game_binary"
  ini_read_string(p_ini, INI_BINARY, game_binary, sizeof(game_binary), "berusky");
  
  pprintf("level_data: %s",levels);
  pprintf("game_data: %s",gamedata);
  pprintf("graphics_data: %s",graphics);
  pprintf("level_data_user: %s",levels_user);
  pprintf("tmp_data: %s",tmp);
  pprintf("current working dir: %s",cwd);
}
void stalker_movement_manager_obstacles::rebuild_path				()
{
#if 1
	level_path().make_inactual		();
	
	set_build_path_at_once			();
	update_path						();
#else
	level_path().select_intermediate_vertex();
	detail().make_inactual			();
#endif
	
	set_build_path_at_once			();
	update_path						();
}
Beispiel #3
0
static int db_rename(backend_store_interface* i, const char* rel_path, const char* new_path) {
	logger_logf(LOG(i), "old_path = %s, new_path = %s", rel_path, new_path);

	ERR_IF_DOESNT_EXIST(i, rel_path);
	ERR_IF_CANT_WRITE_TO_FILE(i, rel_path);

	update_path(rel_path, new_path);

    return 0;
}
Beispiel #4
0
/*
 * Traverse back up to root fixing parents of current node as needed.
 *
 * If we changed start of first entry in a node, fix parent index start
 * and so on.
 *
 * Safe to call for any position in node; if not at the first entry,
 * will  simply return.
 */
errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle)
{
	int				retval = 0;
	int				orig_height;
	blk64_t				start;
	struct extent_path		*path;
	struct ext2fs_extent		extent;
	struct ext2_extent_info		info;

	EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EXTENT_HANDLE);

	if (!(handle->fs->flags & EXT2_FLAG_RW))
		return EXT2_ET_RO_FILSYS;

	if (!handle->path)
		return EXT2_ET_NO_CURRENT_NODE;

	path = handle->path + handle->level;
	if (!path->curr)
		return EXT2_ET_NO_CURRENT_NODE;

	retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);
	if (retval)
		goto done;

	/* modified node's start block */
	start = extent.e_lblk;

	if ((retval = ext2fs_extent_get_info(handle, &info)))
		return retval;
	orig_height = info.max_depth - info.curr_level;

	/* traverse up until index not first, or startblk matches, or top */
	while (handle->level > 0 &&
	       (path->left == path->entries - 1)) {
		retval = ext2fs_extent_get(handle, EXT2_EXTENT_UP, &extent);
		if (retval)
			goto done;
		if (extent.e_lblk == start)
			break;
		path = handle->path + handle->level;
		extent.e_len += (extent.e_lblk - start);
		extent.e_lblk = start;
		retval = ext2fs_extent_replace(handle, 0, &extent);
		if (retval)
			goto done;
		update_path(handle);
	}

	/* put handle back to where we started */
	retval = ext2fs_extent_goto2(handle, orig_height, start);
done:
	return retval;
}
Beispiel #5
0
void find_path(NavGridLocation from, NavGridLocation to)
{
    int grid_size = gs.grid.get_width() * gs.grid.get_height();
    int from_id = hash_location(from);

    std::vector<AiNode> nodes (grid_size);
    for (int i = 0; i < nodes.size(); i++) {
        AiNode& node = nodes[i];
        node.id = i;
        node.visited = false;
        node.prev_node = nullptr;
        node.true_score = std::numeric_limits<float>::max();
        node.guess_score = std::numeric_limits<float>::max();
        node.pq_node = nullptr;
    }
    nodes[from_id].true_score = 0.f;
    nodes[from_id].guess_score = heuristic_cost(unhash_location(from_id), to);
    PriorityQueue<AiNode*> pq;
    nodes[from_id].pq_node = pq.enqueue(&nodes[from_id], -nodes[from_id].guess_score);
    update_prev(nodes);
    while (!pq.is_empty()) {
        AiNode* current = pq.get_front();
        pq.dequeue();
        current->pq_node = nullptr;
        current->visited = true;
        if (current->id == hash_location(to)) {
            break;
        }
        for (const NavGridLocation& adj : gs.grid.get_adjacent(unhash_location(current->id))) {
            AiNode* adj_node = &nodes[hash_location(adj)];
            if (adj_node->visited) 
                continue;
            float new_score = current->true_score + 1;
            if (new_score >= adj_node->true_score)
                continue;
            adj_node->prev_node = current;
            adj_node->true_score = new_score;
            adj_node->guess_score = new_score + heuristic_cost(unhash_location(adj_node->id), to);
            if (adj_node->pq_node) {
                pq.update(adj_node->pq_node, -adj_node->guess_score);
            } else {
                adj_node->pq_node = pq.enqueue(adj_node, -adj_node->guess_score);
            }
        }
    }
    update_prev(nodes);
    update_path(nodes, to);
}
Beispiel #6
0
static errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle)
{
	int				retval = 0;
	blk64_t				start;
	struct extent_path		*path;
	struct ext2fs_extent		extent;

	EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EXTENT_HANDLE);

	if (!(handle->fs->flags & EXT2_FLAG_RW))
		return EXT2_ET_RO_FILSYS;

	if (!handle->path)
		return EXT2_ET_NO_CURRENT_NODE;

	path = handle->path + handle->level;
	if (!path->curr)
		return EXT2_ET_NO_CURRENT_NODE;

	retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);
	if (retval)
		goto done;

	
	start = extent.e_lblk;

	
	while (handle->level > 0 &&
	       (path->left == path->entries - 1)) {
		retval = ext2fs_extent_get(handle, EXT2_EXTENT_UP, &extent);
		if (retval)
			goto done;
		if (extent.e_lblk == start)
			break;
		path = handle->path + handle->level;
		extent.e_len += (extent.e_lblk - start);
		extent.e_lblk = start;
		retval = ext2fs_extent_replace(handle, 0, &extent);
		if (retval)
			goto done;
		update_path(handle);
	}

	
	retval = ext2fs_extent_goto(handle, start);
done:
	return retval;
}
Beispiel #7
0
/* Append the standard include chain defined in cppdefault.c.  */
static void
add_standard_paths (const char *sysroot, const char *iprefix, int cxx_stdinc)
{
  const struct default_include *p;
  size_t len;

  if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
    {
      /* Look for directories that start with the standard prefix.
	 "Translate" them, i.e. replace /usr/local/lib/gcc... with
	 IPREFIX and search them first.  */
      for (p = cpp_include_defaults; p->fname; p++)
	{
	  if (!p->cplusplus || cxx_stdinc)
	    {
	      /* Should we be translating sysrooted dirs too?  Assume
		 that iprefix and sysroot are mutually exclusive, for
		 now.  */
	      if (sysroot && p->add_sysroot)
		continue;
	      if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
		{
		  char *str = concat (iprefix, p->fname + len, NULL);
		  add_path (str, SYSTEM, p->cxx_aware, false);
		}
	    }
	}
    }

  for (p = cpp_include_defaults; p->fname; p++)
    {
      if (!p->cplusplus || cxx_stdinc)
	{
	  char *str;

	  /* Should this directory start with the sysroot?  */
	  if (sysroot && p->add_sysroot)
	    str = concat (sysroot, p->fname, NULL);
	  else
	    str = update_path (p->fname, p->component);

	  add_path (str, SYSTEM, p->cxx_aware, false);
	}
    }
}
/**
 * msm_bus_scale_client_update_request() - Update the request for bandwidth
 * from a particular client
 *
 * cl: Handle to the client
 * index: Index into the vector, to which the bw and clock values need to be
 * updated
 */
int msm_bus_scale_client_update_request(uint32_t cl, unsigned index)
{
	int i, ret = 0;
	struct msm_bus_scale_pdata *pdata;
	int pnode, src, curr, ctx;
	unsigned long req_clk, req_bw, curr_clk, curr_bw;
	struct msm_bus_client *client = (struct msm_bus_client *)cl;
	if (IS_ERR_OR_NULL(client)) {
		MSM_BUS_ERR("msm_bus_scale_client update req error %d\n",
				(uint32_t)client);
		return -ENXIO;
	}

	mutex_lock(&msm_bus_lock);
	if (client->curr == index)
		goto err;

	curr = client->curr;
	pdata = client->pdata;
//tcd add start
	if (!pdata) {
		MSM_BUS_ERR("Null pdata passed to update-request\n");
		return -ENXIO;
	}
//tcd end

	if (index >= pdata->num_usecases) {
		MSM_BUS_ERR("Client %u passed invalid index: %d\n",
			(uint32_t)client, index);
		ret = -ENXIO;
		goto err;
	}

	MSM_BUS_DBG("cl: %u index: %d curr: %d"
			" num_paths: %d\n", cl, index, client->curr,
			client->pdata->usecase->num_paths);

	for (i = 0; i < pdata->usecase->num_paths; i++) {
		src = msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].src);
		if (src == -ENXIO) {
			MSM_BUS_ERR("Master %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].src);
			goto err;
		}

		if (msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].dst) == -ENXIO) {
			MSM_BUS_ERR("Slave %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].dst);
		}

		pnode = client->src_pnode[i];
		req_clk = client->pdata->usecase[index].vectors[i].ib;
		req_bw = client->pdata->usecase[index].vectors[i].ab;
		if (curr < 0) {
			curr_clk = 0;
			curr_bw = 0;
		} else {
			curr_clk = client->pdata->usecase[curr].vectors[i].ib;
			curr_bw = client->pdata->usecase[curr].vectors[i].ab;
			MSM_BUS_DBG("ab: %lu ib: %lu\n", curr_bw, curr_clk);
		}
		//tcd add start
		if (index == 0) {
			/* This check protects the bus driver from clients
			 * that can leave non-zero requests after
			 * unregistering.
			 */
			req_clk = 0;
			req_bw = 0;
		}
		//tcd end
		if (!pdata->active_only) {
			ret = update_path(src, pnode, req_clk, req_bw,
				curr_clk, curr_bw, 0, pdata->active_only);
			if (ret) {
				MSM_BUS_ERR("Update path failed! %d\n", ret);
				goto err;
			}
		}

		ret = update_path(src, pnode, req_clk, req_bw, curr_clk,
				curr_bw, ACTIVE_CTX, pdata->active_only);
		if (ret) {
			MSM_BUS_ERR("Update Path failed! %d\n", ret);
			goto err;
		}
	}

	client->curr = index;
	ctx = ACTIVE_CTX;
	msm_bus_dbg_client_data(client->pdata, index, cl);
	bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_commit_fn);

err:
	mutex_unlock(&msm_bus_lock);
	return ret;
}
/**
 * msm_bus_scale_client_update_request() - Update the request for bandwidth
 * from a particular client
 *
 * cl: Handle to the client
 * index: Index into the vector, to which the bw and clock values need to be
 * updated
 */
int msm_bus_scale_client_update_request(uint32_t cl, unsigned index)
{
	int i, ret = 0;
	struct msm_bus_scale_pdata *pdata;
	int pnode, src, curr, ctx;
	unsigned long req_clk, req_bw, curr_clk, curr_bw;
	struct msm_bus_client *client = (struct msm_bus_client *)cl;
	if (IS_ERR(client)) {
		MSM_BUS_ERR("msm_bus_scale_client update req error %d\n",
				(uint32_t)client);
		ret = -ENXIO;
		goto err;
	}

	mutex_lock(&msm_bus_lock);
	if (client->curr == index)
		goto err;

	curr = client->curr;
	pdata = client->pdata;

	if ((index < 0) || (index >= pdata->num_usecases)) {
		MSM_BUS_ERR("Client %u passed invalid index: %d\n",
			(uint32_t)client, index);
		ret = -ENXIO;
		goto err;
	}

	MSM_BUS_DBG("cl: %u index: %d curr: %d"
			" num_paths: %d\n", cl, index, client->curr,
			client->pdata->usecase->num_paths);

	for (i = 0; i < pdata->usecase->num_paths; i++) {
		src = msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].src);
		pnode = client->src_pnode[i];
		req_clk = client->pdata->usecase[index].vectors[i].ib;
		req_bw = client->pdata->usecase[index].vectors[i].ab;
		if (curr < 0) {
			curr_clk = 0;
			curr_bw = 0;
		} else {
			curr_clk = client->pdata->usecase[curr].vectors[i].ib;
			curr_bw = client->pdata->usecase[curr].vectors[i].ab;
			MSM_BUS_DBG("ab: %lu ib: %lu\n", curr_bw, curr_clk);
		}

		if (!pdata->active_only) {
			ret = update_path(src, pnode, req_clk, req_bw,
				curr_clk, curr_bw, 0, pdata->active_only);
			if (ret) {
				MSM_BUS_ERR("Update path failed! %d\n", ret);
				goto err;
			}
		}

		ret = update_path(src, pnode, req_clk, req_bw, curr_clk,
				curr_bw, ACTIVE_CTX, pdata->active_only);
		if (ret) {
			MSM_BUS_ERR("Update Path failed! %d\n", ret);
			goto err;
		}
	}

	client->curr = index;
	ctx = ACTIVE_CTX;
	msm_bus_dbg_client_data(client->pdata, index, cl);
	bus_for_each_dev(&msm_bus_type, NULL, (void *)ctx, msm_bus_commit_fn);

err:
	mutex_unlock(&msm_bus_lock);
	return ret;
}
/**
 * msm_bus_scale_client_update_request() - Update the request for bandwidth
 * from a particular client
 *
 * cl: Handle to the client
 * index: Index into the vector, to which the bw and clock values need to be
 * updated
 */
int msm_bus_scale_client_update_request(uint32_t cl, unsigned index)
{
	int i, ret = 0;
	struct msm_bus_scale_pdata *pdata;
	int pnode, src, curr, ctx;
	uint64_t req_clk, req_bw, curr_clk, curr_bw;
	struct msm_bus_client *client = (struct msm_bus_client *)cl;
#ifdef DEBUG_MSM_BUS_ARB_REQ
	static int log_cnt = 0;
#endif
	if (IS_ERR_OR_NULL(client)) {
		MSM_BUS_ERR("msm_bus_scale_client update req error %d\n",
				(uint32_t)client);
		return -ENXIO;
	}
#ifdef SEC_FEATURE_USE_RT_MUTEX
	rt_mutex_lock(&msm_bus_lock);
#else
	mutex_lock(&msm_bus_lock);
#endif
	if (client->curr == index)
		goto err;

	curr = client->curr;
	pdata = client->pdata;
	if (!pdata) {
		MSM_BUS_ERR("Null pdata passed to update-request\n");
		return -ENXIO;
	}

	if (index >= pdata->num_usecases) {
		MSM_BUS_ERR("Client %u passed invalid index: %d\n",
			(uint32_t)client, index);
		ret = -ENXIO;
		goto err;
	}

	MSM_BUS_DBG("cl: %u index: %d curr: %d num_paths: %d\n",
		cl, index, client->curr, client->pdata->usecase->num_paths);

	for (i = 0; i < pdata->usecase->num_paths; i++) {
		src = msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].src);
		if (src == -ENXIO) {
			MSM_BUS_ERR("Master %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].src);
			goto err;
		}

		if (msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].dst) == -ENXIO) {
			MSM_BUS_ERR("Slave %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].dst);
		}

		pnode = client->src_pnode[i];
		req_clk = client->pdata->usecase[index].vectors[i].ib;
		req_bw = client->pdata->usecase[index].vectors[i].ab;

#ifdef DEBUG_MSM_BUS_ARB_REQ
		//Debug code to collect client info
		{
			struct msm_bus_fabric_device *fabdev_d = msm_bus_get_fabric_device(GET_FABID(src));
			if (MSM_BUS_FAB_APPSS  == fabdev_d->id)
			{
				if (log_cnt >= 1000)
					log_cnt = 0;
				
				log_req[log_cnt].ab = client->pdata->usecase[index].vectors[i].ab;
				log_req[log_cnt].ib = client->pdata->usecase[index].vectors[i].ib;
				log_req[log_cnt].src = client->pdata->usecase[index].vectors[i].src;
				log_req[log_cnt].dst = client->pdata->usecase[index].vectors[i].dst;
				log_req[log_cnt].cnt = arch_counter_get_cntpct(); 
				strncpy(log_req[log_cnt].name, client->pdata->name, 19);
				log_cnt++;
				//printk("*** cl: %s ab: %llu ib: %llu\n", client->pdata->name, req_bw, req_clk);
			}
		}
#endif

		if (curr < 0) {
			curr_clk = 0;
			curr_bw = 0;
		} else {
			curr_clk = client->pdata->usecase[curr].vectors[i].ib;
			curr_bw = client->pdata->usecase[curr].vectors[i].ab;
			MSM_BUS_DBG("ab: %llu ib: %llu\n", curr_bw, curr_clk);
		}

		if (!pdata->active_only) {
			ret = update_path(src, pnode, req_clk, req_bw,
				curr_clk, curr_bw, 0, pdata->active_only);
			if (ret) {
				MSM_BUS_ERR("Update path failed! %d\n", ret);
				goto err;
			}
		}

		ret = update_path(src, pnode, req_clk, req_bw, curr_clk,
				curr_bw, ACTIVE_CTX, pdata->active_only);
		if (ret) {
			MSM_BUS_ERR("Update Path failed! %d\n", ret);
			goto err;
		}
	}

	client->curr = index;
	ctx = ACTIVE_CTX;
	msm_bus_dbg_client_data(client->pdata, index, cl);
	bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_commit_fn);

err:
#ifdef SEC_FEATURE_USE_RT_MUTEX
	rt_mutex_unlock(&msm_bus_lock);
#else
	mutex_unlock(&msm_bus_lock);
#endif
	return ret;
}
void GraphicsDirectedEdge::
set_stop(QPoint p)
{
	_stop = p;
	update_path();
}
Beispiel #12
0
static int update_request_legacy(uint32_t cl, unsigned index)
{
	int i, ret = 0;
	struct msm_bus_scale_pdata *pdata;
	int pnode, src = 0, curr, ctx;
	uint64_t req_clk = 0, req_bw = 0, curr_clk = 0, curr_bw = 0;
	struct msm_bus_client *client = (struct msm_bus_client *)cl;
	if (IS_ERR_OR_NULL(client)) {
		MSM_BUS_ERR("msm_bus_scale_client update req error %d\n",
				(uint32_t)client);
		return -ENXIO;
	}

	mutex_lock(&msm_bus_lock);
	if (client->curr == index)
		goto err;

	curr = client->curr;
	pdata = client->pdata;
	if (!pdata) {
		MSM_BUS_ERR("Null pdata passed to update-request\n");
		ret = -ENXIO;
		goto err;
	}

	if (index >= pdata->num_usecases) {
		MSM_BUS_ERR("Client %u passed invalid index: %d\n",
			(uint32_t)client, index);
		ret = -ENXIO;
		goto err;
	}

	MSM_BUS_DBG("cl: %u index: %d curr: %d num_paths: %d\n",
		cl, index, client->curr, client->pdata->usecase->num_paths);

	for (i = 0; i < pdata->usecase->num_paths; i++) {
		src = msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].src);
		if (src == -ENXIO) {
			MSM_BUS_ERR("Master %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].src);
			goto err;
		}

		if (msm_bus_board_get_iid(client->pdata->usecase[index].
			vectors[i].dst) == -ENXIO) {
			MSM_BUS_ERR("Slave %d not supported. Request cannot"
				" be updated\n", client->pdata->usecase->
				vectors[i].dst);
		}

		pnode = client->src_pnode[i];
		req_clk = client->pdata->usecase[index].vectors[i].ib;
		req_bw = client->pdata->usecase[index].vectors[i].ab;
		if (curr < 0) {
			curr_clk = 0;
			curr_bw = 0;
		} else {
			curr_clk = client->pdata->usecase[curr].vectors[i].ib;
			curr_bw = client->pdata->usecase[curr].vectors[i].ab;
			MSM_BUS_DBG("ab: %llu ib: %llu\n", curr_bw, curr_clk);
		}

		if (!pdata->active_only) {
			ret = update_path(src, pnode, req_clk, req_bw,
				curr_clk, curr_bw, 0, pdata->active_only);
			if (ret) {
				MSM_BUS_ERR("Update path failed! %d\n", ret);
				goto err;
			}
		}

		ret = update_path(src, pnode, req_clk, req_bw, curr_clk,
				curr_bw, ACTIVE_CTX, pdata->active_only);
		if (ret) {
			MSM_BUS_ERR("Update Path failed! %d\n", ret);
			goto err;
		}
	}

	client->curr = index;
	ctx = ACTIVE_CTX;
	msm_bus_dbg_client_data(client->pdata, index, cl);
	bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_commit_fn);

	/* For NR/RT limited masters, if freq is going up , apply the changes
	 * after we commit clk data.
	 */
	if (is_nr_lim(src) && ((req_clk > curr_clk) || (req_bw > curr_bw)))
		bus_for_each_dev(&msm_bus_type, NULL, NULL,
					msm_bus_commit_limiter);

err:
	mutex_unlock(&msm_bus_lock);
	return ret;
}
Beispiel #13
0
int main(int argc, char *argv[])
{
  char out_buff[MAX_PATH], *cue_file, *out_base;
  int a;

  if(argc < 2)
  {
    printf("bin/cue to cso/mp3 converter\n");
    printf("usage: %s [options] <input cue> [output base]\n", argv[0]);
    printf("options:\n"
           "   -m        output mp3 files for audio (default) (lame required)\n"
           "   -b <rate> mp3 bitrate to use (default is 128)\n"
           "   -w        output wav files for audio\n"
           "   -c        output cso as data track (default) (ciso required)\n"
           "   -i        output iso as data track\n");
    return 0;
  }

  for (a = 1; a < argc - 1; a++)
  {
    if      (strcmp(argv[a], "-m") == 0)
      opt_use_mp3 = 1;
    else if (strcmp(argv[a], "-w") == 0)
      opt_use_mp3 = 0;
    else if (strcmp(argv[a], "-c") == 0)
      opt_use_cso = 1;
    else if (strcmp(argv[a], "-i") == 0)
      opt_use_cso = 0;
    else if (strcmp(argv[a], "-b") == 0)
    {
      opt_mp3_bitrate = atoi(argv[++a]);
    }
    else
      break;
  }
  cue_file = argv[a];
  out_base = argv[a+1];

  /* some sanity checks */
  if(strlen(cue_file) < 4 || strcasecmp(cue_file + strlen(cue_file) - 4, ".cue") != 0)
  {
    printf("error: not a cue file specified?\n");
    myexit(1);
  }

#ifdef _WIN32
  update_path();
#endif

  if(opt_use_mp3 && system(LAME_BINARY " --help " NULL_REDIR) != 0)
  {
    printf("LAME seems to be missing.\n"
#ifdef _WIN32
      "Download from http://lame.sourceforge.net/links.php#Binaries and extract\n"
      "lame.exe to the same directory as %s\n", argv[0]
#else
      "Install lame using your packet manager, obtain binaries or build from\n"
      "sources at http://lame.sourceforge.net/\n"
#endif
      );
    myexit(1);
  }

  if(opt_use_cso && system(CISO_BINARY " " NULL_REDIR) != 0)
  {
    printf("CISO seems to be missing.\n"
#ifdef _WIN32
      "Download ciso.exe and extract to the same directory as %s\n"
      "You can take ciso.exe from yacc at http://yacc.pspgen.com/\n", argv[0]
#else
      "Install ciso using your packet manager, obtain binaries or build from\n"
      "sources at http://ciso.tenshu.fr/\n"
#endif
      );
    myexit(1);
  }

  if(load_bin_cue(cue_file) == 0)
  {
    if(out_base == NULL)
    {
      char *p;
      strncpy(out_buff, cue_file, sizeof(out_buff));
      out_buff[sizeof(out_buff)-1] = 0;
      p = strrchr(out_buff, DIR_SEPARATOR_CHAR);
      if (p != NULL)
      {
        *p++ = 0;
        chdir(out_buff);
        memmove(out_buff, p, strlen(p)+1);
      }
      out_buff[strlen(out_buff)-4] = 0;
      out_base = out_buff;
    }
    if(convert_bin_cue(out_base) != 0)
      myexit(1);
  }
  else
  {
    printf("error: could not load cue file %s\n", cue_file);
    myexit(1);
  }

  return 0;
}