提交 e899cb3b 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

ls.cc

上级 386b6539
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
}
char*
fmtname(char *path)
const char*
fmtname(const char *path)
{
static char buf[DIRSIZ+1];
char *p;
const char *p;
// Find first character after last slash.
for(p=path+strlen(path); p >= path && *p != '/'; p--)
......@@ -23,7 +25,7 @@ fmtname(char *path)
}
void
ls(char *path)
ls(const char *path)
{
char buf[512], *p;
int fd;
......
......@@ -101,7 +101,7 @@ writec(void *arg, char c)
}
void
printf(int fd, char *fmt, ...)
printf(int fd, const char *fmt, ...)
{
va_list ap;
......
......@@ -15,7 +15,7 @@ strncpy(char *s, const char *t, int n)
}
char*
strcpy(char *s, char *t)
strcpy(char *s, const char *t)
{
char *os;
......
......@@ -28,7 +28,7 @@ void halt(void);
// ulib.c
int stat(char*, struct stat*);
char* strcpy(char*, char*);
char* strcpy(char*, const char*);
void *memmove(void*, const void*, int);
char* strchr(const char*, char c);
int strcmp(const char*, const char*);
......@@ -45,6 +45,6 @@ int atoi(const char*);
int forkt(void *sp, void *pc, void *arg);
// printf.c
void printf(int, char*, ...);
void printf(int, const char*, ...);
void snprintf(char *buf, unsigned int n, const char *fmt, ...);
void die(const char* errstr, ...) __attribute__((noreturn));
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论