/* *********** Check comments starting with // ### and fill appropriate code there *********** */ #pragma implementation #include #include #include #include "nt2linux.h" #include "nt2linux.m" MODULE_DEFINE_VERSION(nt2linux); PUBLIC MODULE_nt2linux::MODULE_nt2linux() : LINUXCONF_MODULE("nt2linux") { linuxconf_loadmsg ("nt2linux",PACKAGE_REV); } static const char *keymenu=NULL; PUBLIC void MODULE_nt2linux::setmenu ( DIALOG &dia, MENU_CONTEXT context) { if (context == MENU_MISCSERV){ keymenu = MSG_U(M_nt2linux,"Import NT configuration"); dia.new_menuitem ("nt2linux","",keymenu); } } static void nt2linux_pickfile () { if (perm_rootaccess(MSG_U(P_IMPORTCONFIG ,"import configuration files"))){ SSTRING file; if (dialog_inputbox( MSG_U(T_EXPORTFILE,"Export.dat location") ,MSG_U(I_EXPORTFILE ,"You must provide the path of the export.dat file") ,help_nil ,file)==MENU_ACCEPT){ browse (file.get()); } } } PUBLIC int MODULE_nt2linux::domenu ( MENU_CONTEXT context, const char *key) { if (context == MENU_MISCSERV){ if (key == keymenu){ nt2linux_pickfile(); } } return 0; } PUBLIC int MODULE_nt2linux::dohtml (const char *key) { int ret = LNCF_NOT_APPLICABLE; if (strcmp(key,"nt2linux")==0){ // ### Insert any menu and dialog here ret = 0; } return ret; } static void usage() { xconf_error (MSG_U(T_USAGE ,"linuxconf --modulemain nt2linux usage\n" "\n" " nt2linux --option ...\n") ); } PUBLIC void MODULE_nt2linux::usage (SSTRINGS &tb) { tb.add (new SSTRING (MSG_R(T_USAGE))); } PUBLIC int MODULE_nt2linux::execmain (int argc , char *argv[], bool standalone) { int ret = LNCF_NOT_APPLICABLE; const char *pt = strrchr(argv[0],'/'); if (pt != NULL){ pt++; }else{ pt = argv[0]; } if (strcmp(pt,"nt2linux")==0){ ret = -1; if (argc == 1){ // ### Place call to main menu of the module nt2linux_pickfile(); }else{ // ### Add some option parsing for the module ::usage(); } } return ret; } static MODULE_nt2linux nt2linux;