返回列表 发帖
本帖最后由 Bella 于 2016-10-19 19:37 编辑

回复 14# /zhqsystem/zhq

mtr


winMTR
1

评分人数

TOP

回复 15# freesoft00


    ping百度就行了, 我觉得百度就是用来ping的
1

评分人数

    • CrLf: 哈哈哈哈哈哈技术 + 1

TOP

回复 17# Bella

举十指十趾赞成, 那就是那货最大的用处
1

评分人数

TOP

本帖最后由 happy886rr 于 2016-10-10 20:59 编辑

生成utf8
set/p=联<NUL>bom.txtCOPY
1

评分人数

    • CrLf: 确定不是来黑的吗技术 + 1

TOP

突然想起锟斤拷

本帖最后由 523066680 于 2016-10-10 23:37 编辑
    [ef bb] [bf e9] [b4 a8]
GBK 锘      块      川
    [ef bb bf] [e9 b4 a8 ]
UTF8   BOM        鴨COPY
[url=][/url]

TOP

bat吧的Byaidu曾经发现过一个管道的特技
第一眼看到被惊艳了,感觉非常有趣,很有潜力,大概是这个样子

demo.bat 主程序
@makelist|output
@pauseCOPY
makelist.bat 生成数列
@echo off
for /l %%i in (1 1 20) do (
    echo %%i
    ping -n 1 localhost >nul
)COPY
output.bat 输出
@echo off
:loop
set n=
set /p n=
if not "%n%"=="" (
    set /a "n=1<<n"
    call echo %%n%%
    goto loop
) else echo end!COPY
双击Demo.bat看效果

TOP

本帖最后由 pcl_test 于 2016-10-16 16:49 编辑

回复 21# bailong360

简化下代码
for /l %%i in (1 1 20) do echo;%%i|(set /p n=&call set /a "1<<%%n%%"&echo;)COPY
跟(for /l %%i in (1 1 5) do set /p line=&call echo;%%line%%)<a.txt是类似的吧

TOP

回复 22# pcl_test
原理应该是一样的,只是原以为cmd的管道是先获取了全部输出再传递给下一个程序,觉得可以动态地获取很不可思议
有进程间通信的feel

TOP

本帖最后由 CrLf 于 2016-10-17 04:04 编辑

回复 23# bailong360
dir /s \ | find "Desktop"COPY
你会发现包括 more、find 在内的很多第三方工具是“边下边播”的,而 for /f %%a in ('[COMMAND]') do xx 则是要等 [COMMAND] 执行完毕才会开始 do


贴吧原帖链接:http://tieba.baidu.com/p/4377042621

这方法其实并没有太大的实用性...它的价值其实在于引出几个很有趣的问题:
这些输出是被谁吃了?
用 set /p 为什么会跳行(改用 c 语言编译的 gets 或 getch 亦然)?
又为什么不是在延时之后立刻出现跳行现象,而一定是发生在延时的下下次 set /p?
以及 ping 之后为什么会得到奇怪的结果?
为什么会 :OUT 居然会停下来等待 :IN 的 pause?

奉上测试代码,有心人自然会意:
@echo off
%1 %0 :OUT | %0 :IN
goto %1 :eof
:OUT
set /a a+=1
echo %a%
title %a%
goto :OUT
:IN
setlocal enabledelayedexpansion
echo -----------------
set /p input=
echo     1:!input!
set /p input2=
echo     2:!input2!
set /p input3=
echo     3:!input3!
set /p input4=
echo     4:!input4! [before sleep]
for /l %%a in (1 1 1000) do (cd .)
set /p input5=
echo     5:!input5! [after sleep]
set /p input6=
echo     6:!input6!
set /p input7=
echo     7:!input7!
set /p input8=
echo     8:!input8! [before ping]
ping /n 1 127.1 >nul
set /p input9=
echo     9:!input9! [after ping]
set /p input10=
echo    10:!input10!
set /p input11=
echo    11:!input11!
set /p input10=
echo    12:!input12!
set /p input10=
echo    13:!input13! [before pause]
pause<con
set /p input10=
echo    14:!input14! [after pause]
set /p input10=
echo    15:!input15!
set /p input10=
echo    16:!input16!
pause<con
endlocal
goto :INCOPY
通过改变变量 a 的长度并观察 title 停止刷新时的值,解方程可知管道缓冲区的 BufferSize=4095,末尾必须用于存放 \0
于是前面的现象也就得到了解答——都是缓冲区惹的祸

【以下均为推测】
假设执行了一个 命令A | 命令B,在管道内发生了如下逻辑:
命令A 执行时,向缓冲区写入文本,
当缓冲区写满 4095 字节时(含回车换行),命令A 挂起,
当缓冲区被读取时,唤醒 命令A 继续执行(唤醒的过程可能会有一个耗时),
(存疑)在命令A 唤醒时,cmd 会清理一部分缓冲区(时多时少,规律不明),
当命令A 关闭时,命令B 的 stdin 为空

也就是说,跳行的原因还是一个谜

-----------------------------------------------------------------------------------
找到两篇文章,部分佐证了这个观点:
http://blog.csdn.net/qzwujiaying/article/details/6027570
http://blog.csdn.net/guang11cheng/article/details/17144907
3

评分人数

TOP

更有意思的是用不同方式同时读取 stdin,得到的内容居然是两条时间线:
#include <windows.h>
#include <stdio.h>
main(){
int i=0,j=0;
wchar_t str[8192]=L"";
char temp[1111]="";
for(i=0;++i;){
Sleep(1000);
fgetws(str,1024,stdin);
wprintf(L"@1 %s\r\n",str);
fgetws(str,1024,stdin);
wprintf(L"@2 %s\r\n",str);
system("set /p n=&call echo Batch: %n%");
fgetws(str,1024,stdin);
wprintf(L"@3 %s\r\n",str);
fgetws(str,1024,stdin);
wprintf(L"@4 %s\r\n",str);
getch();
}
}COPY
结论:cmd 打破时空壁垒,穿越了

TOP

本帖最后由 aa77dd@163.com 于 2016-10-17 13:01 编辑

回复 24# CrLf

set /p 后面的
input10

从 12 到 16 是不是木有改呢

象是关于 cmd 的管道阻塞处理方式

Desktop App>Technologies System Services>Interprocess Communications>\"\"ipes

Pipe Functions

管道编程

The Windows Pipes Programming - windows“管道”编程 之 "匿名管道"


那个老版的 CMD 源码中有个 文件 cop.c,  包含了 4 个关于管道的函数 ePipe ,PipeErr, PipeWait, BreakPipes
文件 600+ 行, 我就贴上吧
cop.c
#include "cmd.h"
extern int LastRetCode;
extern int ExtCtrlc; /* @@1 */
/*  M000 ends */
unsigned PipeCnt ; /* M007 - Active pipe count    */
struct pipedata *PdHead = NULL; /* M007 - 1st element of pipedata list    */
struct pipedata *PdTail = NULL; /* M007 - Last element of pipedata list    */
unsigned PipePid ; /* M007 - Communication with ECWork    */
/*** eComSep - execute a statement containing a command separator
*
*  Purpose:
* Execute the left and right hand sides of a command separator
* operator.
*
*  int eComSep(struct node *n)
*
*  Args:
* n - parse tree node containing the command separator node
*
*  Returns:
* Whatever the right hand side returns.
*
*  Notes:
* Revised to always supply both args to Dispatch().
*/
int eComSep(n)
struct node *n ;
{
Dispatch(RIO_OTHER,n->lhs) ;
return(Dispatch(RIO_OTHER,n->rhs)) ;
}
/*** eOr - execute an OR operation
*
*  Purpose:
* Execute the left hand side of an OR operator (||).  If it succeeds,
* quit.  Otherwise execute the right side of the operator.
*
*  int eOr(struct node *n)
*
*  Args:
* n - parse tree node containing the OR operator node
*
*  Returns:
* If the left hand side succeeds, return SUCCESS.  Otherwise, return
* whatever the right side returns.
*
*  Notes:
* Revised to always supply both args to Dispatch().
*/
int eOr(n)
struct node *n ;
{
        int i ;                         /* Retcode from L.H. side of OR   */
if ((i = Dispatch(RIO_OTHER,n->lhs)) == SUCCESS)
    return(SUCCESS) ;
else {
            LastRetCode = i;
    return(Dispatch(RIO_OTHER,n->rhs)) ;
        }
}
/*** eAnd - execute an AND operation
*
*  Purpose:
* Execute the left hand side of an AND operator (&&).  If it fails,
* quit.  Otherwise execute the right side of the operator.
*
*  int eAnd(struct node *n)
*
*  Args:
* n - parse tree node containing the AND operator node
*
*  Returns:
* If the left hand side fails, return its return code.  Otherwise, return
* whatever the right side returns.
*
*  Notes:
* Revised to always supply both args to Dispatch().
*/
int eAnd(n)
struct node *n ;
{
int i ; /* Retcode from L.H. side of AND   */
if ((i = Dispatch(RIO_OTHER,n->lhs)) != SUCCESS)
return(i) ;
else
return(Dispatch(RIO_OTHER,n->rhs)) ;
}
/********************* START OF SPECIFICATION **************************/
/*        */
/* SUBROUTINE NAME: ePipe        */
/*        */
/* DESCRIPTIVE NAME: Pipe Process        */
/*        */
/* FUNCTION: Execute the left side of the pipe and direct its output to*/
/*      the right side of the pipe.        */
/*        */
/* NOTES: None        */
/*        */
/*        */
/* ENTRY POINT: ePipe        */
/*    LINKAGE: NEAR        */
/*        */
/* INPUT: n - parse tree node containing the pipe operator        */
/*        */
/* OUTPUT: None        */
/*        */
/* EXIT-NORMAL: The return code of the right side process.        */
/*        */
/* EXIT-ERROR: Failure if no pipe redirection can take place.        */
/*        */
/* EFFECTS:        */
/*        */
/*    struct pipedata {        */
/*    unsigned rh ;        Pipe read handle        */
/*    unsigned wh ;        Pipe write handle        */
/*    unsigned shr ;        Handles where the normal...     */
/*    unsigned shw ;        ...STDIN/OUT handles are saved  */
/*    unsigned lPID ;        Pipe lh side PID        */
/*    unsigned rPID ;        Pipe rh side PID        */
/*    unsigned lstart ;        Start Information of lh side @@4*/
/*    unsigned rstart ;        Start Information of rh side @@4*/
/*    struct pipedata *prvpds ;   Ptr to previous pipedata struct */
/*    struct pipedata *nxtpds ;   Ptr to next pipedata struct     */
/*       }        */
/*        */
/*    unsigned PipePID;        Pipe Process ID        */
/*        */
/*    unsigned start_type;        Start Information        */
/*        */
/*        */
/* INTERNAL REFERENCES:        */
/* ROUTINES:        */
/* PutStdErr -  Print an error message        */
/* Abort    -  Terminate program with abort        */
/* SetList   -  Set Link List for pipedata structure        */
/* Cdup    -  Duplicate supplied handle and save the new handle*/
/* Cdup2    -  Duplicate supplied handle and save the new handle*/
/* Dispatch  -  Execute the program        */
/* PipeErr   -  Handle pipe error        */
/* Cclose    -  Close the specified handle        */
/* PipeWait  -  Wait for the all pipe process completion        */
/*        */
/* EXTERNAL REFERENCES:        */
/* ROUTINES:        */
/* DOSMAKEPIPE - Make pipe        */
/*        */
/********************** END  OF SPECIFICATION **************************/
/*** ePipe - Create a pipeline between two processes (M000)
*
*  Purpose:
* Execute the left side of the pipe and direct its output to
* the right side of the pipe.
*
*  int ePipe(struct node *n)
*
*  Args:
* n - parse tree node containing the pipe operator
*
*  Returns:
* The return code of the right side process or failure if no
* pipe redirection can take place.
*
*  Notes:
* M007 - This function has been completely rewritten for real pipes.
*
*/
int ePipe(n)
struct node *n ;
{
struct pipedata *Pd ; /* Pipe struct pointer    */
int k = 0 ; /* RH side return code    */
struct node *l ; /* Copy of left side arg   */
struct node *r ; /* Copy of right side arg  */
extern unsigned start_type ; /* API type used to start  */
TCHAR cflags ; /*    */
l = n->lhs ; /* Equate locals to...    */
r = n->rhs ; /* ...L & R operations    */
DEBUG((OPGRP,PILVL,"PIPES:LH = %d, RH = %d ",l->type,r->type)) ;
if (!(Pd = (struct pipedata *)mkstr(sizeof(struct pipedata)))) {
DEBUG((OPGRP,PILVL,"PIPES:Couldn't alloc structure!")) ;
return(FAILURE) ;
} ;
if (_pipe((int *)Pd, 0, O_BINARY)) {
DEBUG((OPGRP,PILVL,"PIPES:pipe failed!")) ;
PutStdErr(ERROR_NOT_ENOUGH_MEMORY, NOARGS); /* M013    */
return(FAILURE) ;
Abort() ;
} ;
SetList(Pd->rh) ; /* M009 */
SetList(Pd->wh) ; /* M009 */
DEBUG((OPGRP,PILVL,"PIPES:Pipe built. Handles: rd = %d wt = %d ",Pd->rh, Pd->wh)) ;
DEBUG((OPGRP,PILVL,"PIPES:Pipe (pre-index) count = %d", PipeCnt)) ;
if (!PipeCnt++) { /* Already some pipes?    */
PdHead = PdTail = Pd ; /* No, set head/tail ptrs  */
Pd->prvpds = NULL ; /* No previous structure   */
DEBUG((OPGRP,PILVL,"PIPES:This is first pipe.")) ;
} else {
DEBUG((OPGRP,PILVL,"PIPES:This is pipe %d.", PipeCnt)) ;
PdTail->nxtpds = Pd ;
Pd->prvpds = PdTail ;
Pd->nxtpds = NULL ;
PdTail = Pd ;
} ;
if ((Pd->shw = Cdup(STDOUT)) == BADHANDLE) {   /* Save STDOUT (M009) */
Pd->shw = BADHANDLE ; /* If err, go process it   */
PipeErr() ; /* DOES NOT RETURN    */
} ;
DEBUG((OPGRP,PILVL,"PIPES:STDOUT dup'd to %d.", Pd->shw)) ;
if (Cdup2(Pd->wh, STDOUT) == BADHANDLE) /* Make wh STDOUT (M009)   */
PipeErr() ; /* DOES NOT RETURN    */
Cclose(Pd->wh) ; /* Close pipe hndl (M009)  */
Pd->wh = 0 ; /* And zero the holder    */
if (l->type <= CMDTYP)   /* @@5a */
  {   /* @@5a */
    FindAndFix( (struct cmdnode *) l, &cflags ) ; /* @@5a */
  }   /* @@5a */
DEBUG((OPGRP,PILVL,"PIPES:Write pipe now STDOUT")) ;
k = Dispatch(RIO_PIPE,l) ;
        DuplicateHandle( (HANDLE)PipePid, CRTTONT(Pd->rh),
                        NULL, NULL, 0, FALSE, DUPLICATE_CLOSE_SOURCE);
if (Cdup2(Pd->shw, STDOUT) == BADHANDLE) /* M009 */
PipeErr() ; /* DOES NOT RETURN    */
Cclose(Pd->shw) ; /* M009 */
Pd->shw = 0 ;
DEBUG((OPGRP,PILVL,"PIPES:STDOUT now handle 1 again.")) ;
if (k) {
ExtCtrlc = 2; /* @@1 */
Abort() ;
}
Pd->lPID = PipePid ;
Pd->lstart = start_type ;  /* Save the start_type in pipedata struct */
PipePid = 0 ;
start_type = NONEPGM ;    /* Reset the start_type     D64      */
DEBUG((OPGRP,PILVL,"PIPES:Dispatch LH side succeeded - LPID = %d.",Pd->lPID)) ;
if ((Pd->shr = Cdup(STDIN)) == BADHANDLE) {    /* Save STDIN (M009) */
Pd->shr = BADHANDLE ;
PipeErr() ; /* DOES NOT RETURN    */
} ;
DEBUG((OPGRP,PILVL,"PIPES:STDIN dup'd to %d.", Pd->shr)) ;
if (Cdup2(Pd->rh, STDIN) == BADHANDLE) /* Make rh STDIN (M009)    */
PipeErr() ; /* DOES NOT RETURN    */
Cclose(Pd->rh) ; /* Close pipe hndl (M009)  */
Pd->rh = 0 ; /* And zero the holder    */
if (r->type <= CMDTYP)      /* @@5a */
  {      /* @@5a */
    FindAndFix( (struct cmdnode *) r, &cflags) ;     /* @@5a */
  } ;      /* @@5a */
DEBUG((OPGRP,PILVL,"PIPES:Read pipe now STDIN")) ;
k = Dispatch(RIO_PIPE,r) ;
if (Cdup2(Pd->shr, STDIN) == BADHANDLE) /* M009 */
PipeErr() ; /* DOES NOT RETURN    */
Cclose(Pd->shr) ; /* M009 */
Pd->shr = 0 ;
DEBUG((OPGRP,PILVL,"PIPES:STDIN now handle 0 again.")) ;
if (k) {
ExtCtrlc = 2; /* @@1 */
Abort() ;
}
Pd->rPID = PipePid ;
Pd->rstart = start_type ;  /* Save the start_type in pipedata struct */
PipePid = 0 ;
start_type = NONEPGM ;    /* Reset the start_type  D64      */
DEBUG((OPGRP,PILVL,"PIPES:Dispatch RH side succeeded - RPID = %d.",Pd->rPID)) ;
if (!(--PipeCnt)) { /* Additional pipes?    */
DEBUG((OPGRP,PILVL,"PIPES:Returning from top level pipe. Cnt = %d", PipeCnt)) ;
return(PipeWait()) ; /* No, return CWAIT    */
} ;
DEBUG((OPGRP,PILVL,"PIPES:Returning from pipe. Cnt = %d", PipeCnt)) ;
return(k) ; /* Else return exec ret    */
}
/*** PipeErr - Fixup and error out following pipe error
*
*  Purpose:
* To provide single error out point for multiple error conditions.
*
*  int PipeErr()
*
*  Args:
* None.
*
*  Returns:
* DOES NOT RETURN TO CALLER.  Instead it causes an internal Abort().
*
*/
void PipeErr()
{
PutStdErr(MSG_PIPE_FAILURE, NOARGS) ; /* M013    */
Abort() ;
}
/********************* START OF SPECIFICATION **************************/
/*        */
/* SUBROUTINE NAME: PipeWait        */
/*        */
/* DESCRIPTIVE NAME: Wait and Collect Retcode for All Pipe Completion  */
/*        */
/* FUNCTION: This routine calls WaitProc or WaitTermQProc for all      */
/*      pipelined processes until entire pipeline is finished.    */
/*      The return code of right most element is returned.        */
/*        */
/* NOTES:    If the pipelined process is started by DosExecPgm,        */
/*      WaitProc is called.  If the pipelined process is started  */
/*      by DosStartSession, WaitTermQProc is called.        */
/*        */
/*        */
/* ENTRY POINT: PipeWait        */
/*    LINKAGE: NEAR        */
/*        */
/* INPUT: None        */
/*        */
/* OUTPUT: None        */
/*        */
/* EXIT-NORMAL:  No error return code        */
/*        */
/* EXIT-ERROR: Error return code from either WaitTermQProc or WaitProc*/
/*        */
/*        */
/* EFFECTS: None.        */
/*        */
/* INTERNAL REFERENCES:        */
/* ROUTINES:        */
/* WaitProc - wait for the termination of the specified process, */
/*     its child process, and  related pipelined        */
/*     processes.        */
/*        */
/* WaitTermQProc - wait for the termination of the specified     */
/* session and related pipelined session.        */
/*        */
/* EXTERNAL REFERENCES:        */
/* ROUTINES:        */
/* WINCHANGESWITCHENTRY -  Change switch list entry        */
/*        */
/********************** END  OF SPECIFICATION **************************/
/*** PipeWait - wait and collect retcode for all pipe completion (M007)
*
*  Purpose:
* To do cwaits on all pipelined processes until entire pipeline
* is finished.  The retcode of the rightmost element of the pipe
* is returned.
*
*  int PipeWait()
*
*  Args:
* None.
*
*  Returns:
* Retcode of rightmost pipe process.
*
*/
PipeWait()
{
unsigned i ;
DEBUG((OPGRP,PILVL,"PIPEWAIT:Entered - PipeCnt = %d", PipeCnt)) ;
while (PdHead) {
if (PdHead->lPID) {
     DEBUG((OPGRP, PILVL, "PIPEWAIT: lPID %d, lstart %d", PdHead->lPID, PdHead->lstart));
     if ( PdHead->lstart == EXECPGM )
       {
i = WaitProc(PdHead->lPID) ; /* M012 - Wait LH   */
DEBUG((OPGRP,PILVL,"PIPEWAIT:CWAIT on LH - Ret = %d, SPID = %d", i, PdHead->lPID)) ;
       }
//      else
//        {
// WaitTermQProc(PdHead->lPID, &i) ;
//
// DEBUG((OPGRP,PILVL,"PIPEWAIT:Read TermQ on LH - Ret = %d, PID = %d", i, PdHead->lPID)) ;
//        } ;
//
} ;
if (PdHead->rPID) {
     DEBUG((OPGRP, PILVL, "PIPEWAIT: rPID %d, rstart %d", PdHead->rPID, PdHead->rstart));
     if ( PdHead->rstart == EXECPGM )
       {
i = WaitProc(PdHead->rPID) ; /* M012 - Wait RH   */
DEBUG((OPGRP,PILVL,"PIPEWAIT:CWAIT on RH - Ret = %d, PID = %d", i, PdHead->rPID)) ;
       }
//      else
//        {
// WaitTermQProc(PdHead->rPID, &i) ;
//
// DEBUG((OPGRP,PILVL,"PIPEWAIT:Read TermQ on LH - Ret = %d, PID = %d", i, PdHead->rPID)) ;
//        } ;
} ;
PdHead = PdHead->nxtpds ;
} ;
DEBUG((OPGRP,PILVL,"PIPEWAIT: complete, Retcode = %d", i)) ;
PdTail = NULL ; /* Cancel linked list...    */
PipeCnt = PipePid = 0 ; /* ...pipe count and pipe PID    */
        LastRetCode = i;
return(i) ;
}
/*** BreakPipes - disconnect all active pipes  (M000)
*
*  Purpose:
* To remove the temporary pipe files and invalidate the pipedata
* structure when pipes are to be terminated, either through the
* completion of the pipe operation or SigTerm.
*
* This routine is called directly by the signal handler and must
* not generate any additional error conditions.
*
*  void BreakPipes()
*
*  Args:
* None.
*
*  Returns:
* Nothing.
*
*  Notes:
* M007 - This function has been completely rewritten for real pipes.
*
* *** W A R N I N G ! ***
* THIS ROUTINE IS CALLED AS A PART OF SIGNAL/ABORT RECOVERY AND
* THEREFORE MUST NOT BE ABLE TO TRIGGER ANOTHER ABORT CONDITION.
*
*/
void BreakPipes()
{
unsigned i ;
struct pipedata *pnode;
DEBUG((OPGRP,PILVL,"BRKPIPES:Entered - PipeCnt = %d", PipeCnt)) ;
/* The following two lines have been commented out */
/* because the NULL test on PdTail should be enough, */
/* and more importantly, even if PipeCnt is 0, you */
/* may still have been servicing a pipe in Pipewait */
/* if (!PipeCnt)        */ /* If no active pipes...   */
/* return ;       */ /* ...don't do anything    */
pnode = PdTail;
/* First, kill all of the processes */
while (pnode) {
if (pnode->lPID) {
/* M012 */ i = KillProc(pnode->lPID, FALSE) ; /* Kill LH   */
DEBUG((OPGRP,PILVL,"BRKPIPES:LH (Pid %d) killed - Retcode = %d", PdTail->lPID, i)) ;
} ;
if (pnode->rPID) {
/* M012 */ i = KillProc(pnode->rPID, FALSE) ; /* Kill RH   */
DEBUG((OPGRP,PILVL,"BRKPIPES:RH (Pid %d) killed - Retcode = %d", PdTail->rPID, i)) ;
} ;
pnode = pnode->prvpds ;
}
/* Wait for the processes to die, and clean up file handles */
while (PdTail) {
if (PdTail->lPID) {
   if (PdTail->lstart == EXECPGM) {
      i = WaitProc(PdTail->lPID);
//    } else {
//       WaitTermQProc(PdTail->lPID, &i) ;
   }
} ;
if (PdTail->rPID) {
   if (PdTail->rstart == EXECPGM) {
      i = WaitProc(PdTail->rPID);
//    } else {
//       WaitTermQProc(PdTail->rPID, &i) ;
   }
} ;
if (PdTail->rh) {
Cclose(PdTail->rh) ; /* M009 */
DEBUG((OPGRP,PILVL,"BRKPIPES:Pipe read handle closed")) ;
} ;
if (PdTail->wh) {
Cclose(PdTail->wh) ; /* M009 */
DEBUG((OPGRP,PILVL,"BRKPIPES:Pipe write handle closed")) ;
} ;
if(PdTail->shr) {
FlushFileBuffers(CRTTONT(PdTail->shr));
Cdup2(PdTail->shr, STDIN) ; /* M009 */
Cclose(PdTail->shr) ; /* M009 */
DEBUG((OPGRP,PILVL,"BRKPIPES:STDIN restored.")) ;
} ;
if(PdTail->shw) {
Cdup2(PdTail->shw, STDOUT) ; /* M009 */
Cclose(PdTail->shw) ; /* M009 */
DEBUG((OPGRP,PILVL,"BRKPIPES:STDOUT restored.")) ;
} ;
PdTail = PdTail->prvpds ;
} ;
PdHead = NULL ; /* Cancel linked list...    */
PipeCnt = PipePid = 0 ; /* ...pipe count and pipe PID    */
DEBUG((OPGRP,PILVL,"BRKPIPES:Action complete, returning")) ;
}
/*** eParen - execute a parenthesized statement group
*
*  Purpose:
* Execute the group of statements enclosed by a statement grouping
* operator; parenthesis().
*
*  int eParen(struct node *n)
*
*  Args:
* n - parse tree node containing the PAREN operator node
*
*  Returns:
* Whatever the statement group returns.
*
*  Notes:
* M000 - Altered to always supply both args to Dispatch().
* M004 - Debug statements were added for SILTYP operator.
* **  WARNING  **
* BOTH THE LEFT PAREN AND THE SILENT OPERATOR (@) USE eParen
* WHEN DISPATCHED.  CHANGING ONE WILL AFFECT THE OTHER !!
*/
int eParen(n)
struct node *n ;
{
#ifndef NODEB
if (n->type == PARTYP)
                DEBUG((OPGRP,PNLVL,"ePAREN: Operator is Paren")) ;
else if (n->type == SILTYP)
                DEBUG((OPGRP,PNLVL,"ePAREN: Operator is Silent")) ;
#endif
return(Dispatch(RIO_OTHER,n->lhs)) ;
}COPY
我还是去浇花来得轻松
https://play.google.com/store/ap ... m.tedrasoft.plumber

TOP

本帖最后由 Bella 于 2016-10-17 15:19 编辑

回复 24# CrLf
@echo off
fsutil file createnew 4176B 4176 >nul
echo 4176B
type 4176B | cd >nul
pause
echo;
fsutil file createnew 4177B 4177 >nul
echo 4177B
type 4177B | cd >nul
pauseCOPY

TOP

回复 27# Bella


    这是为什么呢?
1

评分人数

    • Bella: 严禁灌水技术 + 1

TOP

回复 28# CrLf


    4176 = 4096 + 80
1

评分人数

    • Bella: 发错版块技术 + 1

TOP

本帖最后由 Bella 于 2016-10-20 02:30 编辑

回复 28# CrLf


fsutil file createnew 这命令不错, 测试的时候有用
1

评分人数

    • aa77dd@163.com: 我喜欢仅有一个\0的文件 fsutil file crea ...技术 + 1

TOP

返回列表