feat(inventory): Phase 1 - scan and validate UPC barcodes #1

Open
lyrathorpe wants to merge 54 commits from feat/inventory-phase1-scan into main
Showing only changes of commit 6e9254fc10 - Show all commits
+24
View File
@@ -0,0 +1,24 @@
/*
* upc.h - UPC-A barcode validation.
*
* Pure C, no SIBO/PLIB dependencies, so it can be unit-tested on any host
* compiler as well as built for the Workabout.
*/
#ifndef UPC_H
#define UPC_H
#define UPC_A_LEN 12
/*
* Returns 1 if s is a valid 12-digit UPC-A (all digits and a correct
* check digit), 0 otherwise. s must be NUL-terminated.
*/
int upcIsValid(const char *s);
/*
* Returns the UPC-A check digit (0-9) computed from the first 11 digits
* of s, or -1 if those 11 characters are not all digits.
*/
int upcCheckDigit(const char *s);
#endif /* UPC_H */