#! /usr/local/bin/perl
#
# id=yaor2.cgi
#
# 矢尾百貨店フロアー案内ファイルを読み表示する
# update. 00.2.21
# ファイル名
$file = "/dialup/chichibu/cgi-bin/yao.txt";
$reload = 'http://www0.kumagaya.or.jp/cgi-bin/users/chichibu/yaor2.cgi';
require 'cgi-lib.pl';
require 'jcode.pl';
&ReadParse;
####################################
# #
# メインルーチン(処理の分岐) #
# #
####################################
# 全体の流れを決定する
if ($in{'action'} eq 'main') {
$flg=1; $tl="フロアーのご案内"; &main; }
elsif ($in{'action'} eq 'main2') {
$flg=2; $tl="コーナーのご案内"; &main; }
elsif ($in{'action'} eq 'all') { &zenkan_rtn; }
else {
$flg=0; $tl="矢尾百貨店全館のご案内"; &main; }
# なくても良いが最終出口を示す
exit;
#############################################
# #
# 指定されたフロアーを表示する #
# #
#############################################
sub main {
&html_rtn;
} # end of main
###############################
# #
# ブラウザに出力 #
# #
###############################
sub html_rtn {
print "Content-type: text/html\n\n";
print "\n
\n";
# タイトルをSJISに変換する
&jcode'convert(*tl,'sjis');
print "\n";
print $tl;
print "\n";
print "\n\n";
# 1.ファイルを読み出しモードでオープン
open(DATA,"$file");
# 2.読み込み、 WHILE命令により、ファイルの最後まで1行ずつ読み込み表示します
# わかりやすくするため、改行させて表示させます
# フロアーをカウントする変数
$fno=0;
# コーナーをカウントする変数
$CNO=0;
while() {
# 先頭の#はコメントとみなして飛ばす
if ($_ =~ /^#/) { }
else {
# フロアーcJウント(階とは違う)
$a="・";
&jcode'convert(*a,'sjis');
if ($_ =~ /^$a/) { $fno++ }
$a=" ・";
&jcode'convert(*a,'sjis');
if ($_ =~ /^$a/) { $cno++ }
# ここから
# この中で指示されたものを判定する
# フロアーのみを処理する部分
if ($flg == 0) {
# 先頭・がフロアーを示す
# キーをSJISに合わせる
$a="・";
&jcode'convert(*a,'sjis');
if ($_ =~ /^$a/) {
print ''.$_.'';
print '
';
} # if
} # if
# ここまで。
# ここから
# フロアーの中を処理する
if ($flg == 1) {
if ($in{'flr'} == $fno) {
# 先頭 ・がフロアーの中を示す
# キーをSJISに合わせる
$a=" ・";
&jcode'convert(*a,'sjis');
if ($_ =~ /^$a/) {
print ''.$_.'';
print '
';
} # if
} # if
} # if
# ここまで。
# ここから
# コーナーの中を処理する
if ($flg == 2) {
if ($in{'flr'} == $fno & $in{'cno'} == $cno) {
# 先頭 がコーナーの中を示す
# キーをSJISに合わせる
$a=" ";
&jcode'convert(*a,'sjis');
if ($_ =~ /^$a/) {
print $_;
print '
';
} # if
} # if
} # if
# ここまで。
} # else
} # while
# 3.ファイルを閉じます
close(DATA);
# 最初だけ全館表示を入れる
if ($flg == 0) {
$a="・全館表示";
&jcode'convert(*a,'sjis');
print ''.$a.'';
} # if
print "\n\n";
} # end of html_rtn
########################
# 全館のご案内表示 #
########################
sub zenkan_rtn {
print "Content-type: text/html\n\n";
print "\n\n";
# タイトルをSJISに変換する
$tl="全館のご案内";
&jcode'convert(*tl,'sjis');
print "\n";
print $tl;
print "\n";
print "\n\n";
# 1.ファイルを読み出しモードでオープン
open(DATA,"$file");
while() {
# 先頭の#はコメントとみなして飛ばす
if ($_ =~ /^#/) { }
else {
print ;
print '
';
} # else
} # while
# 3.ファイルを閉じます
close(DATA);
print "\n\n";
} # end of zenkan_rtn
################## end of script ##################