2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							| @@ -41,7 +41,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, | ||||
| =* ln              yes                          none | ||||
| =* logger          yes                          none | ||||
| =* logname         yes                          none | ||||
| =  ls              no                           -A, (-C), -R, -S, -f, -m, -n, -s, -x | ||||
| =  ls              no                           (-C), -R, -S, -f, -m, -n, -s, -x | ||||
| =* md5sum          non-posix                    none | ||||
| =* mkdir           yes                          none | ||||
| =* mkfifo          yes                          none | ||||
|   | ||||
							
								
								
									
										6
									
								
								ls.1
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								ls.1
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| .Dd February 18, 2015 | ||||
| .Dd February 21, 2015 | ||||
| .Dt LS 1 | ||||
| .Os sbase | ||||
| .Sh NAME | ||||
| @@ -6,7 +6,7 @@ | ||||
| .Nd list directory contents | ||||
| .Sh SYNOPSIS | ||||
| .Nm | ||||
| .Op Fl 1acdFHhiLlqrtUu | ||||
| .Op Fl 1AacdFHhiLlqrtUu | ||||
| .Op Ar file ... | ||||
| .Sh DESCRIPTION | ||||
| .Nm | ||||
| @@ -14,6 +14,8 @@ lists each given file, and the contents of each given directory. If no files | ||||
| are given the current directory is listed. | ||||
| .Sh OPTIONS | ||||
| .Bl -tag -width Ds | ||||
| .It Fl A | ||||
| List all entries except for '.' and '..'. | ||||
| .It Fl a | ||||
| Show hidden files (those beginning with '.'). | ||||
| .It Fl c | ||||
|   | ||||
							
								
								
									
										11
									
								
								ls.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ls.c
									
									
									
									
									
								
							| @@ -24,6 +24,7 @@ struct entry { | ||||
| 	ino_t   ino; | ||||
| }; | ||||
|  | ||||
| static int Aflag = 0; | ||||
| static int aflag = 0; | ||||
| static int cflag = 0; | ||||
| static int dflag = 0; | ||||
| @@ -204,7 +205,10 @@ lsdir(const char *path) | ||||
| 	} | ||||
|  | ||||
| 	while ((d = readdir(dp))) { | ||||
| 		if (d->d_name[0] == '.' && !aflag) | ||||
| 		if (d->d_name[0] == '.' && !aflag && !Aflag) | ||||
| 			continue; | ||||
| 		else if (Aflag) | ||||
| 			if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) | ||||
| 				continue; | ||||
| 		if (Uflag){ | ||||
| 			mkent(&ent, d->d_name, Fflag || lflag || pflag || iflag, Lflag); | ||||
| @@ -256,7 +260,7 @@ ls(const struct entry *ent) | ||||
| static void | ||||
| usage(void) | ||||
| { | ||||
| 	eprintf("usage: %s [-1acdFHhiLlqrtUu] [file ...]\n", argv0); | ||||
| 	eprintf("usage: %s [-1AacdFHhiLlqrtUu] [file ...]\n", argv0); | ||||
| } | ||||
|  | ||||
| int | ||||
| @@ -269,6 +273,9 @@ main(int argc, char *argv[]) | ||||
| 	case '1': | ||||
| 		/* ignore */ | ||||
| 		break; | ||||
| 	case 'A': | ||||
| 		Aflag = 1; | ||||
| 		break; | ||||
| 	case 'a': | ||||
| 		aflag = 1; | ||||
| 		break; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user