rh

Check-in [2e4bd9935a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add -0 for rooting through filenames with spaces.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:2e4bd9935a55c1a7806948c7586ac8710db354865d602117c6902dd12c362916
User & Date: vandyswa@gmail.com 2017-04-24 20:38:29
Context
2017-04-29
14:49
hassubdir() broken on fuse filesystems. check-in: 8434e47cb5 user: vandyswa@gmail.com tags: master, trunk
2017-04-24
20:38
Add -0 for rooting through filenames with spaces. check-in: 2e4bd9935a user: vandyswa@gmail.com tags: master, trunk
20:26
My private rhrc macros check-in: 7aea832c71 user: vandyswa@gmail.com tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to rh.c.

    57     57   
    58     58   int		Trace = 0;
    59     59   #endif
    60     60   
    61     61   #if defined(S_IFLNK)
    62     62   
    63     63   #if defined(DEBUG)
    64         -#define SWITCHES "CDFLTUVWXYZbcde:f:hilp:qrstvwx:"
           64  +#define SWITCHES "0CDFLTUVWXYZbcde:f:hilp:qrstvwx:"
    65     65   #else
    66         -#define SWITCHES "CDFLVbcde:f:hilp:qrstvwx:"
           66  +#define SWITCHES "0CDFLVbcde:f:hilp:qrstvwx:"
    67     67   #endif
    68     68   
    69     69   static char *usage =
    70         -    "Usage: %s [-CDFLVbcdhilqrsvw] [-f filename] [-e expression]\n"
           70  +    "Usage: %s [-0CDFLVbcdhilqrsvw] [-f filename] [-e expression]\n"
    71     71       "\t\t[-p format] [-x command] [directory/file ...]\n";
    72     72   
    73     73   #else
    74     74   
    75     75   #if defined(DEBUG)
    76         -#define SWITCHES "CTUVWXYZbcde:f:hilp:qrstvwx:"
           76  +#define SWITCHES "0CTUVWXYZbcde:f:hilp:qrstvwx:"
    77     77   #else
    78         -#define SWITCHES "CVbcde:f:hilp:qrstvwx:"
           78  +#define SWITCHES "0CVbcde:f:hilp:qrstvwx:"
    79     79   #endif
    80     80   
    81     81   static char *usage = 
    82         -    "Usage: %s [-CVbcdhilqrsvw] [-f filename] [-e expression]\n"
           82  +    "Usage: %s [-0CVbcdhilqrsvw] [-f filename] [-e expression]\n"
    83     83       "\t\t[-p format] [-x command] [directory/file ...]\n";
    84     84   #endif
    85     85   
    86     86   
    87     87   /*
    88     88    * printhelp:
    89     89    *	Print out the help screen. The string 's' is argv[0].
................................................................................
   125    125   		   "\t-q\tdisplay non-graphic characters in filenames as ?\n"
   126    126   		   "\t-r\tdo not go down the directory tree (non-recursive)\n"
   127    127   		   "\t-s\tprint users/groups as strings instead of numbers\n"
   128    128   		   "\t-t\tprint full date/time instead of ls(1) type date/time\n"
   129    129   		   "\t-v\tverbose output\n"
   130    130   		   "\t-w\tdisplay warning messages\n"
   131    131   		   "\t-x command\texecute 'command' for matching files\n"
          132  +		   "\t-0\tseparate filenames by null char, not newline\n"
   132    133   		   "\nvalid symbols:\n"
   133    134   		   );
   134    135   		   
   135    136       for (i = 1, p = Symbol_table; p != (symbol *) NULL; p = p->next, i++) {
   136    137   	(void) fprintf(stderr, "%12s%s", p->name,
   137    138   		      (((i - 1) % 5) == 4
   138    139   		       || p->next == (symbol *) NULL) ? "\n" : " ");
................................................................................
   393    394    */
   394    395   
   395    396   /* print file out by itself */
   396    397   
   397    398   static void exam1(void)
   398    399   {
   399    400       if (execute()) {
   400         -	(void) printf("%s\n", attr.graphic ? graphic(attr.fname) : attr.fname);
          401  +	(void) printf("%s%c",
          402  +	    attr.graphic ? graphic(attr.fname) : attr.fname,
          403  +	    attr.zero_term ? '\0' : '\n');
          404  +	if (attr.zero_term) {
          405  +	    (void)fflush(stdout);
          406  +	}
   401    407       }
   402         -    return;
   403    408   }
   404    409   
   405    410   /* long output of file */
   406    411   
   407    412   static void exam2(void)
   408    413   {
   409    414       if (execute()) {
................................................................................
   902    907   	case 'x': 
   903    908   	    if (attr.command != (char *) NULL) {
   904    909   		error("only one -x option is allowed");
   905    910   	    }
   906    911   	    examptr = exam4;
   907    912   	    attr.command = optarg;
   908    913   	    break;
          914  +
          915  +	case '0':
          916  +	    attr.zero_term = TRUE;
          917  +	    break;
   909    918   	    
   910    919   #if defined(DEBUG)
   911    920   	case 'T':
   912    921   	    ++Trace;
   913    922   	    break;
   914    923   
   915    924   	case 'U':
................................................................................
   927    936   	case 'Y':
   928    937   	    ++rh_debug;
   929    938   	    break;
   930    939   
   931    940   	case 'Z':
   932    941   	    ++yy_flex_debug;
   933    942   	    break;
          943  +
   934    944   #endif
   935    945   
   936    946   	default:
   937    947   	    warning("use -h for help");
   938    948   	    exit(1);
   939    949   	}
   940    950   	

Changes to rh.h.

   249    249      char			graphic;	/* display non-graphic characters in filenames as ? */
   250    250      char			ignore_case;	/* ignore case when comparing filenames */
   251    251      char			prune;		/* flag to indicate prunning */
   252    252      char			stat_all;	/* stat() all files */
   253    253      char			str_owner;	/* print user/group strings instead of numbers */
   254    254      char			verbose;	/* used by the (*func)() routine */
   255    255      char			full_date;	/* print full date instead of ls(1) type date */
          256  +   char			zero_term;	/* flag separate files by \0 */
   256    257   };