[BACK]Return to vis.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/gen/vis.c between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 1993/03/21 09:45:37 version 1.1.1.2, 1995/02/25 09:13:22
Line 1 
Line 1 
 /*-  /*-
  * Copyright (c) 1989 The Regents of the University of California.   * Copyright (c) 1989, 1993
  * All rights reserved.   *      The Regents of the University of California.  All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions   * modification, are permitted provided that the following conditions
Line 32 
Line 32 
  */   */
   
 #if defined(LIBC_SCCS) && !defined(lint)  #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)vis.c       5.4 (Berkeley) 2/23/91";  static char sccsid[] = "@(#)vis.c       8.1 (Berkeley) 7/19/93";
 #endif /* LIBC_SCCS and not lint */  #endif /* LIBC_SCCS and not lint */
   
 #include <sys/types.h>  #include <sys/types.h>
   #include <limits.h>
 #include <ctype.h>  #include <ctype.h>
 #include <vis.h>  #include <vis.h>
   
Line 45  static char sccsid[] = "@(#)vis.c 5.4 (B
Line 46  static char sccsid[] = "@(#)vis.c 5.4 (B
  * vis - visually encode characters   * vis - visually encode characters
  */   */
 char *  char *
 #if __STDC__  
 vis(register char *dst, register char c, register int flag, char nextc)  
 #else  
 vis(dst, c, flag, nextc)  vis(dst, c, flag, nextc)
         register char *dst, c;          register char *dst;
         char nextc;          int c, nextc;
         register int flag;          register int flag;
 #endif  
 {  {
         if (isascii(c) && isgraph(c) ||          if ((u_int)c <= UCHAR_MAX && isgraph(c) ||
            ((flag & VIS_SP) == 0 && c == ' ') ||             ((flag & VIS_SP) == 0 && c == ' ') ||
            ((flag & VIS_TAB) == 0 && c == '\t') ||             ((flag & VIS_TAB) == 0 && c == '\t') ||
            ((flag & VIS_NL) == 0 && c == '\n') ||             ((flag & VIS_NL) == 0 && c == '\n') ||
Line 159  strvis(dst, src, flag)
Line 156  strvis(dst, src, flag)
         int flag;          int flag;
 {  {
         register char c;          register char c;
         char *start = dst;          char *start;
   
         for (;c = *src; src++)  
                 dst = vis(dst, c, flag, *(src+1));  
   
           for (start = dst; c = *src;)
                   dst = vis(dst, c, flag, *++src);
           *dst = '\0';
         return (dst - start);          return (dst - start);
 }  }
   
Line 174  strvisx(dst, src, len, flag)
Line 171  strvisx(dst, src, len, flag)
         register size_t len;          register size_t len;
         int flag;          int flag;
 {  {
         char *start = dst;          int c;
           char *start;
   
         while (len > 1) {          for (start = dst; len > 1; len--) {
                 dst = vis(dst, *src, flag, *(src+1));                  c = *src;
                 len--;                  dst = vis(dst, c, flag, *++src);
         }          }
         if (len)          if (len)
                 dst = vis(dst, *src, flag, '\0');                  dst = vis(dst, *src, flag, '\0');
           *dst = '\0';
   
         return (dst - start);          return (dst - start);
 }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2

CVSweb <webmaster@jp.NetBSD.org>