[BACK]Return to hexsyntax.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / hexdump

Diff for /src/usr.bin/hexdump/hexsyntax.c between version 1.5 and 1.6

version 1.5, 2001/11/02 19:41:06 version 1.6, 2001/12/30 08:17:32
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
   /*      $NetBSD: hexsyntax.c,v 1.8 1998/04/08 23:48:57 jeremy Exp $     */
   
 /*-  /*-
  * Copyright (c) 1990 The Regents of the University of California.   * Copyright (c) 1990, 1993
  * All rights reserved.   *      The Regents of the University of California.  All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions   * modification, are permitted provided that the following conditions
Line 39 
Line 40 
 #endif /* not lint */  #endif /* not lint */
   
 #include <sys/types.h>  #include <sys/types.h>
   
   #include <err.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <limits.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
 #include <err.h>  
 #include "hexdump.h"  #include "hexdump.h"
   
 off_t skip;                             /* bytes to skip */  off_t skip;                             /* bytes to skip */
Line 53 
Line 56 
         int argc;          int argc;
         char ***argvp;          char ***argvp;
 {  {
         extern enum _vflag vflag;  
         extern FS *fshead;  
         extern char *optarg;  
         extern int length, optind;  
         int ch;          int ch;
         char *p, **argv;          char *p, **argv;
   
         argv = *argvp;          argv = *argvp;
         while ((ch = getopt(argc, argv, "bcde:f:n:os:vx")) != -1)          while ((ch = getopt(argc, argv, "bcCde:f:n:os:vx")) != -1)
                 switch (ch) {                  switch (ch) {
                 case 'b':                  case 'b':
                         add("\"%07.7_Ax\n\"");                          add("\"%07.7_Ax\n\"");
Line 71 
Line 70 
                         add("\"%07.7_Ax\n\"");                          add("\"%07.7_Ax\n\"");
                         add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");                          add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");
                         break;                          break;
                   case 'C':
                           add("\"%08.8_Ax\n\"");
                           add("\"%08.8_ax  \" 8/1 \"%02x \" \"  \" 8/1 \"%02x \" ");
                           add("\"  |\" 16/1 \"%_p\" \"|\\n\"");
                           break;
                 case 'd':                  case 'd':
                         add("\"%07.7_Ax\n\"");                          add("\"%07.7_Ax\n\"");
                         add("\"%07.7_ax \" 8/2 \"  %05u \" \"\\n\"");                          add("\"%07.7_ax \" 8/2 \"  %05u \" \"\\n\"");
Line 83 
Line 87 
                         break;                          break;
                 case 'n':                  case 'n':
                         if ((length = atoi(optarg)) < 0)                          if ((length = atoi(optarg)) < 0)
                                 errx(1, "bad length value");                                  errx(1, "%s: bad length value", optarg);
                         break;                          break;
                 case 'o':                  case 'o':
                         add("\"%07.7_Ax\n\"");                          add("\"%07.7_Ax\n\"");
Line 91 
Line 95 
                         break;                          break;
                 case 's':                  case 's':
                         if ((skip = strtol(optarg, &p, 0)) < 0)                          if ((skip = strtol(optarg, &p, 0)) < 0)
                                 errx(1, "bad skip value");                                  errx(1, "%s: bad skip value", optarg);
                         switch(*p) {                          switch(*p) {
                         case 'b':                          case 'b':
                                 skip *= 512;                                  skip *= 512;
Line 113 
Line 117 
                         break;                          break;
                 case '?':                  case '?':
                         usage();                          usage();
                         exit(1);  
                 }                  }
   
         if (!fshead) {          if (!fshead) {
Line 128 
Line 131 
 usage()  usage()
 {  {
         extern char *__progname;          extern char *__progname;
         fprintf(stderr, "usage: %s [-bcdovx] [-e fmt] [-f fmt_file] "          fprintf(stderr, "usage: %s [-bcCdovx] [-e fmt] [-f fmt_file] "
                         "[-n length] [-s skip] [file ...]", __progname);                          "[-n length] [-s skip] [file ...]\n", __progname);
         exit(1);          exit(1);
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6