added -l
This commit is contained in:
parent
63c3474d9b
commit
4b261f03aa
1 changed files with 20 additions and 3 deletions
23
skratch.c
23
skratch.c
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -69,6 +70,23 @@ int make_skratch_path(struct Flags *f)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int list_files(struct Flags *f)
|
||||||
|
{
|
||||||
|
int delete = 0;
|
||||||
|
DIR *d = opendir(f->skratch_path);
|
||||||
|
if (d == NULL) return 5;
|
||||||
|
struct dirent *dir;
|
||||||
|
if (d)
|
||||||
|
{
|
||||||
|
while ((dir = readdir(d)) != NULL)
|
||||||
|
{
|
||||||
|
printf("%s\n", dir->d_name);
|
||||||
|
}
|
||||||
|
closedir(d);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Flags f = {.use_v = 0, .filename="skratchXXXXXX"};
|
struct Flags f = {.use_v = 0, .filename="skratchXXXXXX"};
|
||||||
|
|
@ -108,9 +126,8 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
//list all .skratch files
|
list_files(&f);
|
||||||
printf("LIST!\n");
|
return 0;
|
||||||
break;
|
|
||||||
case 'v':
|
case 'v':
|
||||||
//use visual editor
|
//use visual editor
|
||||||
printf("VISUAL!\n");
|
printf("VISUAL!\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue