convert "do {...} while (1);" -> "while (1) {...}"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-03-02 04:07:14 +01:00
parent 708dd4c986
commit 940c7206c2
4 changed files with 17 additions and 16 deletions

View File

@ -32,7 +32,7 @@ static char *next_file(char *old, unsigned suffix_len)
unsigned i = 1; unsigned i = 1;
char *curr; char *curr;
do { while (1) {
curr = old + end - i; curr = old + end - i;
if (*curr < 'z') { if (*curr < 'z') {
*curr += 1; *curr += 1;
@ -43,7 +43,7 @@ static char *next_file(char *old, unsigned suffix_len)
return NULL; return NULL;
} }
*curr = 'a'; *curr = 'a';
} while (1); }
return old; return old;
} }

View File

@ -93,16 +93,17 @@ int vlock_main(int argc UNUSED_PARAM, char **argv)
term.c_lflag &= ~(ECHO | ECHOCTL); term.c_lflag &= ~(ECHO | ECHOCTL);
tcsetattr_stdin_TCSANOW(&term); tcsetattr_stdin_TCSANOW(&term);
do { while (1) {
printf("Virtual console%s locked by %s.\n", printf("Virtual console%s locked by %s.\n",
option_mask32 /*o_lock_all*/ ? "s" : "", /* "s" if -a, else "": */ "s" + !option_mask32,
pw->pw_name); pw->pw_name
);
if (correct_password(pw)) { if (correct_password(pw)) {
break; break;
} }
bb_do_delay(FAIL_DELAY); bb_do_delay(FAIL_DELAY);
puts("Password incorrect"); puts("Password incorrect");
} while (1); }
#ifdef __linux__ #ifdef __linux__
ioctl(STDIN_FILENO, VT_SETMODE, &ovtm); ioctl(STDIN_FILENO, VT_SETMODE, &ovtm);

View File

@ -605,7 +605,7 @@ static void INET6_displayroutes(void)
set_flags(flags, (iflags & IPV6_MASK)); set_flags(flags, (iflags & IPV6_MASK));
r = 0; r = 0;
do { while (1) {
inet_pton(AF_INET6, addr6x + r, inet_pton(AF_INET6, addr6x + r,
(struct sockaddr *) &snaddr6.sin6_addr); (struct sockaddr *) &snaddr6.sin6_addr);
snaddr6.sin6_family = AF_INET6; snaddr6.sin6_family = AF_INET6;
@ -624,7 +624,7 @@ static void INET6_displayroutes(void)
free(naddr6); free(naddr6);
break; break;
} }
} while (1); }
} }
fclose(fp); fclose(fp);
} }

View File

@ -3539,12 +3539,12 @@ set_curjob(struct job *jp, unsigned mode)
/* first remove from list */ /* first remove from list */
jpp = curp = &curjob; jpp = curp = &curjob;
do { while (1) {
jp1 = *jpp; jp1 = *jpp;
if (jp1 == jp) if (jp1 == jp)
break; break;
jpp = &jp1->prev_job; jpp = &jp1->prev_job;
} while (1); }
*jpp = jp1->prev_job; *jpp = jp1->prev_job;
/* Then re-insert in correct position */ /* Then re-insert in correct position */
@ -3560,14 +3560,14 @@ set_curjob(struct job *jp, unsigned mode)
case CUR_RUNNING: case CUR_RUNNING:
/* newly created job or backgrounded job, /* newly created job or backgrounded job,
put after all stopped jobs. */ put after all stopped jobs. */
do { while (1) {
jp1 = *jpp; jp1 = *jpp;
#if JOBS #if JOBS
if (!jp1 || jp1->state != JOBSTOPPED) if (!jp1 || jp1->state != JOBSTOPPED)
#endif #endif
break; break;
jpp = &jp1->prev_job; jpp = &jp1->prev_job;
} while (1); }
/* FALLTHROUGH */ /* FALLTHROUGH */
#if JOBS #if JOBS
case CUR_STOPPED: case CUR_STOPPED:
@ -3740,7 +3740,7 @@ setjobctl(int on)
goto out; goto out;
/* fd is a tty at this point */ /* fd is a tty at this point */
close_on_exec_on(fd); close_on_exec_on(fd);
do { /* while we are in the background */ while (1) { /* while we are in the background */
pgrp = tcgetpgrp(fd); pgrp = tcgetpgrp(fd);
if (pgrp < 0) { if (pgrp < 0) {
out: out:
@ -3751,7 +3751,7 @@ setjobctl(int on)
if (pgrp == getpgrp()) if (pgrp == getpgrp())
break; break;
killpg(0, SIGTTIN); killpg(0, SIGTTIN);
} while (1); }
initialpgrp = pgrp; initialpgrp = pgrp;
setsignal(SIGTSTP); setsignal(SIGTSTP);
@ -5970,7 +5970,7 @@ expari(int quotes)
p = expdest - 1; p = expdest - 1;
*p = '\0'; *p = '\0';
p--; p--;
do { while (1) {
int esc; int esc;
while ((unsigned char)*p != CTLARI) { while ((unsigned char)*p != CTLARI) {
@ -5988,7 +5988,7 @@ expari(int quotes)
} }
p -= esc + 1; p -= esc + 1;
} while (1); }
begoff = p - start; begoff = p - start;