Remove trailing white space with:
for f in *.{h,c}; do sed -i .sed 's/[[:blank:]]*$//' $f; done
(Thanks to Nicolás Wolovick)
This commit is contained in:
parent
6de6a3c952
commit
7894fcd217
32 changed files with 116 additions and 116 deletions
12
ls.c
12
ls.c
|
|
@ -8,12 +8,12 @@ fmtname(char *path)
|
|||
{
|
||||
static char buf[DIRSIZ+1];
|
||||
char *p;
|
||||
|
||||
|
||||
// Find first character after last slash.
|
||||
for(p=path+strlen(path); p >= path && *p != '/'; p--)
|
||||
;
|
||||
p++;
|
||||
|
||||
|
||||
// Return blank-padded name.
|
||||
if(strlen(p) >= DIRSIZ)
|
||||
return p;
|
||||
|
|
@ -29,23 +29,23 @@ ls(char *path)
|
|||
int fd;
|
||||
struct dirent de;
|
||||
struct stat st;
|
||||
|
||||
|
||||
if((fd = open(path, 0)) < 0){
|
||||
printf(2, "ls: cannot open %s\n", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(fstat(fd, &st) < 0){
|
||||
printf(2, "ls: cannot stat %s\n", path);
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch(st.type){
|
||||
case T_FILE:
|
||||
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
|
||||
break;
|
||||
|
||||
|
||||
case T_DIR:
|
||||
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
|
||||
printf(1, "ls: path too long\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue