Diff

Differences From Artifact [53e2f62fc8]:

To Artifact [a15198f18c]:


   158    158   #define GSCIS_AID_CCC                 0xA0, 0x00, 0x00, 0x01, 0x16, 0xDB, 0x00
   159    159   
   160    160   #ifdef CACKEY_DEBUG
   161    161   #  ifdef HAVE_STDIO_H
   162    162   #    include <stdio.h>
   163    163   #  endif
   164    164   
   165         -#  define CACKEY_DEBUG_PRINTF(x...) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); fprintf(stderr, x); fprintf(stderr, "\n"); }
   166         -#  define CACKEY_DEBUG_PRINTBUF(f, x, y) { unsigned char *TMPBUF; unsigned long idx; TMPBUF = (unsigned char *) (x); fprintf(stderr, "%s():%i: %s  (%s/%lu = {%02x", __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0]); for (idx = 1; idx < (y); idx++) { fprintf(stderr, ", %02x", TMPBUF[idx]); }; fprintf(stderr, "})\n"); }
   167         -#  define CACKEY_DEBUG_PERROR(x) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); perror(x); }
          165  +#  define CACKEY_DEBUG_PRINTF(x...) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); fprintf(stderr, x); fprintf(stderr, "\n"); fflush(stderr); }
          166  +#  define CACKEY_DEBUG_PRINTBUF(f, x, y) { unsigned char *TMPBUF; unsigned long idx; TMPBUF = (unsigned char *) (x); fprintf(stderr, "%s():%i: %s  (%s/%lu = {%02x", __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0]); for (idx = 1; idx < (y); idx++) { fprintf(stderr, ", %02x", TMPBUF[idx]); }; fprintf(stderr, "})\n"); fflush(stderr); }
          167  +#  define CACKEY_DEBUG_PERROR(x) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); perror(x); fflush(stderr); }
   168    168   #  define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", x, #x); free(x); }
   169    169   
   170    170   static void *CACKEY_DEBUG_FUNC_MALLOC(size_t size, const char *func, int line) {
   171    171   	void *retval;
   172    172   
   173    173   	retval = malloc(size);
   174    174   
   175    175   	fprintf(stderr, "%s():%i: ", func, line);
   176    176   	fprintf(stderr, "MALLOC() = %p", retval);
   177    177   	fprintf(stderr, "\n");
          178  +	fflush(stderr);
   178    179   
   179    180   	return(retval);
   180    181   }
   181    182   
   182    183   static void *CACKEY_DEBUG_FUNC_REALLOC(void *ptr, size_t size, const char *func, int line) {
   183    184   	void *retval;
   184    185   
   185    186   	retval = realloc(ptr, size);
   186    187   
   187    188   	if (retval != ptr) {
   188    189   		fprintf(stderr, "%s():%i: ", func, line);
   189    190   		fprintf(stderr, "REALLOC(%p) = %p", ptr, retval);
   190    191   		fprintf(stderr, "\n");
          192  +		fflush(stderr);
   191    193   	}
   192    194   
   193    195   	return(retval);
   194    196   }
   195    197   
   196    198   static char *CACKEY_DEBUG_FUNC_STRDUP(const char *ptr, const char *func, int line) {
   197    199   	char *retval;
   198    200   
   199    201   	retval = strdup(ptr);
   200    202   
   201    203   	fprintf(stderr, "%s():%i: ", func, line);
   202    204   	fprintf(stderr, "STRDUP_MALLOC() = %p", retval);
   203    205   	fprintf(stderr, "\n");
          206  +	fflush(stderr);
   204    207   
   205    208   	return(retval);
   206    209   }
   207    210   
   208    211   static const char *CACKEY_DEBUG_FUNC_TAG_TO_STR(unsigned char tag) {
   209    212   	switch (tag) {
   210    213   		case GSCIS_TAG_CARDID: