This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new ad3f44b  Change match to fnmatch
ad3f44b is described below

commit ad3f44bc779bcefb06e3c8ce977b7d242bfac6cc
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun Aug 1 23:20:18 2021 +0800

    Change match to fnmatch
    
    follow the kernel side change
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 netutils/thttpd/cgi-src/ssi.c |  7 +++----
 netutils/thttpd/libhttpd.c    | 12 ++++++------
 system/trace/trace.c          |  4 ++--
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/netutils/thttpd/cgi-src/ssi.c b/netutils/thttpd/cgi-src/ssi.c
index bad3fb3..7104af2 100644
--- a/netutils/thttpd/cgi-src/ssi.c
+++ b/netutils/thttpd/cgi-src/ssi.c
@@ -7,7 +7,7 @@
  *
  * Derived from the file of the same name in the original THTTPD package:
  *
- *   Copyright � 1995 by Jef Poskanzer <[email protected]>.
+ *   Copyright 1995 by Jef Poskanzer <[email protected]>.
  *   All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,8 +46,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-
-#include <nuttx/lib/regex.h>
+#include <fnmatch.h>
 
 #include "config.h"
 
@@ -339,7 +338,7 @@ static int check_filename(char *filename)
 
   /* Ensure that we are not reading a CGI file. */
 
-  if (cgi_pattern != (char *)0 && match(cgi_pattern, filename))
+  if (cgi_pattern != (char *)0 && !fnmatch(cgi_pattern, filename, 0))
     {
       return 0;
     }
diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index 1c72d0d..015b4a3 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -7,7 +7,7 @@
  *
  * Derived from the file of the same name in the original THTTPD package:
  *
- *   Copyright � 1995,1998,1999,2000,2001 by Jef Poskanzer 
<[email protected]>.
+ *   Copyright 1995,1998,1999,2000,2001 by Jef Poskanzer <[email protected]>.
  *   All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,8 +59,8 @@
 #include <sched.h>
 #include <errno.h>
 #include <debug.h>
+#include <fnmatch.h>
 
-#include <nuttx/lib/regex.h>
 #include "netutils/thttpd.h"
 
 #include "config.h"
@@ -436,7 +436,7 @@ static void send_response(httpd_conn *hc, int status, const 
char *title, const c
   snprintf(buf, sizeof(buf), form, defanged);
   add_response(hc, buf);
 
-  if (match("**MSIE**", hc->useragent))
+  if (!fnmatch("**MSIE**", hc->useragent, 0))
     {
       int n;
       add_response(hc, "<!--\n");
@@ -1960,7 +1960,7 @@ static int really_check_referer(httpd_conn *hc)
     {
       /* Disallow if the url matches. */
 
-      if (match(CONFIG_THTTPD_URLPATTERN, hc->origfilename))
+      if (!fnmatch(CONFIG_THTTPD_URLPATTERN, hc->origfilename, 0))
         {
           return 0;
         }
@@ -2030,7 +2030,7 @@ static int really_check_referer(httpd_conn *hc)
    * filename does match the url pattern, it's an illegal reference.
    */
 
-  if (!match(lp, refhost) && match(CONFIG_THTTPD_URLPATTERN, hc->origfilename))
+  if (fnmatch(lp, refhost, 0) && !fnmatch(CONFIG_THTTPD_URLPATTERN, 
hc->origfilename, 0))
     {
       return 0;
     }
@@ -3352,7 +3352,7 @@ int httpd_start_request(httpd_conn *hc, struct timeval 
*nowP)
   /* Is it in the CGI area? */
 
 #ifdef CONFIG_THTTPD_CGI_PATTERN
-  if (match(CONFIG_THTTPD_CGI_PATTERN, hc->expnfilename))
+  if (!fnmatch(CONFIG_THTTPD_CGI_PATTERN, hc->expnfilename, 0))
     {
       return cgi(hc);
     }
diff --git a/system/trace/trace.c b/system/trace/trace.c
index ed9db32..c7f9d7f 100644
--- a/system/trace/trace.c
+++ b/system/trace/trace.c
@@ -30,8 +30,8 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <fnmatch.h>
 #include <sys/ioctl.h>
-#include <nuttx/lib/regex.h>
 #include <nuttx/note/notectl_driver.h>
 
 #include "trace.h"
@@ -473,7 +473,7 @@ static int trace_cmd_syscall(int index, int argc, FAR char 
**argv,
 
       for (syscallno = 0; syscallno < SYS_nsyscalls; syscallno++)
         {
-          if (!match(&argv[index][1], g_funcnames[syscallno]))
+          if (fnmatch(&argv[index][1], g_funcnames[syscallno], 0))
             {
               continue;
             }

Reply via email to