Chapter-3/3-2/escape.c
/* unescape:  converts escape sequenes '\n' and '\t' into newlines and
              tabs into as it copies the string t into s */
converts escape sequenes '\n' and '\t' into newlines and
tabs into as it copies the string t into s
converts escape sequenes ' \ n ' and ' \ t ' into newlines and tabs into as it copies the string t into s
void unescape(char s[], char t[]) {
  int i, j;
  int slash;
  slash = FALSE;
  for (i = j = 0; t[i] != '\0'; ++i) {
    switch (t[i]) {
      case '\\':
        slash = TRUE;
        break;
      case 'n':
        if (slash) {
          s[j++] = '\n';
          slash = FALSE;
          break;
        }
      case 't':
        if (slash) {
          s[j++] = '\t';
          slash = FALSE;
          break;
        }
      default:
        s[j++] = t[i];
        break;
    }
  }
  s[j] = '\0';
}
void unescape ( char s [ ] , char t [ ] ) { int i , j ; int slash ; slash = FALSE ; for ( i = j = 0 ; t [ i ] != ' \0 ' ; ++ i ) { switch ( t [ i ] ) { case ' \\ ' : slash = TRUE ; break ; case ' ' : if ( slash ) { s [ j ++ ] = ' \n ' ; slash = FALSE ; break ; } case ' ' : if ( slash ) { s [ j ++ ] = ' \t ' ; slash = FALSE ; break ; } default : s [ j ++ ] = t [ i ] ; break ; } } s [ j ] = ' \0 ' ; }
unescape:  converts escape sequenes '\n' and '\t' into newlines and
tabs into as it copies the string t into s
unescape : converts escape sequenes ' \ n ' and ' \ t ' into newlines and tabs into as it copies the string t into s