path.c
资源名称:httpd.tar.gz [点击查看]
上传用户:lampled
上传日期:2007-01-07
资源大小:94k
文件大小:1k
源码类别:
Web服务器
开发平台:
Unix_Linux
- /* Copyright (C) 1995, 1996 by Sven Berkvens (sven@stack.nl) */
- #include "config.h"
- #include <pwd.h>
- #include <stdio.h>
- #include <sys/stat.h>
- #include "httpd.h"
- #include "local.h"
- #include "string.h"
- extern const char *
- calcpath DECL1C(char *, name)
- {
- static char buffer[XS_PATH_MAX];
- size_t len;
- if (*name == '/')
- strncpy(buffer, name, XS_PATH_MAX - 1);
- else
- {
- strncpy(buffer, rootdir, XS_PATH_MAX - 1);
- buffer[XS_PATH_MAX - 2] = 0;
- len = strlen(buffer);
- buffer[len++] = '/';
- buffer[len] = 0;
- strncat(buffer + len, name, XS_PATH_MAX - len);
- }
- buffer[XS_PATH_MAX - 1] = 0;
- return(buffer);
- }