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>
26 #include "perf-sys.h"
42 static int use_pager = -1;
53 { "buildid-cache", cmd_buildid_cache, 0 },
54 { "buildid-list", cmd_buildid_list, 0 },
108 return (strstarts(var, header) && !strcmp(var + strlen(header), c->cmd)); in same_cmd_with_prefix()
115 c->val = perf_config_bool(var, value); in pager_command_config()
119 /* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
125 c.val = -1; in check_pager_config()
134 c->val = perf_config_bool(var, value); in browser_command_config()
136 c->val = perf_config_bool(var, value) ? 2 : 0; in browser_command_config()
142 * and -1 for "not specified"
149 c.val = -1; in check_browser_config()
168 static int set_debug_file(const char *path) in set_debug_file() argument
170 debug_fp = fopen(path, "w"); in set_debug_file()
173 path, strerror(errno)); in set_debug_file()
174 return -1; in set_debug_file()
184 OPT_ARGUMENT("exec-path", "exec-path"),
185 OPT_ARGUMENT("html-path", "html-path"),
187 OPT_ARGUMENT("no-pager", "no-pager"),
188 OPT_ARGUMENT("debugfs-dir", "debugfs-dir"),
189 OPT_ARGUMENT("buildid-dir", "buildid-dir"),
190 OPT_ARGUMENT("list-cmds", "list-cmds"),
191 OPT_ARGUMENT("list-opts", "list-opts"),
193 OPT_ARGUMENT("debug-file", "debug-file"),
203 if (cmd[0] != '-') in handle_options()
208 * commands can be written with "--" prepended in handle_options()
211 if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version")) in handle_options()
215 * Shortcut for '-h' and '-v' options to invoke help in handle_options()
218 if (!strcmp(cmd, "-h")) { in handle_options()
219 (*argv)[0] = "--help"; in handle_options()
223 if (!strcmp(cmd, "-v")) { in handle_options()
224 (*argv)[0] = "--version"; in handle_options()
228 if (!strcmp(cmd, "-vv")) { in handle_options()
245 } else if (!strcmp(cmd, "--html-path")) { in handle_options()
248 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { in handle_options()
250 } else if (!strcmp(cmd, "--no-pager")) { in handle_options()
254 } else if (!strcmp(cmd, "--debugfs-dir")) { in handle_options()
256 fprintf(stderr, "No directory given for --debugfs-dir.\n"); in handle_options()
263 (*argc)--; in handle_options()
264 } else if (!strcmp(cmd, "--buildid-dir")) { in handle_options()
266 fprintf(stderr, "No directory given for --buildid-dir.\n"); in handle_options()
273 (*argc)--; in handle_options()
279 } else if (!strcmp(cmd, "--list-cmds")) { in handle_options()
284 printf("%s ", p->cmd); in handle_options()
288 } else if (!strcmp(cmd, "--list-opts")) { in handle_options()
291 for (i = 0; i < ARRAY_SIZE(options)-1; i++) { in handle_options()
293 printf("--%s ", p->long_name); in handle_options()
297 } else if (!strcmp(cmd, "--debug")) { in handle_options()
299 fprintf(stderr, "No variable specified for --debug.\n"); in handle_options()
306 (*argc)--; in handle_options()
307 } else if (!strcmp(cmd, "--debug-file")) { in handle_options()
309 fprintf(stderr, "No path given for --debug-file.\n"); in handle_options()
317 (*argc)--; in handle_options()
325 (*argc)--; in handle_options()
340 if (use_browser == -1) in run_builtin()
341 use_browser = check_browser_config(p->cmd); in run_builtin()
343 if (use_pager == -1 && p->option & RUN_SETUP) in run_builtin()
344 use_pager = check_pager_config(p->cmd); in run_builtin()
345 if (use_pager == -1 && p->option & USE_PAGER) in run_builtin()
351 status = p->fn(argc, argv); in run_builtin()
359 /* Somebody closed stdout? */ in run_builtin()
360 if (fstat(fileno(stdout), &st)) in run_builtin()
368 if (fflush(stdout)) { in run_builtin()
373 if (ferror(stdout)) { in run_builtin()
377 if (fclose(stdout)) { in run_builtin()
392 /* Turn "perf cmd --help" into "perf help cmd" */ in handle_internal_command()
393 if (argc > 1 && !strcmp(argv[1], "--help")) { in handle_internal_command()
400 if (p->fn == NULL) in handle_internal_command()
402 if (strcmp(p->cmd, cmd)) in handle_internal_command()
414 if (asprintf(&cmd, "perf-%s", argv[0]) < 0) in execv_dashed_external()
431 if (status != -ERR_RUN_COMMAND_EXEC) { in execv_dashed_external()
435 status = -128; in execv_dashed_external()
437 exit(-status); in execv_dashed_external()
477 cmd = "perf-help"; in main()
490 * "perf-xxxx" is the same as "perf xxxx", but we obviously: in main()
492 * - cannot take flags in between the "perf" and the "xxxx". in main()
493 * - cannot execute it externally (since it would just do in main()
501 if (strstarts(cmd, "perf-")) { in main()
509 cmd -= 5; in main()
519 "trace command not available: missing audit-libs devel package at build time.\n"); in main()
529 argc--; in main()
534 if (strstarts(argv[0], "--")) in main()
548 * We use PATH to find perf commands, but we prepend some higher in main()
549 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH in main()