#include #include #include #include #include #define ICONSIZE 48 #define ICONBYTES (ICONSIZE*(ICONSIZE/8)) #define ICONWORDS (ICONSIZE*(ICONSIZE/16)) #define ICONPATH "/usr/dmd/icon/face48/" #define ICONLEN strlen(ICONPATH) char iconfile[100]=ICONPATH; main(argc, argv) char *argv[]; { register i; struct sgttyb modes; if(argc==1){ fprintf(stderr, "usage: face moniker ...\n"); return 1; } if(system("32ld Catalog.m")){ fprintf(stderr, "face: 32ld errors\n"); return 1; } ioctl(1, TIOCGETP, &modes); modes.sg_flags|=RAW; ioctl(1, TIOCSETP, &modes); for(i=1; i='0') && (Hex<='9')) return(Hex-'0'); if ((Hex>='A') && (Hex<='F')) return(10+Hex-'A'); if ((Hex>='a') && (Hex<='f')) return(10+Hex-'a'); return(-1); } sendicon(p) char *p; { FILE *icon; struct stat statbuf; char buf[6], IconBuf[ICONBYTES]; char *ip; int i,val; if(p[0]=='/') ip=p; else{ strncpy(iconfile+ICONLEN, p, 100-ICONLEN); ip=iconfile; } if (stat(ip, &statbuf)<0){ strncpy(iconfile+ICONLEN, "unknown", 100-ICONLEN); ip=iconfile; } if ((icon = fopen(ip, "r")) != NULL) for (i=0; i