void Background() { int i; setfillstyle(1,3); bar(0,0,640,480); for(i=0;i<=15;i++) { setcolor(i); rectangle(0+i,0+i,640-i,480-i); } win("BRAINVITA",145,45,505,400,1); // winp(159,79,491,381,1); win("Keys",24,45,135,290,1); win("Help !",510,45,625,250,1); setfillstyle(1,0); bar(35,75,125,280); bar(520,75,618,240); winp(35,75,125,280,1); winp(520,75,618,240,1); setcolor(14); settextstyle(2,0,4); outtextxy(42,80,"Keys used"); setcolor(15); outtextxy(42,100,"+ or- : color"); outtextxy(47,120,"� : Up"); outtextxy(47,140,"� : Down"); outtextxy(42,160,"<- : Left"); outtextxy(42,180,"-> : Right"); outtextxy(42,200,"Enter : Pick"); outtextxy(42,220,"S : save game"); outtextxy(42,240,"L : load game"); outtextxy(42,260,"Esc : Exit"); line(47,120,50,123); line(47,120,43,123); line(47,140,50,143); line(47,140,43,143); outtextxy(523,80,"Use Arrow Keys"); outtextxy(523,100,"to move around"); outtextxy(523,120,"then press enter"); outtextxy(523,140,"to select any"); outtextxy(523,160,"marble,then jump"); outtextxy(523,180,"over another to"); outtextxy(523,200,"remove it."); win("",190,410,480,460,0); setfillstyle(1,0); bar(200,420,470,450); settextstyle(1,0,3); setcolor(10); outtextxy(220,420,"Marbles :"); }
int main(int argc, char **argv) { time_t tloc; struct tm *tmp; int year; int month; off_t rectmpin; (void) setlocale(LC_ALL, ""); setbuf(stdout, NULL); (void) time(&tloc); tmp = localtime(&tloc); year = tmp->tm_year; month = tmp->tm_mon + 1; lastmonth = ((year + 1900 - 1970) * 365 + (month - 1) * 30) * DAYEPOCH; nextmonth = ((year + 1900 - 1970) * 365 + (month + 1) * 30) * DAYEPOCH; if (argc < 2) { argv[argc] = "-"; argc++; } /* * Almost all system call failures in this program are unrecoverable * and therefore fatal. Typical causes might be lack of memory or * of space in a filesystem. If necessary, the system administrator * can invoke /usr/lib/acct/runacct interactively after making room * to complete the remaining phases of last night's accounting. */ if ((Temp = tmpfile()) == NULL) { perror("Cannot create temporary file"); return (EXIT_FAILURE); } while (--argc > 0) { argv++; if (strcmp(*argv, "-") == 0) { Wtmpx = stdin; cur_input_name = STDIN_NAME; } else if ((Wtmpx = fopen(*argv, "r")) == NULL) { (void) fprintf(stderr, "Cannot open %s: %s\n", *argv, strerror(errno)); return (EXIT_FAILURE); } else { cur_input_name = *argv; } /* * Filter records reading from current input stream Wtmpx, * writing to Temp. */ scanfile(); if (Wtmpx != stdin) (void) fclose(Wtmpx); } /* flush and rewind Temp for readback */ if (fflush(Temp) != 0) { perror("<temporary file>: fflush"); return (EXIT_FAILURE); } if (fseeko(Temp, (off_t)0L, SEEK_SET) != 0) { perror("<temporary file>: seek"); return (EXIT_FAILURE); } /* second pass: apply time adjustments */ rectmpin = 0; while (winp(Temp, &Ut)) { adjust(rectmpin, &Ut); rectmpin += UTRSZ; if (fwrite(&Ut, UTRSZ, 1, stdout) < 1) { perror("<stdout>: fwrite"); return (EXIT_FAILURE); } } (void) fclose(Temp); /* * Detect if we've run out of space (say) and exit unsuccessfully * so that downstream accounting utilities won't start processing an * incomplete tmpwtmp file. */ if (fflush(stdout) != 0) { perror("<stdout>: fflush"); return (EXIT_FAILURE); } return (EXIT_SUCCESS); }