Removing the prompt()
This commit is contained in:
parent
185008c51e
commit
daf43f09a6
1 changed files with 0 additions and 15 deletions
|
@ -67,12 +67,6 @@ func HandleConnection(client Client) {
|
||||||
// Process input
|
// Process input
|
||||||
input := bufio.NewScanner(client.Connection())
|
input := bufio.NewScanner(client.Connection())
|
||||||
|
|
||||||
stack, ok := client.Stack().(*StringStack)
|
|
||||||
if ok == false {
|
|
||||||
panic("Cannot cast client.Stack() to *StringStack!")
|
|
||||||
}
|
|
||||||
|
|
||||||
prompt(client, stack)
|
|
||||||
for input.Scan() {
|
for input.Scan() {
|
||||||
log.Println(client.Connection().RemoteAddr(), ":", input.Text())
|
log.Println(client.Connection().RemoteAddr(), ":", input.Text())
|
||||||
|
|
||||||
|
@ -81,17 +75,8 @@ func HandleConnection(client Client) {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
io.WriteString(client.Connection(), err.Error()+"\n")
|
io.WriteString(client.Connection(), err.Error()+"\n")
|
||||||
}
|
}
|
||||||
prompt(client, stack)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client has left.
|
// Client has left.
|
||||||
log.Println(client.Connection().RemoteAddr(), "has disconnected.")
|
log.Println(client.Connection().RemoteAddr(), "has disconnected.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func prompt(client Client, stack *StringStack) (int, error) {
|
|
||||||
var str string
|
|
||||||
if !stack.IsEmpty() {
|
|
||||||
str = stack.Top().(string) + " "
|
|
||||||
}
|
|
||||||
return io.WriteString(client.Connection(), str+"ftp> ")
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue