Thu, 11 Jul 2024 20:05:21 +0200
hotfix: ampersand not escaped in html output
41
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | <!DOCTYPE html> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | <html> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | <head> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | <title>c2html</title> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | <style type="text/css"> |
66 | 6 | div.c2html-code { |
7 | white-space: pre; | |
8 | font-family: monospace; | |
9 | } | |
10 | a.c2html-lineno { | |
11 | /* as long as user-select isn't widely spread, we throw the bomb */ | |
12 | -webkit-user-select: none; | |
13 | -moz-user-select: none; | |
14 | -ms-user-select: none; | |
15 | user-select: none; | |
16 | display: inline-block; | |
41
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | font-style: italic; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | text-decoration: none; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | color: grey; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | span.c2html-keyword { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | color: blue; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | span.c2html-macroconst { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | color: cornflowerblue; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | span.c2html-type { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | color: cornflowerblue; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
29 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
30 | span.c2html-directive { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
31 | color: green; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
32 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
33 | span.c2html-string { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
34 | color: darkorange; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
35 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
36 | span.c2html-comment { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
37 | color: grey; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
38 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
39 | span.c2html-stdinclude { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
40 | color: darkorange; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
41 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
42 | span.c2html-userinclude { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
43 | color: darkorange; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
44 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
45 | a.c2html-userinclude { |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
46 | color: darkorange; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
47 | text-decoration: underline; |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
48 | } |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
49 | </style> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
50 | </head> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
51 | <body> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
52 | |
66 | 53 | <div class="c2html-code"> |
54 | <a class="c2html-lineno" name="l1" href="#l1"> 1 </a><span class="c2html-comment">/*</span> | |
55 | <a class="c2html-lineno" name="l2" href="#l2"> 2 </a><span class="c2html-comment"> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.</span> | |
56 | <a class="c2html-lineno" name="l3" href="#l3"> 3 </a><span class="c2html-comment"> *</span> | |
57 | <a class="c2html-lineno" name="l4" href="#l4"> 4 </a><span class="c2html-comment"> * Copyright 2015 Olaf Wintermann. All rights reserved.</span> | |
58 | <a class="c2html-lineno" name="l5" href="#l5"> 5 </a><span class="c2html-comment"> *</span> | |
59 | <a class="c2html-lineno" name="l6" href="#l6"> 6 </a><span class="c2html-comment"> * Redistribution and use in source and binary forms, with or without</span> | |
60 | <a class="c2html-lineno" name="l7" href="#l7"> 7 </a><span class="c2html-comment"> * modification, are permitted provided that the following conditions are met:</span> | |
61 | <a class="c2html-lineno" name="l8" href="#l8"> 8 </a><span class="c2html-comment"> *</span> | |
62 | <a class="c2html-lineno" name="l9" href="#l9"> 9 </a><span class="c2html-comment"> * 1. Redistributions of source code must retain the above copyright</span> | |
63 | <a class="c2html-lineno" name="l10" href="#l10"> 10 </a><span class="c2html-comment"> * notice, this list of conditions and the following disclaimer.</span> | |
64 | <a class="c2html-lineno" name="l11" href="#l11"> 11 </a><span class="c2html-comment"> *</span> | |
65 | <a class="c2html-lineno" name="l12" href="#l12"> 12 </a><span class="c2html-comment"> * 2. Redistributions in binary form must reproduce the above copyright</span> | |
66 | <a class="c2html-lineno" name="l13" href="#l13"> 13 </a><span class="c2html-comment"> * notice, this list of conditions and the following disclaimer in the</span> | |
67 | <a class="c2html-lineno" name="l14" href="#l14"> 14 </a><span class="c2html-comment"> * documentation and/or other materials provided with the distribution.</span> | |
68 | <a class="c2html-lineno" name="l15" href="#l15"> 15 </a><span class="c2html-comment"> *</span> | |
69 | <a class="c2html-lineno" name="l16" href="#l16"> 16 </a><span class="c2html-comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span> | |
70 | <a class="c2html-lineno" name="l17" href="#l17"> 17 </a><span class="c2html-comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> | |
71 | <a class="c2html-lineno" name="l18" href="#l18"> 18 </a><span class="c2html-comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span> | |
72 | <a class="c2html-lineno" name="l19" href="#l19"> 19 </a><span class="c2html-comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE</span> | |
73 | <a class="c2html-lineno" name="l20" href="#l20"> 20 </a><span class="c2html-comment"> * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span> | |
74 | <a class="c2html-lineno" name="l21" href="#l21"> 21 </a><span class="c2html-comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span> | |
75 | <a class="c2html-lineno" name="l22" href="#l22"> 22 </a><span class="c2html-comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span> | |
76 | <a class="c2html-lineno" name="l23" href="#l23"> 23 </a><span class="c2html-comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span> | |
77 | <a class="c2html-lineno" name="l24" href="#l24"> 24 </a><span class="c2html-comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span> | |
78 | <a class="c2html-lineno" name="l25" href="#l25"> 25 </a><span class="c2html-comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span> | |
79 | <a class="c2html-lineno" name="l26" href="#l26"> 26 </a><span class="c2html-comment"> * POSSIBILITY OF SUCH DAMAGE.</span> | |
80 | <a class="c2html-lineno" name="l27" href="#l27"> 27 </a><span class="c2html-comment"> */</span> | |
81 | <a class="c2html-lineno" name="l28" href="#l28"> 28 </a> | |
82 | <a class="c2html-lineno" name="l29" href="#l29"> 29 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><time.h></span> | |
83 | <a class="c2html-lineno" name="l30" href="#l30"> 30 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><stdio.h></span> | |
84 | <a class="c2html-lineno" name="l31" href="#l31"> 31 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><stdlib.h></span> | |
85 | <a class="c2html-lineno" name="l32" href="#l32"> 32 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><string.h></span> | |
86 | <a class="c2html-lineno" name="l33" href="#l33"> 33 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><ucx/string.h></span> | |
87 | <a class="c2html-lineno" name="l34" href="#l34"> 34 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><ucx/buffer.h></span> | |
88 | <a class="c2html-lineno" name="l35" href="#l35"> 35 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><ucx/utils.h></span> | |
89 | <a class="c2html-lineno" name="l36" href="#l36"> 36 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><libxml/tree.h></span> | |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
90 | <a class="c2html-lineno" name="l37" href="#l37"> 37 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><curl\ |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
91 | </span><a class="c2html-lineno" name="l38" href="#l38"> 38 </a><span class="c2html-stdinclude">/curl.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
92 | <a class="c2html-lineno" name="l39" href="#l39"> 39 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
93 | <a class="c2html-lineno" name="l40" href="#l40"> 40 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/sha.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
94 | <a class="c2html-lineno" name="l41" href="#l41"> 41 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/hmac.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
95 | <a class="c2html-lineno" name="l42" href="#l42"> 42 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/evp.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
96 | <a class="c2html-lineno" name="l43" href="#l43"> 43 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/bio.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
97 | <a class="c2html-lineno" name="l44" href="#l44"> 44 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/buffer.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
98 | <a class="c2html-lineno" name="l45" href="#l45"> 45 </a><span class="c2html-directive">#include</span> <span class="c2html-stdinclude"><openssl/rand.h></span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
99 | <a class="c2html-lineno" name="l46" href="#l46"> 46 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
100 | <a class="c2html-lineno" name="l47" href="#l47"> 47 </a><span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="utils.h">"utils.h"</a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
101 | <a class="c2html-lineno" name="l48" href="#l48"> 48 </a><span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="crypto.h">"crypto.h"</a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
102 | <a class="c2html-lineno" name="l49" href="#l49"> 49 </a><span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="webdav.h">"webdav.h"</a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
103 | <a class="c2html-lineno" name="l50" href="#l50"> 50 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
104 | <a class="c2html-lineno" name="l51" href="#l51"> 51 </a><span class="c2html-directive">#define</span> <span class="c2html-macroconst">MACRO1337</span> <span class="c2html-macroconst">1337L</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
105 | <a class="c2html-lineno" name="l52" href="#l52"> 52 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
106 | <a class="c2html-lineno" name="l53" href="#l53"> 53 </a><span class="c2html-keyword">static</span> <span class="c2html-keyword">const</span> <span class="c2html-keyword">char</span>* continuation_test = <span class="c2html-string">"this is a string\ |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
107 | </span><a class="c2html-lineno" name="l54" href="#l54"> 54 </a><span class="c2html-string"> with a continuation"</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
108 | <a class="c2html-lineno" name="l55" href="#l55"> 55 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
109 | <a class="c2html-lineno" name="l56" href="#l56"> 56 </a><span class="c2html-comment">/* -------------------- This is a testing file. -------------------------- */</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
110 | <a class="c2html-lineno" name="l57" href="#l57"> 57 </a><span class="c2html-comment">/*</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
111 | <a class="c2html-lineno" name="l58" href="#l58"> 58 </a><span class="c2html-comment">time_t util_parse_creationdate(char *str) {</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
112 | <a class="c2html-lineno" name="l59" href="#l59"> 59 </a><span class="c2html-comment"> // example: 2012-11-29T21:35:35Z</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
113 | <a class="c2html-lineno" name="l60" href="#l60"> 60 </a><span class="c2html-comment"> if(!str) {</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
114 | <a class="c2html-lineno" name="l61" href="#l61"> 61 </a><span class="c2html-comment"> return 0;</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
115 | <a class="c2html-lineno" name="l62" href="#l62"> 62 </a><span class="c2html-comment"> }</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
116 | <a class="c2html-lineno" name="l63" href="#l63"> 63 </a><span class="c2html-comment"> // TODO</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
117 | <a class="c2html-lineno" name="l64" href="#l64"> 64 </a><span class="c2html-comment"> return 0;</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
118 | <a class="c2html-lineno" name="l65" href="#l65"> 65 </a><span class="c2html-comment">}</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
119 | <a class="c2html-lineno" name="l66" href="#l66"> 66 </a><span class="c2html-comment">*/</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
120 | <a class="c2html-lineno" name="l67" href="#l67"> 67 </a><span class="c2html-type">time_t</span> util_parse_lastmodified(<span class="c2html-keyword">char</span> *str) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
121 | <a class="c2html-lineno" name="l68" href="#l68"> 68 </a> <span class="c2html-comment">// example: Thu, 29 Nov 2012 21:35:35 GMT</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
122 | <a class="c2html-lineno" name="l69" href="#l69"> 69 </a> <span class="c2html-keyword">if</span>(!str) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
123 | <a class="c2html-lineno" name="l70" href="#l70"> 70 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
124 | <a class="c2html-lineno" name="l71" href="#l71"> 71 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
125 | <a class="c2html-lineno" name="l72" href="#l72"> 72 </a> <span class="c2html-keyword">return</span> curl_getdate(str, <span class="c2html-macroconst">NULL</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
126 | <a class="c2html-lineno" name="l73" href="#l73"> 73 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
127 | <a class="c2html-lineno" name="l74" href="#l74"> 74 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
128 | <a class="c2html-lineno" name="l75" href="#l75"> 75 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
129 | <a class="c2html-lineno" name="l76" href="#l76"> 76 </a><span class="c2html-keyword">int</span> util_getboolean(<span class="c2html-keyword">char</span> *v) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
130 | <a class="c2html-lineno" name="l77" href="#l77"> 77 </a> <span class="c2html-keyword">if</span>(v[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'T'</span> || v[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'t'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
131 | <a class="c2html-lineno" name="l78" href="#l78"> 78 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
132 | <a class="c2html-lineno" name="l79" href="#l79"> 79 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
133 | <a class="c2html-lineno" name="l80" href="#l80"> 80 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
134 | <a class="c2html-lineno" name="l81" href="#l81"> 81 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
135 | <a class="c2html-lineno" name="l82" href="#l82"> 82 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
136 | <a class="c2html-lineno" name="l83" href="#l83"> 83 </a><span class="c2html-keyword">int</span> util_strtoint(<span class="c2html-keyword">char</span> *str, <span class="c2html-type">int64_t</span> *value) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
137 | <a class="c2html-lineno" name="l84" href="#l84"> 84 </a> <span class="c2html-keyword">char</span> *end; |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
138 | <a class="c2html-lineno" name="l85" href="#l85"> 85 </a> <span class="c2html-type">int64_t</span> val = strtoll(str, &end, <span class="c2html-macroconst">0</span>); |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
139 | <a class="c2html-lineno" name="l86" href="#l86"> 86 </a> <span class="c2html-keyword">if</span>(strlen(end) == <span class="c2html-macroconst">0</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
140 | <a class="c2html-lineno" name="l87" href="#l87"> 87 </a> *value = val; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
141 | <a class="c2html-lineno" name="l88" href="#l88"> 88 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
142 | <a class="c2html-lineno" name="l89" href="#l89"> 89 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
143 | <a class="c2html-lineno" name="l90" href="#l90"> 90 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
144 | <a class="c2html-lineno" name="l91" href="#l91"> 91 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
145 | <a class="c2html-lineno" name="l92" href="#l92"> 92 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
146 | <a class="c2html-lineno" name="l93" href="#l93"> 93 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
147 | <a class="c2html-lineno" name="l94" href="#l94"> 94 </a><span class="c2html-keyword">char</span>* util_url_path(<span class="c2html-keyword">char</span> *url) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
148 | <a class="c2html-lineno" name="l95" href="#l95"> 95 </a> <span class="c2html-keyword">char</span> *path = <span class="c2html-macroconst">NULL</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
149 | <a class="c2html-lineno" name="l96" href="#l96"> 96 </a> <span class="c2html-type">size_t</span> len = strlen(url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
150 | <a class="c2html-lineno" name="l97" href="#l97"> 97 </a> <span class="c2html-keyword">int</span> slashcount = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
151 | <a class="c2html-lineno" name="l98" href="#l98"> 98 </a> <span class="c2html-keyword">int</span> slmax; |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
152 | <a class="c2html-lineno" name="l99" href="#l99"> 99 </a> <span class="c2html-keyword">if</span>(len > <span class="c2html-macroconst">7</span> && !strncasecmp(url, <span class="c2html-string">"http://"</span>, <span class="c2html-macroconst">7</span>)) { |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
153 | <a class="c2html-lineno" name="l100" href="#l100">100 </a> slmax = <span class="c2html-macroconst">3</span>; |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
154 | <a class="c2html-lineno" name="l101" href="#l101">101 </a> } <span class="c2html-keyword">else</span> <span class="c2html-keyword">if</span>(len > <span class="c2html-macroconst">8</span> && !strncasecmp(url, <span class="c2html-string">"https://"</span>, <span class="c2html-macroconst">8</span>)) { |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
155 | <a class="c2html-lineno" name="l102" href="#l102">102 </a> slmax = <span class="c2html-macroconst">3</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
156 | <a class="c2html-lineno" name="l103" href="#l103">103 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
157 | <a class="c2html-lineno" name="l104" href="#l104">104 </a> slmax = <span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
158 | <a class="c2html-lineno" name="l105" href="#l105">105 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
159 | <a class="c2html-lineno" name="l106" href="#l106">106 </a> <span class="c2html-keyword">char</span> c; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
160 | <a class="c2html-lineno" name="l107" href="#l107">107 </a> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i<len;i++) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
161 | <a class="c2html-lineno" name="l108" href="#l108">108 </a> c = url[i]; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
162 | <a class="c2html-lineno" name="l109" href="#l109">109 </a> <span class="c2html-keyword">if</span>(c == <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
163 | <a class="c2html-lineno" name="l110" href="#l110">110 </a> slashcount++; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
164 | <a class="c2html-lineno" name="l111" href="#l111">111 </a> <span class="c2html-keyword">if</span>(slashcount == slmax) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
165 | <a class="c2html-lineno" name="l112" href="#l112">112 </a> path = url + i; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
166 | <a class="c2html-lineno" name="l113" href="#l113">113 </a> <span class="c2html-keyword">break</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
167 | <a class="c2html-lineno" name="l114" href="#l114">114 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
168 | <a class="c2html-lineno" name="l115" href="#l115">115 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
169 | <a class="c2html-lineno" name="l116" href="#l116">116 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
170 | <a class="c2html-lineno" name="l117" href="#l117">117 </a> <span class="c2html-keyword">return</span> path; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
171 | <a class="c2html-lineno" name="l118" href="#l118">118 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
172 | <a class="c2html-lineno" name="l119" href="#l119">119 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
173 | <a class="c2html-lineno" name="l120" href="#l120">120 </a><span class="c2html-keyword">char</span>* util_url_decode(DavSession *sn, <span class="c2html-keyword">char</span> *url) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
174 | <a class="c2html-lineno" name="l121" href="#l121">121 </a> <span class="c2html-keyword">char</span> *unesc = curl_easy_unescape(sn->handle, url, strlen(url), <span class="c2html-macroconst">NULL</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
175 | <a class="c2html-lineno" name="l122" href="#l122">122 </a> <span class="c2html-keyword">char</span> *ret = strdup(unesc); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
176 | <a class="c2html-lineno" name="l123" href="#l123">123 </a> curl_free(unesc); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
177 | <a class="c2html-lineno" name="l124" href="#l124">124 </a> <span class="c2html-keyword">return</span> ret; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
178 | <a class="c2html-lineno" name="l125" href="#l125">125 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
179 | <a class="c2html-lineno" name="l126" href="#l126">126 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
180 | <a class="c2html-lineno" name="l127" href="#l127">127 </a><span class="c2html-keyword">char</span>* util_resource_name(<span class="c2html-keyword">char</span> *url) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
181 | <a class="c2html-lineno" name="l128" href="#l128">128 </a> <span class="c2html-keyword">int</span> si = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
182 | <a class="c2html-lineno" name="l129" href="#l129">129 </a> <span class="c2html-keyword">int</span> osi = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
183 | <a class="c2html-lineno" name="l130" href="#l130">130 </a> <span class="c2html-keyword">int</span> i = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
184 | <a class="c2html-lineno" name="l131" href="#l131">131 </a> <span class="c2html-keyword">int</span> p = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
185 | <a class="c2html-lineno" name="l132" href="#l132">132 </a> <span class="c2html-keyword">char</span> c; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
186 | <a class="c2html-lineno" name="l133" href="#l133">133 </a> <span class="c2html-keyword">while</span>((c = url[i]) != <span class="c2html-macroconst">0</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
187 | <a class="c2html-lineno" name="l134" href="#l134">134 </a> <span class="c2html-keyword">if</span>(c == <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
188 | <a class="c2html-lineno" name="l135" href="#l135">135 </a> osi = si; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
189 | <a class="c2html-lineno" name="l136" href="#l136">136 </a> si = i; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
190 | <a class="c2html-lineno" name="l137" href="#l137">137 </a> p = <span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
191 | <a class="c2html-lineno" name="l138" href="#l138">138 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
192 | <a class="c2html-lineno" name="l139" href="#l139">139 </a> i++; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
193 | <a class="c2html-lineno" name="l140" href="#l140">140 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
194 | <a class="c2html-lineno" name="l141" href="#l141">141 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
195 | <a class="c2html-lineno" name="l142" href="#l142">142 </a> <span class="c2html-keyword">char</span> *name = url + si + p; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
196 | <a class="c2html-lineno" name="l143" href="#l143">143 </a> <span class="c2html-keyword">if</span>(name[<span class="c2html-macroconst">0</span>] == <span class="c2html-macroconst">0</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
197 | <a class="c2html-lineno" name="l144" href="#l144">144 </a> name = url + osi + p; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
198 | <a class="c2html-lineno" name="l145" href="#l145">145 </a> <span class="c2html-keyword">if</span>(name[<span class="c2html-macroconst">0</span>] == <span class="c2html-macroconst">0</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
199 | <a class="c2html-lineno" name="l146" href="#l146">146 </a> <span class="c2html-keyword">return</span> url; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
200 | <a class="c2html-lineno" name="l147" href="#l147">147 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
201 | <a class="c2html-lineno" name="l148" href="#l148">148 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
202 | <a class="c2html-lineno" name="l149" href="#l149">149 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
203 | <a class="c2html-lineno" name="l150" href="#l150">150 </a> <span class="c2html-keyword">return</span> name; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
204 | <a class="c2html-lineno" name="l151" href="#l151">151 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
205 | <a class="c2html-lineno" name="l152" href="#l152">152 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
206 | <a class="c2html-lineno" name="l153" href="#l153">153 </a><span class="c2html-keyword">int</span> util_mkdir(<span class="c2html-keyword">char</span> *path, <span class="c2html-type">mode_t</span> mode) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
207 | <a class="c2html-lineno" name="l154" href="#l154">154 </a><span class="c2html-directive">#ifdef</span> <span class="c2html-macroconst">_WIN32</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
208 | <a class="c2html-lineno" name="l155" href="#l155">155 </a> <span class="c2html-keyword">return</span> mkdir(path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
209 | <a class="c2html-lineno" name="l156" href="#l156">156 </a><span class="c2html-directive">#else</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
210 | <a class="c2html-lineno" name="l157" href="#l157">157 </a> <span class="c2html-keyword">return</span> mkdir(path, mode); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
211 | <a class="c2html-lineno" name="l158" href="#l158">158 </a><span class="c2html-directive">#endif</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
212 | <a class="c2html-lineno" name="l159" href="#l159">159 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
213 | <a class="c2html-lineno" name="l160" href="#l160">160 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
214 | <a class="c2html-lineno" name="l161" href="#l161">161 </a><span class="c2html-keyword">char</span>* util_concat_path(<span class="c2html-keyword">char</span> *url_base, <span class="c2html-keyword">char</span> *p) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
215 | <a class="c2html-lineno" name="l162" href="#l162">162 </a> <span class="c2html-type">sstr_t</span> base = sstr(url_base); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
216 | <a class="c2html-lineno" name="l163" href="#l163">163 </a> <span class="c2html-type">sstr_t</span> path; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
217 | <a class="c2html-lineno" name="l164" href="#l164">164 </a> <span class="c2html-keyword">if</span>(p) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
218 | <a class="c2html-lineno" name="l165" href="#l165">165 </a> path = sstr(p); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
219 | <a class="c2html-lineno" name="l166" href="#l166">166 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
220 | <a class="c2html-lineno" name="l167" href="#l167">167 </a> path = sstrn(<span class="c2html-string">""</span>, <span class="c2html-macroconst">0</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
221 | <a class="c2html-lineno" name="l168" href="#l168">168 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
222 | <a class="c2html-lineno" name="l169" href="#l169">169 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
223 | <a class="c2html-lineno" name="l170" href="#l170">170 </a> <span class="c2html-keyword">int</span> add_separator = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
224 | <a class="c2html-lineno" name="l171" href="#l171">171 </a> <span class="c2html-keyword">if</span>(base.ptr[base.length-<span class="c2html-macroconst">1</span>] == <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
225 | <a class="c2html-lineno" name="l172" href="#l172">172 </a> <span class="c2html-keyword">if</span>(path.ptr[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
226 | <a class="c2html-lineno" name="l173" href="#l173">173 </a> base.length--; |
66 | 227 | <a class="c2html-lineno" name="l174" href="#l174">174 </a> } |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
228 | <a class="c2html-lineno" name="l175" href="#l175">175 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
229 | <a class="c2html-lineno" name="l176" href="#l176">176 </a> <span class="c2html-keyword">if</span>(path.length == <span class="c2html-macroconst">0</span> || path.ptr[<span class="c2html-macroconst">0</span>] != <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
230 | <a class="c2html-lineno" name="l177" href="#l177">177 </a> add_separator = <span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
231 | <a class="c2html-lineno" name="l178" href="#l178">178 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
232 | <a class="c2html-lineno" name="l179" href="#l179">179 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
233 | <a class="c2html-lineno" name="l180" href="#l180">180 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
234 | <a class="c2html-lineno" name="l181" href="#l181">181 </a> <span class="c2html-type">sstr_t</span> url; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
235 | <a class="c2html-lineno" name="l182" href="#l182">182 </a> <span class="c2html-keyword">if</span>(add_separator) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
236 | <a class="c2html-lineno" name="l183" href="#l183">183 </a> url = sstrcat(<span class="c2html-macroconst">3</span>, base, sstr(<span class="c2html-string">"/"</span>), path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
237 | <a class="c2html-lineno" name="l184" href="#l184">184 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
238 | <a class="c2html-lineno" name="l185" href="#l185">185 </a> url = sstrcat(<span class="c2html-macroconst">2</span>, base, path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
239 | <a class="c2html-lineno" name="l186" href="#l186">186 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
240 | <a class="c2html-lineno" name="l187" href="#l187">187 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
241 | <a class="c2html-lineno" name="l188" href="#l188">188 </a> <span class="c2html-keyword">return</span> url.ptr; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
242 | <a class="c2html-lineno" name="l189" href="#l189">189 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
243 | <a class="c2html-lineno" name="l190" href="#l190">190 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
244 | <a class="c2html-lineno" name="l191" href="#l191">191 </a><span class="c2html-keyword">void</span> util_set_url(DavSession *sn, <span class="c2html-keyword">char</span> *href) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
245 | <a class="c2html-lineno" name="l192" href="#l192">192 </a> <span class="c2html-type">sstr_t</span> base = sstr(sn->base_url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
246 | <a class="c2html-lineno" name="l193" href="#l193">193 </a> <span class="c2html-type">sstr_t</span> href_str = sstr(href); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
247 | <a class="c2html-lineno" name="l194" href="#l194">194 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
248 | <a class="c2html-lineno" name="l195" href="#l195">195 </a> <span class="c2html-keyword">char</span> *base_path = util_url_path(sn->base_url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
249 | <a class="c2html-lineno" name="l196" href="#l196">196 </a> base.length -= strlen(base_path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
250 | <a class="c2html-lineno" name="l197" href="#l197">197 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
251 | <a class="c2html-lineno" name="l198" href="#l198">198 </a> <span class="c2html-type">sstr_t</span> url = sstrcat(<span class="c2html-macroconst">2</span>, base, href_str); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
252 | <a class="c2html-lineno" name="l199" href="#l199">199 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
253 | <a class="c2html-lineno" name="l200" href="#l200">200 </a> curl_easy_setopt(sn->handle, <span class="c2html-macroconst">CURLOPT_URL</span>, url.ptr); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
254 | <a class="c2html-lineno" name="l201" href="#l201">201 </a> free(url.ptr); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
255 | <a class="c2html-lineno" name="l202" href="#l202">202 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
256 | <a class="c2html-lineno" name="l203" href="#l203">203 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
257 | <a class="c2html-lineno" name="l204" href="#l204">204 </a><span class="c2html-keyword">char</span>* util_path_to_url(DavSession *sn, <span class="c2html-keyword">char</span> *path) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
258 | <a class="c2html-lineno" name="l205" href="#l205">205 </a> <span class="c2html-keyword">char</span> *space = malloc(<span class="c2html-macroconst">256</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
259 | <a class="c2html-lineno" name="l206" href="#l206">206 </a> UcxBuffer *url = ucx_buffer_new(space, <span class="c2html-macroconst">256</span>, <span class="c2html-macroconst">CX_BUFFER_AUTO_EXTEND</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
260 | <a class="c2html-lineno" name="l207" href="#l207">207 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
261 | <a class="c2html-lineno" name="l208" href="#l208">208 </a> <span class="c2html-comment">// add base url</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
262 | <a class="c2html-lineno" name="l209" href="#l209">209 </a> ucx_buffer_write(sn->base_url, <span class="c2html-macroconst">1</span>, strlen(sn->base_url), url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
263 | <a class="c2html-lineno" name="l210" href="#l210">210 </a> <span class="c2html-comment">// remove trailing slash</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
264 | <a class="c2html-lineno" name="l211" href="#l211">211 </a> ucx_buffer_seek(url, -<span class="c2html-macroconst">1</span>, <span class="c2html-macroconst">SEEK_CUR</span>); |
66 | 265 | <a class="c2html-lineno" name="l212" href="#l212">212 </a> |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
266 | <a class="c2html-lineno" name="l213" href="#l213">213 </a> <span class="c2html-type">sstr_t</span> p = sstr(path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
267 | <a class="c2html-lineno" name="l214" href="#l214">214 </a> <span class="c2html-type">ssize_t</span> ntk = <span class="c2html-macroconst">0</span>; |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
268 | <a class="c2html-lineno" name="l215" href="#l215">215 </a> <span class="c2html-type">sstr_t</span> *tks = sstrsplit(p, <span class="c2html-macroconst">S</span>(<span class="c2html-string">"/"</span>), &ntk); |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
269 | <a class="c2html-lineno" name="l216" href="#l216">216 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
270 | <a class="c2html-lineno" name="l217" href="#l217">217 </a> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i<ntk;i++) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
271 | <a class="c2html-lineno" name="l218" href="#l218">218 </a> <span class="c2html-type">sstr_t</span> node = tks[i]; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
272 | <a class="c2html-lineno" name="l219" href="#l219">219 </a> <span class="c2html-keyword">if</span>(node.length > <span class="c2html-macroconst">0</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
273 | <a class="c2html-lineno" name="l220" href="#l220">220 </a> <span class="c2html-keyword">char</span> *esc = curl_easy_escape(sn->handle, node.ptr, node.length); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
274 | <a class="c2html-lineno" name="l221" href="#l221">221 </a> ucx_buffer_putc(url, <span class="c2html-string">'/'</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
275 | <a class="c2html-lineno" name="l222" href="#l222">222 </a> ucx_buffer_write(esc, <span class="c2html-macroconst">1</span>, strlen(esc), url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
276 | <a class="c2html-lineno" name="l223" href="#l223">223 </a> curl_free(esc); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
277 | <a class="c2html-lineno" name="l224" href="#l224">224 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
278 | <a class="c2html-lineno" name="l225" href="#l225">225 </a> free(node.ptr); |
66 | 279 | <a class="c2html-lineno" name="l226" href="#l226">226 </a> } |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
280 | <a class="c2html-lineno" name="l227" href="#l227">227 </a> free(tks); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
281 | <a class="c2html-lineno" name="l228" href="#l228">228 </a> <span class="c2html-keyword">if</span>(path[p.length-<span class="c2html-macroconst">1</span>] == <span class="c2html-string">'/'</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
282 | <a class="c2html-lineno" name="l229" href="#l229">229 </a> ucx_buffer_putc(url, <span class="c2html-string">'/'</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
283 | <a class="c2html-lineno" name="l230" href="#l230">230 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
284 | <a class="c2html-lineno" name="l231" href="#l231">231 </a> ucx_buffer_putc(url, <span class="c2html-macroconst">0</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
285 | <a class="c2html-lineno" name="l232" href="#l232">232 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
286 | <a class="c2html-lineno" name="l233" href="#l233">233 </a> space = url->space; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
287 | <a class="c2html-lineno" name="l234" href="#l234">234 </a> ucx_buffer_free(url); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
288 | <a class="c2html-lineno" name="l235" href="#l235">235 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
289 | <a class="c2html-lineno" name="l236" href="#l236">236 </a> <span class="c2html-keyword">return</span> space; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
290 | <a class="c2html-lineno" name="l237" href="#l237">237 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
291 | <a class="c2html-lineno" name="l238" href="#l238">238 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
292 | <a class="c2html-lineno" name="l239" href="#l239">239 </a><span class="c2html-keyword">char</span>* util_parent_path(<span class="c2html-keyword">char</span> *path) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
293 | <a class="c2html-lineno" name="l240" href="#l240">240 </a> <span class="c2html-keyword">char</span> *name = util_resource_name(path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
294 | <a class="c2html-lineno" name="l241" href="#l241">241 </a> <span class="c2html-type">size_t</span> namelen = strlen(name); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
295 | <a class="c2html-lineno" name="l242" href="#l242">242 </a> <span class="c2html-type">size_t</span> pathlen = strlen(path); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
296 | <a class="c2html-lineno" name="l243" href="#l243">243 </a> <span class="c2html-type">size_t</span> parentlen = pathlen - namelen; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
297 | <a class="c2html-lineno" name="l244" href="#l244">244 </a> <span class="c2html-keyword">char</span> *parent = malloc(parentlen + <span class="c2html-macroconst">1</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
298 | <a class="c2html-lineno" name="l245" href="#l245">245 </a> memcpy(parent, path, parentlen); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
299 | <a class="c2html-lineno" name="l246" href="#l246">246 </a> parent[parentlen] = <span class="c2html-string">'\0'</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
300 | <a class="c2html-lineno" name="l247" href="#l247">247 </a> <span class="c2html-keyword">return</span> parent; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
301 | <a class="c2html-lineno" name="l248" href="#l248">248 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
302 | <a class="c2html-lineno" name="l249" href="#l249">249 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
303 | <a class="c2html-lineno" name="l250" href="#l250">250 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
304 | <a class="c2html-lineno" name="l251" href="#l251">251 </a><span class="c2html-keyword">char</span>* util_xml_get_text(xmlNode *elm) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
305 | <a class="c2html-lineno" name="l252" href="#l252">252 </a> xmlNode *node = elm->children; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
306 | <a class="c2html-lineno" name="l253" href="#l253">253 </a> <span class="c2html-keyword">while</span>(node) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
307 | <a class="c2html-lineno" name="l254" href="#l254">254 </a> <span class="c2html-keyword">if</span>(node->type == <span class="c2html-macroconst">XML_TEXT_NODE</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
308 | <a class="c2html-lineno" name="l255" href="#l255">255 </a> <span class="c2html-keyword">return</span> (<span class="c2html-keyword">char</span>*)node->content; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
309 | <a class="c2html-lineno" name="l256" href="#l256">256 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
310 | <a class="c2html-lineno" name="l257" href="#l257">257 </a> node = node->next; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
311 | <a class="c2html-lineno" name="l258" href="#l258">258 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
312 | <a class="c2html-lineno" name="l259" href="#l259">259 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">NULL</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
313 | <a class="c2html-lineno" name="l260" href="#l260">260 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
314 | <a class="c2html-lineno" name="l261" href="#l261">261 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
315 | <a class="c2html-lineno" name="l262" href="#l262">262 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
316 | <a class="c2html-lineno" name="l263" href="#l263">263 </a><span class="c2html-keyword">char</span>* util_base64decode(<span class="c2html-keyword">char</span> *in) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
317 | <a class="c2html-lineno" name="l264" href="#l264">264 </a> <span class="c2html-keyword">int</span> len = <span class="c2html-macroconst">0</span>; |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
318 | <a class="c2html-lineno" name="l265" href="#l265">265 </a> <span class="c2html-keyword">return</span> util_base64decode_len(in, &len); |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
319 | <a class="c2html-lineno" name="l266" href="#l266">266 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
320 | <a class="c2html-lineno" name="l267" href="#l267">267 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
321 | <a class="c2html-lineno" name="l268" href="#l268">268 </a><span class="c2html-keyword">char</span>* util_base64decode_len(<span class="c2html-keyword">char</span>* in, <span class="c2html-keyword">int</span> *outlen) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
322 | <a class="c2html-lineno" name="l269" href="#l269">269 </a> <span class="c2html-type">size_t</span> len = strlen(in); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
323 | <a class="c2html-lineno" name="l270" href="#l270">270 </a> <span class="c2html-keyword">char</span> *out = calloc(<span class="c2html-macroconst">1</span>, len); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
324 | <a class="c2html-lineno" name="l271" href="#l271">271 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
325 | <a class="c2html-lineno" name="l272" href="#l272">272 </a> <span class="c2html-macroconst">BIO</span>* b = BIO_new_mem_buf(in, len); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
326 | <a class="c2html-lineno" name="l273" href="#l273">273 </a> <span class="c2html-macroconst">BIO</span> *d = BIO_new(BIO_f_base64()); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
327 | <a class="c2html-lineno" name="l274" href="#l274">274 </a> BIO_set_flags(d, <span class="c2html-macroconst">BIO_FLAGS_BASE64_NO_NL</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
328 | <a class="c2html-lineno" name="l275" href="#l275">275 </a> b = BIO_push(d, b); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
329 | <a class="c2html-lineno" name="l276" href="#l276">276 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
330 | <a class="c2html-lineno" name="l277" href="#l277">277 </a> *outlen = BIO_read(b, out, len); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
331 | <a class="c2html-lineno" name="l278" href="#l278">278 </a> BIO_free_all(b); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
332 | <a class="c2html-lineno" name="l279" href="#l279">279 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
333 | <a class="c2html-lineno" name="l280" href="#l280">280 </a> <span class="c2html-keyword">return</span> out; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
334 | <a class="c2html-lineno" name="l281" href="#l281">281 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
335 | <a class="c2html-lineno" name="l282" href="#l282">282 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
336 | <a class="c2html-lineno" name="l283" href="#l283">283 </a><span class="c2html-keyword">char</span>* util_base64encode(<span class="c2html-keyword">char</span> *in, <span class="c2html-type">size_t</span> len) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
337 | <a class="c2html-lineno" name="l284" href="#l284">284 </a> <span class="c2html-macroconst">BIO</span> *b; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
338 | <a class="c2html-lineno" name="l285" href="#l285">285 </a> <span class="c2html-macroconst">BIO</span> *e; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
339 | <a class="c2html-lineno" name="l286" href="#l286">286 </a> <span class="c2html-macroconst">BUF_MEM</span> *mem; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
340 | <a class="c2html-lineno" name="l287" href="#l287">287 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
341 | <a class="c2html-lineno" name="l288" href="#l288">288 </a> e = BIO_new(BIO_f_base64()); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
342 | <a class="c2html-lineno" name="l289" href="#l289">289 </a> b = BIO_new(BIO_s_mem()); |
66 | 343 | <a class="c2html-lineno" name="l290" href="#l290">290 </a> |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
344 | <a class="c2html-lineno" name="l291" href="#l291">291 </a> e = BIO_push(e, b); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
345 | <a class="c2html-lineno" name="l292" href="#l292">292 </a> BIO_write(e, in, len); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
346 | <a class="c2html-lineno" name="l293" href="#l293">293 </a> BIO_flush(e); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
347 | <a class="c2html-lineno" name="l294" href="#l294">294 </a> |
80
0f1c55d2a90a
hotfix: ampersand not escaped in html output
Mike Becker <universe@uap-core.de>
parents:
75
diff
changeset
|
348 | <a class="c2html-lineno" name="l295" href="#l295">295 </a> BIO_get_mem_ptr(e, &mem); |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
349 | <a class="c2html-lineno" name="l296" href="#l296">296 </a> <span class="c2html-keyword">char</span> *out = malloc(mem->length); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
350 | <a class="c2html-lineno" name="l297" href="#l297">297 </a> memcpy(out, mem->data, mem->length -<span class="c2html-macroconst">1</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
351 | <a class="c2html-lineno" name="l298" href="#l298">298 </a> out[mem->length - <span class="c2html-macroconst">1</span>] = <span class="c2html-string">'\0'</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
352 | <a class="c2html-lineno" name="l299" href="#l299">299 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
353 | <a class="c2html-lineno" name="l300" href="#l300">300 </a> BIO_free_all(e); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
354 | <a class="c2html-lineno" name="l301" href="#l301">301 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
355 | <a class="c2html-lineno" name="l302" href="#l302">302 </a> <span class="c2html-keyword">return</span> out; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
356 | <a class="c2html-lineno" name="l303" href="#l303">303 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
357 | <a class="c2html-lineno" name="l304" href="#l304">304 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
358 | <a class="c2html-lineno" name="l305" href="#l305">305 </a><span class="c2html-keyword">char</span>* util_encrypt_str(DavSession *sn, <span class="c2html-keyword">char</span> *str, <span class="c2html-keyword">char</span> *key) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
359 | <a class="c2html-lineno" name="l306" href="#l306">306 </a> DavKey *k = dav_context_get_key(sn->context, key); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
360 | <a class="c2html-lineno" name="l307" href="#l307">307 </a> <span class="c2html-keyword">if</span>(!k) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
361 | <a class="c2html-lineno" name="l308" href="#l308">308 </a> <span class="c2html-comment">// TODO: session error</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
362 | <a class="c2html-lineno" name="l309" href="#l309">309 </a> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">NULL</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
363 | <a class="c2html-lineno" name="l310" href="#l310">310 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
364 | <a class="c2html-lineno" name="l311" href="#l311">311 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
365 | <a class="c2html-lineno" name="l312" href="#l312">312 </a> <span class="c2html-keyword">char</span> *enc_str = aes_encrypt(str, k); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
366 | <a class="c2html-lineno" name="l313" href="#l313">313 </a> <span class="c2html-keyword">char</span> *ret_str = dav_session_strdup(sn, enc_str); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
367 | <a class="c2html-lineno" name="l314" href="#l314">314 </a> free(enc_str); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
368 | <a class="c2html-lineno" name="l315" href="#l315">315 </a> <span class="c2html-keyword">return</span> ret_str; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
369 | <a class="c2html-lineno" name="l316" href="#l316">316 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
370 | <a class="c2html-lineno" name="l317" href="#l317">317 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
371 | <a class="c2html-lineno" name="l318" href="#l318">318 </a><span class="c2html-comment">/* commented out for testing reasons */</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
372 | <a class="c2html-lineno" name="l319" href="#l319">319 </a><span class="c2html-comment">/*</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
373 | <a class="c2html-lineno" name="l320" href="#l320">320 </a><span class="c2html-comment">char* util_decrypt_str(DavSession *sn, char *str, char *key) {</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
374 | <a class="c2html-lineno" name="l321" href="#l321">321 </a><span class="c2html-comment"> DavKey *k = dav_context_get_key(sn->context, key);</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
375 | <a class="c2html-lineno" name="l322" href="#l322">322 </a><span class="c2html-comment"> if(!k) {</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
376 | <a class="c2html-lineno" name="l323" href="#l323">323 </a><span class="c2html-comment"> // TODO: session error</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
377 | <a class="c2html-lineno" name="l324" href="#l324">324 </a><span class="c2html-comment"> return NULL;</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
378 | <a class="c2html-lineno" name="l325" href="#l325">325 </a><span class="c2html-comment"> }</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
379 | <a class="c2html-lineno" name="l326" href="#l326">326 </a><span class="c2html-comment"> </span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
380 | <a class="c2html-lineno" name="l327" href="#l327">327 </a><span class="c2html-comment"> char *dec_str = aes_decrypt(str, k);</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
381 | <a class="c2html-lineno" name="l328" href="#l328">328 </a><span class="c2html-comment"> char *ret_str = dav_session_strdup(sn, dec_str);</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
382 | <a class="c2html-lineno" name="l329" href="#l329">329 </a><span class="c2html-comment"> free(dec_str);</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
383 | <a class="c2html-lineno" name="l330" href="#l330">330 </a><span class="c2html-comment"> return ret_str;</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
384 | <a class="c2html-lineno" name="l331" href="#l331">331 </a><span class="c2html-comment">}</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
385 | <a class="c2html-lineno" name="l332" href="#l332">332 </a><span class="c2html-comment">*/</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
386 | <a class="c2html-lineno" name="l333" href="#l333">333 </a><span class="c2html-keyword">char</span>* util_random_str() { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
387 | <a class="c2html-lineno" name="l334" href="#l334">334 </a> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span> *str = malloc(<span class="c2html-macroconst">25</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
388 | <a class="c2html-lineno" name="l335" href="#l335">335 </a> str[<span class="c2html-macroconst">24</span>] = <span class="c2html-string">'\0'</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
389 | <a class="c2html-lineno" name="l336" href="#l336">336 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
390 | <a class="c2html-lineno" name="l337" href="#l337">337 </a> <span class="c2html-type">sstr_t</span> t = <span class="c2html-macroconst">S</span>( |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
391 | <a class="c2html-lineno" name="l338" href="#l338">338 </a> <span class="c2html-string">"01234567890"</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
392 | <a class="c2html-lineno" name="l339" href="#l339">339 </a> <span class="c2html-string">"abcdefghijklmnopqrstuvwxyz"</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
393 | <a class="c2html-lineno" name="l340" href="#l340">340 </a> <span class="c2html-string">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
394 | <a class="c2html-lineno" name="l341" href="#l341">341 </a> <span class="c2html-keyword">const</span> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span> *table = (<span class="c2html-keyword">const</span> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span>*)t.ptr; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
395 | <a class="c2html-lineno" name="l342" href="#l342">342 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
396 | <a class="c2html-lineno" name="l343" href="#l343">343 </a> RAND_pseudo_bytes(str, <span class="c2html-macroconst">24</span>); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
397 | <a class="c2html-lineno" name="l344" href="#l344">344 </a> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i<<span class="c2html-macroconst">24</span>;i++) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
398 | <a class="c2html-lineno" name="l345" href="#l345">345 </a> <span class="c2html-keyword">int</span> c = str[i] % t.length; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
399 | <a class="c2html-lineno" name="l346" href="#l346">346 </a> str[i] = table[c]; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
400 | <a class="c2html-lineno" name="l347" href="#l347">347 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
401 | <a class="c2html-lineno" name="l348" href="#l348">348 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
402 | <a class="c2html-lineno" name="l349" href="#l349">349 </a> <span class="c2html-keyword">return</span> (<span class="c2html-keyword">char</span>*)str; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
403 | <a class="c2html-lineno" name="l350" href="#l350">350 </a>} |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
404 | <a class="c2html-lineno" name="l351" href="#l351">351 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
405 | <a class="c2html-lineno" name="l352" href="#l352">352 </a><span class="c2html-comment">/*</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
406 | <a class="c2html-lineno" name="l353" href="#l353">353 </a><span class="c2html-comment"> * gets a substring from 0 to the appearance of the token</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
407 | <a class="c2html-lineno" name="l354" href="#l354">354 </a><span class="c2html-comment"> * tokens are separated by space</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
408 | <a class="c2html-lineno" name="l355" href="#l355">355 </a><span class="c2html-comment"> * sets sub to the substring and returns the remaining string</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
409 | <a class="c2html-lineno" name="l356" href="#l356">356 </a><span class="c2html-comment"> */</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
410 | <a class="c2html-lineno" name="l357" href="#l357">357 </a><span class="c2html-type">sstr_t</span> util_getsubstr_until_token(<span class="c2html-type">sstr_t</span> str, <span class="c2html-type">sstr_t</span> token, <span class="c2html-type">sstr_t</span> *sub) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
411 | <a class="c2html-lineno" name="l358" href="#l358">358 </a> <span class="c2html-keyword">int</span> i; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
412 | <a class="c2html-lineno" name="l359" href="#l359">359 </a> <span class="c2html-keyword">int</span> token_start = -<span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
413 | <a class="c2html-lineno" name="l360" href="#l360">360 </a> <span class="c2html-keyword">int</span> token_end = -<span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
414 | <a class="c2html-lineno" name="l361" href="#l361">361 </a> <span class="c2html-keyword">for</span>(i=<span class="c2html-macroconst">0</span>;i<=str.length;i++) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
415 | <a class="c2html-lineno" name="l362" href="#l362">362 </a> <span class="c2html-keyword">int</span> c; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
416 | <a class="c2html-lineno" name="l363" href="#l363">363 </a> <span class="c2html-keyword">if</span>(i == str.length) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
417 | <a class="c2html-lineno" name="l364" href="#l364">364 </a> c = <span class="c2html-string">' '</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
418 | <a class="c2html-lineno" name="l365" href="#l365">365 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
419 | <a class="c2html-lineno" name="l366" href="#l366">366 </a> c = str.ptr[i]; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
420 | <a class="c2html-lineno" name="l367" href="#l367">367 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
421 | <a class="c2html-lineno" name="l368" href="#l368">368 </a> <span class="c2html-keyword">if</span>(c < <span class="c2html-macroconst">33</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
422 | <a class="c2html-lineno" name="l369" href="#l369">369 </a> <span class="c2html-keyword">if</span>(token_start != -<span class="c2html-macroconst">1</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
423 | <a class="c2html-lineno" name="l370" href="#l370">370 </a> token_end = i; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
424 | <a class="c2html-lineno" name="l371" href="#l371">371 </a> <span class="c2html-type">size_t</span> len = token_end - token_start; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
425 | <a class="c2html-lineno" name="l372" href="#l372">372 </a> <span class="c2html-type">sstr_t</span> tk = sstrsubsl(str, token_start, len); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
426 | <a class="c2html-lineno" name="l373" href="#l373">373 </a> <span class="c2html-comment">//printf("token: {%.*s}\n", token.length, token.ptr);</span> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
427 | <a class="c2html-lineno" name="l374" href="#l374">374 </a> <span class="c2html-keyword">if</span>(!sstrcmp(tk, token)) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
428 | <a class="c2html-lineno" name="l375" href="#l375">375 </a> *sub = sstrtrim(sstrsubsl(str, <span class="c2html-macroconst">0</span>, token_start)); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
429 | <a class="c2html-lineno" name="l376" href="#l376">376 </a> <span class="c2html-keyword">break</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
430 | <a class="c2html-lineno" name="l377" href="#l377">377 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
431 | <a class="c2html-lineno" name="l378" href="#l378">378 </a> token_start = -<span class="c2html-macroconst">1</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
432 | <a class="c2html-lineno" name="l379" href="#l379">379 </a> token_end = -<span class="c2html-macroconst">1</span>; |
66 | 433 | <a class="c2html-lineno" name="l380" href="#l380">380 </a> } |
75
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
434 | <a class="c2html-lineno" name="l381" href="#l381">381 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
435 | <a class="c2html-lineno" name="l382" href="#l382">382 </a> <span class="c2html-keyword">if</span>(token_start == -<span class="c2html-macroconst">1</span>) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
436 | <a class="c2html-lineno" name="l383" href="#l383">383 </a> token_start = i; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
437 | <a class="c2html-lineno" name="l384" href="#l384">384 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
438 | <a class="c2html-lineno" name="l385" href="#l385">385 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
439 | <a class="c2html-lineno" name="l386" href="#l386">386 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
440 | <a class="c2html-lineno" name="l387" href="#l387">387 </a> |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
441 | <a class="c2html-lineno" name="l388" href="#l388">388 </a> <span class="c2html-keyword">if</span>(i < str.length) { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
442 | <a class="c2html-lineno" name="l389" href="#l389">389 </a> <span class="c2html-keyword">return</span> sstrtrim(sstrsubs(str, i)); |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
443 | <a class="c2html-lineno" name="l390" href="#l390">390 </a> } <span class="c2html-keyword">else</span> { |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
444 | <a class="c2html-lineno" name="l391" href="#l391">391 </a> str.ptr = <span class="c2html-macroconst">NULL</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
445 | <a class="c2html-lineno" name="l392" href="#l392">392 </a> str.length = <span class="c2html-macroconst">0</span>; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
446 | <a class="c2html-lineno" name="l393" href="#l393">393 </a> <span class="c2html-keyword">return</span> str; |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
447 | <a class="c2html-lineno" name="l394" href="#l394">394 </a> } |
c72b250866ab
add basic support for line continuations in C highlighter
Mike Becker <universe@uap-core.de>
parents:
70
diff
changeset
|
448 | <a class="c2html-lineno" name="l395" href="#l395">395 </a>}</div> |
41
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
449 | </body> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
450 | </html> |
c06ab07fd29d
increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
451 |