亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? shell.c

?? nedit 是一款linux下的開發源碼的功能強大的編輯器
?? C
?? 第 1 頁 / 共 3 頁
字號:
static const char CVSID[] = "$Id: shell.c,v 1.25 2003/05/02 19:19:02 edg Exp $";/********************************************************************************									       ** shell.c -- Nirvana Editor shell command execution			       **									       ** Copyright (C) 1999 Mark Edel						       **									       ** This is free software; you can redistribute it and/or modify it under the    ** terms of the GNU General Public License as published by the Free Software    ** Foundation; either version 2 of the License, or (at your option) any later   ** version.							               ** 									       ** This software is distributed in the hope that it will be useful, but WITHOUT ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        ** FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License        ** for more details.							       ** 									       ** You should have received a copy of the GNU General Public License along with ** software; if not, write to the Free Software Foundation, Inc., 59 Temple     ** Place, Suite 330, Boston, MA  02111-1307 USA		                       **									       ** Nirvana Text Editor	    						       ** December, 1993							       **									       ** Written by Mark Edel							       **									       ********************************************************************************/#ifdef HAVE_CONFIG_H#include "../config.h"#endif#include "shell.h"#include "textBuf.h"#include "text.h"#include "nedit.h"#include "window.h"#include "preferences.h"#include "file.h"#include "macro.h"#include "interpret.h"#include "../util/DialogF.h"#include "../util/misc.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <signal.h>#include <sys/types.h>#ifndef __MVS__#include <sys/param.h>#endif#include <sys/wait.h>#include <unistd.h>#include <fcntl.h>#include <ctype.h>#include <errno.h>#ifdef notdef#ifdef IBM#define NBBY 8#include <sys/select.h>#endif#include <time.h>#endif#ifdef __EMX__#include <process.h>#endif#include <Xm/Xm.h>#include <Xm/MessageB.h>#include <Xm/Text.h>#include <Xm/Form.h>#include <Xm/PushBG.h>#ifdef HAVE_DEBUG_H#include "../debug.h"#endif/* Tuning parameters */#define IO_BUF_SIZE 4096	/* size of buffers for collecting cmd output */#define MAX_OUT_DIALOG_ROWS 30	/* max height of dialog for command output */#define MAX_OUT_DIALOG_COLS 80	/* max width of dialog for command output */#define OUTPUT_FLUSH_FREQ 1000	/* how often (msec) to flush output buffers    	    	    	    	   when process is taking too long */#define BANNER_WAIT_TIME 6000	/* how long to wait (msec) before putting up    	    	    	    	   Shell Command Executing... banner *//* flags for issueCommand */#define ACCUMULATE 1#define ERROR_DIALOGS 2#define REPLACE_SELECTION 4#define RELOAD_FILE_AFTER 8#define OUTPUT_TO_DIALOG 16#define OUTPUT_TO_STRING 32/* element of a buffer list for collecting output from shell processes */typedef struct bufElem {    struct bufElem *next;    int length;    char contents[IO_BUF_SIZE];} buffer;/* data attached to window during shell command execution with   information for controling and communicating with the process */typedef struct {    int flags;    int stdinFD, stdoutFD, stderrFD;    pid_t childPid;    XtInputId stdinInputID, stdoutInputID, stderrInputID;    buffer *outBufs, *errBufs;    char *input;    char *inPtr;    Widget textW;    int leftPos, rightPos;    int inLength;    XtIntervalId bannerTimeoutID, flushTimeoutID;    char bannerIsUp;    char fromMacro;} shellCmdInfo;static void issueCommand(WindowInfo *window, const char *command, char *input,	int inputLen, int flags, Widget textW, int replaceLeft,	int replaceRight, int fromMacro);static void stdoutReadProc(XtPointer clientData, int *source, XtInputId *id);static void stderrReadProc(XtPointer clientData, int *source, XtInputId *id);static void stdinWriteProc(XtPointer clientData, int *source, XtInputId *id);static void finishCmdExecution(WindowInfo *window, int terminatedOnError);static pid_t forkCommand(Widget parent, const char *command, const char *cmdDir,	int *stdinFD, int *stdoutFD, int *stderrFD);static void addOutput(buffer **bufList, buffer *buf);static char *coalesceOutput(buffer **bufList, int *length);static void freeBufList(buffer **bufList);static void removeTrailingNewlines(char *string);static void createOutputDialog(Widget parent, char *text);static void destroyOutDialogCB(Widget w, XtPointer callback, XtPointer closure);static void measureText(char *text, int wrapWidth, int *rows, int *cols,	int *wrapped);static void truncateString(char *string, int length);static void bannerTimeoutProc(XtPointer clientData, XtIntervalId *id);static void flushTimeoutProc(XtPointer clientData, XtIntervalId *id);static void safeBufReplace(textBuffer *buf, int *start, int *end, 	const char *text);static char *shellCommandSubstitutes(const char *inStr, const char *fileStr,	const char *lineStr);static int shellSubstituter(char *outStr, const char *inStr, const char *fileStr,	const char *lineStr, int outLen, int predictOnly);/*** Filter the current selection through shell command "command".  The selection** is removed, and replaced by the output from the command execution.  Failed** command status and output to stderr are presented in dialog form.*/void FilterSelection(WindowInfo *window, const char *command, int fromMacro){    int left, right, textLen;    char *text;    /* Can't do two shell commands at once in the same window */    if (window->shellCmdData != NULL) {    	XBell(TheDisplay, 0);    	return;    }    /* Get the selection and the range in character positions that it       occupies.  Beep and return if no selection */    text = BufGetSelectionText(window->buffer);    if (*text == '\0') {	XtFree(text);	XBell(TheDisplay, 0);	return;    }    textLen = strlen(text);    BufUnsubstituteNullChars(text, window->buffer);    left = window->buffer->primary.start;    right = window->buffer->primary.end;        /* Issue the command and collect its output */    issueCommand(window, command, text, textLen, ACCUMULATE | ERROR_DIALOGS |	    REPLACE_SELECTION, window->lastFocus, left, right, fromMacro);}/*** Execute shell command "command", depositing the result at the current** insert position or in the current selection if the window has a** selection.*/void ExecShellCommand(WindowInfo *window, const char *command, int fromMacro){    int left, right, flags = 0;    char *subsCommand, fullName[MAXPATHLEN];    int pos, line, column;    char lineNumber[11];    /* Can't do two shell commands at once in the same window */    if (window->shellCmdData != NULL) {    	XBell(TheDisplay, 0);    	return;    }        /* get the selection or the insert position */    pos = TextGetCursorPos(window->lastFocus);    if (GetSimpleSelection(window->buffer, &left, &right))    	flags = ACCUMULATE | REPLACE_SELECTION;    else    	left = right = pos;        /* Substitute the current file name for % and the current line number       for # in the shell command */    strcpy(fullName, window->path);    strcat(fullName, window->filename);    TextPosToLineAndCol(window->lastFocus, pos, &line, &column);    sprintf(lineNumber, "%d", line);        subsCommand = shellCommandSubstitutes(command, fullName, lineNumber);    if (subsCommand == NULL)    {        DialogF(DF_ERR, window->shell, 1, "Shell Command",                "Shell command is too long due to\n"                "filename substitutions with '%%' or\n"                "line number substitutions with '#'", "OK");        return;    }    /* issue the command */    issueCommand(window, subsCommand, NULL, 0, flags, window->lastFocus, left,	    right, fromMacro);    free(subsCommand);}/*** Execute shell command "command", on input string "input", depositing the** in a macro string (via a call back to ReturnShellCommandOutput).*/void ShellCmdToMacroString(WindowInfo *window, const char *command,   const char *input){    char *inputCopy;        /* Make a copy of the input string for issueCommand to hold and free       upon completion */    inputCopy = *input == '\0' ? NULL : XtNewString(input);        /* fork the command and begin processing input/output */    issueCommand(window, command, inputCopy, strlen(input),	    ACCUMULATE | OUTPUT_TO_STRING, NULL, 0, 0, True);}/*** Execute the line of text where the the insertion cursor is positioned** as a shell command.*/void ExecCursorLine(WindowInfo *window, int fromMacro){    char *cmdText;    int left, right, insertPos;    char *subsCommand, fullName[MAXPATHLEN];    int pos, line, column;    char lineNumber[11];    /* Can't do two shell commands at once in the same window */    if (window->shellCmdData != NULL) {    	XBell(TheDisplay, 0);    	return;    }    /* get all of the text on the line with the insert position */    pos = TextGetCursorPos(window->lastFocus);    if (!GetSimpleSelection(window->buffer, &left, &right)) {	left = right = pos;	left = BufStartOfLine(window->buffer, left);	right = BufEndOfLine(window->buffer, right);	insertPos = right;    } else    	insertPos = BufEndOfLine(window->buffer, right);    cmdText = BufGetRange(window->buffer, left, right);    BufUnsubstituteNullChars(cmdText, window->buffer);        /* insert a newline after the entire line */    BufInsert(window->buffer, insertPos, "\n");    /* Substitute the current file name for % and the current line number       for # in the shell command */    strcpy(fullName, window->path);    strcat(fullName, window->filename);    TextPosToLineAndCol(window->lastFocus, pos, &line, &column);    sprintf(lineNumber, "%d", line);        subsCommand = shellCommandSubstitutes(cmdText, fullName, lineNumber);    if (subsCommand == NULL)    {        DialogF(DF_ERR, window->shell, 1, "Shell Command",                "Shell command is too long due to\n"                "filename substitutions with '%%' or\n"                "line number substitutions with '#'", "OK");        return;    }    /* issue the command */    issueCommand(window, subsCommand, NULL, 0, 0, window->lastFocus, insertPos+1,	    insertPos+1, fromMacro);    free(subsCommand);    XtFree(cmdText);}/*** Do a shell command, with the options allowed to users (input source,** output destination, save first and load after) in the shell commands** menu.*/void DoShellMenuCmd(WindowInfo *window, const char *command,        int input, int output,	int outputReplacesInput, int saveFirst, int loadAfter, int fromMacro) {    int flags = 0;    char *text;    char *subsCommand, fullName[MAXPATHLEN];    int left, right, textLen;    int pos, line, column;    char lineNumber[11];    WindowInfo *inWindow = window;    Widget outWidget;    /* Can't do two shell commands at once in the same window */    if (window->shellCmdData != NULL) {    	XBell(TheDisplay, 0);    	return;    }    /* Substitute the current file name for % and the current line number       for # in the shell command */    strcpy(fullName, window->path);    strcat(fullName, window->filename);    pos = TextGetCursorPos(window->lastFocus);    TextPosToLineAndCol(window->lastFocus, pos, &line, &column);    sprintf(lineNumber, "%d", line);        subsCommand = shellCommandSubstitutes(command, fullName, lineNumber);    if (subsCommand == NULL)    {        DialogF(DF_ERR, window->shell, 1, "Shell Command",                "Shell command is too long due to\n"                "filename substitutions with '%%' or\n"                "line number substitutions with '#'", "OK");        return;    }    /* Get the command input as a text string.  If there is input, errors      shouldn't be mixed in with output, so set flags to ERROR_DIALOGS */    if (input == FROM_SELECTION) {	text = BufGetSelectionText(window->buffer);	if (*text == '\0') {    	    XtFree(text);            free(subsCommand);    	    XBell(TheDisplay, 0);    	    return;    	}    	flags |= ACCUMULATE | ERROR_DIALOGS;    } else if (input == FROM_WINDOW) {	text = BufGetAll(window->buffer);    	flags |= ACCUMULATE | ERROR_DIALOGS;    } else if (input == FROM_EITHER) {	text = BufGetSelectionText(window->buffer);	if (*text == '\0') {	    XtFree(text);	    text = BufGetAll(window->buffer);    	}    	flags |= ACCUMULATE | ERROR_DIALOGS;    } else /* FROM_NONE */    	text = NULL;        /* If the buffer was substituting another character for ascii-nuls,       put the nuls back in before exporting the text */    if (text != NULL) {	textLen = strlen(text);	BufUnsubstituteNullChars(text, window->buffer);    } else	textLen = 0;        /* Assign the output destination.  If output is to a new window,       create it, and run the command from it instead of the current       one, to free the current one from waiting for lengthy execution */    if (output == TO_DIALOG) {    	outWidget = NULL;	flags |= OUTPUT_TO_DIALOG;    	left = right = 0;    } else if (output == TO_NEW_WINDOW) {    	EditNewFile(NULL, False, NULL, window->path);    	outWidget = WindowList->textArea;	inWindow = WindowList;    	left = right = 0;    } else { /* TO_SAME_WINDOW */    	outWidget = window->lastFocus;    	if (outputReplacesInput && input != FROM_NONE) {    	    if (input == FROM_WINDOW) {    		left = 0;    		right = window->buffer->length;    	    } else if (input == FROM_SELECTION) {    	    	GetSimpleSelection(window->buffer, &left, &right);	        flags |= ACCUMULATE | REPLACE_SELECTION;    	    } else if (input == FROM_EITHER) {    	    	if (GetSimpleSelection(window->buffer, &left, &right))	            flags |= ACCUMULATE | REPLACE_SELECTION;	        else {	            left = 0;	            right = window->buffer->length;	        }	    }    	} else {	    if (GetSimpleSelection(window->buffer, &left, &right))	        flags |= ACCUMULATE | REPLACE_SELECTION;	    else    		left = right = TextGetCursorPos(window->lastFocus);    	}    }        /* If the command requires the file be saved first, save it */    if (saveFirst) {    	if (!SaveWindow(window)) {    	    if (input != FROM_NONE)    		XtFree(text);            free(subsCommand);    	    return;	}    }        /* If the command requires the file to be reloaded after execution, set       a flag for issueCommand to deal with it when execution is complete */    if (loadAfter)    	flags |= RELOAD_FILE_AFTER;    	    /* issue the command */    issueCommand(inWindow, subsCommand, text, textLen, flags, outWidget, left,	    right, fromMacro);    free(subsCommand);}/*** Cancel the shell command in progress*/void AbortShellCommand(WindowInfo *window){    shellCmdInfo *cmdData = window->shellCmdData;    if (cmdData == NULL)    	return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女精品一区二区| 欧美体内she精高潮| 亚洲狠狠爱一区二区三区| 久久综合九色综合久久久精品综合| 欧美在线观看视频在线| 色综合久久88色综合天天免费| 成人av电影在线| 成人开心网精品视频| 成人午夜大片免费观看| 国产精品亚洲午夜一区二区三区| 国产一区视频导航| 国产成人午夜电影网| 国产一区二区三区不卡在线观看| 国产在线视频精品一区| 成人一区二区三区在线观看 | 色呦呦国产精品| 91女人视频在线观看| 91福利精品视频| 欧美人xxxx| 久久亚洲一级片| 亚洲色图视频网站| 亚洲不卡一区二区三区| 久久超级碰视频| 成人av影视在线观看| 欧美色电影在线| 日韩视频一区二区三区| 久久久久久久免费视频了| 国产精品久久久久桃色tv| 亚洲精品国产a| 激情久久五月天| 91视频.com| 日韩欧美国产午夜精品| 中文字幕一区二区在线播放 | 欧美影院精品一区| 日韩欧美久久久| 亚洲欧美另类久久久精品| 日韩精品久久久久久| 国产v综合v亚洲欧| 欧美色区777第一页| 久久精品亚洲国产奇米99| 亚洲免费电影在线| 精品中文字幕一区二区小辣椒| 成人激情开心网| 欧美日韩精品欧美日韩精品一| 精品国产a毛片| 一区二区三区小说| 成人免费毛片aaaaa**| 678五月天丁香亚洲综合网| 久久精品亚洲麻豆av一区二区| 亚洲无人区一区| www.成人网.com| 精品国产乱码久久久久久牛牛 | 日韩一区二区三区在线| 成人免费在线视频| 国产精品一品二品| 欧美电影免费观看完整版| 一区二区三区毛片| 成人激情文学综合网| 国产亚洲精品7777| 激情综合色播激情啊| 欧美精品123区| 亚洲精品国产无天堂网2021| 国产成人免费9x9x人网站视频| 成人h动漫精品一区二区| 日韩三级免费观看| 日韩精品一级中文字幕精品视频免费观看 | 国产日产精品1区| 黄色小说综合网站| 精品美女一区二区| 麻豆国产91在线播放| 欧美一区二区女人| 日韩成人伦理电影在线观看| 欧美日韩高清在线| 午夜a成v人精品| 欧美女孩性生活视频| 亚洲一区二区三区自拍| 欧洲日韩一区二区三区| 亚洲午夜久久久久中文字幕久| 91影院在线免费观看| 亚洲三级久久久| 色哟哟国产精品| 亚洲第一综合色| 欧美久久一区二区| 久久精品国产在热久久| 欧美成人精品1314www| 激情五月婷婷综合网| 国产亚洲一二三区| 成人性生交大片免费看中文网站| 欧美—级在线免费片| 97se亚洲国产综合自在线不卡| 亚洲欧美日韩在线不卡| 在线视频你懂得一区| 五月激情六月综合| 欧美一二三区在线| 顶级嫩模精品视频在线看| 亚洲欧美另类久久久精品2019| 在线日韩一区二区| 美女www一区二区| 久久品道一品道久久精品| zzijzzij亚洲日本少妇熟睡| 一区二区三区在线不卡| 欧美xxxxxxxx| 99精品国产热久久91蜜凸| 亚洲成人av中文| 精品日韩在线观看| 色综合激情久久| 久久国产精品第一页| 国产精品高潮久久久久无| 欧美肥妇free| 成人sese在线| 精彩视频一区二区| 亚洲老妇xxxxxx| 精品国产凹凸成av人导航| 在线观看亚洲精品| 国产美女久久久久| 亚洲制服欧美中文字幕中文字幕| 久久久美女毛片| 欧美日韩精品是欧美日韩精品| 成人黄色综合网站| 久久99精品久久久久久动态图| 亚洲人午夜精品天堂一二香蕉| 日韩亚洲欧美一区| 91久久精品午夜一区二区| 久久99精品久久久久婷婷| 亚洲va欧美va人人爽午夜| 国产精品国产馆在线真实露脸| 欧美精品少妇一区二区三区 | 亚洲日本一区二区| 欧美va日韩va| 欧美高清激情brazzers| 91视视频在线观看入口直接观看www | 日韩一区欧美小说| 久久免费视频一区| 日韩午夜av电影| 欧美日韩国产在线观看| 91在线小视频| 成人精品国产福利| 国产黄色精品网站| 理论片日本一区| 日韩精品久久理论片| 成人黄色免费短视频| 国产视频视频一区| 国产日韩精品一区| 不卡在线观看av| 国产一区二区精品久久| 蜜桃av一区二区在线观看| 亚洲成人激情自拍| 一区二区在线观看免费视频播放 | 久久久久久久精| 日韩久久精品一区| 日韩三级视频中文字幕| 欧美大白屁股肥臀xxxxxx| 欧美日本视频在线| 51久久夜色精品国产麻豆| 精品视频一区二区不卡| 9191成人精品久久| 日韩一卡二卡三卡四卡| 欧美一级艳片视频免费观看| 7777女厕盗摄久久久| 91精品国产综合久久婷婷香蕉| 欧美三级电影在线看| 精品污污网站免费看| 91麻豆精品国产91久久久久久| 欧美挠脚心视频网站| 日韩一区二区三区在线视频| 精品噜噜噜噜久久久久久久久试看| 精品少妇一区二区| 国产精品久久久久久户外露出 | 99久久99久久免费精品蜜臀| av成人老司机| 欧美日韩一区二区欧美激情| 欧美一级日韩免费不卡| 337p粉嫩大胆色噜噜噜噜亚洲| 久久免费的精品国产v∧| 国产精品无码永久免费888| 亚洲日本免费电影| 亚洲成人久久影院| 国产综合久久久久影院| 99re6这里只有精品视频在线观看| 日本国产一区二区| 日韩欧美亚洲一区二区| 欧美国产1区2区| 午夜亚洲国产au精品一区二区| 蜜桃av一区二区三区电影| 成人一区二区三区视频| 欧美三级日韩在线| 久久影院视频免费| 自拍av一区二区三区| 三级欧美在线一区| 成人免费的视频| 4438成人网| 亚洲欧洲99久久| 激情综合网最新| 欧美亚洲尤物久久| 久久久蜜桃精品| 奇米亚洲午夜久久精品| 99国产精品国产精品久久| 欧美成人精品1314www| 一区二区三区蜜桃| 99精品视频一区|