fixed quote request errors in server
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
// =============================================================================
|
||||
// Auth: alex
|
||||
// File: server.go
|
||||
// Revn: 09-12-2026 3.0.1
|
||||
// Revn: 09-15-2026 3.0.2
|
||||
// Func: host MOTD connection
|
||||
//
|
||||
// TODO: add user-specific prints
|
||||
// write usage and errors to logfile
|
||||
// remove ioutil import
|
||||
// send logfile to client on request
|
||||
// add color printing to qfile
|
||||
// add flags?
|
||||
// add more /codes/ to handle
|
||||
// =============================================================================
|
||||
@@ -53,6 +52,8 @@
|
||||
// 09-05-2026: buncha shit happened, dropped the commit
|
||||
//#09-06-2026: added /e1/, /e2/, and /cr/, got edit working
|
||||
// 09-12-2026: minor comments in receive()
|
||||
//*09-15-2026: fixed OOB error in /qa/ for perhaps the last time
|
||||
// fixed bad Atoi conversion bug for perhaps the last time
|
||||
//
|
||||
// =============================================================================
|
||||
|
||||
@@ -187,7 +188,7 @@ func handle( command []string ) string {
|
||||
case "qr": // /qr/, quote request
|
||||
// convert message argument to string to make sure it's a
|
||||
// valid number
|
||||
num, nerr := strconv.Atoi( command[0] )
|
||||
num, nerr := strconv.Atoi( command[1] )
|
||||
// nerr will not be nil if comm[1] is not a number
|
||||
if nerr != nil {
|
||||
// formulate an error message
|
||||
@@ -205,7 +206,7 @@ func handle( command []string ) string {
|
||||
// why bad? num is -
|
||||
default:
|
||||
// good num, get quote, send off
|
||||
resp = "qa@" + qlist[num - 1] // quote answer
|
||||
resp = "qa@" + qlist[num] // quote answer
|
||||
}
|
||||
}
|
||||
case "lr": // /lr/, list request
|
||||
@@ -453,7 +454,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
// FIXME get better versioning method
|
||||
VERS = "3.0.1"
|
||||
VERS = "3.0.2"
|
||||
|
||||
if vv { // display info and exit
|
||||
fmt.Println( "ekho server v" + VERS )
|
||||
|
||||
Reference in New Issue
Block a user