This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] : make cygpath use multiple filename arguments


What about filenames with spaces in them? Wouldn't the output be ambiguous?

Mark Blackburn wrote:

Dunno if anybody will find this useful or not:

Currently if you say:

# cygpath -w /usr /lib

you get a usage error. With my patch you get:

# cygpath -w /usr /lib
c:\cygwin\usr c:\cygwin\lib

Mark.


------------------------------------------------------------------------


Index: utils/cygpath.cc
===================================================================
RCS file: /cvs/src/src/winsup/utils/cygpath.cc,v
retrieving revision 1.28
diff -u -p -r1.28 cygpath.cc
--- utils/cygpath.cc 12 Jun 2003 20:40:58 -0000 1.28
+++ utils/cygpath.cc 17 Jul 2003 20:36:17 -0000
@@ -479,7 +479,7 @@ doit (char *filename)
}
}
- puts (buf);
+ printf ("%s", buf);
}
static void
@@ -675,11 +675,16 @@ main (int argc, char **argv)
if (output_flag)
dowin (o);
- if (optind != argc - 1)
+ if (optind > argc - 1)
usage (stderr, 1);
- filename = argv[optind];
- doit (filename);
+ for (int i=optind; argv[i]; i++) {
+ if (i != optind)
+ printf(" ");
+ filename = argv[i];
+ doit (filename);
+ }
+ printf("\n");
}
else
{






-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]