/*
 * @(#)List.java
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2001-2003 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDcreator.java for details.
 *
 * Author: Jörg Haeger, 05.02.2001
 */

/**
 * List
 *
 * @version 20030915
 * @author Jörg P. M. Haeger
 */
class List extends Command {
	private static String mutex = "List";
	String strs[] = new String[100];
	int count = 0;

	String[] getStrings() {
		String strs2[] = new String[count];
		for (int i = 0; i < count; i++)
			strs2[i] = strs[i];
		return strs2;
	}

	void processHint(String str) {
		if (count == strs.length) {
			String[] old = strs;
			strs = new String[count + 100];
			for (int i = 0; i < count; i++)
				strs[i] = old[i];
		}

		strs[count++] = str;
	}

	public void run(String path) {
		synchronized(mutex) {
			execCommand("list " + spaceToEsc(path));
		}
		super.run();
	}
}
