[hackers] [sbase] Chop one level of indentation || sin

From: <git_AT_suckless.org>
Date: Mon, 05 May 2014 16:12:24 +0200

commit 9694305e05c1de0d0f0c903d6fbd6d9c52c78aa5
Author: sin <sin_AT_2f30.org>
Date: Mon May 5 15:07:55 2014 +0100

    Chop one level of indentation
    
    eprintf() will exit the program, no need to use the else construct.

diff --git a/util/cp.c b/util/cp.c
index 33853ad..4e06ddc 100644
--- a/util/cp.c
+++ b/util/cp.c
_AT_@ -28,36 +28,37 @@ cp(const char *s1, const char *s2)
         if (stat(s1, &st) == 0 && S_ISDIR(st.st_mode)) {
                 if (!cp_rflag) {
                         eprintf("%s: is a directory
", s1);
- } else {
- if(!(dp = opendir(s1)))
- eprintf("opendir %s:", s1);
+ }
 
- if (mkdir(s2, st.st_mode) == -1 && errno != EEXIST)
- eprintf("mkdir %s:", s2);
+ if(!(dp = opendir(s1)))
+ eprintf("opendir %s:", s1);
 
- apathmax(&ns1, &size1);
- apathmax(&ns2, &size2);
- while((d = readdir(dp))) {
- if(strcmp(d->d_name, ".")
- && strcmp(d->d_name, "..")) {
- if(snprintf(ns1, size1, "%s/%s", s1,
- d->d_name) >= size1) {
- eprintf("%s/%s: filename too long
",
- s1, d->d_name);
- }
+ if (mkdir(s2, st.st_mode) == -1 && errno != EEXIST)
+ eprintf("mkdir %s:", s2);
 
- if(snprintf(ns2, size2, "%s/%s", s2,
- d->d_name) >= size2) {
- eprintf("%s/%s: filename too long
",
- s2, d->d_name);
- }
- fnck(ns1, ns2, cp);
+ apathmax(&ns1, &size1);
+ apathmax(&ns2, &size2);
+ while((d = readdir(dp))) {
+ if(strcmp(d->d_name, ".")
+ && strcmp(d->d_name, "..")) {
+ if(snprintf(ns1, size1, "%s/%s", s1,
+ d->d_name) >= size1) {
+ eprintf("%s/%s: filename too long
",
+ s1, d->d_name);
                                 }
+
+ if(snprintf(ns2, size2, "%s/%s", s2,
+ d->d_name) >= size2) {
+ eprintf("%s/%s: filename too long
",
+ s2, d->d_name);
+ }
+ fnck(ns1, ns2, cp);
                         }
- closedir(dp);
- free(ns1);
- free(ns2);
                 }
+
+ closedir(dp);
+ free(ns1);
+ free(ns2);
                 return 0;
         }
         if(!(f1 = fopen(s1, "r")))
Received on Mon May 05 2014 - 16:12:24 CEST

This archive was generated by hypermail 2.3.0 : Mon May 05 2014 - 16:24:08 CEST