Created
November 1, 2025 02:38
-
-
Save su8/cc95b1c5941a613609d8516d89cc8d3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstdio> | |
| #include <cstring> | |
| #include <cstdlib> | |
| #include <cctype> | |
| #include <string> | |
| int main(void) { | |
| unsigned short int y = 0U; | |
| unsigned short int z = 0U; | |
| char buf[4096] = {'\0'}; | |
| char folders[100][4096] = {'\0'}; | |
| char wordStr[] = "-m /home/user /usr /tmp"; | |
| char *allptr = wordStr; | |
| /* | |
| char *bufptr = buf; | |
| for(; *allptr;) { | |
| //if (*allptr == '-' && (*(allptr+1) == 'b' || *(allptr+1) == 'm')) { allptr++; allptr++; continue; } | |
| if (std::isspace(*allptr)) { y++; allptr++; continue;} | |
| *bufptr++ = *allptr++; | |
| snprintf(folders[y], sizeof(buf), "%s", buf); | |
| } | |
| */ | |
| //while ((token = strtok_r(allptr, " ", &allptr))) { if(!strcmp(token, "-m")){continue;}snprintf(folders[y++], sizeof(buf), "%s", token); } | |
| for (; z < y; z++) { puts(folders[z]); } | |
| return EXIT_SUCCESS; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment