Unix Technical Forum

Re: new in rm

This is a discussion on Re: new in rm within the mailing.openbsd.tech forums, part of the OpenBSD category; --> * Ray Lai (ray@cyth.net) wrote: > > continue; > > - else if (S_ISDIR(sb.st_mode)) > > - rval = ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:43 AM
Pierre-Yves Ritschard
 
Posts: n/a
Default Re: new in rm

* Ray Lai (ray@cyth.net) wrote:
> > continue;
> > - else if (S_ISDIR(sb.st_mode))
> > - rval = rmdir(f);
> > else {
> > - if (Pflag)
> > - if (!rm_overwrite(f, &sb))
> > - continue;
> > - rval = unlink(f);
> > + if (vflag)
> > + printf("%s\n", f);
> > + if (S_ISDIR(sb.st_mode))
> > + rval = rmdir(f);
> > + else {
> > + if (Pflag)
> > + if (!rm_overwrite(f, &sb))
> > + continue;
> > + rval = unlink(f);
> > + }

>
> Why the additional level of indentation?
>
> And as djm@ suggested, ``It should probably print the file/directory
> name *after* successfully removing it.''
>
> > }


look at the initial code, it was a "else if" condition, here i wanted to
print the path in the else condition, then run the if else test.

hence the code moved from

before | after
|
if { | if {
stmt1; | stmt1;
} else if { | } else {
stmt2; | additionnal_stmt;
} else { | if {
stmt3; | stmt2;
} | } else {
| stmt3;
| }
| }

I'll move to post-removal printing anyway.

> > .Fl R .
> > +.Pp
> > +.It Fl v
> > +Print each file path before removal. Useful when removing large
> > +directories.

>
> You don't need a .Pp right before a .It.
>

noted, thanks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:25 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com