diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-02-24 11:31:20 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-02-24 11:31:20 (GMT) |
commit | b93c8eebc70153866d8c5a6872b6c7c4ccd94860 (patch) | |
tree | 374b194f2d627afe40510190928f4bc1f2443ec0 | |
parent | 0e3fa54782f8cbb47af058c4bf13688e8b23865b (diff) | |
download | monitoring-plugins-b93c8eebc70153866d8c5a6872b6c7c4ccd94860.tar.gz |
Cosmetic change
Replace all occurrences of "strstr(s, "c") == s" with "s[0] == 'c'".
-rw-r--r-- | plugins/check_snmp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 6c90909..4cd3805 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -740,7 +740,7 @@ process_arguments (int argc, char **argv) | |||
740 | labels[nlabels - 1] = optarg; | 740 | labels[nlabels - 1] = optarg; |
741 | ptr = thisarg (optarg); | 741 | ptr = thisarg (optarg); |
742 | labels[nlabels - 1] = ptr; | 742 | labels[nlabels - 1] = ptr; |
743 | if (strstr (ptr, "'") == ptr) | 743 | if (ptr[0] == '\'') |
744 | labels[nlabels - 1] = ptr + 1; | 744 | labels[nlabels - 1] = ptr + 1; |
745 | while (ptr && (ptr = nextarg (ptr))) { | 745 | while (ptr && (ptr = nextarg (ptr))) { |
746 | if (nlabels >= labels_size) { | 746 | if (nlabels >= labels_size) { |
@@ -751,7 +751,7 @@ process_arguments (int argc, char **argv) | |||
751 | } | 751 | } |
752 | nlabels++; | 752 | nlabels++; |
753 | ptr = thisarg (ptr); | 753 | ptr = thisarg (ptr); |
754 | if (strstr (ptr, "'") == ptr) | 754 | if (ptr[0] == '\'') |
755 | labels[nlabels - 1] = ptr + 1; | 755 | labels[nlabels - 1] = ptr + 1; |
756 | else | 756 | else |
757 | labels[nlabels - 1] = ptr; | 757 | labels[nlabels - 1] = ptr; |
@@ -769,7 +769,7 @@ process_arguments (int argc, char **argv) | |||
769 | unitv[nunits - 1] = optarg; | 769 | unitv[nunits - 1] = optarg; |
770 | ptr = thisarg (optarg); | 770 | ptr = thisarg (optarg); |
771 | unitv[nunits - 1] = ptr; | 771 | unitv[nunits - 1] = ptr; |
772 | if (strstr (ptr, "'") == ptr) | 772 | if (ptr[0] == '\'') |
773 | unitv[nunits - 1] = ptr + 1; | 773 | unitv[nunits - 1] = ptr + 1; |
774 | while (ptr && (ptr = nextarg (ptr))) { | 774 | while (ptr && (ptr = nextarg (ptr))) { |
775 | if (nunits >= unitv_size) { | 775 | if (nunits >= unitv_size) { |
@@ -780,7 +780,7 @@ process_arguments (int argc, char **argv) | |||
780 | } | 780 | } |
781 | nunits++; | 781 | nunits++; |
782 | ptr = thisarg (ptr); | 782 | ptr = thisarg (ptr); |
783 | if (strstr (ptr, "'") == ptr) | 783 | if (ptr[0] == '\'') |
784 | unitv[nunits - 1] = ptr + 1; | 784 | unitv[nunits - 1] = ptr + 1; |
785 | else | 785 | else |
786 | unitv[nunits - 1] = ptr; | 786 | unitv[nunits - 1] = ptr; |
@@ -935,7 +935,7 @@ char * | |||
935 | thisarg (char *str) | 935 | thisarg (char *str) |
936 | { | 936 | { |
937 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | 937 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ |
938 | if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ | 938 | if (str[0] == '\'') { /* handle SIMPLE quoted strings */ |
939 | if (strlen (str) == 1 || !strstr (str + 1, "'")) | 939 | if (strlen (str) == 1 || !strstr (str + 1, "'")) |
940 | die (STATE_UNKNOWN, _("Unbalanced quotes\n")); | 940 | die (STATE_UNKNOWN, _("Unbalanced quotes\n")); |
941 | } | 941 | } |
@@ -951,7 +951,7 @@ thisarg (char *str) | |||
951 | char * | 951 | char * |
952 | nextarg (char *str) | 952 | nextarg (char *str) |
953 | { | 953 | { |
954 | if (strstr (str, "'") == str) { | 954 | if (str[0] == '\'') { |
955 | str[0] = 0; | 955 | str[0] = 0; |
956 | if (strlen (str) > 1) { | 956 | if (strlen (str) > 1) { |
957 | str = strstr (str + 1, "'"); | 957 | str = strstr (str + 1, "'"); |
@@ -961,7 +961,7 @@ nextarg (char *str) | |||
961 | return NULL; | 961 | return NULL; |
962 | } | 962 | } |
963 | } | 963 | } |
964 | if (strstr (str, ",") == str) { | 964 | if (str[0] == ',') { |
965 | str[0] = 0; | 965 | str[0] = 0; |
966 | if (strlen (str) > 1) { | 966 | if (strlen (str) > 1) { |
967 | return (++str); | 967 | return (++str); |