{(char *) "ignore", no_argument, NULL, 'i'},
{(char *) "long-name", no_argument, NULL, 'l'},
{(char *) "mixed", no_argument, NULL, 'm'},
+ {(char *) "mode", no_argument, NULL, 'M'},
{(char *) "option", no_argument, NULL, 'o'},
{(char *) "path", no_argument, NULL, 'p'},
{(char *) "short-name", no_argument, NULL, 's'},
{0, no_argument, 0, 0}
};
-static char options[] = "ac:df:hilmopst:uvwADHPSW";
+static char options[] = "ac:df:hilmMopst:uvwADHPSW";
static void
usage (FILE * stream, int status)
Output type options:\n\
-d, --dos print DOS (short) form of NAME (C:\\PROGRA~1\\)\n\
-m, --mixed like --windows, but with regular slashes (C:/WINNT)\n\
+ -M, --mode report on mode of file (binmode or textmode)\n\
-u, --unix (default) print Unix form of NAME (/cygdrive/c/winnt)\n\
-w, --windows print Windows form of NAME (C:\\WINNT)\n\
-t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'\n\
}
static void
+report_mode (char *filename)
+{
+ switch (cygwin_internal (CW_GET_BINMODE, filename))
+ {
+ case O_BINARY:
+ printf ("%s: binary\n", filename);
+ break;
+ case O_TEXT:
+ printf ("%s: text\n", filename);
+ break;
+ default:
+ fprintf (stderr, "%s: file '%s' - %s\n", prog_name, filename,
+ strerror (errno));
+ break;
+ }
+}
+
+static void
doit (char *filename)
{
char *buf;
{
int c, o = 0;
int options_from_file_flag;
- char *filename;
+ int mode_flag;
prog_name = strrchr (argv[0], '/');
if (prog_name == NULL)
options_from_file_flag = 0;
allusers_flag = 0;
output_flag = 0;
+ mode_flag = 0;
while ((c = getopt_long (argc, argv, options,
long_options, (int *) NULL)) != EOF)
{
file_arg = optarg;
break;
+ case 'M':
+ mode_flag = 1;
+ break;
+
case 'o':
options_from_file_flag = 1;
break;
if (optind > argc - 1)
usage (stderr, 1);
- for (int i=optind; argv[i]; i++) {
- filename = argv[i];
- doit (filename);
- }
+ for (int i = optind; argv[i]; i++)
+ if (mode_flag)
+ report_mode (argv[i]);
+ else
+ doit (argv[i]);
}
else
{
Output type options:
-d, --dos print DOS (short) form of NAME (C:\PROGRA~1\)
-m, --mixed like --windows, but with regular slashes (C:/WINNT)
+ -M, --mode report on mode of file (currently binmode or textmode)
-u, --unix (default) print Unix form of NAME (/cygdrive/c/winnt)
-w, --windows print Windows form of NAME (C:\WINNT)
-t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'