socket_script.c
/* display a string which may contain non-printable characters */
display a string which may contain non-printable characters
display a string which may contain non - printable characters
static void display_string(const char *str)
{
  const char *p = str;
  while (*p)
  {
    if (*p>=' ' && *p<127)
      printf("%c", *p);
    else if (*p == '\r')
      printf("\\r");
    else if (*p == '\n')
      printf("\\n");
    else if (*p == '\t')
      printf("\\t");
    else
      printf("\\%o", *p);
    p++;
  }
}
static void display_string ( const char * str ) { const char * p = str ; while ( * p ) { if ( * p >= ' ' && * p < 127 ) printf ( " " , * p ) ; else if ( * p == ' \r ' ) printf ( " \\ " ) ; else if ( * p == ' \n ' ) printf ( " \\ " ) ; else if ( * p == ' \t ' ) printf ( " \\ " ) ; else printf ( " \\ " , * p ) ; p ++ ; } }
display a string which may contain non-printable characters
display a string which may contain non - printable characters