Fix verbose and debug mode options
[babeltrace.git] / converter / babeltrace-log.c
index 55eabf2d1e39015910b4e1c1991627f51205c7ae..38cf8392d47802224f63990d7a80d7055798fff8 100644 (file)
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
- *
- * Depends on glibc 2.10 for getline().
  */
 
-#define _GNU_SOURCE
-#include <config.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
 #include <inttypes.h>
+#include <glib.h>
+#include <glib/gstdio.h>
 
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/types.h>
 #include <babeltrace/compat/uuid.h>
 #include <babeltrace/compat/utc.h>
+#include <babeltrace/compat/stdio.h>
 #include <babeltrace/endian.h>
 
 #define NSEC_PER_USEC 1000UL
@@ -54,7 +53,7 @@
 #define NSEC_PER_SEC 1000000000ULL
 #define USEC_PER_SEC 1000000UL
 
-int babeltrace_debug, babeltrace_verbose;
+bool babeltrace_debug, babeltrace_verbose;
 
 static char *s_outputname;
 static int s_timestamp;
@@ -233,7 +232,7 @@ void write_event_header(struct ctf_stream_pos *pos, char *line,
                        ti.tm_min = min;
                        ti.tm_sec = sec;
 
-                       ep_sec = babeltrace_timegm(&ti);
+                       ep_sec = bt_timegm(&ti);
                        if (ep_sec != (time_t) -1) {
                                *ts = (uint64_t) ep_sec * NSEC_PER_SEC
                                        + (uint64_t) msec * NSEC_PER_MSEC;
@@ -318,7 +317,7 @@ void trace_text(FILE *input, int output)
        struct ctf_stream_pos pos;
        ssize_t len;
        char *line = NULL, *nl;
-       size_t linesize;
+       size_t linesize = 0;
        int ret;
 
        memset(&pos, 0, sizeof(pos));
@@ -331,7 +330,7 @@ void trace_text(FILE *input, int output)
        write_packet_header(&pos, s_uuid);
        write_packet_context(&pos);
        for (;;) {
-               len = getline(&line, &linesize, input);
+               len = bt_getline(&line, &linesize, input);
                if (len < 0)
                        break;
                nl = strrchr(line, '\n');
@@ -404,9 +403,9 @@ int main(int argc, char **argv)
                exit(EXIT_SUCCESS);
        }
 
-       ret = mkdir(s_outputname, S_IRWXU|S_IRWXG);
+       ret = g_mkdir(s_outputname, S_IRWXU|S_IRWXG);
        if (ret) {
-               perror("mkdir");
+               perror("g_mkdir");
                goto error;
        }
 
This page took 0.023944 seconds and 4 git commands to generate.