Lines Matching +full:stdout +full:- +full:path

6  * This is the main hub from which the sub-commands (perf stat,
12 #include "util/build-id.h"
16 #include <subcmd/exec-cmd.h>
18 #include <subcmd/run-command.h>
19 #include "util/parse-events.h"
20 #include <subcmd/parse-options.h>
25 #include "perf-sys.h"
41 static int use_pager = -1;
51 { "buildid-cache", cmd_buildid_cache, 0 },
52 { "buildid-list", cmd_buildid_list, 0 },
105 return (strstarts(var, header) && !strcmp(var + strlen(header), c->cmd)); in same_cmd_with_prefix()
112 c->val = perf_config_bool(var, value); in pager_command_config()
116 /* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
122 c.val = -1; in check_pager_config()
131 c->val = perf_config_bool(var, value); in browser_command_config()
133 c->val = perf_config_bool(var, value) ? 2 : 0; in browser_command_config()
139 * and -1 for "not specified"
146 c.val = -1; in check_browser_config()
168 OPT_ARGUMENT("exec-path", "exec-path"),
169 OPT_ARGUMENT("html-path", "html-path"),
171 OPT_ARGUMENT("no-pager", "no-pager"),
172 OPT_ARGUMENT("debugfs-dir", "debugfs-dir"),
173 OPT_ARGUMENT("buildid-dir", "buildid-dir"),
174 OPT_ARGUMENT("list-cmds", "list-cmds"),
175 OPT_ARGUMENT("list-opts", "list-opts"),
186 if (cmd[0] != '-') in handle_options()
191 * commands can be written with "--" prepended in handle_options()
194 if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version")) in handle_options()
198 * Shortcut for '-h' and '-v' options to invoke help in handle_options()
201 if (!strcmp(cmd, "-h")) { in handle_options()
202 (*argv)[0] = "--help"; in handle_options()
206 if (!strcmp(cmd, "-v")) { in handle_options()
207 (*argv)[0] = "--version"; in handle_options()
211 if (!strcmp(cmd, "-vv")) { in handle_options()
228 } else if (!strcmp(cmd, "--html-path")) { in handle_options()
231 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { in handle_options()
233 } else if (!strcmp(cmd, "--no-pager")) { in handle_options()
237 } else if (!strcmp(cmd, "--debugfs-dir")) { in handle_options()
239 fprintf(stderr, "No directory given for --debugfs-dir.\n"); in handle_options()
246 (*argc)--; in handle_options()
247 } else if (!strcmp(cmd, "--buildid-dir")) { in handle_options()
249 fprintf(stderr, "No directory given for --buildid-dir.\n"); in handle_options()
256 (*argc)--; in handle_options()
262 } else if (!strcmp(cmd, "--list-cmds")) { in handle_options()
267 printf("%s ", p->cmd); in handle_options()
271 } else if (!strcmp(cmd, "--list-opts")) { in handle_options()
274 for (i = 0; i < ARRAY_SIZE(options)-1; i++) { in handle_options()
276 printf("--%s ", p->long_name); in handle_options()
280 } else if (!strcmp(cmd, "--debug")) { in handle_options()
282 fprintf(stderr, "No variable specified for --debug.\n"); in handle_options()
289 (*argc)--; in handle_options()
296 (*argc)--; in handle_options()
311 if (use_browser == -1) in run_builtin()
312 use_browser = check_browser_config(p->cmd); in run_builtin()
314 if (use_pager == -1 && p->option & RUN_SETUP) in run_builtin()
315 use_pager = check_pager_config(p->cmd); in run_builtin()
316 if (use_pager == -1 && p->option & USE_PAGER) in run_builtin()
322 status = p->fn(argc, argv); in run_builtin()
330 /* Somebody closed stdout? */ in run_builtin()
331 if (fstat(fileno(stdout), &st)) in run_builtin()
339 if (fflush(stdout)) { in run_builtin()
344 if (ferror(stdout)) { in run_builtin()
348 if (fclose(stdout)) { in run_builtin()
363 /* Turn "perf cmd --help" into "perf help cmd" */ in handle_internal_command()
364 if (argc > 1 && !strcmp(argv[1], "--help")) { in handle_internal_command()
371 if (p->fn == NULL) in handle_internal_command()
373 if (strcmp(p->cmd, cmd)) in handle_internal_command()
385 if (asprintf(&cmd, "perf-%s", argv[0]) < 0) in execv_dashed_external()
402 if (status != -ERR_RUN_COMMAND_EXEC) { in execv_dashed_external()
406 status = -128; in execv_dashed_external()
408 exit(-status); in execv_dashed_external()
448 cmd = "perf-help"; in main()
461 * "perf-xxxx" is the same as "perf xxxx", but we obviously: in main()
463 * - cannot take flags in between the "perf" and the "xxxx". in main()
464 * - cannot execute it externally (since it would just do in main()
472 if (strstarts(cmd, "perf-")) { in main()
480 cmd -= 5; in main()
490 "trace command not available: missing audit-libs devel package at build time.\n"); in main()
500 argc--; in main()
505 if (strstarts(argv[0], "--")) in main()
519 * We use PATH to find perf commands, but we prepend some higher in main()
520 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH in main()