rem: if(target->SendMessage(&BMessage(B_GET_SUPPORTED_SUITES), &rply)==B_OK){
add: BMessage req(B_GET_SUPPORTED_SUITES); if(target->SendMessage(&req, &rply)==B_OK){
context: status_t Hey(BMessenger* target, char* argv[], int32* argx, int32 argc, BMessage* reply){	bool direct_what = false;	BMessage the_message;	if(strcasecmp(argv[*argx], "let")==0){			// added "let" -- sander@adamation.com 31may2000		BMessage get_target (B_GET_PROPERTY);		get_target.AddSpecifier ("Messenger");		// parse the specifiers		(*argx)++;		status_t result=B_OK;		while((result=add_specifier(&get_target, argv, argx, argc))==B_OK){};				if(result!=B_ERROR){	// bad syntax			if(!silent) fprintf(stderr, "Bad specifier syntax!\n");			return result;		}		BMessage msgr;		if (target && target->IsValid()) {			result = target->SendMessage(&get_target, &msgr);			if (result!=B_OK) return result;			result = msgr.FindMessenger ("result", target);			if (result!=B_OK) {				if (!silent) fprintf(stderr, "Couldn't retrieve the BMessenger!\n");				return result;			}		}		if (!argv[*argx]) {			if (!silent) fprintf(stderr, "Syntax error - forgot \"do\"?\n");			return B_ERROR;		}	}	if(strcasecmp(argv[*argx], "do")==0){			// added "do"  -- pfolk@uni.uiuc.edu  1999-11-03		the_message.what=B_EXECUTE_PROPERTY;	}else if(strcasecmp(argv[*argx], "get")==0){		the_message.what=B_GET_PROPERTY;	}else if(strcasecmp(argv[*argx], "set")==0){		the_message.what=B_SET_PROPERTY;	}else if(strcasecmp(argv[*argx], "create")==0){		the_message.what=B_CREATE_PROPERTY;	}else if(strcasecmp(argv[*argx], "delete")==0){		the_message.what=B_DELETE_PROPERTY;	}else if(strcasecmp(argv[*argx], "quit")==0){		the_message.what=B_QUIT_REQUESTED;	}else if(strcasecmp(argv[*argx], "save")==0){		the_message.what=B_SAVE_REQUESTED;	}else if(strcasecmp(argv[*argx], "load")==0){		the_message.what=B_REFS_RECEIVED;	}else if(strcasecmp(argv[*argx], "count")==0){		the_message.what=B_COUNT_PROPERTIES;	}else if(strcasecmp(argv[*argx], "getsuites")==0){		the_message.what=B_GET_SUPPORTED_SUITES;	}else{		switch(strlen(argv[*argx])){	// can be a message constant if 1,2,3 or 4 chars			case 1:						the_message.what=(int32)argv[*argx][0];						break;			case 2:						the_message.what=(((int32)argv[*argx][0])<<8)|(((int32)argv[*argx][1]));						break;			case 3:						the_message.what=(((int32)argv[*argx][0])<<16)|(((int32)argv[*argx][1])<<8)|(((int32)argv[*argx][2]));						break;			case 4:									the_message.what=(((int32)argv[*argx][0])<<24)|(((int32)argv[*argx][1])<<16)|(((int32)argv[*argx][2])<<8)|(((int32)argv[*argx][3]));						break;			default:						// maybe this is a user defined command, ask for the supported suites						bool found=false;						if (target && target->IsValid()) {							BMessage rply;							if(target->SendMessage(&BMessage(B_GET_SUPPORTED_SUITES), &rply)==B_OK){								// if all goes well, rply contains all kinds of property infos								int32 j=0;								void *voidptr;								int32 sizefound;								BPropertyInfo propinfo;								const value_info *vinfo;								int32 vinfo_index, vinfo_count;								//								const char *str;//								while (rply.FindString("suites", j++, &str) == B_OK)//									printf ("Suite %ld: %s\n", j, str);//									//								j = 0;								while(rply.FindData("messages", B_PROPERTY_INFO_TYPE, j++, (const void **)&voidptr, &sizefound)==B_OK && !found){									if(propinfo.Unflatten(B_PROPERTY_INFO_TYPE, (const void *)voidptr, sizefound)==B_OK){										vinfo=propinfo.Values();										vinfo_index=0;										vinfo_count=propinfo.CountValues();#if TEST_VALUEINFO>0										value_info vinfo[10]={	{"Backup", 'back', B_COMMAND_KIND, "This command backs up your hard drive."},																{"Abort", 'abor', B_COMMAND_KIND, "Stops the current operation..."},																{"Type Code", 'type', B_TYPE_CODE_KIND, "Type code info..."}																};										vinfo_count=3;#endif														while(vinfo_index<vinfo_count){											if(strcmp(vinfo[vinfo_index].name, argv[*argx])==0){												found=true;												the_message.what=vinfo[vinfo_index].value;#if TEST_VALUEINFO>0												printf("FOUND COMMAND \"%s\" = %lX\n", vinfo[vinfo_index].name, the_message.what);#endif												break;											}											vinfo_index++;										}																			}								}							}						}						if(!found){							if(!silent) fprintf(stderr, "Bad verb (\"%s\")\n", argv[*argx]);							return -1;						}		}		direct_what = true;	}		status_t result=B_OK;	(*argx)++;	// One exception: Single data item at end of line.	if (direct_what && *argx == argc - 1 && argv[*argx] != NULL) {		add_data(&the_message, argv, argx);	}	else {		// parse the specifiers		if(the_message.what!=B_REFS_RECEIVED){	// LOAD has no specifier			while((result=add_specifier(&the_message, argv, argx, argc))==B_OK){};					if(result!=B_ERROR){	// bad syntax				if(!silent) fprintf(stderr, "Bad specifier syntax!\n");				return result;			}		}	}		// if verb is SET or LOAD, there should be a to <value>	if((the_message.what==B_SET_PROPERTY || the_message.what==B_REFS_RECEIVED) && argv[*argx]!=NULL){		if(strcasecmp(argv[*argx], "to")==0){			(*argx)++;		}		result=add_data(&the_message, argv, argx);		if(result!=B_OK){			if(result==B_FILE_NOT_FOUND){				if(!silent) fprintf(stderr, "File not found!\n");			}else{				if(!silent) fprintf(stderr, "Invalid 'to...' value format!\n");			}			return result;		}	}	add_with(&the_message, argv, argx, argc);	#if DEBUG_HEY>0	fprintf(stderr, "Send ");	print_message(&the_message);	fprintf(stderr, "\n");#endif	if (target && target->IsValid()) {		if (reply) {			result = target->SendMessage(&the_message, reply);		} else {			result = target->SendMessage(&the_message);		}	}	return result;}