]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - attribute.c
interactive: Add producer to struct i9e_client_info.
[paraslash.git] / attribute.c
index edf3baf51fa376708785eaa014f321eaff827aa4..638e22ea70fe5e5bb5ebac55f0e296db387adc5c 100644 (file)
@@ -154,6 +154,7 @@ static void com_lsatt_callback(int fd, const struct osl_object *query)
                        .max_size = shm_get_shmmax(),
                        .private_data = &(struct afs_max_size_handler_data) {
                                .fd = fd,
+                               .band = SBD_OUTPUT
                        },
                        .max_size_handler = afs_max_size_handler
                }
@@ -175,7 +176,7 @@ static void com_lsatt_callback(int fd, const struct osl_object *query)
                pmd.pm_flags |= PM_REVERSE_LOOP;
        for_each_matching_row(&pmd);
        if (laad.pb.offset)
-               pass_buffer_as_shm(laad.pb.buf, laad.pb.offset, &fd);
+               pass_buffer_as_shm(fd, SBD_OUTPUT, laad.pb.buf, laad.pb.offset);
        free(laad.pb.buf);
 }
 
@@ -208,11 +209,13 @@ int com_lsatt(struct command_context *cc)
        }
        ret = send_option_arg_callback_request(&options, cc->argc - i, cc->argv + i,
                com_lsatt_callback, afs_cb_result_handler, cc);
-       if (!ret) {
-               if (cc->argc > 1)
-                       ret = sc_send_va_buffer(&cc->scc, "no matches\n");
-       } else if (ret < 0)
-               sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));
+       if (ret < 0)
+               send_strerror(cc, -ret);
+       else if (ret == 0 && cc->argc > 1)
+               ret = cc->use_sideband?
+                       send_sb_va(&cc->scc, SBD_ERROR_LOG, "no matches\n")
+               :
+                       sc_send_va_buffer(&cc->scc, "no matches\n");
        return ret;
 }
 
@@ -302,6 +305,7 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
                .max_size = shm_get_shmmax(),
                .private_data = &(struct afs_max_size_handler_data) {
                        .fd = fd,
+                       .band = SBD_OUTPUT
                },
                .max_size_handler = afs_max_size_handler
        };
@@ -359,7 +363,7 @@ out:
        if (ret < 0 && ret2 >= 0)
                para_printf(&pb, "%s: %s\n", p, para_strerror(-ret));
        if (pb.offset)
-               pass_buffer_as_shm(pb.buf, pb.offset, &fd);
+               pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
        free(pb.buf);
 }
 
@@ -372,7 +376,7 @@ int com_addatt(struct command_context *cc)
        ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1,
                com_addatt_callback, afs_cb_result_handler, cc);
        if (ret < 0)
-               sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));
+               send_strerror(cc, -ret);
        return ret;
 }
 
@@ -387,6 +391,7 @@ static void com_mvatt_callback(int fd, const struct osl_object *query)
                .max_size = shm_get_shmmax(),
                .private_data = &(struct afs_max_size_handler_data) {
                        .fd = fd,
+                       .band = SBD_OUTPUT
                },
                .max_size_handler = afs_max_size_handler,
        };
@@ -404,7 +409,7 @@ out:
        else
                afs_event(ATTRIBUTE_RENAME, &pb, NULL);
        if (pb.offset)
-               pass_buffer_as_shm(pb.buf, pb.offset, &fd);
+               pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
        free(pb.buf);
 }
 
@@ -417,7 +422,7 @@ int com_mvatt(struct command_context *cc)
        ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1,
                com_mvatt_callback, afs_cb_result_handler, cc);
        if (ret < 0)
-               sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));
+               send_strerror(cc, -ret);
        return ret;
 }
 
@@ -459,6 +464,7 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
                        .max_size = shm_get_shmmax(),
                        .private_data = &(struct afs_max_size_handler_data) {
                                .fd = fd,
+                               .band = SBD_OUTPUT
                        },
                        .max_size_handler = afs_max_size_handler,
                }
@@ -478,7 +484,7 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
        else if (!raad.num_removed)
                ret2 = para_printf(&raad.pb, "no match -- nothing removed\n");
        if (ret2 >= 0 && raad.pb.offset)
-               pass_buffer_as_shm(raad.pb.buf, raad.pb.offset, &fd);
+               pass_buffer_as_shm(fd, SBD_OUTPUT, raad.pb.buf, raad.pb.offset);
        free(raad.pb.buf);
 }
 
@@ -491,7 +497,7 @@ int com_rmatt(struct command_context *cc)
        ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1,
                com_rmatt_callback, afs_cb_result_handler, cc);
        if (ret < 0)
-               sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));
+               send_strerror(cc, -ret);
        return ret;
 }