|
|
1.1 ! root 1: /* @(#)util.c 1.2 */ ! 2: /* 3.0 SID # 1.2 */ ! 3: #include <sys/types.h> ! 4: #include <sys/stat.h> ! 5: #include <sys/dir.h> ! 6: #include "fio.h" ! 7: #define DIRSIZE 14 ! 8: g_char(a,alen,b) char *a,*b; ftnlen alen; ! 9: { char *x=a+alen-1,*y=b+alen-1; ! 10: *(y+1)=0; ! 11: for(;x>=a && *x==' ';x--) *y--=0; ! 12: for(;x>=a;*y--= *x--); ! 13: } ! 14: b_char(a,b,blen) char *a,*b; ftnlen blen; ! 15: { int i; ! 16: for(i=0;i<blen && *a!=0;i++) *b++= *a++; ! 17: for(;i<blen;i++) *b++=' '; ! 18: } ! 19: inode(a) char *a; ! 20: { struct stat x; ! 21: if(stat(a,&x)<0) return(-1); ! 22: return(x.st_ino); ! 23: } ! 24: #define DONE {*bufpos++=0; (void) close(file); return;} ! 25: #define INTBOUND sizeof(int)-1 ! 26: #define register ! 27: mvgbt(n,len,a,b) char *a,*b; ! 28: { register int num=n*len; ! 29: if( ((int)a&INTBOUND)==0 && ((int)b&INTBOUND)==0 && (num&INTBOUND)==0 ) ! 30: { register int *x=(int *)a,*y=(int *)b; ! 31: num /= sizeof(int); ! 32: if(x>y) for(;num>0;num--) *y++= *x++; ! 33: else for(num--;num>=0;num--) *(y+num)= *(x+num); ! 34: } ! 35: else ! 36: { register char *x=a,*y=b; ! 37: if(x>y) for(;num>0;num--) *y++= *x++; ! 38: else for(num--;num>=0;num--) *(y+num)= *(x+num); ! 39: } ! 40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.