All of the sample programs reference the sample header file, example.h, the contents of which are as follows:
/* ** example.h ** ** This is the header file that goes with the ** Sybase Client-Library example programs. ** ** */ /* ** Define symbolic names, constants, and macros */ #define EX_MAXSTRINGLEN 255 #define EX_BUFSIZE 1024 #define EX_CTLIB_VERSION CS_VERSION_125 #define EX_BLK_VERSION BLK_VERSION_125 #define EX_ERROR_OUT stderr /* ** exit status values */ #define EX_EXIT_SUCCEED 0 #define EX_EXIT_FAIL 1 /* ** Define global variables used in all sample ** programs */ #define EX_SERVER NULL/* use DSQUERY env var */ #define EX_USERNAME "user" #define EX_PASSWORD "server_password"
The sample programs make use of the define statements in example.h as illustrated in the following fragments:
CS_CHAR *Ex_username = EX_USERNAME; CS_CHAR *Ex_password = EX_PASSWORD; /* ** If a user name is defined, set the ** CS_USERNAME property. */ if (retcode == CS_SUCCEED && Ex_username != NULL) { if ((retcode = ct_con_props(*connection, CS_SET, CS_USERNAME, Ex_username, CS_NULLTERM, NULL)) != CS_SUCCEED) { ex_error("ct_con_props(username) failed"); } } /* ** If a password is defined, set the ** CS_PASSWORD property. */ if (retcode == CS_SUCCEED && Ex_password != NULL) { if ((retcode = ct_con_props(*connection, CS_SET, CS_PASSWORD, Ex_password, CS_NULLTERM, NULL)) != CS_SUCCEED) { ex_error("ct_con_props(password) failed"); } }
Edits for these lines in example.h are described in the following sections.