rem: buffer = wmalloc(strlen(file)+20); sprintf(buffer,"Delete directory %s ?",file);
add: int len = strlen(file)+20; buffer = wmalloc(len); snprintf(buffer,len,_("Delete directory %s ?"),file);
context: deleteFile(WMButton *bPre, WMFilePanel *panel){    char *file;    char *buffer, *s;    struct stat filestat;    WMScreen *scr = WMWidgetScreen(panel->win);    file = getCurrentFileName(panel);    while ((s = strstr(file,"//"))) {        int i;        for (i = 2;s[i] == '/';i++);        strcpy(s, &s[i-1]);    }    if (strlen(file) > 1 && (s = strrchr(file, '/')) && !s[1]) s[0] = 0;    if (stat(file,&filestat)) {        switch (errno) {            case ENOENT:                showError(scr, panel->win, "'%s' does not exist.", file);                break;            case EACCES:                showError(scr, panel->win, "Permission denied.", NULL);                break;            case ENOMEM:                showError(scr, panel->win,                        "Insufficient memory available.", NULL);                break;            case EROFS:                showError(scr, panel->win,                        "'%s' is on a read-only filesystem.", file);                break;            default:                showError(scr, panel->win, "Can not delete '%s'.", file);        }        wfree(file);        return;    } else if (S_ISDIR(filestat.st_mode)) {        buffer = wmalloc(strlen(file)+20);        sprintf(buffer,"Delete directory %s ?",file);    } else {        buffer = wmalloc(strlen(file)+15);        sprintf(buffer,"Delete file %s ?",file);    }    if (!WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,                "Warning", buffer, "OK", "Cancel", NULL)) {        if (S_ISDIR(filestat.st_mode)) {            if (rmdir(file) != 0) {                switch (errno) {                    case EACCES:                        showError(scr, panel->win, "Permission denied.", NULL);                        break;                    case ENOENT:                        showError(scr, panel->win, "Directory '%s' does not exist.", file);                        break;                    case ENOTEMPTY:                        showError(scr, panel->win, "Directory '%s' is not empty.", file);                        break;                    case EBUSY:                        showError(scr, panel->win, "Directory '%s' is busy.", file);                        break;                    default:                        showError(scr, panel->win, "Can not delete '%s'.", file);                }            } else {                char *s = strrchr(file,'/');                if (s) s[0] = 0;                WMSetFilePanelDirectory(panel, file);            }        } else if (remove(file) != 0) {            switch (errno) {                case EISDIR:                    showError(scr, panel->win, "'%s' is a directory.", file);                    break;                case ENOENT:                    showError(scr, panel->win, "'%s' does not exist.", file);                    break;                case EACCES:                    showError(scr, panel->win, "Permission denied.", NULL);                    break;                case ENOMEM:                    showError(scr, panel->win,                            "Insufficient memory available.", NULL);                    break;                case EROFS:                    showError(scr, panel->win,                            "'%s' is on a read-only filesystem.", file);                    break;                default:                    showError(scr, panel->win, "Can not delete '%s'.", file);            }        } else {            char *s = strrchr(file,'/');            if (s) s[1] = 0;            WMSetFilePanelDirectory(panel, file);        }    }    wfree(buffer);    wfree(file);}