/* ls.c - command to list files and devices */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2007,2008,2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/partition.h>
#include <grub/datetime.h>
GRUB_MOD_LICENSE ("GPLv3+");
{
{0, 0, 0, 0, 0, 0}
};
grub_ls_list_devices (int longlist);
{
auto int grub_ls_print_devices (const char *name);
{
if (longlist)
else
return 0;
}
grub_xputs ("\n");
#ifndef GRUB_UTIL
{
{
if (first)
first = 0;
}
grub_xputs ("\n");
}
#endif
grub_refresh ();
return 0;
}
{
char *device_name;
const char *path;
auto int print_files (const char *filename,
const struct grub_dirhook_info *info);
auto int print_files_long (const char *filename,
const struct grub_dirhook_info *info);
{
return 0;
}
const struct grub_dirhook_info *info)
{
return 0;
{
char *pathname;
else
if (!pathname)
return 1;
/* XXX: For ext2fs symlinks are detected as files while they
should be reported as directories. */
if (! file)
{
grub_errno = 0;
return 0;
}
if (! human)
else
{
int units = 0;
while (fsz / 1024)
{
fsz /= 1024;
units++;
}
if (units)
{
}
else
}
}
else
{
if (human)
grub_printf (" %d-%02d-%02d %02d:%02d:%02d %-11s ",
else
grub_printf (" %04d%02d%02d%02d%02d%02d ",
}
return 0;
}
if (! dev)
goto fail;
if (! path)
else
path++;
if (! path && ! device_name)
{
goto fail;
}
if (! *path)
{
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
}
else if (fs)
{
if (longlist)
else
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE
{
/* PATH might be a regular file. */
char *p;
grub_errno = 0;
if (! file)
goto fail;
if (! dirname)
goto fail;
all = 1;
if (longlist)
print_files_long (p, &info);
else
print_files (p, &info);
}
if (grub_errno == GRUB_ERR_NONE)
grub_xputs ("\n");
grub_refresh ();
}
fail:
if (dev)
return 0;
}
static grub_err_t
{
int i;
if (argc == 0)
else
for (i = 0; i < argc; i++)
return 0;
}
{
N_("[-l|-h|-a] [FILE ...]"),
}
{
}