Module Name: src Committed By: dholland Date: Sun Jul 26 02:06:37 UTC 2009
Modified Files: src/bin/ed: cbc.c ed.h Log Message: sprinkle static in this file To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/bin/ed/cbc.c cvs rdiff -u -r1.33 -r1.34 src/bin/ed/ed.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/ed/cbc.c diff -u src/bin/ed/cbc.c:1.19 src/bin/ed/cbc.c:1.20 --- src/bin/ed/cbc.c:1.19 Sun Jul 26 01:58:20 2009 +++ src/bin/ed/cbc.c Sun Jul 26 02:06:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cbc.c,v 1.19 2009/07/26 01:58:20 dholland Exp $ */ +/* $NetBSD: cbc.c,v 1.20 2009/07/26 02:06:37 dholland Exp $ */ /* cbc.c: This file contains the encryption routines for the ed line editor */ /*- @@ -72,7 +72,7 @@ #if 0 static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; #else -__RCSID("$NetBSD: cbc.c,v 1.19 2009/07/26 01:58:20 dholland Exp $"); +__RCSID("$NetBSD: cbc.c,v 1.20 2009/07/26 02:06:37 dholland Exp $"); #endif #endif /* not lint */ @@ -128,23 +128,31 @@ * global variables and related macros */ -enum { /* encrypt, decrypt, authenticate */ +enum { /* encrypt, decrypt, authenticate */ MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE } mode = MODE_ENCRYPT; -Desbuf ivec; /* initialization vector */ -Desbuf pvec; /* padding vector */ -char bits[] = { /* used to extract bits from a char */ +static Desbuf ivec; /* initialization vector */ +static Desbuf pvec; /* padding vector */ +static char bits[] = { /* used to extract bits from a char */ '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' }; -int pflag; /* 1 to preserve parity bits */ +static int pflag; /* 1 to preserve parity bits */ -char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ -int des_ct = 0; /* count for get_des_char/put_des_char */ -int des_n = 0; /* index for put_des_char/get_des_char */ +static char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ +static int des_ct = 0; /* count for get_des_char/put_des_char */ +static int des_n = 0; /* index for put_des_char/get_des_char */ #endif +static void des_error(const char *); +static int hex_to_binary(int, int); +static void expand_des_key(char *, char *); +static void set_des_key(char *); +static int cbc_decode(char *, FILE *); +static int cbc_encode(char *, int, FILE *); + + /* init_des_cipher: initialize DES */ void init_des_cipher(void) @@ -243,7 +251,7 @@ /* * print a warning message and, possibly, terminate */ -void +static void des_error(const char *s /* the message */) { (void)sprintf(errmsg, "%s", s ? s : strerror(errno)); @@ -252,7 +260,7 @@ /* * map a hex character to an integer */ -int +static int hex_to_binary(int c /* char to be converted */, int radix /* base (2 to 16) */) { @@ -283,7 +291,7 @@ /* * convert the key to a bit pattern */ -void +static void expand_des_key(char *obuf /* bit pattern */, char *inbuf /* the key itself */) { int i, j; /* counter in a for loop */ @@ -349,7 +357,7 @@ * systems set the parity (high) bit of each character to 0, and the * DES ignores the low order bit of each character. */ -void +static void set_des_key(Desbuf buf /* key block */) { int i, j; /* counter in a for loop */ @@ -378,7 +386,7 @@ /* * This encrypts using the Cipher Block Chaining mode of DES */ -int +static int cbc_encode(char *msgbuf, int n, FILE *fp) { int inverse = 0; /* 0 to encrypt, 1 to decrypt */ @@ -414,7 +422,7 @@ /* * This decrypts using the Cipher Block Chaining mode of DES */ -int +static int cbc_decode(char *msgbuf /* I/O buffer */, FILE *fp /* input file descriptor */) { Index: src/bin/ed/ed.h diff -u src/bin/ed/ed.h:1.33 src/bin/ed/ed.h:1.34 --- src/bin/ed/ed.h:1.33 Sun Jun 26 19:10:49 2005 +++ src/bin/ed/ed.h Sun Jul 26 02:06:37 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ed.h,v 1.33 2005/06/26 19:10:49 christos Exp $ */ +/* $NetBSD: ed.h,v 1.34 2009/07/26 02:06:37 dholland Exp $ */ /* ed.h: type and constant definitions for the ed editor. */ /* @@ -194,20 +194,16 @@ int append_lines(long); int apply_subst_template(char *, regmatch_t *, int, int); int build_active_list(int); -int cbc_decode(char *, FILE *); -int cbc_encode(char *, int, FILE *); int check_addr_range(long, long); void clear_active_list(void); void clear_undo_stack(void); int close_sbuf(void); int copy_lines(long); int delete_lines(long, long); -void des_error(const char *); int display_lines(long, long, int); line_t *dup_line_node(line_t *); int exec_command(void); long exec_global(int, int); -void expand_des_key(char *, char *); int extract_addr_range(void); char *extract_pattern(int); int extract_subst_tail(int *, long *); @@ -231,7 +227,6 @@ void handle_int(int); void handle_winch(int); int has_trailing_escape(char *, char *); -int hex_to_binary(int, int); void init_buffers(void); void init_des_cipher(void); int is_legal_filename(char *); @@ -253,7 +248,6 @@ long read_stream(FILE *, long); int search_and_replace(pattern_t *, int, int); int set_active_node(line_t *); -void set_des_key(char *); void signal_hup(int); void signal_int(int); char *strip_escapes(const char *);