Last active
March 28, 2018 13:16
-
-
Save codingbychanche/0a91de4389ae4c90aa9e to your computer and use it in GitHub Desktop.
C collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------------------------------------------ | |
* C- Source.c | |
* A standard framework for C- Language command line tools | |
* | |
* | |
* | |
* V0.0 // 30.10.2014 | |
*------------------------------------------------------------------------------------*/ | |
#include <stdio.h> | |
#define VERSION "\nProgramm, V 0.0 // 30.10.2014\n\n" | |
/*------------------------------------------------------------------------------------- | |
* main | |
*------------------------------------------------------------------------------------*/ | |
int main(int argc, const char *argv[]) | |
{ | |
int aopt,bopt; | |
char c; | |
/* | |
* Check parameters | |
*/ | |
if (argc<=1) { | |
version(); | |
descripe(); | |
usag(); | |
return(0); | |
} | |
/* | |
* Check for options | |
*/ | |
aopt=bopt=0; | |
while (argc>=1 && argv[1][0]=='-'){ | |
c=argv [1][1]; | |
switch (c){ | |
case 'a': // Option 1 | |
aopt++; | |
break; | |
case 'b': // Option 2 | |
bopt++; | |
break; | |
} | |
--argc; | |
++argv; | |
} | |
argv++; // No more options found, argv now points to path of disk image | |
/* | |
* Display program name, usage and version | |
*/ | |
version(); | |
usag(); | |
descripe(); | |
/* | |
* Call main part of programm | |
*/ | |
return (1); | |
} | |
/*------------------------------------------------------------------------------------ | |
* Usage | |
*------------------------------------------------------------------------------------*/ | |
usag () | |
{ | |
printf ("Usage : [-xyz][Filename]\n"); | |
} | |
/*------------------------------------------------------------------------------------ | |
* Version | |
*------------------------------------------------------------------------------------*/ | |
version () | |
{ | |
printf (VERSION); | |
printf ("Made by retrozock\n"); | |
printf ("www.retrozock.com\n\n"); | |
} | |
/*------------------------------------------------------------------------------------ | |
* Description | |
*------------------------------------------------------------------------------------*/ | |
descripe () | |
{ | |
printf ("'Bla bla bla\n"); | |
printf ("Bla bla bla blaaaaaa\n\n"); | |
return(0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment