* strlen -> mbstowcs (multibyte str to wide char str) conversion where we
want the actual number of characters, not the number of bytes. * Added a TODO to take care of later in scriptlet processing.
This commit is contained in:
parent
97f3a52a9b
commit
cd34ced4ad
4 changed files with 17 additions and 8 deletions
|
@ -509,12 +509,19 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
|
||||||
char line[1024];
|
char line[1024];
|
||||||
if(fgets(line, 1024, pp) == NULL)
|
if(fgets(line, 1024, pp) == NULL)
|
||||||
break;
|
break;
|
||||||
|
/*TODO clean this code up, remove weird SCRIPTLET_START/DONE,
|
||||||
|
* (void*)atol call, etc. */
|
||||||
/* "START <event desc>" */
|
/* "START <event desc>" */
|
||||||
if((strlen(line) > strlen(SCRIPTLET_START)) && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) {
|
if((strlen(line) > strlen(SCRIPTLET_START))
|
||||||
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL);
|
&& !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) {
|
||||||
|
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START,
|
||||||
|
_alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL);
|
||||||
/* "DONE <ret code>" */
|
/* "DONE <ret code>" */
|
||||||
} else if((strlen(line) > strlen(SCRIPTLET_DONE)) && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) {
|
} else if((strlen(line) > strlen(SCRIPTLET_DONE))
|
||||||
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), NULL);
|
&& !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) {
|
||||||
|
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE,
|
||||||
|
(void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))),
|
||||||
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
_alpm_strtrim(line);
|
_alpm_strtrim(line);
|
||||||
/* log our script output */
|
/* log our script output */
|
||||||
|
@ -526,7 +533,8 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
if(waitpid(pid, 0, 0) == -1) {
|
if(waitpid(pid, 0, 0) == -1) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), strerror(errno));
|
_alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"),
|
||||||
|
strerror(errno));
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#define _(s) s
|
#define _(s) s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*TODO wtf? why is this done like this? */
|
||||||
#define SCRIPTLET_START "START "
|
#define SCRIPTLET_START "START "
|
||||||
#define SCRIPTLET_DONE "DONE "
|
#define SCRIPTLET_DONE "DONE "
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
|
||||||
|
|
||||||
/* printed using a variable to make i18n safe */
|
/* printed using a variable to make i18n safe */
|
||||||
printf("%s", descheader);
|
printf("%s", descheader);
|
||||||
indentprint(alpm_pkg_get_desc(pkg), strlen(descheader));
|
indentprint(alpm_pkg_get_desc(pkg), mbstowcs(NULL, descheader, 0));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
/* Print additional package info if info flag passed more than once */
|
/* Print additional package info if info flag passed more than once */
|
||||||
|
@ -134,7 +134,7 @@ void dump_pkg_sync(pmpkg_t *pkg, const char *treename)
|
||||||
|
|
||||||
/* printed using a variable to make i18n safe */
|
/* printed using a variable to make i18n safe */
|
||||||
printf("%s", descheader);
|
printf("%s", descheader);
|
||||||
indentprint(alpm_pkg_get_desc(pkg), strlen(descheader));
|
indentprint(alpm_pkg_get_desc(pkg), mbstowcs(NULL, descheader, 0));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (md5sum != NULL && md5sum[0] != '\0') {
|
if (md5sum != NULL && md5sum[0] != '\0') {
|
||||||
|
|
|
@ -334,7 +334,7 @@ void cb_trans_progress(pmtransprog_t event, char *pkgname, const int percent,
|
||||||
/* determine room left for non-digits text [not ( 1/12) part] */
|
/* determine room left for non-digits text [not ( 1/12) part] */
|
||||||
textlen = infolen - 3 - (2 * digits);
|
textlen = infolen - 3 - (2 * digits);
|
||||||
/* room left for package name */
|
/* room left for package name */
|
||||||
pkglen = textlen - strlen(ptr) - 1;
|
pkglen = textlen - mbstowcs(NULL, ptr, 0) - 1;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case PM_TRANS_PROGRESS_ADD_START:
|
case PM_TRANS_PROGRESS_ADD_START:
|
||||||
|
|
Loading…
Add table
Reference in a new issue