This software was done in part for a textbook on AI I ve written called _The Basis of AI_ (tentative

源代码在线查看: license.c

软件大小: 8290 K
上传用户: lixuecheng
关键词: tentative software textbook written
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 				#include 				#include 								#define equal(s1,s2) (strcmp(s1,s2)==0)								main(int argc, char** argv) {								char* lfname = ".license";				FILE* file;				char s[128];				int ok;								if (argc > 1) lfname = argv[1];								file = fopen(lfname,"w");				fputs("LEDA LICENSE FILE",file);				fclose(file);								if (getenv("NO_LICENSE_CHECK")) exit(0);												file = fopen("license.txt","r");				while (fgets(s,128,file)) printf("%s",s);				fclose(file);				printf("Do you want to continue? ");				fflush(stdout);								for(;;)				{ scanf("%s",s);				  if (equal(s,"no")  || equal(s,"NO")  || equal(s,"No"))  { ok = 0; break; }				  if (equal(s,"yes") || equal(s,"YES") || equal(s,"Yes")) { ok = 1; break; }				  printf("\nPlease type YES or NO: ");				}												if (ok)				   printf("Ok, installation continues.\n");				else				  { sprintf(s,"del %s > NUL",lfname);				    system(s);				    printf("Installation stopped.\n");				   }								printf("\n");								return 0;								}							

相关资源