Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com>
This commit is contained in:
parent
40eaa9f0bb
commit
92d23245c9
@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define error_msg(s, d) fprintf(stderr, s, d)
|
#define error_msg(s, d) fprintf(stderr, s, d)
|
||||||
#endif
|
#endif /* TEST */
|
||||||
|
|
||||||
|
|
||||||
struct history {
|
struct history {
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
typedef unsigned short unicode;
|
typedef unsigned short unicode;
|
||||||
|
|
||||||
static long int ctoi(unsigned char *s, int *is_unicode);
|
static long int ctoi(unsigned char *s, int *is_unicode);
|
||||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
||||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
||||||
unicode utf8_to_ucs2(char *buf);
|
static unicode utf8_to_ucs2(char *buf);
|
||||||
int screen_map_load(int fd, FILE * fp);
|
static int screen_map_load(int fd, FILE * fp);
|
||||||
|
|
||||||
int loadacm_main(int argc, char **argv)
|
int loadacm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int screen_map_load(int fd, FILE * fp)
|
static int screen_map_load(int fd, FILE * fp)
|
||||||
{
|
{
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
unicode wbuf[E_TABSZ];
|
unicode wbuf[E_TABSZ];
|
||||||
@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
*
|
*
|
||||||
* FIXME: ignores everything after second word
|
* FIXME: ignores everything after second word
|
||||||
*/
|
*/
|
||||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* line buffer reading file */
|
char buffer[256]; /* line buffer reading file */
|
||||||
char *p, *q; /* 1st + 2nd words in line */
|
char *p, *q; /* 1st + 2nd words in line */
|
||||||
@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int in, on;
|
int in, on;
|
||||||
@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
|||||||
*
|
*
|
||||||
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
|
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
|
||||||
*/
|
*/
|
||||||
long int ctoi(unsigned char *s, int *is_unicode)
|
static long int ctoi(unsigned char *s, int *is_unicode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t ls;
|
size_t ls;
|
||||||
@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void saveoldmap(int fd, char *omfil)
|
static unicode utf8_to_ucs2(char *buf)
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char buf[E_TABSZ];
|
|
||||||
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
unicode xbuf[E_TABSZ];
|
|
||||||
int is_old_map = 0;
|
|
||||||
|
|
||||||
if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
|
|
||||||
perror_msg("GIO_UNISCRNMAP ioctl error");
|
|
||||||
#endif
|
|
||||||
if (ioctl(fd, GIO_SCRNMAP, buf))
|
|
||||||
perror_msg_and_die("GIO_SCRNMAP ioctl error");
|
|
||||||
else
|
|
||||||
is_old_map = 1;
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fp = xfopen(omfil, "w");
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
if (is_old_map) {
|
|
||||||
#endif
|
|
||||||
if (fwrite(buf, E_TABSZ, 1, fp) != 1)
|
|
||||||
perror_msg_and_die("Error writing map to file");
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
} else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
|
|
||||||
perror_msg_and_die("Error writing map to file");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
unicode utf8_to_ucs2(char *buf)
|
|
||||||
{
|
{
|
||||||
int utf_count = 0;
|
int utf_count = 0;
|
||||||
long utf_char = 0;
|
long utf_char = 0;
|
||||||
|
@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r; \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define arithdivf(name, op) \
|
#define arithdivf(name, op) \
|
||||||
int name (l, r) VALUE *l; VALUE *r; \
|
static int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (r)) \
|
if (!toarith (l) || !toarith (r)) \
|
||||||
error_msg_and_die ( "non-numeric argument"); \
|
error_msg_and_die ( "non-numeric argument"); \
|
||||||
|
@ -110,10 +110,10 @@ enum token_types {
|
|||||||
PAREN
|
PAREN
|
||||||
};
|
};
|
||||||
|
|
||||||
struct t_op {
|
static const struct t_op {
|
||||||
const char *op_text;
|
const char *op_text;
|
||||||
short op_num, op_type;
|
short op_num, op_type;
|
||||||
} const ops [] = {
|
} ops [] = {
|
||||||
{"-r", FILRD, UNOP},
|
{"-r", FILRD, UNOP},
|
||||||
{"-w", FILWR, UNOP},
|
{"-w", FILWR, UNOP},
|
||||||
{"-x", FILEX, UNOP},
|
{"-x", FILEX, UNOP},
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* getopt not needed */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
|
2
expr.c
2
expr.c
@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r; \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define arithdivf(name, op) \
|
#define arithdivf(name, op) \
|
||||||
int name (l, r) VALUE *l; VALUE *r; \
|
static int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (r)) \
|
if (!toarith (l) || !toarith (r)) \
|
||||||
error_msg_and_die ( "non-numeric argument"); \
|
error_msg_and_die ( "non-numeric argument"); \
|
||||||
|
53
loadacm.c
53
loadacm.c
@ -24,10 +24,10 @@
|
|||||||
typedef unsigned short unicode;
|
typedef unsigned short unicode;
|
||||||
|
|
||||||
static long int ctoi(unsigned char *s, int *is_unicode);
|
static long int ctoi(unsigned char *s, int *is_unicode);
|
||||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
||||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
||||||
unicode utf8_to_ucs2(char *buf);
|
static unicode utf8_to_ucs2(char *buf);
|
||||||
int screen_map_load(int fd, FILE * fp);
|
static int screen_map_load(int fd, FILE * fp);
|
||||||
|
|
||||||
int loadacm_main(int argc, char **argv)
|
int loadacm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int screen_map_load(int fd, FILE * fp)
|
static int screen_map_load(int fd, FILE * fp)
|
||||||
{
|
{
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
unicode wbuf[E_TABSZ];
|
unicode wbuf[E_TABSZ];
|
||||||
@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
*
|
*
|
||||||
* FIXME: ignores everything after second word
|
* FIXME: ignores everything after second word
|
||||||
*/
|
*/
|
||||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* line buffer reading file */
|
char buffer[256]; /* line buffer reading file */
|
||||||
char *p, *q; /* 1st + 2nd words in line */
|
char *p, *q; /* 1st + 2nd words in line */
|
||||||
@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int in, on;
|
int in, on;
|
||||||
@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
|||||||
*
|
*
|
||||||
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
|
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
|
||||||
*/
|
*/
|
||||||
long int ctoi(unsigned char *s, int *is_unicode)
|
static long int ctoi(unsigned char *s, int *is_unicode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t ls;
|
size_t ls;
|
||||||
@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void saveoldmap(int fd, char *omfil)
|
static unicode utf8_to_ucs2(char *buf)
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char buf[E_TABSZ];
|
|
||||||
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
unicode xbuf[E_TABSZ];
|
|
||||||
int is_old_map = 0;
|
|
||||||
|
|
||||||
if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
|
|
||||||
perror_msg("GIO_UNISCRNMAP ioctl error");
|
|
||||||
#endif
|
|
||||||
if (ioctl(fd, GIO_SCRNMAP, buf))
|
|
||||||
perror_msg_and_die("GIO_SCRNMAP ioctl error");
|
|
||||||
else
|
|
||||||
is_old_map = 1;
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fp = xfopen(omfil, "w");
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
if (is_old_map) {
|
|
||||||
#endif
|
|
||||||
if (fwrite(buf, E_TABSZ, 1, fp) != 1)
|
|
||||||
perror_msg_and_die("Error writing map to file");
|
|
||||||
#ifdef GIO_UNISCRNMAP
|
|
||||||
} else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
|
|
||||||
perror_msg_and_die("Error writing map to file");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
unicode utf8_to_ucs2(char *buf)
|
|
||||||
{
|
{
|
||||||
int utf_count = 0;
|
int utf_count = 0;
|
||||||
long utf_char = 0;
|
long utf_char = 0;
|
||||||
|
@ -382,7 +382,7 @@ static void mark_good_blocks(void)
|
|||||||
mark_zone(good_blocks_table[blk]);
|
mark_zone(good_blocks_table[blk]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int next(int zone)
|
static int next(int zone)
|
||||||
{
|
{
|
||||||
if (!zone)
|
if (!zone)
|
||||||
zone = FIRSTZONE - 1;
|
zone = FIRSTZONE - 1;
|
||||||
|
@ -85,7 +85,7 @@ enum {
|
|||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
/* use globals to reduce size ??? */ /* test this hypothesis later */
|
/* use globals to reduce size ??? */ /* test this hypothesis later */
|
||||||
struct Globalvars {
|
static struct Globalvars {
|
||||||
int netfd; /* console fd:s are 0 and 1 (and 2) */
|
int netfd; /* console fd:s are 0 and 1 (and 2) */
|
||||||
/* same buffer used both for network and console read/write */
|
/* same buffer used both for network and console read/write */
|
||||||
char * buf; /* allocating so static size is smaller */
|
char * buf; /* allocating so static size is smaller */
|
||||||
@ -108,7 +108,7 @@ struct Globalvars {
|
|||||||
struct Globalvars * Gptr;
|
struct Globalvars * Gptr;
|
||||||
#define G (*Gptr)
|
#define G (*Gptr)
|
||||||
#else
|
#else
|
||||||
struct Globalvars G;
|
static struct Globalvars G;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void iacflush()
|
static inline void iacflush()
|
||||||
|
@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define error_msg(s, d) fprintf(stderr, s, d)
|
#define error_msg(s, d) fprintf(stderr, s, d)
|
||||||
#endif
|
#endif /* TEST */
|
||||||
|
|
||||||
|
|
||||||
struct history {
|
struct history {
|
||||||
|
4
telnet.c
4
telnet.c
@ -85,7 +85,7 @@ enum {
|
|||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
/* use globals to reduce size ??? */ /* test this hypothesis later */
|
/* use globals to reduce size ??? */ /* test this hypothesis later */
|
||||||
struct Globalvars {
|
static struct Globalvars {
|
||||||
int netfd; /* console fd:s are 0 and 1 (and 2) */
|
int netfd; /* console fd:s are 0 and 1 (and 2) */
|
||||||
/* same buffer used both for network and console read/write */
|
/* same buffer used both for network and console read/write */
|
||||||
char * buf; /* allocating so static size is smaller */
|
char * buf; /* allocating so static size is smaller */
|
||||||
@ -108,7 +108,7 @@ struct Globalvars {
|
|||||||
struct Globalvars * Gptr;
|
struct Globalvars * Gptr;
|
||||||
#define G (*Gptr)
|
#define G (*Gptr)
|
||||||
#else
|
#else
|
||||||
struct Globalvars G;
|
static struct Globalvars G;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void iacflush()
|
static inline void iacflush()
|
||||||
|
4
test.c
4
test.c
@ -110,10 +110,10 @@ enum token_types {
|
|||||||
PAREN
|
PAREN
|
||||||
};
|
};
|
||||||
|
|
||||||
struct t_op {
|
static const struct t_op {
|
||||||
const char *op_text;
|
const char *op_text;
|
||||||
short op_num, op_type;
|
short op_num, op_type;
|
||||||
} const ops [] = {
|
} ops [] = {
|
||||||
{"-r", FILRD, UNOP},
|
{"-r", FILRD, UNOP},
|
||||||
{"-w", FILWR, UNOP},
|
{"-w", FILWR, UNOP},
|
||||||
{"-x", FILEX, UNOP},
|
{"-x", FILEX, UNOP},
|
||||||
|
2
usleep.c
2
usleep.c
@ -21,6 +21,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* getopt not needed */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
|
@ -382,7 +382,7 @@ static void mark_good_blocks(void)
|
|||||||
mark_zone(good_blocks_table[blk]);
|
mark_zone(good_blocks_table[blk]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int next(int zone)
|
static int next(int zone)
|
||||||
{
|
{
|
||||||
if (!zone)
|
if (!zone)
|
||||||
zone = FIRSTZONE - 1;
|
zone = FIRSTZONE - 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user