MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetWordNum

Function GetWordNum

netcon/mtclient/chat_api.cpp:495–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495const char *GetWordNum(int num, const char *l_String) {
496 static char strreturn[600];
497 static char ptokstr[600];
498 char seps[10] = " \n\r\t";
499 char *token, *strstart;
500
501 strstart = ptokstr;
502
503 strcpy(ptokstr, l_String);
504
505 token = strtok(ptokstr, seps);
506
507 for (int i = 0; i != num; i++) {
508 token = strtok(nullptr, seps);
509 }
510 if (token) {
511 strcpy(strreturn, token);
512 } else {
513 return "";
514 }
515 // check for the ':' char....
516 if (token[0] == ':') {
517 // Its not pretty, but it works, return the rest of the string
518 strcpy(strreturn, l_String + ((token - strstart) + 1));
519 }
520
521 // return the appropriate response.
522 return strreturn;
523}
524
525int AddChatUser(const char *nickname) {
526 Curruser = Firstuser;

Callers 2

SendChatStringFunction · 0.85
ParseIRCMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected