svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Sun Sep 10 18:26:51 UTC 2006


Author: vda
Date: 2006-09-10 11:26:51 -0700 (Sun, 10 Sep 2006)
New Revision: 16092

Log:
ipcs: silly trick with strings. saves ~200 bytes.


Modified:
   trunk/busybox/util-linux/ipcs.c
   trunk/busybox/util-linux/pivot_root.c


Changeset:
Modified: trunk/busybox/util-linux/ipcs.c
===================================================================
--- trunk/busybox/util-linux/ipcs.c	2006-09-10 06:10:52 UTC (rev 16091)
+++ trunk/busybox/util-linux/ipcs.c	2006-09-10 18:26:51 UTC (rev 16092)
@@ -136,13 +136,13 @@
 
 	maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info);
 	if (maxid < 0) {
-		bb_printf("kernel not configured for shared memory\n");
+		bb_printf("kernel not configured for %s\n", "shared memory");
 		return;
 	}
 
 	switch (format) {
 	case LIMITS:
-		bb_printf("------ Shared Memory Limits --------\n");
+		bb_printf("------ Shared Memory %s --------\n", "Limits");
 		if ((shmctl(0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0)
 			return;
 		/* glibc 2.1.3 and all earlier libc's have ints as fields
@@ -158,12 +158,12 @@
 		return;
 
 	case STATUS:
-		bb_printf("------ Shared Memory Status --------\n"
-				  "segments allocated %d\n"
+		bb_printf("------ Shared Memory %s --------\n", "Status");
+		bb_printf(	  "segments allocated %d\n"
 				  "pages allocated %ld\n"
 				  "pages resident  %ld\n"
 				  "pages swapped   %ld\n"
-				  "Swap performance: %ld attempts\t %ld successes\n",
+				  "Swap performance: %ld attempts\t%ld successes\n",
 				  shm_info.used_ids,
 				  shm_info.shm_tot,
 				  shm_info.shm_rss,
@@ -172,26 +172,26 @@
 		return;
 
 	case CREATOR:
-		bb_printf("------ Shared Memory Segment Creators/Owners --------\n"
-				  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Shared Memory %s --------\n", "Segment Creators/Owners");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
 				  "shmid", "perms", "cuid", "cgid", "uid", "gid");
 		break;
 
 	case TIME:
-		bb_printf("------ Shared Memory Attach/Detach/Change Times --------\n"
-				  "%-10s %-10s %-20s %-20s %-20s\n",
+		bb_printf("------ Shared Memory %s --------\n", "Attach/Detach/Change Times");
+		bb_printf(	  "%-10s %-10s %-20s %-20s %-20s\n",
 				  "shmid", "owner", "attached", "detached", "changed");
 		break;
 
 	case PID:
-		bb_printf("------ Shared Memory Creator/Last-op --------\n"
-				  "%-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Shared Memory %s --------\n", "Creator/Last-op");
+		bb_printf(	  "%-10s %-10s %-10s %-10s\n",
 				  "shmid", "owner", "cpid", "lpid");
 		break;
 
 	default:
-		bb_printf("------ Shared Memory Segments --------\n"
-				  "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
+		bb_printf("------ Shared Memory %s --------\n", "Segments");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
 				  "key", "shmid", "owner", "perms", "bytes", "nattch",
 				  "status");
 		break;
@@ -264,13 +264,13 @@
 	arg.array = (ushort *) (void *) &seminfo;
 	maxid = semctl(0, 0, SEM_INFO, arg);
 	if (maxid < 0) {
-		bb_printf("kernel not configured for semaphores\n");
+		bb_printf("kernel not configured for %s\n", "semaphores");
 		return;
 	}
 
 	switch (format) {
 	case LIMITS:
-		bb_printf("------ Semaphore Limits --------\n");
+		bb_printf("------ Semaphore %s --------\n", "Limits");
 		arg.array = (ushort *) (void *) &seminfo;	/* damn union */
 		if ((semctl(0, 0, IPC_INFO, arg)) < 0)
 			return;
@@ -285,21 +285,21 @@
 		return;
 
 	case STATUS:
-		bb_printf("------ Semaphore Status --------\n"
-				  "used arrays = %d\n"
+		bb_printf("------ Semaphore %s --------\n", "Status");
+		bb_printf(	  "used arrays = %d\n"
 				  "allocated semaphores = %d\n",
 				  seminfo.semusz, seminfo.semaem);
 		return;
 
 	case CREATOR:
-		bb_printf("------ Semaphore Arrays Creators/Owners --------\n"
-				  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Semaphore %s --------\n", "Arrays Creators/Owners");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
 				  "semid", "perms", "cuid", "cgid", "uid", "gid");
 		break;
 
 	case TIME:
-		bb_printf("------ Shared Memory Operation/Change Times --------\n"
-				  "%-8s %-10s %-26.24s %-26.24s\n",
+		bb_printf("------ Shared Memory %s --------\n", "Operation/Change Times");
+		bb_printf(	  "%-8s %-10s %-26.24s %-26.24s\n",
 				  "shmid", "owner", "last-op", "last-changed");
 		break;
 
@@ -307,8 +307,8 @@
 		break;
 
 	default:
-		bb_printf("------ Semaphore Arrays --------\n"
-				  "%-10s %-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Semaphore %s --------\n", "Arrays");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-10s\n",
 				  "key", "semid", "owner", "perms", "nsems");
 		break;
 	}
@@ -368,7 +368,7 @@
 
 	maxid = msgctl(0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo);
 	if (maxid < 0) {
-		bb_printf("kernel not configured for message queues\n");
+		bb_printf("kernel not configured for %s\n", "message queues");
 		return;
 	}
 
@@ -376,42 +376,42 @@
 	case LIMITS:
 		if ((msgctl(0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0)
 			return;
-		bb_printf("------ Messages: Limits --------\n"
-				  "max queues system wide = %d\n"
+		bb_printf("------ Message%s --------\n", "s: Limits");
+		bb_printf(	  "max queues system wide = %d\n"
 				  "max size of message (bytes) = %d\n"
 				  "default max size of queue (bytes) = %d\n",
 				  msginfo.msgmni, msginfo.msgmax, msginfo.msgmnb);
 		return;
 
 	case STATUS:
-		bb_printf("------ Messages: Status --------\n"
-				  "allocated queues = %d\n"
+		bb_printf("------ Message%s --------\n", "s: Status");
+		bb_printf(	  "allocated queues = %d\n"
 				  "used headers = %d\n"
 				  "used space = %d bytes\n",
 				  msginfo.msgpool, msginfo.msgmap, msginfo.msgtql);
 		return;
 
 	case CREATOR:
-		bb_printf("------ Message Queues: Creators/Owners --------\n"
-				  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Message%s --------\n", " Queues: Creators/Owners");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-10s %-10s\n",
 				  "msqid", "perms", "cuid", "cgid", "uid", "gid");
 		break;
 
 	case TIME:
-		bb_printf("------ Message Queues Send/Recv/Change Times --------\n"
-				  "%-8s %-10s %-20s %-20s %-20s\n",
+		bb_printf("------ Message%s --------\n", " Queues Send/Recv/Change Times");
+		bb_printf(	  "%-8s %-10s %-20s %-20s %-20s\n",
 				  "msqid", "owner", "send", "recv", "change");
 		break;
 
 	case PID:
-		bb_printf("------ Message Queues PIDs --------\n"
-				  "%-10s %-10s %-10s %-10s\n",
+		bb_printf("------ Message%s --------\n", " Queues PIDs");
+		bb_printf(	  "%-10s %-10s %-10s %-10s\n",
 				  "msqid", "owner", "lspid", "lrpid");
 		break;
 
 	default:
-		bb_printf("------ Message Queues --------\n"
-				  "%-10s %-10s %-10s %-10s %-12s %-12s\n",
+		bb_printf("------ Message%s --------\n", " Queues");
+		bb_printf(	  "%-10s %-10s %-10s %-10s %-12s %-12s\n",
 				  "key", "msqid", "owner", "perms", "used-bytes", "messages");
 		break;
 	}

Modified: trunk/busybox/util-linux/pivot_root.c
===================================================================
--- trunk/busybox/util-linux/pivot_root.c	2006-09-10 06:10:52 UTC (rev 16091)
+++ trunk/busybox/util-linux/pivot_root.c	2006-09-10 18:26:51 UTC (rev 16092)
@@ -17,12 +17,11 @@
 
 int pivot_root_main(int argc, char **argv)
 {
-    if (argc != 3)
-	bb_show_usage();
+	if (argc != 3)
+		bb_show_usage();
 
 	if (pivot_root(argv[1],argv[2]) < 0)
 		bb_perror_msg_and_die("pivot_root");
 
-    return EXIT_SUCCESS;
-
+	return EXIT_SUCCESS;
 }




More information about the busybox-cvs mailing list