Commit 34f34f3d3b44198978bcccc327718f72053aed1e
1 parent
854943ad
Exists in
master
and in
5 other branches
Recuperando código do sample que foi danificador por engano
Showing
1 changed file
with
5 additions
and
49 deletions
Show diff stats
src/sample/connect.c
| @@ -33,7 +33,6 @@ | @@ -33,7 +33,6 @@ | ||
| 33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
| 34 | #include <string.h> | 34 | #include <string.h> |
| 35 | #include <lib3270.h> | 35 | #include <lib3270.h> |
| 36 | - #include <lib3270/actions.h> | ||
| 37 | 36 | ||
| 38 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 39 | 38 | ||
| @@ -61,67 +60,24 @@ | @@ -61,67 +60,24 @@ | ||
| 61 | 60 | ||
| 62 | printf("Connected to LU %s\n",lib3270_get_luname(hSession)); | 61 | printf("Connected to LU %s\n",lib3270_get_luname(hSession)); |
| 63 | 62 | ||
| 64 | - // Wait until the host is ready for commands | 63 | + /* Wait until the host is ready for commands */ |
| 65 | rc = lib3270_wait_for_ready(hSession,60); | 64 | rc = lib3270_wait_for_ready(hSession,60); |
| 66 | if(rc) | 65 | if(rc) |
| 67 | { | 66 | { |
| 68 | fprintf(stderr,"Error waiting for session negotiation: %s\n",strerror(rc)); | 67 | fprintf(stderr,"Error waiting for session negotiation: %s\n",strerror(rc)); |
| 69 | return rc; | 68 | return rc; |
| 70 | } | 69 | } |
| 71 | - | ||
| 72 | - while(lib3270_wait_for_ready(hSession,60)) | ||
| 73 | - { | ||
| 74 | - char * screen_id = lib3270_get_text(hSession,1,9); | ||
| 75 | - | ||
| 76 | - printf("Screen-id: [%s]",screen_id); | ||
| 77 | - | ||
| 78 | - if(!strcasecmp(screen_id)," ") | ||
| 79 | - { | ||
| 80 | -/* | ||
| 81 | - select | ||
| 82 | - when host~queryStringAt(16,34,"Tecle ENTER") | ||
| 83 | - then host~sendEnterKey() | ||
| 84 | - | ||
| 85 | - when host~queryStringAt(2,24,"Conexoes Externas ao SISBB") | ||
| 86 | - then host~sendEnterKey() | ||
| 87 | - | ||
| 88 | - when host~queryStringAt(15,2,"Aplicativo :") then | ||
| 89 | - do | ||
| 90 | - if host~queryStringAt(15,21,app) = 0 then | ||
| 91 | - do | ||
| 92 | - host~setStringAt(15,21,aplic) | ||
| 93 | - host~setCursorPosition(13,21) | ||
| 94 | - end | ||
| 95 | - end | ||
| 96 | - | ||
| 97 | - otherwise | ||
| 98 | - end | ||
| 99 | -*/ | ||
| 100 | - } | ||
| 101 | - else | ||
| 102 | - { | ||
| 103 | - fprintf(stderr,"Tela desconhecida [%s], abortando\n",screen_id); | ||
| 104 | - break; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - | ||
| 108 | - lib3270_free(screen_id); | ||
| 109 | - | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | -/* | ||
| 113 | - | ||
| 114 | - rc = lib3270_enter(hSession); | ||
| 115 | - rc = lib3270_wait_for_ready(hSession,60); | ||
| 116 | - | 70 | + else |
| 117 | { | 71 | { |
| 72 | + /* Host is ready, get screen contents */ | ||
| 118 | char *text = lib3270_get_text(hSession,0,-1); | 73 | char *text = lib3270_get_text(hSession,0,-1); |
| 119 | 74 | ||
| 120 | printf("\nScreen contents:\n%s\n",text); | 75 | printf("\nScreen contents:\n%s\n",text); |
| 121 | 76 | ||
| 122 | lib3270_free(text); | 77 | lib3270_free(text); |
| 123 | } | 78 | } |
| 124 | -*/ | 79 | + |
| 80 | + | ||
| 125 | 81 | ||
| 126 | 82 | ||
| 127 | /* Release session handle */ | 83 | /* Release session handle */ |