Annotation of researchv10dc/libI77/util.c, revision 1.1

1.1     ! root        1: #ifndef NON_UNIX_STDIO
        !             2: #include "sys/types.h"
        !             3: #include "sys/stat.h"
        !             4: #endif
        !             5: #include "f2c.h"
        !             6: #include "fio.h"
        !             7: 
        !             8:  VOID
        !             9: #ifdef KR_headers
        !            10: g_char(a,alen,b) char *a,*b; ftnlen alen;
        !            11: #else
        !            12: g_char(char *a, ftnlen alen, char *b)
        !            13: #endif
        !            14: {
        !            15:        char *x = a + alen, *y = b + alen;
        !            16: 
        !            17:        for(;; y--) {
        !            18:                if (x <= a) {
        !            19:                        *b = 0;
        !            20:                        return;
        !            21:                        }
        !            22:                if (*--x != ' ')
        !            23:                        break;
        !            24:                }
        !            25:        *y-- = 0;
        !            26:        do *y-- = *x;
        !            27:                while(x-- > a);
        !            28:        }
        !            29: 
        !            30:  VOID
        !            31: #ifdef KR_headers
        !            32: b_char(a,b,blen) char *a,*b; ftnlen blen;
        !            33: #else
        !            34: b_char(char *a, char *b, ftnlen blen)
        !            35: #endif
        !            36: {      int i;
        !            37:        for(i=0;i<blen && *a!=0;i++) *b++= *a++;
        !            38:        for(;i<blen;i++) *b++=' ';
        !            39: }
        !            40: #ifndef NON_UNIX_STDIO
        !            41: #ifdef KR_headers
        !            42: long f__inode(a, dev) char *a; int *dev;
        !            43: #else
        !            44: long f__inode(char *a, int *dev)
        !            45: #endif
        !            46: {      struct stat x;
        !            47:        if(stat(a,&x)<0) return(-1);
        !            48:        *dev = x.st_dev;
        !            49:        return(x.st_ino);
        !            50: }
        !            51: #endif
        !            52: 
        !            53: #define INTBOUND sizeof(int)-1
        !            54:  VOID
        !            55: #ifdef KR_headers
        !            56: f__mvgbt(n,len,a,b) char *a,*b;
        !            57: #else
        !            58: f__mvgbt(int n, int len, char *a, char *b)
        !            59: #endif
        !            60: {      register int num=n*len;
        !            61:        if( ((int)a&INTBOUND)==0 && ((int)b&INTBOUND)==0 && (num&INTBOUND)==0 )
        !            62:        {       register int *x=(int *)a,*y=(int *)b;
        !            63:                num /= sizeof(int);
        !            64:                if(x>y) for(;num>0;num--) *y++= *x++;
        !            65:                else for(num--;num>=0;num--) *(y+num)= *(x+num);
        !            66:        }
        !            67:        else
        !            68:        {       register char *x=a,*y=b;
        !            69:                if(x>y) for(;num>0;num--) *y++= *x++;
        !            70:                else for(num--;num>=0;num--) *(y+num)= *(x+num);
        !            71:        }
        !            72: }

unix.superglobalmegacorp.com

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