]> git.meshlink.io Git - utcp/commitdiff
Don't use ?: without the middle argument.
authorGuus Sliepen <guus@meshlink.io>
Thu, 29 Oct 2015 15:31:17 +0000 (16:31 +0100)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 10:05:42 +0000 (12:05 +0200)
test.c

diff --git a/test.c b/test.c
index 3491e296c9a558a6b587d63cec23702f65ec4b21..d138fd60bc168adf713ed4c068b18d0f92abf29a 100644 (file)
--- a/test.c
+++ b/test.c
@@ -25,7 +25,7 @@ long outpktno;
 long dropfrom;
 long dropto;
 double reorder;
-long reorder_dist;
+long reorder_dist = 10;
 double dropin;
 double dropout;
 long total_out;
@@ -110,12 +110,12 @@ int main(int argc, char *argv[]) {
        bool server = argc == 2;
        bool connected = false;
 
-       dropin = atof(getenv("DROPIN") ?: "0");
-       dropout = atof(getenv("DROPOUT") ?: "0");
-       dropfrom = atoi(getenv("DROPFROM") ?: "0");
-       dropto = atoi(getenv("DROPTO") ?: "0");
-       reorder = atof(getenv("REORDER") ?: "0");
-       reorder_dist = atoi(getenv("REORDER_DIST") ?: "10");
+       if(getenv("DROPIN")) dropin = atof(getenv("DROPIN"));
+       if(getenv("DROPOUT")) dropout = atof(getenv("DROPOUT"));
+       if(getenv("DROPFROM")) dropfrom = atoi(getenv("DROPFROM"));
+       if(getenv("DROPTO")) dropto = atoi(getenv("DROPTO"));
+       if(getenv("REORDER")) reorder = atof(getenv("REORDER"));
+       if(getenv("REORDER_DIST")) reorder_dist = atoi(getenv("REORDER_DIST"));
 
        if(dropto < dropfrom)
                dropto = 1 << 30;