chiark / gitweb /
logging: add trailing newline to all strings
[elogind.git] / extras / cdrom_id / cdrom_id.c
index 315d27610f1bcc91a9d10886f451fc9f440d7637..b88f5b4b1e0748f9729ce002d8ccd0d88d74206a 100644 (file)
@@ -71,7 +71,6 @@ void log_message(int priority, const char *format, ...)
        if (debug) {
                fprintf(stderr, "[%d] ", (int) getpid());
                vfprintf(stderr, format, args);
-               fprintf(stderr, "\n");
        } else
                vsyslog(priority, format, args);
        va_end(args);
@@ -137,10 +136,10 @@ static unsigned long long int cd_media_session_last_offset;
 static void info_scsi_cmd_err(const char *cmd, int err)
 {
        if (err == -1) {
-               info("%s failed", cmd);
+               info("%s failed\n", cmd);
                return;
        }
-       info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh", cmd, SK(err), ASC(err), ASCQ(err));
+       info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err));
 }
 
 struct scsi_cmd {
@@ -199,7 +198,7 @@ static int cd_capability_compat(int fd)
 
        capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
        if (capabilty < 0) {
-               info("CDROM_GET_CAPABILITY failed");
+               info("CDROM_GET_CAPABILITY failed\n");
                return -1;
        }
 
@@ -235,11 +234,11 @@ static int cd_inquiry(int fd) {
        }
 
        if ((inq[0] & 0x1F) != 5) {
-               info("not an MMC unit");
+               info("not an MMC unit\n");
                return -1;
        }
 
-       info("INQUIRY: [%.8s][%.16s][%.4s]", inq + 8, inq + 16, inq + 32);
+       info("INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32);
        return 0;
 }
 
@@ -264,9 +263,9 @@ static int cd_profiles(int fd)
        }
 
        len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]);
-       info("GET CONFIGURATION: number of profiles %i", len);
+       info("GET CONFIGURATION: number of profiles %i\n", len);
        if (len > sizeof(profiles)) {
-               info("invalid number of profiles");
+               info("invalid number of profiles\n");
                return -1;
        }
 
@@ -287,7 +286,7 @@ static int cd_profiles(int fd)
                unsigned int profile = (profiles[i] << 8 | profiles[i + 1]);
                if (profile == 0)
                        continue;
-               info("profile 0x%02x", profile);
+               info("profile 0x%02x\n", profile);
 
                switch (profile) {
                case 0x03:
@@ -343,9 +342,9 @@ static int cd_profiles(int fd)
 
        /* current media profile */
        cur_profile = header[6] << 8 | header[7];
-       info("current profile 0x%02x", cur_profile);
+       info("current profile 0x%02x\n", cur_profile);
        if (cur_profile == 0) {
-               info("no current profile, assuming no media");
+               info("no current profile, assuming no media\n");
                return -1;
        }
 
@@ -435,7 +434,7 @@ static int cd_media_info(int fd)
                return -1;
        };
 
-       info("disk type %02x", header[8]);
+       info("disk type %02x\n", header[8]);
 
        if ((header[2] & 3) < 4)
                cd_media_state = media_status[header[2] & 3];
@@ -467,12 +466,12 @@ static int cd_media_toc(int fd)
        }
 
        len = (header[0] << 8 | header[1]) + 2;
-       info("READ TOC: len: %d", len);
+       info("READ TOC: len: %d\n", len);
        if (len > sizeof(toc))
                return -1;
 
        /* check if we have a data track */
-       info("ctl %02x (0x04 is data/audio)", header[5]);
+       info("ctl %02x (0x04 is data/audio)\n", header[5]);
        cd_media_has_audio = (header[5] & 0x04) == 0;
 
        scsi_cmd_set(&sc, 0, 0x43);
@@ -490,7 +489,7 @@ static int cd_media_toc(int fd)
                unsigned int block;
 
                block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7];
-               info("track %u starts at block %u", p[2], block);
+               info("track %u starts at block %u\n", p[2], block);
        }
 
        scsi_cmd_set(&sc, 0, 0x43);
@@ -503,7 +502,7 @@ static int cd_media_toc(int fd)
                return -1;
        }
        len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7];
-       info("last track %u starts at block %u", header[4+2], len);
+       info("last track %u starts at block %u\n", header[4+2], len);
        cd_media_session_last_offset = (unsigned long long int)len * 2048;
        return 0;
 }
@@ -550,7 +549,7 @@ int main(int argc, char *argv[])
 
        node = argv[optind];
        if (!node) {
-               err("no device");
+               err("no device\n");
                fprintf(stderr, "no device\n");
                rc = 1;
                goto exit;
@@ -558,11 +557,11 @@ int main(int argc, char *argv[])
 
        fd = open(node, O_RDONLY | O_NONBLOCK);
        if (fd < 0) {
-               info("unable to open '%s'", node);
+               info("unable to open '%s'\n", node);
                rc = 1;
                goto exit;
        }
-       info("probing: '%s'", node);
+       info("probing: '%s'\n", node);
 
        /* same data as original cdrom_id */
        if (cd_capability_compat(fd) < 0) {