port = Integer.parseInt(args[1]);
port = Integer.parseInt(args[argIndex + 1]);
	public static void main(String []args)	{		FileOrURL f = null;		ContextStack context;		int i;		boolean readingStdin;		boolean isHttpServer = false;		int argIndex = 0;		int port = 0;		Level logLevel = null;		StringBuffer commandsToExecute = new StringBuffer();		if (args.length == 0)			printUsageAndExit();		/*		 * Parse command line arguments -- these are the files and URLs		 * to read commands from.		 */		while (argIndex < args.length &&			args[argIndex].startsWith("-") &&			args[argIndex].length() > 1)		{			String arg = args[argIndex];			if (arg.equals("-h") || arg.equals("--help") ||				arg.equals("-?"))			{				/*			 	* Show usage message and quit.			 	*/				printUsageAndExit();			}			else if (arg.equals("-v") || arg.equals("--version"))			{				/*			 	* Show version number and quit.			 	*/				System.out.println(Constants.PROGRAM_NAME + " " +					Constants.getVersion() + " " +					Constants.getReleaseDate());				System.out.println(getJavaConfiguration());				System.exit(1);			}			else if (arg.equals("-s"))			{				if (argIndex + 1 == args.length)					printUsageAndExit();				try				{					port = Integer.parseInt(args[1]);				}				catch (NumberFormatException e)				{					printUsageAndExit();				}				argIndex += 2;				isHttpServer = true;			}			else if (arg.equals("-e"))			{				if (argIndex + 1 == args.length)					printUsageAndExit();				/*				 * Commands to be executed given on command line.				 */				commandsToExecute.append(args[argIndex + 1]);				commandsToExecute.append(Constants.LINE_SEPARATOR);				argIndex += 2;			}			else if (arg.equals("-l"))			{				/*				 * Set logging level.				 */				if (argIndex + 1 == args.length)					printUsageAndExit();				try				{					logLevel = Level.parse(args[argIndex + 1]);				}				catch (IllegalArgumentException e)				{					System.err.println(e.getMessage());					System.exit(1);				}				argIndex += 2;			}			else if (arg.equals("--"))			{				/*				 * "--" marks end of options.				 */				argIndex++;				break;			}			else			{				/*				 * Unknown option.				 */				System.err.println(MapyrusMessages.get(MapyrusMessages.INVALID_OPTION) + ": " + arg);				System.exit(1);			}		}		initialise();		context = new ContextStack();		Interpreter interpreter = new Interpreter();		if (commandsToExecute.length() > 0)		{			/*			 * Run commands given as a command line argument.			 */			f = new FileOrURL(new StringReader(commandsToExecute.toString()), "-e");			if (!processFile(context, f, interpreter, false))				System.exit(1);		}		else		{			i = argIndex;			while (i < args.length)			{				readingStdin = args[i].equals("-");				if (readingStdin)				{					/*					 * Read from standard input.					 */					f = new FileOrURL(new InputStreamReader(System.in), "standard input");				}				else				{					/*					 * Read from a file or URL.					 */					try					{						f = new FileOrURL(args[i]);					}					catch (IOException e)					{						System.err.println(e.getMessage());						System.exit(1);					}					catch (MapyrusException e)					{						System.err.println(e.getMessage());						System.exit(1);					}				}						if (!processFile(context, f, interpreter, !readingStdin))					System.exit(1);				i++;			}		}		/*		 * Finish off anything being created in this context.		 */		try		{			context.closeContextStack();		}		catch (IOException e)		{			System.err.println(e.getMessage());			System.exit(1);		}		catch (MapyrusException e)		{			System.err.println(e.getMessage());			System.exit(1);		}		/*		 * If we're running as an HTTP server we are now ready to		 * accept connections and respond to requests from HTTP clients.		 */		if (isHttpServer)		{			serveHttp(interpreter, port, logLevel);			System.exit(1);		}		System.exit(0);	}