void templateeditfrm::init() { vars v; QStringList sgeo = v.loadgeo ( this->objectName() ); if ( sgeo.size() > 0 ) { if ( sgeo[0] == "1" ) this->setWindowState ( this->windowState() ^ Qt::WindowMaximized ); this->setGeometry ( sgeo[1].toInt(), sgeo[2].toInt(), sgeo[3].toInt(), sgeo[4].toInt() ); } templateid = ""; connect ( btnimport, SIGNAL ( released() ), this, SLOT ( importfile() ) ); connect ( btncancel, SIGNAL ( released() ), this, SLOT ( close() ) ); connect ( btnaccept, SIGNAL ( released() ), this, SLOT ( savetemplate() ) ); }
int shell(int *g) { char command[BUFFER_SIZE]; char func[BUFFER_SIZE],arg1[BUFFER_SIZE],arg2[BUFFER_SIZE]; int i; minifile_cd("/"); //cd to root (will also initialize the system if necessary) printf("%s\n", IDstring); while(1) { memset(command,'\0',BUFFER_SIZE); memset(func,'\0',BUFFER_SIZE); memset(arg1,'\0',BUFFER_SIZE); memset(arg2,'\0',BUFFER_SIZE); put_prompt(); gets(command); //extract first three strings in command (delimited by spaces) sscanf(command,"%s %s %s",func,arg1,arg2); if(strcmp(func,"help") == 0) help_screen(); else if(strcmp(func,"cd") == 0) minifile_cd(arg1); else if(strcmp(func,"ls") == 0 || strcmp(func,"dir") == 0) { char **files = minifile_ls(arg1); printf("File listing for %s\n", arg1); for(i = 0; files != NULL && files[i] != NULL; ++i) { printf("\t%s\n",files[i]); free(files[i]); } if(files != NULL) free(files); } else if(strcmp(func,"pwd") == 0) printf("%s\n", minifile_pwd()); else if(strcmp(func,"mkdir") == 0) minifile_mkdir(arg1); else if(strcmp(func,"rmdir") == 0) minifile_rmdir(arg1); else if(strcmp(func,"rm") == 0 || strcmp(func,"del") == 0) minifile_unlink(arg1); else if(strcmp(func,"import") == 0) importfile(arg1,arg2); else if(strcmp(func,"export") == 0) exportfile(arg1,arg2); else if(strcmp(func,"type") == 0) typefile(arg1); else if(strcmp(func,"input") == 0) inputfile(arg1); else if(strcmp(func,"cp") == 0 || strcmp(func,"copy") == 0) copy(arg1,arg2); else if(strcmp(func,"mv") == 0 || strcmp(func,"move") == 0) move(arg1,arg2); else if(strcmp(func,"whoami") == 0) printf("You are minithread %d, running our shell\n",minithread_id()); else if(strcmp(func,"exit") == 0) break; else if(strcmp(func,"doscmd") == 0) system(command+7); else if(strcmp(func,"exec") == 0) { //this is not efficient -- just for fun!!! char cmdline[BUFFER_SIZE]; memset(cmdline,'\0',BUFFER_SIZE); strcpy(cmdline,"tmp0000~.exe "); strcpy(cmdline+13,command+5+strlen(arg1)); exportfile(arg1,"tmp0000~.exe"); system(cmdline); system("rm tmp0000~.exe"); } else printf("%s: Command not found\n",func); } printf("Good-bye :-)\n"); return 0; }