[PATCH] gen_init_cpio: Revised the use of space and tabs

From: 13145886936
Date: Thu Jun 03 2021 - 23:12:06 EST


From: gushengxian <gushengxian@xxxxxxxxxx>

Revised the use of space and tabs.

Signed-off-by: gushengxian <gushengxian@xxxxxxxxxx>
---
usr/gen_init_cpio.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 03b21189d58b..6c28a0938a5e 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -107,7 +107,7 @@ static int cpio_mkslink(const char *name, const char *target,

if (name[0] == '/')
name++;
- sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+ sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
ino++, /* ino */
@@ -156,7 +156,7 @@ static int cpio_mkgeneric(const char *name, unsigned int mode,

if (name[0] == '/')
name++;
- sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+ sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
ino++, /* ino */
@@ -250,7 +250,7 @@ static int cpio_mknod(const char *name, unsigned int mode,

if (name[0] == '/')
name++;
- sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+ sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX"
"%08X%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
ino++, /* ino */
@@ -335,12 +335,13 @@ static int cpio_mkfile(const char *name, const char *location,
size = 0;
for (i = 1; i <= nlinks; i++) {
/* data goes on last link */
- if (i == nlinks) size = buf.st_size;
+ if (i == nlinks)
+ size = buf.st_size;

if (name[0] == '/')
name++;
namesize = strlen(name) + 1;
- sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+ sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX"
"%08lX%08X%08X%08X%08X%08X%08X",
"070701", /* magic */
ino, /* ino */
@@ -373,10 +374,12 @@ static int cpio_mkfile(const char *name, const char *location,
}
ino++;
rc = 0;
-
+
error:
- if (filebuf) free(filebuf);
- if (file >= 0) close(file);
+ if (filebuf)
+ free(filebuf);
+ if (file >= 0)
+ close(file);
return rc;
}

@@ -443,9 +446,10 @@ static int cpio_mkfile_line(const char *line)
dname = name;
}
rc = cpio_mkfile(dname, cpio_replace_env(location),
- mode, uid, gid, nlinks);
+ mode, uid, gid, nlinks);
fail:
- if (dname_len) free(dname);
+ if (dname_len)
+ free(dname);
return rc;
}

@@ -603,7 +607,7 @@ int main (int argc, char *argv[])

for (type_idx = 0; file_handler_table[type_idx].type; type_idx++) {
int rc;
- if (! strcmp(line, file_handler_table[type_idx].type)) {
+ if (!strcmp(line, file_handler_table[type_idx].type)) {
if ((rc = file_handler_table[type_idx].handler(args))) {
ec = rc;
fprintf(stderr, " line %d\n", line_nr);
--
2.25.1