Find the offset to where a string should be trimmed to remove one word or special character sequence, including trailing whitespace. Definition at line 665 of file gui_input.c. 00666 { 00667 const char *end; 00668 00669 /* Last character */ 00670 end = (gs->str + gs->len) - 1; 00671 00672 /* Trim as much trailing whitespace as possible */ 00673 for (;;) { 00674 if (end < gs->str) return (0); 00675 if (!isspace(*end)) break; 00676 end--; 00677 } 00678 00679 if (isalnum(*end)) { 00680 /* Trim alphanumerics */ 00681 do { 00682 if (--end < gs->str) return (0); 00683 } while (isalnum(*end)); 00684 } else { 00685 /* Trim special characters */ 00686 do { 00687 if (--end < gs->str) return (0); 00688 } while (!isalnum(*end) && !isspace(*end)); 00689 } 00690 00691 return (end - gs->str) + 1; 00692 }
Here is the caller graph for this function:
![]() |
1.6.3