/[gxemul]/trunk/src/main.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 6 by dpavlin, Mon Oct 8 16:18:11 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: main.c,v 1.232 2005/04/18 21:40:58 debug Exp $   *  $Id: main.c,v 1.236 2005/05/25 06:40:18 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 155  void fatal(char *fmt, ...) Line 155  void fatal(char *fmt, ...)
155    
156    
157  /*  /*
  *  mystrtoull():  
  *  
  *  This function is used on OSes that don't have strtoull() in libc.  
  */  
 unsigned long long mystrtoull(const char *s, char **endp, int base)  
 {  
         unsigned long long res = 0;  
         int minus_sign = 0;  
   
         if (s == NULL)  
                 return 0;  
   
         /*  TODO: Implement endp?  */  
         if (endp != NULL) {  
                 fprintf(stderr, "mystrtoull(): endp isn't implemented\n");  
                 exit(1);  
         }  
   
         if (s[0] == '-') {  
                 minus_sign = 1;  
                 s++;  
         }  
   
         /*  Guess base:  */  
         if (base == 0) {  
                 if (s[0] == '0') {  
                         /*  Just "0"? :-)  */  
                         if (!s[1])  
                                 return 0;  
                         if (s[1] == 'x' || s[1] == 'X') {  
                                 base = 16;  
                                 s += 2;  
                         } else {  
                                 base = 8;  
                                 s ++;  
                         }  
                 } else if (s[0] >= '1' && s[0] <= '9')  
                         base = 10;  
         }  
   
         while (s[0]) {  
                 int c = s[0];  
                 if (c >= '0' && c <= '9')  
                         c -= '0';  
                 else if (c >= 'a' && c <= 'f')  
                         c = c - 'a' + 10;  
                 else if (c >= 'A' && c <= 'F')  
                         c = c - 'A' + 10;  
                 else  
                         break;  
                 switch (base) {  
                 case 8: res = (res << 3) | c;  
                         break;  
                 case 16:res = (res << 4) | c;  
                         break;  
                 default:res = (res * base) + c;  
                 }  
                 s++;  
         }  
   
         if (minus_sign)  
                 res = (uint64_t) -(int64_t)res;  
         return res;  
 }  
   
   
 /*****************************************************************************/  
   
   
 /*  
158   *  internal_w():   *  internal_w():
159   *   *
160   *  For internal use by gxemul itself.   *  For internal use by gxemul itself.
# Line 296  static void usage(int longusage) Line 226  static void usage(int longusage)
226          printf("  -d fname  add fname as a disk image. You can add \"xxx:\""          printf("  -d fname  add fname as a disk image. You can add \"xxx:\""
227              " as a prefix\n");              " as a prefix\n");
228          printf("            where xxx is one or more of the following:\n");          printf("            where xxx is one or more of the following:\n");
229          printf("                b     specifies that this is the boot"          printf("                b      specifies that this is the boot"
230              " device\n");              " device\n");
231          printf("                c     CD-ROM\n");          printf("                c      CD-ROM\n");
232          printf("                d     DISK\n");          printf("                d      DISK\n");
233          printf("                f     FLOPPY\n");          printf("                f      FLOPPY\n");
234          printf("                i     IDE\n");          printf("                gH;S;  set geometry to H heads and S"
235          printf("                r     read-only (don't allow changes to the"              " sectors-per-track\n");
236            printf("                i      IDE\n");
237            printf("                r      read-only (don't allow changes to the"
238              " file)\n");              " file)\n");
239          printf("                s     SCSI\n");          printf("                s      SCSI\n");
240          printf("                t     tape\n");          printf("                t      tape\n");
241          printf("                0-7   force a specific ID\n");          printf("                0-7    force a specific ID\n");
242          printf("  -I x      emulate clock interrupts at x Hz (affects"          printf("  -I x      emulate clock interrupts at x Hz (affects"
243              " rtc devices only, not\n");              " rtc devices only, not\n");
244          printf("            actual runtime speed) (this disables automatic"          printf("            actual runtime speed) (this disables automatic"
# Line 868  int main(int argc, char *argv[]) Line 800  int main(int argc, char *argv[])
800          }          }
801    
802          if (n_emuls == 0) {          if (n_emuls == 0) {
803                  fprintf(stderr, "No emulations defined.\n");                  fprintf(stderr, "No emulations defined. Maybe you forgot to "
804                        "use -E xx (and -e yy), to specify\nthe machine type)."
805                        " For example:\n\n    %s -E dec -e 3max -d disk.img\n\n"
806                        "to boot an emulated DECstation 5000/200 with a disk "
807                        "image.\n", progname);
808                  exit(1);                  exit(1);
809          }          }
810    

Legend:
Removed from v.4  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.26