#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <signal.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <stdio.h>#include <limits.h>Include dependency graph for sort.c:

Go to the source code of this file.
Data Structures | |
| struct | MERGE |
| struct | FIELD |
Defines | |
| #define | OPEN_FILES (OPEN_MAX-4) |
| #define | MEMORY_SIZE ((10 * sizeof(int)) * 1024) |
| #define | LINE_SIZE (1024 >> 1) |
| #define | IO_SIZE (2 * 1024) |
| #define | STD_OUT 1 |
| #define | OK 0 |
| #define | ERROR -1 |
| #define | NIL_PTR ((char *) 0) |
| #define | LOWER -1 |
| #define | SAME 0 |
| #define | HIGHER 1 |
| #define | DICT 0x001 |
| #define | ASCII 0x002 |
| #define | BLANK 0x004 |
| #define | DIGIT 0x008 |
| #define | UPPER 0x010 |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | NIL_MERGE ((MERGE *) 0) |
| #define | FIELDS_LIMIT 10 |
| #define | GLOBAL 0 |
Typedefs | |
| typedef int | BOOL |
Functions | |
| _PROTOTYPE (int main,(int argc, char **argv)) | |
| _PROTOTYPE (void get_opts,(char *ptr, FIELD *field)) | |
| _PROTOTYPE (void new_field,(FIELD *field, int *offset, BOOL beg_fl)) | |
| _PROTOTYPE (void adjust_options,(FIELD *field)) | |
| _PROTOTYPE (void error,(BOOL quit, char *message, char *arg)) | |
| _PROTOTYPE (void open_outfile,(void)) | |
| _PROTOTYPE (void get_file,(int fd, off_t size)) | |
| _PROTOTYPE (int last_line,(void)) | |
| _PROTOTYPE (void print_table,(int fd)) | |
| _PROTOTYPE (char *file_name,(int nr)) | |
| _PROTOTYPE (void mread,(int fd, char *address, int bytes)) | |
| _PROTOTYPE (void sort_table,(int nel)) | |
| _PROTOTYPE (void incr,(int si, int ei)) | |
| _PROTOTYPE (int cmp_fields,(char *el1, char *el2)) | |
| _PROTOTYPE (void build_field,(char *dest, FIELD *field, char *src)) | |
| _PROTOTYPE (char *skip_fields,(char *str, int nf)) | |
| _PROTOTYPE (int cmp,(unsigned char *el1, unsigned char *el2, FIELD *field)) | |
| _PROTOTYPE (int digits,(char *str1, char *str2, BOOL check_sign)) | |
| _PROTOTYPE (void files_merge,(int file_cnt)) | |
| _PROTOTYPE (void merge,(int start_file, int limit_file)) | |
| _PROTOTYPE (void put_line,(char *line)) | |
| _PROTOTYPE (MERGE *print,(MERGE *merg, int file_cnt)) | |
| _PROTOTYPE (int read_line,(MERGE *merg)) | |
| _PROTOTYPE (MERGE *skip_lines,(MERGE *smallest, int file_cnt)) | |
| _PROTOTYPE (void uniq_lines,(MERGE *merg)) | |
| _PROTOTYPE (void check_file,(int fd, char *file)) | |
| _PROTOTYPE (int length,(char *line)) | |
| _PROTOTYPE (void copy,(char *dest, char *src)) | |
| _PROTOTYPE (char *msbrk,(int size)) | |
| _PROTOTYPE (void mbrk,(char *address)) | |
| _PROTOTYPE (void catch,(int dummy)) | |
| void | get_opts (char *ptr, FIELD *field) |
| void | new_field (FIELD *field, int *offset, BOOL beg_fl) |
| int | main (int argc, argv) |
| void | adjust_options (FIELD *field) |
| void | error (BOOL quit, char *message, char *arg) |
| void | open_outfile () |
| void | get_file (int fd, off_t size) |
| int | last_line () |
| void | print_table (int fd) |
| char * | file_name (int nr) |
| void | mread (int fd, char *address, int bytes) |
| void | mwrite (int fd, char *address, int bytes) |
| void | sort () |
| void | sort_table (int nel) |
| void | incr (int si, int ei) |
| int | cmp_fields (char *el1, char *el2) |
| void | build_field (char *dest, FIELD *field, char *src) |
| char * | skip_fields (char *str, int nf) |
| int | compare (char *el1, char *el2) |
| int | cmp (unsigned char *el1, unsigned char *el2, FIELD *field) |
| int | digits (char *str1, char *str2, BOOL check_sign) |
| void | files_merge (int file_cnt) |
| void | merge (int start_file, int limit_file) |
| void | put_line (char *line) |
| MERGE * | print (MERGE *merg, int file_cnt) |
| int | read_line (MERGE *merg) |
| MERGE * | skip_lines (MERGE *smallest, int file_cnt) |
| void | uniq_lines (MERGE *merg) |
| void | check_file (int fd, char *file) |
| int | length (char *line) |
| void | copy (char *dest, char *src) |
| char * | msbrk (int size) |
| void | mbrk (char *address) |
| void | catch (int dummy) |
Variables | |
| MERGE | merge_f [OPEN_FILES] |
| int | buf_size |
| FIELD | fields [FIELDS_LIMIT] |
| int | field_cnt |
| BOOL | check = FALSE |
| BOOL | only_merge = FALSE |
| BOOL | uniq = FALSE |
| char * | mem_top |
| char * | cur_pos |
| char ** | line_table |
| BOOL | in_core = TRUE |
| char | temp_files [] = "/tmp/sort.XXXXX.XX" |
| char * | output_file |
| int | out_fd |
| char | out_buffer [IO_SIZE] |
| char ** | argptr |
| int | args_offset |
| int | args_limit |
| char | separator |
| int | nr_of_files = 0 |
| int | disabled |
| char | USAGE [] = "Usage: sort [-funbirdcmt'x'] [+beg_pos [-end_pos]] [-o outfile] [file] .." |
| char | table [256] |
|
|
Definition at line 67 of file sort.c. Referenced by complement(). |
|
|
|
|
|
Definition at line 66 of file sort.c. Referenced by inflateSetDictionary(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 89 of file sort.c. Referenced by main(). |
|
|
Definition at line 90 of file sort.c. Referenced by adjust_options(), compare(), and main(). |
|
|
|
|
|
|
|
|
Definition at line 51 of file sort.c. Referenced by check_file(), cmp_fields(), merge(), read_line(), and uniq_lines(). |
|
|
Definition at line 61 of file sort.c. Referenced by digits(), and dos_name(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 44 of file sort.c. Referenced by files_merge(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
Definition at line 420 of file sort.c. References FIELD::ascii, FIELD::blanks, FIELD::dictionary, fields, FIELD::fold_case, GLOBAL, FIELD::numeric, FIELD::reverse, and TRUE. Referenced by main(). |
|
||||||||||||||||
|
Definition at line 692 of file sort.c. References begin, copy, ERROR, i, and skip_fields(). Referenced by cmp_fields(). |
|
|
Definition at line 1184 of file sort.c. References exit(), FALSE, file_name, i, only_merge, SIG_IGN, SIGINT, signal(), and unlink. |
|
||||||||||||
|
Definition at line 1110 of file sort.c. References buf_size, MERGE::buffer, MERGE::cnt, compare, copy, ERROR, FALSE, MERGE::fd, lastline, MERGE::line, LINE_SIZE, mem_top, MEMORY_SIZE, msbrk(), MERGE::read_chars, read_line(), and write. |
|
||||||||||||||||
|
|
|
||||||||||||
|
Definition at line 668 of file sort.c. References build_field(), cmp, field_cnt, fields, i, line1, line2, LINE_SIZE, and SAME. Referenced by compare(). |
|
||||||||||||
|
Definition at line 740 of file sort.c. References cmp, cmp_fields(), field_cnt, fields, and GLOBAL. |
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 820 of file sort.c. References BOOL, diff(), DIGIT, FALSE, LOWER, pow(), SAME, and TRUE. Referenced by cmp(), cvtnum(), out_long(), out_num(), push_constant(), and zputhex(). |
|
||||||||||||||||
|
|
|
|
Definition at line 559 of file sort.c. References argptr, args_limit, args_offset, only_merge, and temp_files. |
|
|
Definition at line 886 of file sort.c. References i, OPEN_FILES, and open_outfile(). Referenced by main(). |
|
||||||||||||
|
Definition at line 458 of file sort.c. References cur_pos, FALSE, get_file(), i, in_core, last_line(), lseek, mem_top, MEMORY_SIZE, mread(), read, SEEK_CUR, and sort(). |
|
||||||||||||
|
Definition at line 234 of file sort.c. References error, NIL_PTR, TRUE, and USAGE. Referenced by main(), and new_field(). |
|
||||||||||||
|
Definition at line 647 of file sort.c. References compare, line_table, and tmp. Referenced by inflate_table(), inflate_table9(), main(), sort_table(), and tgoto(). |
|
|
Definition at line 514 of file sort.c. References i, mem_top, and MEMORY_SIZE. Referenced by get_file(), overlay(), and overwrite(). |
|
|
Definition at line 1150 of file sort.c. References i. |
|
||||||||||||
|
Definition at line 311 of file sort.c. References adjust_options(), arg_count, argptr, args_limit, args_offset, check, check_file(), cur_pos, error, exit(), FALSE, field_cnt, fields, FIELDS_LIMIT, files_merge(), get_file(), get_opts(), getpid, GLOBAL, mem_top, MEMORY_SIZE, msbrk(), new_field(), NIL_PTR, nr_of_files, O_RDONLY, only_merge, open, output_file, pid, pow(), ptr, separator, SIGINT, signal(), sort(), st, stat::st_size, stat, strcmp, temp_files, TRUE, and uniq. |
|
|
Definition at line 1178 of file sort.c. |
|
||||||||||||
|
Definition at line 914 of file sort.c. References buf_size, disabled, ERROR, FALSE, MERGE::fd, file_name, i, if(), LINE_SIZE, mbrk(), mem_top, MEMORY_SIZE, merge_f, O_RDONLY, open, and strcmp. Referenced by _dis(), and free_mem(). |
|
||||||||||||||||
|
Definition at line 572 of file sort.c. References error, NIL_PTR, read, and TRUE. Referenced by add_file(), get_file(), and get_header(). |
|
|
Definition at line 1167 of file sort.c. References address(), error, NIL_PTR, sbrk, and TRUE. Referenced by check_file(), main(), and sort(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 268 of file sort.c. References argptr, atoi, DIGIT, ERROR, error, FALSE, get_opts(), NIL_PTR, ptr, and TRUE. Referenced by main(). |
|
|
Definition at line 447 of file sort.c. References creat, error, NIL_PTR, out_fd, output_file, STD_OUT, and TRUE. |
|
||||||||||||
|
Definition at line 1008 of file sort.c. References ERROR, i, merge_f, put_line(), and read_line(). |
|
|
Definition at line 526 of file sort.c. References compare, creat, error, ERROR, file_name, index(), line_table, NIL_PTR, nr_of_files, ptr, SAME, TRUE, and uniq. |
|
|
Definition at line 983 of file sort.c. References close, index(), IO_SIZE, mwrite(), NIL_PTR, out_buffer, and out_fd. |
|
|
Definition at line 1034 of file sort.c. References buf_size, close, disabled, ERROR, LINE_SIZE, OK, ptr, and read. |
|
||||||||||||
|
Definition at line 720 of file sort.c. References BLANK, and separator. Referenced by build_field(). |
|
||||||||||||
|
Definition at line 1065 of file sort.c. References compare, disabled, ERROR, i, if(), MERGE::line, merge_f, and read_line(). |
|
|
Definition at line 592 of file sort.c. References count, ERROR, in_core, line_table, mbrk(), mem_top, msbrk(), NIL_PTR, open_outfile(), out_fd, print_table(), ptr, and sort_table(). |
|
|
Definition at line 628 of file sort.c. References i, incr(), line_table, and tmp. Referenced by sort(). |
|
|
Definition at line 1088 of file sort.c. References compare, ERROR, if(), lastline, LINE_SIZE, put_line(), read_line(), and SAME. |
|
|
|
|
|
Definition at line 125 of file sort.c. Referenced by file_name(), and main(). |
|
|
Definition at line 124 of file sort.c. Referenced by file_name(), and main(). |
|
|
|
|
|
|
|
|
Definition at line 113 of file sort.c. Referenced by get_file(), get_line(), and main(). |
|
|
Definition at line 129 of file sort.c. Referenced by merge(), read_line(), and skip_lines(). |
|
|
Definition at line 105 of file sort.c. Referenced by cmp_fields(), compare(), and main(). |
|
|
|
|
|
Definition at line 115 of file sort.c. Referenced by get_file(), and sort(). |
|
|
Definition at line 114 of file sort.c. Referenced by incr(), print_table(), sort(), and sort_table(). |
|
|
Definition at line 112 of file sort.c. Referenced by check_file(), get_file(), last_line(), main(), merge(), and sort(). |
|
|
Definition at line 86 of file sort.c. Referenced by merge(), print(), and skip_lines(). |
|
|
Definition at line 128 of file sort.c. Referenced by main(), and print_table(). |
|
|
Definition at line 109 of file sort.c. Referenced by catch(), file_name(), and main(). |
|
|
Definition at line 121 of file sort.c. Referenced by put_line(). |
|
|
Definition at line 120 of file sort.c. Referenced by open_outfile(), put_line(), and sort(). |
|
|
Definition at line 119 of file sort.c. Referenced by copy_ident(), goto_actions(), main(), open_files(), open_outfile(), output_base(), output_check(), output_debug(), output_rule_data(), output_table(), and output_yydefred(). |
|
|
Definition at line 127 of file sort.c. Referenced by main(), and skip_fields(). |
|
|
|
|
|
Definition at line 118 of file sort.c. Referenced by file_name(), and main(). |
|
|
Definition at line 110 of file sort.c. Referenced by main(), print_table(), and uniqname(). |
|
|
|
1.4.6