⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmds.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
	(void) unlink(mt_scratchfile);}/* * Reread .mailrc to pick up any changes. *//* ARGSUSED */voidmt_mailrc_proc(item, ie)	Panel_item      item;	Event          *ie;{/* not used - hala	struct reply_panel_data *ptr, *new;*/	mt_mail_cmd("source %s", mt_value("MAILRC"));	mt_get_vars(0);	mt_start_timer();	mt_init_filemenu();	mt_folder_menu = NULL;	/* will be rebuilt next time is used. *//* not used - hala 	ptr = (struct reply_panel_data *)panel_get(		mt_cmdpanel, PANEL_CLIENT_DATA);*/	mt_start_timer();	/* in case user changed interval */	mt_init_mailtool_defaults();}/* * Display the next message. *//* ARGSUSED */voidmt_next_proc(item, ie)	Panel_item      item;	Event          *ie;{	int             nextmsg;	int		has_selection;	if (mt_nomail) {		mt_warn(mt_frame, "No Mail", 0);		return;	}	/* mt_save_curmsg(); XXX */	/* give warning msg if no mssg selected in header subwindow */	if ((nextmsg = mt_get_curselmsg(0)) == 0)		return;	has_selection = mt_has_selection();	if (event_shift_is_down(ie)) {		int savescandir;		savescandir = mt_scandir;		mt_scandir = -mt_scandir;	/* reverse scan direction */		nextmsg = mt_next_msg(mt_curmsg);		if (mt_scandir == -savescandir)	/* if no change, put it back */			mt_scandir = savescandir;	} else {		if (mt_message[mt_curmsg].m_deleted)			mt_curmsg = mt_next_msg(mt_curmsg);		nextmsg = mt_next_msg(mt_curmsg);	}	mt_update_msgsw(nextmsg, TRUE, TRUE, TRUE, has_selection);}/* * Handles "new mail" and "done" */voidmt_new_mail_proc(item, ie)	Panel_item      item;	Event          *ie;{	mt_do_retrieve(item, ie, TRUE, FALSE);}/* ARGSUSED */voidmt_new_style_panel_proc(item, ie)	Panel_item      item;	Event          *ie;{	mt_create_cmd_panel(mt_New);}/* * Procedure that does nothing. Lives behind panel items that only have menus. *//* ARGSUSED */voidmt_nop_proc(item, ie)	Panel_item      item;	Event          *ie;{/* nop */}/* ARGSUSED */voidmt_old_style_panel_proc(item, ie)	Panel_item      item;	Event          *ie;{	mt_create_cmd_panel(mt_Old);}/* * Preserve the selected message. *//* ARGSUSED */voidmt_preserve_proc(item, ie)	Panel_item      item;	Event          *ie;{	int	msg;	if (mt_nomail) {		mt_warn(mt_frame, "No Mail", 0);		return;	}	if ((msg = mt_get_curselmsg(0)) == 0)		return;	mt_preserve_msg(msg);}/* * Display the previous message. *//* ARGSUSED */voidmt_prev_proc(item, ie)	Panel_item      item;	Event          *ie;{	event_set_shiftmask(ie, SHIFTMASK);	mt_next_proc(item, ie);}/* * Print the selected message on a printer. *//* ARGSUSED */voidmt_print_proc(item, ie)	Panel_item      item;	Event          *ie;{	int             msg;	if (mt_nomail) {		mt_warn(mt_frame, "No Mail", 0);		return;	}	if ((msg = mt_get_curselmsg(0)) == 0)		return;	(void) unlink(mt_printfile);	if (msg == mt_curmsg)		mt_save_curmsg();	(void)mt_copy_msg(msg, mt_printfile);	if (vfork() == 0) {		register int i;		register char *p;		for (i = GETDTABLESIZE(); i > 2; i--)			(void) close(i);		(void) close(0);		(void) open(mt_printfile, 0);		(void) unlink(mt_printfile);		if ((p = mt_value("printmail")) != NULL)			execl("/bin/sh", "sh", "-c", p, 0);		else			execl("/usr/ucb/lpr", "lpr", "-p", 0);		exit(-1);	}}/* * Quit the tool. *//* ARGSUSED */voidmt_quit_proc(item, ie)	Panel_item      item;	Event          *ie;{	(void)win_release_event_lock(mt_cmdpanel_fd);	mt_yield_all();	if (event_ctrl_is_down(ie))		mt_assign("expert", "");		/* XXX - force no confirm, just quit */	(void)window_done((struct tool *)(LINT_CAST(mt_frame)));}/* * Readdress. *//* ARGSUSED */voidmt_readdress_proc(item, ie)	Panel_item      item;	Event          *ie;{	Panel		panel;	struct reply_panel_data *ptr;	int		lower_context;	if (!mt_compose_msg(0, mt_scratchfile, mt_value("askcc"), FALSE))		return;	panel = panel_get(item, PANEL_PARENT_PANEL);	ptr = (struct reply_panel_data *)panel_get(panel, PANEL_CLIENT_DATA);	lower_context = (int)window_get(ptr->replysw, TEXTSW_LOWER_CONTEXT);	(void) window_set(ptr->replysw,		TEXTSW_INSERTION_POINT, 0,		TEXTSW_LOWER_CONTEXT, -1,	/* work around to						 * suppress scrolling as						 * you insert */		TEXTSW_INSERT_FROM_FILE, mt_scratchfile,		TEXTSW_LOWER_CONTEXT, lower_context,		TEXTSW_INSERTION_POINT, 4,	/* after "To: " */ 		0);	if (mt_use_fields) {		Textsw_index             first, last_plus_one;		first = (Textsw_index)window_get(ptr->replysw,			TEXTSW_INSERTION_POINT);		textsw_match_bytes(ptr->replysw,			&first, &last_plus_one, "|>", 2, "<|", 2,			TEXTSW_FIELD_FORWARD);		(void) textsw_set_selection(ptr->replysw, first, last_plus_one,			PRIMARY_SELECTION | PRIMARY_PD_SELECTION);		(void) window_set(ptr->replysw, TEXTSW_INSERTION_POINT,			last_plus_one, 0);	} 	mt_move_input_focus(ptr->replysw);	if (ptr->frame != mt_frame)		(void) window_set(ptr->frame,			FRAME_ICON, &mt_composing_icon,			0);}/* * Reply to the selected message. *//* ARGSUSED */voidmt_reply_proc(item, ie)	Panel_item      item;	Event          *ie;{	struct reply_panel_data *ptr;	int             msg, lower_context;	if (mt_nomail) {		mt_warn(mt_frame, "No Mail", 0);		return;	}	else if ((msg = mt_get_curselmsg(0)) == 0)		return;	else if (!(ptr = mt_get_replysw(item)))		return;	mt_save_curmsg();	if (!(mt_reply_msg(msg, ptr->replysw_file, event_shift_is_down(ie),	    event_ctrl_is_down(ie))))	    	return;	mt_start_reply(ptr);	lower_context = (int)window_get(ptr->replysw, TEXTSW_LOWER_CONTEXT);	(void) window_set(ptr->replysw,		TEXTSW_LOWER_CONTEXT, -1,	/* work around to						 * suppress scrolling as						 * you insert */		TEXTSW_FILE_CONTENTS, ptr->replysw_file, 		TEXTSW_LOWER_CONTEXT, lower_context,		TEXTSW_INSERTION_POINT, TEXTSW_INFINITY,		0);	if (mt_use_fields) {		Textsw_index	first, last_plus_one;		first = (Textsw_index) window_get(ptr, TEXTSW_INSERTION_POINT);		textsw_match_bytes(ptr->replysw,			&first, &last_plus_one, "|>", 2, "<|", 2,			TEXTSW_FIELD_BACKWARD);		(void) textsw_set_selection(ptr->replysw, first, last_plus_one,			PRIMARY_SELECTION | PRIMARY_PD_SELECTION);		(void) window_set(ptr->replysw, TEXTSW_INSERTION_POINT,			last_plus_one, 0); 	} 	mt_display_reply(ptr);	/* (Bug# 1010744 fix) make sure beguinning of msg is on screen */	textsw_possibly_normalize(ptr->replysw, 0);	if (ptr->frame != mt_frame)		(void) window_set(ptr->frame,			FRAME_ICON, &mt_replying_icon,			0);	if (mt_debugging) {		(void) printf("replysw setup, #fds = %d\n", nfds_avail());		(void) fflush(stdout);	}	if ((nfds_avail()) < 4) {		/*		 * currently, you		 * need 4 (choke!) fds to invoke a filter, two for each pair		 * of pipes 		 */		mt_warn(window_get(ptr->replysw, WIN_OWNER),			"Warning: low on fds. Don't use text filters",			"or the text extras menu in composition windows.",			0);	}}/* * toggle permanent/temporary. *//* ARGSUSED */voidmt_replysw_proc(item, value, ie)	Panel_item      item;	int             value;	Event          *ie;{	Panel           reply_panel;	struct reply_panel_data *ptr;	reply_panel = panel_get(item, PANEL_PARENT_PANEL);	ptr = (struct reply_panel_data *)panel_get(		reply_panel, PANEL_CLIENT_DATA);	ptr->behavior = (enum mt_Popup_Behavior) value;	mt_replypanel_init(reply_panel);}/* * Save the selected message in the specified file. *//* ARGSUSED */voidmt_save_proc(item, ie)	Panel_item      item;	Event          *ie;{	mt_do_save(1, ie, mt_has_selection());}/* * Display message specified by current selection. * Selection must be numeric and we display the message * with that number. *//* ARGSUSED */voidmt_show_proc(item, ie)	Panel_item      item;	Event          *ie;{	int             msg;	if (mt_nomail) {		mt_warn(mt_frame, "No Mail", 0);		return;	}	if ((msg = mt_get_curselmsg(0)) == 0)		return;	mt_update_msgsw(msg, (event_shift_is_down(ie)) == 0,		TRUE, FALSE, FALSE);}/* * Undelete the most recently deleted message. *//* ARGSUSED */voidmt_undel_proc(item, ie)	Panel_item      item;	Event          *ie;{	int		has_selection;	int             msg;	if (mt_delp == NULL) {		mt_warn(mt_frame, "No deleted messages.", 0);		return;	}	has_selection = mt_has_selection();	msg = mt_delp - mt_message;	 /* the message number */	mt_save_curmsg();	mt_undel_msg(msg);	mt_delp = mt_delp->m_next;	if (mt_delp == NULL && mt_del_item) { /* last deleted message */		struct panel_item_data *p;		if (mt_panel_style == mt_3DImages)			(void) panel_set(mt_del_item,				PANEL_LABEL_IMAGE, mt_trash_pr,		 		0);		p = (struct panel_item_data *)panel_get(			mt_del_item, PANEL_CLIENT_DATA);		(void) menu_set(menu_get(p->menu, MENU_NTH_ITEM, 2),			MENU_INACTIVE, TRUE, 0);	}	mt_ins_header(mt_message[msg].m_start, mt_message[msg].m_header);	mt_curmsg = msg;	if (mt_nomail) {		mt_nomail = FALSE;		mt_update_msgsw(mt_curmsg, TRUE, FALSE, TRUE, has_selection);	} else if (mt_value("autoprint"))		mt_update_msgsw(mt_curmsg, TRUE, FALSE, TRUE, has_selection);	if (!mt_3x_compatibility) {		(void)sprintf(mt_info, "%d deleted message%s", mt_del_count, 			mt_del_count != 1 ? "s" : "");		mt_update_info(mt_info);		mt_set_namestripe_right(mt_info, TRUE);	}}/* ARGSUSED */voidmt_3Dimages_style_proc(item, ie)	Panel_item      item;	Event          *ie;{	if (!mt_use_images) 		mt_warn(mt_frame,			"This instance of mailtool was not compiled with -DUSE_IMAGES.",			"No images are available.",			0);	else		mt_create_cmd_panel(mt_3DImages);}static voidmt_create_cmd_panel(style)	enum mt_Panel_Style style;{	char            file_item[128], info_item[128];	struct reply_panel_data *ptr;	ptr = (struct reply_panel_data *)panel_get(mt_cmdpanel,		PANEL_CLIENT_DATA);	/* get file & info string if it exists */	(void) strcpy(file_item, (char *)panel_get_value(mt_file_item));	if (mt_info_item != NULL)		(void) strcpy(info_item, (char *)panel_get_value(mt_info_item));	mt_remove_window(mt_cmdpanel);	(void) window_destroy(mt_cmdpanel);	mt_info_item = NULL;	if (style == mt_3DImages)		mt_create_3Dimages_panel();	else {		mt_del_item = NULL;		if (style == mt_New) 			mt_create_new_style_panel();		else if (style == mt_Old) {			mt_create_old_style_panel();			mt_set_namestripe_right("", TRUE);		}	}	mt_panel_style = style;	if (!mt_always_use_popup) {		/* get rid of old reply panel & sw */		mt_remove_window(mt_replypanel);		(void) window_destroy(mt_replypanel);		mt_remove_window(mt_replysw);		(void) window_destroy(mt_replysw);		/* create new reply panel & sw */		ptr = mt_create_reply_panel(mt_frame);		if (ptr == NULL)		{		   fprintf(stderr, "Unable to create reply panel in mt_create_cmd_panel\n");		   exit(1);		}		mt_replypanel = ptr->reply_panel;		mt_replysw = ptr->replysw;	}	(void) panel_set(mt_cmdpanel, PANEL_CLIENT_DATA, ptr, 0);	(void) panel_set(mt_file_item, PANEL_VALUE, file_item,		PANEL_PAINT, PANEL_NONE, 0);	if (mt_info_item != NULL)		(void) panel_set(mt_info_item, PANEL_VALUE, info_item,			PANEL_PAINT, PANEL_NONE, 0);	(void) window_set(mt_cmdpanel,		WIN_X, 0,		WIN_BELOW, mt_headersw,		0);	(void) window_set(mt_msgsw,		WIN_X, 0,		WIN_BELOW, mt_cmdpanel,		0);	if (mt_cd_frame)		mt_destroy_cd_popup();}/* * Delete a message. * Called by "delete" and "save". *//* ARGSUSED */static voidmt_do_del(msg, ie, has_selection)	int             msg;	Event          *ie;	int		has_selection;{	int             display_next;	/* display next msg after delete? */	int             nmsg;		/* new message after delete */	mt_del_header(mt_message[msg].m_start, mt_message[msg+1].m_start);	mt_del_msg(msg);	if (mt_delp == NULL && mt_del_item) {		/*		 * this is the first deleted message. mt_del_item is NULL for		 * old style panels 		 */		struct panel_item_data *p;		if (mt_panel_style == mt_3DImages)			(void) panel_set(mt_del_item,				PANEL_LABEL_IMAGE, mt_trashfull_pr,		 		0);		p = (struct panel_item_data *)panel_get(			mt_del_item, PANEL_CLIENT_DATA);		(void) menu_set(menu_get(p->menu, MENU_NTH_ITEM, 2),			MENU_INACTIVE, FALSE, 0);	}	mt_message[msg].m_next = mt_delp;	mt_delp = &mt_message[msg];	display_next = event_ctrl_is_down(ie) ?	    mt_value("autoprint") == NULL : mt_value("autoprint") != NULL;	if (msg == mt_curmsg || display_next) {		if (event_shift_is_down(ie)) {			int savescandir;			savescandir = mt_scandir;			mt_scandir = -mt_scandir;	/* reverse scan							 * direction */			nmsg = mt_next_msg(msg);			if (mt_scandir == -savescandir)				mt_scandir = savescandir;		} else			nmsg = mt_next_msg(msg);		if (nmsg == 0)			mt_set_nomail();		else			if (display_next && mt_curmsg != nmsg)				mt_update_msgsw(nmsg, TRUE, FALSE,					TRUE, has_selection);			else {				if (msg == mt_curmsg)					textsw_reset(mt_msgsw, 0, 0);				mt_update_headersw(nmsg);				/*				 * scrolls header subwindow if necessary to				 * bring next/previous message into view				 */				mt_set_curselmsg(nmsg); 			}	} else { 		nmsg = mt_next_msg(msg);		mt_update_headersw(nmsg);				/*				 * scrolls header subwindow if necessary to				 * bring next/previous message into view				 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -