cygrun.c

来自「cygwin, 著名的在win32下模拟unix操作系统的东东」· C语言 代码 · 共 68 行

C
68
字号
/* cygrun.c: testsuite support program   Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.This file is part of Cygwin.This software is a copyrighted work licensed under the terms of theCygwin license.  Please consult the file "CYGWIN_LICENSE" fordetails. *//* This program is intended to be used only by the testsuite.  It runs   programs without using the cygwin api, so that the just-built dll   can be tested without interference from the currently installed   dll. */#include <stdio.h>#include <windows.h>#include <stdlib.h>intmain (int argc, char **argv){  STARTUPINFO sa;  PROCESS_INFORMATION pi;  DWORD ec = 1;  char *p;  if (argc < 2)    {      fprintf (stderr, "Usage: cygrun [program]\n");      exit (0);    }  SetEnvironmentVariable ("CYGWIN_TESTING", "1");  if ((p = getenv ("CYGWIN")) == NULL || (strstr (p, "ntsec") == NULL))    {      char buf[4096];      if (!p)	{	  p = buf;	  p[0] = '\0';	}      else	{	  strcpy (buf, p);	  strcat (buf, " ");	}      strcat(buf, "ntsec");      SetEnvironmentVariable ("CYGWIN", buf);    }  memset (&sa, 0, sizeof (sa));  memset (&pi, 0, sizeof (pi));  if (!CreateProcess (0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi))    {      fprintf (stderr, "CreateProcess %s failed\n", argv[1]);      exit (1);    }  WaitForSingleObject (pi.hProcess, INFINITE);  GetExitCodeProcess (pi.hProcess, &ec);  CloseHandle (pi.hProcess);  CloseHandle (pi.hThread);  return ec;}

⌨️ 快捷键说明

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