File: cgdb_clog.cpp

package info (click to toggle)
cgdb 0.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,468 kB
  • sloc: cpp: 12,169; ansic: 10,042; sh: 4,383; exp: 640; makefile: 197
file content (32 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "cgdb_clog.h"

/**
 * Modified clog's clog_error function to set this variable.
 */
bool clog_cgdb_error_occurred = false;

int clog_open(int id, const char *fmt, const char *config_dir)
{
    int i;

    /* Try to open a log file exclusively. This allows us to run
     * several instances of cgdb without the logfiles getting borked. */
    for (i = 1; i < 100; i++)
    {
        char filename[FSUTIL_PATH_MAX];

        /* Initialize the debug file that a2_tgdb writes to */
        snprintf(filename, sizeof(filename), fmt, config_dir, i);

        if (clog_init_path(id, filename) == 0) {
            return 0;
        }
    }

    return -1;
}

bool clog_did_error_occur()
{
    return clog_cgdb_error_occurred;
}