コード例 #1
0
ファイル: lchdir.c プロジェクト: fbb-git/yodl
void l_chdir(Lexer *lp, char const *pathname)
{
// fprintf(stderr, "CHANGING WD\n");
 
    char *resolved = realpath(media_filename(lp->d_media_ptr), NULL);

    if (resolved == NULL)
        out_of_memory();

    *(strrchr(resolved, '/') + 1) = 0;

    if (chdir(resolved) != 0)
    {
        char const *prefix = NULL;
        if (message_show(MSG_CRIT))
            prefix = "[Fatal] ";
        else if (message_show(MSG_WARNING))
            prefix = "";

        if (prefix != NULL)
            message("%s%s (%u): Can't chdir to `%s'", prefix,
                    message_filename(), message_lineno(), resolved);
    }

    free(resolved);
}
コード例 #2
0
ファイル: list.c プロジェクト: FreeBSDFoundation/freebsd
extern void
list_file(const char *filename)
{
	if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO)
		message_fatal(_("--list works only on .xz files "
				"(--format=xz or --format=auto)"));

	message_filename(filename);

	if (filename == stdin_filename) {
		message_error(_("--list does not support reading from "
				"standard input"));
		return;
	}

	// Unset opt_stdout so that io_open_src() won't accept special files.
	// Set opt_force so that io_open_src() will follow symlinks.
	opt_stdout = false;
	opt_force = true;
	file_pair *pair = io_open_src(filename);
	if (pair == NULL)
		return;

	xz_file_info xfi = XZ_FILE_INFO_INIT;
	if (!parse_indexes(&xfi, pair)) {
		bool fail;

		// We have three main modes:
		//  - --robot, which has submodes if --verbose is specified
		//    once or twice
		//  - Normal --list without --verbose
		//  - --list with one or two --verbose
		if (opt_robot)
			fail = print_info_robot(&xfi, pair);
		else if (message_verbosity_get() <= V_WARNING)
			fail = print_info_basic(&xfi, pair);
		else
			fail = print_info_adv(&xfi, pair);

		// Update the totals that are displayed after all
		// the individual files have been listed. Don't count
		// broken files.
		if (!fail)
			update_totals(&xfi);

		lzma_index_end(xfi.idx, NULL);
	}

	io_close(pair, false);
	return;
}
コード例 #3
0
int main(int argc, char* argv[]){
    if(argc != 3){
        std::cout << "Usage: " << argv[0] << " foreground_image background_image\n" << "Returns 0 if sucessful, else 1" << std::endl;
        return 1;
    }
    //image to load
    std::string message_filename(argv[1]);
    std::string background_filename(argv[2]);
    
    //init
    if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
        return 1;

    //set up screen region
    screen = SDL2_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
    
    if(screen == NULL)
        return 1;
    //window caption
    SDL_WM_SetCaption("Hello World", NULL);

    //load image
    message = load_image(message_filename);
    background = load_image(background_filename);
    //Applies image to screen region
    //background
    apply_surface( 320, 0, background, screen );
    apply_surface( 0, 240, background, screen );
    apply_surface( 320, 240, background, screen );    
    //message
    apply_surface(180, 140, message, screen);


    //updates screen
    if(SDL_Flip(screen) == -1){
        return 1;
    }

    //pause
    SDL_Delay(2000);
   
    //Cleanup
    SDL_FreeSurface(message);
    SDL_FreeSurface(background);

    SDL_Quit();
    return 0;
}
コード例 #4
0
ファイル: rooms.c プロジェクト: cafuego/monolith
void
erase_all_messages(long highest)
{
    long i;
    char filename[L_FILE + 1];

    cprintf("\n\1f\1rErasing messages for %s \1y%d\1r from file system...", config.forum, curr_rm);

    for (i = 0; i <= highest; i++) {
	message_header_filename(filename, curr_rm, i);
	if (fexists(filename)) {
	    unlink(filename);
	    message_filename(filename, curr_rm, i);
	    if (fexists(filename))
		unlink(filename);
	}
	if (!(i % 10))		/* show progress.. */
	    cprintf(".");
    }
    cprintf(" \1gdone.\1a\n");
}