comparison main.c @ 549:dd7b58eca06d

Use the helper functions for creating log file directory automatically.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Nov 2012 14:18:26 +0200
parents 28688eb812de
children 504a8b9297a3
comparison
equal deleted inserted replaced
548:28688eb812de 549:dd7b58eca06d
1805 1805
1806 // Initialize curses windowing 1806 // Initialize curses windowing
1807 if (!optDaemon && !nnwin_init(SET_DELAY)) 1807 if (!optDaemon && !nnwin_init(SET_DELAY))
1808 goto err_exit; 1808 goto err_exit;
1809 1809
1810 {
1811 BOOL isDir, isWritable, isReadable;
1812 if (nn_stat_path(optLogPath, &isDir, &isWritable, &isReadable))
1813 {
1814 if (!isDir)
1815 {
1816 errorMsg("The log file path '%s' is not a directory.\n",
1817 optLogPath);
1818 goto err_exit;
1819 }
1820 else
1821 if (!isWritable)
1822 {
1823 errorMsg("The log file path '%s' is not writable.\n",
1824 optLogPath);
1825 goto err_exit;
1826 }
1827 }
1828 else
1829 if (!nn_mkdir_rec(optLogPath))
1830 {
1831 errorMsg("Could not create log file directory '%s'.\n",
1832 optLogPath);
1833 goto err_exit;
1834 }
1835 }
1836
1810 if (cursesInit) 1837 if (cursesInit)
1811 { 1838 {
1812 printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc); 1839 printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc);
1813 printMsg(NULL, "%s\n", th_prog_author); 1840 printMsg(NULL, "%s\n", th_prog_author);
1814 printMsg(NULL, "%s\n", th_prog_license); 1841 printMsg(NULL, "%s\n", th_prog_license);