亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cd_db.pl

?? Linux程序設(shè)計(原書第2版)BeginningLinuxProgrammingLinux 程序設(shè)計(原書第2版)BeginningLinuxProgrammingLinux程序設(shè)計(原書第2版)B
?? PL
字號:
#! /usr/bin/perl -w# Perl translation of chapter 2's shell CD database# Copyright (C) 1999 Wrox Press.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-#1307  USA# Now the global variables.$menu_choice="";$title_file="title.cdb";$tracks_file="tracks.cdb";$temp_file="/tmp/cdb.$$";$SIG{INT} = sub { tidy_up(); exit; } ;sub read_in {    open TITLES, $title_file or die "Couldn't open $title_file : $!\n";    while (<TITLES>) { chomp; push @titles, $_ };    close TITLES;    open TRACKS, $tracks_file or die "Couldn't open $tracks_file : $!\n";    while (<TRACKS>) { chomp; push @tracks, $_ };    close TRACKS;}sub tidy_up {    # Die aborts with an error, and $! is the error message from open()    open TITLES, ">".$title_file or die "Couldn't write to $title_file : $!\n";    foreach (@titles) { print TITLES "$_\n"; }    close TITLES;    open TRACKS, ">".$tracks_file or die "Couldn't open $tracks_file : $!\n";    foreach (@tracks) { print TRACKS "$_\n"; }    close TRACKS;}# Two little functions for getting keyboard input.sub get_return {    print "Press return ";    <> # Get a line from STDIN, and ignore it.}sub get_confirm {    print "Are you sure? ";    while (1) {        $_ = <>; # Get a reply into $_        return 1 if (/^y(?:es)?$/i); # 1 is true, not 0        if (/^no?$/i) {            print "Cancelled!\n";            return 0;        }        print "Please enter yes or no.\n";    }}# Now we display the main menu, and get a choice from the user.# The <<EOF syntax is called a here-document and prints until it finds the word EOF# or whatever delimiter string you choose.sub set_menu_choice {    print `clear`; # Shelling out to clear screen. Yuck.    print <<EOF;    a) Add new CD    f) Find CD    c) Count the CDs and tracks in the catalogEOF    if ($cdcatnum) {        print "   l) List tracks on $cdtitle\n";        print "   r) Remove $cdtitle\n";        print "   u) Update track information for $cdtitle\n";    }    print "   q) Quit\n\n";    print "Please enter choice then press return\n";    chomp($menu_choice=<>);    return}# Then the one-liners as before to add new records to the arrays# and the subroutine to add track information.sub insert_title {    push @titles, (join "," , @_);}sub insert_track {    push @tracks, (join "," , @_);}sub add_record_tracks {    print "Enter track information for this CD\n";    print "When no more tracks enter q\n";    $cdtrack=1;    $cdttitle="";    while ($cdttitle ne "q") {        print "Track $cdtrack, track title? ";        chomp($cdttitle=<>);        if ($cdttitle =~ /,/) {            print "Sorry, no commas allowed.\n";            redo;        }        if ($cdttitle and $cdttitle ne "q") {            insert_track($cdcatnum,$cdtrack,$cdttitle);            $cdtrack++;        }    }}# Now we implement the add_records function to add the record of a new CD to the database.sub add_records {    print "Enter catalog name ";    chomp($cdcatnum=<>);    $cdcatnum=~ s/,.*//; # Drop everything after a comma.    print "Enter title ";    chomp($cdtitle=<>);    $cdtitle =~ s/,.*//;    print "Enter type ";    chomp($cdtype=<>);    $cdtype =~ s/,.*//;    print "Enter artist/composer ";    chomp($cdac=<>);    $cdac =~ s/,.*//;    print "About to add a new entry\n";    print "$cdcatnum $cdtitle $cdtype $cdac\n";    if (get_confirm()) {        insert_title($cdcatnum,$cdtitle,$cdtype,$cdac);        add_record_tracks();    } else {        remove_records();    }}# Since we've got an array of lines, finding the CD is very simple.# We could iterate through the array and pick out the matches.# However, it's easier to use Perl's grep function which was intended for this very purpose.sub find_cd {    # $asklist is true if the first member of @_    # (That is, the first parameter) is not "n"    $asklist = ($_[0] ne "n");    $cdcatnum="";    print "Enter a string to search for in the CD titles ";    chomp($searchstr=<>);    return 0 unless $searchstr;    # The \Q and \E metacharacters stop other metacharacters    # from working, so question marks, asterisks and so on    # in titles aren't dangerous.        @matches = grep /\Q$searchstr\E/, @titles;    if (scalar @matches == 0) {        print "Sorry, nothing found.\n";        get_return();        return 0;    } elsif   (scalar @matches != 1 ) {        print "Sorry, not unique.\n";        print "Found the following:\n";        foreach (@matches) {            print "$_\n";        }        get_return();        return 0;    }    ($cdcatnum,$cdtitle,$cdtype,$cdac) = split "," , $matches[0];    unless ($cdcatnum) {        print "Sorry, could not extract catalog field\n";        get_return();        return 0;    }    print "\nCatalog number: $cdcatnum\n";    print "Title: $cdtitle\n";    print "Type: $cdtype\n";    print "Artist/Composer: $cdac\n\n";    get_return();    if ($asklist) {        print "View tracks for this CD? ";        $_ = <>;        if (/^y(?:es)?$/i) {            print "\n";            list_tracks();            print "\n";        }    }    return 1;}# update_cd is nice and easy to implement, apart from the bit where we delete# the old tracks from the array. We'll do this using another grep,# but this time, we can negate the regular expression using !/regexp/. sub update_cd {    unless ($cdcatnum) {        print "You must select a CD first\n";        find_cd("n");    }    if ($cdcatnum) {        print "Current tracks are :-\n";        list_tracks();        print "\nThis will re-enter the tracks for $cdtitle\n";        if (get_confirm()) {            @tracks = grep !/^$cdcatnum,/, @tracks;            add_record_tracks();        }    }}# Since it's all stored in arrays, counting the contents of the database is trivial. sub count_cds {    print "Found ".(scalar @titles)." CDs, ";    print "with a total of ".(scalar @tracks)." tracks.\n";    get_return();}# We've seen how to use grep with a negated regexp to remove entries from an array.# Let's do this again: sub remove_records {    unless ($cdcatnum) {        print "You must select a CD first\n";        find_cd("n");    }    if ($cdcatnum) {        print "You are about to delete $cdtitle\n";        if (get_confirm()) {            @titles = grep !/^$cdcatnum,/, @titles;            @tracks = grep !/^$cdcatnum,/, @tracks;            @cdcatnum="";            print "Entry removed";        }        get_return();    }}# list_tracks requires a pager, so we need to write out a temporary file and shell out.sub list_tracks {    unless ($cdcatnum) {        print "No CD selected yet.\n";        return    }    open(TEMP, ">$temp_file")         or die "Can't write to $temp_file: $!\n";    @temp = grep /^$cdcatnum,/ , @tracks;    if (scalar @temp == 0) {        print "No tracks found for $cdtitle\n";    } else {        print TEMP "\n$cdtitle :-\n\n";        foreach (@temp) {            s/^.*?,//; # Remove the first field            print TEMP $_."\n";        }        close TEMP;        system("more $temp_file");        unlink($temp_file); # Delete it.    }    get_return();}# Now the main routine; we must remember to write out the arrays before exiting.# We also make sure the files exist before reading from them, by creating them.# Of course, we needn't have done it this way.# The alternative is not to complain if the files do not exist, the arrays would be empty# and the files would be created when we leave. # File tests work like shellsystem("touch $title_file") unless ( -f $title_file );system("touch $tracks_file") unless ( -f $tracks_file );read_in();system("clear");print "\n\nMini CD manager\n";sleep(3);while (1) {    set_menu_choice();    if ($menu_choice =~ /a/i) { add_records(); }    elsif ($menu_choice =~ /r/i) { remove_records(); }    elsif ($menu_choice =~ /f/i) { find_cd("y"); }    elsif ($menu_choice =~ /u/i) { update_cd(); }    elsif ($menu_choice =~ /c/i) { count_cds(); }    elsif ($menu_choice =~ /l/i) { list_tracks(); }    elsif ($menu_choice =~ /b/i) {        print "\n";        foreach (@titles) {            print "$_\n";        }        print "\n";        get_return();    }    elsif ($menu_choice =~ /q/i) { last; }    else { print "Sorry, choice not recognized.\n"; }}tidy_up();exit;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色老汉一区二区三区| 免费高清视频精品| 亚洲444eee在线观看| 麻豆成人久久精品二区三区红| 高清不卡一区二区| 91精品国产综合久久精品图片| 亚洲国产成人一区二区三区| 午夜久久久久久| 成人app网站| www激情久久| 日韩成人伦理电影在线观看| 99国产欧美久久久精品| 精品美女一区二区| 亚洲一区在线电影| av电影天堂一区二区在线| 精品久久久久久久一区二区蜜臀| 亚洲天堂av一区| 从欧美一区二区三区| 日韩一区二区不卡| 天堂久久一区二区三区| 91色在线porny| 日本一区二区成人| 国产精品一区二区在线播放| 欧美一激情一区二区三区| 亚洲成av人片在线观看| 91视频www| 亚洲精品成人精品456| 91首页免费视频| 国产精品理伦片| 成人动漫一区二区三区| 亚洲精品一区二区三区在线观看| 麻豆精品一区二区av白丝在线| 欧美日韩综合在线| 亚洲综合色噜噜狠狠| 91美女片黄在线观看| 亚洲免费视频成人| 91麻豆视频网站| 亚洲三级小视频| 一本大道综合伊人精品热热| 亚洲视频1区2区| 欧美在线综合视频| 亚洲第一二三四区| 欧美伦理影视网| 亚洲影院在线观看| 欧美日韩免费一区二区三区视频| 尤物av一区二区| 欧美老年两性高潮| 日本不卡在线视频| 精品日本一线二线三线不卡| 国产高清不卡一区二区| 中文字幕va一区二区三区| 99r国产精品| 亚洲一区二三区| 欧美一区二区免费观在线| 美女久久久精品| 国产亚洲欧美在线| 91丨porny丨在线| 亚洲3atv精品一区二区三区| 日韩精品一区二区三区三区免费 | 99精品视频在线播放观看| 国产精品成人免费精品自在线观看| bt欧美亚洲午夜电影天堂| 亚洲综合av网| 精品盗摄一区二区三区| 不卡一卡二卡三乱码免费网站| 一卡二卡欧美日韩| 日韩午夜av一区| 国产**成人网毛片九色| 亚洲一级在线观看| 精品国产精品一区二区夜夜嗨| 成人高清视频在线观看| 亚洲高清在线精品| 国产日韩精品视频一区| 在线一区二区三区四区五区| 免费久久99精品国产| 国产精品素人视频| 欧美一级黄色录像| 91免费视频网址| 九色|91porny| 亚洲一区二区三区四区在线| 精品国产一区二区三区久久影院| www.亚洲色图| 国产在线精品免费av| 亚洲人被黑人高潮完整版| 日韩欧美一卡二卡| 色欲综合视频天天天| 国内精品免费在线观看| 亚洲观看高清完整版在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 欧美日韩免费在线视频| 99久久综合精品| 韩国视频一区二区| 日韩在线一区二区三区| 亚洲人成精品久久久久久 | 2023国产一二三区日本精品2022| 在线一区二区三区做爰视频网站| 国产精品综合网| 日韩电影在线观看网站| 亚洲最大色网站| 亚洲视频免费在线观看| 久久久国产综合精品女国产盗摄| 91精品免费在线观看| 色妹子一区二区| www.在线欧美| 成人福利视频在线| 国产电影一区二区三区| 精品一区二区在线观看| 欧美aaaaaa午夜精品| 亚洲成年人网站在线观看| 一区二区在线免费| 亚洲日本va午夜在线电影| 欧美国产激情一区二区三区蜜月| 精品国产乱码久久久久久影片| 欧美一区二区三区免费在线看| 欧美色男人天堂| 欧美日韩国产在线观看| 欧美综合久久久| 欧美视频一区二区在线观看| 欧美亚洲综合在线| 精品视频资源站| 欧美人伦禁忌dvd放荡欲情| 欧美在线小视频| 在线观看成人免费视频| 欧美在线一区二区| 91.成人天堂一区| 日韩一区二区三区视频| 精品日韩一区二区三区| 久久亚洲影视婷婷| 国产欧美日韩亚州综合 | 国产精品久久久久久户外露出| 国产欧美久久久精品影院| 久久久国产精华| 国产精品灌醉下药二区| 一区二区三区中文字幕精品精品| 一区二区三区日韩| 视频一区二区中文字幕| 九一九一国产精品| 成人性生交大片免费| 色中色一区二区| 欧美一区国产二区| 国产欧美精品日韩区二区麻豆天美| 国产精品欧美一区喷水| 亚洲精品一卡二卡| 青草av.久久免费一区| 国产在线精品免费| 色香蕉成人二区免费| 在线电影一区二区三区| 26uuu欧美| 亚洲丝袜精品丝袜在线| 亚洲第一狼人社区| 狠狠狠色丁香婷婷综合久久五月| av中文字幕亚洲| 欧美一区二区视频网站| 久久夜色精品国产噜噜av| 亚洲欧美另类小说视频| 麻豆国产精品777777在线| 成人丝袜高跟foot| 在线电影欧美成精品| 久久免费电影网| 日韩美女视频一区二区 | 综合激情成人伊人| 日韩电影免费在线看| 成人97人人超碰人人99| 欧美久久久久中文字幕| 国产精品久久久久一区二区三区 | 国产精品福利一区| 日产国产欧美视频一区精品 | 久久99精品久久久久久动态图| 91美女精品福利| 久久久国产一区二区三区四区小说| 亚洲综合激情小说| 成人久久久精品乱码一区二区三区| 欧美日韩精品一区二区天天拍小说 | 色婷婷精品久久二区二区蜜臀av| 日韩美一区二区三区| 亚洲另类中文字| 成人一级视频在线观看| 欧美成人精品二区三区99精品| 亚洲美女偷拍久久| 国产成人免费在线视频| 日韩亚洲电影在线| 午夜精品在线视频一区| 91色.com| 中文字幕在线播放不卡一区| 国产麻豆精品一区二区| 日韩欧美精品在线视频| 亚洲v精品v日韩v欧美v专区| 91片在线免费观看| 国产精品天美传媒沈樵| 国产福利精品一区二区| 久久亚洲影视婷婷| 极品美女销魂一区二区三区免费 | 亚洲人快播电影网| av一二三不卡影片| 国产精品亲子乱子伦xxxx裸| 国产成人综合亚洲网站| 久久综合丝袜日本网| 国内精品久久久久影院薰衣草 | 欧美不卡视频一区| 久久综合综合久久综合|