mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added escape char possibility to "\#" for substitutions
SVN revision: 2449
This commit is contained in:
parent
96d77ffed1
commit
69c0cd4a41
10
src/elogd.c
10
src/elogd.c
@ -8650,7 +8650,7 @@ void get_auto_index(LOGBOOK * lbs, int index, char *format, char *retstr, int si
|
|||||||
auto-increment tags */
|
auto-increment tags */
|
||||||
{
|
{
|
||||||
int i, message_id, loc, len, old_index;
|
int i, message_id, loc, len, old_index;
|
||||||
char str[NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH], att[MAX_ATTACHMENTS][256];
|
char *p, str[NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH], att[MAX_ATTACHMENTS][256];
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
if (strchr(format, '%') == NULL && strchr(format, '#') == NULL) {
|
if (strchr(format, '%') == NULL && strchr(format, '#') == NULL) {
|
||||||
@ -8661,8 +8661,14 @@ void get_auto_index(LOGBOOK * lbs, int index, char *format, char *retstr, int si
|
|||||||
time(&now);
|
time(&now);
|
||||||
my_strftime(retstr, size, format, localtime(&now));
|
my_strftime(retstr, size, format, localtime(&now));
|
||||||
|
|
||||||
if (strchr(retstr, '#') == NULL)
|
p = strchr(retstr, '#');
|
||||||
|
if (p == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (p > retstr && *(p-1) == '\\') { // escape
|
||||||
|
memmove(p-1, p, strlen(p)+1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* record location and length of ###'s */
|
/* record location and length of ###'s */
|
||||||
for (i = loc = 0, len = 1; i < (int) strlen(retstr); i++) {
|
for (i = loc = 0, len = 1; i < (int) strlen(retstr); i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user