getcwd.c
来自「newos is new operation system」· C语言 代码 · 共 42 行
C
42 行
/* ** Copyright 2001, Manuel J. Petit. All rights reserved.** Distributed under the terms of the NewOS License.*/#include <unistd.h>#include <stdlib.h>#include <sys/syscalls.h>/* * XXXfreston: this should be a system definition */#define MAXPATHLEN 1024char *getcwd(char *buf, size_t len){ int rc; char *_buf; _buf= buf?buf:malloc(len); rc= _kern_getcwd(_buf, len); if(rc< 0) { if(buf!= _buf) { free(_buf); } _buf= 0; } return _buf;}char *getwd(char *buf){ return getcwd(buf, MAXPATHLEN);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?