X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=sources%2Fmylschroot.c;h=13d93bb6316c36f70e730609f02e0101ce8fe8de;hb=5d621249af8897e27fc0a842a33e7a7ef3b9c2ca;hp=a2b2a8a18228d74965d4ff15c6da54cfe859b60e;hpb=7321862445902ceedfa27b3f9e250fc7ff72653e;p=gapil.git diff --git a/sources/mylschroot.c b/sources/mylschroot.c index a2b2a8a..13d93bb 100644 --- a/sources/mylschroot.c +++ b/sources/mylschroot.c @@ -18,30 +18,32 @@ */ /***************************************************************************** * - * File myls.c: An example ls done after a chroot + * File mylschroot.c: An example ls done after a chroot + * List files and their size inside a given directory inside a chroot * * Author: S. Piccardi Mar. 2005 * - * $Id$ - * *****************************************************************************/ -#include -#include -#include /* directory */ -#include /* C standard library */ -#include +/* + * Include needed headers + */ +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* directory operation constants and functions */ +#include /* C standard library */ +#include /* unix standard library */ #include "Gapil.h" -/* - * Program myls - * - * List files and their size inside a given directory + +/* + * Function and globals definitions */ -/* Help printing routine */ -void usage(void); -/* computation function for DirScan */ -int do_ls(struct dirent * direntry); +void usage(void); /* Help printing routine */ +int do_ls(struct dirent * direntry); /* computation function for DirScan */ +/* + * Main program + */ int main(int argc, char *argv[]) { int i; @@ -52,7 +54,7 @@ int main(int argc, char *argv[]) * Use getopt function */ opterr = 0; /* don't want writing to stderr */ - while ( (i = getopt(argc, argv, "hs:l:wrbf")) != -1) { + while ( (i = getopt(argc, argv, "h")) != -1) { switch (i) { /* * Handling options @@ -112,7 +114,7 @@ int do_ls(struct dirent * direntry) * routine to print usage info and exit */ void usage(void) { - printf("Program myls: list file in a directory \n"); + printf("Program mylschroot: chroot in a directory and list files \n"); printf("Usage:\n"); printf(" myls [-h] dirname \n"); printf(" -h print this help\n");