本文整理汇总了C++中doSystem函数的典型用法代码示例。如果您正苦于以下问题:C++ doSystem函数的具体用法?C++ doSystem怎么用?C++ doSystem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doSystem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: disconnect_ndis
int
disconnect_ndis(int devnum)
{
int valid_node, qmi_mode = 0;
char control_node[16] = {0};
// check wdm device
valid_node = find_modem_node("cdc-wdm", 0, 0, -1, NULL); // todo (need devnode for cdc-wdm)
if (valid_node >= 0) {
qmi_mode = 1;
sprintf(control_node, "cdc-wdm%d", valid_node);
}
else {
// check serial device
valid_node = get_modem_node("ttyUSB", devnum, NULL);
if (valid_node >= 0)
sprintf(control_node, "ttyUSB%d", valid_node);
}
if (strlen(control_node) > 0) {
if (!qmi_mode) {
int vid = 0, pid = 0;
get_modem_vid_pid(control_node, &vid, &pid);
if ( (vid == 0x1199 || vid == 0x0f3d) && (pid == 0x68a3 || pid == 0x68aa) )
return doSystem("/bin/comgt -d /dev/%s -s %s/ppp/3g/%s", control_node, MODEM_SCRIPTS_DIR, "Sierra_disconn.scr");
else
return doSystem("/bin/comgt -d /dev/%s -s %s/ppp/3g/%s", control_node, MODEM_SCRIPTS_DIR, "NDIS_disconn.scr");
}
else
return qmi_stop_network(control_node);
}
return 1;
}
开发者ID:schidler,项目名称:flyzjhz-rt-n56u,代码行数:34,代码来源:usb_modem.c
示例2: safe_remove_usb_modem
void
safe_remove_usb_modem(void)
{
doSystem("killall %s %s", "-q", "usb_modeswitch");
doSystem("killall %s %s", "-q", "eject");
if (nvram_get_int("modem_type") == 3)
{
char* svcs[] = { "udhcpc", NULL };
if (pids(svcs[0]))
{
doSystem("killall %s %s", "-SIGUSR2", svcs[0]);
usleep(300000);
kill_services(svcs, 3, 1);
}
stop_wan_usbnet();
// unlink_modem_ndis();
}
else
{
char* svcs_ppp[] = { "pppd", NULL };
kill_services(svcs_ppp, 10, 1);
// unlink_modem_ras();
}
set_usb_modem_dev_wan(0, 0);
}
开发者ID:PterX,项目名称:rt-n56u,代码行数:31,代码来源:usb_modem.c
示例3: stop_modem_ndis
void
stop_modem_ndis(void)
{
int i, modem_devnum = 0;
char node_fname[64];
char ndis_ifname[16] = {0};
doSystem("killall %s %s", "-q", "usb_modeswitch");
doSystem("killall %s %s", "-q", "eject");
if (get_modem_ndis_ifname(ndis_ifname, &modem_devnum)) {
disconnect_ndis(modem_devnum);
if (is_interface_exist(ndis_ifname))
ifconfig(ndis_ifname, 0, "0.0.0.0", NULL);
}
for (i=0; i<MAX_USB_NODE; i++)
{
sprintf(node_fname, "%s/ttyUSB%d", MODEM_NODE_DIR, i);
unlink(node_fname);
sprintf(node_fname, "%s/cdc-wdm%d", MODEM_NODE_DIR, i);
unlink(node_fname);
sprintf(node_fname, "%s/weth%d", MODEM_NODE_DIR, i);
unlink(node_fname);
sprintf(node_fname, "%s/wwan%d", MODEM_NODE_DIR, i);
unlink(node_fname);
}
}
开发者ID:schidler,项目名称:flyzjhz-rt-n56u,代码行数:31,代码来源:usb_modem.c
示例4: storageDiskPart
static void storageDiskPart(webs_t wp, char_t *path, char_t *query)
{
char_t *part1_vol, *part2_vol, *part3_vol;
int max_part = atoi(websGetVar(wp, T("max_part"), T("")));
FILE *fp = NULL;
char part[30];
if (NULL == (fp = fopen("/proc/mounts", "r")))
{
perror(__FUNCTION__);
return;
}
while(EOF != fscanf(fp, "%s %*s %*s %*s %*s %*s\n", part))
{
if (NULL != strstr(part, "/dev/sd") || NULL != strstr(part, "/dev/mmc"))
doSystem("umount -l %s", part);
}
fclose(fp);
part1_vol = websGetVar(wp, T("part1_vol"), T(""));
part2_vol = websGetVar(wp, T("part2_vol"), T(""));
part3_vol = websGetVar(wp, T("part3_vol"), T(""));
doSystem("storage.sh reparted %s %s %s %d",
part1_vol, part2_vol, part3_vol, max_part);
sleep(50);
memset(part, 0, 30);
do {
sprintf(part, "/dev/sda%d", max_part+4);
FormatPart(part, "");
sleep(5);
} while (max_part--);
doSystem("storage.sh restart");
sleep(5);
websRedirect(wp, "usb/STORAGEdisk_admin.asp");
}
开发者ID:houzhenggang,项目名称:MT,代码行数:34,代码来源:usb.c
示例5: webcamra
/* goform/webcamra */
static void webcamra(webs_t wp, char_t *path, char_t *query)
{
char_t *enable, *resolution, *fps, *port;
// fetch from web input
enable = websGetVar(wp, T("enabled"), T(""));
resolution = websGetVar(wp, T("resolution"), T(""));
fps = websGetVar(wp, T("fps"), T(""));
port = websGetVar(wp, T("port"), T(""));
// set to nvram
nvram_bufset(RT2860_NVRAM, "WebCamEnabled", enable);
nvram_bufset(RT2860_NVRAM, "WebCamResolution", resolution);
nvram_bufset(RT2860_NVRAM, "WebCamFPS", fps);
nvram_bufset(RT2860_NVRAM, "WebCamPort", port);
nvram_commit(RT2860_NVRAM);
// setup device
doSystem("killall uvc_stream");
if (0 == strcmp(enable, "1"))
{
doSystem("uvc_stream -r %s -f %s -p %s -b",
resolution, fps, port);
}
// debug print
websHeader(wp);
websWrite(wp, T("<h2>Web Camera Settings</h2><br>\n"));
websWrite(wp, T("enabled: %s<br>\n"), enable);
websWrite(wp, T("resolution: %s<br>\n"), resolution);
websWrite(wp, T("fps: %s<br>\n"), fps);
websWrite(wp, T("port: %s<br>\n"), port);
websFooter(wp);
websDone(wp, 200);
}
开发者ID:houzhenggang,项目名称:MT,代码行数:36,代码来源:usb.c
示例6: storageAdm
/* goform/storageAdm */
static void storageAdm(webs_t wp, char_t *path, char_t *query)
{
char_t *submit;
submit = websGetVar(wp, T("hiddenButton"), T(""));
if (0 == strcmp(submit, "delete"))
{
char_t *user_select;
char feild[20];
feild[0] = '\0';
user_select = websGetVar(wp, T("storage_user_select"), T(""));
sprintf(feild, "User%s", user_select);
nvram_bufset(RT2860_NVRAM, feild, "");
doSystem("rm -rf \"%s/home/%s\"", first_part, nvram_bufget(RT2860_NVRAM, feild));
sprintf(feild, "User%sPasswd", user_select);
nvram_bufset(RT2860_NVRAM, feild, "");
sprintf(feild, "FtpUser%s", user_select);
nvram_bufset(RT2860_NVRAM, feild, "");
sprintf(feild, "SmbUser%s", user_select);
nvram_bufset(RT2860_NVRAM, feild, "");
nvram_commit(RT2860_NVRAM);
doSystem("storage.sh admin");
}
else if (0 == strcmp(submit, "apply"))
{
initUSB();
}
websRedirect(wp, "usb/STORAGEuser_admin.asp");
}
开发者ID:houzhenggang,项目名称:MT,代码行数:32,代码来源:usb.c
示例7: iTunesSrv
static void iTunesSrv(webs_t wp, char_t *path, char_t *query)
{
char_t *enable, *dir_path, *name;
// fetch from web input
enable = websGetVar(wp, T("enabled"), T("0"));
dir_path = websGetVar(wp, T("dir_path"), T(""));
name = websGetVar(wp, T("srv_name"), T(""));
// set to nvram
nvram_bufset(RT2860_NVRAM, "iTunesEnable", enable);
nvram_bufset(RT2860_NVRAM, "iTunesDir", dir_path);
nvram_bufset(RT2860_NVRAM, "iTunesSrvName", name);
nvram_commit(RT2860_NVRAM);
// setup device
doSystem("killall mt-daapd; killall mDNSResponder");
if (strcmp(enable, "1") == 0)
doSystem("config-iTunes.sh \"%s\" \"%s\" \"%s\"",
name,
nvram_bufget(RT2860_NVRAM, "Password"),
dir_path);
// debug print
websHeader(wp);
websWrite(wp, T("<h2>iTunes Server Settings</h2><br>\n"));
websWrite(wp, T("capability: %s<br>\n"), enable);
websWrite(wp, T("srv_name: %s<br>\n"), name);
websWrite(wp, T("media library: %s<br>\n"), dir_path);
websFooter(wp);
websDone(wp, 200);
}
开发者ID:houzhenggang,项目名称:MT,代码行数:31,代码来源:usb.c
示例8: openvpn_tunif_stop
static void
openvpn_tunif_stop(const char *ifname)
{
if (is_interface_exist(ifname)) {
doSystem("ifconfig %s %s", ifname, "down");
doSystem("%s %s --dev %s", OPENVPN_EXE, "--rmtun", ifname);
}
}
开发者ID:PterX,项目名称:rt-n56u,代码行数:8,代码来源:vpn_openvpn.c
示例9: link_backup_run
void link_backup_run(int sign)
{
if(sign==1){
doSystem("start_linkbackup > /dev/console&");
}else{
doSystem("killall link_backup");
}
}
开发者ID:Hackerpipers,项目名称:yhrouter,代码行数:8,代码来源:linkbackup_action.c
示例10: openvpn_tapif_start
static void
openvpn_tapif_start(const char *ifname, int insert_to_bridge)
{
if (!is_interface_exist(ifname))
doSystem("%s %s --dev %s", OPENVPN_EXE, "--mktun", ifname);
if (insert_to_bridge)
doSystem("brctl %s %s %s", "addif", IFNAME_BR, ifname);
doSystem("ifconfig %s %s %s", ifname, "0.0.0.0", "promisc up");
}
开发者ID:PterX,项目名称:rt-n56u,代码行数:9,代码来源:vpn_openvpn.c
示例11: openvpn_tapif_stop
static void
openvpn_tapif_stop(const char *ifname)
{
if (is_interface_exist(ifname)) {
doSystem("ifconfig %s %s", ifname, "down");
doSystem("brctl %s %s %s 2>/dev/null", "delif", IFNAME_BR, ifname);
doSystem("%s %s --dev %s", OPENVPN_EXE, "--rmtun", ifname);
}
}
开发者ID:PterX,项目名称:rt-n56u,代码行数:9,代码来源:vpn_openvpn.c
示例12: default_plc_write_to_flash
/*
* write default .nvm and .pib to flash
*/
int default_plc_write_to_flash(void)
{
FILE *fp;
int len, i;
char cmd[64], buf[64];
char mac[18], dak[48], nmk[48];
unsigned char emac[ETHER_ADDR_LEN], enmk[PLC_KEY_LEN];
doSystem("cp %s %s", DEFAULT_NVM_PATH, BOOT_NVM_PATH);
doSystem("cp %s %s", DEFAULT_PIB_PATH, BOOT_PIB_PATH);
// modify .pib
// MAC
if (!__getPLC_para(emac, OFFSET_PLC_MAC)) {
_dprintf("READ PLC MAC: Out of scope\n");
}
else {
if (emac[0] != 0xff) {
if (ether_etoa(emac, mac))
doSystem("/usr/local/bin/modpib %s -M %s", BOOT_PIB_PATH, mac);
// DAK
if (__getPLC_PWD(emac, buf)) {
sprintf(cmd, "/usr/local/bin/hpavkey -D %s", buf);
fp = popen(cmd, "r");
if (fp) {
len = fread(buf, 1, sizeof(buf), fp);
pclose(fp);
if (len > 1) {
buf[len - 1] = '\0';
for (i = 0; i < PLC_KEY_LEN; i++) {
if (i == 0)
sprintf(dak, "%c%c", buf[0], buf[1]);
else
sprintf(dak, "%s:%c%c", dak, buf[i*2], buf[i*2+1]);
}
doSystem("/usr/local/bin/modpib %s -D %s", BOOT_PIB_PATH, dak);
}
}
}
}
}
// NMK
if (!__getPLC_para(enmk, OFFSET_PLC_NMK))
_dprintf("READ PLC NMK: Out of scope\n");
else {
if (enmk[0] != 0xff && enmk[1] != 0xff && enmk[2] != 0xff) {
if (key_etoa(enmk, nmk))
doSystem("/usr/local/bin/modpib %s -N %s", BOOT_PIB_PATH, nmk);
}
}
return plc_write_to_flash(BOOT_NVM_PATH, BOOT_PIB_PATH);
}
开发者ID:ArekOsiewicz,项目名称:asuswrt-merlin,代码行数:59,代码来源:plc_utils.c
示例13: openvpn_tapif_start
static void
openvpn_tapif_start(const char *ifname, int insert_to_bridge)
{
if (!is_interface_exist(ifname))
doSystem("%s %s --dev %s", OPENVPN_EXE, "--mktun", ifname);
if (insert_to_bridge)
br_add_del_if(IFNAME_BR, ifname, 1);
doSystem("ifconfig %s %s %s", ifname, "0.0.0.0", "promisc up");
set_vpn_balancing(ifname);
}
开发者ID:andy-padavan,项目名称:rt-n56u,代码行数:11,代码来源:vpn_openvpn.c
示例14: wan6_up
void wan6_up(char *wan_ifname)
{
int ipv6_type, start_radvd_now;
char *wan_addr6, *wan_gate6, *wan_addr4;
ipv6_type = get_ipv6_type();
if (ipv6_type == IPV6_DISABLED)
return;
stop_dhcp6c();
build_dns6_var();
control_if_ipv6_dad(IFNAME_BR, 1);
start_radvd_now = 1;
if (ipv6_type == IPV6_6IN4 || ipv6_type == IPV6_6TO4 || ipv6_type == IPV6_6RD)
{
wan_addr4 = nvram_safe_get("wan0_ipaddr");
wan_addr6 = nvram_safe_get("wan0_addr6");
start_sit_tunnel(ipv6_type, wan_addr4, wan_addr6);
}
else
{
control_if_ipv6_dad(wan_ifname, 1);
if (ipv6_type == IPV6_NATIVE_STATIC) {
wan_addr6 = nvram_safe_get("wan0_addr6");
wan_gate6 = nvram_safe_get("wan0_gate6");
control_if_ipv6_radv(wan_ifname, 0);
clear_if_addr6(wan_ifname);
if (*wan_addr6)
doSystem("ip -6 addr add %s dev %s", wan_addr6, wan_ifname);
if (*wan_gate6) {
doSystem("ip -6 route add %s dev %s", wan_gate6, wan_ifname);
doSystem("ip -6 route add default via %s metric %d", wan_gate6, 1);
}
}
else {
doSystem("ip -6 route add default dev %s metric %d", wan_ifname, 2048);
control_if_ipv6_autoconf(wan_ifname, nvram_invmatch("ip6_wan_dhcp", "1"));
control_if_ipv6_radv(wan_ifname, 1);
/* wait for interface ready */
sleep(2);
start_dhcp6c(wan_ifname);
if (nvram_match("ip6_lan_auto", "1"))
start_radvd_now = 0;
}
}
if (start_radvd_now)
reload_radvd();
}
开发者ID:eckyecky,项目名称:rt-n56u,代码行数:54,代码来源:net_wan6.c
示例15: load_wireless_modules
static void
load_wireless_modules(void)
{
#if defined (USE_RT2860V2_AP)
doSystem("modprobe %s", "rt2860v2_ap");
#endif
#if defined (USE_RT3090_AP)
doSystem("modprobe %s", "rt3090_ap");
#elif defined (USE_RT5392_AP)
doSystem("modprobe %s", "rt5392_ap");
#elif defined (USE_MT76X3_AP)
doSystem("modprobe %s", "mt76x3_ap");
#endif
#if defined (USE_MT76X2_AP)
doSystem("modprobe %s", "mt76x2_ap");
#endif
#if defined (USE_RT5592_AP)
doSystem("modprobe %s", "rt5592_ap");
#elif defined (USE_RT3593_AP)
doSystem("modprobe %s", "rt3593_ap");
#elif defined (USE_MT7610_AP)
doSystem("modprobe %s", "mt7610_ap");
#endif
}
开发者ID:clockzhong,项目名称:RouterN56U,代码行数:27,代码来源:rc.c
示例16: ipup_vpns_main
int
ipup_vpns_main(int argc, char **argv)
{
FILE *fp;
int i_cast, i_vuse;
char *peer_name;
char *script_name = VPN_SERVER_UPDOWN_SCRIPT;
if (argc < 7)
return -1;
peer_name = safe_getenv("PEERNAME");
logmessage(VPNS_LOG_NAME, "peer %s (%s) connected - ifname: %s, local IP: %s",
argv[6], peer_name, argv[1], argv[5]);
umask(0000);
/* add firewall permission for this client */
vpns_firewall_permission(argv[1], 1);
i_vuse = nvram_get_int("vpns_vuse");
if (i_vuse) {
/* disable multicast flag */
doSystem("ifconfig %s %s", argv[1], "-multicast");
}
/* add route to client's LAN */
vpns_route_to_remote_lan(peer_name, argv[1], NULL, 1);
fp = fopen(VPN_SERVER_LEASE_FILE, "a+");
if (fp) {
fprintf(fp, "%s %s %s %s\n", argv[1], argv[5], argv[6], peer_name);
fclose(fp);
}
if (i_vuse == 0 && !pids("bcrelay")) {
i_cast = nvram_get_int("vpns_cast");
if (i_cast == 1 || i_cast == 3)
eval("/usr/sbin/bcrelay", "-d", "-i", IFNAME_BR, "-o", "ppp[1-5][0-9]", "-n");
if (i_cast == 2 || i_cast == 3)
eval("/usr/sbin/bcrelay", "-d", "-i", "ppp[1-5][0-9]", "-o", IFNAME_BR, "-n");
}
if (check_if_file_exist(script_name))
doSystem("%s %s %s %s %s %s", script_name, "up", argv[1], argv[5], argv[6], peer_name);
return 0;
}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:49,代码来源:vpn_server.c
示例17: initial_all_var_file_in_mount_path
int initial_all_var_file_in_mount_path(const char *const mount_path) {
int i;
int acc_num = 0;
char **account_list = NULL;
if (mount_path == NULL || strlen(mount_path) <= 0) {
return -1;
}
// delete all var files
doSystem("rm -f /%s/.__*.txt", mount_path);
// initial the var file for ftp anonymous
initial_one_var_file_in_mount_path(FTP_ANONYMOUS_USER, mount_path);
// get the account number and account_list
get_account_list(&acc_num, &account_list);
// initial the var file
for (i = 0; i < acc_num; ++i)
initial_one_var_file_in_mount_path(account_list[i], mount_path);
free_2_dimension_list(&acc_num, &account_list);
// initial the folder list
initial_folder_list_in_mount_path(mount_path);
return 0;
}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:28,代码来源:disk_share.c
示例18: test_of_var_files
int test_of_var_files(const char *const mount_path) {
doSystem("rm -f /%s/.__MediaServer_var.txt", mount_path);
create_if_no_var_files(mount_path); // According to the old folder_list, add the new folder.
initial_folder_list_in_mount_path(mount_path); // get the new folder_list.
create_if_no_var_files(mount_path); // According to the new folder_list, add the new var file.
return 0;
}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:7,代码来源:disk_share.c
示例19: StorageEditUser
/* goform/StorageEditUser */
static void StorageEditUser(webs_t wp, char_t *path, char_t *query)
{
char_t *index, *password;
char_t *user_ftp_enable, *user_smb_enable;
char feild[20];
feild[0] = '\0';
// fetch from web input
index = websGetVar(wp, T("hiddenIndex"), T(""));
password = websGetVar(wp, T("edituser_pw"), T(""));
user_ftp_enable = websGetVar(wp, T("edituser_ftp"), T(""));
user_smb_enable = websGetVar(wp, T("edituser_smb"), T(""));
/*
DEBUG(index);
DEBUG(password);
DEBUG(user_ftp_enable);
DEBUG(user_smb_enable);
*/
// set to nvram
sprintf(feild, "User%sPasswd", index);
nvram_bufset(RT2860_NVRAM, feild, password);
sprintf(feild, "FtpUser%s", index);
// DEBUG(feild);
nvram_bufset(RT2860_NVRAM, feild, user_ftp_enable);
sprintf(feild, "SmbUser%s", index);
// DEBUG(feild);
nvram_bufset(RT2860_NVRAM, feild, user_smb_enable);
nvram_commit(RT2860_NVRAM);
doSystem("storage.sh admin");
websRedirect(wp, "usb/STORAGEuser_admin.asp");
}
开发者ID:houzhenggang,项目名称:MT,代码行数:34,代码来源:usb.c
示例20: safe_remove_usb_modem
void
safe_remove_usb_modem(void)
{
char* svcs[] = { "pppd", NULL };
if (nvram_match("modem_type", "3"))
{
if (pids("udhcpc"))
{
doSystem("killall %s %s", "-SIGUSR2", "udhcpc");
usleep(250000);
svcs[0] = "udhcpc";
kill_services(svcs, 3, 1);
}
stop_modem_ndis();
}
else
{
kill_services(svcs, 10, 1);
stop_modem_ras();
}
set_usb_modem_dev_wan(0, 0);
}
开发者ID:schidler,项目名称:flyzjhz-rt-n56u,代码行数:27,代码来源:usb_modem.c
注:本文中的doSystem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论