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>
21 #include "util/bpf-loader.h"
26 #include "perf-sys.h"
43 "perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
48 static int use_pager = -1;
58 { "buildid-cache", cmd_buildid_cache, 0 },
59 { "buildid-list", cmd_buildid_list, 0 },
101 if (strstarts(var, "pager.") && !strcmp(var + 6, c->cmd)) in pager_command_config()
102 c->val = perf_config_bool(var, value); in pager_command_config()
106 /* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
112 c.val = -1; in check_pager_config()
120 if (strstarts(var, "tui.") && !strcmp(var + 4, c->cmd)) in browser_command_config()
121 c->val = perf_config_bool(var, value); in browser_command_config()
122 if (strstarts(var, "gtk.") && !strcmp(var + 4, c->cmd)) in browser_command_config()
123 c->val = perf_config_bool(var, value) ? 2 : 0; in browser_command_config()
129 * and -1 for "not specified"
136 c.val = -1; in check_browser_config()
158 OPT_ARGUMENT("exec-path", "exec-path"),
159 OPT_ARGUMENT("html-path", "html-path"),
161 OPT_ARGUMENT("no-pager", "no-pager"),
162 OPT_ARGUMENT("debugfs-dir", "debugfs-dir"),
163 OPT_ARGUMENT("buildid-dir", "buildid-dir"),
164 OPT_ARGUMENT("list-cmds", "list-cmds"),
165 OPT_ARGUMENT("list-opts", "list-opts"),
176 if (cmd[0] != '-') in handle_options()
181 * commands can be written with "--" prepended in handle_options()
184 if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version")) in handle_options()
188 * Shortcut for '-h' and '-v' options to invoke help in handle_options()
191 if (!strcmp(cmd, "-h")) { in handle_options()
192 (*argv)[0] = "--help"; in handle_options()
196 if (!strcmp(cmd, "-v")) { in handle_options()
197 (*argv)[0] = "--version"; in handle_options()
201 if (!strcmp(cmd, "-vv")) { in handle_options()
218 } else if (!strcmp(cmd, "--html-path")) { in handle_options()
221 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { in handle_options()
223 } else if (!strcmp(cmd, "--no-pager")) { in handle_options()
227 } else if (!strcmp(cmd, "--debugfs-dir")) { in handle_options()
229 fprintf(stderr, "No directory given for --debugfs-dir.\n"); in handle_options()
236 (*argc)--; in handle_options()
237 } else if (!strcmp(cmd, "--buildid-dir")) { in handle_options()
239 fprintf(stderr, "No directory given for --buildid-dir.\n"); in handle_options()
246 (*argc)--; in handle_options()
252 } else if (!strcmp(cmd, "--list-cmds")) { in handle_options()
257 printf("%s ", p->cmd); in handle_options()
261 } else if (!strcmp(cmd, "--list-opts")) { in handle_options()
264 for (i = 0; i < ARRAY_SIZE(options)-1; i++) { in handle_options()
266 printf("--%s ", p->long_name); in handle_options()
270 } else if (!strcmp(cmd, "--debug")) { in handle_options()
272 fprintf(stderr, "No variable specified for --debug.\n"); in handle_options()
279 (*argc)--; in handle_options()
286 (*argc)--; in handle_options()
301 if (use_browser == -1) in run_builtin()
302 use_browser = check_browser_config(p->cmd); in run_builtin()
304 if (use_pager == -1 && p->option & RUN_SETUP) in run_builtin()
305 use_pager = check_pager_config(p->cmd); in run_builtin()
306 if (use_pager == -1 && p->option & USE_PAGER) in run_builtin()
312 status = p->fn(argc, argv); in run_builtin()
321 /* Somebody closed stdout? */ in run_builtin()
322 if (fstat(fileno(stdout), &st)) in run_builtin()
330 if (fflush(stdout)) { in run_builtin()
335 if (ferror(stdout)) { in run_builtin()
339 if (fclose(stdout)) { in run_builtin()
354 /* Turn "perf cmd --help" into "perf help cmd" */ in handle_internal_command()
355 if (argc > 1 && !strcmp(argv[1], "--help")) { in handle_internal_command()
362 if (strcmp(p->cmd, cmd)) in handle_internal_command()
374 if (asprintf(&cmd, "perf-%s", argv[0]) < 0) in execv_dashed_external()
391 if (status != -ERR_RUN_COMMAND_EXEC) { in execv_dashed_external()
395 status = -128; in execv_dashed_external()
397 exit(-status); in execv_dashed_external()
453 cmd = "perf-help"; in main()
466 * "perf-xxxx" is the same as "perf xxxx", but we obviously: in main()
468 * - cannot take flags in between the "perf" and the "xxxx". in main()
469 * - cannot execute it externally (since it would just do in main()
477 if (strstarts(cmd, "perf-")) { in main()
485 cmd -= 5; in main()
495 "trace command not available: missing audit-libs devel package at build time.\n"); in main()
501 argc--; in main()
506 if (strstarts(argv[0], "--")) in main()
520 * We use PATH to find perf commands, but we prepend some higher in main()
521 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH in main()