- if (argc == 3 && (strcmp(argv[1], "-n") == 0 || strcmp(argv[1], "-N") == 0)) {
- path = argv[2];
- if (strcmp(argv[1], "-N") == 0) {
- only_path = 1;
- show_path = 1;
+ rc = glob(pattern, GLOB_BRACE | (popt->recursive ? GLOB_MARK : 0),
+ NULL, &glob_info);
+ if (rc) {
+ fprintf(stderr, "error: list_param: %s: %s\n",
+ pattern, globerrstr(rc));
+ return -ESRCH;
+ }
+
+ for (i = 0; i < glob_info.gl_pathc; i++) {
+ char *valuename = NULL;
+ int last;
+
+ /* Trailing '/' will indicate recursion into directory */
+ last = strlen(glob_info.gl_pathv[i]) - 1;
+
+ /* Remove trailing '/' or it will be converted to '.' */
+ if (last > 0 && glob_info.gl_pathv[i][last] == '/')
+ glob_info.gl_pathv[i][last] = '\0';
+ else
+ last = 0;
+ strcpy(filename, glob_info.gl_pathv[i]);
+ valuename = display_name(filename, popt->show_type);
+ if (valuename)
+ printf("%s\n", valuename);
+ if (last) {
+ strcpy(filename, glob_info.gl_pathv[i]);
+ strcat(filename, "/*");
+ listparam_display(popt, filename);