aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdformat.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /util-linux/fdformat.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.bz2
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'util-linux/fdformat.c')
-rw-r--r--util-linux/fdformat.c24
1 files changed, 8 insertions, 16 deletions
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 @@
9 * 5 July 2003 -- modified for Busybox by Erik Andersen 9 * 5 July 2003 -- modified for Busybox by Erik Andersen
10 */ 10 */
11 11
12#include <stdio.h>
13#include <string.h>
14#include <fcntl.h>
15#include <errno.h>
16#include <unistd.h>
17#include <stdlib.h>
18#include <sys/stat.h>
19#include <sys/ioctl.h>
20#include "busybox.h" 12#include "busybox.h"
21 13
22 14
@@ -60,10 +52,10 @@ static void print_and_flush(const char * __restrict format, ...)
60 va_start(arg, format); 52 va_start(arg, format);
61 bb_vfprintf(stdout, format, arg); 53 bb_vfprintf(stdout, format, arg);
62 va_end(arg); 54 va_end(arg);
63 bb_xfflush_stdout(); 55 xfflush_stdout();
64} 56}
65 57
66static void bb_xioctl(int fd, int request, void *argp, const char *string) 58static void xioctl(int fd, int request, void *argp, const char *string)
67{ 59{
68 if (ioctl (fd, request, argp) < 0) { 60 if (ioctl (fd, request, argp) < 0) {
69 bb_perror_msg_and_die(string); 61 bb_perror_msg_and_die(string);
@@ -95,9 +87,9 @@ int fdformat_main(int argc,char **argv)
95 87
96 88
97 /* O_RDWR for formatting and verifying */ 89 /* O_RDWR for formatting and verifying */
98 fd = bb_xopen(*argv,O_RDWR ); 90 fd = xopen(*argv,O_RDWR );
99 91
100 bb_xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */ 92 xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */
101 93
102 print_and_flush("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n", 94 print_and_flush("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n",
103 (param.head == 2) ? "Double" : "Single", 95 (param.head == 2) ? "Double" : "Single",
@@ -105,22 +97,22 @@ int fdformat_main(int argc,char **argv)
105 97
106 /* FORMAT */ 98 /* FORMAT */
107 print_and_flush("Formatting ... ", NULL); 99 print_and_flush("Formatting ... ", NULL);
108 bb_xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG"); 100 xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG");
109 101
110 /* n == track */ 102 /* n == track */
111 for (n = 0; n < param.track; n++) 103 for (n = 0; n < param.track; n++)
112 { 104 {
113 descr.head = 0; 105 descr.head = 0;
114 descr.track = n; 106 descr.track = n;
115 bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); 107 xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
116 print_and_flush("%3d\b\b\b", n); 108 print_and_flush("%3d\b\b\b", n);
117 if (param.head == 2) { 109 if (param.head == 2) {
118 descr.head = 1; 110 descr.head = 1;
119 bb_xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); 111 xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
120 } 112 }
121 } 113 }
122 114
123 bb_xioctl(fd,FDFMTEND,NULL,"FDFMTEND"); 115 xioctl(fd,FDFMTEND,NULL,"FDFMTEND");
124 print_and_flush("done\n", NULL); 116 print_and_flush("done\n", NULL);
125 117
126 /* VERIFY */ 118 /* VERIFY */