Annotation of coherent/b/lib/libc/string/i8086/strlen.m, revision 1.1.1.1

1.1       root        1: //////////
                      2: / i8086 C string library.
                      3: / strlen()
                      4: / ANSI 4.11.6.3.
                      5: //////////
                      6: 
                      7: //////////
                      8: / size_t
                      9: / strlen(String)
                     10: / char *String;
                     11: /
                     12: / Find length of String.
                     13: //////////
                     14: 
                     15: #include <larges.h>
                     16: 
                     17: String =       LEFTARG
                     18: 
                     19:        Enter(strlen_)
                     20:        Les     di, String(bp)  / String address to ES:DI
                     21:        cld
                     22:        mov     dx, di          / Save start
                     23:        mov     cx, $-1         / Max count to CX
                     24:        sub     ax, ax
                     25:        repne
                     26:        scasb                   / Scan to NUL
                     27:        dec     di              / Back up to match
                     28:        mov     ax, di
                     29:        sub     ax, dx          / &NUL - &start = length
                     30:        Leave

unix.superglobalmegacorp.com

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