Annotation of cci/usr/src/bin/cdb/symln.c, revision 1.1

1.1     ! root        1: static char sccsid[] = "@(#)symln.c    2.4";
        !             2: 
        !             3: #include <stdio.h>
        !             4: #include "basic.h"
        !             5: 
        !             6: main()
        !             7: {
        !             8:        short   cchStrCret0, cchStrData, cchStrText;
        !             9:        short   cchStrLine, lnLast, ln;
        !            10:        FLAGT   fText;
        !            11:        char    *dotptr, *strLine, str2[200], str[200];
        !            12:        char    *strCret0, *strText, *strData;
        !            13: 
        !            14:        char    *strrchr();
        !            15: 
        !            16:        strLine = "//   line ";
        !            17:        cchStrLine = strlen(strLine);
        !            18:        strText = "     .text";
        !            19:        cchStrText = strlen(strText);
        !            20:        strData = "     .data";
        !            21:        cchStrData = strlen(strData);
        !            22:        strCret0 = "    jpr     cret0";
        !            23:        cchStrCret0 = strlen(strCret0);
        !            24:        ln = -1;
        !            25:        lnLast = -2;
        !            26: 
        !            27:        fText = true;  /* this is the state the assembler starts in */
        !            28:        while (gets(str) != NULL) {
        !            29:                if (!fText) {
        !            30:                        if (strncmp(str, strText, cchStrText) == 0) {
        !            31:                                fText = true;   /* we are back in text mode */
        !            32:                        } /* if */
        !            33:                        puts(str);
        !            34:                } 
        !            35:                else if (strncmp(str, strLine, cchStrLine) == 0) {
        !            36:                        dotptr = strrchr(str, '.');
        !            37:                        if (dotptr == 0 OR dotptr[1] != 'h') {
        !            38:                                ln = atoi(&str[cchStrLine]);
        !            39:                                if (ln != lnLast) {
        !            40:                                        sprintf(str, "~_lN%d:",ln);
        !            41:                                        lnLast = ln;
        !            42:                                        puts(str);
        !            43:                                } /* if */
        !            44:                        } /* if */
        !            45:                } 
        !            46:                else if (strncmp(str, strCret0, cchStrCret0) == 0) {
        !            47:                        ln = lnLast + 1;
        !            48:                        sprintf(str2, "~_lN%d:\n~_lE%d:", ln, ln);
        !            49:                        lnLast = ln;
        !            50:                        puts(str2);
        !            51:                        puts(str);
        !            52:                } 
        !            53:                else if (strncmp(str, strData, cchStrData) == 0) {
        !            54:                        fText = false;
        !            55:                        puts(str);
        !            56:                } 
        !            57:                else {
        !            58:                        puts(str);
        !            59:                } /* if */
        !            60:        } /* while */
        !            61:        exit(0);
        !            62: } /* main */

unix.superglobalmegacorp.com

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