/* write (pack) content of the current directory in 'zipfile' */ int zwrite(const char *zipfile) { const char *args[6]; args[0] = "zip"; args[1] = "-q"; args[2] = "-r"; args[3] = zipfile; args[4] = workdir; args[5] = NULL; return zrun(args[0], args); }
/*void timer0( ) interrupt 1 //定时器0工作方式1 { anjian(); TH0=(65536-2)/256; //重装计数初值 TL0=(65536-2)%256; //重装计数初值 } */ main() { a=0; b=0; /*TMOD=0X01; //定时器中断0 TH0=(65536-2)/256; //定时时间高八位初值 TL0=(65536-2)%256; //定时时间低八位初值 EA=1; //开CPU中断 ET0=1; //开T/C0中断 TR0=1; */ while(1) { if(P2_0==0) { while(!P2_0); b=1; } if(P2_1==0) { while(!P2_1); b=2; } anjian(); switch(b) { case 0: break; case 1: frun();break; case 2: zrun(); break; default:break; } switch(a) { case 0:y=100; P3=ZERO;break; case 1:y=75; P3=ONE; break; case 2:y=60; P3=TWO; break; case 3:y=45; P3=THREE;break; case 4:y=35; P3=FOUR; break; case 5:y=25; P3=FIVE; break; case 6:y=20; P3=SIX; break; case 7:y=16; P3=SEVEN;break; case 8:y=12; P3=EIGHT; break; case 9:y=8; P3=NINE; break; default:break; } } }
/* read (extract) 'zipfile' in current directory */ int zread(const char *zipfile, unsigned long long maxsize) { int rc; const char *args[6]; args[0] = "unzip"; args[1] = "-q"; args[2] = "-d"; args[3] = workdir; args[4] = zipfile; args[5] = NULL; file_reset(); rc = zrun(args[0], args); if (!rc) rc = fill_files(); return rc; }