Пример #1
0
char *
has_ident(const char *name,
	  char *first,
	  char *last)
{
    char *base;
    char *s, *t, *d, c;

    name = leaf_of(name);

    s = first;
    while ((t = base = strchr(s, '$')) != 0 && (t < last)) {
	t++;
	if ((s = exact(skip_camel(t), "Id")) != 0
	    || (s = exact(t, "Header")) != 0) {
	    if (*s == '$') {
		return base;
	    } else if ((*s == ':')
		       && is_inline(t, '$')) {
		/* RCS identifier can have pathname prepended */
		s = skip_white(s + 1);
		d = skip_text(s);
		c = *d;
		*d = EOS;
		while (is_inline(s, '/'))
		    s++;
		*d = c;
		if ((s = same_name(s, name)) != 0
		    && (s = exact(s, ",v")) != 0
		    && isspace(*s))
		    return base;
	    }
	}
	s = t;
    }

    s = first;
    while ((t = base = strchr(s, '@')) != 0 && (t < last)) {
	t++;
	if ((s = exact(t, "(#)")) != NULL) {
	    t = s;
	    /* some versions of SCCS don't do module-name */
	    if ((s = same_name(t, name)) != NULL)
		return base;

	    t = skip_text(t);	/* module-name, if any */
	    t = skip_white(t);
	    if ((s = same_name(t, name)) != NULL)
		return base;
	}
	s = t;
    }
    return 0;
}
Пример #2
0
    void pull_tree( vtrc::client::vtrc_client_sptr &client,
                    const interfaces::remote_fs    &impl,
                    const std::string              &remote_path,
                    const std::string              &local_path)
    {
        typedef vtrc::shared_ptr<interfaces::remote_fs_iterator> iterator;

        iterator i = impl.begin_iterator(remote_path);

        std::cout << "Create dirs: " << local_path << "...";
        fs::create_directories( local_path );
        std::cout << "Ok\n";

        for( ; !i->end( ); i->next( ) ) {

            bool is_dir( i->info( ).is_directory_ );

            std::string name( leaf_of(i->info( ).path_) );
            fs::path next( local_path );
            next /= name;

            if( is_dir ) {
                try {
                    pull_tree( client, impl, i->info( ).path_, next.string( ) );
                } catch( ... ) {
                    std::cout << "<iteration failed>\n";
                }
            } else if( i->info( ).is_regular_ ) {
                std::cout << "Pull file: \"" <<  i->info( ).path_ << "\""
                          << " -> " << next
                          << "\n";
                pull_file( client, impl,
                           i->info( ).path_, next.string( ),
                           44000 );
            }
        }
    }