Beispiel #1
0
int main(int argc, char *argv[])
{
    int count = 0;
    int i = 0;
    int ret = 0;
    struct lxc_container **containers = NULL;
    struct lxc_list *cmd_groups_list = NULL;
    struct lxc_list *c_groups_list = NULL;
    struct lxc_list *it, *next;
    char *const default_start_args[] = {
        "/sbin/init",
        '\0',
    };

    if (lxc_arguments_parse(&my_args, argc, argv))
        return 1;

    count = list_defined_containers(NULL, NULL, &containers);

    if (count < 0)
        return 1;

    qsort(&containers[0], count, sizeof(struct lxc_container *), cmporder);

    if (my_args.groups && !my_args.all)
        cmd_groups_list = get_list((char*)my_args.groups, ",");

    for (i = 0; i < count; i++) {
        struct lxc_container *c = containers[i];

        if (!c->may_control(c)) {
            lxc_container_put(c);
            continue;
        }

        if (get_config_integer(c, "lxc.start.auto") != 1) {
            lxc_container_put(c);
            continue;
        }

        if (!my_args.all) {
            /* Filter by group */
            c_groups_list = get_config_list(c, "lxc.group");

            ret = lists_contain_common_entry(cmd_groups_list, c_groups_list);

            if (c_groups_list) {
                lxc_list_for_each_safe(it, c_groups_list, next) {
                    lxc_list_del(it);
                    free(it->elem);
                    free(it);
                }
                free(c_groups_list);
            }

            if (ret == 0) {
                lxc_container_put(c);
                continue;
            }
        }
Beispiel #2
0
LRESULT CALLBACK assign_action_dlg(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	char str[255];

	switch(msg)
	{
	case WM_SHOWWINDOW:
		break;
	case WM_INITDIALOG:
		get_config_list(hwnd,IDC_ACTION_LIST);
		SendMessage(GetDlgItem(hwnd,IDC_ACTION_LIST),CB_SETCURSEL,current_config,0);
		break;
	case WM_COMMAND:
		switch(LOWORD(wparam))
		{
		case WM_DESTROY:
			EndDialog(hwnd,0);
			break;
		case IDC_NEW_ACTION:
			hdlg=CreateDialog(ghInstance,MAKEINTRESOURCE(IDD_EDIT_ACTION),hwnd_parent,edit_action_dlg);
			if(hdlg!=NULL)
				ShowWindow(hdlg, SW_SHOW);
			EndDialog(hwnd,IDC_NEW_ACTION);
			break;
		case IDC_EDIT_ACTION:


			EndDialog(hwnd,IDC_EDIT_ACTION);
			break;
		case IDC_DELETE_ACTION:
			_snprintf(str,sizeof(str),"This will delete the action '%s' from this configuration. Do you want to do this?");
			if(IDYES==MessageBox(hwnd,str,"Confirm Delete",MB_YESNO)){
				//delete_config();
				EndDialog(hwnd,0);
			}
			break;
		case IDOK:
			EndDialog(hwnd,0);
			break;
		}
		break;
	case WM_CLOSE:
	case WM_QUIT:
		EndDialog(hwnd,0);
		break;
	}
	return 0;
}