/* Tests the strrm() function */ static void test_strrm() { char test1[] = {'_', '1', '0', '0', '_', '0', '0', '_', 0}; strrm(test1, test1, '_'); assert(!strcmp(test1, "10000")); fprintf(stdout, "%s:\t\tpassed\n", __FUNCTION__); }
int main() { strcpy(s2, "efg"); p = strdog("abc", s2); printf("output for strdog function p= %s\n", p); strcpy(s, "ravikrishna"); p = strrev(s); printf("output for strrev function p= %s\n", p); strcpy(s1, "AABZBAADZDAA"); p = strrm(s1, "ZA"); printf("output for strrm function p= %s\n", p); strcpy(s1, "AABZBAADZDAA"); p = strcrm(s1, "ZA"); printf("output for strcrm function p= %s\n", p); }
void DirToStream(char *dir, void (*streamWriter)(uchar *, uint)) { autoList_t *pathsStack = newList(); autoList_t *infosStack = newList(); // !withInfo のときは使わない。 autoList_t *paths; autoList_t *infos = NULL; int withInfo = DTS_WithInfo; enterDir: addCwd(dir); if(withInfo) { lsInfos = newList(); paths = ls("."); infos = lsInfos; lsInfos = NULL; } else paths = ls("."); eraseParents(paths); if(withInfo) { char *path; uint index; foreach(paths, path, index) { path = strrm(path, 4); setElement(paths, index, (uint)path); valueToBlock(strchr(path, '\0') + 1, getElement(infos, index)); } rapidSortLines(paths); foreach(paths, path, index) { setElement(infos, index, blockToValue(strchr(path, '\0') + 1)); }
static void ResolveRelHintPath(char *file) { char *text = readText_b(file); char *p; int modified = 0; text = strrm(text, 128000000); // XXX p = text; while(p = strstrNext(p, "<HintPath>")) { if(startsWith(p, "..\\")) { char *trailer = strx(p); uint c; for(c = 0; c < UTIntoParentStep; c++) { *p++ = '.'; *p++ = '.'; *p++ = '\\'; } strcpy(p, trailer); memFree(trailer); p = strstrNext(p, "</HintPath>"); errorCase(!p); modified = 1; } } if(modified) writeOneLineNoRet_b(file, text); memFree(text); }