Change E[v]snprintf -> [v]snprintf

This commit is contained in:
Kim Woelders 2021-08-31 07:38:38 +02:00
parent 9cb4561227
commit 87a3dbceac
24 changed files with 198 additions and 202 deletions

View File

@ -486,7 +486,7 @@ Epplet_Init(const char *name, const char *version, const char *info,
/* set the client machine name */ /* set the client machine name */
if (!uname(&ubuf)) if (!uname(&ubuf))
{ {
Esnprintf(s, sizeof(s), "%s", ubuf.nodename); snprintf(s, sizeof(s), "%s", ubuf.nodename);
xtp.encoding = XA_STRING; xtp.encoding = XA_STRING;
xtp.format = 8; xtp.format = 8;
xtp.value = (unsigned char *)s; xtp.value = (unsigned char *)s;
@ -520,11 +520,11 @@ Epplet_Init(const char *name, const char *version, const char *info,
win_info = info; win_info = info;
xid_context = XUniqueContext(); xid_context = XUniqueContext();
CommsSetup(); CommsSetup();
Esnprintf(s, sizeof(s), "set clientname %s", win_name); snprintf(s, sizeof(s), "set clientname %s", win_name);
ECommsSend(s); ECommsSend(s);
Esnprintf(s, sizeof(s), "set version %s", win_version); snprintf(s, sizeof(s), "set version %s", win_version);
ECommsSend(s); ECommsSend(s);
Esnprintf(s, sizeof(s), "set info %s", win_info); snprintf(s, sizeof(s), "set info %s", win_info);
ECommsSend(s); ECommsSend(s);
ESYNC; ESYNC;
@ -932,7 +932,7 @@ Epplet_cleanup(void)
if (conf_dir) if (conf_dir)
{ {
/* remove lock file */ /* remove lock file */
Esnprintf(s, sizeof(s), "%s/.lock_%i", conf_dir, epplet_instance); snprintf(s, sizeof(s), "%s/.lock_%i", conf_dir, epplet_instance);
if (unlink(s) < 0) if (unlink(s) < 0)
{ {
Epplet_dialog_ok("Unable to remove lock file %s -- %s.\n", Epplet_dialog_ok("Unable to remove lock file %s -- %s.\n",
@ -970,7 +970,7 @@ Epplet_remember(void)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "wop %x snap all auto", (unsigned int)mainwin->win); snprintf(s, sizeof(s), "wop %x snap all auto", (unsigned int)mainwin->win);
ECommsSend(s); ECommsSend(s);
} }
@ -979,7 +979,7 @@ Epplet_unremember(void)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "wop %x snap none", (unsigned int)mainwin->win); snprintf(s, sizeof(s), "wop %x snap none", (unsigned int)mainwin->win);
ECommsSend(s); ECommsSend(s);
ESYNC; ESYNC;
} }
@ -995,8 +995,8 @@ Epplet_imageclass_apply(const char *iclass, const char *state, Window ww)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "imageclass %s apply 0x%x %s", iclass, snprintf(s, sizeof(s), "imageclass %s apply 0x%x %s", iclass,
(unsigned int)ww, state); (unsigned int)ww, state);
ECommsSend(s); ECommsSend(s);
} }
@ -1009,8 +1009,8 @@ Epplet_imageclass_paste(const char *iclass, const char *state, Window ww,
GC gc = 0; GC gc = 0;
XGCValues gcv; XGCValues gcv;
Esnprintf(s, sizeof(s), "imageclass %s apply_copy 0x%x %s %i %i", iclass, snprintf(s, sizeof(s), "imageclass %s apply_copy 0x%x %s %i %i", iclass,
(unsigned int)ww, state, w, h); (unsigned int)ww, state, w, h);
ECommsSend(s); ECommsSend(s);
msg = ECommsWaitForMessage(); msg = ECommsWaitForMessage();
if (msg) if (msg)
@ -1021,8 +1021,8 @@ Epplet_imageclass_paste(const char *iclass, const char *state, Window ww,
XSetClipMask(disp, gc, m); XSetClipMask(disp, gc, m);
XSetClipOrigin(disp, gc, x, y); XSetClipOrigin(disp, gc, x, y);
XCopyArea(disp, p, context_win->win, gc, 0, 0, w, h, x, y); XCopyArea(disp, p, context_win->win, gc, 0, 0, w, h, x, y);
Esnprintf(s, sizeof(s), "imageclass %s free_pixmap 0x%x", iclass, snprintf(s, sizeof(s), "imageclass %s free_pixmap 0x%x", iclass,
(unsigned int)p); (unsigned int)p);
ECommsSend(s); ECommsSend(s);
XFreeGC(disp, gc); XFreeGC(disp, gc);
} }
@ -1037,8 +1037,8 @@ Epplet_imageclass_get_pixmaps(const char *iclass, const char *state, Pixmap * p,
GC gc = 0, mgc = 0; GC gc = 0, mgc = 0;
XGCValues gcv; XGCValues gcv;
Esnprintf(s, sizeof(s), "imageclass %s apply_copy 0x%x %s %i %i", iclass, snprintf(s, sizeof(s), "imageclass %s apply_copy 0x%x %s %i %i", iclass,
(unsigned int)context_win->win, state, w, h); (unsigned int)context_win->win, state, w, h);
ECommsSend(s); ECommsSend(s);
msg = ECommsWaitForMessage(); msg = ECommsWaitForMessage();
if (msg) if (msg)
@ -1063,8 +1063,8 @@ Epplet_imageclass_get_pixmaps(const char *iclass, const char *state, Pixmap * p,
mgc = XCreateGC(disp, *m, 0, &gcv); mgc = XCreateGC(disp, *m, 0, &gcv);
XCopyArea(disp, mm, *m, mgc, 0, 0, w, h, 0, 0); XCopyArea(disp, mm, *m, mgc, 0, 0, w, h, 0, 0);
} }
Esnprintf(s, sizeof(s), "imageclass %s free_pixmap 0x%x", iclass, snprintf(s, sizeof(s), "imageclass %s free_pixmap 0x%x", iclass,
(unsigned int)pp); (unsigned int)pp);
ECommsSend(s); ECommsSend(s);
if (*p) if (*p)
XFreeGC(disp, gc); XFreeGC(disp, gc);
@ -1079,8 +1079,8 @@ Epplet_textclass_draw(const char *iclass, const char *state, Window ww, int x,
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "textclass %s apply 0x%x %i %i %s %s", iclass, snprintf(s, sizeof(s), "textclass %s apply 0x%x %i %i %s %s", iclass,
(unsigned int)ww, x, y, state, txt); (unsigned int)ww, x, y, state, txt);
ECommsSend(s); ECommsSend(s);
} }
@ -1089,7 +1089,7 @@ Epplet_textclass_get_size(const char *iclass, int *w, int *h, const char *txt)
{ {
char s[1024], *msg = NULL; char s[1024], *msg = NULL;
Esnprintf(s, sizeof(s), "textclass %s query_size %s", iclass, txt); snprintf(s, sizeof(s), "textclass %s query_size %s", iclass, txt);
ECommsSend(s); ECommsSend(s);
msg = ECommsWaitForMessage(); msg = ECommsWaitForMessage();
if (msg) if (msg)
@ -1785,7 +1785,7 @@ ECommsSend(const char *s)
for (i = 0; i < len + 1; i += 12) for (i = 0; i < len + 1; i += 12)
{ {
Esnprintf(ss, sizeof(ss), "%8x", (int)my_win); snprintf(ss, sizeof(ss), "%8x", (int)my_win);
for (j = 0; j < 12; j++) for (j = 0; j < 12; j++)
{ {
ss[8 + j] = s[i + j]; ss[8 + j] = s[i + j];
@ -1911,7 +1911,7 @@ Epplet_find_file(const char *name)
return Estrdup(name); return Estrdup(name);
/* Check if in epplet data dir */ /* Check if in epplet data dir */
Esnprintf(s, sizeof(s), "%s/%s", Epplet_data_dir(), name); snprintf(s, sizeof(s), "%s/%s", Epplet_data_dir(), name);
if (stat(s, &st) == 0) if (stat(s, &st) == 0)
return Estrdup(s); return Estrdup(s);
@ -2732,7 +2732,7 @@ Epplet_draw_button(Epplet_gadget eg)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "EPPLET_%s", g->std); snprintf(s, sizeof(s), "EPPLET_%s", g->std);
Epplet_imageclass_get_pixmaps(s, state, Epplet_imageclass_get_pixmaps(s, state,
&(g->pmap), &(g->mask), g->w, g->h); &(g->pmap), &(g->mask), g->w, g->h);
} }
@ -3847,7 +3847,7 @@ Epplet_draw_popupbutton(Epplet_gadget eg)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "EPPLET_%s", g->std); snprintf(s, sizeof(s), "EPPLET_%s", g->std);
Epplet_imageclass_get_pixmaps(s, state, Epplet_imageclass_get_pixmaps(s, state,
&(g->pmap), &(g->mask), g->w, g->h); &(g->pmap), &(g->mask), g->w, g->h);
} }
@ -5371,7 +5371,7 @@ Epplet_show_about(const char *name __UNUSED__)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "edox %s/ABOUT", Epplet_data_dir()); snprintf(s, sizeof(s), "edox %s/ABOUT", Epplet_data_dir());
Epplet_spawn_command(s); Epplet_spawn_command(s);
} }
@ -5382,7 +5382,7 @@ Epplet_dialog_ok(const char *fmt, ...)
char buf[1000], s[1024]; char buf[1000], s[1024];
va_start(args, fmt); va_start(args, fmt);
Evsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
if (!dd) if (!dd)
@ -5391,7 +5391,7 @@ Epplet_dialog_ok(const char *fmt, ...)
return; return;
} }
Esnprintf(s, sizeof(s), "dialog_ok %s", buf); snprintf(s, sizeof(s), "dialog_ok %s", buf);
ECommsSend(s); ECommsSend(s);
} }
@ -5405,24 +5405,24 @@ Epplet_find_instance(const char *name)
pid_t pid; pid_t pid;
/* Set epplet data dir */ /* Set epplet data dir */
Esnprintf(s, sizeof(s), ENLIGHTENMENT_ROOT "/epplet_data/%s", name); snprintf(s, sizeof(s), ENLIGHTENMENT_ROOT "/epplet_data/%s", name);
data_dir = Estrdup(s); data_dir = Estrdup(s);
/* Find E dir */ /* Find E dir */
Esnprintf(s, sizeof(s), "%s/.e16", getenv("HOME")); snprintf(s, sizeof(s), "%s/.e16", getenv("HOME"));
if (stat(s, &st) < 0) if (stat(s, &st) < 0)
{ {
Esnprintf(s, sizeof(s), "%s/.enlightenment", getenv("HOME")); snprintf(s, sizeof(s), "%s/.enlightenment", getenv("HOME"));
if (stat(s, &st) < 0) if (stat(s, &st) < 0)
{ {
Esnprintf(s, sizeof(s), "%s/.enlightenment", getenv("HOME")); snprintf(s, sizeof(s), "%s/.enlightenment", getenv("HOME"));
mkdir(s, S_IRWXU); mkdir(s, S_IRWXU);
} }
} }
e16_user_dir = strdup(s); e16_user_dir = strdup(s);
/* make sure basic dir exists */ /* make sure basic dir exists */
Esnprintf(s, sizeof(s), "%s/epplet_config", Epplet_e16_user_dir()); snprintf(s, sizeof(s), "%s/epplet_config", Epplet_e16_user_dir());
if (stat(s, &st) < 0) if (stat(s, &st) < 0)
{ {
if (mkdir(s, S_IRWXU) < 0) if (mkdir(s, S_IRWXU) < 0)
@ -5436,7 +5436,7 @@ Epplet_find_instance(const char *name)
} }
/* make sure this epplet's config dir exists */ /* make sure this epplet's config dir exists */
Esnprintf(s, sizeof(s), "%s/epplet_config/%s", Epplet_e16_user_dir(), name); snprintf(s, sizeof(s), "%s/epplet_config/%s", Epplet_e16_user_dir(), name);
conf_dir = strdup(s); conf_dir = strdup(s);
if (stat(s, &st) < 0) if (stat(s, &st) < 0)
@ -5460,7 +5460,7 @@ Epplet_find_instance(const char *name)
for (i = 1; i < 256; i++) for (i = 1; i < 256; i++)
{ {
Esnprintf(s, sizeof(s), "%s/.lock_%i", conf_dir, i); snprintf(s, sizeof(s), "%s/.lock_%i", conf_dir, i);
exists = stat(s, &st) == 0; exists = stat(s, &st) == 0;
@ -5557,7 +5557,7 @@ Epplet_find_instance(const char *name)
/* find out epplet's name */ /* find out epplet's name */
if (epplet_instance > 1) if (epplet_instance > 1)
{ {
Esnprintf(s, sizeof(s), "%s-%i", name, epplet_instance); snprintf(s, sizeof(s), "%s-%i", name, epplet_instance);
epplet_name = strdup(s); epplet_name = strdup(s);
} }
else else
@ -5622,7 +5622,7 @@ Epplet_load_config(void)
return; return;
/* create config file name */ /* create config file name */
Esnprintf(s, sizeof(s), "%s/%s.cfg", conf_dir, epplet_name); snprintf(s, sizeof(s), "%s/%s.cfg", conf_dir, epplet_name);
epplet_cfg_file = strdup(s); epplet_cfg_file = strdup(s);
Epplet_load_config_file(epplet_cfg_file); Epplet_load_config_file(epplet_cfg_file);
@ -5780,7 +5780,7 @@ Epplet_modify_multi_config(const char *shortkey, char **values, int num)
return; return;
/* build the actual key: */ /* build the actual key: */
Esnprintf(key, sizeof(key), "__%s__", shortkey); snprintf(key, sizeof(key), "__%s__", shortkey);
matches = 0; matches = 0;
/* first wipe out old ones */ /* first wipe out old ones */
@ -5823,7 +5823,7 @@ Epplet_modify_multi_config(const char *shortkey, char **values, int num)
(config_dict->num_entries - matches + num)); (config_dict->num_entries - matches + num));
for (i = 0, j = config_dict->num_entries - matches; i < num; i++, j++) for (i = 0, j = config_dict->num_entries - matches; i < num; i++, j++)
{ {
Esnprintf(key2, sizeof(key2), "%s%i", key, i); snprintf(key2, sizeof(key2), "%s%i", key, i);
config_dict->entries[j].key = strdup(key2); config_dict->entries[j].key = strdup(key2);
config_dict->entries[j].value = strdup(values[i]); config_dict->entries[j].value = strdup(values[i]);
} }
@ -5842,7 +5842,7 @@ Epplet_query_multi_config(const char *shortkey, int *num)
return NULL; return NULL;
/* build the actual key: */ /* build the actual key: */
Esnprintf(key, sizeof(key), "__%s__", shortkey); snprintf(key, sizeof(key), "__%s__", shortkey);
*num = 0; *num = 0;
for (i = 0; i < config_dict->num_entries; i++) for (i = 0; i < config_dict->num_entries; i++)

View File

@ -35,9 +35,6 @@
#define __sun__ #define __sun__
#endif #endif
#define Evsnprintf vsnprintf
#define Esnprintf snprintf
/****************************************************************************/ /****************************************************************************/
/* Data structures & primitives */ /* Data structures & primitives */
/****************************************************************************/ /****************************************************************************/

View File

@ -25,7 +25,7 @@ main(int argc, char **argv)
result = Epplet_query_config_def("USE_COUNT", "0"); result = Epplet_query_config_def("USE_COUNT", "0");
use_count = atoi(result); use_count = atoi(result);
use_count++; use_count++;
Esnprintf(s, sizeof(s), "%i", use_count); snprintf(s, sizeof(s), "%i", use_count);
Epplet_modify_config("USE_COUNT", s); Epplet_modify_config("USE_COUNT", s);
printf("Dump before modification:\n"); printf("Dump before modification:\n");
@ -51,10 +51,10 @@ main(int argc, char **argv)
if (results) if (results)
free(results); free(results);
Esnprintf(s, sizeof(s), "Instance %i", Epplet_get_instance()); snprintf(s, sizeof(s), "Instance %i", Epplet_get_instance());
Epplet_gadget_show(Epplet_create_label(10, 2, s, 0)); Epplet_gadget_show(Epplet_create_label(10, 2, s, 0));
Esnprintf(s, sizeof(s), "Used %i times.", use_count); snprintf(s, sizeof(s), "Used %i times.", use_count);
Epplet_gadget_show(Epplet_create_label(10, 14, s, 0)); Epplet_gadget_show(Epplet_create_label(10, 14, s, 0));
Epplet_gadget_show(Epplet_create_button(NULL, NULL, Epplet_gadget_show(Epplet_create_button(NULL, NULL,

View File

@ -95,7 +95,7 @@ timer_cb(void *data __UNUSED__)
if (in_bytes > max_in) if (in_bytes > max_in)
{ {
max_in = in_bytes; max_in = in_bytes;
Esnprintf(buff, sizeof(buff), "%lu", max_in); snprintf(buff, sizeof(buff), "%lu", max_in);
Epplet_modify_config("max_in", buff); Epplet_modify_config("max_in", buff);
D(("Set max_in to %lu\n", max_in)); D(("Set max_in to %lu\n", max_in));
} }
@ -114,7 +114,7 @@ timer_cb(void *data __UNUSED__)
if (out_bytes > max_out) if (out_bytes > max_out)
{ {
max_out = out_bytes; max_out = out_bytes;
Esnprintf(buff, sizeof(buff), "%lu", max_out); snprintf(buff, sizeof(buff), "%lu", max_out);
Epplet_modify_config("max_out", buff); Epplet_modify_config("max_out", buff);
D(("Set max_out to %lu\n", max_out)); D(("Set max_out to %lu\n", max_out));
} }

View File

@ -62,10 +62,9 @@ display_count(void)
char label_text[64]; char label_text[64];
if (show_total) if (show_total)
Esnprintf(label_text, sizeof(label_text), "%lu / %lu", new_cnt, snprintf(label_text, sizeof(label_text), "%lu / %lu", new_cnt, total_cnt);
total_cnt);
else else
Esnprintf(label_text, sizeof(label_text), "%lu", new_cnt); snprintf(label_text, sizeof(label_text), "%lu", new_cnt);
Epplet_change_label(cnt_label, label_text); Epplet_change_label(cnt_label, label_text);
} }
@ -446,7 +445,7 @@ main(int argc, char **argv)
} }
} }
s = (char *)malloc(sizeof(MAIL_PATH "/") + strlen(username) + 1); s = (char *)malloc(sizeof(MAIL_PATH "/") + strlen(username) + 1);
/* Whoever changed the next line to Esnprintf(), DON'T. The size has already been calculated. /* Whoever changed the next line to snprintf(), DON'T. The size has already been calculated.
* Besides, the sizeof() operator returns sizeof(char *) here, not the array size. -- mej */ * Besides, the sizeof() operator returns sizeof(char *) here, not the array size. -- mej */
sprintf(s, MAIL_PATH "/%s", username); sprintf(s, MAIL_PATH "/%s", username);
D(("Generated folder path of \"%s\"\n", s)); D(("Generated folder path of \"%s\"\n", s));

View File

@ -383,11 +383,11 @@ save_conf(int d1, int d2, int d3, int d4, int d5, int d6, int d7, int d8,
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "%d %d %d", d1, d2, d3); snprintf(s, sizeof(s), "%d %d %d", d1, d2, d3);
Epplet_modify_config("color1", s); Epplet_modify_config("color1", s);
Esnprintf(s, sizeof(s), "%d %d %d", d4, d5, d6); snprintf(s, sizeof(s), "%d %d %d", d4, d5, d6);
Epplet_modify_config("color2", s); Epplet_modify_config("color2", s);
Esnprintf(s, sizeof(s), "%d %d %d", d7, d8, d9); snprintf(s, sizeof(s), "%d %d %d", d7, d8, d9);
Epplet_modify_config("color3", s); Epplet_modify_config("color3", s);
sprintf(s, "%d", include_nice); sprintf(s, "%d", include_nice);
Epplet_modify_config("nice", s); Epplet_modify_config("nice", s);

View File

@ -128,7 +128,7 @@ timer_cb(void *data __UNUSED__)
if (in_blks > max_in) if (in_blks > max_in)
{ {
max_in = in_blks; max_in = in_blks;
Esnprintf(buff, sizeof(buff), "%lu", max_in); snprintf(buff, sizeof(buff), "%lu", max_in);
Epplet_modify_config("max_in", buff); Epplet_modify_config("max_in", buff);
} }
if (in_blks != in_delta) if (in_blks != in_delta)
@ -150,7 +150,7 @@ timer_cb(void *data __UNUSED__)
if (out_blks > max_out) if (out_blks > max_out)
{ {
max_out = out_blks; max_out = out_blks;
Esnprintf(buff, sizeof(buff), "%lu", max_out); snprintf(buff, sizeof(buff), "%lu", max_out);
Epplet_modify_config("max_out", buff); Epplet_modify_config("max_out", buff);
} }
if (out_blks != out_delta) if (out_blks != out_delta)

View File

@ -52,11 +52,11 @@ timer_cb(void *data __UNUSED__)
Epplet_gadget_data_changed(vbar2); Epplet_gadget_data_changed(vbar2);
Epplet_gadget_data_changed(vbar3); Epplet_gadget_data_changed(vbar3);
Esnprintf(buff, sizeof(buff), "%3.2f", d1); snprintf(buff, sizeof(buff), "%3.2f", d1);
Epplet_change_label(label1, buff); Epplet_change_label(label1, buff);
Esnprintf(buff, sizeof(buff), "%3.2f", d2); snprintf(buff, sizeof(buff), "%3.2f", d2);
Epplet_change_label(label2, buff); Epplet_change_label(label2, buff);
Esnprintf(buff, sizeof(buff), "%3.2f", d3); snprintf(buff, sizeof(buff), "%3.2f", d3);
Epplet_change_label(label3, buff); Epplet_change_label(label3, buff);
Epplet_timer(timer_cb, NULL, 5.0, "TIMER"); Epplet_timer(timer_cb, NULL, 5.0, "TIMER");

View File

@ -294,7 +294,7 @@ parse_config(void)
image = Epplet_query_config_def("image", "8ball.png"); image = Epplet_query_config_def("image", "8ball.png");
Esnprintf(ss, sizeof(ss), "%s/answers.txt", Epplet_data_dir()); snprintf(ss, sizeof(ss), "%s/answers.txt", Epplet_data_dir());
ans_file = Epplet_query_config_def("answers", ss); ans_file = Epplet_query_config_def("answers", ss);
if (!parse_answers(ans_file) && !parse_answers(ans_file = ss)) if (!parse_answers(ans_file) && !parse_answers(ans_file = ss))
{ {

View File

@ -106,19 +106,19 @@ timer_cb(void *data __UNUSED__)
Epplet_gadget_data_changed(mem_bar); Epplet_gadget_data_changed(mem_bar);
if (used < 1024) if (used < 1024)
{ {
Esnprintf(buff, sizeof(buff), "M: %lub", used); snprintf(buff, sizeof(buff), "M: %lub", used);
} }
else if (used < 1024 * 1024) else if (used < 1024 * 1024)
{ {
Esnprintf(buff, sizeof(buff), "M: %luK", used / 1024); snprintf(buff, sizeof(buff), "M: %luK", used / 1024);
} }
else if (used < 1024 * 1024 * 1024) else if (used < 1024 * 1024 * 1024)
{ {
Esnprintf(buff, sizeof(buff), "M: %luM", used / (1024 * 1024)); snprintf(buff, sizeof(buff), "M: %luM", used / (1024 * 1024));
} }
else else
{ {
Esnprintf(buff, sizeof(buff), "M: %luG", used / (1024 * 1024 * 1024)); snprintf(buff, sizeof(buff), "M: %luG", used / (1024 * 1024 * 1024));
} }
Epplet_change_label(mem_label, buff); Epplet_change_label(mem_label, buff);
@ -170,19 +170,19 @@ timer_cb(void *data __UNUSED__)
Epplet_gadget_data_changed(swap_bar); Epplet_gadget_data_changed(swap_bar);
if (used < 1024) if (used < 1024)
{ {
Esnprintf(buff, sizeof(buff), "S: %lub", used); snprintf(buff, sizeof(buff), "S: %lub", used);
} }
else if (used < 1024 * 1024) else if (used < 1024 * 1024)
{ {
Esnprintf(buff, sizeof(buff), "S: %luK", used / 1024); snprintf(buff, sizeof(buff), "S: %luK", used / 1024);
} }
else if (used < 1024 * 1024 * 1024) else if (used < 1024 * 1024 * 1024)
{ {
Esnprintf(buff, sizeof(buff), "S: %luM", used / (1024 * 1024)); snprintf(buff, sizeof(buff), "S: %luM", used / (1024 * 1024));
} }
else else
{ {
Esnprintf(buff, sizeof(buff), "S: %luG", used / (1024 * 1024 * 1024)); snprintf(buff, sizeof(buff), "S: %luG", used / (1024 * 1024 * 1024));
} }
Epplet_change_label(swap_label, buff); Epplet_change_label(swap_label, buff);

View File

@ -55,7 +55,7 @@ moonclock_cb(void *data __UNUSED__)
if (ImageNumber > 59) if (ImageNumber > 59)
ImageNumber = 0; ImageNumber = 0;
Esnprintf(buf, sizeof(buf), "E-MoonClock-%02d.png", ImageNumber); snprintf(buf, sizeof(buf), "E-MoonClock-%02d.png", ImageNumber);
moon_pixmap = Epplet_create_image(2, 2, 43, 43, buf); moon_pixmap = Epplet_create_image(2, 2, 43, 43, buf);
Epplet_gadget_show(moon_pixmap); Epplet_gadget_show(moon_pixmap);

View File

@ -429,7 +429,7 @@ Callback_ConfigInterval(void *data __UNUSED__)
{ {
char s[64]; char s[64];
Esnprintf(s, sizeof(s), "%i s", mode.polling_interval); snprintf(s, sizeof(s), "%i s", mode.polling_interval);
Epplet_change_label(label_interval, s); Epplet_change_label(label_interval, s);
} }
@ -868,8 +868,8 @@ AddMountPoint(char *device, char *path)
{ {
char buf[1024]; char buf[1024];
Esnprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
Epplet_data_dir(), __DEFAULT); Epplet_data_dir(), __DEFAULT);
tmp_image = imlib_load_image(buf); tmp_image = imlib_load_image(buf);
} }
if (!tmp_image) if (!tmp_image)
@ -1101,7 +1101,7 @@ Mount(MountPoint * mp)
return; return;
if (mp->path) if (mp->path)
{ {
Esnprintf(s, sizeof(s), "%s %s", MOUNT, mp->path); snprintf(s, sizeof(s), "%s %s", MOUNT, mp->path);
if (!Epplet_run_command(s)) if (!Epplet_run_command(s))
{ {
mp->mounted = 1; mp->mounted = 1;
@ -1129,7 +1129,7 @@ Umount(MountPoint * mp)
return; return;
if (mp->path) if (mp->path)
{ {
Esnprintf(s, sizeof(s), "%s %s", UMOUNT, mp->path); snprintf(s, sizeof(s), "%s %s", UMOUNT, mp->path);
if (!Epplet_run_command(s)) if (!Epplet_run_command(s))
{ {
mp->mounted = 0; mp->mounted = 0;
@ -1138,7 +1138,7 @@ Umount(MountPoint * mp)
#ifdef HAVE_EJECT #ifdef HAVE_EJECT
if (mode.eject_mode == AUTO_EJECT) if (mode.eject_mode == AUTO_EJECT)
{ {
Esnprintf(s, sizeof(s), "%s %s", EJECT, mp->device); snprintf(s, sizeof(s), "%s %s", EJECT, mp->device);
Epplet_run_command(s); Epplet_run_command(s);
} }
#endif #endif
@ -1474,7 +1474,7 @@ CallbackButtonUp(void *data __UNUSED__, Window win, int x, int y, int b)
#ifdef HAVE_EJECT #ifdef HAVE_EJECT
else if (b == 3 && mode.eject_mode == MANUAL_EJECT) else if (b == 3 && mode.eject_mode == MANUAL_EJECT)
{ {
Esnprintf(s, sizeof(s), "%s %s", EJECT, mountpoint->device); snprintf(s, sizeof(s), "%s %s", EJECT, mountpoint->device);
Epplet_run_command(s); Epplet_run_command(s);
} }
#endif #endif
@ -1483,8 +1483,8 @@ CallbackButtonUp(void *data __UNUSED__, Window win, int x, int y, int b)
Epplet_gadget popup = Epplet_create_popup(); Epplet_gadget popup = Epplet_create_popup();
s[0] = 0; s[0] = 0;
Esnprintf(s, sizeof(s), "%s at %s.", mountpoint->device, snprintf(s, sizeof(s), "%s at %s.", mountpoint->device,
mountpoint->path); mountpoint->path);
Epplet_add_popup_entry(popup, s, NULL, NULL, NULL); Epplet_add_popup_entry(popup, s, NULL, NULL, NULL);
Epplet_pop_popup(popup, 0); Epplet_pop_popup(popup, 0);
} }
@ -1553,7 +1553,7 @@ SetupDefaults(void)
} }
instance = atoi(Epplet_query_config_def("INSTANCE", "0")); instance = atoi(Epplet_query_config_def("INSTANCE", "0"));
Esnprintf(s2, sizeof(s2), "%i", ++instance); snprintf(s2, sizeof(s2), "%i", ++instance);
Epplet_modify_config("INSTANCE", s2); Epplet_modify_config("INSTANCE", s2);
mode.eject_mode = (EjectMode) atoi(Epplet_query_config("EJECT_MODE")); mode.eject_mode = (EjectMode) atoi(Epplet_query_config("EJECT_MODE"));
@ -1618,7 +1618,7 @@ SetupGraphx(void)
tmp = imlib_load_image(s); tmp = imlib_load_image(s);
if (!tmp) if (!tmp)
{ {
Esnprintf(buf, sizeof(buf), "%s/%s", Epplet_data_dir(), __BG_IMAGE); snprintf(buf, sizeof(buf), "%s/%s", Epplet_data_dir(), __BG_IMAGE);
tmp = imlib_load_image(buf); tmp = imlib_load_image(buf);
} }
if (!tmp) if (!tmp)
@ -1765,13 +1765,13 @@ SyncConfigs(void)
int i; int i;
MountPointType *mpt = NULL; MountPointType *mpt = NULL;
Esnprintf(s, sizeof(s), "%i", (int)mode.eject_mode); snprintf(s, sizeof(s), "%i", (int)mode.eject_mode);
Epplet_modify_config("EJECT_MODE", s); Epplet_modify_config("EJECT_MODE", s);
Esnprintf(s, sizeof(s), "%i", mode.do_polling); snprintf(s, sizeof(s), "%i", mode.do_polling);
Epplet_modify_config("DO_POLL", s); Epplet_modify_config("DO_POLL", s);
Esnprintf(s, sizeof(s), "%i", mode.polling_interval); snprintf(s, sizeof(s), "%i", mode.polling_interval);
Epplet_modify_config("POLLINTVAL", s); Epplet_modify_config("POLLINTVAL", s);
strings = (char **)malloc(sizeof(char *) * num_types); strings = (char **)malloc(sizeof(char *) * num_types);
@ -1779,7 +1779,7 @@ SyncConfigs(void)
{ {
for (mpt = types, i = 0; mpt; mpt = mpt->next, i++) for (mpt = types, i = 0; mpt; mpt = mpt->next, i++)
{ {
Esnprintf(s, sizeof(s), "%s %s", mpt->key, mpt->imagefile); snprintf(s, sizeof(s), "%s %s", mpt->key, mpt->imagefile);
strings[i] = strdup(s); strings[i] = strdup(s);
} }

View File

@ -56,9 +56,9 @@ save_conf(void)
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "%f", upstream_max); snprintf(s, sizeof(s), "%f", upstream_max);
Epplet_modify_config("upstream_max", s); Epplet_modify_config("upstream_max", s);
Esnprintf(s, sizeof(s), "%f", downstream_max); snprintf(s, sizeof(s), "%f", downstream_max);
Epplet_modify_config("downstream_max", s); Epplet_modify_config("downstream_max", s);
Epplet_save_config(); Epplet_save_config();
} }

View File

@ -296,7 +296,7 @@ epplet_bandwidth(void *data)
d = (double *)data; d = (double *)data;
stream_max = d[0]; stream_max = d[0];
Esnprintf(s, sizeof(s), "%f", stream_max); snprintf(s, sizeof(s), "%f", stream_max);
Epplet_modify_config("bandwidth", s); Epplet_modify_config("bandwidth", s);
Epplet_save_config(); Epplet_save_config();
Epplet_gadget_hide(pop); Epplet_gadget_hide(pop);
@ -349,13 +349,13 @@ save_conf(int d1, int d2, int d3, int d4, int d5,
{ {
char s[1024]; char s[1024];
Esnprintf(s, sizeof(s), "%d %d %d", d1, d2, d3); snprintf(s, sizeof(s), "%d %d %d", d1, d2, d3);
Epplet_modify_config("color1", s); Epplet_modify_config("color1", s);
Esnprintf(s, sizeof(s), "%d %d %d", d4, d5, d6); snprintf(s, sizeof(s), "%d %d %d", d4, d5, d6);
Epplet_modify_config("color2", s); Epplet_modify_config("color2", s);
Esnprintf(s, sizeof(s), "%d %d %d", d7, d8, d9); snprintf(s, sizeof(s), "%d %d %d", d7, d8, d9);
Epplet_modify_config("color3", s); Epplet_modify_config("color3", s);
Esnprintf(s, sizeof(s), "%f", stream_max); snprintf(s, sizeof(s), "%f", stream_max);
Epplet_modify_config("bandwidth", s); Epplet_modify_config("bandwidth", s);
Epplet_save_config(); Epplet_save_config();
} }

View File

@ -342,11 +342,11 @@ save_conf(void)
{ {
char s[8]; char s[8];
Esnprintf(s, sizeof(s), "%i", gWhichRotate); snprintf(s, sizeof(s), "%i", gWhichRotate);
Epplet_modify_config("gWhichRotate", s); Epplet_modify_config("gWhichRotate", s);
Esnprintf(s, sizeof(s), "%i", gLighting); snprintf(s, sizeof(s), "%i", gLighting);
Epplet_modify_config("gLighting", s); Epplet_modify_config("gLighting", s);
Esnprintf(s, sizeof(s), "%i", gTexturing); snprintf(s, sizeof(s), "%i", gTexturing);
Epplet_modify_config("gTexturing", s); Epplet_modify_config("gTexturing", s);
Epplet_save_config(); Epplet_save_config();
@ -453,7 +453,7 @@ main(int argc, char **argv)
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
/* Lets load teh texture */ /* Lets load teh texture */
Esnprintf(buf, sizeof(buf), "%s/cube_texture.RGB", Epplet_data_dir()); snprintf(buf, sizeof(buf), "%s/cube_texture.RGB", Epplet_data_dir());
if (!(textureFile = fopen(buf, "rb"))) if (!(textureFile = fopen(buf, "rb")))
{ {
printf("Failed to load the cube texture file!\n"); printf("Failed to load the cube texture file!\n");

View File

@ -84,13 +84,13 @@ save_config(void)
{ {
char buf[10]; char buf[10];
Esnprintf(buf, sizeof(buf), "%f", opt.cloak_delay); snprintf(buf, sizeof(buf), "%f", opt.cloak_delay);
Epplet_modify_config("CLOAK_DELAY", buf); Epplet_modify_config("CLOAK_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%f", opt.draw_interval); snprintf(buf, sizeof(buf), "%f", opt.draw_interval);
Epplet_modify_config("DRAW_INTERVAL", buf); Epplet_modify_config("DRAW_INTERVAL", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.do_cloak); snprintf(buf, sizeof(buf), "%d", opt.do_cloak);
Epplet_modify_config("DO_CLOAK", buf); Epplet_modify_config("DO_CLOAK", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.cloak_anim); snprintf(buf, sizeof(buf), "%d", opt.cloak_anim);
Epplet_modify_config("CLOAK_ANIM", buf); Epplet_modify_config("CLOAK_ANIM", buf);
Epplet_modify_config("DIRECTORY", opt.dir); Epplet_modify_config("DIRECTORY", opt.dir);
} }

View File

@ -88,15 +88,15 @@ save_config(void)
{ {
char buf[10]; char buf[10];
Esnprintf(buf, sizeof(buf), "%.2f", opt.delay); snprintf(buf, sizeof(buf), "%.2f", opt.delay);
Epplet_modify_config("SAVE_DELAY", buf); Epplet_modify_config("SAVE_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%.2f", opt.cloak_delay); snprintf(buf, sizeof(buf), "%.2f", opt.cloak_delay);
Epplet_modify_config("CLOAK_DELAY", buf); Epplet_modify_config("CLOAK_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%.2f", opt.draw_interval); snprintf(buf, sizeof(buf), "%.2f", opt.draw_interval);
Epplet_modify_config("DRAW_INTERVAL", buf); Epplet_modify_config("DRAW_INTERVAL", buf);
Esnprintf(buf, sizeof(buf), "%.2f", opt.rand_delay); snprintf(buf, sizeof(buf), "%.2f", opt.rand_delay);
Epplet_modify_config("RAND_DELAY", buf); Epplet_modify_config("RAND_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.do_cloak); snprintf(buf, sizeof(buf), "%d", opt.do_cloak);
Epplet_modify_config("DO_CLOAK", buf); Epplet_modify_config("DO_CLOAK", buf);
if (opt.rand_cloak) if (opt.rand_cloak)
{ {
@ -104,7 +104,7 @@ save_config(void)
} }
else else
{ {
Esnprintf(buf, sizeof(buf), "%d", opt.cloak_anim); snprintf(buf, sizeof(buf), "%d", opt.cloak_anim);
} }
Epplet_modify_config("CLOAK_ANIM", buf); Epplet_modify_config("CLOAK_ANIM", buf);
Epplet_modify_config("LOCK_COMMAND", opt.lock_cmd); Epplet_modify_config("LOCK_COMMAND", opt.lock_cmd);

View File

@ -115,19 +115,19 @@ save_config(void)
{ {
char buf[10]; char buf[10];
Esnprintf(buf, sizeof(buf), "%d", opt.quality); snprintf(buf, sizeof(buf), "%d", opt.quality);
Epplet_modify_config("QUALITY", buf); Epplet_modify_config("QUALITY", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.win); snprintf(buf, sizeof(buf), "%d", opt.win);
Epplet_modify_config("WIN_AREA", buf); Epplet_modify_config("WIN_AREA", buf);
Esnprintf(buf, sizeof(buf), "%f", opt.delay); snprintf(buf, sizeof(buf), "%f", opt.delay);
Epplet_modify_config("SHOT_DELAY", buf); Epplet_modify_config("SHOT_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%f", opt.cloak_delay); snprintf(buf, sizeof(buf), "%f", opt.cloak_delay);
Epplet_modify_config("CLOAK_DELAY", buf); Epplet_modify_config("CLOAK_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%f", opt.draw_interval); snprintf(buf, sizeof(buf), "%f", opt.draw_interval);
Epplet_modify_config("DRAW_INTERVAL", buf); Epplet_modify_config("DRAW_INTERVAL", buf);
Esnprintf(buf, sizeof(buf), "%f", opt.rand_delay); snprintf(buf, sizeof(buf), "%f", opt.rand_delay);
Epplet_modify_config("RAND_DELAY", buf); Epplet_modify_config("RAND_DELAY", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.do_cloak); snprintf(buf, sizeof(buf), "%d", opt.do_cloak);
Epplet_modify_config("DO_CLOAK", buf); Epplet_modify_config("DO_CLOAK", buf);
if (opt.rand_cloak) if (opt.rand_cloak)
{ {
@ -135,20 +135,20 @@ save_config(void)
} }
else else
{ {
Esnprintf(buf, sizeof(buf), "%d", opt.cloak_anim); snprintf(buf, sizeof(buf), "%d", opt.cloak_anim);
} }
Epplet_modify_config("CLOAK_ANIM", buf); Epplet_modify_config("CLOAK_ANIM", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.frame); snprintf(buf, sizeof(buf), "%d", opt.frame);
Epplet_modify_config("WM_FRAME", buf); Epplet_modify_config("WM_FRAME", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.beep); snprintf(buf, sizeof(buf), "%d", opt.beep);
Epplet_modify_config("BEEP", buf); Epplet_modify_config("BEEP", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.run_script); snprintf(buf, sizeof(buf), "%d", opt.run_script);
Epplet_modify_config("RUN_SCRIPT", buf); Epplet_modify_config("RUN_SCRIPT", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.view_shot); snprintf(buf, sizeof(buf), "%d", opt.view_shot);
Epplet_modify_config("VIEW_SHOT", buf); Epplet_modify_config("VIEW_SHOT", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.do_ftp); snprintf(buf, sizeof(buf), "%d", opt.do_ftp);
Epplet_modify_config("DO_FTP", buf); Epplet_modify_config("DO_FTP", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.ftp_passive); snprintf(buf, sizeof(buf), "%d", opt.ftp_passive);
Epplet_modify_config("FTP_PASSIVE", buf); Epplet_modify_config("FTP_PASSIVE", buf);
Epplet_modify_config("DIRECTORY", opt.dir); Epplet_modify_config("DIRECTORY", opt.dir);
Epplet_modify_config("FILE_PREFIX", opt.file_prefix); Epplet_modify_config("FILE_PREFIX", opt.file_prefix);
@ -670,7 +670,7 @@ do_shot(void *data __UNUSED__)
char *view_buf = NULL; char *view_buf = NULL;
char *filename = NULL; char *filename = NULL;
Esnprintf(qual_buf, sizeof(qual_buf), "%d", opt.quality); snprintf(qual_buf, sizeof(qual_buf), "%d", opt.quality);
filename = filename =
_Strjoin(NULL, opt.dir, opt.file_prefix, opt.file_stamp, ".", _Strjoin(NULL, opt.dir, opt.file_prefix, opt.file_stamp, ".",
@ -681,19 +681,19 @@ do_shot(void *data __UNUSED__)
if (!strcmp(opt.grabber, "import")) if (!strcmp(opt.grabber, "import"))
{ {
if ((opt.frame) && (opt.win)) if ((opt.frame) && (opt.win))
Esnprintf(frame_buf, sizeof(frame_buf), "-frame"); snprintf(frame_buf, sizeof(frame_buf), "-frame");
else else
frame_buf[0] = '\0'; frame_buf[0] = '\0';
if (opt.beep) if (opt.beep)
beep_buf[0] = '\0'; beep_buf[0] = '\0';
else else
Esnprintf(beep_buf, sizeof(beep_buf), "-silent"); snprintf(beep_buf, sizeof(beep_buf), "-silent");
if (opt.win) if (opt.win)
Esnprintf(import_buf, sizeof(import_buf), "import"); snprintf(import_buf, sizeof(import_buf), "import");
else else
Esnprintf(import_buf, sizeof(import_buf), "import -window root"); snprintf(import_buf, sizeof(import_buf), "import -window root");
if (opt.run_script) if (opt.run_script)
script_buf = _Strjoin(" ", "&&", opt.script, "$SCRTEMP", NULL); script_buf = _Strjoin(" ", "&&", opt.script, "$SCRTEMP", NULL);
@ -715,19 +715,19 @@ do_shot(void *data __UNUSED__)
char delay_buf[20]; char delay_buf[20];
if (opt.delay > 0) if (opt.delay > 0)
Esnprintf(delay_buf, sizeof(delay_buf), "-d %.0f", opt.delay); snprintf(delay_buf, sizeof(delay_buf), "-d %.0f", opt.delay);
else else
delay_buf[0] = '\0'; delay_buf[0] = '\0';
if ((opt.frame) && (opt.win)) if ((opt.frame) && (opt.win))
Esnprintf(frame_buf, sizeof(frame_buf), "-b"); snprintf(frame_buf, sizeof(frame_buf), "-b");
else else
frame_buf[0] = '\0'; frame_buf[0] = '\0';
if (opt.win) if (opt.win)
Esnprintf(import_buf, sizeof(import_buf), "scrot -s"); snprintf(import_buf, sizeof(import_buf), "scrot -s");
else else
Esnprintf(import_buf, sizeof(import_buf), "scrot"); snprintf(import_buf, sizeof(import_buf), "scrot");
if (opt.run_script) if (opt.run_script)
script_buf = _Strjoin(" ", "&&", opt.script, "$SCRTEMP", NULL); script_buf = _Strjoin(" ", "&&", opt.script, "$SCRTEMP", NULL);

View File

@ -108,7 +108,7 @@ dirscan(char *dir, unsigned long *num)
{ {
if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
{ {
Esnprintf(fullname, sizeof(fullname), "%s/%s", dir, dp->d_name); snprintf(fullname, sizeof(fullname), "%s/%s", dir, dp->d_name);
D((" -> About to stat() %s\n", fullname)); D((" -> About to stat() %s\n", fullname));
if (stat(fullname, &filestat)) if (stat(fullname, &filestat))
{ {
@ -216,31 +216,31 @@ set_background(int tiled, int keep_aspect)
} }
free(reply); free(reply);
Esnprintf(bg_name, sizeof(bg_name), "E_SLIDES_BG_%s", filenames[CUR_PIC()]); snprintf(bg_name, sizeof(bg_name), "E_SLIDES_BG_%s", filenames[CUR_PIC()]);
Esnprintf(buff, sizeof(buff), "background %s bg.file %s/%s", bg_name, path, snprintf(buff, sizeof(buff), "background %s bg.file %s/%s", bg_name, path,
filenames[CUR_PIC()]); filenames[CUR_PIC()]);
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.solid 0 0 0", bg_name); snprintf(buff, sizeof(buff), "background %s bg.solid 0 0 0", bg_name);
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.tile %d", bg_name, tiled); snprintf(buff, sizeof(buff), "background %s bg.tile %d", bg_name, tiled);
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.keep_aspect %d", bg_name, snprintf(buff, sizeof(buff), "background %s bg.keep_aspect %d", bg_name,
keep_aspect); keep_aspect);
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.xperc %d", bg_name, snprintf(buff, sizeof(buff), "background %s bg.xperc %d", bg_name,
(tiled ? 0 : 1024)); (tiled ? 0 : 1024));
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.yperc %d", bg_name, snprintf(buff, sizeof(buff), "background %s bg.yperc %d", bg_name,
(tiled ? 0 : 1024)); (tiled ? 0 : 1024));
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.xjust %d", bg_name, snprintf(buff, sizeof(buff), "background %s bg.xjust %d", bg_name,
(tiled ? 0 : 512)); (tiled ? 0 : 512));
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "background %s bg.yjust %d", bg_name, snprintf(buff, sizeof(buff), "background %s bg.yjust %d", bg_name,
(tiled ? 0 : 512)); (tiled ? 0 : 512));
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esnprintf(buff, sizeof(buff), "use_bg %s %d", bg_name, current_desk); snprintf(buff, sizeof(buff), "use_bg %s %d", bg_name, current_desk);
Epplet_send_ipc(buff); Epplet_send_ipc(buff);
Esync(); Esync();
} }
@ -332,7 +332,7 @@ zoom_cb(void *data __UNUSED__)
{ {
char buff[1024]; char buff[1024];
Esnprintf(buff, sizeof(buff), zoom_cmd, filenames[CUR_PIC()]); snprintf(buff, sizeof(buff), zoom_cmd, filenames[CUR_PIC()]);
Epplet_spawn_command(buff); Epplet_spawn_command(buff);
} }
@ -614,7 +614,7 @@ parse_config(void)
s = Epplet_query_config("image_dir"); s = Epplet_query_config("image_dir");
if (!s) if (!s)
{ {
Esnprintf(buff, sizeof(buff), "%s/backgrounds", Epplet_e16_user_dir()); snprintf(buff, sizeof(buff), "%s/backgrounds", Epplet_e16_user_dir());
path = strdup(buff); path = strdup(buff);
Epplet_add_config("image_dir", buff); Epplet_add_config("image_dir", buff);
} }

View File

@ -81,11 +81,11 @@ timer_cb(void *data __UNUSED__)
} }
delay = (double)secs; delay = (double)secs;
Esnprintf(buff, sizeof(buff), "%lu days", days); snprintf(buff, sizeof(buff), "%lu days", days);
Epplet_change_label(label2, buff); Epplet_change_label(label2, buff);
Esnprintf(buff, sizeof(buff), "%lu hours", hours); snprintf(buff, sizeof(buff), "%lu hours", hours);
Epplet_change_label(label3, buff); Epplet_change_label(label3, buff);
Esnprintf(buff, sizeof(buff), "%lu mins", mins); snprintf(buff, sizeof(buff), "%lu mins", mins);
Epplet_change_label(label4, buff); Epplet_change_label(label4, buff);
Esync(); Esync();

View File

@ -48,7 +48,7 @@ timer_cb(void *data __UNUSED__)
if (timezone_str && *timezone_str) if (timezone_str && *timezone_str)
{ {
Esnprintf(tm, sizeof(tm), "TZ=%s", timezone_str); snprintf(tm, sizeof(tm), "TZ=%s", timezone_str);
putenv(tm); putenv(tm);
} }
t2 = time(NULL); t2 = time(NULL);
@ -117,7 +117,7 @@ apply_config(void)
Epplet_gadget_move(label2, 4 * just, 15); Epplet_gadget_move(label2, 4 * just, 15);
Epplet_gadget_move(label3, 4 * just, 26); Epplet_gadget_move(label3, 4 * just, 26);
Epplet_gadget_move(label4, 4 * just, 36); Epplet_gadget_move(label4, 4 * just, 36);
Esnprintf(buff, sizeof(buff), "%d", just); snprintf(buff, sizeof(buff), "%d", just);
Epplet_modify_config("just", buff); Epplet_modify_config("just", buff);
} }

View File

@ -411,31 +411,31 @@ config_cb(void *data __UNUSED__)
Epplet_gadget_show(cfg_gads[i].cfg_tb_image); Epplet_gadget_show(cfg_gads[i].cfg_tb_image);
x += 100; x += 100;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].y); snprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].y);
cfg_gads[i].cfg_tb_y = cfg_gads[i].cfg_tb_y =
Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_gads[i].cfg_tb_y); Epplet_gadget_show(cfg_gads[i].cfg_tb_y);
x += row_w + 14; x += row_w + 14;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].x); snprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].x);
cfg_gads[i].cfg_tb_x = cfg_gads[i].cfg_tb_x =
Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_gads[i].cfg_tb_x); Epplet_gadget_show(cfg_gads[i].cfg_tb_x);
x += col_w + 10; x += col_w + 10;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].w); snprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].w);
cfg_gads[i].cfg_tb_w = cfg_gads[i].cfg_tb_w =
Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_gads[i].cfg_tb_w); Epplet_gadget_show(cfg_gads[i].cfg_tb_w);
x += width_w + 10; x += width_w + 10;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].h); snprintf(buff, sizeof(buff), "%u", (unsigned)buttons[i].h);
cfg_gads[i].cfg_tb_h = cfg_gads[i].cfg_tb_h =
Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 24, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_gads[i].cfg_tb_h); Epplet_gadget_show(cfg_gads[i].cfg_tb_h);
x += height_w + 10; x += height_w + 10;
Esnprintf(buff, sizeof(buff), "%ld", buttons[i].popup); snprintf(buff, sizeof(buff), "%ld", buttons[i].popup);
cfg_gads[i].cfg_tb_popup = cfg_gads[i].cfg_tb_popup =
Epplet_create_textbox(NULL, ((buttons[i].popup != -1) ? buff : NULL), Epplet_create_textbox(NULL, ((buttons[i].popup != -1) ? buff : NULL),
x, y, 24, 20, 2, NULL, NULL); x, y, 24, 20, 2, NULL, NULL);
@ -489,7 +489,7 @@ config_cb(void *data __UNUSED__)
Epplet_gadget_show(tmp_gad); Epplet_gadget_show(tmp_gad);
x += Epplet_gadget_get_width(tmp_gad) + 8; x += Epplet_gadget_get_width(tmp_gad) + 8;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)w); snprintf(buff, sizeof(buff), "%u", (unsigned)w);
cfg_tb_width = cfg_tb_width =
Epplet_create_textbox(NULL, buff, x, y, 32, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 32, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_tb_width); Epplet_gadget_show(cfg_tb_width);
@ -499,7 +499,7 @@ config_cb(void *data __UNUSED__)
Epplet_gadget_show(tmp_gad); Epplet_gadget_show(tmp_gad);
x += Epplet_gadget_get_width(tmp_gad) + 8; x += Epplet_gadget_get_width(tmp_gad) + 8;
Esnprintf(buff, sizeof(buff), "%u", (unsigned)h); snprintf(buff, sizeof(buff), "%u", (unsigned)h);
cfg_tb_height = cfg_tb_height =
Epplet_create_textbox(NULL, buff, x, y, 32, 20, 2, NULL, NULL); Epplet_create_textbox(NULL, buff, x, y, 32, 20, 2, NULL, NULL);
Epplet_gadget_show(cfg_tb_height); Epplet_gadget_show(cfg_tb_height);
@ -517,7 +517,7 @@ parse_config(void)
if (!Epplet_query_config("button_0")) if (!Epplet_query_config("button_0"))
{ {
Esnprintf(buff, sizeof(buff), "%s/default.cfg", Epplet_data_dir()); snprintf(buff, sizeof(buff), "%s/default.cfg", Epplet_data_dir());
Epplet_load_config_file(buff); Epplet_load_config_file(buff);
} }
new_w = w; new_w = w;
@ -554,7 +554,7 @@ parse_config(void)
} }
memset(&buttons[button_cnt], 0, sizeof(toolbutton_t)); memset(&buttons[button_cnt], 0, sizeof(toolbutton_t));
Esnprintf(buff, sizeof(buff), "button_%lu", button_cnt); snprintf(buff, sizeof(buff), "button_%lu", button_cnt);
tmp = Epplet_query_config(buff); tmp = Epplet_query_config(buff);
if (!tmp) if (!tmp)
{ {
@ -562,15 +562,15 @@ parse_config(void)
} }
buttons[button_cnt].prog = strdup(tmp); buttons[button_cnt].prog = strdup(tmp);
Esnprintf(buff, sizeof(buff), "button_%lu_image", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_image", button_cnt);
buttons[button_cnt].image = strdup(Epplet_query_config_def(buff, "")); buttons[button_cnt].image = strdup(Epplet_query_config_def(buff, ""));
Esnprintf(buff, sizeof(buff), "button_%lu_label", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_label", button_cnt);
buttons[button_cnt].label = strdup(Epplet_query_config_def(buff, "")); buttons[button_cnt].label = strdup(Epplet_query_config_def(buff, ""));
D(("label is %8p \"%s\", image is %8p \"%s\"\n", D(("label is %8p \"%s\", image is %8p \"%s\"\n",
buttons[button_cnt].label, buttons[button_cnt].label, buttons[button_cnt].label, buttons[button_cnt].label,
buttons[button_cnt].image, buttons[button_cnt].image)); buttons[button_cnt].image, buttons[button_cnt].image));
Esnprintf(buff, sizeof(buff), "button_%lu_popup", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_popup", button_cnt);
tmp = Epplet_query_config(buff); tmp = Epplet_query_config(buff);
if (tmp) if (tmp)
{ {
@ -579,16 +579,16 @@ parse_config(void)
else else
{ {
buttons[button_cnt].popup = -1; buttons[button_cnt].popup = -1;
Esnprintf(buff, sizeof(buff), "button_%lu_x", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_x", button_cnt);
buttons[button_cnt].x = buttons[button_cnt].x =
(unsigned short)atoi(Epplet_query_config_def(buff, "0")); (unsigned short)atoi(Epplet_query_config_def(buff, "0"));
Esnprintf(buff, sizeof(buff), "button_%lu_y", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_y", button_cnt);
buttons[button_cnt].y = buttons[button_cnt].y =
(unsigned short)atoi(Epplet_query_config_def(buff, "0")); (unsigned short)atoi(Epplet_query_config_def(buff, "0"));
Esnprintf(buff, sizeof(buff), "button_%lu_w", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_w", button_cnt);
buttons[button_cnt].w = buttons[button_cnt].w =
(unsigned short)atoi(Epplet_query_config_def(buff, "1")); (unsigned short)atoi(Epplet_query_config_def(buff, "1"));
Esnprintf(buff, sizeof(buff), "button_%lu_h", button_cnt); snprintf(buff, sizeof(buff), "button_%lu_h", button_cnt);
buttons[button_cnt].h = buttons[button_cnt].h =
(unsigned short)atoi(Epplet_query_config_def(buff, "1")); (unsigned short)atoi(Epplet_query_config_def(buff, "1"));
} }
@ -602,43 +602,43 @@ save_config(void)
char buff[25], buff2[8]; char buff[25], buff2[8];
unsigned long i; unsigned long i;
Esnprintf(buff, sizeof(buff), "%d", w); snprintf(buff, sizeof(buff), "%d", w);
Epplet_modify_config("width", buff); Epplet_modify_config("width", buff);
Esnprintf(buff, sizeof(buff), "%d", h); snprintf(buff, sizeof(buff), "%d", h);
Epplet_modify_config("height", buff); Epplet_modify_config("height", buff);
for (i = 0; i < button_cnt; i++) for (i = 0; i < button_cnt; i++)
{ {
Esnprintf(buff, sizeof(buff), "button_%lu", i); snprintf(buff, sizeof(buff), "button_%lu", i);
Epplet_modify_config(buff, buttons[i].prog); Epplet_modify_config(buff, buttons[i].prog);
Esnprintf(buff, sizeof(buff), "button_%lu_image", i); snprintf(buff, sizeof(buff), "button_%lu_image", i);
Epplet_modify_config(buff, buttons[i].image); Epplet_modify_config(buff, buttons[i].image);
Esnprintf(buff, sizeof(buff), "button_%lu_label", i); snprintf(buff, sizeof(buff), "button_%lu_label", i);
Epplet_modify_config(buff, buttons[i].label); Epplet_modify_config(buff, buttons[i].label);
if (buttons[i].popup != -1) if (buttons[i].popup != -1)
{ {
Esnprintf(buff, sizeof(buff), "button_%lu_popup", i); snprintf(buff, sizeof(buff), "button_%lu_popup", i);
Esnprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].popup); snprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].popup);
Epplet_modify_config(buff, buff2); Epplet_modify_config(buff, buff2);
} }
else else
{ {
D(("x == %hu, y == %hu, w == %hu, h == %hu\n", buttons[i].x, D(("x == %hu, y == %hu, w == %hu, h == %hu\n", buttons[i].x,
buttons[i].y, buttons[i].w, buttons[i].h)); buttons[i].y, buttons[i].w, buttons[i].h));
Esnprintf(buff, sizeof(buff), "button_%lu_x", i); snprintf(buff, sizeof(buff), "button_%lu_x", i);
Esnprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].x); snprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].x);
Epplet_modify_config(buff, buff2); Epplet_modify_config(buff, buff2);
Esnprintf(buff, sizeof(buff), "button_%lu_y", i); snprintf(buff, sizeof(buff), "button_%lu_y", i);
Esnprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].y); snprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].y);
Epplet_modify_config(buff, buff2); Epplet_modify_config(buff, buff2);
Esnprintf(buff, sizeof(buff), "button_%lu_w", i); snprintf(buff, sizeof(buff), "button_%lu_w", i);
Esnprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].w); snprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].w);
Epplet_modify_config(buff, buff2); Epplet_modify_config(buff, buff2);
Esnprintf(buff, sizeof(buff), "button_%lu_h", i); snprintf(buff, sizeof(buff), "button_%lu_h", i);
Esnprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].h); snprintf(buff2, sizeof(buff2), "%d", (int)buttons[i].h);
Epplet_modify_config(buff, buff2); Epplet_modify_config(buff, buff2);
} }
} }
@ -689,8 +689,8 @@ resize(int nw, int nh, int c)
Epplet_cleanup(); Epplet_cleanup();
Esync(); Esync();
Esnprintf(tmp_w, sizeof(tmp_w), "%d", w); snprintf(tmp_w, sizeof(tmp_w), "%d", w);
Esnprintf(tmp_h, sizeof(tmp_h), "%d", h); snprintf(tmp_h, sizeof(tmp_h), "%d", h);
execlp(prog_name, prog_name, "-w", tmp_w, "-h", tmp_h, (c ? "-c" : NULL), execlp(prog_name, prog_name, "-w", tmp_w, "-h", tmp_h, (c ? "-c" : NULL),
NULL); NULL);
fprintf(stderr, "execlp() failed -- %s\n", strerror(errno)); fprintf(stderr, "execlp() failed -- %s\n", strerror(errno));

View File

@ -79,13 +79,13 @@ save_config(void)
* strings. */ * strings. */
char buf[10]; char buf[10];
Esnprintf(buf, sizeof(buf), "%d", opt.always_show_file_urls); snprintf(buf, sizeof(buf), "%d", opt.always_show_file_urls);
Epplet_modify_config("ALWAYS_SHOW_FILE_URLS", buf); Epplet_modify_config("ALWAYS_SHOW_FILE_URLS", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.save_urls); snprintf(buf, sizeof(buf), "%d", opt.save_urls);
Epplet_modify_config("SAVE_URLS", buf); Epplet_modify_config("SAVE_URLS", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.check_url_file); snprintf(buf, sizeof(buf), "%d", opt.check_url_file);
Epplet_modify_config("CHECK_URL_FILE", buf); Epplet_modify_config("CHECK_URL_FILE", buf);
Esnprintf(buf, sizeof(buf), "%d", opt.do_new_url_command); snprintf(buf, sizeof(buf), "%d", opt.do_new_url_command);
Epplet_modify_config("RUN_COMMAND_ON_NEW_URL", buf); Epplet_modify_config("RUN_COMMAND_ON_NEW_URL", buf);
Epplet_modify_config("WWW_COMMAND", opt.www_command); Epplet_modify_config("WWW_COMMAND", opt.www_command);
Epplet_modify_config("FTP_COMMAND", opt.ftp_command); Epplet_modify_config("FTP_COMMAND", opt.ftp_command);
@ -126,15 +126,15 @@ load_config(void)
("GET_COMMAND", "Eterm -O -e wget \"%s\" &")); ("GET_COMMAND", "Eterm -O -e wget \"%s\" &"));
if (opt.url_save_file) if (opt.url_save_file)
free(opt.url_save_file); free(opt.url_save_file);
Esnprintf(buf, sizeof(buf), "%s/.Urls", home); snprintf(buf, sizeof(buf), "%s/.Urls", home);
opt.url_save_file = _Strdup(Epplet_query_config_def("URL_SAVE_FILE", buf)); opt.url_save_file = _Strdup(Epplet_query_config_def("URL_SAVE_FILE", buf));
if (opt.url_file) if (opt.url_file)
free(opt.url_file); free(opt.url_file);
Esnprintf(buf, sizeof(buf), "%s/.te/.urls", home); snprintf(buf, sizeof(buf), "%s/.te/.urls", home);
opt.url_file = _Strdup(Epplet_query_config_def("URL_CHECK_FILE", buf)); opt.url_file = _Strdup(Epplet_query_config_def("URL_CHECK_FILE", buf));
if (opt.new_url_command) if (opt.new_url_command)
free(opt.new_url_command); free(opt.new_url_command);
Esnprintf(buf, sizeof(buf), "esdplay %s/wooeep.wav &", Epplet_data_dir()); snprintf(buf, sizeof(buf), "esdplay %s/wooeep.wav &", Epplet_data_dir());
opt.new_url_command = opt.new_url_command =
_Strdup(Epplet_query_config_def("NEW_URL_COMMAND", buf)); _Strdup(Epplet_query_config_def("NEW_URL_COMMAND", buf));
} }
@ -596,7 +596,7 @@ scroll_string(void *data __UNUSED__)
pause = 1; pause = 1;
} }
Esnprintf(buf, sizeof(buf), "%s", dtext.str + dtext.pos); snprintf(buf, sizeof(buf), "%s", dtext.str + dtext.pos);
if (!back) if (!back)
dtext.pos += 1; dtext.pos += 1;
@ -674,28 +674,28 @@ handle_url(const char *url, const char *type)
/* This should be close enough :) */ /* This should be close enough :) */
len = strlen(opt.www_command) + strlen(url) + 2; len = strlen(opt.www_command) + strlen(url) + 2;
sys = malloc(len); sys = malloc(len);
Esnprintf(sys, len, opt.www_command, url); snprintf(sys, len, opt.www_command, url);
} }
else if (!strcmp(type, "ftp")) else if (!strcmp(type, "ftp"))
{ {
/* This should be close enough :) */ /* This should be close enough :) */
len = strlen(opt.ftp_command) + strlen(url) + 2; len = strlen(opt.ftp_command) + strlen(url) + 2;
sys = malloc(len); sys = malloc(len);
Esnprintf(sys, len, opt.ftp_command, url); snprintf(sys, len, opt.ftp_command, url);
} }
else if (!strcmp(type, "get")) else if (!strcmp(type, "get"))
{ {
/* This should be close enough :) */ /* This should be close enough :) */
len = strlen(opt.get_command) + strlen(url) + 2; len = strlen(opt.get_command) + strlen(url) + 2;
sys = malloc(len); sys = malloc(len);
Esnprintf(sys, len, opt.get_command, url); snprintf(sys, len, opt.get_command, url);
} }
else else
{ {
/* This should be close enough :) */ /* This should be close enough :) */
len = strlen(opt.www_command) + strlen(url) + 2; len = strlen(opt.www_command) + strlen(url) + 2;
sys = malloc(len); sys = malloc(len);
Esnprintf(sys, len, opt.www_command, url); snprintf(sys, len, opt.www_command, url);
} }
D(("In handle_url: About to system() -->%s<--\n", sys)); D(("In handle_url: About to system() -->%s<--\n", sys));

View File

@ -55,8 +55,8 @@ start_hack(char *hack)
{ {
char buff[1024]; char buff[1024];
Esnprintf(buff, sizeof(buff), "%s -window-id %ld", hack, snprintf(buff, sizeof(buff), "%s -window-id %ld", hack,
Epplet_get_drawingarea_window(draw_area)); Epplet_get_drawingarea_window(draw_area));
Epplet_register_child_handler(child_cb, NULL); Epplet_register_child_handler(child_cb, NULL);
hack_pid = Epplet_spawn_command(buff); hack_pid = Epplet_spawn_command(buff);
} }
@ -189,7 +189,7 @@ apply_config(void)
s = Epplet_textbox_contents(cfg_tb_hacks[i]); s = Epplet_textbox_contents(cfg_tb_hacks[i]);
if (strlen(s)) if (strlen(s))
{ {
Esnprintf(buff, sizeof(buff), "hack_%lu", j); snprintf(buff, sizeof(buff), "hack_%lu", j);
Epplet_modify_config(buff, s); Epplet_modify_config(buff, s);
hacks[j++] = (char *)Epplet_query_config(buff); hacks[j++] = (char *)Epplet_query_config(buff);
} }
@ -256,7 +256,7 @@ config_cb(void *data __UNUSED__)
for (i = 0, y = 50; i < hack_cnt; i++) for (i = 0, y = 50; i < hack_cnt; i++)
{ {
Esnprintf(buff, sizeof(buff), "Hack #%d:", i); snprintf(buff, sizeof(buff), "Hack #%d:", i);
Epplet_gadget_show(Epplet_create_label(4, y, buff, 2)); Epplet_gadget_show(Epplet_create_label(4, y, buff, 2));
y += 14; y += 14;
Epplet_gadget_show(cfg_tb_hacks[i] = Epplet_gadget_show(cfg_tb_hacks[i] =
@ -289,7 +289,7 @@ parse_config(void)
const char *tmp; const char *tmp;
char buff[40]; char buff[40];
Esnprintf(buff, sizeof(buff), "hack_%lu", hack_cnt); snprintf(buff, sizeof(buff), "hack_%lu", hack_cnt);
tmp = Epplet_query_config(buff); tmp = Epplet_query_config(buff);
if (!tmp) if (!tmp)
{ {