Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bcmp(3C) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

reentrant(3)

memcmp(3C)



bcmp(3C)                       DG/UX 5.4R3.00                       bcmp(3C)


NAME
       bcmp - compare two areas of memory

SYNOPSIS
       int bcmp(), result, length;
       char *ptr1, *ptr2;
       ...
       result = bcmp(ptr1, ptr2, length);

   where:
       ptr1      A pointer to the first area.
       ptr2      A pointer to the second area.
       length    The number of bytes to compare.

DESCRIPTION
       The bcmp function compares two areas of memory, byte by byte, as
       unsigned values.  It compares the number of bytes you specify with
       length; this function comes from the University of California
       Berkeley UNIX (BSD) system.  Unlike the memcmp function, the bcmp
       function tests only for equality.  This function does not indicate
       whether the first area is greater or less than the second area.


   Considerations for Threads Programming
                     +---------+-----------------------------+
                     |         |                      async- |
                     |function | reentrant   cancel   cancel |
                     |         |              point    safe  |
                     +---------+-----------------------------+
                     |bcmp     |     Y          N        N   |
                     +---------+-----------------------------+

RETURN VALUE
       The bcmp function returns 0 if the areas are equal.  Otherwise, it
       returns a nonzero value.  However, if length is negative, the
       function bcmp returns 0.

EXAMPLE
       The following program compares an input string to the username mike.

       /* Program test for the bcmp() function */

       #include <stdio.h>

       int bcmp();
       char buf[80];

       main() {
           printf("Type in a name:  ");
           if (fgets(buf, sizeof(buf), stdin)) {
               if (!bcmp(buf, "mike\n", 5))
                   printf("You typed mike!\n");
               else
                   printf("You did not type mike.\n");



Licensed material--property of copyright holder(s)                         1




bcmp(3C)                       DG/UX 5.4R3.00                       bcmp(3C)


           }
           return 0;
       }

SEE ALSO
       reentrant(3), memcmp(3C).



















































Licensed material--property of copyright holder(s)                         2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026