📄 main_old.c
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <fcntl.h>#ifdef WIN32#include "getopt.h"#else#ifdef __FreeBSD__#include <unistd.h>#else#include <getopt.h>#endif#endif#include <errno.h>#include "globs.h"#include "pdf417_enc.h"#include "main.h"intmain (int argc, char **argv){ int test_mode; int test_ecc_mode; char rowstring[128]; char colstring[128]; char ec_string[128]; int debug; int use_def; int rval; int cval; int output_type = 0; int option_args = 0; int begin_args = 0; int ch; int usg; debug = 0; digit_table_valid = FALSE; /* base 900 table for numeric_compress */ if (debug) { printf ("In main \n"); } quotchar = 34; codeindex = 0; test_mode = 0; test_ecc_mode = 0; cval = 8; rval = 24; pdf417_init_arrays (); /* process getopt commandline arguments */ while ((ch = getopt (argc, argv, "t:")) != -1) { switch (ch) { case 't': if (strcasecmp ("pbm", optarg) == 0) output_type = OUTPUT_PBM; else if (strcasecmp ("ps", optarg) == 0) output_type = OUTPUT_PS; else if (strcasecmp ("psbits", optarg) == 0) output_type = OUTPUT_PS_BITS; else if (strcasecmp ("raw", optarg) == 0) output_type = OUTPUT_RAW;#ifdef DO_GIFS else if (strcasecmp ("gif", optarg) == 0) output_type = OUTPUT_GIF;#endif /* DO_GIFS */ else { usg = Usage_old(); exit (1); } option_args += 1; break; } } if ((argc - option_args) < 3) { Usage_old(); exit (1); } if ( strncmp("_",argv[option_args +1],1) == 0) { input_filename= NULL; } else { input_filename = strdup (argv[option_args + 1]); } if ( strncmp("_",argv[option_args +2],1) == 0) { output_filename = NULL; } else { output_filename = strdup (argv[option_args + 2]); } use_def = TRUE; if (debug) { printf ("Argc = %d \n", argc); } ec_level = 5; if (argc - option_args > 3) { if (argc - option_args < 6) { strcpy (rowstring, argv[option_args + 3]); strcpy (colstring, argv[option_args + 4]); rval = atoi (rowstring); cval = atoi (colstring); if (debug) { printf ("Col = %d row = %d \n", rval, cval); } if ((rval > 0) && (rval < 90)) { if ((cval > 0) && (cval < 30)) { use_def = FALSE; number_of_rows = rval; number_of_columns = cval; } else { printf (" Columns must be less than 30 \n"); exit (0); } } else { if (rval != 999) { printf ("Rows must be less that 90 \n"); exit (0); } else // rval = 999 { if ((cval > 0) && (cval < 30)) { use_def = FALSE; // number of rows to calculated later number_of_columns = cval; } else { printf (" Columns must be less than 30 \n"); exit (0); } } } } if (argc - option_args == 6) { strcpy (rowstring, argv[option_args + 3]); strcpy (colstring, argv[option_args + 4]); strcpy (ec_string, argv[option_args + 5]); if (debug) { printf ("rowstring = %s colstring = %s ec_string = %s \n", rowstring, colstring, ec_string); } rval = atoi (rowstring); cval = atoi (colstring); ec_level = atoi (ec_string); if (debug) { printf ("ec_level = %d \n", ec_level); } if (ec_level > 8) { printf ("Error: Error correction level > 8 not supported \n"); printf ("Error correction level defaulting to 5 \n"); ec_level = 5; } if (ec_level < 1) { printf ("Error: Error correction level should be from 1 to 8 \n"); printf ("Error correction defaulted to 5 \n"); ec_level = 5; } if (debug) { printf ("Col = %d row = %d \n", rval, cval); } if ((rval > 0) && (rval < 90)) { if ((cval > 0) && (cval < 30)) { use_def = FALSE; number_of_rows = rval; number_of_columns = cval; } else { printf (" Columns must be less than 30 \n"); exit (0); } } else { if (rval != 999) { printf ("Rows must be less thatn 90 \n"); exit (0); } else { if ((cval > 0) && (cval < 30)) { use_def = FALSE; // number of rows to calculated later number_of_columns = cval; } else { printf (" Columns must be less than 30 \n"); exit (0); } } } } } // test_ecc(); if (test_mode) { test_text_comp (); test_byte_compact (); test_nc (); test_ecc (); } if (test_ecc_mode) { test_ecc (); exit (0); }// do the code to generate barcode pdf417_en (rval, cval, ec_level, output_type, use_def, FALSE);} /* end main */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -