wok-current diff busybox/stuff/busybox-1.23-ris.u @ rev 18253

Add some lang packages for tesseract-ocr (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Aug 03 16:17:09 2015 +0200 (2015-08-03)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.23-ris.u	Mon Aug 03 16:17:09 2015 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +Add support for the Windows Remote Installation Service
     1.5 +--- busybox-1.23.0/networking/Config.src
     1.6 ++++ busybox-1.23.0/networking/Config.src
     1.7 +@@ -827,6 +827,15 @@
     1.8 + comment "Common options for tftp/tftpd"
     1.9 + 	depends on TFTP || TFTPD
    1.10 + 
    1.11 ++config FEATURE_TFTPD_RIS
    1.12 ++	bool "Enable \"RIS\" support"
    1.13 ++	default y
    1.14 ++	depends on TFTPD
    1.15 ++	help
    1.16 ++	  Add support for the Windows Remote Installation Service. This allows
    1.17 ++	  a client to get files starting with \ without respecting case.
    1.18 ++	  Each \ will be replaced by a /.
    1.19 ++
    1.20 + config FEATURE_TFTP_GET
    1.21 + 	bool "Enable 'tftp get' and/or tftpd upload code"
    1.22 + 	default y
    1.23 +--- busybox-1.23.0/networking/tftp.c
    1.24 ++++ busybox-1.23.0/networking/tftp.c
    1.25 +@@ -673,6 +673,59 @@
    1.26 + #undef remote_file
    1.27 + }
    1.28 + 
    1.29 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.30 ++#include <dirent.h>
    1.31 ++
    1.32 ++static int lookup_entry(const char *search, char *unixpath);
    1.33 ++static void unixfilename(char *filename);
    1.34 ++
    1.35 ++// lookup search and concat real filename to unixpath
    1.36 ++static int lookup_entry(const char *search, char *unixpath)
    1.37 ++{
    1.38 ++ 	int status = 0;
    1.39 ++	DIR *dirp = opendir(unixpath[0] ? unixpath : ".");
    1.40 ++ 
    1.41 ++ 	if (dirp != NULL) {
    1.42 ++		struct dirent *entry;
    1.43 ++
    1.44 ++		while ((entry = readdir(dirp))) {
    1.45 ++			if (!strcasecmp(entry->d_name, search)) {
    1.46 ++				if (unixpath[0]) strcat(unixpath, "/");
    1.47 ++				strcat(unixpath, entry->d_name);
    1.48 ++				status++;
    1.49 ++				break;
    1.50 ++			}
    1.51 ++		}
    1.52 ++		closedir(dirp);
    1.53 ++ 	}
    1.54 ++	return status;
    1.55 ++}
    1.56 ++
    1.57 ++// update filename with real file path found
    1.58 ++static void unixfilename(char *filename)
    1.59 ++{
    1.60 ++	char unixpath[PATH_MAX];
    1.61 ++	char *s = unixpath + 1;
    1.62 ++	char *check = filename + 1;
    1.63 ++	int len;
    1.64 ++
    1.65 ++	for (unixpath[0] = 0; *check; len++, s += len, check += len) {
    1.66 ++		char *seek = strchr(check, '\\');
    1.67 ++
    1.68 ++		if (!seek) { // basename of filename
    1.69 ++			if (lookup_entry(check, unixpath))
    1.70 ++				strcpy(filename, unixpath); // found
    1.71 ++			break;
    1.72 ++		}
    1.73 ++		len = seek - check;
    1.74 ++		memcpy(s, check, len);
    1.75 ++		s[len] = '\0';
    1.76 ++		if (!lookup_entry(s, unixpath))
    1.77 ++			break; // path mismatch
    1.78 ++	}
    1.79 ++}
    1.80 ++#endif
    1.81 ++
    1.82 + #if ENABLE_TFTP
    1.83 + 
    1.84 + int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.85 +@@ -820,6 +873,10 @@
    1.86 + 	G.block_buf_tail[0] = '\0';
    1.87 + 
    1.88 + 	local_file = G.block_buf + 2;
    1.89 ++#if ENABLE_FEATURE_TFTPD_RIS
    1.90 ++	if (local_file[0] == '\\')
    1.91 ++		unixfilename(local_file);
    1.92 ++#endif
    1.93 + 	if (local_file[0] == '.' || strstr(local_file, "/.")) {
    1.94 + 		error_msg = "dot in file name";
    1.95 + 		goto err;