minor comments

This commit is contained in:
2026-09-12 23:01:21 -04:00
parent 5f7ce723ae
commit 5b0ef3e596
+7 -16
View File
@@ -1,7 +1,7 @@
// =============================================================================
// Auth: alex
// File: server.go
// Revn: 09-06-2026 3.0.0
// Revn: 09-12-2026 3.0.1
// Func: host MOTD connection
//
// TODO: add user-specific prints
@@ -52,6 +52,7 @@
// 05-12-2026: added v and vv input flags
// 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()
//
// =============================================================================
@@ -151,25 +152,16 @@ func receive( conn net.Conn ) {
n, err := conn.Read( buffer[:] )
checkN( err, conn ) // make sure read worked
// message anatomy
// command@number[@user]
// @ @ delimiter
// command command, like list request or quote request
// number sequence or quote number
// user quote username if applicable, default if not give
// add request message anatomy
// command@quote[@user]
// quote quote to be added
// user quote username, default if not given
// cast message to string, take first n bytes, split over @
command := strings.Split( string( buffer[:n] ), "@" )
// if command is to end transaction
if command[0] == "te" {
conn.Close()
return
conn.Close() // end transaction
return // and bail
}
// process command get response
resp := handle( command )
// write response to client
@@ -438,7 +430,6 @@ func handle( command []string ) string {
// globals
var qlist []string // list of quotes
//var qlist = make( map[string][]string )
var qfile string // file object
var tsize int // size of transmission buffer
var VERS string // version
@@ -462,7 +453,7 @@ func main() {
flag.Parse()
// FIXME get better versioning method
VERS = "3.0.0"
VERS = "3.0.1"
if vv { // display info and exit
fmt.Println( "ekho server v" + VERS )