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

📄 dirname.c

📁 Solaris操作系统下的过滤驱动程序, C源码程序.
💻 C
字号:
/* * Copyright (c) 1997-2003 Erez Zadok * Copyright (c) 2001-2003 Stony Brook University * Copyright (c) 1997-2000 Columbia University * * For specific licensing information, see the COPYING file distributed with * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. * * This Copyright notice must be kept intact and distributed with all * fistgen sources INCLUDING sources generated by fistgen. *//* replacement function from glibc */char *dirname(char *path){  static const char dot[] = ".";  char *last_slash;  /* Find last '/'.  */  last_slash = path != NULL ? strrchr (path, '/') : NULL;  if (last_slash == path)    /* The last slash is the first character in the string.  We have to       return "/".  */    ++last_slash;  else if (last_slash != NULL && last_slash[1] == '\0')    /* The '/' is the last character, we have to look further.  */    last_slash = memchr (path, last_slash - path, '/');  if (last_slash != NULL)    /* Terminate the path.  */    last_slash[0] = '\0';  else    /* This assignment is ill-designed but the XPG specs require to       return a string containing "." in any case no directory part is       found and so a static and constant string is required.  */    path = (char *) dot;  return path;}

⌨️ 快捷键说明

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