📄 getwd.c
字号:
/* * 4.2bsd getwd simulation for Sys V.3 */#include <stdio.h>#define SYSV3#define MAXWD 1024 /* limited by 4.2 getwd(2) */#ifdef SYSV3char *getcwd();char *getwd(path)char *path;{ return(getcwd(path,MAXWD));}#else/* * 4.2bsd getwd simulation for Sys V.2 */#include <stdio.h>#define MAXWD 1024 /* limited by 4.2 getwd(2) */char *getwd(path)char *path;{ char *nlp; FILE *fp; FILE *popen(); char *strrchr(); putenv("IFS= \t\n"); fp = popen("PATH=/bin:/usr/bin pwd", "r"); if (fp == NULL) return 0; if (fgets(path, MAXWD, fp) == NULL) { (void) pclose(fp); return 0; } if ((nlp = strrchr(path, '\n')) != NULL) *nlp = '\0'; (void) pclose(fp); return path;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -