home *** CD-ROM | disk | FTP | other *** search
- /* esc() - escaped character processing.
-
- Author: Jeff Taylor, The Toolsmith (c) copyright 1985
- Environment: UNIX 4.2 BSD; cc compiler.
- */
-
- #include "style.h"
-
- #define ESCAPE '\\'
-
- char real[] = "\t\f\n\010"; /* \010 otherwise known as '\b' */
- char symb[] = "tfnb";
-
- /* esc - map string into escaped cahracter if appropriate */
- char esc(s)
- /*register*/ char **s;
- {
- register int i;
-
- if (**s == ESCAPE && *(*s + 1) != EOS) /* not special at end */
- {
- ++s;
- for (i = 0; i < sizeof(symb) -1; ++i)
- {
- if (symb[i] == **s)
- return(real[i]);
- }
- }
- return(**s);
- }
-
- /* lexcmp() - alphabetical comparison.
-
- Author: Jeff Taylor, The Toolsmith (c) copyright 1985
- Environment: UNIX 4.2 BSD; cc compiler.
- */
-
- #include <ctype.h>
- #include "style.h"
-
- #define lower(c) (isupper(c)? tolower(c) : (c))
-
- /* lexcmp - alphabetical comparison, similar to strcmp() */
- int lexcmp(aa, bb)
- char *aa, *bb;
- {
- register char *a, *b;
-
- for (a = aa, b = bb; ; a++, b++)
- {
- if (lower(*a) != lower(*b))
- return(lower(*a) - lower(*b));
- if (*a == EOS)
- break;
- }
- for (a = aa, b = bb; ; a++, b++)
- {
- if (*a != *b)
- return(*a - *b);
- if (*a == EOS)
- break;
- }
- return(0); /* equal, if made it this far */
- }
-
-
-