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

📄 gcd.c

📁 这是一个符合posix.13 pse51的实时内核
💻 C
字号:
/* Project: 	HARTIK 3.0      				*/
/* Description: Hard Real TIme Kernel for 386 & higher machines */
/* Author:	Gerardo Lamastra				*/
/* Date:	9/5/96 						*/
/* Revision:	Beta 1.0					*/

/* File: GCd.C		  	*/
/* A GNU Make Helper  	  	*/
/* (Translates PATH DOS <-> GNU	*/

#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <direct.h>

#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif

void main(int argc,char *argv[])
{
    char path[160];
    register i,len;
    
    switch (argc) {
	case 1 :  getcwd(path,160);
		  printf("%s\n",path);
		  break;
	case 2 :  strcpy(path,argv[1]);
		  len = max(strlen(path),160);
		  for (i = 0; i < len; i++)
		       if (path[i] == '/') path[i] = '\\';
		  if (chdir(path) != 0) printf("Unvalid directory\n");
		  break;
	default : printf("Too much parameters\n");
		  break;
    }
}

⌨️ 快捷键说明

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