Added README and LICENSE
This commit is contained in:
parent
54e6168672
commit
1037aef5f5
15
LICENSE
Normal file
15
LICENSE
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Copyright (C) 2017 Jack-Benny Persson <jack-benny@cyberinfo.se>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
71
README.md
Normal file
71
README.md
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
`on-stock` is a small but useful inventory tool. As most of my small programs it
|
||||||
|
came to life from a real need of mine. There are many programs out there, big
|
||||||
|
programs, to keep track of your inventory. But all of these were to big and
|
||||||
|
complex for my own need. What I wanted was a small, preferably CLI-based,
|
||||||
|
inventory tool. So this program is the result of that. It may not meet the need
|
||||||
|
of other businesses, but for me it's more than enough.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
Usage: ./on-stock [-l] [-s] [-m [-d [-n] [-f filename]
|
||||||
|
-l = list the articles in the database
|
||||||
|
-s = search for an article in the database
|
||||||
|
-m = modify a article
|
||||||
|
-d = delete a article
|
||||||
|
-n = create a new article
|
||||||
|
-f = specifiy a filename for the database
|
||||||
|
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
jake@red-dwarf:on-stock$ ./on-stock -n
|
||||||
|
Could not open storage.bin
|
||||||
|
Create the file and start adding records? (y/n): y
|
||||||
|
Name ('done' when finished): Bolt
|
||||||
|
Quantity: 89
|
||||||
|
Price: 9.99
|
||||||
|
Name ('done' when finished): Nail
|
||||||
|
Quantity: 50
|
||||||
|
Price: 0.50
|
||||||
|
Name ('done' when finished): Hammer
|
||||||
|
Quantity: 12
|
||||||
|
Price: 59
|
||||||
|
Name ('done' when finished): done
|
||||||
|
|
||||||
|
|
||||||
|
jake@red-dwarf:on-stock$ ./on-stock -l
|
||||||
|
|
||||||
|
Name Quantity Price
|
||||||
|
=====================================================
|
||||||
|
Bolt 89 9.99
|
||||||
|
Nail 50 0.50
|
||||||
|
Hammer 12 59.00
|
||||||
|
|
||||||
|
|
||||||
|
jake@red-dwarf:on-stock$ ./on-stock -m
|
||||||
|
Name: Bolt
|
||||||
|
|
||||||
|
Name Quantity Price
|
||||||
|
=====================================================
|
||||||
|
Bolt 89 9.99
|
||||||
|
|
||||||
|
What do you like to modify? (name, quantity, price): quantity
|
||||||
|
Quantity (absolute value or +/-NUMBER: -9
|
||||||
|
|
||||||
|
*Bolt* quantity is now 80.
|
||||||
|
|
||||||
|
jake@red-dwarf:on-stock$ ./on-stock -d
|
||||||
|
Name: Nail
|
||||||
|
|
||||||
|
Name Quantity Price
|
||||||
|
=====================================================
|
||||||
|
Nail 50 0.50
|
||||||
|
|
||||||
|
Delete the record listed above? (y/n): y
|
||||||
|
|
||||||
|
*Nail* is now deleted from the database.
|
||||||
|
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
`on-stock` is released under GNU GPLv2.
|
@ -1,3 +1,8 @@
|
|||||||
|
/* A simple inventory tool written in C, by
|
||||||
|
* Jack-Benny Persson (jack-benny@cyberinfo.se).
|
||||||
|
* Released under GNU GPLv2.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -152,7 +157,6 @@ void search(struct myData *datap, int numRec)
|
|||||||
fgets(searchword, NAMEMAXLENGTH, stdin);
|
fgets(searchword, NAMEMAXLENGTH, stdin);
|
||||||
/* Replace the newline character with a null character */
|
/* Replace the newline character with a null character */
|
||||||
searchword[strcspn(searchword, "\n")] = '\0';
|
searchword[strcspn(searchword, "\n")] = '\0';
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
for (int i = 0; i<numRec; i++)
|
for (int i = 0; i<numRec; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user