search for: replace_str

Displaying 20 results from an estimated 27 matches for "replace_str".

2014 Oct 10
4
[PATCH 1/3] Move JSON to mllib
...* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +(* Poor man's JSON generator. *) + +open Printf + +open Common_utils + +type field = string * json_t +and json_t = String of string | Int of int +and doc = field list + +(* JSON quoting. *) +let json_quote str = + let str = replace_str str "\\" "\\\\" in + let str = replace_str str "\"" "\\\"" in + let str = replace_str str "'" "\\'" in + let str = replace_str str "\008" "\\b" in + let str = replace_str str "\012" &quot...
2014 Sep 05
2
[LLVMdev] Address sanitizer regression test failures for PPC64 targets
...ght be wrong and started by looking into the null_deref.cc test as it hangs during the test run. I observe that after the detection of the faulty memory access it receives a SEGV after entering ReportSIGSEGV() more precisely when it gets to the __intercept_strlen() and tries to access flags()->replace_str. The caller of __intercept_strlen() is get_cie_encoding() from libgcc (version 4.8.2 in my system). As I am not familiar with the sanitizer implementation, I was wondering if this is an expected failure for PPC targets due to some incomplete implementation, an unexpected bug, or due to some miscon...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...n -> String.replace_char n '_' '-') non_c_aliases in fish_alias @ non_c_aliases let all_functions_commands_and_aliases_sorted = @@ -73,7 +74,7 @@ let all_functions_commands_and_aliases_sorted = let c_quoted_indented ~indent str = let str = c_quote str in - let str = replace_str str "\\n" ("\\n\"\n" ^ indent ^ "\"") in + let str = String.replace str "\\n" ("\\n\"\n" ^ indent ^ "\"") in str (* Generate run_* functions and header for libguestfs API functions. *) @@ -322,7 +323,7 @@ let gen...
2011 Sep 23
4
replace multiple string
Hi I would like to use a bash script that searches files and subdirectories name in a directory /var/ww/html/web for a specific string, and when it finds the search string, replaces the string (old1) with new string (new1), and so on old2 with new2 ....oldn with newn. replace_string.sh #!/bin/bash for db in $(find /var/www/html/web -name * -exec) do sed -e "s/old1/new1/" \ sed -e "s/old2/new2/" \ ... sed -e "s/oldn/newn/" $db done Any recommendation.. Thanks pons
2016 Dec 09
0
Re: [PATCH] generator: Share Common_utils code.
...gt; - List.rev !r Ditto. > -let map_chars f str = > - List.map f (explode str) Ditto. > -let spaces n = String.make n ' ' Oh there's a copy of this in mllib/getopt.ml, so could you please include that in this patch? > - > -let html_escape text = > - let text = replace_str text "&" "&amp;" in > - let text = replace_str text "<" "&lt;" in > - let text = replace_str text ">" "&gt;" in > - text Not a big deal, but could this be left here to reduce the diff? > diff --git a/...
2014 Sep 05
4
[LLVMdev] [cfe-dev] Address sanitizer regression test failures for PPC64 targets
...into the >> null_deref.cc test as it hangs during the test run. I observe that after >> the detection of the faulty memory access it receives a SEGV after entering >> ReportSIGSEGV() more precisely when it gets to the __intercept_strlen() and >> tries to access flags()->replace_str. The caller of __intercept_strlen() is >> get_cie_encoding() from libgcc (version 4.8.2 in my system). >> >> As I am not familiar with the sanitizer implementation, I was wondering if >> this is an expected failure for PPC targets due to some incomplete >> implementati...
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...t a straight refactoring. Various ad hoc string_* functions that appeared in Common_utils have been renamed and placed in the String.* namespace. The old vs "new" functions are: string_prefix -> String.is_prefix string_suffix -> String.is_suffix string_find -> String.find replace_str -> String.replace string_nsplit -> String.nsplit string_split -> String.split string_lines_split -> String.lines_split string_random8 -> String.random8 --- builder/checksums.ml | 2 +- builder/downloader.ml | 2 +- builder/index_par...
2015 Oct 07
1
Re: [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...ad hoc string_* > functions that appeared in Common_utils have been renamed and placed > in the String.* namespace. The old vs "new" functions are: > > string_prefix -> String.is_prefix > string_suffix -> String.is_suffix > string_find -> String.find > replace_str -> String.replace > string_nsplit -> String.nsplit > string_split -> String.split > string_lines_split -> String.lines_split > string_random8 -> String.random8 > --- As mentioned yesterday on IRC, I'm torn about this one: the functions would automatically al...
2015 Feb 10
3
[PATCH 1/3] generator: add a simple HTML escaping function
...index b24ba8c..3a62084 100644 --- a/generator/utils.ml +++ b/generator/utils.ml @@ -360,4 +360,10 @@ let args_of_optargs optargs = | OInt64 n -> Int64 n | OString n -> String n | OStringList n -> StringList n - ) optargs; + ) optargs + +let html_escape text = + let text = replace_str text "&" "&amp;" in + let text = replace_str text "<" "&lt;" in + let text = replace_str text ">" "&gt;" in + text diff --git a/generator/utils.mli b/generator/utils.mli index 5fd40ce..e0f30c3 100644 --- a/generato...
2016 Apr 11
1
[PATCH] fish: improve formatting of help text of generated commands
...4f65d..646674d 100644 --- a/generator/fish.ml +++ b/generator/fish.ml @@ -71,6 +71,11 @@ let all_functions_commands_and_aliases_sorted = ) (fish_functions_sorted @ fish_commands) [] in List.sort func_compare all +let c_quoted_indented ~indent str = + let str = c_quote str in + let str = replace_str str "\\n" ("\\n\"\n" ^ indent ^ "\"") in + str + (* Generate a lot of different functions for guestfish. *) let generate_fish_cmds () = generate_header CStyle GPLv2plus; @@ -138,7 +143,7 @@ let generate_fish_cmds () = pr "struct command_en...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase. These are replaced by safe functions that won't break UTF-8 strings. Other miscellaneous refactoring. Rich.
2013 Feb 04
1
[PATCH] generator: Add visibility to action struct
...@@ public class GuestFS { (* Methods. *) List.iter ( - fun ({ name = name; style = (ret, args, optargs as style); - in_docs = in_docs; shortdesc = shortdesc; - longdesc = longdesc; non_c_aliases = non_c_aliases } as f) -> - if in_docs then ( - let doc = replace_str longdesc "C<guestfs_" "C<g." in + fun f -> + let ret, args, optargs = f.style in + + if is_documented f then ( + let doc = replace_str f.longdesc "C<guestfs_" "C<g." in let doc = if optargs <> [] th...
2014 Oct 01
2
[LLVMdev] [cfe-dev] Address sanitizer regression test failures for PPC64 targets
...c test as it hangs during the test run. I observe that > after > >> the detection of the faulty memory access it receives a SEGV after > entering > >> ReportSIGSEGV() more precisely when it gets to the __intercept_strlen() > and > >> tries to access flags()->replace_str. The caller of > __intercept_strlen() is > >> get_cie_encoding() from libgcc (version 4.8.2 in my system). > >> > >> As I am not familiar with the sanitizer implementation, I was wondering > if > >> this is an expected failure for PPC targets due to some in...
2013 Aug 16
3
[PATCH v2] sysprep: added --mount-options option to mount selected
Nikita, Please take a look at the attached patch. I have rewritten it a little, and only lightly tested it. Rich.
2013 Mar 19
1
[LLVMdev] Strange linker error with clang 3.2
...inker error with the clang compiler version 3.2 on the Debian build system: There is an "undefined reference" error even though the function was previously defined in the same file. The code works without any issues with the GNU toolchain. Here is the error message: rrep.o: In function `replace_string': /«PKGBUILDDIR»/src/rrep.c:230: undefined reference to `write_replacement' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [rrep] Error 1 rrep.c has the following layout: inline int write_replacement (FILE *fp, const char *start, const reg...
2014 Dec 04
2
[PATCH v3 0/2] v2v: When picking a default kernel, favour non-debug
Since v2: - Use string_suffix kernel_name "-debug" || string_suffix kernel_name "-dbg" - This requires addition of the string_suffix function and some tests
2013 Apr 12
11
[PATCH v4 1/2] libxl: postpone backend name resolution
...uf, &disk); - disk.backend_domid = 0; - libxl_cdrom_insert(ctx, domid, &disk, NULL); libxl_device_disk_dispose(&disk); @@ -5534,11 +5501,7 @@ int main_networkattach(int argc, char **argv) } else if (MATCH_OPTION("script", *argv, oparg)) { replace_string(&nic.script, oparg); } else if (MATCH_OPTION("backend", *argv, oparg)) { - if(libxl_name_to_domid(ctx, oparg, &val)) { - fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n"); - val = 0; -...
2016 Jan 27
2
[PATCH 1/2] generator: add TestRunOrUnsupported test type
...f9d 100644 --- a/generator/utils.ml +++ b/generator/utils.ml @@ -266,7 +266,8 @@ let seq_of_test = function | TestResultDevice (s, _) | TestResultTrue s | TestResultFalse s - | TestLastFail s -> s + | TestLastFail s + | TestRunOrUnsupported s -> s let c_quote str = let str = replace_str str "\\" "\\\\" in -- 2.5.0
2016 Feb 26
1
[PATCH] doc: add info on per-function needed feature
...al with + | None -> doc + | Some opt -> + doc ^ sprintf "\n\nThis function depends on the feature C<%s>. See also C<g.feature-available>." opt in let doc = pod2text ~width:60 f.name doc in let doc = List.map (fun line -> replace_str line "\\" "\\\\") doc in let doc = String.concat "\n " doc in diff --git a/generator/ruby.ml b/generator/ruby.ml index 9567925..97ccfdc 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -481,6 +481,11 @@ get_all_event_callbacks (guestfs_h *g, si...
2015 Jul 01
12
[PATCH 1/9] v2v: Stable bus and slot numbers for removable drives (RHBZ#1238053).
This patch series adds stable bus and slot numbers for removable drives (CDs and floppies) when the guest is converted using virt-v2v or virt-p2v. Previously we were a bit random about this. After this patch series, the bus and slot numbers and preserved if at all possible. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1238053 Rich.