MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / API_ROUTINE gds__edit

Function API_ROUTINE gds__edit

src/yvalve/utl.cpp:1794–1829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1792
1793#if defined(UNIX) || defined(WIN_NT)
1794int API_ROUTINE gds__edit(const TEXT* file_name, USHORT /*type*/)
1795{
1796/**************************************
1797 *
1798 * g d s _ $ e d i t
1799 *
1800 **************************************
1801 *
1802 * Functional description
1803 * Edit a file.
1804 *
1805 **************************************/
1806 string editor;
1807
1808#ifndef WIN_NT
1809 if (!fb_utils::readenv("VISUAL", editor) && !fb_utils::readenv("EDITOR", editor))
1810 editor = "vi";
1811#else
1812 if (!fb_utils::readenv("EDITOR", editor))
1813 editor = "Notepad";
1814#endif
1815
1816 struct STAT before;
1817 os_utils::stat(file_name, &before);
1818 // The path of the editor + the path of the file + quotes + one space.
1819 // We aren't using quotes around the editor for now.
1820 TEXT buffer[MAXPATHLEN * 2 + 5];
1821 fb_utils::snprintf(buffer, sizeof(buffer), "%s \"%s\"", editor.c_str(), file_name);
1822
1823 FB_UNUSED(system(buffer));
1824
1825 struct STAT after;
1826 os_utils::stat(file_name, &after);
1827
1828 return (before.st_mtime != after.st_mtime || before.st_size != after.st_size);
1829}
1830#endif
1831
1832

Callers

nothing calls this directly

Calls 4

readenvFunction · 0.85
statClass · 0.50
snprintfFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected