chiark / gitweb /
sd-booted: update sd_booted() check a bit
[elogind.git] / src / core / manager.c
index 77eaa468d95d444db6a9f8a7640458e6e91d74e9..8e66732cd7bf8c68347f6a307b10f37e1aea2246 100644 (file)
@@ -226,36 +226,26 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
         assert(pos <= width+1); /* 0 or width+1 mean that the center light is behind the corner */
 
         if (pos > 1) {
-                if (pos > 2) {
-                        memset(p, ' ', pos-2);
-                        p += pos-2;
-                }
-                memcpy(p, ANSI_RED_ON, strlen(ANSI_RED_ON));
-                p += strlen(ANSI_RED_ON);
+                if (pos > 2)
+                        p = mempset(p, ' ', pos-2);
+                p = stpcpy(p, ANSI_RED_ON);
                 *p++ = '*';
         }
 
         if (pos > 0 && pos <= width) {
-                memcpy(p, ANSI_HIGHLIGHT_RED_ON, strlen(ANSI_HIGHLIGHT_RED_ON));
-                p += strlen(ANSI_HIGHLIGHT_RED_ON);
+                p = stpcpy(p, ANSI_HIGHLIGHT_RED_ON);
                 *p++ = '*';
         }
 
-        memcpy(p, ANSI_HIGHLIGHT_OFF, strlen(ANSI_HIGHLIGHT_OFF));
-        p += strlen(ANSI_HIGHLIGHT_OFF);
+        p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
 
         if (pos < width) {
-                memcpy(p, ANSI_RED_ON, strlen(ANSI_RED_ON));
-                p += strlen(ANSI_RED_ON);
+                p = stpcpy(p, ANSI_RED_ON);
                 *p++ = '*';
-                if (pos < width-1) {
-                        memset(p, ' ', width-1-pos);
-                        p += width-1-pos;
-                }
-                memcpy(p, ANSI_HIGHLIGHT_OFF, strlen(ANSI_HIGHLIGHT_OFF));
-                p += strlen(ANSI_HIGHLIGHT_OFF);
+                if (pos < width-1)
+                        p = mempset(p, ' ', width-1-pos);
+                p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
         }
-        *p = 0;
 }
 
 static void manager_print_jobs_in_progress(Manager *m) {