-/* Strip any trailing junk from the command */
-void strip_trailing_junk(char *cmd)
-{
- char *p;
- p = cmd + strlen(cmd) - 1;
-
- /* strip trailing junk from command */
- while ((p >= cmd) && (*p == '\n' || *p == '\r' || *p == ' '))
- *p-- = 0;
-}
-
-/* Strip any trailing slashes from a directory path */
-void strip_trailing_slashes(char *dir)
-{
- char *p;
- p = dir + strlen(dir) - 1;
-
- /* strip trailing slashes */
- while ((p >= dir) && (*p == '/'))
- *p-- = 0;
-}
-
-/*
- * Skip spaces
- * Returns: 0 on failure (EOF)
- * 1 on success
- * new address in passed parameter
- */
-int skip_spaces(char **msg)
-{
- char *p = *msg;
- if (!p) {
- return 0;
- }
- while (*p && *p == ' ') {
- p++;
- }
- *msg = p;
- return *p ? 1 : 0;
-}
-
-/*
- * Skip nonspaces
- * Returns: 0 on failure (EOF)
- * 1 on success
- * new address in passed parameter
- */
-int skip_nonspaces(char **msg)
-{
- char *p = *msg;
-
- if (!p) {
- return 0;
- }
- while (*p && *p != ' ') {
- p++;
- }
- *msg = p;
- return *p ? 1 : 0;
-}
-
-/* folded search for string - case insensitive */
-int
-fstrsch(char *a, char *b) /* folded case search */
-{
- register char *s1,*s2;
- register char c1, c2;
-
- s1=a;
- s2=b;
- while (*s1) { /* do it the fast way */
- if ((*s1++ | 0x20) != (*s2++ | 0x20))
- return 0; /* failed */
- }
- while (*a) { /* do it over the correct slow way */
- if (B_ISUPPER(c1 = *a)) {
- c1 = tolower((int)c1);
- }
- if (B_ISUPPER(c2 = *b)) {
- c2 = tolower((int)c2);
- }
- if (c1 != c2) {
- return 0;
- }
- a++;
- b++;
- }
- return 1;
-}
-