return -E_AFT_SYNTAX;
ret = send_option_arg_callback_request(&query, argc - i,
argv + i, com_touch_callback, &result);
- if (ret > 0) {
- send_buffer(fd, (char *)result.data);
- free(result.data);
- } else if (ret < 0)
+ if (!ret)
+ return 0;
+ if (ret < 0) {
send_va_buffer(fd, "%s\n", para_strerror(-ret));
+ return ret;
+ }
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}
return -E_AFT_SYNTAX;
ret = send_option_arg_callback_request(&query, argc - i, argv + i,
com_rm_callback, &result);
- if (ret > 0) {
- send_buffer(fd, (char *)result.data);
- free(result.data);
- } else if (ret < 0)
+ if (!ret)
+ return 0;
+ if (ret < 0) {
send_va_buffer(fd, "%s\n", para_strerror(-ret));
+ return ret;
+ }
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}
flags = ~(unsigned)CPSI_FLAG_VERBOSE | flags;
ret = send_option_arg_callback_request(&options, argc - i, argv + i,
com_cpsi_callback, &result);
- if (ret > 0) {
- send_buffer(fd, (char *)result.data);
- free(result.data);
- } else
+ if (!ret)
+ return 0;
+ if (ret < 0) {
send_va_buffer(fd, "%s\n", para_strerror(-ret));
+ return ret;
+ }
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}
}
ret = send_option_arg_callback_request(&options, argc - i, argv + i,
com_lsatt_callback, &result);
- if (ret > 0) {
- ret = send_buffer(fd, (char *)result.data);
- free(result.data);
- } else if (ret < 0)
+ if (!ret) {
+ if (argc > 1)
+ ret = send_va_buffer(fd, "no matches\n");
+ return ret;
+ }
+ if (ret < 0) {
send_va_buffer(fd, "%s\n", para_strerror(-ret));
- else if (argc > 1)
- send_va_buffer(fd, "no matches\n");
+ return ret;
+ }
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}
return -E_ATTR_SYNTAX;
ret = send_standard_callback_request(argc - 1, argv + 1, com_rmatt_callback,
&result);
- if (ret > 0) {
- send_buffer(fd, (char *)result.data);
- free(result.data);
- } else
+ if (!ret)
+ return 0;
+ if (ret < 0) {
send_va_buffer(fd, "%s\n", para_strerror(-ret));
+ return ret;
+ }
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}
// return -E_BLOB_SYNTAX;
ret = send_option_arg_callback_request(&options, argc - i,
argv + i, f, &result);
- if (ret > 0) {
- send_buffer(fd, (char *)result.data);
- free(result.data);
+ if (!ret)
+ return 0;
+ if (ret < 0) {
+ send_va_buffer(fd, "%s\n", para_strerror(-ret));
+ return ret;
}
+ ret = send_buffer(fd, (char *)result.data);
+ free(result.data);
return ret;
}