cpio -o -H newc

Denys Vlasenko vda.linux at googlemail.com
Mon Mar 31 02:03:21 UTC 2008


hi Pascal,

On Saturday 29 March 2008 21:25, Pascal Bellard wrote:
> Please find attached a patch-file to add 'cpio -o -H newc' feature.

Patch seems to have rather inconsistent tab/space usage
and occasional broken indentation (or maybe it only looks
wrong when I set tab == 8 spaces...)

               struct inodes_s *inode = xzalloc(sizeof(*inode));
+
+               if (!inode) {
+       abort_cpio_o:
+                       bb_perror_msg_and_die(name);
+               }

xzalloc never returns NULL.

+               if (line) {
+               /* Strip leading `./' from the filename.  */
+               for (name = line; name[0] == '.' && name[1] == '/';) {
+                   while (*++name == '/');
+               }

I find this use of for() to be a bit of excercise in
"how can I use for() for this?". I prefer "how to do it
efficiently, _yet_ not hard to understand?"
In this case:

               name = line;
               while (name[0] == '.' && name[1] == '/') {
                       while (*++name == '/')
                               continue;
               }
--
vda




More information about the busybox mailing list