int main (int argc, char **argv) { s_rules rr; if (argv[argc]) err(1, "bad argument list"); if (argc != 3) usage(argv[0]); if (strcmp(argv[1], "-c")) usage(argv[0]); openlog(argv[0], LOG_PID, LOG_AUTH); log_args("NEW", argc, (const char **)argv); init_package(); { const char *env_auth_id = getenv(ENV_AUTH_ID); t_sym id = sympackage_intern(&g_sympkg, env_auth_id ? env_auth_id : ""); s_symtable cmd; cmd_init(&cmd, id, argv[2]); rules_init(&rr); rules_read(&rr, "/etc/git-auth.conf"); { int auth_ok = auth(&rr, &cmd); rules_free(&rr); log_rule(auth_ok ? "ALLOW" : "DENY", &cmd); if (auth_ok) { exec_cmd(&cmd); // never reached } } log_rule("DENY", &cmd); } cleanup(); return 1; }
void rf_init(unsigned short panid,unsigned short nwkaddr,unsigned char channel){ uz_init(); uz_set_tx_power(0); uz_enable_ext_wakeup(); uz_set_channel(channel); uz_set_panId(panid); uz_set_nwk_addr(nwkaddr); init_package(panid,nwkaddr); set_tx_dst_panid(0xffff); set_tx_dst_nwk_addr(0xffff); uz_rx_normal_mode(); }
static int manage_package_mode(const std::string &packagename, bool manager, int processor, const CmdArgs &args) { CmdArgs::const_iterator it = args.begin(); CmdArgs::const_iterator end = args.end(); bool stop = false; vle::utils::Package pkg(packagename); if (not init_package(pkg, args)) return EXIT_FAILURE; for (; not stop and it != end; ++it) { if (*it == "create") { pkg.create(); } else if (*it == "configure") { pkg.configure(); pkg.wait(std::cerr, std::cerr); stop = not pkg.isSuccess(); } else if (*it == "build") { pkg.build(); pkg.wait(std::cerr, std::cerr); if (pkg.isSuccess()) { pkg.install(); pkg.wait(std::cerr, std::cerr); } stop = not pkg.isSuccess(); } else if (*it == "test") { pkg.test(); pkg.wait(std::cerr, std::cerr); stop = not pkg.isSuccess(); } else if (*it == "install") { pkg.install(); pkg.wait(std::cerr, std::cerr); stop = not pkg.isSuccess(); } else if (*it == "clean") { pkg.clean(); pkg.wait(std::cerr, std::cerr); stop = not pkg.isSuccess(); } else if (*it == "rclean") { pkg.rclean(); } else if (*it == "package") { pkg.pack(); pkg.wait(std::cerr, std::cerr); stop = not pkg.isSuccess(); } else if (*it == "all") { std::cerr << "all is not yet implemented\n"; stop = true; } else if (*it == "depends") { std::cerr << "Depends is not yet implemented\n"; stop = true; } else if (*it == "list") { show_package_content(pkg); } else { break; } } int ret = EXIT_SUCCESS; if (stop) ret = EXIT_FAILURE; else if (it != end) { #ifndef NDEBUG vle::devs::ExternalEvent::allocated = 0; vle::devs::ExternalEvent::deallocated = 0; vle::devs::InternalEvent::allocated = 0; vle::devs::InternalEvent::deallocated = 0; vle::value::Value::allocated = 0; vle::value::Value::deallocated = 0; #endif if (manager) ret = run_manager(it, end, processor, pkg); else ret = run_simulation(it, end, pkg); #ifndef NDEBUG std::cerr << vle::fmt(_("\n - Debug mode:\n" " allocated deallocated\n" " - External events: %=12d/%=12d\n" " - Internal events: %=12d/%=12d\n" " - Values : %=12d/%=12d\n")) % vle::devs::ExternalEvent::allocated % vle::devs::ExternalEvent::deallocated % vle::devs::InternalEvent::allocated % vle::devs::InternalEvent::deallocated % vle::value::Value::allocated % vle::value::Value::deallocated; #endif } return ret; }