Skip to content

Commit

Permalink
Fix csv_escape #58
Browse files Browse the repository at this point in the history
  • Loading branch information
simon987 committed Jun 5, 2020
1 parent 27b4e64 commit 018b49f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define EPILOG "Made by simon987 <[email protected]>. Released under GPL-3.0"


static const char *const Version = "2.4.0";
static const char *const Version = "2.4.1";
static const char *const usage[] = {
"sist2 scan [OPTION]... PATH",
"sist2 index [OPTION]... INDEX",
Expand Down
2 changes: 1 addition & 1 deletion src/static/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">2.4.0</span>
<span class="badge badge-pill version">2.4.1</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span>
<a class="btn ml-auto" href="/stats">Stats</a>
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings</button>
Expand Down
2 changes: 1 addition & 1 deletion src/static/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">2.4.0</span>
<span class="badge badge-pill version">2.4.1</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span>
<a style="margin-left: auto" class="btn" href="/">Back</a>
<button class="btn" type="button" data-toggle="modal" data-target="#settings"
Expand Down
8 changes: 5 additions & 3 deletions src/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,18 @@ void csv_escape(char *dst, const char *str) {
return;
}

while (*ptr++ != 0) {
char c = *ptr;

*out++ = '"';
char c;
while ((c = *ptr++) != 0) {
if (c == '"') {
*out++ = '"';
*out++ = '"';
} else {
*out++ = c;
}
}
*out++ = '"';
*out = '\0';
}

int open_or_exit(const char *path) {
Expand Down

0 comments on commit 018b49f

Please sign in to comment.