From dd35bf78c6ad59b0049a47a0443ebbed97837ca8 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 6 Mar 2012 13:48:58 +0000 Subject: [PATCH] [372968] [dstore][shell] provide support for csh and tcsh shells --- .../miners/command/CommandMinerThread.java | 15 +++++++++++---- .../universal/miners/command/OutputHandler.java | 8 +++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java index a546867c6c5..658ce4ea76c 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java @@ -35,6 +35,7 @@ * David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support * David McKnight (IBM) [339741] [dstore][shells] consecutive prompt line is ignored * Noriaki Takatsu (IBM) [369767] [multithread][dstore] Invalid Default directory in shell Launch + * David McKnight (IBM) [372968] [dstore][shell] provide support for csh and tcsh shells *******************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.command; @@ -273,9 +274,10 @@ public class CommandMinerThread extends MinerThread { isSHonZ = true; } - else if (theShell.endsWith("/csh") || theShell.endsWith("/bsh")){ //$NON-NLS-1$//$NON-NLS-2$ + else if (theShell.endsWith("/csh") || theShell.endsWith("/tcsh") || theShell.endsWith("/bsh")){ //$NON-NLS-1$//$NON-NLS-2$ _isCsh = true; } + } // In a single-process server, both user.home and HOME don't represent // each client home directory. @@ -556,13 +558,18 @@ public class CommandMinerThread extends MinerThread if (didLogin || _isTTY) { // unsupported prompting - boolean unsupportedPrompt = theShell.endsWith("csh") || theShell.endsWith("bsh") || //$NON-NLS-1$//$NON-NLS-2$ + boolean unsupportedPrompt = theShell.endsWith("bsh") || //$NON-NLS-1$//$NON-NLS-2$ theShell.endsWith("tsh") || theShell.endsWith("rksh"); //$NON-NLS-1$//$NON-NLS-2$ String initCmd = ""; //$NON-NLS-1$ if (_isTTY && !unsupportedPrompt){ - initCmd = "export PS1='$PWD>';" ; //$NON-NLS-1$ + if (_isCsh){ + initCmd = "set prompt=\"$PWD>\""; //$NON-NLS-1$ + } + else { + initCmd = "export PS1='$PWD>';" ; //$NON-NLS-1$ + } } if (didLogin && !userHome.equals(_cwdStr)){ initCmd += "cd " + _cwdStr; //$NON-NLS-1$ @@ -686,7 +693,7 @@ public class CommandMinerThread extends MinerThread UniversalServerUtilities.logInfo(getName(), "shell input after char conversion="+input, _dataStore); //$NON-NLS-1$ if (_isCsh && origInput.startsWith("export ")){ //$NON-NLS-1$ - input = origInput.replaceAll("export ", "set "); //$NON-NLS-1$//$NON-NLS-2$ + input = origInput.replaceAll("export ", "setenv ").replaceAll("=", " "); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } try diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java index 1b739f18321..7f8d2f8dd64 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ * David McKnight (IBM) [312415] [dstore] shell service interprets < and > sequences - handle old client/new server case * David McKnight (IBM) [341366] [dstore][shells] codepage IBM-1141 has faulty display of \ character * David McKnight (IBM) [343421] [dstore] Man page was not displayed properly in the shell + * David McKnight (IBM) [372968] [dstore][shell] provide support for csh and tcsh shells *******************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.command; @@ -295,8 +296,9 @@ public class OutputHandler extends Handler { String lastLine = output[index - 1]; - boolean endLine = fullOutput.endsWith("\n") || fullOutput.endsWith("\r") || fullOutput.endsWith(">"); - + boolean endLine = fullOutput.endsWith("\n") || fullOutput.endsWith("\r") || //$NON-NLS-1$//$NON-NLS-2$ + fullOutput.endsWith(">") || //$NON-NLS-1$ + fullOutput.endsWith("% "); // csh/tcsh //$NON-NLS-1$ if (!_endOfStream && !endLine) { // our last line may be cut off