Sfoglia il codice sorgente

Default to cwd if not argument is provided

master
sin 10 anni fa
parent
commit
5999cef396
1 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. +10
    -1
      noice.c

+ 10
- 1
noice.c Vedi File

@@ -6,6 +6,7 @@
#include <dirent.h>
#include <curses.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <regex.h>
#include <stdlib.h>
@@ -613,9 +614,17 @@ out:
int
main(int argc, char *argv[])
{
char *ipath = argv[1] != NULL ? argv[1] : "/";
char cwd[PATH_MAX], *ipath;
char *ifilter = "^[^.].*"; /* Hide dotfiles */

if (argv[1] != NULL) {
ipath = argv[1];
} else {
ipath = getcwd(cwd, sizeof(cwd));
if (ipath == NULL)
ipath = "/";
}

/* Test initial path */
if (!testopendir(ipath))
printerr(1, ipath);


Loading…
Annulla
Salva