commit ed61ce74b727cc9f6f3b87e3c30a21657fe7df38
Author: Juergen Spitzmueller <[email protected]>
Date: Mon Aug 20 09:25:22 2018 +0200
So long, date-insert!
This function is superseded by info-insert date, which is much mightier
and more flexible.
---
lib/RELEASE-NOTES | 9 +++++
lib/doc/UserGuide.lyx | 8 ++--
lib/doc/de/UserGuide.lyx | 56 ----------------------------------
lib/scripts/prefs2prefs_lfuns.py | 7 ++++-
lib/scripts/prefs2prefs_prefs.py | 11 ++++++-
src/FuncCode.h | 5 +--
src/LyXAction.cpp | 13 --------
src/LyXRC.cpp | 22 +-------------
src/LyXRC.h | 3 --
src/Text3.cpp | 15 ---------
src/frontends/qt4/GuiPrefs.cpp | 48 -----------------------------
src/frontends/qt4/GuiPrefs.h | 3 --
src/frontends/qt4/ui/PrefOutputUi.ui | 29 +-----------------
src/support/lyxtime.cpp | 9 -----
src/support/lyxtime.h | 7 ----
src/support/os.h | 3 --
src/support/os_cygwin.cpp | 17 ----------
src/support/os_unix.cpp | 17 ----------
src/support/os_win32.cpp | 17 ----------
19 files changed, 33 insertions(+), 266 deletions(-)
diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 2a1157e..9fa91e3 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -29,6 +29,10 @@
* \use_qimage
This is no longer necessary due to the rewrite of the painter.
+* \date_insert_format
+ The function date-insert has been removed and superseded by info-insert date.
+ The latter does not need a pref value anymore.
+
!!!The following new LyX functions have been introduced in 2.4:
@@ -42,6 +46,11 @@
* info-insert buffer vcs-*: renamed to info-insert vcs *
+!!!The following LyX functions have been removed in 2.4:
+
+* date-insert: obsoleted by info-insert date.
+
+
!!!The following LyX documents have been moved in 2.4:
diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index 893fe1e..e648bab 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -8343,14 +8343,12 @@ Verbatim
\end_layout
\begin_layout Verbatim
-
This is Verbatim.
\end_layout
\begin_layout Verbatim
\noindent
\align block
-
The following 2 lines are empty:
\end_layout
@@ -8363,7 +8361,6 @@ The following 2 lines are empty:
\end_layout
\begin_layout Verbatim
-
Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash
}][{|
@@ -8387,7 +8384,6 @@ Verbatim
\end_layout
\begin_layout Verbatim*
-
This is Verbatim*.
\end_layout
@@ -49274,6 +49270,8 @@ text
\end_layout
\begin_layout Description
+
+\change_deleted -712698321 1534601711
Date
\begin_inset space ~
\end_inset
@@ -49326,6 +49324,8 @@ For example the format
\end_inset
prints the date as day/month/year.
+\change_unchanged
+
\end_layout
\begin_layout Description
diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx
index 1951687..3677149 100644
--- a/lib/doc/de/UserGuide.lyx
+++ b/lib/doc/de/UserGuide.lyx
@@ -8601,12 +8601,10 @@ Unformatiert
\end_layout
\begin_layout Verbatim
-
Dies ist Unformatiert.
\end_layout
\begin_layout Verbatim
-
Die folgenden 2 Zeilen sind leer:
\end_layout
@@ -8619,7 +8617,6 @@ Die folgenden 2 Zeilen sind leer:
\end_layout
\begin_layout Verbatim
-
Fast alles ist in Unformatiert erlaubt:"%&$§#~'`
\backslash
}][{|
@@ -8643,7 +8640,6 @@ Unformatiert
\end_layout
\begin_layout Verbatim*
-
Dies ist Unformatiert*.
\end_layout
@@ -47024,58 +47020,6 @@ Text
\end_layout
\begin_layout Description
-Datumsformat
-\begin_inset Index idx
-status collapsed
-
-\begin_layout Plain Layout
-Datumsformat
-\end_layout
-
-\end_inset
-
-
-\begin_inset Index idx
-status collapsed
-
-\begin_layout Plain Layout
-Einstellungen ! Datumsformat
-\end_layout
-
-\end_inset
-
- Das Datumsformat kann eines oder eine Mischung der hier aufgelisteten Formate
- sein:
-\begin_inset Newline newline
-\end_inset
-
-
-\begin_inset Flex URL
-status collapsed
-
-\begin_layout Plain Layout
-
-http://man7.org/linux/man-pages/man1/date.1.html
-\end_layout
-
-\end_inset
-
-
-\begin_inset Newline newline
-\end_inset
-
-Zum Beispiel gibt das Format
-\begin_inset Newline newline
-\end_inset
-
-%d/%m/%y
-\begin_inset Newline newline
-\end_inset
-
-das Datum in der Form Tag/Monat/Jahr aus.
-\end_layout
-
-\begin_layout Description
Beim
\begin_inset space ~
\end_inset
diff --git a/lib/scripts/prefs2prefs_lfuns.py b/lib/scripts/prefs2prefs_lfuns.py
index 2ffb7f1..ec65f97 100644
--- a/lib/scripts/prefs2prefs_lfuns.py
+++ b/lib/scripts/prefs2prefs_lfuns.py
@@ -217,6 +217,10 @@ def info_rename_vcstreerevision(line):
return simple_renaming(line, "info-insert buffer vcs-tree-revision",
"info-insert vcs tree-revision")
+def remove_date_insert(line):
+ return simple_remove(line, "date-insert")
+
+
#
###########################################################
@@ -253,6 +257,7 @@ conversions = [
info_rename_vcsdate,
info_rename_vcstime,
info_rename_vcsrevision,
- info_rename_vcstreerevision
+ info_rename_vcstreerevision,
+ remove_date_insert
]]
]
diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py
index 8ea2072..5e7c0bf 100644
--- a/lib/scripts/prefs2prefs_prefs.py
+++ b/lib/scripts/prefs2prefs_prefs.py
@@ -111,6 +111,9 @@
# Incremented to format 27, by spitz
# Add optional flavor value to needaux flag
+# Incremented to format 28, by spitz
+# Remove date_insert_format
+
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
@@ -405,6 +408,11 @@ def remove_font_encoding(line):
return no_match
return (True, "")
+def remove_date_insert_format(line):
+ if not line.lower().startswith("\\date_insert_format "):
+ return no_match
+ return (True, "")
+
# End conversions for LyX 2.3 to 2.4
####################################
@@ -446,5 +454,6 @@ conversions = [
[ 24, [rename_collapsible]],
[ 25, [remove_use_qimage]],
[ 26, [remove_font_encoding]],
- [ 27, []]
+ [ 27, []],
+ [ 28, [remove_date_insert_format]]
]
diff --git a/src/FuncCode.h b/src/FuncCode.h
index 7b8fedc..3798786 100644
--- a/src/FuncCode.h
+++ b/src/FuncCode.h
@@ -241,7 +241,7 @@ enum FuncCode
LFUN_PREFERENCES_SAVE,
LFUN_HELP_OPEN, // Jug 990627
// 175
- LFUN_DATE_INSERT, // jdblair 20000131
+ LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
LFUN_LANGUAGE, // Dekel 20000203
LFUN_ERT_INSERT, // Jug 20000218
LFUN_FOOTNOTE_INSERT, // Jug 20000307
@@ -479,9 +479,8 @@ enum FuncCode
LFUN_BUFFER_ANONYMIZE, // sanda, 20180201
LFUN_GRAPHICS_UNIFY, // sanda, 20180207
LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417
- LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
- // 375
LFUN_INSET_END_EDIT, // gb/rkh, 20180605
+ // 375
LFUN_LASTACTION // end of the table
};
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 4f42488..43f4e80 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1366,19 +1366,6 @@ void LyXAction::init()
{ LFUN_CUT, "cut", Noop, Edit },
/*!
- * \var lyx::FuncCode lyx::LFUN_DATE_INSERT
- * \li Action: Inserts the current date.
- * \li Syntax: date-insert [<ARG>]
- * \li Params: <ARG>: Format of date. The default value (%x) can be set
- in Preferences->Output->General->Date format. For
- possible formats see the manual page of the
- strftime function.
- * \li Origin: jdblair, 31 Jan 2000
- * \endvar
- */
- { LFUN_DATE_INSERT, "date-insert", Noop, Edit },
-
-/*!
* \var lyx::FuncCode lyx::LFUN_DEBUG_LEVEL_SET
* \li Action: Set debug output level.
* \li Syntax: debug-level-set <LEVEL>
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 5e8d38c..d11181f 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -59,7 +59,7 @@ namespace {
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
-static unsigned int const LYXRC_FILEFORMAT = 27; // spitz: add flavor value to
needaux flag
+static unsigned int const LYXRC_FILEFORMAT = 28; // spitz: remove
\\date_insert_format
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
@@ -92,7 +92,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\copier", LyXRC::RC_COPIER },
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
- { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
{ "\\def_file", LyXRC::RC_DEFFILE },
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
{ "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
@@ -311,7 +310,6 @@ void LyXRC::setDefaults()
show_banner = true;
windows_style_tex_paths = false;
tex_allows_spaces = false;
- date_insert_format = "%x";
cursor_follows_scrollbar = false;
scroll_below_document = false;
scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
@@ -917,9 +915,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool
check_format)
if (lexrc.next())
default_length_unit = (Length::UNIT)
lexrc.getInteger();
break;
- case RC_DATE_INSERT_FORMAT:
- lexrc >> date_insert_format;
- break;
case RC_LANGUAGE_CUSTOM_PACKAGE:
lexrc >> language_custom_package;
break;
@@ -1592,15 +1587,6 @@ void LyXRC::write(ostream & os, bool
ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
// fall through
- case RC_DATE_INSERT_FORMAT:
- if (ignore_system_lyxrc ||
- date_insert_format != system_lyxrc.date_insert_format) {
- os << "\\date_insert_format \"" << date_insert_format
- << "\"\n";
- }
- if (tag != RC_LAST)
- break;
- // fall through
case RC_USER_NAME:
os << "\\user_name \"" << user_name << "\"\n";
if (tag != RC_LAST)
@@ -2913,7 +2899,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC
const & lyxrc_new)
case LyXRC::RC_COPIER:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
- case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_GUI_LANGUAGE:
case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
@@ -3153,11 +3138,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Show a small box around a Math Macro with the macro
name when the cursor is inside.");
break;
- case RC_DATE_INSERT_FORMAT:
- //xgettext:no-c-format
- str = _("This accepts the normal strftime formats; see man
strftime for full details. E.g.\"%A, %e. %B %Y\".");
- break;
-
case RC_DEFFILE:
str = _("Command definition file. Can either specify an
absolute path, or LyX will look in its global and local commands/
directories.");
break;
diff --git a/src/LyXRC.h b/src/LyXRC.h
index b499c7a..8a371d9 100644
--- a/src/LyXRC.h
+++ b/src/LyXRC.h
@@ -66,7 +66,6 @@ public:
RC_COPIER,
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CURSOR_WIDTH,
- RC_DATE_INSERT_FORMAT,
RC_DEFAULT_DECIMAL_POINT,
RC_DEFAULT_LENGTH_UNIT,
RC_DEFAULT_OTF_VIEW_FORMAT,
@@ -357,8 +356,6 @@ public:
///
std::string lyxpipes;
///
- std::string date_insert_format;
- ///
std::string language_custom_package;
///
bool language_auto_begin;
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 7d1142c..918064c 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -1750,14 +1750,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break;
}
- case LFUN_DATE_INSERT: {
- string const format = cmd.argument().empty()
- ? lyxrc.date_insert_format : to_utf8(cmd.argument());
- string const time = formatted_time(current_time(), format);
- lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, time));
- break;
- }
-
case LFUN_MOUSE_TRIPLE:
if (cmd.button() == mouse_button::button1) {
tm->cursorHome(cur);
@@ -3271,13 +3263,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const &
cmd,
enable = !inDescriptionItem(cur);
break;
- case LFUN_DATE_INSERT: {
- string const format = cmd.argument().empty()
- ? lyxrc.date_insert_format : to_utf8(cmd.argument());
- enable = support::os::is_valid_strftime(format);
- break;
- }
-
case LFUN_LANGUAGE:
enable = !cur.paragraph().isPassThru();
flag.setOnOff(cmd.getArg(0) ==
cur.real_current_font.language()->lang());
diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index f79d4d3..c08245c 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -351,35 +351,6 @@ static void setComboxFont(QComboBox * cb, string const &
family,
/////////////////////////////////////////////////////////////////////
//
-// StrftimeValidator
-//
-/////////////////////////////////////////////////////////////////////
-
-class StrftimeValidator : public QValidator
-{
-public:
- StrftimeValidator(QWidget *);
- QValidator::State validate(QString & input, int & pos) const;
-};
-
-
-StrftimeValidator::StrftimeValidator(QWidget * parent)
- : QValidator(parent)
-{
-}
-
-
-QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/)
const
-{
- if (is_valid_strftime(fromqstr(input)))
- return QValidator::Acceptable;
- else
- return QValidator::Intermediate;
-}
-
-
-/////////////////////////////////////////////////////////////////////
-//
// PrefOutput
//
/////////////////////////////////////////////////////////////////////
@@ -389,12 +360,9 @@ PrefOutput::PrefOutput(GuiPreferences * form)
{
setupUi(this);
- DateED->setValidator(new StrftimeValidator(DateED));
dviCB->setValidator(new NoNewLineValidator(dviCB));
pdfCB->setValidator(new NoNewLineValidator(pdfCB));
- connect(DateED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(overwriteCO, SIGNAL(activated(int)),
@@ -430,19 +398,8 @@ PrefOutput::PrefOutput(GuiPreferences * form)
}
-void PrefOutput::on_DateED_textChanged(const QString &)
-{
- QString t = DateED->text();
- int p = 0;
- bool valid = DateED->validator()->validate(t, p)
- == QValidator::Acceptable;
- setValid(DateLA, valid);
-}
-
-
void PrefOutput::applyRC(LyXRC & rc) const
{
- rc.date_insert_format = fromqstr(DateED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
rc.forward_search_dvi = fromqstr(dviCB->currentText());
rc.forward_search_pdf = fromqstr(pdfCB->currentText());
@@ -467,7 +424,6 @@ void PrefOutput::applyRC(LyXRC & rc) const
void PrefOutput::updateRC(LyXRC const & rc)
{
- DateED->setText(toqstr(rc.date_insert_format));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
dviCB->setEditText(toqstr(rc.forward_search_dvi));
pdfCB->setEditText(toqstr(rc.forward_search_pdf));
@@ -3440,7 +3396,6 @@ GuiPreferences::GuiPreferences(GuiView & lv)
addModule(new PrefLanguage(this));
addModule(new PrefSpellchecker(this));
- //for strftime validator
PrefOutput * output = new PrefOutput(this);
addModule(output);
addModule(new PrefLatex(this));
@@ -3464,9 +3419,6 @@ GuiPreferences::GuiPreferences(GuiView & lv)
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
-
- // initialize the strftime validator
- bc().addCheckedLineEdit(output->DateED);
}
diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h
index 4f56499..d6f7602 100644
--- a/src/frontends/qt4/GuiPrefs.h
+++ b/src/frontends/qt4/GuiPrefs.h
@@ -163,9 +163,6 @@ public:
virtual void applyRC(LyXRC & rc) const;
virtual void updateRC(LyXRC const & rc);
-
-private Q_SLOTS:
- void on_DateED_textChanged(const QString &);
};
diff --git a/src/frontends/qt4/ui/PrefOutputUi.ui
b/src/frontends/qt4/ui/PrefOutputUi.ui
index 0c24c05..f8c8a82 100644
--- a/src/frontends/qt4/ui/PrefOutputUi.ui
+++ b/src/frontends/qt4/ui/PrefOutputUi.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>356</width>
- <height>393</height>
+ <height>442</height>
</rect>
</property>
<property name="windowTitle">
@@ -193,33 +193,6 @@
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QLabel" name="DateLA">
- <property name="text">
- <string>&Date format:</string>
- </property>
- <property name="buddy">
- <cstring>DateED</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="DateED">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Date format for strftime output</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_4">
diff --git a/src/support/lyxtime.cpp b/src/support/lyxtime.cpp
index 5415ac4..f3318eb 100644
--- a/src/support/lyxtime.cpp
+++ b/src/support/lyxtime.cpp
@@ -31,15 +31,6 @@ time_t current_time()
}
-string const formatted_time(time_t t, string const & fmt)
-{
- struct tm * loc_tm = localtime(&t);
- char date[50];
- strftime(date, sizeof(date), fmt.c_str(), loc_tm);
- return string(date);
-}
-
-
docstring formatted_datetime(time_t t, string const & fmt)
{
QString qres;
diff --git a/src/support/lyxtime.h b/src/support/lyxtime.h
index bc545b8..05cbc50 100644
--- a/src/support/lyxtime.h
+++ b/src/support/lyxtime.h
@@ -24,13 +24,6 @@ namespace support {
time_t current_time();
-/** Returns a locale-dependent formatting of the date
- * and time encoded in \c time. The \p fmt string
- * holds the formatting arguments of \c strftime.
- * Prefer the function formatted_datetime below.
- */
-std::string const formatted_time(time_t t, std::string const & fmt);
-
/** Returns a locale-dependent formatting of the date and time encoded in \c t
* The \p fmt string holds the formatting arguments of QDateTime::toString().
* If fmt is empty then the formatting of the date and time is itself
according
diff --git a/src/support/os.h b/src/support/os.h
index 9b38e4e..07d6d7b 100644
--- a/src/support/os.h
+++ b/src/support/os.h
@@ -111,9 +111,6 @@ std::string latex_path(std::string const & p);
*/
std::string latex_path_list(std::string const & p);
-/// Checks if the format string is suitable on the OS
-bool is_valid_strftime(std::string const & p);
-
/** Returns a string suitable to be passed to popen when
* reading a file.
*/
diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp
index 64436f1..5d43737 100644
--- a/src/support/os_cygwin.cpp
+++ b/src/support/os_cygwin.cpp
@@ -364,23 +364,6 @@ string latex_path_list(string const & p)
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
// returns a string suitable to be passed to popen when
// reading a pipe
char const * popen_read_mode()
diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp
index 5a6c21f..34cfd47 100644
--- a/src/support/os_unix.cpp
+++ b/src/support/os_unix.cpp
@@ -193,23 +193,6 @@ string latex_path_list(string const & p)
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
char const * popen_read_mode()
{
return "r";
diff --git a/src/support/os_win32.cpp b/src/support/os_win32.cpp
index 8d52138..145d506 100644
--- a/src/support/os_win32.cpp
+++ b/src/support/os_win32.cpp
@@ -442,23 +442,6 @@ string latex_path_list(string const & p)
}
-bool is_valid_strftime(string const & p)
-{
- string::size_type pos = p.find_first_of('%');
- while (pos != string::npos) {
- if (pos + 1 == string::npos)
- break;
- if (!containsOnly(p.substr(pos + 1, 1),
- "aAbBcdfHIjmMpSUwWxXyYzZ%"))
- return false;
- if (pos + 2 == string::npos)
- break;
- pos = p.find_first_of('%', pos + 2);
- }
- return true;
-}
-
-
// returns a string suitable to be passed to popen when
// reading a pipe
char const * popen_read_mode()