added more some comments
This commit is contained in:
parent
7de932eeaa
commit
47b43dade6
1 changed files with 6 additions and 4 deletions
10
skratch.c
10
skratch.c
|
|
@ -127,27 +127,29 @@ int main(int argc, char *argv[])
|
|||
int opt;
|
||||
struct Flags f = {.use_v = 0, .filename="skratch-XXXXXX"};
|
||||
make_skratch_path(&f);
|
||||
//handle args
|
||||
while ((opt = getopt(argc, argv, "cls:v")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'c':
|
||||
case 'c': // delete ~/.skratch files
|
||||
delete_files(&f);
|
||||
return 0;
|
||||
case 'l':
|
||||
case 'l': // list ~/.skratch files
|
||||
list_files(&f, 0);
|
||||
return 0;
|
||||
case 's':
|
||||
case 's': // use file suffix, like .txt
|
||||
f.use_s = 1;
|
||||
f.suffix = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
case 'v': // use visual editor
|
||||
f.use_v = 1;
|
||||
break;
|
||||
default:
|
||||
printf("error print usage");
|
||||
}
|
||||
}
|
||||
// find optional filename if exists
|
||||
for (int i = optind; i < argc; i++)
|
||||
{
|
||||
if (!strcmp(f.filename,"skratch-XXXXXX"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue