88c88 < Print numbers from FIRST to LAST, in steps of INCREMENT.\n\ --- > Print numbers or characters from FIRST to LAST, in steps of INCREMENT.\n\ 98,102c98,102 < If FIRST or INCREMENT is omitted, it defaults to 1.\n\ < FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\ < INCREMENT should be positive if FIRST is smaller than LAST, and negative\n\ < otherwise. When given, the FORMAT argument must contain exactly one of\n\ < the printf-style, floating point output formats %e, %f, %g\n\ --- > If FIRST is omitted, it defaults to 1 or a, if INCREMENT is omitted,\n\ > it defaults to 1. FIRST, INCREMENT, and LAST are interpreted as floating\n\ > point values. INCREMENT should be positive if FIRST is smaller than LAST,\n\ > and negative otherwise. When given, the FORMAT argument must contain exactly\n\ > one of the printf-style, floating point output formats %e, %f, %g\n\ 427,441c427,504 < last = scan_double_arg (argv[optind++]); < < if (optind < argc) < { < first = last; < last = scan_double_arg (argv[optind++]); < < if (optind < argc) < { < step = last; < step_is_set = 1; < last = scan_double_arg (argv[optind++]); < < } < } --- > /* Check if the user wants a character sequence or a numeric > sequence. > */ > if( isalpha (argv[optind][0]) ) > { > char first; > long int step; > char last; > > switch (argc-optind) > { > case 1: > first = isupper( *argv[optind] )?'A':'a'; > last = *argv[optind]; > step = 1; > break; > > case 2: > first = *argv[optind]; > last = *argv[optind+1]; > step = last>first?1:-1; > break; > > case 3: > first = *argv[optind]; > errno=0; > step = strtol (argv[optind+1], 0, 10); > last = *argv[optind+2]; > break; > } > > if (errno || !step) > { > error ( 0, 0, _("invalid step length")); > usage (EXIT_FAILURE); > } > > if (!(isupper(first) || islower(first))) > { > error ( 0, 0, _("invalid first character")); > usage (EXIT_FAILURE); > } > > if (!(isupper(last) || islower(last))) > { > error ( 0, 0, _("invalid last character")); > usage (EXIT_FAILURE); > } > > if (isupper (first) != isupper (last)) > { > error ( 0, 0, _("first and last character must have same case")); > usage (EXIT_FAILURE); > } > > if ((step > 0) == (last > first)) > { > for( ; (step>0)?(first <= last):(first>=last); first+=step ) > printf( "%c\n", first ); > } > } > else > { > last = scan_double_arg (argv[optind++]); > > if (optind < argc) > { > first = last; > last = scan_double_arg (argv[optind++]); > > if (optind < argc) > { > step = last; > step_is_set = 1; > last = scan_double_arg (argv[optind++]); > > } > } 464a528,529 > } >