#include "d:\include\osbind.mjh" main(argc,argv) int argc; char *argv[]; { int i,j,k,e,cnt,ch,ccnt,flug,flag,head,tail,count,flog,buffcnt,handle,p, int flow; char c,d; static char filename[] = {""}; static char buffer[8192]; char incmd[6]; char outcmd[7]; char runcmd[4]; incmd[0]='i'; incmd[1]='n'; incmd[2]='c'; incmd[3]='a'; incmd[4]='t'; incmd[5]='\0'; outcmd[0]='o'; outcmd[1]='u'; outcmd[2]='t'; outcmd[3]='c'; outcmd[4]='a'; outcmd[5]='t'; outcmd[6]='\0'; runcmd[0]='c'; runcmd[1]='a'; runcmd[2]='t'; runcmd[3]='\0'; if (argc != 2) { printf("\nuseage: gettext [%%][+]\n\n"); goto alpha; } flug = 0; flag = 0; flog = 0; k = 0; e = 1; flow = 0; Rsconf(-1,e,-1,-1,-1,-1); Vsync(); Vsync(); Vsync(); Vsync(); while (Bconstat(1) != 0) Bconin(1); while (Bconstat(2) != 0) Bconin(2); buffcnt = 0; while (incmd[buffcnt] != '\0') { Bconout(1,(int)incmd[buffcnt++]); } Bconout(1,(int)'\r'); d = ' '; while (d != 'y') { if (Bconstat(1) != 0) d = Bconin(1) & 0x7F; if (Bconstat(2) != 0) { while (Bconstat(2) != 0) d = Bconin(2) & 0x7F; goto gamma; } } /* printf("\nGetting file..."); */ buffcnt = 0; while (runcmd[buffcnt] != '\0') { Bconout(1,(int)runcmd[buffcnt++]); } Bconout(1,(int)' '); if (*argv[1] == '%') { flag = 1; argv[1]++;} if (*argv[1] == '+') { flog = 1; argv[1]++;} k = 0; while (filename[k] != '\0') {k++;} count = k; while (*argv[1] >= '!') { Bconout(1,(int)*argv[1]); /* printf("%c",*argv[1]); */ if (*argv[1] != '/') { filename[count++] = *argv[1]; } else { count = k; } argv[1]++; } argv[1]++; filename[count++] = '\0'; Bconout(1,(int)'\r'); /* printf("\n\n"); */ i = 0; j = 0; head = 0; tail = 0; d = '\0'; while (d < '\40') { if (Bconstat(1) != 0) { d = Bconin(1) & 0x7F; } if (Bconstat(2) != 0) { while (Bconstat(2) != 0) d = Bconin(2) & 0x7F; goto alpha; } } ch = 0; while (k <= 5000) { if ((Bconstat(1) != 0) && (flow == 0)) { if (ch != 0) { d = Bconin(1) & 0x7F; } ch = 1; cnt = 1; if (d == '\9') { cnt = 8; d = ' '; } for (ccnt=1 ; ccnt<=cnt ; ccnt++) { buffer[tail++] = d; if (tail >= 8190) { tail = 0; } if (((tail - head) == 3072) || ((head - tail) == 1024)) { Bconout(1,(int)'\23'); flow = 1; } } } if (head != tail) { j = 0; if (flog == 0) { while ((Bcostat(0) == 0) && (j < 100)) {j++;} if (j < 100) { Bconout(0,(int)buffer[head]); k=0; } } if (j < 100) { if (((i++ < 120) || (flag == 1) || (flog == 1)) && (buffer[head] != '\015')) { printf("%c",buffer[head]); } head++; if (head >= 8190) { head = 0; } if (((tail - head) == 1024) || ((head - tail) == 3072)) { Bconout(1,(int)'\21'); flow = 0; } k = 0; } } if (Bconstat(2) != 0) { d = Bconin(2); goto beta; } k++; } beta: if (flog == 0) { Bconout(0,(int)'\13'); Bconout(0,(int)'\13'); Bconout(0,(int)'\15'); } Bconout(1,(int)'\3'); printf("\n"); gamma: buffcnt = 0; while (outcmd[buffcnt] != '\0') { Bconout(1,(int)outcmd[buffcnt++]); } Bconout(1,(int)'\r'); alpha: Pterm(0); }