X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2Fgetparam.c;h=b5207b7188e185267acf8e79500bd942a6932cb1;hp=5619c1f3a9aac24a8f5a2ea375dc3b3e84533ee4;hb=HEAD;hpb=b1ead1b930038e4f7cd6ee7f737d7ee4699a068c diff --git a/sources/getparam.c b/sources/getparam.c index 5619c1f..b5207b7 100644 --- a/sources/getparam.c +++ b/sources/getparam.c @@ -19,15 +19,13 @@ /**************************************************************** * * Program getparam.c: - * Program to test function fopen + * Program to read system parameters * * Author: Simone Piccardi * Jan. 2002 * * Usage: getparam -h give all info's * - * $Id: getparam.c,v 1.3 2003/05/02 09:55:14 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers @@ -36,12 +34,11 @@ #include /* error definitions and routines */ #include /* C standard library */ #include /* unix standard library */ -#include /* string functions */ -#include -#include - +#include /* C strings library */ +#include /* system limits constants, types and functions */ +#include /* standard I/O library */ +#include /* date and time constants, types and functions */ -#include /* for CLK_TCK e CLOCKS_PER_SEC */ /* Table of constants for sysconf() */ char *sc_names[]={"_SC_ARG_MAX", @@ -110,10 +107,11 @@ int defined[]={ 0, #endif #ifdef SSIZE_MAX - 1 + 1, #else #define SSIZE_MAX -1 0 +#endif }; @@ -169,14 +167,13 @@ int main(int argc, char *argv[]) * Main code beginning * * ***********************************************************/ - /* There must be 2 remaing parameters */ if ( (argc-optind) != 1 ) { printf("From %d arguments, removed %d options\n", argc, optind); usage(); } for (i=0; i<=4; i++) { - printf("Response for %s is %ld, values is %ld\n", names[i], - sysconf(argument[i]), values[i]); + printf("Response for %s is %ld, values is %ld\n",sc_names[i], + sysconf(sc_argument[i]), values[i]); } return 0; } @@ -184,9 +181,9 @@ int main(int argc, char *argv[]) * routine to print usage info and exit */ void usage(void) { - printf("Program testfopen : test fopen for a file \n"); + printf("Program getparam : test fopen for a file \n"); printf("Usage:\n"); - printf(" testfopen [-h] file mode \n"); + printf(" getparam [-h] parameter \n"); printf(" -h print this help\n"); exit(1);