Annotation of 43BSDTahoe/ucb/tn3270/general/general.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that this notice is preserved and that due credit is given
                      7:  * to the University of California at Berkeley. The name of the University
                      8:  * may not be used to endorse or promote products derived from this
                      9:  * software without specific prior written permission. This software
                     10:  * is provided ``as is'' without express or implied warranty.
                     11:  *
                     12:  *     @(#)general.h   3.2 (Berkeley) 3/28/88
                     13:  */
                     14: 
                     15: /*
                     16:  * Some general definitions.
                     17:  */
                     18: 
                     19: #define        numberof(x)     (sizeof x/sizeof x[0])
                     20: #define        highestof(x)    (numberof(x)-1)
                     21: 
                     22: #if    defined(unix)
                     23: #define        ClearElement(x)         bzero((char *)&x, sizeof x)
                     24: #define        ClearArray(x)           bzero((char *)x, sizeof x)
                     25: #else  /* defined(unix) */
                     26: #define        ClearElement(x)         memset((char *)&x, 0, sizeof x)
                     27: #define        ClearArray(x)           memset((char *)x, 0, sizeof x)
                     28: #endif /* defined(unix) */
                     29: 
                     30: #if    defined(unix)           /* Define BSD equivalent mem* functions */
                     31: #define        memcpy(dest,src,n)      bcopy(src,dest,n)
                     32: #define        memmove(dest,src,n)     bcopy(src,dest,n)
                     33: #define        memset(s,c,n)           if (c == 0) { \
                     34:                                    bzero(s,n); \
                     35:                                } else { \
                     36:                                    register char *src = s; \
                     37:                                    register int count = n; \
                     38:                                        \
                     39:                                    while (count--) { \
                     40:                                        *src++ = c; \
                     41:                                    } \
                     42:                                }
                     43: #define        memcmp(s1,s2,n)         bcmp(s1,s2,n)
                     44: #endif /* defined(unix) */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.