Strnchr() -> memchr().
authorElan Amir <elan@ucbvax.Berkeley.EDU>
Wed, 19 May 1993 05:46:20 +0000 (21:46 -0800)
committerElan Amir <elan@ucbvax.Berkeley.EDU>
Wed, 19 May 1993 05:46:20 +0000 (21:46 -0800)
SCCS-vsn: usr.bin/sed/extern.h 5.7
SCCS-vsn: usr.bin/sed/misc.c 5.5
SCCS-vsn: usr.bin/sed/process.c 5.16

usr/src/usr.bin/sed/extern.h
usr/src/usr.bin/sed/misc.c
usr/src/usr.bin/sed/process.c

index 991b8b5..51cc157 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)extern.h    5.6 (Berkeley) %G%
+ *     @(#)extern.h    5.7 (Berkeley) %G%
  */
 
 extern struct s_command *prog;
  */
 
 extern struct s_command *prog;
@@ -28,7 +28,6 @@ char  *cu_fgets __P((char *, int));
 void    err __P((int, const char *, ...));
 int     mf_fgets __P((SPACE *, enum e_spflag));
 void    process __P((void));
 void    err __P((int, const char *, ...));
 int     mf_fgets __P((SPACE *, enum e_spflag));
 void    process __P((void));
-char   *strnchr __P((const char *, int c, size_t));
 char   *strregerror __P((int, regex_t *));
 void   *xmalloc __P((u_int));
 void   *xrealloc __P((void *, u_int));
 char   *strregerror __P((int, regex_t *));
 void   *xmalloc __P((u_int));
 void   *xrealloc __P((void *, u_int));
index 10cdace..afdc5f2 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)misc.c     5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c     5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -54,20 +54,6 @@ xrealloc(p, size)
        return (p);
 }
 
        return (p);
 }
 
-char *
-strnchr(buf, c, len)
-       const char *buf;
-       int c;
-       size_t len;
-{
-       const char *cp;
-       
-       for (cp = buf; cp - buf < len; cp++)
-               if (*cp == c)
-                       return ((char *)cp);
-       return (NULL);
-}
-
 /*
  * Return a string for a regular expression error passed.  This is a overkill,
  * because of the silly semantics of regerror (we can never know the size of
 /*
  * Return a string for a regular expression error passed.  This is a overkill,
  * because of the silly semantics of regerror (we can never know the size of
index 415d9fb..9e0f85e 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)process.c  5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)process.c  5.16 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -105,7 +105,7 @@ redirect:
                        case 'D':
                                if (pd)
                                        goto new;
                        case 'D':
                                if (pd)
                                        goto new;
-                               if ((p = strnchr(ps, '\n', psl)) == NULL)
+                               if ((p = memchr(ps, '\n', psl)) == NULL)
                                        pd = 1;
                                else {
                                        psl -= (p - ps) - 1;
                                        pd = 1;
                                else {
                                        psl -= (p - ps) - 1;
@@ -157,7 +157,7 @@ redirect:
                        case 'P':
                                if (pd)
                                        break;
                        case 'P':
                                if (pd)
                                        break;
-                               if ((p = strnchr(ps, '\n', psl)) != NULL) {
+                               if ((p = memchr(ps, '\n', psl)) != NULL) {
                                        oldc = *p;
                                        *p = '\0';
                                }
                                        oldc = *p;
                                        *p = '\0';
                                }