亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美日韩不卡一区| 在线播放欧美女士性生活| 国产精品一卡二卡| 国产成人a级片| 91黄色免费网站| 日韩午夜在线观看视频| 久久久美女艺术照精彩视频福利播放| 精品久久国产字幕高潮| 国产日韩亚洲欧美综合| 亚洲日穴在线视频| 视频一区免费在线观看| 国产精品99久久久久久似苏梦涵 | 欧美videossexotv100| 中文字幕欧美日本乱码一线二线| 国产精品久久毛片av大全日韩| 亚洲一区视频在线| 国产精品羞羞答答xxdd| 欧美精品粉嫩高潮一区二区| 精品久久人人做人人爽| 亚洲国产精品影院| 成人高清视频在线| 日韩亚洲欧美中文三级| 亚洲伊人伊色伊影伊综合网| 国产精品资源在线观看| 91麻豆精品国产综合久久久久久| 国产天堂亚洲国产碰碰| 免费观看在线综合| 91首页免费视频| 日韩伦理av电影| 国产suv精品一区二区6| 日韩欧美色综合网站| 青青青伊人色综合久久| 日韩欧美一区中文| 青青草国产精品亚洲专区无| 欧美日韩成人综合在线一区二区| 亚洲视频综合在线| 91久久香蕉国产日韩欧美9色| 欧美国产欧美综合| 精品中文字幕一区二区小辣椒| 日本道免费精品一区二区三区| 中文字幕一区二区三区在线播放 | 韩国三级在线一区| 日韩精品在线网站| 中文av一区二区| 成人午夜激情片| 蜜桃av一区二区| 国产麻豆精品视频| 精品中文字幕一区二区| 卡一卡二国产精品| 韩国成人在线视频| 国产又黄又大久久| 国产精品亚洲а∨天堂免在线| 日韩国产一区二| 久久精品999| 国产精品香蕉一区二区三区| 国产一区 二区| 在线电影欧美成精品| 欧美日韩国产高清一区二区| 欧美日韩电影在线| 欧美成人一区二区三区在线观看| 久久久久久久综合狠狠综合| 国产免费久久精品| 性久久久久久久久| 国产精品综合av一区二区国产馆| 春色校园综合激情亚洲| 国产一区二区三区精品欧美日韩一区二区三区 | 国产欧美综合在线| 国产精品午夜电影| 亚洲黄色尤物视频| 久久99精品久久久久婷婷| 成人国产精品免费| 欧美日韩国产一区二区三区地区| 欧美三级中文字幕| 精品美女在线播放| 亚洲午夜电影在线| 国产精品自拍av| 欧美日韩精品一区二区三区蜜桃| 综合av第一页| 乱中年女人伦av一区二区| 91麻豆精东视频| 成人网在线免费视频| 色哟哟在线观看一区二区三区| 国产原创一区二区三区| 亚洲美女视频在线| 亚洲免费观看高清在线观看| 91蜜桃网址入口| 69堂亚洲精品首页| 欧美一区二区三区系列电影| 日本不卡不码高清免费观看| 欧美精品久久一区| 日本一区二区电影| 色婷婷av久久久久久久| 欧美三片在线视频观看| 国产日韩av一区二区| 国产一本一道久久香蕉| 懂色av中文字幕一区二区三区| 成人一区二区三区| 日本成人中文字幕在线视频| 亚洲电影第三页| 日韩va亚洲va欧美va久久| 在线视频国产一区| 欧美日韩一区二区在线视频| 亚洲色图19p| 国产精品中文字幕日韩精品| 国产欧美一区二区三区网站 | 久久久久久久久久久久电影| 国产三级欧美三级日产三级99| 国产精品天干天干在线综合| 亚洲午夜激情网站| 91豆麻精品91久久久久久| 亚洲高清免费观看| 91久久一区二区| 亚洲va欧美va人人爽| 久久久久久久久久久电影| 日本网站在线观看一区二区三区| 91精品国产麻豆国产自产在线 | 久久久五月婷婷| 91精品国产免费久久综合| 1区2区3区欧美| 国产日韩亚洲欧美综合| 欧美日韩综合在线| 日韩一本二本av| 亚洲国产精品成人久久综合一区| 成人97人人超碰人人99| 亚洲另类色综合网站| 欧美三级乱人伦电影| 奇米影视一区二区三区| 一区二区三区影院| 亚洲精品中文字幕在线观看| 亚洲精品视频在线| 精品亚洲成av人在线观看| 欧美日韩情趣电影| 黄色小说综合网站| 中文幕一区二区三区久久蜜桃| 91精品一区二区三区在线观看| 精品对白一区国产伦| 国产精品综合久久| 亚洲婷婷综合久久一本伊一区| 91精品国产综合久久国产大片| 国产成人在线观看| 婷婷久久综合九色综合绿巨人| 欧美精品一区二区三区一线天视频 | 国产成人在线免费观看| 欧美韩国日本一区| 日韩天堂在线观看| 亚洲精品va在线观看| 免费欧美高清视频| 精品国产第一区二区三区观看体验| 久久久久久影视| 91麻豆成人久久精品二区三区| 亚洲美女视频在线观看| 日韩欧美一二区| 欧美无砖专区一中文字| 99久久婷婷国产| 高清成人在线观看| 日韩av午夜在线观看| 亚洲精品日日夜夜| 日本一区二区三区dvd视频在线| 欧美日韩高清不卡| 欧美日韩精品一区二区三区四区 | 久久综合色8888| 欧美亚洲综合在线| 91网站黄www| av高清不卡在线| 成人短视频下载| av在线不卡电影| 91免费看`日韩一区二区| av激情综合网| www.欧美色图| 91网站最新地址| 色久优优欧美色久优优| 色综合久久88色综合天天免费| 在线亚洲人成电影网站色www| www.欧美.com| 色综合久久久网| 粉嫩av一区二区三区在线播放| 成人18精品视频| bt7086福利一区国产| 91在线视频网址| 欧美探花视频资源| 欧美一区二区三区色| 久久你懂得1024| 亚洲欧美日韩成人高清在线一区| 日韩一区欧美一区| 免费欧美在线视频| 99久久精品久久久久久清纯| 欧美性大战久久久久久久蜜臀| 日韩精品在线看片z| 国产精品二区一区二区aⅴ污介绍| 亚洲美女淫视频| 麻豆精品精品国产自在97香蕉| 成人综合在线网站| 欧美高清视频一二三区| 国产精品久久久久天堂| 热久久免费视频| 欧美在线三级电影| 久久精品亚洲麻豆av一区二区 | 日韩精品欧美精品| 99免费精品在线| 久久亚洲精品小早川怜子|