+ rc = glob(pattern, GLOB_BRACE, NULL, &glob_info);
+ if (rc) {
+ fprintf(stderr, "error: get_param: %s: %s\n",
+ pattern, globerrstr(rc));
+ return -ESRCH;
+ }
+
+ buf = malloc(CFS_PAGE_SIZE);
+ for (i = 0; i < glob_info.gl_pathc; i++) {
+ char *valuename = NULL;
+
+ memset(buf, 0, CFS_PAGE_SIZE);
+ /* As listparam_display is used to show param name (with type),
+ * here "if (only_path)" is ignored.*/
+ if (popt->show_path) {
+ strcpy(filename, glob_info.gl_pathv[i]);
+ valuename = display_name(filename, 0);
+ }
+
+ /* Write the contents of file to stdout */
+ fd = open(glob_info.gl_pathv[i], O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr,
+ "error: get_param: opening('%s') failed: %s\n",
+ glob_info.gl_pathv[i], strerror(errno));
+ continue;
+ }
+
+ do {
+ rc = read(fd, buf, CFS_PAGE_SIZE);
+ if (rc == 0)
+ break;
+ if (rc < 0) {
+ fprintf(stderr, "error: get_param: "
+ "read('%s') failed: %s\n",
+ glob_info.gl_pathv[i], strerror(errno));
+ break;
+ }
+ /* Print the output in the format path=value if the
+ * value contains no new line character or cab be
+ * occupied in a line, else print value on new line */
+ if (valuename && popt->show_path) {
+ int longbuf = strnchr(buf, rc - 1, '\n') != NULL
+ || rc > 60;
+ printf("%s=%s", valuename, longbuf ? "\n" : buf);
+ valuename = NULL;
+ if (!longbuf)
+ continue;
+ fflush(stdout);
+ }
+ rc = write(fileno(stdout), buf, rc);
+ if (rc < 0) {
+ fprintf(stderr, "error: get_param: "
+ "write to stdout failed: %s\n",
+ strerror(errno));
+ break;
+ }
+ } while (1);
+ close(fd);
+ }
+
+ globfree(&glob_info);
+ free(buf);
+ return rc;
+}
+
+int jt_lcfg_getparam(int argc, char **argv)
+{
+ int fp;
+ int rc = 0, i;
+ struct param_opts popt;
+ char pattern[PATH_MAX];
+ char *path;
+
+ rc = getparam_cmdline(argc, argv, &popt);
+ if (rc < 0 || rc >= argc)