static rc_t cg_dump_gather_output_compression( Args * args, cg_dump_opts * opts ) { const char * value; bool found; rc_t rc = cg_dump_get_string_option( args, OPTION_COMP, &value, &found ); if ( rc == 0 ) { opts->comp = oc_bzip; if ( found ) { if ( string_cmp ( value, string_size( value ), value_comp_none, string_size( value_comp_none ), string_size( value ) ) == 0 ) { opts->comp = oc_none; } else if ( string_cmp ( value, string_size( value ), value_comp_bzip, string_size( value_comp_bzip ), string_size( value ) ) == 0 ) { opts->comp = oc_bzip; } else if ( string_cmp ( value, string_size( value ), value_comp_gzip, string_size( value_comp_gzip ), string_size( value ) ) == 0 ) { opts->comp = oc_gzip; } else if ( string_cmp ( value, string_size( value ), value_comp_null, string_size( value_comp_null ), string_size( value ) ) == 0 ) { opts->comp = oc_null; } } } return rc; }
int hy_nevra_cmp(HyNevra nevra1, HyNevra nevra2) { int ret; ret = string_cmp(nevra1->name, nevra2->name); if (ret != 0) return ret; ret = hy_nevra_evr_cmp(nevra1, nevra2, NULL); if (ret != 0) return ret; return string_cmp(nevra1->arch, nevra2->arch); }
static int64_t CC sort_cmp (const void ** l, const void ** r, void * data) { /* KDirectory * d; */ uint64_t lz, rz; rc_t rc; /* d = data; */ /* lz = l; */ /* rz = r; */ rc = KDirectoryFileSize (data, &lz, *l); if (rc == 0) { rc = KDirectoryFileSize (data, &rz, *r); if (rc == 0) { int64_t zdiff; zdiff = lz - rz; if (zdiff != 0) return (zdiff < 0) ? -1 : 1; else { size_t lsz = string_size (*l); size_t rsz = string_size (*r); return string_cmp (*l, lsz, *r, rsz, lsz+1); } } } return 0; /* dunno just leave it... */ }
static bool pacbio_is_schema_dflt( const char * schema ) { size_t asize = string_size ( schema ); size_t bsize = string_size ( DFLT_SCHEMA ); uint32_t max_chars = ( asize > bsize ) ? asize : bsize; return ( string_cmp ( schema, asize, DFLT_SCHEMA, bsize, max_chars ) == 0 ); }
LIB_EXPORT rc_t CC XFS_StrEndsWith ( const char * Str, const char * End ) { uint32_t StrLen, EndLen; if ( Str == NULL || End == NULL ) { return false; } StrLen = string_len ( Str, string_size ( Str ) ); EndLen = string_len ( End, string_size ( End ) ); if ( StrLen >= EndLen && EndLen > 0 ) { return string_cmp ( Str + ( StrLen - EndLen ), EndLen, End, EndLen, EndLen ) == 0; } return false; } /* XFS_StrEndsWith () */
bool namelist_contains( const KNamelist *names, const char * a_name ) { bool res = false; uint32_t count; rc_t rc = KNamelistCount( names, &count ); if ( rc == 0 && count > 0 ) { uint32_t idx; size_t a_name_len = string_size( a_name ); for ( idx = 0; idx < count && rc == 0 && !res; ++idx ) { const char * s; rc = KNamelistGet( names, idx, &s ); if ( rc == 0 && s != NULL ) { size_t s_len = string_size( s ); size_t max_len = a_name_len > s_len ? a_name_len : s_len; int cmp = string_cmp( a_name, a_name_len, s, s_len, max_len ); if ( cmp == 0 ) res = true; } } } return res; }
int main(int argc, char** argv) { char* pText01 = NULL; char* pText02 = NULL; printf("init\n"); if( (pText01 = malloc(sizeof(pText01))) == NULL) return EXIT_FAILURE; strcpy(pText01, TEXT01); if( (pText02 = malloc(sizeof(pText02))) == NULL) return EXIT_FAILURE; strcpy(pText02, TEXT02); // strcmp output printf("do string_cmp()\n"); int iResult = 0; if( -1 == string_cmp(pText01, pText02, &iResult)) return EXIT_FAILURE; printf("strcmp: \"%s\" and \"%s\", \nresult: \'%d\' - ", pText01, pText02, iResult); // print result if(iResult < 0){ printf("\"%s\" greater than \"%s\"\n", pText01, pText02); }else if(iResult > 0){ printf("\"%s\" smaller than \"%s\"\n", pText01, pText02); }else{ printf("Equal!\n"); } if(pText01 != NULL) free(pText01); if(pText01 != NULL) free(pText02); printf("READY.\n"); return EXIT_SUCCESS; }
static rc_t GetNewPassword(const struct KFile* pwd_in, struct KFile* pwd_out, char* buf) { rc_t rc = KFileWrite ( pwd_out, 0, KR_PWD_PROMPT_1, string_measure(KR_PWD_PROMPT_1, NULL), NULL); if (rc == 0) { char buf1[MaxPwdSize]; size_t last_pos = 0; rc = ReadPassword(pwd_in, & last_pos, buf1, MaxPwdSize); if (rc == 0) { rc = KFileWrite ( pwd_out, string_measure(KR_PWD_PROMPT_1, NULL), KR_PWD_PROMPT_2, string_measure(KR_PWD_PROMPT_2, NULL), NULL ); if (rc == 0) { char buf2[MaxPwdSize]; rc = ReadPassword(pwd_in, & last_pos, buf2, sizeof(buf2)); if (rc == 0) { size_t pwd_size = string_measure(buf1, NULL); if (string_cmp(buf1, pwd_size, buf2, string_measure(buf2, NULL), MaxPwdSize) != 0) rc = RC(rcApp, rcEncryptionKey, rcCreating, rcParam, rcInconsistent); else string_copy(buf, MaxPwdSize, buf1, pwd_size + 1); } } } } return rc; }
static int64_t DictionaryEntryFind ( const void *p_a, const BSTNode *p_b ) { const char * a = ( const char * ) p_a; DictionaryEntry* b = ( DictionaryEntry * ) p_b; size_t a_path_size = string_size ( a ); return string_cmp ( a, a_path_size, b -> path, string_size ( b -> path ), ( uint32_t ) a_path_size ); }
static int64_t DictionaryEntryCompare ( const BSTNode *p_a, const BSTNode *p_b ) { DictionaryEntry* a = ( DictionaryEntry * ) p_a; DictionaryEntry* b = ( DictionaryEntry * ) p_b; size_t a_path_size = string_size ( a -> path ); return string_cmp ( a -> path, a_path_size, b -> path, string_size ( b -> path ), ( uint32_t ) a_path_size ); }
static VRemoteProtocols parseProtocol ( const char * protocol, rc_t * prc ) { VRemoteProtocols protocols = 0; int n = 0; int j = 0; uint32_t sz = 0; assert ( protocol && prc ); sz = string_measure ( protocol, NULL ); while ( sz > 0 ) { bool found = false; int l = sz; char * c = string_chr ( protocol, sz, ',' ); if ( c != NULL ) l = c - protocol; for ( j = 0; j < sizeof PROTOCOLS / sizeof PROTOCOLS [ 0 ]; ++ j ) { const TProtocol * p = & PROTOCOLS [ j ]; uint32_t max_chars = p -> s > l ? p -> s : l; if (string_cmp ( protocol, l, p -> n, p -> s, max_chars ) == 0) { VRemoteProtocols next = p -> p << ( 3 * n ); protocols = next + protocols; ++n; assert ( l >= p -> s ); protocol += p -> s; sz -= p -> s; found = true; break; } } if ( ! found ) { * prc = RC ( rcExe, rcArgv, rcParsing, rcParam, rcInvalid ); PLOGERR ( klogErr, ( klogErr, * prc, "Bad protocol '$(p)'", "p=%.*s", l, protocol ) ); break; } if ( c != NULL ) { ++ protocol; -- sz; } } return protocols; }
static int netnode_sort (const void *va, const void *vb) { LibraryEntryType *am = (LibraryEntryType *) va; LibraryEntryType *bm = (LibraryEntryType *) vb; char *a = am->ListEntry; char *b = bm->ListEntry; return string_cmp (a, b); }
static int cmp_pchar_vs_len( const char * a, const char * b, size_t len_b ) { int res = 0; if ( ( a != NULL )&&( b != NULL ) ) { size_t len_a = string_size( a ); res = string_cmp ( a, len_a, b, len_b, ( len_a < len_b ) ? len_b : len_a ); } return res; }
static bool _StringStartsWith(const String *self, const char *buf) { size_t len = 0; assert(self && buf); len = string_size(buf); assert(len); /*printf("_StringStartsWith(%.*s, %s)\n", self->len, self->addr, buf);*/ if (self->len < len) { return false; } return string_cmp(self->addr, self->len, buf, len, (uint32_t)len) == 0; }
static obj_t string_ge_fn(obj_t args, Reporter rep) { obj_t s1, s2; int rv; if (!args_match(rep, args, 2, is_string, is_string)) return unspecific; s1 = list_ref(args, 0); s2 = list_ref(args, 1); rv = string_cmp(fetch_string(s1), fetch_string(s2)); return make_bool(rv >= 0); }
static int netlist_sort (const void *va, const void *vb) { LibraryMenuType *am = (LibraryMenuType *) va; LibraryMenuType *bm = (LibraryMenuType *) vb; char *a = am->Name; char *b = bm->Name; if (*a == '~') a++; if (*b == '~') b++; return string_cmp (a, b); }
static bool string_ends_in( const char * str, const char * end ) { bool res = false; if ( str != NULL && end != NULL ) { uint32_t l_str = string_len( str, string_size( str ) ); uint32_t l_end = string_len( end, string_size( end ) ); if ( l_str >= l_end && l_end > 0 ) { const char * p = str + ( l_str - l_end ); res = ( string_cmp ( p, l_end, end, l_end, l_end ) == 0 ); } } return res; }
/* FastFind * Uses heuristics to select the repository most likely to contain the accession, then tries to locate the acecssion in the repository. */ static rc_t FindFast( const NCBISRAPath *cself, const char *accession, char *path, size_t path_max, size_t *rep_len ) { /*TODO: look up cache first */ /* recognize known naming schemes */ size_t size = string_size(accession); if ( string_cmp(accession, size, "SRR", 3, 3) == 0 ) return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ncbi); if ( string_cmp(accession, size, "ERR", 3, 3) == 0 ) return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ebi); if ( string_cmp(accession, size, "DRR", 3, 3) == 0 ) return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_ncbi, alg_ddbj); if ( string_chr(accession, size, '.') != NULL ) return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_refseq, alg_none); if ( size > 2 && isdigit(accession[size-1]) && isdigit(accession[size-2]) && ! isdigit(accession[size-3]) ) return SRAPathFindInRepoByType(cself, accession, path, path_max, rep_len, alg_wgs, alg_none); return RC ( rcSRA, rcMgr, rcSelecting, rcPath, rcNotFound ); }
void Compare::set_val() { if(m_v1.is_bool() && m_v2.is_bool()) VarBase::operator=(bool_cmp(bool(m_v1), bool(m_v2))); else if(m_v1.is_int() && m_v2.is_int()) VarBase::operator=(int_cmp(int(m_v1), int(m_v2))); else if(m_v1.is_double() && m_v2.is_double()) VarBase::operator=(double_cmp(double(m_v1), double(m_v2))); else if(m_v1.is_string() && m_v2.is_string()) { std::string s1 = std::string(m_v1), s2 = std::string(m_v2); VarBase::operator=(string_cmp(s1, s2)); } else VarBase::operator=(VarBase()); // Set it invalid }
int main() { map *m; string *k; string *v; string *q; map_iterator *n; pair *t; m = map_init(stcmp); q = string_init_cstring(""); k = string_init(); string_read_line(k); while(string_cmp(k, q)) { v = string_init(); string_read_line(v); map_add(m, k, v); k = string_init(); string_read_line(k); } k = string_free(k); /* Iterate through map. */ for(n = map_begin(m); n; n = map_next(n)) { t = n->data; string_print(t->first); printf(" => "); string_println(t->second); } /* Free map. */ for(n = map_begin(m); n; n = map_next(n)) { t = n->data; string_free(t->first); string_free(t->second); } string_free(q); m = map_free(m); return 0; }
/* ---------------------------------------------------------------------- */ static int64_t CC extnode_sort (const BSTNode * item, const BSTNode * n) { const extnode * l; const extnode * r; int64_t ii; l = (const extnode *)item; r = (const extnode *)n; if (l->offset < r->offset) ii = -1; else if (l->offset > r->offset) ii = 1; else { size_t lz; size_t rz; char lbuff [8192]; char rbuff [8192]; rc_t lrc; rc_t rrc; lrc = VPathReadPath (l->path, lbuff, sizeof (lbuff), &lz); if (lrc) { LOGERR (klogInt, lrc, "failed to etract item path"); lz = 0; } rrc = VPathReadPath (r->path, rbuff, sizeof (rbuff), &rz); if (lrc) { LOGERR (klogInt, rrc, "failed to etract node path"); rz = 0; } ii = string_cmp (lbuff, lz, rbuff, rz, lz + rz); } return ii; }
LIB_EXPORT rc_t CC VNamelistIndexOf( VNamelist *self, const char* s, uint32_t *found ) { rc_t rc; if ( self == NULL ) rc = RC ( rcCont, rcNamelist, rcSearching, rcSelf, rcNull ); else { if ( s == NULL ) rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcNull ); else if ( s[0] == 0 ) rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcEmpty ); else if ( found == NULL ) rc = RC( rcCont, rcNamelist, rcSearching, rcParam, rcNull ); else { uint32_t count; rc = VNameListCount ( self, &count ); if ( rc == 0 ) { uint32_t idx; size_t n1 = string_size ( s ); for ( idx = 0; idx < count; ++idx ) { const char * name; rc = VNameListGet ( self, idx, &name ); if ( rc == 0 ) { size_t n2 = string_size ( name ); if ( string_cmp ( s, n1, name, n2, (uint32_t) ( ( n1 < n2 ) ? n2 : n1 ) ) == 0 ) { *found = idx; return 0; } } } rc = RC( rcCont, rcNamelist, rcSearching, rcString, rcNotFound ); } } } return rc; }
static rc_t CC _IsPathCart ( const struct KDirectory * Directory, const char * Path, const char * Name, char * BF, size_t BFS, bool * IsCart ) { rc_t RCt; size_t nwr; const struct KFile * File; const char * Sg = "ncbikart"; size_t SgLen; char SF [ 64 ]; RCt = 0; nwr = 0; File = NULL; SgLen = sizeof ( Sg ); * SF = 0; * BF = 0; * IsCart = false; RCt = string_printf ( BF, BFS, & nwr, "%s/%s", Path, Name ); if ( RCt == 0 ) { RCt = KDirectoryOpenFileRead ( Directory, & File, BF ); if ( RCt == 0 ) { RCt = KFileRead ( File, 0, SF, SgLen, & nwr ); if ( RCt == 0 ) { * IsCart = ! string_cmp ( SF, SgLen, Sg, SgLen, SgLen ); } KFileRelease ( File ); } } return RCt; } /* _IsPathCart () */
void set_ofsrec(u_char *ptr, int len, int ofs) { OffsetRec *orec; int low, high, mid; int i; if (ofsrec_num <= 0) { orec = makeoffset(ptr, len, ofs); ofsrec[0]= orec; ofsrec_num++; return; } low = 0; high = ofsrec_num - 1; do { mid = (low + high) / 2; i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, ptr, len); if (i > 0) high = mid - 1; else if (i < 0) low = ++mid; else break; } while (low <= high); if (i) { if (ofsrec_num >= MAXOFFSETNUMBER) { fprintf(stderr, "\245\252\245\325\245\273\245\303\245\310\241\246\245\306\241\274\245\326\245\353\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n"); exit(1); } orec = makeoffset(ptr, len, ofs); for (i = ofsrec_num ; i > mid ; i--) ofsrec[i] = ofsrec[i - 1]; ofsrec[mid] = orec; ofsrec_num++; } }
int isknjexist(u_char *knj, int len) { int low, high, mid; int i; if (ofsrec_num <= 0) return 0; low = 0; high = ofsrec_num - 1; while (low <= high) { mid = (low + high) / 2; i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, knj, len); if (i > 0) high = mid - 1; else if (i < 0) low = ++mid; else return ofsrec[mid] -> offset; } return 0; }
bool equalp(Value lhs, Value rhs) { ObjectType lt = get_type(lhs); ObjectType rt = get_type(rhs); if (lt != rt) return false; switch (lt) { case FIXNUM: return lhs.i == rhs.i; case STRING: case SYMBOL: return !string_cmp(lhs.ptr, rhs.ptr); default: error("equality not implemented for this type yet"); } return false; }
int main() { string *s = string_init(); string *o; string *subs; string *q = string_init_cstring("quit"); string_read_line(s); while(string_cmp(s, q)) { string_print(s); string_reset(s); string_read_line(s); } string_append(s, q); o = string_cat(s, q); string_print(s); string_print(o); string_append_cstring(o, "hello"); string_append_char(o, 'J'); string_print(o); subs = string_substring(o, 5, 6); printf("--\n"); printf("%c\n", string_get(s, 5)); printf("%d\n", string_index(o, 'o')); string_print(subs); printf("--\n"); o = string_free(o); s = string_free(s); q = string_free(q); subs = string_free(subs); return 0; }
static bool CC find_spot_group_callback( DLNode *n, void *data ) { find_spot_group_cb_ctx *ctx = ( find_spot_group_cb_ctx * )data; spot_group * sg = ( spot_group * ) n; bool res = false; if ( ctx->name == NULL || sg->name == NULL ) { res = true; } else { res = ( string_cmp ( sg->name, sg->len, ctx->name, ctx->len, ( sg->len < ctx->len ) ? ctx->len : sg->len ) == 0 ); } if ( res ) { ctx->res = sg; } return res; }
static bool does_table_have_column( VTable const * tbl, char const column[] ) { KNamelist * column_names; bool res = false; rc_t rc = VTableListReadableColumns ( tbl, &column_names ); if ( rc == 0 ) { uint32_t count; rc = KNamelistCount ( column_names, &count ); if ( rc == 0 && count > 0 ) { uint32_t idx; size_t col_name_size; const char * col_name = string_chr ( column, string_size( column ), ')' ); if ( col_name == NULL ) col_name = column; else col_name++; col_name_size = string_size( col_name ); for ( idx = 0; idx < count && rc == 0 && !res; ++idx ) { const char * name; rc = KNamelistGet ( column_names, idx, &name ); if ( rc == 0 && name != NULL ) { int cmp = string_cmp( col_name, col_name_size, name, string_size( name ), 0xFFFF ); if ( cmp == 0 ) res = true; } } } KNamelistRelease ( column_names ); } return res; }
static rc_t Start (KDirectory * cwd, const char * src, const char * dst) { KPathType dtype; KPathType stype; char dpath [MY_MAX_PATH]; char spath [MY_MAX_PATH]; rc_t rc; bool using_stdin, using_stdout, try_rename; /* limited anti oops checks */ try_rename = (dst == NULL); if (!try_rename) { /* try to prevent file to file clash */ if (strcmp (src,dst) == 0) dst = NULL; /* try to prevent file to dir clash */ else { size_t s,d; s = string_size (src); d = string_size (dst); if (s > d) { if (string_cmp (src, s, dst, d, d) == 0) { if ((strchr (src+d+1, '/') == NULL) && ((src[d] == '/') || (src[d-1] == '/'))) { try_rename = true; dst = NULL; } } } } } /* * This is a quick fix "hack" * A fully built out VFS should replace the KFS in use and eliminate this */ using_stdin = (strcmp (src, "/dev/stdin") == 0); if (using_stdin) { if (dst == NULL) { rc = RC (rcExe, rcArgv, rcParsing, rcParam, rcNull); LOGERR (klogErr, rc, "Unable to handle stdin in place"); return rc; } stype = kptFile; strcpy (spath, src); UseStdin = true; STSMSG (1, ("reading console / stdin as input")); goto stdin_shortcut; } rc = KDirectoryResolvePath (cwd, false, spath, sizeof spath, "%s", src); if (rc) { LOGERR (klogErr, rc, "can't resolve source"); return rc; } stype = KDirectoryPathType (cwd, spath); switch (stype) { case kptNotFound: rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcNotFound); break; default: case kptBadPath: rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcInvalid); break; case kptCharDev: case kptBlockDev: case kptFIFO: case kptZombieFile: case kptDataset: case kptDatatype: rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcIncorrect); break; case kptFile: case kptDir: break; } if (rc) { PLOGERR (klogErr, (klogErr, rc, "can not use source '$(S)'", "S=%s", src)); return rc; } /* * In Place Operation */ if (dst == NULL) { /* * Input is a file */ if (stype == kptFile) { KDirectory * ndir; char * pc; pc = strrchr (spath, '/'); if (pc == NULL) { pc = spath; ndir = cwd; rc = KDirectoryAddRef (cwd); } else if (pc == spath) { ++pc; ndir = cwd; rc = KDirectoryAddRef (cwd); } else { *pc++ = '\0'; rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, spath); } if (rc == 0) { rc = FileInPlace (ndir, pc, try_rename); KDirectoryRelease (ndir); } } /* * Input is a directory */ else { KDirectory * ndir; rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, spath); if (rc) ; else { STSMSG (1, ("%scrypting directory %s", De, spath)); rc = DoDir (ndir, ndir); STSMSG (1, ("done with directory %s", spath)); KDirectoryRelease (ndir); } } } /* * 'Copy' Operation */ else { stdin_shortcut: using_stdout = (strcmp (dst, "/dev/stdout") == 0); if (using_stdout == true) { dtype = kptFile; strcpy (dpath, dst); UseStdout = true; STSMSG (1, ("writing console / stdout as output")); goto do_file; } rc = KDirectoryResolvePath (cwd, false, dpath, sizeof dpath, "%s", dst); if (rc) { LOGERR (klogErr, rc, "can't resolve destination"); return rc; } dtype = KDirectoryPathType (cwd, dpath); switch (dtype) { default: case kptBadPath: rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcInvalid); PLOGERR (klogErr, (klogErr, rc, "can not use destination '$(S)'", "S=%s", dst)); break; case kptCharDev: case kptBlockDev: case kptFIFO: case kptZombieFile: case kptDataset: case kptDatatype: rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcIncorrect); PLOGERR (klogErr, (klogErr, rc, "can not use destination parameter '$(S)'", "S=%s", dst)); break; case kptNotFound: { size_t z; z = strlen (dst) - 1; if ((dst[z] == '/') || (stype == kptDir)) goto do_dir; else goto do_file; } case kptFile: if (!ForceFlag) { rc = RC (rcExe, rcArgv, rcParsing, rcFile, rcExists); PLOGERR (klogErr, (klogErr, rc, "can not over-write '$(F)' without --force", "F=%s", dpath)); break; } do_file: if (stype == kptFile) { rc = FileToFile (cwd, spath, cwd, dpath, try_rename, NULL); } else { rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcIncorrect); LOGERR (klogErr, rc, "Can't do directory to file"); } break; do_dir: case kptDir: /* * Input is a directory */ if (stype == kptDir) { #if DIRECTORY_TO_DIRECTORY_SUPPORTED const KDirectory * sdir; KDirectory * ddir; rc = KDirectoryOpenDirRead (cwd, &sdir, false, spath); if (rc) ; else { if (dtype == kptNotFound) { STSMSG (1, ("creating output directory %s", dpath)); rc = KDirectoryCreateDir (cwd, 0775, kcmCreate|kcmParents, "%s", dpath); } if (rc == 0) { rc = KDirectoryOpenDirUpdate (cwd, &ddir, false, dpath); if (rc) ; else { STSMSG (1, ("%scrypting directory %s to %s", De, spath, dpath)); rc = DoDir (sdir, ddir); STSMSG (1, ("done with directory %s to %s", spath, dpath)); KDirectoryRelease (ddir); } } KDirectoryRelease (sdir); } #else rc = RC (rcExe, rcArgv, rcResolving, rcPath, rcIncorrect); LOGERR (klogErr, rc, "Can't do directory to directory"); #endif } /* * Input is a file */ else { KDirectory * ndir; const char * pc; if (dtype == kptNotFound) { STSMSG (1, ("creating output directory %s", dpath)); rc = KDirectoryCreateDir (cwd, 0775, kcmCreate|kcmParents, "%s", dpath); } if (rc == 0) { STSMSG (1, ("opening output directory %s", dpath)); rc = KDirectoryOpenDirUpdate (cwd, &ndir, false, dpath); if (rc) ; else { pc = strrchr (spath, '/'); if (pc == NULL) pc = spath; else ++pc; rc = FileToFile (cwd, spath, ndir, pc, true, dpath); KDirectoryRelease (ndir); } } } break; } } return rc; }