pike.git / bin / rsif

version» Context lines:

pike.git/bin/rsif:1:   #! /usr/bin/env pike - // -*- pike -*- $Id: rsif,v 1.6 2002/04/06 22:12:52 jhs Exp $ + // -*- pike -*- $Id: rsif,v 1.7 2002/04/21 04:06:42 jhs Exp $    - string version = ("$Revision: 1.6 $"/" ")[1]; + string version = ("$Revision: 1.7 $"/" ")[1];   int verbosity = 1; // interactive   int overwrite = 1; // no backups      void usage(function|void output_fun)   {    if(!output_fun)    output_fun = write;    output_fun(#"rsif [options] <from> <to> <files>      rsif (\"replace string in file\") replaces all occurrences of the string
pike.git/bin/rsif:27:    foreach(Getopt.find_all_options(argv, ({    ({ "backup", Getopt.NO_ARG, "-b,--backup"/"," }),    ({ "verbose", Getopt.NO_ARG, "-v,--verbose"/"," }),    ({ "version", Getopt.NO_ARG, "-V,--version"/"," }),    ({ "quiet", Getopt.NO_ARG, "-q,--quiet"/"," }),    ({ "help", Getopt.NO_ARG, "-h,--help"/"," }) })), array opt)    switch(opt[0])    {    case "backup": overwrite = 0; break;    case "verbose": verbosity++; break; -  case "version": return 0, write(version + "\n"); +  case "version": write(version + "\n"); return 0;    case "quiet": verbosity = 0; break; -  case "help": return 0, usage(); +  case "help": usage(); return 0;    }    argv = Getopt.get_args(argv);       if(4 > (argc = sizeof(argv))) -  return 1, usage(werror); +  return usage(werror), 1;       string from = argv[1], to = argv[2], file;    if(argc == 4 && argv[-1] == "-")    {    if(file = Stdio.stdin.read())    {    if(has_value(file, argv[1]))    {    if(verbosity > 1)    werror("Processing stdin.\n");