X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aft.c;h=cfb1f69773a73a2f6401bf2b93bfc1be21217412;hp=96f65e99fbf5b1bd2ae7eb863b864ce77e743c70;hb=fdb03951ee708a42795d4abb36d3a8637c478975;hpb=385aab3b349e2d60d2ce863abda57e3a3f2c3afd diff --git a/aft.c b/aft.c index 96f65e99..cfb1f697 100644 --- a/aft.c +++ b/aft.c @@ -1439,18 +1439,26 @@ int com_ls(struct command_context *cc) i++; break; } + /* + * Compatibility: Prior to 0.5.5 it was necessary to specify + * the listing mode without the '=' character as in -lv, for + * example. Now the variant with '=' is preferred and + * documented but we still accept the old way to specify the + * listing mode. + * + * Support for the legacy syntax can be dropped at 0.6.0 + * or later. + */ if (!strncmp(arg, "-l", 2)) { - if (!*(arg + 2)) { - mode = LS_MODE_LONG; - continue; - } - if (*(arg + 3)) - return -E_AFT_SYNTAX; - switch(*(arg + 2)) { + arg += 2; + if (*arg == '=') + arg++; + switch (*arg) { case 's': mode = LS_MODE_SHORT; continue; case 'l': + case '\0': mode = LS_MODE_LONG; continue; case 'v': @@ -1485,10 +1493,12 @@ int com_ls(struct command_context *cc) flags |= LS_FLAG_UNIXDATE; continue; } + /* The compatibility remark above applies also to -s. */ if (!strncmp(arg, "-s", 2)) { - if (!*(arg + 2) || *(arg + 3)) - return -E_AFT_SYNTAX; - switch(*(arg + 2)) { + arg += 2; + if (*arg == '=') + arg++; + switch (*arg) { case 'p': sort = LS_SORT_BY_PATH; continue; @@ -2561,7 +2571,8 @@ static void com_setatt_callback(int fd, const struct osl_object *query) if (!cad.add_mask && !cad.del_mask) goto out; pmd.patterns.data = p; - assert(p < (char *)query->data + query->size); + if (p >= (char *)query->data + query->size) + goto out; pmd.patterns.size = (char *)query->data + query->size - p; ret = for_each_matching_row(&pmd); if (ret < 0)