X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=attribute.c;h=19700944dff7c266db4c78a78e73eb79fda37713;hp=f36f4e7d91f7aae22fe9e039dd86ce30e0f3538b;hb=f0e41e36c3f1a3a5bb6ff66d92d2814391d8f908;hpb=b307a25ed895caa33684302b502e9e0e70dc78b7 diff --git a/attribute.c b/attribute.c index f36f4e7d..19700944 100644 --- a/attribute.c +++ b/attribute.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2011 Andre Noll + * Copyright (C) 1997-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -16,6 +16,7 @@ #include "afh.h" #include "afs.h" #include "ipc.h" +#include "command.h" static struct osl_table *attribute_table; static int greatest_att_bitnum; @@ -175,14 +176,14 @@ static void com_lsatt_callback(int fd, const struct osl_object *query) free(laad.pb.buf); } -int com_lsatt(struct stream_cipher_context *scc, int argc, char * const * const argv) +int com_lsatt(struct command_context *cc) { unsigned flags = 0; struct osl_object options = {.data = &flags, .size = sizeof(flags)}; int ret, i; - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; + for (i = 1; i < cc->argc; i++) { + const char *arg = cc->argv[i]; if (arg[0] != '-') break; if (!strcmp(arg, "--")) { @@ -202,13 +203,13 @@ int com_lsatt(struct stream_cipher_context *scc, int argc, char * const * const continue; } } - ret = send_option_arg_callback_request(&options, argc - i, argv + i, - com_lsatt_callback, sc_send_result, scc); + ret = send_option_arg_callback_request(&options, cc->argc - i, cc->argv + i, + com_lsatt_callback, sc_send_result, cc); if (!ret) { - if (argc > 1) - ret = sc_send_va_buffer(scc, "no matches\n"); + if (cc->argc > 1) + ret = sc_send_va_buffer(&cc->scc, "no matches\n"); } else if (ret < 0) - sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); + sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret)); return ret; } @@ -276,12 +277,12 @@ out: PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); } -int com_setatt(__a_unused struct stream_cipher_context *scc, int argc, char * const * const argv) +int com_setatt(struct command_context *cc) { - if (argc < 3) + if (cc->argc < 3) return -E_ATTR_SYNTAX; - return send_standard_callback_request(argc - 1, argv + 1, com_setatt_callback, - NULL, NULL); + return send_standard_callback_request(cc->argc - 1, cc->argv + 1, + com_setatt_callback, NULL, NULL); } struct addatt_event_data { @@ -357,16 +358,16 @@ out: free(pb.buf); } -int com_addatt(struct stream_cipher_context *scc, int argc, char * const * const argv) +int com_addatt(struct command_context *cc) { int ret; - if (argc < 2) + if (cc->argc < 2) return -E_ATTR_SYNTAX; - ret = send_standard_callback_request(argc - 1, argv + 1, com_addatt_callback, - sc_send_result, scc); + ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1, + com_addatt_callback, sc_send_result, cc); if (ret < 0) - sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); + sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret)); return ret; } @@ -400,16 +401,16 @@ out: free(pb.buf); } -int com_mvatt(struct stream_cipher_context *scc, int argc, char * const * const argv) +int com_mvatt(struct command_context *cc) { int ret; - if (argc != 3) + if (cc->argc != 3) return -E_ATTR_SYNTAX; - ret = send_standard_callback_request(argc - 1, argv + 1, com_mvatt_callback, - sc_send_result, scc); + ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1, + com_mvatt_callback, sc_send_result, cc); if (ret < 0) - sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); + sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret)); return ret; } @@ -472,16 +473,16 @@ static void com_rmatt_callback(int fd, const struct osl_object *query) free(raad.pb.buf); } -int com_rmatt(struct stream_cipher_context *scc, int argc, char * const * const argv) +int com_rmatt(struct command_context *cc) { int ret; - if (argc < 2) + if (cc->argc < 2) return -E_ATTR_SYNTAX; - ret = send_standard_callback_request(argc - 1, argv + 1, com_rmatt_callback, - sc_send_result, scc); + ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1, + com_rmatt_callback, sc_send_result, cc); if (ret < 0) - sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); + sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret)); return ret; }