debuggerUsage((toupper(args[0][2])=='T') ? "cbt" : "cba");
debuggerUsage((char *)((toupper(args[0][2])=='T') ? "cbt" : "cba"));
static void debuggerCondValidate(int n,char **args,int start){  /*    0: address/register    1: op    2: value    3: size  */    int i=debuggerNumOfBreakpoints;    char *address=args[start];  char *op=args[start+1];  char *value=args[start+2];  char *returnmsg="";  char *tsize,*taddress,*tvalue;  int rel=0;    u32 value1=0;  u32 value2=0;    char size=NULL;  int j=1;    if(n==6) {    size = args[start+3][0];    if(size != 'b' && size != 'h' && size != 'w') {      printf("Invalid size.\n");      return;    }        switch(size) {    case 'b':      debuggerBreakpointList[i].cond_size=1;      tsize="byte";      break;    case 'h':      debuggerBreakpointList[i].cond_size=2;      tsize="halfword";      break;    case 'w':      debuggerBreakpointList[i].cond_size=4;      tsize="word";      break;    }  }  switch(toupper(address[0])) {  case '$': //is address    while (address[j]) {      address[j-1]=address[j];      j++;    }    address[j-1]=0;        sscanf(address,"%x",&value1);    switch(size) {    case 'h':      if(value1 & 1) {        printf("Misaligned Conditional Address.\n");        return;      }      break;    case 'w':      if(value1 & 3) {        printf("Misaligned Conditional Address.\n");        return;      }    case 'b':      break;    default:      printf("Erroneous Condition\n");      debuggerUsage((toupper(args[0][2])=='T') ? "cbt" : "cba");      return;    }    debuggerBreakpointList[i].ia1=true;    taddress="$";    break;  case 'R': //is register    while(address[j]) {      address[j-1]=address[j];      j++;    }    address[j-1]=0;    sscanf(address,"%d",&value1);        if(value1 > 16) {      printf("Invalid Register.\n");      return;    }    if(size)      size=0;    debuggerBreakpointList[i].ia1=true;    taddress="r";    break;  default: //immediate;    printf("First Comparison Parameter should not be Immediate\n");    return;  }  debuggerBreakpointList[i].cond_address = value1;  // Check op   switch(op[0]) {  case '=': // 1    if (op[1] == '=' && op[2]==0)      rel=1;    else       goto error;    break;  case '!': //2    if (op[1]=='=' && op[2]==0)      rel=2;    else      goto error;    break;  case '<': //3    if(op[1]=='=')      rel=5;    else if (op[1]==0)      rel=3;    else      goto error;    break;  case '>': //4    if (op[1]=='=')      rel=6;    else if (op[1]==0)      rel=4;    else      goto error;    break;  default:  error:    printf("Invalid comparison operator.\n");    return;  }    if(op==0) {    printf("Invalid comparison operator.\n");    return;  }  debuggerBreakpointList[i].cond_rel=rel;  switch(toupper(value[0])) {  case '$': //is address    while(value[j]) {      value[j-1]=value[j];      j++;    }    value[j-1]=0;    sscanf(value,"%x",&value2);    debuggerBreakpointList[i].ia2=true;    tvalue="$";    switch(size) {    case 'h':      if(value2 & 1) {        printf("Misaligned Conditional Address.\n");        return;      }      break;    case 'w':      if(value2 & 3) {        printf("Misaligned Conditional Address.\n");        return;      }    case 'b':      break;    default:      printf("Erroneous Condition\n");      debuggerUsage((toupper(args[0][2])=='T') ? "cbt" : "cba");      return;    }    break;  case 'R': //is register    while(value[j]) {      value[j-1]=value[j];      j++;    }    value[j-1]=0;    sscanf(value,"%d",&value2);        if(value2 > 16) {      printf("Invalid Register.\n");      return;    }    debuggerBreakpointList[i].ia2=true;    tvalue="r";    break;  default: //immediate;    sscanf(value, "%x",&value2);    debuggerBreakpointList[i].ia2=false;    tvalue="0x";        switch(size) {    case 'b':      value2 &=0xFF;      break;    case 'h':      value2 &=0xFFFF;      break;    default:    case 'w':      value2 &=0xFFFFFFFF;      break;    }    break;  }    debuggerBreakpointList[i].cond_value = value2;  debuggerNumOfBreakpoints++;    // At here, everything's set. Display message.  switch(size) {  case 0:    printf("Added breakpoint on %08X if R%02d %s %08X\n",           debuggerBreakpointList[i].address,           debuggerBreakpointList[i].cond_address,           op,           debuggerBreakpointList[i].cond_value);    break;  case 'b':    printf("Added breakpoint on %08X if %s%08X %s %s%02X\n",           debuggerBreakpointList[i].address,           taddress,           debuggerBreakpointList[i].cond_address,           op,tvalue,           debuggerBreakpointList[i].cond_value);    break;  case 'h':    printf("Added breakpoint on %08X if %s%08X %s %s%04X\n",           debuggerBreakpointList[i].address,           taddress,           debuggerBreakpointList[i].cond_address,           op,           tvalue,           debuggerBreakpointList[i].cond_value);    break;  case 'w':    printf("Added breakpoint on %08X if %s%08X %s %s%08X\n",           debuggerBreakpointList[i].address,           taddress,           debuggerBreakpointList[i].cond_address,           op,tvalue,           debuggerBreakpointList[i].cond_value);    break;  }}