added more some comments

This commit is contained in:
phixxy 2026-03-21 15:08:29 -07:00
parent 7de932eeaa
commit 47b43dade6

View file

@ -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"))