@@ -239,11 +239,11 @@ func (e *Emulator) WaitForField(timeout time.Duration, maxRetries int) error {
239239 unlockOutput , unlockErr := e .execCommand (unlockCommand )
240240
241241 // Query keyboard lock state after Wait(timeout, Unlock)
242- if kbLockState , kbErr := e .query ("KeyboardLock" ); kbErr == nil {
243- if Verbose {
244- log .Printf ("Keyboard lock state after Unlock wait: %s" , kbLockState )
245- }
246- }
242+ if kbLockState , kbErr := e .query ("KeyboardLock" ); kbErr == nil {
243+ if Verbose {
244+ log .Printf ("Keyboard lock state after Unlock wait: %s" , kbLockState )
245+ }
246+ }
247247
248248 // Check if unlock failed or status is not "U"
249249 needsReset := false
@@ -262,13 +262,13 @@ func (e *Emulator) WaitForField(timeout time.Duration, maxRetries int) error {
262262 // Retry unlock after reset
263263 time .Sleep (retryDelay )
264264 unlockOutput , unlockErr = e .execCommand (unlockCommand )
265-
265+
266266 // Query keyboard lock state again after reset
267- if kbLockState , kbErr := e .query ("KeyboardLock" ); kbErr == nil {
268- if Verbose {
269- log .Printf ("Keyboard lock state after Reset and Unlock: %s" , kbLockState )
270- }
271- }
267+ if kbLockState , kbErr := e .query ("KeyboardLock" ); kbErr == nil {
268+ if Verbose {
269+ log .Printf ("Keyboard lock state after Reset and Unlock: %s" , kbLockState )
270+ }
271+ }
272272 }
273273 }
274274
@@ -279,12 +279,12 @@ func (e *Emulator) WaitForField(timeout time.Duration, maxRetries int) error {
279279 for retries := 0 ; retries < maxRetries ; retries ++ {
280280 output , err := e .execCommand (command )
281281 if err == nil {
282- if output == "" {
283- if Verbose {
284- log .Println ("Wait command executed successfully (no output)" )
285- }
286- return nil
287- }
282+ if output == "" {
283+ if Verbose {
284+ log .Println ("Wait command executed successfully (no output)" )
285+ }
286+ return nil
287+ }
288288
289289 // Extract the keyboard status from the command output
290290 statusParts := strings .Fields (output )
@@ -511,6 +511,16 @@ func (e *Emulator) GetValue(x, y, length int) (string, error) {
511511 return "" , fmt .Errorf ("maximum GetValue retries reached" )
512512}
513513
514+ // NormalizeQueryResponse reduces a raw Query reply to the value it carries.
515+ //
516+ // s3270 answers on the scripting protocol with the value on a "data:" line
517+ // followed by a status line and "ok". Callers that want to parse the value —
518+ // the host compatibility profiler is one — need the value alone, and Query
519+ // deliberately hands back the reply untouched.
520+ func NormalizeQueryResponse (raw string ) string {
521+ return normalizeAsciiData (raw )
522+ }
523+
514524// normalizeAsciiData trims the s3270/x3270 "data:" prefix and drops status lines.
515525func normalizeAsciiData (raw string ) string {
516526 lines := strings .Split (raw , "\n " )
0 commit comments