Compare commits
9
Commits
1_1_3
..
1_1_stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdea7807b1 | ||
|
|
bbc81fe9f4 | ||
|
|
ec74f95d10 | ||
|
|
d7031a3301 | ||
|
|
6af4cd1a87 | ||
|
|
0c4c053c9d | ||
|
|
ce4b564461 | ||
|
|
7107a2f38c | ||
|
|
edc9e373d9 |
No files matched your search
@@ -14,8 +14,8 @@ endif
|
||||
PROG := busybox
|
||||
MAJOR_VERSION :=1
|
||||
MINOR_VERSION :=1
|
||||
SUBLEVEL_VERSION:=3
|
||||
EXTRAVERSION :=
|
||||
SUBLEVEL_VERSION:=4
|
||||
EXTRAVERSION :=-pre0
|
||||
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
|
||||
+32
-23
@@ -3,9 +3,24 @@
|
||||
* tiny vi.c: A small 'vi' clone
|
||||
* Copyright (C) 2000, 2001 Sterling Huxley <sterling@europa.com>
|
||||
*
|
||||
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
static const char vi_Version[] =
|
||||
"$Id: vi.c,v 1.38 2004/08/19 19:15:06 andersen Exp $";
|
||||
|
||||
/*
|
||||
* To compile for standalone use:
|
||||
* gcc -Wall -Os -s -DSTANDALONE -o vi vi.c
|
||||
@@ -53,6 +68,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -70,9 +86,6 @@
|
||||
#include <stdarg.h>
|
||||
#ifndef STANDALONE
|
||||
#include "busybox.h"
|
||||
#define vi_Version BB_VER " " BB_BT
|
||||
#else
|
||||
#define vi_Version "standalone"
|
||||
#endif /* STANDALONE */
|
||||
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
@@ -1072,10 +1085,9 @@ static void colon(Byte * buf)
|
||||
#endif /* CONFIG_FEATURE_VI_SEARCH */
|
||||
} else if (strncasecmp((char *) cmd, "version", i) == 0) { // show software version
|
||||
psb("%s", vi_Version);
|
||||
} else if (strncasecmp((char *) cmd, "write", i) == 0 // write text to file
|
||||
|| strncasecmp((char *) cmd, "wq", i) == 0
|
||||
|| strncasecmp((char *) cmd, "wn", i) == 0
|
||||
|| strncasecmp((char *) cmd, "x", i) == 0) {
|
||||
} else if ((strncasecmp((char *) cmd, "write", i) == 0) || // write text to file
|
||||
(strncasecmp((char *) cmd, "wq", i) == 0) ||
|
||||
(strncasecmp((char *) cmd, "x", i) == 0)) {
|
||||
// is there a file name to write to?
|
||||
if (strlen((char *) args) > 0) {
|
||||
fn = args;
|
||||
@@ -1112,9 +1124,7 @@ static void colon(Byte * buf)
|
||||
file_modified = 0;
|
||||
last_file_modified = -1;
|
||||
}
|
||||
if ((cmd[0] == 'x' || cmd[1] == 'q' || cmd[1] == 'n' ||
|
||||
cmd[0] == 'X' || cmd[1] == 'Q' || cmd[1] == 'N')
|
||||
&& l == ch) {
|
||||
if ((cmd[0] == 'x' || cmd[1] == 'q') && l == ch) {
|
||||
editing = 0;
|
||||
}
|
||||
}
|
||||
@@ -2179,7 +2189,9 @@ static void core_sig(int sig)
|
||||
signal(SIGQUIT, core_sig);
|
||||
signal(SIGILL, core_sig);
|
||||
signal(SIGTRAP, core_sig);
|
||||
#ifdef SIGIOT
|
||||
signal(SIGIOT, core_sig);
|
||||
#endif
|
||||
signal(SIGABRT, core_sig);
|
||||
signal(SIGFPE, core_sig);
|
||||
signal(SIGBUS, core_sig);
|
||||
@@ -3423,10 +3435,9 @@ key_cmd_mode:
|
||||
} else {
|
||||
editing = 0;
|
||||
}
|
||||
} else if (strncasecmp((char *) p, "write", cnt) == 0
|
||||
|| strncasecmp((char *) p, "wq", cnt) == 0
|
||||
|| strncasecmp((char *) p, "wn", cnt) == 0
|
||||
|| strncasecmp((char *) p, "x", cnt) == 0) {
|
||||
} else if (strncasecmp((char *) p, "write", cnt) == 0 ||
|
||||
strncasecmp((char *) p, "wq", cnt) == 0 ||
|
||||
strncasecmp((char *) p, "x", cnt) == 0) {
|
||||
cnt = file_write(cfn, text, end - 1);
|
||||
if (cnt < 0) {
|
||||
if (cnt == -1)
|
||||
@@ -3435,8 +3446,7 @@ key_cmd_mode:
|
||||
file_modified = 0;
|
||||
last_file_modified = -1;
|
||||
psb("\"%s\" %dL, %dC", cfn, count_lines(text, end - 1), cnt);
|
||||
if (p[0] == 'x' || p[1] == 'q' || p[1] == 'n' ||
|
||||
p[0] == 'X' || p[1] == 'Q' || p[1] == 'N') {
|
||||
if (p[0] == 'x' || p[1] == 'q') {
|
||||
editing = 0;
|
||||
}
|
||||
}
|
||||
@@ -3617,13 +3627,12 @@ key_cmd_mode:
|
||||
indicate_error(c);
|
||||
break;
|
||||
}
|
||||
if (file_modified) {
|
||||
if (file_modified
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
if (vi_readonly || readonly) {
|
||||
psbs("\"%s\" File is read only", cfn);
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
&& ! vi_readonly
|
||||
&& ! readonly
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
) {
|
||||
cnt = file_write(cfn, text, end - 1);
|
||||
if (cnt < 0) {
|
||||
if (cnt == -1)
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ static invert_search_t invert_search;
|
||||
#define GREP_OPT_L (1<<12)
|
||||
#define PRINT_FILES_WITHOUT_MATCHES ((opt & GREP_OPT_L) != 0)
|
||||
#if ENABLE_FEATURE_GREP_CONTEXT
|
||||
#define GREP_OPT_CONTEXT "A:B:C"
|
||||
#define GREP_OPT_CONTEXT "A:B:C:"
|
||||
#define GREP_OPT_A (1<<13)
|
||||
#define GREP_OPT_B (1<<14)
|
||||
#define GREP_OPT_C (1<<15)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* stored and free'ed by the caller. If end is null '\n' isn't considered
|
||||
* and of line. If end isn't null, length of the chunk read is stored in it. */
|
||||
|
||||
char *bb_get_chunk_from_file(FILE *file, int *end)
|
||||
char *bb_get_chunk_from_file(FILE * file, int *end)
|
||||
{
|
||||
int ch;
|
||||
int idx = 0;
|
||||
@@ -30,10 +30,12 @@ char *bb_get_chunk_from_file(FILE *file, int *end)
|
||||
if (idx > linebufsz - 2) {
|
||||
linebuf = xrealloc(linebuf, linebufsz += 80);
|
||||
}
|
||||
linebuf[idx++] = (char)ch;
|
||||
if (!ch || (end && ch == '\n')) break;
|
||||
linebuf[idx++] = (char) ch;
|
||||
if (!ch || (end && ch == '\n'))
|
||||
break;
|
||||
}
|
||||
if (end) *end = idx;
|
||||
if (end)
|
||||
*end = idx;
|
||||
if (linebuf) {
|
||||
if (ferror(file)) {
|
||||
free(linebuf);
|
||||
@@ -45,18 +47,21 @@ char *bb_get_chunk_from_file(FILE *file, int *end)
|
||||
}
|
||||
|
||||
/* Get line, including trailing /n if any */
|
||||
char *bb_get_line_from_file(FILE *file)
|
||||
char *bb_get_line_from_file(FILE * file)
|
||||
{
|
||||
int i;
|
||||
|
||||
return bb_get_chunk_from_file(file, &i);
|
||||
}
|
||||
|
||||
/* Get line. Remove trailing /n */
|
||||
char *bb_get_chomped_line_from_file(FILE *file)
|
||||
char *bb_get_chomped_line_from_file(FILE * file)
|
||||
{
|
||||
int i;
|
||||
char *c=bb_get_chunk_from_file(file, &i);
|
||||
if(i) c[--i]=0;
|
||||
|
||||
char *c = bb_get_chunk_from_file(file, &i);
|
||||
|
||||
if (i && c[--i] == '\n')
|
||||
c[i] = 0;
|
||||
|
||||
return c;
|
||||
}
|
||||
+2
-2
@@ -206,8 +206,8 @@ int INET6_resolve(const char *name, struct sockaddr_in6 *sin6)
|
||||
|
||||
#ifndef IN6_IS_ADDR_UNSPECIFIED
|
||||
# define IN6_IS_ADDR_UNSPECIFIED(a) \
|
||||
(((__u32 *) (a))[0] == 0 && ((__u32 *) (a))[1] == 0 && \
|
||||
((__u32 *) (a))[2] == 0 && ((__u32 *) (a))[3] == 0)
|
||||
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
|
||||
((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ static void data_readlines(void)
|
||||
char current_line[256];
|
||||
FILE *fp;
|
||||
|
||||
fp = (inp_stdin) ? stdin : bb_xfopen(filename, "rt");
|
||||
fp = (inp_stdin) ? stdin : bb_xfopen(filename, "r");
|
||||
flines = NULL;
|
||||
for (i = 0; (feof(fp)==0) && (i <= MAXLINES); i++) {
|
||||
strcpy(current_line, "");
|
||||
|
||||
+4
-4
@@ -290,15 +290,15 @@ static struct dep_t *build_dep ( void )
|
||||
}
|
||||
|
||||
filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release );
|
||||
|
||||
if (( fd = open ( filename, O_RDONLY )) < 0 ) {
|
||||
|
||||
fd = open ( filename, O_RDONLY );
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(filename);
|
||||
if (fd < 0) {
|
||||
/* Ok, that didn't work. Fall back to looking in /lib/modules */
|
||||
if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(filename);
|
||||
|
||||
while ( reads ( fd, buffer, sizeof( buffer ))) {
|
||||
int l = bb_strlen ( buffer );
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ static int singlemount(struct mntent *mp)
|
||||
|
||||
// If mount failed, clean up loop file (if any).
|
||||
|
||||
if (rc && loopFile) {
|
||||
if (ENABLE_FEATURE_MOUNT_LOOP && rc && loopFile) {
|
||||
del_loop(mp->mnt_fsname);
|
||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||
free(loopFile);
|
||||
|
||||
Reference in new issue
Block a user