diff options
author | anonimal <anonimal@i2pmail.org> | 2018-04-19 06:28:55 +0000 |
---|---|---|
committer | anonimal <anonimal@i2pmail.org> | 2018-04-19 10:55:29 +0000 |
commit | 10685648677d9df6230b6b60a580f2ba8481d0a0 (patch) | |
tree | 25b33ba309f38f03b27c862d48bf49a8ebb9b853 /external/miniupnpc/testupnpreplyparse.c | |
parent | Merge pull request #3606 (diff) | |
download | monero-10685648677d9df6230b6b60a580f2ba8481d0a0.tar.xz |
Build: remove in-tree miniupnpc
Will be replaced by a submodule.
(cherry picked from commit e962216678e699a8fc7eb271a8a515f5ca65f7cb)
Diffstat (limited to 'external/miniupnpc/testupnpreplyparse.c')
-rw-r--r-- | external/miniupnpc/testupnpreplyparse.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/external/miniupnpc/testupnpreplyparse.c b/external/miniupnpc/testupnpreplyparse.c deleted file mode 100644 index 7ba7131ea..000000000 --- a/external/miniupnpc/testupnpreplyparse.c +++ /dev/null @@ -1,96 +0,0 @@ -/* $Id: testupnpreplyparse.c,v 1.4 2014/01/27 11:45:19 nanard Exp $ */ -/* MiniUPnP project - * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2014 Thomas Bernard - * This software is subject to the conditions detailed - * in the LICENCE file provided within the distribution */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include "upnpreplyparse.h" - -int -test_parsing(const char * buf, int len, FILE * f) -{ - char line[1024]; - struct NameValueParserData pdata; - int ok = 1; - ParseNameValue(buf, len, &pdata); - /* check result */ - if(f != NULL) - { - while(fgets(line, sizeof(line), f)) - { - char * value; - char * equal; - char * parsedvalue; - int l; - l = strlen(line); - while((l > 0) && ((line[l-1] == '\r') || (line[l-1] == '\n'))) - line[--l] = '\0'; - /* skip empty lines */ - if(l == 0) - continue; - equal = strchr(line, '='); - if(equal == NULL) - { - fprintf(stderr, "Warning, line does not contain '=' : %s\n", line); - continue; - } - *equal = '\0'; - value = equal + 1; - parsedvalue = GetValueFromNameValueList(&pdata, line); - if((parsedvalue == NULL) || (strcmp(parsedvalue, value) != 0)) - { - fprintf(stderr, "Element <%s> : expecting value '%s', got '%s'\n", - line, value, parsedvalue ? parsedvalue : "<null string>"); - ok = 0; - } - } - } - ClearNameValueList(&pdata); - return ok; -} - -int main(int argc, char * * argv) -{ - FILE * f; - char buffer[4096]; - int l; - int ok; - - if(argc<2) - { - fprintf(stderr, "Usage: %s file.xml [file.namevalues]\n", argv[0]); - return 1; - } - f = fopen(argv[1], "r"); - if(!f) - { - fprintf(stderr, "Error : can not open file %s\n", argv[1]); - return 2; - } - l = fread(buffer, 1, sizeof(buffer)-1, f); - fclose(f); - f = NULL; - buffer[l] = '\0'; - if(argc > 2) - { - f = fopen(argv[2], "r"); - if(!f) - { - fprintf(stderr, "Error : can not open file %s\n", argv[2]); - return 2; - } - } -#ifdef DEBUG - DisplayNameValueList(buffer, l); -#endif - ok = test_parsing(buffer, l, f); - if(f) - { - fclose(f); - } - return ok ? 0 : 3; -} - |