bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Add numerical suffixes to split


From: Jesse Kornblum
Subject: [patch] Add numerical suffixes to split
Date: Mon, 23 Jun 2003 08:22:45 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312

Hi there! I'm a computer crime investigator for the United States Air
Force and have developed a patch to improve the functionality of
'split.' We use split to break large files generated by dd into smaller
chunks. Unfortunately, our analysis programs want these chunks to have
numerical suffixes (e.g. .001, .002, .003, etc) instead of the
alphabetical ones that split currently generates. The patch below
against split.c in Coreutils 5.0 adds numerical suffixes to split. Could
it be included in the next release of CoreUtils?

Thanks!

<snip>

65a66,68
> /* If non-zero, use numeric suffixes instead of characters */
> static int suffix_type;
>
82a86
>   {"numbers", no_argument, &suffix_type, 'n'},
108a113
>   -n, --numbers            use digits for suffixes instead of numbers\n\
146c151,158
<       memset (outfile_mid, 'a', suffix_length);
---
>
>       if (!suffix_type)
>       memset (outfile_mid, 'a', suffix_length);
>       else {
>       memset (outfile_mid, '0', suffix_length);
>       outfile_mid[suffix_length - 1] = '1';
>       }
>
168,171c180,190
<       for (p = outfile_mid + suffix_length; outfile_mid < p; *--p = 'a')
<       if (p[-1]++ != 'z')
<         return;
<       error (EXIT_FAILURE, 0, _("Output file suffixes exhausted"));
---
>       if (!suffix_type) {
>       for (p = outfile_mid + suffix_length; outfile_mid < p; *--p = 'a')
>         if (p[-1]++ != 'z')
>           return;
>       error (EXIT_FAILURE, 0, _("Output file suffixes exhausted"));
>       } else {
>       for (p = outfile_mid + suffix_length; outfile_mid < p; *--p = '0')
>         if (p[-1]++ != '9')
>           return;
>       error (EXIT_FAILURE, 0, _("Output file suffixes exhausted"));
>       }
379c398
<       c = getopt_long (argc, argv, "0123456789C:a:b:l:", longopts, NULL);
---
>       c = getopt_long (argc, argv, "0123456789nC:a:b:l:", longopts, NULL);
387a407,410
>       case 'n':
>         suffix_type = 1;
>         break;
>



-- 
SA Jesse Kornblum
Chief, Computer Investigations and Operations
Air Force Office of Special Investigations
DSN 857-1143  Commercial 240-857-1143
Fax 857-0963  STU-III 857-0965
  email: address@hidden
siprnet: address@hidden
http://afosi-web/xos/xosi/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]