From 753fc6efd6488d16d83f9cc20b45958d9b208420 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 30 Apr 2011 19:49:44 +0200 Subject: Replace some printf calls by fputs/putc --- src/collage.c | 14 +++++++------- src/filelist.c | 4 ++-- src/imlib.c | 10 +++++----- src/index.c | 14 +++++++------- src/keyevents.c | 15 ++++----------- src/list.c | 3 ++- src/menu.c | 7 ------- src/options.c | 5 +++-- src/thumbnail.c | 14 +++++++------- 9 files changed, 37 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/collage.c b/src/collage.c index 1f2fac4..4ea88a9 100644 --- a/src/collage.c +++ b/src/collage.c @@ -62,20 +62,20 @@ void init_collage_mode(void) if (!opt.limit_w || !opt.limit_h) { if (bg_im) { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for collage.\n" " You did specify a background however, so the\n" - " collage size has defaulted to the size of the image\n"); + " collage size has defaulted to the size of the image\n", + stdout); opt.limit_w = bg_w; opt.limit_h = bg_h; } else { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for collage.\n" " - For collage mode, you need to specify width and height.\n" - " Using defaults (width 800, height 600)\n"); + " Using defaults (width 800, height 600)\n", + stdout); opt.limit_w = 800; opt.limit_h = 600; } @@ -182,7 +182,7 @@ void init_collage_mode(void) } } if (opt.verbose) - fprintf(stdout, "\n"); + fputs("\n", stdout); if (opt.output && opt.output_file) { char output_buf[1024]; diff --git a/src/filelist.c b/src/filelist.c index fa1735d..c45d1f7 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -256,7 +256,7 @@ gib_list *feh_file_info_preload(gib_list * list) gib_list *remove_list = NULL; if (opt.verbose) - fprintf(stdout, PACKAGE " - preloading...\n"); + fputs(PACKAGE " - preloading...\n", stdout); for (l = list; l; l = l->next) { file = FEH_FILE(l->data); @@ -270,7 +270,7 @@ gib_list *feh_file_info_preload(gib_list * list) feh_display_status('.'); } if (opt.verbose) - fprintf(stdout, "\n"); + fputs("\n", stdout); if (remove_list) { for (l = remove_list; l; l = l->next) diff --git a/src/imlib.c b/src/imlib.c index dfbb63a..b208abf 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -162,7 +162,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) if ((err) || (!im)) { if (opt.verbose && !opt.quiet) { - fprintf(stdout, "\n"); + fputs("\n", stdout); reset_output = 1; } /* Check error code */ @@ -753,7 +753,7 @@ void feh_display_status(char stat) if (reset_output) { /* There's just been an error message. Unfortunate ;) */ for (j = 0; j < (((i % 50) + ((i % 50) / 10)) + 7); j++) - fprintf(stdout, " "); + putc(' ', stdout); } if (!(i % 50)) { @@ -763,11 +763,11 @@ void feh_display_status(char stat) i, init_len, len, ((int) ((float) i / init_len * 100))); } else if ((!(i % 10)) && (!reset_output)) - fprintf(stdout, " "); + putc(' ', stdout); reset_output = 0; } else - fprintf(stdout, "[ 0%%] "); + fputs("[ 0%] ", stdout); fprintf(stdout, "%c", stat); fflush(stdout); @@ -912,7 +912,7 @@ void feh_edit_inplace_lossless_rotate(winwidget w, int orientation) snprintf(file_str, len, "%s", filename); if ((pid = fork()) < 0) { - iw_weprintf(w, "lossless rotate: fork failed:"); + im_weprintf(w, "lossless rotate: fork failed:"); return; } else if (pid == 0) { diff --git a/src/index.c b/src/index.c index 2829bad..4b4c77f 100644 --- a/src/index.c +++ b/src/index.c @@ -113,19 +113,19 @@ void init_index_mode(void) if (!opt.limit_w && !opt.limit_h) { if (bg_im) { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for index.\n" " You did specify a background however, so the\n" - " index size has defaulted to the size of the image\n"); + " index size has defaulted to the size of the image\n", + stdout); opt.limit_w = bg_w; opt.limit_h = bg_h; } else { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for index.\n" - " Using defaults (width limited to 800)\n"); + " Using defaults (width limited to 800)\n", + stdout); opt.limit_w = 800; } } @@ -458,7 +458,7 @@ void init_index_mode(void) } } if (opt.verbose) - fprintf(stdout, "\n"); + putc('\n', stdout); if (opt.title_font) { int fw, fh, fx, fy; diff --git a/src/keyevents.c b/src/keyevents.c index e43ae33..b68a394 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -314,10 +314,10 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action) || (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) { feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]); winwidget_destroy(winwid); - } else if (winwid->type == WIN_TYPE_THUMBNAIL) { - printf("actions from the main thumb window aren't currentl supported!\n"); - printf("For now, open the image to perform the action on it.\n"); - } + } else if (winwid->type == WIN_TYPE_THUMBNAIL) + fputs("actions from the main thumb window aren't currently supported!\n" + "For now, open the image to perform the action on it.\n", + stdout); } return; } @@ -596,15 +596,8 @@ void feh_event_handle_keypress(XEvent * ev) int i, rect[4]; winwidget_get_geometry(winwid, rect); - /* printf("window: (%d, %d)\n", rect[0], rect[1]); - printf("found %d screens.\n", num_xinerama_screens); */ for (i = 0; i < num_xinerama_screens; i++) { xinerama_screen = 0; - /* printf("%d: [%d, %d, %d, %d] (%d, %d)\n", - i, - xinerama_screens[i].x_org, xinerama_screens[i].y_org, - xinerama_screens[i].width, xinerama_screens[i].height, - rect[0], rect[1]); */ if (XY_IN_RECT(rect[0], rect[1], xinerama_screens[i].x_org, xinerama_screens[i].y_org, diff --git a/src/list.c b/src/list.c index f52e0d5..3ef8e75 100644 --- a/src/list.c +++ b/src/list.c @@ -37,7 +37,8 @@ void init_list_mode(void) mode = "list"; if (!opt.customlist) - printf("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE(bytes)\tALPHA\tFILENAME\n"); + fputs("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE(bytes)\tALPHA\tFILENAME\n", + stdout); for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); diff --git a/src/menu.c b/src/menu.c index 943b65a..795a59e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1221,15 +1221,8 @@ void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i) int i, rect[4]; winwidget_get_geometry(m->fehwin, rect); - /* printf("window: (%d, %d)\n", rect[0], rect[1]); - printf("found %d screens.\n", num_xinerama_screens); */ for (i = 0; i < num_xinerama_screens; i++) { xinerama_screen = 0; - /* printf("%d: [%d, %d, %d, %d] (%d, %d)\n", - i, - xinerama_screens[i].x_org, xinerama_screens[i].y_org, - xinerama_screens[i].width, xinerama_screens[i].height, - rect[0], rect[1]); */ if (XY_IN_RECT(rect[0], rect[1], xinerama_screens[i].x_org, xinerama_screens[i].y_org, diff --git a/src/options.c b/src/options.c index de72429..61aee64 100644 --- a/src/options.c +++ b/src/options.c @@ -873,8 +873,9 @@ static void show_version(void) void show_mini_usage(void) { - fprintf(stderr, PACKAGE " - No loadable images specified.\n" - "Use " PACKAGE " --help for detailed usage information\n"); + fputs(PACKAGE " - No loadable images specified.\n" + "Use " PACKAGE " --help for detailed usage information\n", + stderr); exit(1); } diff --git a/src/thumbnail.c b/src/thumbnail.c index ca5c387..0e93447 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -376,7 +376,7 @@ void init_thumbnail_mode(void) winwidget_render_image(winwid, 0, 1); if (opt.verbose) - fprintf(stdout, "\n"); + putc('\n', stdout); if (opt.title_font) { int fw, fh, fx, fy; @@ -563,19 +563,19 @@ void feh_thumbnail_calculate_geometry(void) if (!opt.limit_w && !opt.limit_h) { if (td.im_bg) { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for index.\n" " You did specify a background however, so the\n" - " index size has defaulted to the size of the image\n"); + " index size has defaulted to the size of the image\n", + stdout); opt.limit_w = td.bg_w; opt.limit_h = td.bg_h; } else { if (opt.verbose) - fprintf(stdout, - PACKAGE + fputs(PACKAGE " - No size restriction specified for index.\n" - " Using defaults (width limited to 640)\n"); + " Using defaults (width limited to 640)\n", + stdout); opt.limit_w = 640; } } -- cgit v1.2.3