static int gui_input_trimword ( GString *  gs  )  [static]

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:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:18 2010 for herrie by  doxygen 1.6.3