diff options
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fbset.c | 13 | ||||
-rw-r--r-- | util-linux/fdformat.c | 24 | ||||
-rw-r--r-- | util-linux/freeramdisk.c | 9 | ||||
-rw-r--r-- | util-linux/getopt.c | 12 | ||||
-rw-r--r-- | util-linux/hexdump.c | 3 | ||||
-rw-r--r-- | util-linux/mdev.c | 10 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 20 | ||||
-rw-r--r-- | util-linux/mkswap.c | 2 | ||||
-rw-r--r-- | util-linux/more.c | 23 | ||||
-rw-r--r-- | util-linux/mount.c | 16 | ||||
-rw-r--r-- | util-linux/nfsmount.c | 10 | ||||
-rw-r--r-- | util-linux/readprofile.c | 31 | ||||
-rw-r--r-- | util-linux/umount.c | 4 |
13 files changed, 40 insertions, 137 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 7d3cae251..9a207b6e3 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -12,15 +12,6 @@ * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <ctype.h> -#include <string.h> -#include <stdint.h> -#include <sys/ioctl.h> #include "busybox.h" #define DEFAULTFBDEV FB_0 @@ -186,7 +177,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, char buf[256]; char *p = buf; - f = bb_xfopen(fn, "r"); + f = xfopen(fn, "r"); while (!feof(f)) { fgets(buf, sizeof(buf), f); if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) { @@ -396,7 +387,7 @@ int fbset_main(int argc, char **argv) } } - fh = bb_xopen(fbdev, O_RDONLY); + fh = xopen(fbdev, O_RDONLY); if (ioctl(fh, FBIOGET_VSCREENINFO, &var)) bb_perror_msg_and_die("fbset(ioctl)"); if (g_options & OPT_READMODE) { diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index f94d455c9..63ec2204d 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -9,14 +9,6 @@ * 5 July 2003 -- modified for Busybox by Erik Andersen */ -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <sys/stat.h> -#include <sys/ioctl.h> #include "busybox.h" @@ -60,10 +52,10 @@ static void print_and_flush(const char * __restrict format, ...) va_start(arg, format); bb_vfprintf(stdout, format, arg); va_end(arg); - bb_xfflush_stdout(); + xfflush_stdout(); } -static void bb_xioctl(int fd, int request, void *argp, const char *string) +static void xioctl(int fd, int request, void *argp, const char *string) { if (ioctl (fd, request, argp) < 0) { bb_perror_msg_and_die(string); @@ -95,9 +87,9 @@ int fdformat_main(int argc,char **argv) /* O_RDWR for formatting and verifying */ - fd = bb_xopen(*argv,O_RDWR ); + fd = xopen(*argv,O_RDWR ); - bb_xioctl(fd, FDGETPRM, ¶m, "FDGETPRM");/*original message was: "Could not determine current format type" */ + xioctl(fd, FDGETPRM, ¶m, "FDGETPRM");/*original message was: "Could not determine current format type" */ print_and_flush("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n", (param.head == 2) ? "Double" : "Single", @@ -105,22 +97,22 @@ int fdformat_main(int argc,char **argv) /* FORMAT */ print_and_flush("Formatting ... ", NULL); - bb_xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG"); + xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG"); /* n == track */ for (n = 0; n < param.track; n++) { descr.head = 0; descr.track = n; - bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); + xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); print_and_flush("%3d\b\b\b", n); if (param.head == 2) { descr.head = 1; - bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); + xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); } } - bb_xioctl(fd,FDFMTEND,NULL,"FDFMTEND"); + xioctl(fd,FDFMTEND,NULL,"FDFMTEND"); print_and_flush("done\n", NULL); /* VERIFY */ diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index c959158c9..9e1c453e4 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -9,13 +9,6 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <stdlib.h> -#include <unistd.h> #include "busybox.h" /* From <linux/fd.h> */ @@ -28,7 +21,7 @@ int freeramdisk_main(int argc, char **argv) if (argc != 2) bb_show_usage(); - fd = bb_xopen(argv[1], O_RDWR); + fd = xopen(argv[1], O_RDWR); // Act like freeramdisk, fdflush, or both depending on configuration. result = ioctl(fd, (ENABLE_FREERAMDISK && bb_applet_name[1]=='r') diff --git a/util-linux/getopt.c b/util-linux/getopt.c index fab8f8398..bf05f9164 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -31,14 +31,8 @@ * */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <ctype.h> -#include <getopt.h> - #include "busybox.h" +#include <getopt.h> /* NON_OPT is the code that is returned when a non-option is found in '+' mode */ @@ -86,7 +80,7 @@ const char *normalize(const char *arg) free(BUFFER); if (!quote) { /* Just copy arg */ - BUFFER=bb_xstrdup(arg); + BUFFER=xstrdup(arg); return BUFFER; } @@ -215,7 +209,7 @@ void add_longopt(const char *name,int has_arg) long_options[long_options_nr-1].has_arg=has_arg; long_options[long_options_nr-1].flag=NULL; long_options[long_options_nr-1].val=LONG_OPT; - long_options[long_options_nr-1].name=bb_xstrdup(name); + long_options[long_options_nr-1].name=xstrdup(name); } long_options_nr++; } diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 12f540a53..136243122 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -11,7 +11,6 @@ #include "busybox.h" #include <getopt.h> -#include <string.h> #include "dump.h" static void bb_dump_addfile(char *name) @@ -20,7 +19,7 @@ static void bb_dump_addfile(char *name) FILE *fp; char *buf; - fp = bb_xfopen(name, "r"); + fp = xfopen(name, "r"); while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) { p = skip_whitespace(buf); diff --git a/util-linux/mdev.c b/util-linux/mdev.c index c77c122b5..7c1223dcb 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -10,10 +10,6 @@ */ #include "busybox.h" -#include <ctype.h> -#include <errno.h> -#include <sys/mman.h> -#include <sys/sysmacros.h> #include "xregex.h" #define DEV_PATH "/dev" @@ -146,7 +142,7 @@ static void make_device(char *path, int delete) break; } if ((s2-s+1) & (1<<delete)) - command = bb_xstrndup(pos, end-pos); + command = xstrndup(pos, end-pos); } pos = end2; @@ -180,7 +176,7 @@ static void make_device(char *path, int delete) int rc; char *s; - s=bb_xasprintf("MDEV=%s",device_name); + s=xasprintf("MDEV=%s",device_name); putenv(s); rc = system(command); s[4]=0; @@ -232,7 +228,7 @@ int mdev_main(int argc, char *argv[]) char *env_path; RESERVE_CONFIG_BUFFER(temp,PATH_MAX); - bb_xchdir(DEV_PATH); + xchdir(DEV_PATH); /* Scan */ diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 7f52b563e..a8737a6c9 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -62,20 +62,8 @@ * removed getopt based parser and added a hand rolled one. */ -#include <stdio.h> -#include <time.h> -#include <unistd.h> -#include <string.h> -#include <signal.h> -#include <fcntl.h> -#include <ctype.h> -#include <stdlib.h> -#include <stdint.h> -#include <termios.h> -#include <sys/ioctl.h> -#include <sys/param.h> -#include <mntent.h> #include "busybox.h" +#include <mntent.h> #define MINIX_ROOT_INO 1 #define MINIX_LINK_MAX 250 @@ -304,7 +292,7 @@ static inline int get_size(const char *file) int fd; long size; - fd = bb_xopen3(file, O_RDWR, 0); + fd = xopen3(file, O_RDWR, 0); if (ioctl(fd, BLKGETSIZE, &size) >= 0) { close(fd); return (size * 512); @@ -678,7 +666,7 @@ static void get_list_blocks(char *filename) FILE *listfile; unsigned long blockno; - listfile = bb_xfopen(filename, "r"); + listfile = xfopen(filename, "r"); while (!feof(listfile)) { fscanf(listfile, "%ld\n", &blockno); mark_zone(blockno); @@ -817,7 +805,7 @@ goodbye: tmp += dirsize; *(short *) tmp = 2; strcpy(tmp + 2, ".badblocks"); - DEV = bb_xopen3(device_name, O_RDWR, 0); + DEV = xopen3(device_name, O_RDWR, 0); if (fstat(DEV, &statbuf) < 0) bb_error_msg_and_die("unable to stat %s", device_name); if (!S_ISBLK(statbuf.st_mode)) diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 9b1e2b5c3..b109f5ce1 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -20,7 +20,7 @@ int mkswap_main(int argc, char *argv[]) // Figure out how big the device is and announce our intentions. - fd = bb_xopen(argv[1],O_RDWR); + fd = xopen(argv[1],O_RDWR); len = fdlength(fd); pagesize = getpagesize(); printf("Setting up swapspace version 1, size = %ld bytes\n", (long)(len-pagesize)); diff --git a/util-linux/more.c b/util-linux/more.c index 2ad1e797c..f68292e80 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -11,28 +11,9 @@ * * Termios corrects by Vladimir Oleynik <dzo@simtreas.ru> * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * Licensed under GPLv2 or later, see file License in this tarball for details. */ -#include <stdio.h> -#include <fcntl.h> -#include <signal.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/ioctl.h> #include "busybox.h" @@ -76,7 +57,7 @@ int more_main(int argc, char **argv) if(isatty(STDOUT_FILENO)) { cin = fopen(CURRENT_TTY, "r"); if (!cin) - cin = bb_xfopen(CONSOLE_DEV, "r"); + cin = xfopen(CONSOLE_DEV, "r"); please_display_more_prompt = 2; #ifdef CONFIG_FEATURE_USE_TERMIOS cin_fileno = fileno(cin); diff --git a/util-linux/mount.c b/util-linux/mount.c index c64c3f438..f665a0875 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -23,13 +23,7 @@ */ #include "busybox.h" -#include <unistd.h> -#include <errno.h> -#include <string.h> #include <mntent.h> -#include <ctype.h> -#include <fcntl.h> // for CONFIG_FEATURE_MOUNT_LOOP -#include <sys/ioctl.h> // for CONFIG_FEATURE_MOUNT_LOOP // These two aren't always defined in old headers #ifndef MS_BIND @@ -89,12 +83,12 @@ struct { static void append_mount_options(char **oldopts, char *newopts) { if(*oldopts && **oldopts) { - char *temp=bb_xasprintf("%s,%s",*oldopts,newopts); + char *temp=xasprintf("%s,%s",*oldopts,newopts); free(*oldopts); *oldopts=temp; } else { if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts); - *oldopts = bb_xstrdup(newopts); + *oldopts = xstrdup(newopts); } } @@ -165,7 +159,7 @@ static llist_t *get_block_backed_filesystems(void) if(*fs=='#' || *fs=='*') continue; if(!*fs) continue; - llist_add_to_end(&list,bb_xstrdup(fs)); + llist_add_to_end(&list,xstrdup(fs)); } if (ENABLE_FEATURE_CLEAN_UP) fclose(f); } @@ -367,7 +361,7 @@ report_error: int mount_main(int argc, char **argv) { - char *cmdopts = bb_xstrdup(""), *fstabname, *fstype=0, *storage_path=0; + char *cmdopts = xstrdup(""), *fstabname, *fstype=0, *storage_path=0; FILE *fstab; int i, opt, all = FALSE, rc = 0; struct mntent mtpair[2], *mtcur = mtpair; @@ -493,7 +487,7 @@ int mount_main(int argc, char **argv) // Mount the last thing we found. mtcur = mtnext; - mtcur->mnt_opts=bb_xstrdup(mtcur->mnt_opts); + mtcur->mnt_opts = xstrdup(mtcur->mnt_opts); append_mount_options(&(mtcur->mnt_opts),cmdopts); rc = singlemount(mtcur, 0); free(mtcur->mnt_opts); diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index 705975d29..e7d194f0f 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c @@ -26,10 +26,6 @@ */ #include "busybox.h" -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <time.h> #include <sys/utsname.h> #undef TRUE #undef FALSE @@ -391,7 +387,7 @@ int nfsmount(const char *spec, const char *node, int *flags, } sprintf(new_opts, "%s%saddr=%s", old_opts, *old_opts ? "," : "", s); - *mount_opts = bb_xstrdup(new_opts); + *mount_opts = xstrdup(new_opts); /* Set default options. * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to @@ -459,7 +455,7 @@ int nfsmount(const char *spec, const char *node, int *flags, else if (!strcmp(opt, "mountport")) mountport = val; else if (!strcmp(opt, "mounthost")) - mounthost=bb_xstrndup(opteq+1, + mounthost=xstrndup(opteq+1, strcspn(opteq+1," \t\n\r,")); else if (!strcmp(opt, "mountprog")) mountprog = val; @@ -729,7 +725,7 @@ int nfsmount(const char *spec, const char *node, int *flags, if (!bg) goto fail; if (!running_bg) { - prev_bg_host = bb_xstrdup(hostname); + prev_bg_host = xstrdup(hostname); if (retry > 0) retval = EX_BG; goto fail; diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 8fe8787ba..aaa419a3c 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -4,19 +4,7 @@ * * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it) * - * 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. + * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ /* @@ -44,17 +32,8 @@ * Paul Mundt <lethal@linux-sh.org>. */ -#include <errno.h> -#include <stdio.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/utsname.h> - #include "busybox.h" +#include <sys/utsname.h> #define S_LEN 128 @@ -138,7 +117,7 @@ int readprofile_main(int argc, char **argv) to_write = 1; /* sth different from sizeof(int) */ } - fd = bb_xopen(defaultpro,O_WRONLY); + fd = xopen(defaultpro,O_WRONLY); if (write(fd, &multiplier, to_write) != to_write) bb_perror_msg_and_die("error writing %s", defaultpro); @@ -151,7 +130,7 @@ int readprofile_main(int argc, char **argv) * Use an fd for the profiling buffer, to skip stdio overhead */ - proFd = bb_xopen(proFile,O_RDONLY); + proFd = xopen(proFile,O_RDONLY); if (((int)(len=lseek(proFd,0,SEEK_END)) < 0) || (lseek(proFd,0,SEEK_SET) < 0)) @@ -198,7 +177,7 @@ int readprofile_main(int argc, char **argv) total = 0; - map = bb_xfopen(mapFile, "r"); + map = xfopen(mapFile, "r"); while (fgets(mapline,S_LEN,map)) { if (sscanf(mapline,"%llx %s %s",&fn_add,mode,fn_name) != 3) diff --git a/util-linux/umount.c b/util-linux/umount.c index b5696f78b..b74b11027 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -66,8 +66,8 @@ int umount_main(int argc, char **argv) } else while (getmntent_r(fp,&me,path,sizeof(path))) { m = xmalloc(sizeof(struct mtab_list)); m->next = mtl; - m->device = bb_xstrdup(me.mnt_fsname); - m->dir = bb_xstrdup(me.mnt_dir); + m->device = xstrdup(me.mnt_fsname); + m->dir = xstrdup(me.mnt_dir); mtl = m; } endmntent(fp); |