예제 #1
0
파일: main.cpp 프로젝트: ga2arch/slack
int main(int argc, char* argv[]) {
    
    check_cmdline(argc, argv);
    
    auto token = std::getenv(TOKEN_NAME.c_str());
    if (!token) {
        // fallback to default token name
        token = std::getenv("SLACK_TOKEN");
        if (!token && argc == 1) {
            std::cerr << "No token specified. Check helper message (\"--help\")" << std::endl;;
            exit(EXIT_FAILURE);
        }
    }
    
    assert(token != nullptr);
    
    SlackUI ui;
    SlackClient c;
    
    ui.set_client(&c);
    c.set_ui(&ui);
    
    c.set_token(token);
    ui.show();
}
예제 #2
0
파일: common.c 프로젝트: izak/monitortools
int monitored(const char *pidpath, const char *zopeuser, const char *tag, const char* cmdline, char *name, size_t nlen){
    if(check_cmdline(pidpath, cmdline)){
        struct stat s_procpid;
        uid_t zopeuid = getzopeuid(zopeuser);

        if(stat(pidpath, &s_procpid)==-1){
            return 0;
        }
        if(s_procpid.st_uid == zopeuid){
            char procpidenv[1024];
            char env[65535];
            const char *ptr;
            int i;
            snprintf(procpidenv, sizeof(procpidenv), "%s/environ", pidpath);
            i = readfile(procpidenv, env, sizeof(env));
            if(ptr=scanbuf(env, i, tag)){
                if(ptr = strchr(ptr, '=')){
                    ptr++;
                    strncpy(name, ptr, nlen);
                    return 1;
                }
            }
        }
    }
    return 0;
}
static gboolean
record_live_boot (gpointer unused)
{
  gboolean is_live_boot, is_dual_boot;

  check_cmdline (&is_live_boot, &is_dual_boot);

  if (is_live_boot)
    emtr_event_recorder_record_event (emtr_event_recorder_get_default (),
                                      LIVE_BOOT_EVENT, NULL);
  else if (is_dual_boot)
    emtr_event_recorder_record_event (emtr_event_recorder_get_default (),
                                      DUAL_BOOT_EVENT, NULL);

  return G_SOURCE_REMOVE;
}
void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *board_type)
{
    char serial[PROP_VALUE_MAX];
    char device[PROP_VALUE_MAX];
    char devicename[PROP_VALUE_MAX];

    UNUSED(msm_id);
    UNUSED(msm_ver);
    UNUSED(board_type);

    property_get("ro.boot.serialno", serial);
    if (strncmp(serial, "LGD290", 6) == 0) {
        if (check_cmdline("model.name=LG-D290n") == 1) {
                property_set("ro.product.device", "l70pn");
                property_set("ro.product.model", "LG-D290n");
                property_set("ro.nfc.port", "I2C");
        } else {
                property_set("ro.product.device", "l70p");
                property_set("ro.product.model", "LG-D290");
        }
        property_set("ro.build.description", "l70pn_global_com-user 4.4.2/KOT49I.A1414595997/1414595997:user/release-keys");
        property_set("ro.build.fingerprint", "lge/l70pn_global_com/l70pn:4.4.2/KOT49I.A1414595997/1414595997:user/release-keys");
        property_set("persist.radio.multisim.config", "");
        property_set("telephony.lteOnCdmaDevice", "0");
    } else if (strncmp(serial, "LGD295", 6) == 0) {
        property_set("ro.product.device", "l70pds");
        property_set("ro.product.model", "LG-D295");
        property_set("ro.build.description", "l70pds_global_com-user 4.4.2 KOT49I.D29510d D29510d.1423726485 release-keys");
        property_set("ro.build.fingerprint", "lge/l70pds_global_com-user/l70pn:4.4.2/KOT49I.D29510d/D29510d.1423726485:user/release-keys");
                property_set("persist.radio.multisim.config", "dsds");
        property_set("telephony.lteOnCdmaDevice", "0");
    } else {
        /* XXX */
        property_set("ro.product.device", "l70p");
        property_set("ro.product.model", "Please write your model name to Panos");
        property_set("persist.radio.multisim.config", "");
        property_set("telephony.lteOnCdmaDevice", "0");
    }
    property_get("ro.product.device", device);
    strlcpy(devicename, device, sizeof(devicename));
    ERROR("Found hardware id: %s setting build properties for %s device\n", serial, devicename);
}
예제 #5
0
파일: pagename.c 프로젝트: B-Rich/LilyTerm
gboolean monitor_cmdline(struct Page *page_data)
{
#ifdef FULL
	g_debug("! Launch monitor_cmdline() with page_data = %p", page_data);
#endif
#ifdef DEFENSIVE
	if ((page_data==NULL) || (page_data->lost_focus==NULL) || (page_data->keep_vte_size==NULL) ||
	    (page_data->current_vte==NULL) || (page_data->window_title_tpgid==NULL)) return FALSE;
#endif
	if (page_data->pid<1) return FALSE;

	gboolean lost_focus = *(page_data->lost_focus);

	// g_debug("Get page_data->keep_vte_size = %d in monitor_cmdline()", *(page_data->keep_vte_size));

	// g_debug ("\nvte_terminal_get_status_line = %s,"
	//	"vte_terminal_get_icon_title = %s,\n"
	//	"vte_terminal_get_window_title = %s\n",
	//	vte_terminal_get_status_line(VTE_TERMINAL(page_data->vte)),
	//	vte_terminal_get_icon_title(VTE_TERMINAL(page_data->vte)),
	//	vte_terminal_get_window_title(VTE_TERMINAL(page_data->vte)));

	// The pagename won't be updated if LilyTerm is not on focus or when resizing.
	// But it will still update the window title.
	// 0xfe = 11,111,110
	if ((*(page_data->keep_vte_size)&0xfffc) ||
	    (lost_focus && (*(page_data->current_vte) != (page_data->vte))) ||
	    page_data->custom_page_name ||
	    dialog_activated)
		return TRUE;
	// if we should call get_and_update_page_name or not
	gboolean page_name_changed = FALSE;

	// backup page_data datas
	gint page_update_method = page_data->page_update_method;

	page_data->page_update_method = PAGE_METHOD_AUTOMATIC;
	// g_debug("INIT: lost_focus = %d", lost_focus);
	// g_debug("INIT: page_data->window_title_updated = %d", page_data->window_title_updated);

	if (lost_focus)
		page_name_changed = check_cmdline(page_data, *(page_data->window_title_tpgid));
	else
	{
		page_name_changed = check_cmdline(page_data, page_data->displayed_tpgid);
		
		if ((page_name_changed)	&& page_data->check_root_privileges)
			page_data->is_root = check_is_root(page_data->current_tpgid);
	}

	// g_debug("lost_focus = %d", lost_focus);
	// g_debug("page_data->window_title_updated = %d", page_data->window_title_updated);

	if (check_window_title(page_data, lost_focus))
		page_name_changed = TRUE;

	gchar *old_pwd;
	if (lost_focus)
		old_pwd = page_data->window_title_pwd;
	else
		old_pwd = page_data->pwd;

	gchar *new_pwd = get_tab_name_with_current_dir(page_data->current_tpgid);

	if (check_pwd(page_data, old_pwd, new_pwd, page_update_method))
	{
		page_name_changed = TRUE;
		if (lost_focus)
			page_data->window_title_pwd = new_pwd;
		else
			page_data->pwd = new_pwd;
		new_pwd = old_pwd;
	}

	// g_debug("check_tpgid = %d, and current_tpgid = %d", *check_tpgid, page_data->current_tpgid);
	// only update the page name when tpgid is updated.
	// g_debug("Final: page_data->page_update_method = %d", page_data->page_update_method);
	if (page_name_changed)
	{
		// g_debug("!!! Update the page name for page_no %d", page_data->page_no);
		page_data->is_bold = page_data->bold_action_page_name;
		page_data->should_be_bold = TRUE;
		// g_debug("page_data->is_bold = %d for page_data %p", page_data->is_bold, page_data);

		// g_debug("Launch get_and_update_page_name() in monitor_cmdline()");
		if (( ! get_and_update_page_name(page_data, *(page_data->lost_focus))) && (! lost_focus))
		{
			// if update "tab title" fault. upate window title will never fault.
			// g_debug("!! Tab name is NOT changed to '%s'", page_data->pwd);
			// exchange old_pwd and new_pwd again!
			new_pwd = page_data->pwd;
			page_data->pwd = old_pwd;
			// g_debug("Restore page_data->pwd to %s", page_data->pwd);
		}
	}
	else
	{
		page_data->page_update_method = page_update_method;
		// g_debug("Restore page_data->page_update_method to %d!!!", page_data->page_update_method);
	}

	g_free(new_pwd);

	return TRUE;
}
예제 #6
0
void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *board_type)
{
    char serial[PROP_VALUE_MAX];
    char device[PROP_VALUE_MAX];
    char devicename[PROP_VALUE_MAX];

    UNUSED(msm_id);
    UNUSED(msm_ver);
    UNUSED(board_type);

    property_get("ro.boot.serialno", serial);
    
    if( !strncmp( serial, "LGD400", 6 ) ) {
        /* D400, D400n, D400hn */
        if ( check_cmdline("model.name=LG-D400n") == 1 || check_cmdline("model.name=LG-D400hn") == 1 ) {
            if( check_cmdline("model.name=LG-D400n") == 1 ) {
                property_set("ro.product.device", "w7n");
                property_set("ro.product.model", "LG-D400n");
                property_set("persist.radio.multisim.config", "");
                
            } else {
                property_set("ro.product.device", "w7nds");
                property_set("ro.product.model", "LG-D400hn");
                property_set("persist.radio.multisim.config", "dsds");
                
            }
            property_set("ro.nfc.port", "I2C");
            
        } else { // LG-D400???
            property_set("ro.product.device", "w7");
            property_set("ro.product.model", "LG-D400");
            property_set("persist.radio.multisim.config", "");
            property_set("ro.nfc.port", "");
            
        }
        property_set("ro.build.description", "w7_global_sca-user 4.4.2 KOT49I.V10a 1398486791 release-keys");
        property_set("ro.build.fingerprint", "lge/w7_global_sca/w7:4.4.2/KOT49I.V10a/1398486791:user/release-keys");
        
    } else if (strncmp(serial, "LGD405", 6) == 0) {
        /* D405, D405n, D405hn??? */
        if ( check_cmdline("model.name=LG-D405n") == 1 || check_cmdline("model.name=LG-D405hn") == 1 ) {
            if( check_cmdline("model.name=LG-D405n") == 1 ) {
                // Single-sim with NFC
                property_set("ro.product.device", "w7n");
                property_set("ro.product.model", "LG-D405n");
                property_set("persist.radio.multisim.config", "");
                property_set("ro.build.description", "w7n_global_com-user 4.4.2 KOT49I.A1400215746 1400215746 release-keys");
                property_set("ro.build.fingerprint", "lge/w7n_global_com/w7n:4.4.2/KOT49I.A1400215746/1400215746:user/release-keys");
                
            } else {
                // Dual-sim with NFC
                property_set("ro.product.device", "w7nds");
                property_set("ro.product.model", "LG-D405hn");
                property_set("persist.radio.multisim.config", "dsds");
                property_set("ro.build.description", "w7ds_global_com-user 4.4.2 KOT49I.A1400215746 1400215746 release-keys");
                property_set("ro.build.fingerprint", "lge/w7ds_global_com/w7ds:4.4.2/KOT49I.A1400215746/1400215746:user/release-keys");
                
            }
            property_set("ro.nfc.port", "I2C");
         
        } else {
            // Single-sim without NFC
            property_set("ro.product.model", "LG-D405");
            property_set("ro.product.device", "w7");
            property_set("persist.radio.multisim.config", "");
            property_set("ro.nfc.port", "");
            property_set("ro.build.description", "w7_global_com-user 4.4.2 KOT49I.A1402966338 1402966338 release-keys");
            property_set("ro.build.fingerprint", "lge/w7_global_com/w7:4.4.2/KOT49I.A1402966338/1402966338:user/release-keys");
        }
        
        
    } else if (strncmp(serial, "LGD410", 6) == 0) {
        /* D410n, D410hn */
        if (check_cmdline("model.name=LG-D410hn") == 1 || check_cmdline("model.name=LG-D410n") == 1) {
            if (check_cmdline("model.name=LG-D410hn") == 1) {
                    property_set("ro.product.device", "w7nds");
                    property_set("ro.product.model", "LG-D410hn");
                    property_set("persist.radio.multisim.config", "dsds");
            } else {
                    property_set("ro.product.device", "w7n");
                    property_set("ro.product.model", "LG-D410n");
                    property_set("persist.radio.multisim.config", "");
            }
            property_set("ro.nfc.port", "I2C");
            
        } else {
            property_set("ro.product.model", "LG-D410");
            property_set("ro.product.device", "w7");
            property_set("persist.radio.multisim.config", "");
            property_set("ro.nfc.port", "");
        }
        
        property_set("ro.build.description", "w7ds_global_com-user 4.4.2 KOT49I.A1398228431 1398228431 release-keys");
        property_set("ro.build.fingerprint", "lge/w7ds_global_com/w7ds:4.4.2/KOT49I.A1398228431/1398228431:user/release-keys");
        
    } else if (strncmp(serial, "LGD415", 6) == 0) {
        /* D415 */
        property_set("ro.product.device", "w7");
        property_set("ro.product.model", "LG-D415");
        property_set("ro.build.description", "w7_tmo_us-user 4.4.2 KOT49I.D41510c D41510c.1393916607 release-keys");
        property_set("ro.build.fingerprint", "lge/w7_tmo_us/w7:4.4.2/KOT49I.D41510c/D41510c.1393916607:user/release-keys");
        property_set("persist.radio.multisim.config", "");
        property_set("ro.nfc.port", "");
        
    } else {
        /*  This should technically never happen  */
        /* XXX */
        property_set("ro.product.device", "w7");
        property_set("ro.product.model", "Please write your model name to [email protected]");
        property_set("persist.radio.multisim.config", "");
        
    }
    property_set("telephony.lteOnCdmaDevice", "0");
    property_get("ro.product.device", device);
    strlcpy(devicename, device, sizeof(devicename));
    ERROR("Found hardware id: %s setting build properties for %s device\n", serial, devicename);
}