Commit 5ffd1c33ce095020fefdcba936c6de4b41a622c7
1 parent
6dd1f8d6
Exists in
master
and in
3 other branches
Updating test program.
Showing
3 changed files
with
37 additions
and
104 deletions
Show diff stats
src/lib3270/Makefile.in
| ... | ... | @@ -35,7 +35,7 @@ SOURCES= \ |
| 35 | 35 | $(BASEDIR)/.tmp/$(LIBNAME)/fallbacks.c |
| 36 | 36 | |
| 37 | 37 | TEST_SOURCES= \ |
| 38 | - $(wildcard src/testprogram/*.c) | |
| 38 | + $(wildcard testprogram/*.c) | |
| 39 | 39 | |
| 40 | 40 | #---[ Tools ]---------------------------------------------------------------------------- |
| 41 | 41 | |
| ... | ... | @@ -284,11 +284,11 @@ locale: \ |
| 284 | 284 | #---[ Debug Targets ]-------------------------------------------------------------------- |
| 285 | 285 | |
| 286 | 286 | Debug: \ |
| 287 | - $(BINDBG)/$(LIBNAME)@DLLEXT@ | |
| 287 | + $(BINDBG)/$(LIBNAME)@EXEEXT@ | |
| 288 | 288 | |
| 289 | 289 | $(BINDBG)/$(LIBNAME)@EXEEXT@: \ |
| 290 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) \ | |
| 291 | - $(foreach SRC, $(basename $(TEST_SOURCES)), $(OBJDBG)/$(SRC).o) | |
| 290 | + $(foreach SRC, $(basename $(TEST_SOURCES)), $(OBJDBG)/$(SRC).o) \ | |
| 291 | + $(BINDBG)/$(LIBNAME)@DLLEXT@ | |
| 292 | 292 | |
| 293 | 293 | @$(MKDIR) `dirname $@` |
| 294 | 294 | @echo $< ... | ... | ... |
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | + | |
| 2 | +#include <stdio.h> | |
| 3 | +#include <string.h> | |
| 4 | +#include <stdlib.h> | |
| 5 | + | |
| 6 | +#include <lib3270.h> | |
| 7 | + | |
| 8 | +#define MAX_ARGS 10 | |
| 9 | + | |
| 10 | +int main(int numpar, char *param[]) | |
| 11 | +{ | |
| 12 | + H3270 * h; | |
| 13 | + int rc = 0; | |
| 14 | + const char * url = getenv("TN3270URL"); | |
| 15 | + | |
| 16 | + | |
| 17 | + h = lib3270_session_new(""); | |
| 18 | + printf("3270 session %p created\n]",h); | |
| 19 | + | |
| 20 | +// lib3270_set_toggle(session,LIB3270_TOGGLE_DS_TRACE,1); | |
| 21 | + | |
| 22 | + lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); | |
| 23 | + rc = lib3270_connect(h,1); | |
| 24 | + | |
| 25 | + printf("\nConnect exits with rc=%d\n",rc); | |
| 26 | + | |
| 27 | + lib3270_wait_for_ready(h,10); | |
| 28 | + | |
| 29 | + | |
| 30 | + lib3270_session_free(h); | |
| 31 | + | |
| 32 | + return 0; | |
| 33 | +} | ... | ... |
src/testprogram/testprogram.c
| ... | ... | @@ -1,100 +0,0 @@ |
| 1 | - | |
| 2 | -#include <stdio.h> | |
| 3 | -#include <string.h> | |
| 4 | -#include <stdlib.h> | |
| 5 | -// #include <pthread.h> | |
| 6 | - | |
| 7 | -#include "../lib3270/private.h" | |
| 8 | -#include <lib3270/macros.h> | |
| 9 | - | |
| 10 | -#define MAX_ARGS 10 | |
| 11 | - | |
| 12 | -static H3270 *session = NULL; | |
| 13 | - | |
| 14 | -static void * mainloop(void *dunno) | |
| 15 | -{ | |
| 16 | - while(session) | |
| 17 | - { | |
| 18 | - lib3270_main_iterate(session,1); | |
| 19 | - } | |
| 20 | - return NULL; | |
| 21 | -} | |
| 22 | - | |
| 23 | -int main(int numpar, char *param[]) | |
| 24 | -{ | |
| 25 | - H3270 * h; | |
| 26 | - int rc = 0; | |
| 27 | - const char * url = getenv("TN3270URL"); | |
| 28 | -// char line[4096]; | |
| 29 | -// pthread_t thread; | |
| 30 | - | |
| 31 | - lib3270_initialize(); | |
| 32 | - | |
| 33 | - session = h = lib3270_session_new(""); | |
| 34 | - printf("3270 session %p created\n]",h); | |
| 35 | - | |
| 36 | -// lib3270_set_toggle(session,LIB3270_TOGGLE_DS_TRACE,1); | |
| 37 | - | |
| 38 | -// pthread_create(&thread, NULL, mainloop, NULL); | |
| 39 | -// pthread_detach(thread); | |
| 40 | - | |
| 41 | - lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); | |
| 42 | - rc = lib3270_connect(h,1); | |
| 43 | - | |
| 44 | - printf("\nConnect exits with rc=%d\n",rc); | |
| 45 | - | |
| 46 | - mainloop(0); | |
| 47 | - | |
| 48 | -/* | |
| 49 | - while(fgets(line,4095,stdin)) | |
| 50 | - { | |
| 51 | -// const LIB3270_MACRO_LIST *cmd = get_3270_calls(); | |
| 52 | - | |
| 53 | - int f; | |
| 54 | - int argc = 0; | |
| 55 | - const char * argv[MAX_ARGS+1]; | |
| 56 | - char * ptr; | |
| 57 | - | |
| 58 | - line[4095] = 0; // Just in case. | |
| 59 | - | |
| 60 | - for(ptr = line;ptr && *ptr != '\n';ptr++); | |
| 61 | - *ptr = 0; | |
| 62 | - | |
| 63 | - if(!*line) | |
| 64 | - break; | |
| 65 | - | |
| 66 | - argv[argc++] = strtok(line," "); | |
| 67 | - for(f=1;f<MAX_ARGS;f++) | |
| 68 | - { | |
| 69 | - if( (argv[argc++] = strtok(NULL," ")) == NULL) | |
| 70 | - break; | |
| 71 | - } | |
| 72 | - argv[argc] = NULL; | |
| 73 | - | |
| 74 | - if(!strcmp(argv[0],"quit")) | |
| 75 | - break; | |
| 76 | - | |
| 77 | - ptr = lib3270_run_macro(h,argv); | |
| 78 | - if(ptr) | |
| 79 | - { | |
| 80 | - printf("\n%s\n",ptr); | |
| 81 | - lib3270_free(ptr); | |
| 82 | - } | |
| 83 | - else | |
| 84 | - { | |
| 85 | - printf("\nNo response\n"); | |
| 86 | - } | |
| 87 | - | |
| 88 | - printf("\n]"); | |
| 89 | - | |
| 90 | - } | |
| 91 | - | |
| 92 | - session = 0; | |
| 93 | - pthread_cancel(thread); | |
| 94 | - | |
| 95 | - printf("Ending 3270 session %p\n",h); | |
| 96 | - lib3270_session_free(h); | |
| 97 | -*/ | |
| 98 | - | |
| 99 | - return 0; | |
| 100 | -} |