View Code
//file function: easier to compile and module#include#include #include int main(){ int n,temp; int filedes; char a[50]; printf("1:Navi\n2:Multimedia\nNo.:"); scanf("%d",&n);// printf("input the filename:\n");// scanf("%s",a);// filedes = open(a,O_CREAT | O_RDWR); if(n==1){ //printf("input the filename:\n"); //scanf("%s",a); //filedes = open(a,O_CREAT | O_RDWR); printf("\n1:build_all\n2:buildASR\n3:buildEUR\n4:buildPRC\n5:buildRUS\n6:obj_delete\n"); printf("No.:"); scanf("%d",&n); printf("\nname of outfile:\n"); scanf("%s",a); filedes = open(a,O_CREAT | O_RDWR); temp=dup(2); dup2(filedes,2); switch(n){ case 1: system("./navi/buildall.sh"); break; case 2: system("./navi/buildASR.sh"); break; case 3: system("./navi/buildEUR.sh"); break; case 4: system("./navi/buildPRC.sh"); break; case 5: system("./navi/buildRUS.sh"); break; case 6: system("./navi/navi_obj_del.sh"); return 0; default: break; } system("ls -l /home/naviwork/dso | grep 'navi_hmi*'");#if 1 dup2(temp,2); system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/navi_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/navi/interface/libif/x86a/* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_navi.so /home/naviwork/work/Module_files/"); printf("navi_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmi_core.out | grep 'undefined symbol*'"); printf("\nnavi_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmicprt.out | grep 'undefined symbol*'");#endif } else if(n==2){ printf("\n1:build_all\n2:buildASR\n3:buildEUR\n4:buildPRC\n5:buildRUS\n6:obj_delete\n"); printf("No.:"); scanf("%d",&n); printf("\nname of outfile:\n"); scanf("%s",a); temp=dup(2); filedes = open(a,O_CREAT | O_RDWR); dup2(filedes,2); switch(n){ case 1: system("./mm/buildall.sh"); break; case 2: system("./mm/buildASR.sh"); break; case 3: system("./mm/buildEUR.sh"); break; case 4: system("./mm/buildPRC.sh"); break; case 5: system("./mm/buildRUS.sh"); break; case 6: system("./mm/mm_obj_del.sh"); return 0; default: break; } system("ls -l /home/naviwork/dso | grep 'multimedia_hmi*'");#if 1 dup2(temp,2); system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/multimedia_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/multimedia/interface/libif/x86a/multimedia* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_multimedia.so /home/naviwork/work/Module_files/"); printf("multimedia_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmi_core.out | grep 'undefined symbol*'"); printf("\nmultimedia_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmicprt.out | grep 'undefined symbol*'");#endif } return 0;}
改进后的代码~界面稍微好了点,而且功能也有了修正..
View Code
//file function: easier to compile and module#include#include #include int main(){ int n,temp; int filedes; char a[50]; char for_3; printf("\n"); printf("1:Navi\n2:Multimedia\n3:ModuleWithNeuFiles\n4:EnviSet\nNo.:"); scanf("%d",&n);// printf("input the filename:\n");// scanf("%s",a);// filedes = open(a,O_CREAT | O_RDWR); if(n==1){ //printf("input the filename:\n"); //scanf("%s",a); //filedes = open(a,O_CREAT | O_RDWR); printf("\n1:build_all\n2:buildASR\n3:buildEUR\n4:buildPRC\n5:buildRUS\n6:boot_test\n7:obj_delete\n"); printf("No.:"); scanf("%d",&n); if(n==7){ system("sh ./navi/navi_obj_del.sh"); return 0; } else if(n==6){ system("sh ./navi/boot_test.sh"); return 0; } else if(n>7){ printf("input the correct number.\n"); return 0; } printf("\noutput filename:\n"); scanf("%s",a); filedes = open(a,O_CREAT | O_RDWR); temp=dup(2); dup2(filedes,2); switch(n){ case 1: system("sh ./navi/buildall.sh"); break; case 2: system("sh ./navi/buildASR.sh"); break; case 3: system("sh ./navi/buildEUR.sh"); break; case 4: system("sh ./navi/buildPRC.sh"); break; case 5: system("sh ./navi/buildRUS.sh"); break; //case 6: //system("./navi/navi_obj_del.sh"); //return 0; default: return 0; } system("ls -l /home/naviwork/dso | grep 'navi_hmi*'");#if 1 dup2(temp,2); system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/navi_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/navi/interface/libif/x86a/* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_navi.so /home/naviwork/work/Module_files/"); printf("navi_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmi_core.out | grep 'undefined symbol*'"); printf("\nnavi_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmicprt.out | grep 'undefined symbol*'");#endif } else if(n==2){ printf("\n1:build_all\n2:buildASR\n3:buildEUR\n4:buildPRC\n5:buildRUS\n6:boot_test\n7:obj_delete\n"); printf("No.:"); scanf("%d",&n); if(n==7){ system("sh ./mm/mm_obj_del.sh"); return 0; } else if(n==6){ system("sh ./mm/boot_test.sh"); return 0; } else if(n>7){ printf("input the correct number.\n"); return 0; } printf("\noutput filename:\n"); scanf("%s",a); temp=dup(2); filedes = open(a,O_CREAT | O_RDWR); dup2(filedes,2); switch(n){ case 1: system("sh ./mm/buildall.sh"); break; case 2: system("sh ./mm/buildASR.sh"); break; case 3: system("sh ./mm/buildEUR.sh"); break; case 4: system("sh ./mm/buildPRC.sh"); break; case 5: system("sh ./mm/buildRUS.sh"); break; //case 6: //system("./mm/mm_obj_del.sh"); //return 0; default: return 0; } system("ls -l /home/naviwork/dso | grep 'multimedia_hmi*'");#if 1 dup2(temp,2); system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/multimedia_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/multimedia/interface/libif/x86a/libmultimedia* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_multimedia.so /home/naviwork/work/Module_files/"); printf("multimedia_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmi_core.out | grep 'undefined symbol*'"); printf("\nmultimedia_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmicprt.out | grep 'undefined symbol*'");#endif } else if(n==3){ system("rm -f /home/naviwork/work/Module_files/*"); printf("\n1:Navi\n2:Multimedia\n"); printf("No.:"); scanf("%d",&n); if(n>2) printf("plz input the correct number\n"); else if(n==1){ //printf("1:NAM\n2:ASR\n3:EUR\n4:PRC\n5:RUS\nNo.:"); //scanf("%d",&n); system("rm -f /home/naviwork/work/Supported_files/*"); printf("\nplz copy files first..(Y/N)\n"); getchar(); scanf("%c",&for_3); while(for_3!='Y'){ printf("if copied,input 'Y':"); getchar(); scanf("%c",&for_3); } printf("\n1:NAM\n2:ASR\n3:EUR\n4:PRC\n5:RUS\nNo.:"); scanf("%d",&n); printf("\noutput filename:\n"); scanf("%s",a); filedes = open(a,O_CREAT | O_RDWR); temp=dup(2); dup2(filedes,2); switch(n){ case 1: system("sh ./navi/build_all"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./navi/navibuild_a.sh"); break; case 2: system("sh ./navi/build_ASR"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./navi/navibuildASR_a.sh"); break; case 3: system("sh ./navi/build_EUR"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./navi/navibuildEUR_a.sh"); break; case 4: system("sh ./navi/build_PRC"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./navi/navibuildPRC_a.sh"); break; case 5: system("sh ./navi/build_RUS"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./navi/navibuildRUS_a.sh"); break; default: return 0; } system("ls -l /home/naviwork/dso | grep 'navi_hmi*'"); dup2(temp,2); //system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/navi_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/navi/interface/libif/x86a/* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_navi.so /home/naviwork/work/Module_files/"); printf("navi_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmi_core.out | grep 'undefined symbol*'"); printf("\nnavi_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/navi_hmicprt.out | grep 'undefined symbol*'"); //system("cp /home/naviwork/work/Supported_files/*.a /home/naviwork/work/build_env/"); } else if(n==2){ system("rm -f /home/naviwork/work/Supported_files/*"); printf("\nplz copy files first...(Y/N)\n"); getchar(); scanf("%c",&for_3); while(for_3!='Y'){ printf("if copied,input 'Y':"); getchar(); scanf("%c",&for_3); } printf("\n1:NAM\n2:ASR\n3:EUR\n4:PRC\n5:RUS\nNo.:"); scanf("%d",&n); printf("\noutput filename:\n"); scanf("%s",a); filedes = open(a,O_CREAT | O_RDWR); temp=dup(2); dup2(filedes,2); switch(n){ case 1: system("sh ./mm/build_all"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./mm/multimediabuild_a.sh"); break; case 2: system("sh ./mm/build_ASR"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./mm/multimediabuildASR_a.sh"); break; case 3: system("sh ./mm/build_EUR"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./mm/multimediabuildEUR_a.sh"); break; case 4: system("sh ./mm/build_PRC"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./mm/multimediabuildPRC_a.sh"); break; case 5: system("sh ./mm/build_RUS"); system("cp /home/naviwork/work/Supported_files/*.so /home/naviwork/work/build_env/runtime/lib/x86a/"); system("sh ./mm/multimediabuildRUS_a.sh.sh"); break; default: return 0; } system("ls -l /home/naviwork/dso | grep 'multimedia_hmi*'"); dup2(temp,2); //system("rm /home/naviwork/work/Module_files/*"); system("cp /home/naviwork/dso/multimedia_hmi* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/work/build_env/multimedia/interface/libif/x86a/libmultimedia* /home/naviwork/work/Module_files/"); system("cp /home/naviwork/dso/libifin_multimedia.so /home/naviwork/work/Module_files/"); printf("multimedia_hmi_core.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmi_core.out | grep 'undefined symbol*'"); printf("\nmultimedia_hmicprt.out\n"); system("ldd -r /home/naviwork/work/Module_files/multimedia_hmicprt.out | grep 'undefined symbol*'"); } } else if(n==4){ system("mkdir /home/naviwork/work/Module_files"); system("mkdir /home/naviwork/work/Supported_files"); printf("Finished.\n"); } else{ printf("plz input the correct number.\n"); } return 0;}
哈哈,写完的时候,还是挺开心的...最近学linux的进程通信和TCPIP协议,努力加油吧!