// univifconf.cpp : UnivIF configuration program // #include "stdafx.h" #include "univiflib.h" #include int _tmain(int argc, _TCHAR* argv[]) { int bsn=-1,i,debug=0; char *conffile=NULL; if(argc==1) { puts("\nUniversal Interface board Configuration program" " by kumagai\n" " univifconf (-d) :load conf_file\n" " univifconf (-d) :disable device\n"); } argc--; argv++; while(argc>0) { char *endptr; if(strcmp(argv[0],"-d")==0) { debug=1; argc--; argv++; continue; } strtol(argv[0],&endptr,16); if((argc>0)&&(argv[0]!=endptr)) { bsn=strtol(argv[0],&endptr,16); if((bsn<0) || (bsn>31)) { fprintf(stderr,"Illegal BSN: %d\n",bsn); return 3; } if(argc>1) { conffile=argv[1]; argv+=2; argc-=2; } else { conffile="disable"; argv+=1; argc-=1; } } else { fprintf(stderr,"Illegal options\n"); return 1; } } if(debug) puts(""); uiflib_debug=debug; // ====================================================================== // コンフィグレーション開始 if(bsn<0) { DumpDeviceList(); getchar(); return 1; } if(strcmp(conffile,"disable")==0) { fprintf(stderr,"Disable BSN 0x%X\n\n",bsn); DisableUNIVIF(bsn); return 1; } if(ConfigureUNIVIF(bsn,conffile)) { DumpDeviceList(); return 1; } return 0; }