extrac() -- ファイルの書き出し delete() -- 削除 replac() -- 更新2015年06月06日 18:18

書庫の内容を書き出すextrac()、ファイルを削除するdelete()、 ファイルを更新するreplac()を紹介します。

extrac()は、書庫を開き、書庫内の各ファイルについて、引数のファイルと一致する ならば、ファイルを取り出します。

extrac()のRATFOR版は以下の通り。

# extrac.r -- extract files from archive
      subroutine extrac(aname,cmd)
      integer*1 aname(NAMESIZE),cmd

      integer*1 ename(NAMESIZE),in(MAXLINE)
      integer fcreate,filarg,gethdr,fopen,fc
      integer afd,efd,size

      include carch.fi
      
      if (fopen(afd,aname,READ) == ERR)
          call cant(aname)

      if (cmd == PRINT)
          efd = STDOUT
      else
          efd = ERR
      while (gethdr(afd,in,ename,size) != EOF)
          if (filarg(ename) == NO)
              call fskip(afd,size)
          else {
              if(efd != STDOUT)
                  efd = fcreate(ename)
              if (efd == ERR) {
                  call putlin(ename,STDOUT)
                  call remark(': can not create.')
                  errcnt = errcnt + 1
                  call fskip(afd,size)
                  }
              else {
                  call acopy(afd,efd,size)
                  if (efd != STDOUT)
                      call fclose(efd)
                  }
              }
      call notfnd
      return
      end

WATCOM fortran77版は、以下の通り。

c extrac -- extract files from archive
      subroutine extrac(aname,cmd)
      integer*1 aname(81),cmd           ! NAMESIZE(81)
      integer*1 ename(81),in(81)        ! NAMESIZE(81) MAXLINE(81)
      integer fcreate,filarg,gethdr,fopen
      integer afd,efd,size

      include carch.fi
      
      if (fopen(afd,aname,82) .eq. -1) then ! READ(LETR) ERR(-1)
          call cant(aname)
      end if

      if (cmd .eq. 112) then            ! PRINT(LETP)
          efd = 6                       ! STDOUT(6)
      else
          efd = -1                      ! ERR(-1)
      end if

      while (gethdr(afd,in,ename,size) .ne. -1) do ! EOF(-1)
          if (filarg(ename) .eq. 0) then ! NO(0)
              call fskip(afd,size)
          else
              if(efd .ne. 6) then       ! STDOUT(6)
                  if (fcreate(ename) .eq. -1) then ! ERR(-1)
                      call putlin(ename,6)         ! STDOUT(6)
                      call remark(': can not create.')
                      errcnt = errcnt + 1
                      call fskip(afd,size)
                  else
                      efd = fopen(efd,ename,87) ! WRITE(LETW)
                  end if
              end if
              call acopy(afd,efd,size)
              if (efd .ne. 6) then      ! STDOUT(6)
                  call fclose(efd)
              end if
          end if
      end while
      call notfnd
      return
      end

acopy()は、size文字分、fdiからfdoに書き出します。

RATFOR版は下記の通り。

# acopy.r4 -- copy size characters from fdi to fdo
      subroutine acopy(fdi,fdo,size)
      integer fdi,fdo,size
      
      integer*1 fgetc,c
      integer i
      
      for (i = 1; i <= size; i = i + 1) {
          if (fgetc(fdi,c) == EOF)
              break
          call fputc(fdo,c)
          }
      return
      end

WATCOM Fortran77版は下記の通り。

c acopy.for -- copy size characters from fdi to fdo
      subroutine acopy(fdi,fdo,size)
      integer fdi,fdo,size
      integer*1 fgetc,c
      integer i

      i = 1
      while (i .le. size) do
          if (fgetc(fdi,c) .eq. -1) then ! EOF(-1)
              exit
          end if
          call fputc(fdo,c)
          i = i + 1
      end while
      return
      end

書庫からファイルを削除するdelete()は、ファイルの指定がなかった場合、 警告を出し実行を打ち切ります。

RATFOR版は下記の通り。

# delete.r -- delete files from archive
      subroutine delete(aname)
      character aname(ARB)
      integer fcreate,fopen,afd,tfd

      include carch.ri

      string tname "archtemp"

      if (nfiles < 0 ) then             # protect innocents
          call error('delete by name only.')
      end if
      
      if (fopen(afd,aname,READWRITE) == ERR)
          call cant(aname)
      if (fcreate(tname) == ERR)
          call cant(tname)
      if (fopen(tfd,tname,READWRITE) == ERR)
          call cant(tname)
      
      call replace(afd,tfd,DEL,errcnt)
      call notfnd
      call fclose(afd)
      call fclose(tfd)
      if (errcnt = 0) then
          call amove(tname,aname)
      else
          call remark('fatal errors -- archive not altered.')
      end if
      call fremove(tname)
      return
      end

WATCOM Fortran77版は下記の通り。

c delete.f -- delete files from archive
      subroutine delete(aname)
      integer*1 aname(81)               ! NAMESIZE(81)
      integer fcreate,fopen,afd,tfd

      include carch.fi

      integer*1 tname(9)
      data tname/'a','r','c','h','t','e','m','p',-2/

      if (nfiles .le. 0 ) then          ! protect innocents
          call error('delete by name only.')
      end if
      if (fopen(afd,aname,66) .eq. -1) then ! READWRITE(LETB) ERR(-1)
          call cant(aname)
      end if
      if (fcreate(tname) .eq. -1) then  ! ERR(-1)
          call cant(tname)
      endif
      if (fopen(tfd,tname,66) .eq. -1) then ! READWRITE(LETB) ERR(-1)
          call cant(tname)
      end if
      call replac(afd,tfd,100,errcnt) ! DEL(LETD)
      call notfnd
      call fclose(afd)
      call fclose(tfd)
      if (errcnt .eq. 0) then
          call amove(tname,aname)
      else
          call remark('fatal errors -- archive not altered.')
      end if
      call fremove(tname)
      return
      end

最後にreplac()は、ファイルの更新、または、削除をします。

RATFOR版は下記の通り。

# replac.r4 -- replace or delete files
      subroutine replace(afd,tfd,cmd,errcnt)
      integer afd,tfd,errcnt
      character cmd

      character in(MAXLINE),uname(NAMESIZE)
      integer size,filarg,gethdr

      while (gethdr(afd,in,uname,size) != EOF)
          if (filarg(uname) == YES) {
              if (cmd .eq. UPD)
                  call addfil(uname,tfd,errcnt)
              call fskip(afd,size)
              }
          else {
              call putlin(in,tfd)
              call acopy(afd,tfd,size)
              }
      return
      end

WATCOM Fortran77版は下記の通り。

c replac.for -- replace or delete files
      subroutine replac(afd,tfd,cmd,errcnt)
      integer afd,tfd,errcnt
      integer*1 cmd
      integer*1 in(81),uname(81)        ! MAXLINE(81) NAMESIZE(81)
      integer size
      integer filarg,gethdr

      while (gethdr(afd,in,uname,size) .ne. -1) do ! EOF(-1)
          if (filarg(uname) .eq. 1) then ! YES(1)
              if (cmd .eq. 117) then    ! UPD(LETU)
                  call addfil(uname,tfd,errcnt)
              end if
              call fskip(afd,size)
          else
              call putlin(in,tfd)
              call acopy(afd,tfd,size)
          end if
      end while
      return
      end

コメント

_ Pof Plenty Of Fish Dating Search ― 2015年10月17日 18:56

Good day! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a outstanding job!

_ Pof.com Login Inbox ― 2015年10月18日 05:23

I have learn a few just right stuff here. Definitely value bookmarking for revisiting. I wonder how a lot attempt you set to create such a wonderful informative web site.

_ Plenty Of Fish Basic Search ― 2015年10月18日 08:55

I don't even know how I ended up here, but I thought this post was good. I don't know who you are but definitely you're going to a famous blogger if you aren't already ;) Cheers!

_ Plentyoffish.com Login Page ― 2015年10月18日 11:22

After I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive 4 emails with the same comment. There has to be a way you can remove me from that service? Thanks a lot!

_ quest bars nutrition label ― 2015年10月18日 21:12

Superb site you have here but I was curious if you knew of any community forums that cover the same topics discussed in this article? I'd really like to be a part of group where I can get suggestions from other experienced people that share the same interest. If you have any suggestions, please let me know. Thanks a lot!

_ quest bar oreo ― 2015年10月19日 01:03

Greate article. Keep posting such kind of info on your site. Im really impressed by your site. Hello there, You've performed a fantastic job. I'll certainly digg it and personally suggest to my friends. I'm confident they will be benefited from this web site.

_ ingredients In quest Bar ― 2015年10月19日 08:00

Have you ever thought about writing an ebook or guest authoring on other sites? I have a blog based upon on the same ideas you discuss and would love to have you share some stories/information. I know my visitors would value your work. If you are even remotely interested, feel free to shoot me an email.

_ flolend.com ― 2015年10月24日 17:05

There's certainly a lot to know about this issue. I really like all the points you've made.

_ free match search ― 2015年10月30日 02:42

Way cool! Some extremely valid points! I appreciate
you penning this article and the rest of the site is really good.

_ quest nutrition protein bars uk ― 2015年10月30日 07:34

Hello, I enjoy reading through your article post.
I wanted to write a little comment to support you.

_ does forskolin work for weight loss ― 2015年11月05日 12:39

Hello my family member! I wish to say that this article is awesome, nice
written and come with approximately all significant infos.
I would like to look extra posts like this .

_ plenty of fish dating site of free dating ― 2015年11月05日 23:19

I love your blog.. very nice colors &amp; theme.
Did you create this website yourself or did you hire
someone to do it for you? Plz respond as I&#39;m looking to construct my own blog and would like to know where u
got this from. thanks a lot

_ plenty Of fish dating site of free Dating ― 2015年11月06日 05:40

I blog often and I seriously thank you for your content.
Your article has truly peaked my interest. I am
going to bookmark your website and keep checking for new details about once per week.
I subscribed to your RSS feed too.

_ plenty of Fish dating Site Of free dating ― 2015年11月06日 09:18

Howdy I am so happy I found your website, I really found
you by error, while I was looking on Aol for something else,
Anyways I am here now and would just like to say thanks for a fantastic
post and a all round enjoyable blog (I also love the theme/design),
I don’t have time to look over it all at the moment
but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb b.

_ plenty of fish dating site of free dating ― 2015年11月06日 12:46

Admiring the hard work you put into your blog and in depth information you
provide. It&#39;s great to come across a blog every once in a while that isn&#39;t
the same outdated rehashed material. Fantastic read! I&#39;ve bookmarked your site and I&#39;m including your RSS feeds to my Google account.

_ plenty of fish dating site of free dating ― 2015年11月06日 18:52

Remarkable! Its genuinely awesome article, I have got much clear idea about from this post.

_ plenty of Fish dating site of free dating ― 2015年11月06日 23:20

Hi, i think that i saw you visited my weblog thus i came to
“return the favor”.I am trying to find things to enhance my site!I
suppose its ok to use some of your ideas!!

_ plenty of fish dating site of free dating ― 2015年11月06日 23:54

Hi there, the whole thing is going nicely here and ofcourse every one is sharing data,
that&#39;s truly good, keep up writing.

_ plenty of fish dating site of free dating ― 2015年11月07日 03:16

Incredible! This blog looks exactly like my old one!
It&#39;s on a entirely different subject but it has pretty much the same layout and design. Outstanding choice of
colors!

_ plenty of fish dating site of free dating ― 2015年11月07日 06:55

I just couldn&#39;t go away your website prior to suggesting that I extremely loved
the usual info a person supply on your guests?

Is gonna be again frequently in order to check out new posts

_ plenty of fish dating site of free dating ― 2015年11月07日 09:44

Attractive section of content. I just stumbled
upon your weblog and in accession capital to assert that I acquire
actually enjoyed account your blog posts. Anyway I&#39;ll be
subscribing to your feeds and even I achievement you access consistently quickly.

_ plenty of fish dating site of free dating ― 2015年11月07日 15:14

First of all I would like to say great blog! I had a quick
question which I&#39;d like to ask if you don&#39;t mind.
I was interested to find out how you center yourself and
clear your thoughts prior to writing. I&#39;ve had difficulty clearing my mind in getting my thoughts out there.
I do take pleasure in writing however it just seems like the first 10
to 15 minutes are wasted just trying to figure out how to begin. Any recommendations or tips?
Kudos!

_ justin bieber dating ― 2015年11月09日 13:50

Yes! Finally something about justin bieber dating.

_ justin bieber dating ― 2015年11月09日 15:54

Thanks for finally writing about &gt;extrac() -- ファイルの書き出し delete() -- 削除 replac() -- 更新: アナクロなコンピューターエンジニアのつぶやき &lt;Loved it!

_ kroger digital coupon ― 2015年11月11日 13:03

Hello would you mind letting me know which webhost you&#39;re utilizing?
I&#39;ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most.
Can you recommend a good web hosting provider at a fair price?
Kudos, I appreciate it!

_ kroger weekly digital coupons ― 2015年11月11日 19:07

Valuable info. Lucky me I discovered your website accidentally, and I&#39;m surprised why this twist of fate
didn&#39;t took place earlier! I bookmarked it.

_ www.krogerfeedback.com ― 2015年11月11日 22:26

Today, I went to the beach front with my kids. I found a sea shell
and gave it to my 4 year old daughter and said &quot;You can hear the ocean if you put this to your ear.&quot; She placed the shell to her ear and
screamed. There was a hermit crab inside and it pinched her ear.

She never wants to go back! LoL I know this is entirely off topic but
I had to tell someone!

_ krogerfeedback.com ― 2015年11月12日 17:45

Hi, its nice piece of writing regarding media print, we all be familiar with media is a impressive source of information.

_ krogerfeedback.com ― 2015年11月13日 15:13

Tremendous things here. I am very happy to peer your article.
Thank you a lot and I&#39;m taking a look forward to touch you.
Will you please drop me a e-mail?

_ kroger hot offer digital coupons ― 2015年11月15日 20:58

I have read so many articles regarding the blogger lovers however this article is
genuinely a pleasant piece of writing, keep it up.

_ kroger digital coupons on card ― 2015年11月17日 08:58

This is very interesting, You are a very skilled blogger.
I&#39;ve joined your rss feed and look forward to seeking more of your wonderful post.
Also, I have shared your site in my social networks!

_ plenty of fish ― 2015年11月26日 14:06

Appreciate the recommendation. Will try it out.

_ plenty Of fish dating site of Free dating ― 2015年11月26日 21:09

Quality content is the important to interest the visitors to
pay a quick visit the web page, that&#39;s what this web
page is providing.

_ quest bars ― 2015年11月30日 07:38

I will immediately take hold of your rss feed
as I can&#39;t in finding your email subscription hyperlink or e-newsletter service.

Do you have any? Kindly allow me know so that I may subscribe.
Thanks.

_ www.Krogerfeedback.Com ― 2015年12月04日 17:49

Hi there! Someone in my Myspace group shared this website
with us so I came to give it a look. I&#39;m definitely enjoying the information. I&#39;m book-marking and will be tweeting
this to my followers! Terrific blog and superb
design.

_ kroger feedback survey ― 2015年12月05日 21:25

We&#39;re a bunch of volunteers and opening a brand new scheme in our community.

Your web site offered us with helpful info to work on. You have done a formidable task and our
whole group shall be grateful to you.

_ www.krogerfeedback.Com ― 2015年12月06日 14:17

I&#39;m truly enjoying the design and layout of your
website. It&#39;s a very easy on the eyes which makes it much more enjoyable for me
to come here and visit more often. Did you hire out a
designer to create your theme? Fantastic work!

_ tinyurl.com ― 2015年12月07日 17:22

Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how
to get listed in Yahoo News? I&#39;ve been trying for a while but I
never seem to get there! Thanks

_ tinyurl.com ― 2015年12月08日 16:04

For latest news you have to pay a visit the web and on the web I found this web page as a most excellent website for most up-to-date updates.

_ Tustin CA ― 2015年12月09日 18:54

This paragraph will assist the internet visitors for creating
new webpage or even a weblog from start to end.

_ where can i buy quest bars in store ― 2015年12月11日 16:10

Hey there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Opera.

I&#39;m not sure if this is a formatting issue or something to do with web browser compatibility but I thought
I&#39;d post to let you know. The design and style look
great though! Hope you get the problem solved
soon. Kudos

_ where can you buy quest bars ― 2015年12月11日 20:58

When I originally commented I clicked the &quot;Notify me when new comments are added&quot; checkbox and now
each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

_ best place to buy quest bars ― 2015年12月11日 21:14

I do trust all the concepts you&#39;ve introduced to your post.

They&#39;re really convincing and will certainly work. Still, the posts are very quick for beginners.
May you please lengthen them a little from next time? Thank you for the post.

_ plenty of fish dating site of free dating ― 2015年12月11日 21:17

I do not even know how I ended up here, but I thought
this post was great. I don&#39;t know who you are but certainly
you are going to a famous blogger if you aren&#39;t already ;) Cheers!

_ appdata minecraft ― 2015年12月12日 10:51

Hi there Dear, are you in fact visiting this web site regularly, if so after that
you will absolutely get good experience.

_ quest bars ― 2015年12月12日 15:49

Good way of telling, and fastidious piece of writing to obtain facts
about my presentation subject, which i am going to convey in school.

_ appdata minecraft ― 2015年12月12日 18:45

Hello would you mind sharing which blog platform you&#39;re working with?
I&#39;m planning to start my own blog in the
near future but I&#39;m having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your layout seems different
then most blogs and I&#39;m looking for something unique.
P.S Sorry for being off-topic but I had to ask!

_ Plenty of Fish Dating Site of Free Dating ― 2015年12月16日 06:45

I&#39;m not sure why but this site is loading incredibly slow for me.

Is anyone else having this problem or is it a issue on my end?
I&#39;ll check back later and see if the problem still exists.

_ Quest bars cheap online ― 2015年12月17日 12:04

I blog often and I genuinely appreciate your content.
This article has truly peaked my interest. I&#39;m going to take a note of your
blog and keep checking for new information about once per week.
I subscribed to your Feed too.

_ descargar facebook gratis ― 2015年12月19日 06:13

I think what you said made a bunch of sense. However, what
about this? what if you were to create a killer headline? I am not saying your information is not solid,
however what if you added a headline to maybe get people&#39;s attention? I mean extrac() -- ファイルの書き出し delete() -- 削除 replac() --
更新: アナクロなコンピューターエンジニアのつぶやき is a little boring.
You should peek at Yahoo&#39;s home page and watch how they write news titles to
get people to open the links. You might add a related video or a picture
or two to grab readers excited about what you&#39;ve got to say.

Just my opinion, it might bring your posts a little livelier.

※コメントの受付件数を超えているため、この記事にコメントすることができません。

トラックバック

このエントリのトラックバックURL: http://kida.asablo.jp/blog/2015/06/06/7663370/tb