Lines Matching refs:sort

25  * sort main
40 "[-n?\n@(#)$Id: sort (AT&T Research) 2010-08-11 $\n]"
42 "[+NAME?sort - sort and/or merge files]"
46 "[+?The default sort key is an entire line. Default ordering is "
53 "[k:key?Restrict the sort key to a string beginning at \apos1\a and "
114 "[J:shuffle|jumble?Do a random shuffle of the sort keys. \aseed\a "
130 "is out of sort then write one diagnostic line on the standard error "
133 "[j:processes|nproc|jobs?Use up to \ajobs\a separate processes to sort "
139 "[s:stable?Stable sort. When all keys compare equal, preserve input "
140 "order. The default is \b--nostable\b (\aunstable\a sort): when all "
147 "[l:library?Load the external sort discipline \alibrary\a with optional "
149 "to right order, after the sort method has been "
152 "[L:list?List the available sort methods. See the \b-x\b option.]"
153 "[x:method?Specify the sort method to apply:]:[method:=rasp]"
154 "{\fmethods\f} [v:verbose?Trace the sort progress on the standard "
172 "[+c?Input chunk size; sort chunks of this size and disable "
176 "[+p?Input sort size; sort chunks of this size before merge.]"
212 "[+?When there are multiple sort keys, later keys are compared only "
257 #define TEST_dump 0x80000000 /* dump the state before sort */
442 else if (dls = dllsopen("sort", NiL, NiL))
462 * process argv as in sort(1)
1163 error(ERROR_SYSTEM|2, "sort library initialization error");
1240 error(ERROR_SYSTEM|3, "cannot create intermediate sort file %d", sp->nfiles);
1248 error(ERROR_SYSTEM|2, "intermediate sort file write error");
1253 error(ERROR_SYSTEM|2, "intermediate sort file rewind error");
1404 error(ERROR_SYSTEM|3, "sort error");
1622 error(2, "sort error");
1663 error(2, "sort key error");
1672 Sort_t sort;
1674 error_info.id = "sort";
1675 if (init(&sort, &sort.disc, argv))
1677 if (sort.test & TEST_dump)
1679 sfprintf(sfstderr, "main\n\tintermediates=%d\n", sort.xfiles);
1680 rskeydump(sort.key, sfstderr);
1682 if (sort.key->type & RS_CAT)
1684 while (s = *sort.key->input++)
1686 fp = fileopen(&sort, s);
1689 if (sferror(sfstdout) || rsfileclose(sort.rec, fp))
1695 merge = sort.key->merge && sort.key->input[0] && sort.key->input[1] ? sort.key->input : (char**)0;
1697 if (sort.jobs)
1698 jobs(&sort);
1699 else if (sort.test & TEST_show)
1702 while (s = *sort.key->input++)
1704 fp = fileopen(&sort, s);
1707 if (sort.nfiles >= sort.xfiles)
1709 clear(&sort, NiL);
1710 sort.key->input = merge;
1717 sort.files[sort.nfiles++] = fp;
1719 else if (input(&sort, fp, s) < 0)
1721 else if (fp != sfstdin && !sort.map)
1727 if (sort.nfiles)
1729 if (sort.cur && flush(&sort, sort.cur) < 0)
1731 if (sort.verbose)
1733 if (rsmerge(sort.rec, sort.op, sort.files, sort.nfiles, merge ? RS_TEXT : RS_OTEXT))
1735 clear(&sort, NiL);
1739 if (sort.verbose)
1741 if (rswrite(sort.rec, sort.op, RS_OTEXT) && !error_info.errors)
1742 error(ERROR_SYSTEM|3, "%s: write error", sort.key->output);
1747 done(&sort);