Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

memccpy(3)

string(3)

swab(3)

bcopy(3)  —  Subroutines

NAME

bcopy, bcmp, bzero, ffs − Performs bit and byte string operations

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <string.h> void bcopy (

    const char ∗source,
    char ∗destination,
    int length ); int bcmp (
    const char ∗string1,
    const char ∗string2,
    int length ); void bzero (
    char ∗string,
    int length ); int ffs (
    int index );

PARAMETERS

sourcePoints to the original string for the bcopy() function. 

destinationPoints to the destination string for the bcopy() function. 

string1Specifies the byte string to be compared to the string2 parameter by the bcmp() function. 

string2Specifies the byte string to be compared to the string1 parameter by the bcmp() function. 

lengthSpecifies the length (in bytes) of the string. 

indexSpecifies the bit whose index should be returned. 

DESCRIPTION

The bcopy(), bcmp(), and bzero() functions operate on variable length strings of bytes.  Unlike the string functions, they do not check for null bytes. 

The bcopy() function copies the value of the length parameter in bytes from the string in the source parameter to the string in the destination parameter. 

The bcmp() function compares the byte string in the string1 parameter against the byte string of the string2 parameter, returning a 0 (zero) value if the two strings are identical and a nonzero value otherwise. 

The bzero() function nulls the string in the string parameter, for the value of the length parameter in bytes. 

The ffs() function finds the first bit set in the argument passed to it and returns the index of that bit.  Bits are numbered starting at 1.  A return value of 0 (zero) indicates that the value passed is 0. 

NOTES

The bcopy() function takes parameters backwards from the strcpy() function. 

RELATED INFORMATION

Functions: memccpy(3), string(3), swab(3)

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