Code cleanup

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-07-20 08:19:55 +00:00
parent 67ea65b1a8
commit 0528adcfe2
5 changed files with 11 additions and 8 deletions

View File

@@ -143,7 +143,7 @@ ctl_connect(const char *dir, const char *file)
if (file) {
closedir(dp);
return -3;
return CTL_ERROR_MANY;
}
file = &d->d_name[0];
@@ -151,7 +151,7 @@ ctl_connect(const char *dir, const char *file)
if (!file) {
closedir(dp);
return -2;
return CTL_ERROR_NONE;
}
}

View File

@@ -4,6 +4,9 @@
#include <sys/socket.h>
#define CTL_ERROR_NONE (-2)
#define CTL_ERROR_MANY (-3)
enum ctl_type {
CTL_NONE = 0,
CTL_STATE,

View File

@@ -141,10 +141,10 @@ gt_path(int argc, char **argv)
case -1:
perror("path");
break;
case -2:
case CTL_ERROR_NONE:
gt_log("no device\n");
break;
case -3:
case CTL_ERROR_MANY:
gt_log("please choose a device\n");
break;
default:

View File

@@ -134,10 +134,10 @@ gt_set(int argc, char **argv)
case -1:
perror("set");
break;
case -2:
case CTL_ERROR_NONE:
gt_log("no device\n");
break;
case -3:
case CTL_ERROR_MANY:
gt_log("please choose a device\n");
break;
default:

View File

@@ -94,10 +94,10 @@ gt_show(int argc, char **argv)
case -1:
perror("show");
break;
case -2:
case CTL_ERROR_NONE:
gt_log("no device\n");
break;
case -3:
case CTL_ERROR_MANY:
gt_log("please choose a device\n");
break;
default: