From 87b2f210ec8797c24ff80d16882192a525440847 Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Sat, 13 Jun 2009 08:14:51 +0200 Subject: [PATCH] New command line option -x, to open a file in the hex viewer. --- doc/mp_man.txt | 3 ++- mp_core.mpsl | 7 +++++++ mpv_kde4.cpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/mp_man.txt b/doc/mp_man.txt index d5910bd..2a0bba3 100644 --- a/doc/mp_man.txt +++ b/doc/mp_man.txt @@ -48,7 +48,8 @@ The following options are avaiable: * -t tag: Edits the file where tag is defined (see ctags(1)). * -e mpsl_code: Executes MPSL code. * -f mpsl_script: Executes an MPSL script. - * -d directory: Change working directory. + * -d directory: Changes working directory. + * -x file: opens file in the hexadecimal viewer. * NNN: Moves to line number NNN of last file. MPSL diff --git a/mp_core.mpsl b/mp_core.mpsl index df7cdc4..368b787 100644 --- a/mp_core.mpsl +++ b/mp_core.mpsl @@ -463,6 +463,13 @@ sub mp.process_cmdline() if (o eq '-t') mp.open_tag(shift(ARGV)); else + if (o eq '-x') { + local s = shift(ARGV); + + if (mp.hex_view(s) == NULL) + ERROR = sprintf(L("Cannot open '%s'"), s); + } + else if (regex('/^\+/', o)) { /* move to line */ line = o - 1; diff --git a/mpv_kde4.cpp b/mpv_kde4.cpp index c59c8bd..2875643 100644 --- a/mpv_kde4.cpp +++ b/mpv_kde4.cpp @@ -1112,6 +1112,7 @@ extern "C" int kde4_drv_detect(int * argc, char *** argv) opts.add("e {mpsl_code}", ki18n("Executes MPSL code")); opts.add("f {mpsl_script}", ki18n("Executes MPSL script file")); opts.add("d {directory}", ki18n("Sets working directory")); + opts.add("x {file}", ki18n("Open file in the hexadecimal viewer")); opts.add(" +NNN", ki18n("Moves to line number NNN of last file")); opts.add("+[file(s)]", ki18n("Documents to open")); KCmdLineArgs::addCmdLineOptions(opts); -- 2.11.4.GIT