GCC or similar ANSI/ISO-C compiler
Some knowledge of programming, though not much is necessary for the purpose of creating the program with the sample input.
Hello everyone! This is a tutorial for the Menu Maker for C, a program that makes creating a command-line interface menu ridiculously easy by writing 99% of the source for you! Continue reading for a detailed explanation, or skip to the bottom for quick steps to run it.
Start by downloading the file from SX Labs, and expand to find "menumaker.c". If you open the file with an editor, you'll notice the following file-format-scheme listed at the top:
This is the format used for input to the Menu Maker. For this tutorial, we will be using my example input file. You can download it below. Here is that file along with some comments, which unfortunately you cannot use for input as the comments would become part of the input:
A few notes on the input:
./menumaker <sampleinput.txt which is much easier and faster. It's also easily reproducible since the input is saved in a file.Did you get all that? Good. Now here are the steps to get the program working with the sample input file:
Step 1 - Download the source
Download the Menu Maker for C source from SX Labs and expand it.
Step 2 - Download the sample input
Download the sample input file "sampleinput.txt" below and place it in the same folder as "menumaker.c".
Step 3 - Compile the Menu Maker
Using Terminal, navigate to the directory where you have put the two above files, then enter the following:
gcc -o menumaker menumaker.c
The source should compile without any errors or warnings.
Step 4 - Generate the Menu program with sample input
Still in Terminal in our working directory, enter the following to generate the menu code using the sample input file:
./menumaker <sampleinput.txt
Now get a directory listing (ls) and look at all your new source files!
Step 5 - Fill in the blanks
Launch a text editor (I often use nano) and open "mymenu.c". A few lines down from the top you'll notice some function definitions, but they are missing code! This is the only bit of coding needed in order to get the menus working properly (The program will still compile and run, but the functions won't do anything until filled in, doy). For this sample, the following code will suffice to demonstrate:
printf( "Running Function 1\n" );
Add that line into each Function, changing "1" to whichever Function it is, and here is the code for "Quit":
exit(0)
Step 6 - Compile the Menu program
gcc -o mymenu mymenu.c
The source should compile without any errors or warnings. Possible problems could occur if the original input used was not sound (mismatched names, incorrect option-type values, etc), and of course any problems within the formerly-blank functions will show up.
Step 7 - Run it!
./mymenu
And have fun playing with your new menu application!
Step 8 - Read the source!
Last, but certainly not least, open the source with an editor and read it! Not necessarily the "menumaker.c", but all the source that is generated. I have intentionally designed the code to be organized, easy to understand, and easy to modify. And fuck it, read the "menumaker.c" source too. I don't think any of this is very complicated, but then again no well-organized program should be.
Enjoy =)