aboutsummaryrefslogtreecommitdiff
path: root/src/command.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.h')
-rw-r--r--src/command.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/command.h b/src/command.h
index 3aad04dc..8e2b9071 100644
--- a/src/command.h
+++ b/src/command.h
@@ -29,6 +29,9 @@
#define COMMAND_RETURN_KILL 10
#define COMMAND_RETURN_CLOSE 20
+extern char * current_command;
+extern int command_listNum;
+
int proccessListOfCommands(FILE * fp, int * permission, int * expired,
List * list);
@@ -40,6 +43,18 @@ void finishCommands();
#define commandSuccess(fp) myfprintf(fp, "OK\n")
-#define commandError(fp, format, ... ) myfprintf(fp, "ACK " format "\n", ##__VA_ARGS__)
+#define commandError(fp, format, ... ) \
+ {\
+ if(current_command) { \
+ myfprintf(fp, "ACK [%s:%i] " format "\n", \
+ current_command, command_listNum, \
+ ##__VA_ARGS__); \
+ current_command = NULL; \
+ } \
+ else { \
+ myfprintf(fp, "ACK [:%i] " format "\n", \
+ command_listNum, ##__VA_ARGS__); \
+ } \
+ }
#endif