[HELP] trying to compile mygrep tools in termux

Programming related discussions related to game research
TUNBudi06
Posts: 52
Joined: Tue Sep 14, 2021 7:40 am

[HELP] trying to compile mygrep tools in termux

Post by TUNBudi06 »

When i try to compile it i get this error

Please help me

Code: Select all

 qc mygrep.c
In file included from mygrep.c:60:
./scan.h:97:35: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    files[filesi].name   = strdup(fname);
                                  ^~~~~
/data/data/com.termux/files/usr/include/string.h:110:26: note: passing argument to parameter '__s' here
char* strdup(const char* __s);
                         ^
In file included from mygrep.c:60:
./scan.h:97:26: warning: assigning to 'u8 *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    files[filesi].name   = strdup(fname);
                         ^ ~~~~~~~~~~~~~
./scan.h:166:9: warning: implicit declaration of function 'scandir' is invalid in C99 [-Wimplicit-function-declaration]
    n = scandir(filedir, &namelist, NULL, NULL);
        ^
./scan.h:168:17: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        if(stat(filedir, &xstat) < 0) {
                ^~~~~~~
/data/data/com.termux/files/usr/include/sys/stat.h:149:22: note: passing argument to parameter '__path' here
int stat(const char* __path, struct stat* __buf);
                     ^
In file included from mygrep.c:60:
./scan.h:176:19: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    plen = strlen(filedir);
                  ^~~~~~~
/data/data/com.termux/files/usr/include/string.h:95:27: note: passing argument to parameter '__s' here
size_t strlen(const char* __s) __attribute_pure__;
                          ^
In file included from mygrep.c:60:
./scan.h:178:12: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    strcpy(filedir + plen, "/");
           ^~~~~~~~~~~~~~
/data/data/com.termux/files/usr/include/string.h:108:20: note: passing argument to parameter '__dst' here
char* strcpy(char* __dst, const char* __src);
                   ^
In file included from mygrep.c:60:
./scan.h:182:31: error: incomplete definition of type 'struct dirent'
        if(!strcmp(namelist[i]->d_name, ".") || !strcmp(namelist[i]->d_name, "..")) continue;
                   ~~~~~~~~~~~^
./scan.h:162:13: note: forward declaration of 'struct dirent'
    struct  dirent  **namelist;
            ^
./scan.h:182:68: error: incomplete definition of type 'struct dirent'
        if(!strcmp(namelist[i]->d_name, ".") || !strcmp(namelist[i]->d_name, "..")) continue;
                                                        ~~~~~~~~~~~^
./scan.h:162:13: note: forward declaration of 'struct dirent'
    struct  dirent  **namelist;
            ^
./scan.h:184:37: error: incomplete definition of type 'struct dirent'
        namelen = strlen(namelist[i]->d_name);
                         ~~~~~~~~~~~^
./scan.h:162:13: note: forward declaration of 'struct dirent'
    struct  dirent  **namelist;
            ^
./scan.h:187:43: error: incomplete definition of type 'struct dirent'
        memcpy(filedir + plen, namelist[i]->d_name, namelen);
                               ~~~~~~~~~~~^
./scan.h:162:13: note: forward declaration of 'struct dirent'
    struct  dirent  **namelist;
            ^
./scan.h:190:17: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        if(stat(filedir, &xstat) < 0) {
                ^~~~~~~
/data/data/com.termux/files/usr/include/sys/stat.h:149:22: note: passing argument to parameter '__path' here
int stat(const char* __path, struct stat* __buf);
                     ^
mygrep.c:108:14: warning: assigning to 'u8 *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    g_string = argv[i++];
             ^ ~~~~~~~~~
mygrep.c:113:23: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    g_string = strdup(g_string);    // not necessary
                      ^~~~~~~~
/data/data/com.termux/files/usr/include/string.h:110:26: note: passing argument to parameter '__s' here
char* strdup(const char* __s);
                         ^
mygrep.c:113:14: warning: assigning to 'u8 *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    g_string = strdup(g_string);    // not necessary
             ^ ~~~~~~~~~~~~~~~~
mygrep.c:117:17: warning: passing 'u8 [4096]' to parameter of type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        sprintf(filedir, "%.*s", sizeof(filedir) - 1, argv[i]);
                ^~~~~~~
/data/data/com.termux/files/usr/include/stdio.h:165:19: note: passing argument to parameter '__s' here
int sprintf(char* __s, const char* __fmt, ...)
                  ^
mygrep.c:117:29: warning: field precision should have type 'int', but argument has type 'unsigned long' [-Wformat]
        sprintf(filedir, "%.*s", sizeof(filedir) - 1, argv[i]);
                          ~~^~   ~~~~~~~~~~~~~~~~~~~
mygrep.c:273:31: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
                    if(sscanf(p + 1, "%02x%n", &n, &len) != 1) return(-1);
                              ^~~~~
/data/data/com.termux/files/usr/include/stdio.h:141:24: note: passing argument to parameter '__s' here
int sscanf(const char* __s, const char* __fmt, ...) __scanflike(2, 3);
                       ^
mygrep.c:280:31: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
                    if(sscanf(p, "%3o%n", &n, &len) != 1) return(-1);
                              ^
/data/data/com.termux/files/usr/include/stdio.h:141:24: note: passing argument to parameter '__s' here
int sscanf(const char* __s, const char* __fmt, ...) __scanflike(2, 3);
                       ^
mygrep.c:304:20: warning: assigning to 'u8 *' (aka 'unsigned char *') from 'char [1]' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    if(!data) data = "";
                   ^ ~~
mygrep.c:306:27: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    else     len = strlen(data);
                          ^~~~
/data/data/com.termux/files/usr/include/string.h:95:27: note: passing argument to parameter '__s' here
size_t strlen(const char* __s) __attribute_pure__;
                          ^
mygrep.c:311:17: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        sprintf(ret + (i * 2), "%02x", data[i]);
                ^~~~~~~~~~~~~
/data/data/com.termux/files/usr/include/stdio.h:165:19: note: passing argument to parameter '__s' here
int sprintf(char* __s, const char* __fmt, ...)
                  ^
mygrep.c:313:29: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    if(size) *size = strlen(ret);
                            ^~~
/data/data/com.termux/files/usr/include/string.h:95:27: note: passing argument to parameter '__s' here
size_t strlen(const char* __s) __attribute_pure__;
                          ^
mygrep.c:334:22: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
        len = strlen(data);
                     ^~~~
/data/data/com.termux/files/usr/include/string.h:95:27: note: passing argument to parameter '__s' here
size_t strlen(const char* __s) __attribute_pure__;
                          ^
mygrep.c:402:39: warning: format specifies type 'unsigned int' but the argument has type 'long' [-Wformat]
                printf("  %08x %s\n", p - buff, fname);
                          ~~~~        ^~~~~~~~
                          %08lx
mygrep.c:415:39: warning: format specifies type 'unsigned int' but the argument has type 'long' [-Wformat]
                printf("  %08x %s\n", p - buff, fname);
                          ~~~~        ^~~~~~~~
                          %08lx
mygrep.c:444:16: warning: passing 'u8 *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    fd = fopen(fname, "rb");
               ^~~~~
/data/data/com.termux/files/usr/include/stdio.h:283:25: note: passing argument to parameter '__path' here
FILE* fopen(const char* __path, const char* __mode);
                        ^
22 warnings and 4 errors generated.
Last edited by TUNBudi06 on Wed Mar 16, 2022 3:55 am, edited 1 time in total.
TUNBudi06
Posts: 52
Joined: Tue Sep 14, 2021 7:40 am

Re: [HELP] trying to compile mygrep tools in termux

Post by TUNBudi06 »

Bcz i your tools is is usefull for hex or basecode


That why need help

Bcz Im don't really know about c language

Please help
TUNBudi06
Posts: 52
Joined: Tue Sep 14, 2021 7:40 am

Re: [HELP] trying to compile mygrep tools in termux

Post by TUNBudi06 »

Well before reply this post.i already solved this problem

By include dirent.h in scan.h file

Thanks