Changeset 369 in xtideuniversalbios for trunk/Serial_Server


Ignore:
Timestamp:
Mar 29, 2012, 9:29:28 AM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Serial_Server/win32/Win32.cpp

    r338 r369  
    1717#include "../library/flatimage.h"
    1818
    19 void usage(void)
    20 {
    21     char *usageStrings[] = {
    22         "SerDrive - XTIDE Universal BIOS Serial Drive Server",
    23         "Version 2.0.0 Beta1, Built " __DATE__,
    24         "",
    25         "SerDrive is released under the GNU GPL v2.  SerDrive comes with ABSOLUTELY",
    26         "NO WARRANTY.  This is free software, and you are welcome to redistribute it",
    27         "under certain conditions.  See LICENSE.TXT (included with this distribution)",
    28         "for more details, or visit http://www.gnu.org/licenses/gpl-2.0.html.",
    29         "",
    30         "Usage: SerDrive [options] imagefile [[slave-options] slave-imagefile]",
    31         "",
    32         "  -g [cyl:head:sect]  Geometry in cylinders, sectors per cylinder, and heads",
    33         "                      -g also implies CHS addressing mode (default is LBA28)",
    34         "",
    35         "  -n [megabytes]      Create new disk with given size or use -g geometry",
    36         "                      Maximum size is " USAGE_MAXSECTORS,
    37         "                      Floppy images can also be created, such as \"360K\"",
    38         "                      (default is a 32 MB disk, with CHS geometry 65:16:63)",
    39         "",
    40         "  -p [pipename]       Named Pipe mode for emulators",
    41         "                      (must begin with \"\\\\\", default is \"" PIPENAME "\")",
    42         "",
    43         "  -c COMPortNumber    COM Port to use (default is first found)",
    44         "                      Available COM ports on this system are:",
    45      "COM                          ",
    46         "",
    47         "  -b BaudRate         Baud rate to use on the COM port, with client machine",
    48         "                      rate multiplier in effect:",
    49         "                          None:  2400,  4800,  9600,  28.8K,  57.6K, 115.2K",
    50         "                          2x:    4800,  9600, 19200,  57.6K, 115.2K, 230.4K",
    51         "                          4x:    9600, 19200, 38400, 115.2K, 230.4K, 460.8K",
    52         "                          and for completeness:               76.8K, 153.6K",
    53         "                      (default is 9600, 115.2K when in named pipe mode)",
    54         "",
    55         "  -t                  Disable timeout, useful for long delays when debugging",
    56         "",
    57         "  -r                  Read Only disk, do not allow writes",
    58         "",
    59         "  -v [level]          Reporting level 1-6, with increasing information",
    60         "",
    61         "On the client computer, a serial port can be configured for use as a hard disk",
    62         "with xtidecfg.com.  Or one can hold down the ALT key at the end of the normal",
    63         "IDE hard disk scan and the XTIDE Universal BIOS will scan COM1-7, at each of",
    64         "the six speeds given above for BaudRate.  Note that hardware rate multipliers",
    65         "must be taken into account on the server end, but are invisible on the client.",
    66         "",
    67         "Floppy images may also be used.  Image size must be exactly the same size",
    68         "as a 2.88MB, 1.44MB, 1.2MB, 720KB, 360KB, 320KB, 180KB, or 160KB disk.",
    69         "Floppy images must be the last disks discovered by the BIOS, and only",
    70         "two floppy drives are supported by the BIOS at a time.",
    71         NULL };
    72 
    73     for( int t = 0; usageStrings[t]; t++ )
    74     {
    75         if( !strncmp( usageStrings[t], "COM", 3 ) )
     19char *bannerStrings[] = {
     20    "SerDrive - XTIDE Universal BIOS Serial Drive Server",
     21    "Copyright (C) 2012 by XTIDE Universal BIOS Team",
     22    "Released under GNU GPL v2, with ABSOLUTELY NO WARRANTY",
     23    "Version 2.0.0 Beta1, Built " __DATE__,
     24    "",
     25    NULL };
     26
     27char *usageStrings[] = {
     28    "This is free software, and you are welcome to redistribute it under certain",
     29    "conditions.  For more license details, see the LICENSE.TXT file included with",
     30    "this distribution, visit the XTIDE Universal BIOS wiki (address below), or",
     31    "http://www.gnu.org/licenses/gpl-2.0.html",
     32    "",
     33    "Visit the wiki on http://code.google.com/p/xtideuniversalbios for detailed",
     34    "serial drive usage directions.",
     35    "",
     36    "Usage: SerDrive [options] imagefile [[slave-options] slave-imagefile]",
     37    "",
     38    "  -g [cyl:head:sect]  Geometry in cylinders, sectors per cylinder, and heads",
     39    "                      -g also implies CHS addressing mode (default is LBA28)",
     40    "",
     41    "  -n [megabytes]      Create new disk with given size or use -g geometry",
     42    "                      Maximum size is " USAGE_MAXSECTORS,
     43    "                      Floppy images can also be created, such as \"360K\"",
     44    "                      (default is a 32 MB disk, with CHS geometry 65:16:63)",
     45    "",
     46    "  -p [pipename]       Named Pipe mode for emulators",
     47    "                      (must begin with \"\\\\\", default is \"" PIPENAME "\")",
     48    "",
     49    "  -c COMPortNumber    COM Port to use (default is first found)",
     50    "                      Available COM ports on this system are:",
     51 "COM                          ",
     52    "",
     53    "  -b BaudRate         Baud rate to use on the COM port, with client machine",
     54    "                      rate multiplier in effect:",
     55    "                          None:  2400,  4800,  9600,  28.8K,  57.6K, 115.2K",
     56    "                          2x:    4800,  9600, 19200,  57.6K, 115.2K, 230.4K",
     57    "                          4x:    9600, 19200, 38400, 115.2K, 230.4K, 460.8K",
     58    "                          and for completeness:               76.8K, 153.6K",
     59    "                      (default is 9600, 115.2K when in named pipe mode)",
     60    "",
     61    "  -t                  Disable timeout, useful for long delays when debugging",
     62    "",
     63    "  -r                  Read Only disk, do not allow writes",
     64    "",
     65    "  -v [level]          Reporting level 1-6, with increasing information",
     66    "",
     67    "On the client computer, a serial port can be configured for use as a hard disk",
     68    "with xtidecfg.com.  Or one can hold down the ALT key at the end of the normal",
     69    "IDE hard disk scan and the XTIDE Universal BIOS will scan COM1-7, at each of",
     70    "the six speeds given above for BaudRate.  Note that hardware rate multipliers",
     71    "must be taken into account on the server end, but are invisible on the client.",
     72    "",
     73    "Floppy images may also be used.  Image size must be exactly the same size",
     74    "as a 2.88MB, 1.44MB, 1.2MB, 720KB, 360KB, 320KB, 180KB, or 160KB disk.",
     75    "Floppy images must be the last disks discovered by the BIOS, and only",
     76    "two floppy drives are supported by the BIOS at a time.",
     77    NULL };
     78
     79void usagePrint( char *strings[] )
     80{
     81    for( int t = 0; strings[t]; t++ )
     82    {
     83        if( !strncmp( strings[t], "COM", 3 ) )
    7684        {
    7785            char logbuff[ 1024 ];
    7886
    7987            SerialAccess::EnumerateCOMPorts( logbuff, 1024 );
    80             fprintf( stderr, "%s%s\n", usageStrings[t]+3, logbuff );
     88            fprintf( stderr, "%s%s\n", strings[t]+3, logbuff );
    8189        }
    8290        else
    83             fprintf( stderr, "%s\n", usageStrings[t] );
    84     }
    85 
    86     exit( 1 );
    87 }
     91            fprintf( stderr, "%s\n", strings[t] );
     92    }
     93}
     94
     95#define usage() { usagePrint( usageStrings ); exit(1); }
    8896
    8997int verbose = 0;
     
    115123    Image *images[2] = { NULL, NULL };
    116124
     125    usagePrint( bannerStrings );
     126
    117127    for( int t = 1; t < argc; t++ )
    118128    {
     129        char *next = (t+1 < argc ? argv[t+1] : NULL );
     130
    119131        if( argv[t][0] == '/' || argv[t][0] == '-' )
    120132        {
     
    128140            {
    129141            case 'c': case 'C':
    130                 a = atol( argv[++t] );
     142                if( !next )
     143                    usage();
     144                t++;
     145                a = atol( next );
    131146                if( a < 1 )
    132147                    usage();
     
    135150                break;
    136151            case 'v': case 'V':
    137                 if( atol(argv[t+1]) != 0 )
    138                     verbose = atol(argv[++t]);
     152                if( next && atol(next) != 0 )
     153                {
     154                    t++;
     155                    verbose = atol(next);
     156                }
    139157                else
    140158                    verbose = 1;
     
    144162                break;
    145163            case 'p': case 'P':
    146                 if( argv[t+1][0] == '\\' && argv[t+1][1] == '\\' )
    147                     ComPort = argv[++t];
     164                if( next && next[0] == '\\' && next[1] == '\\' )
     165                {
     166                    t++;
     167                    ComPort = next;
     168                }
    148169                else
    149170                    ComPort = PIPENAME;
     
    152173                break;           
    153174            case 'g': case 'G':
    154                 if( atol(argv[t+1]) != 0 )
     175                if( next && atol(next) != 0 )
    155176                {
    156                     if( !Image::parseGeometry( argv[++t], &cyl, &head, &sect ) )
     177                    t++;
     178                    if( !Image::parseGeometry( next, &cyl, &head, &sect ) )
    157179                        usage();
    158180                }
     
    164186            case 'n': case 'N':
    165187                createFile = 1;
    166                 if( atol(argv[t+1]) != 0 )
     188                if( next && atol(next) != 0 )
    167189                {
    168                     double size = atof(argv[++t]);
     190                    double size = atof(next);
    169191                    struct floppyInfo *fi;
    170192                    char *c;
     193
     194                    t++;
    171195
    172196                    size *= 2;
     
    193217                break;
    194218            case 'b': case 'B':
    195                 if( !(baudRate = baudRateMatchString( argv[++t] )) || !baudRate->rate )
    196                     log( -2, "Unknown Baud Rate \"%s\"", argv[t] );
     219                if( !next )
     220                    usage();
     221                t++;
     222                if( !(baudRate = baudRateMatchString( next )) || !baudRate->rate )
     223                    log( -2, "Unknown Baud Rate \"%s\"", next );
    197224                break;
    198225            default:
Note: See TracChangeset for help on using the changeset viewer.