
*#include "scrnsave.ch"
SET stat off
set scor off
set talk off
set date to brit
set cent on
clea
set colo to gr+/n
@00,00 to 00,79
@01,00 SAY PADC("NET SYSTEM INFORMATICA - SÇO PAULO BR",79)
@02,00 to 02,79
set colo to g/n
@03,00 say "Rotina para criar arquivos RMK e LNK"
@03,65 say "Andril Jan/04"
? ""
? ""
set colo to w+/n
? "Os arquivos criados para utiliza‡Æo pelo Rmake receberÆo o nome iniciado"
? "com LINK1.RMK, LINK2.RMK e etc."
? ""
? "O arquivo para utilizacao pelo LINKEDITOR ser  chamado de RMK.LNK"
? ""
? "Se estiver utilizado muitos arquivos de fontes o arquivo RMK.LNK "
? "gerado poder  ficar muito extenso o que poder  ocasionar erro na "
? "linkagem, diminua a instrucao FI nomedoarquivo colocando mais de "
? "um nome na mesma linha."
? ""
? "Conteudo do arquivo rmk.lnk"
? "FI prog1"
? "FI prog2"
? ""
? "Altera‡äes sugiridas"
? "FI prog1,prog2...progxxx"
? ""

set colo to gr+/n
? "Deseja montar um novo arquivo Rmake com os OBJs e PRGs que constam neste"
? "diret¢rio?  Digite S=Sim ou N=NÆo"
res=" "
@row(),col()+1 get res pict"!"valid res$"SN"
read

if res#"S"
set colo to
return
endif
priv nome_ar[ADIR("*.PRG")]
         TOTALPRG=ADIR("*.PRG")

         cont_arq:=1
         priv atribs[cont_arq]
         priv quinto[cont_arq]
         arqs=ADIR("*.prg",NOME_AR,atribs,,,quinto)

*         ? atribs[1]
*         ? NOME_AR[1]
*         ? NOME_AR[2]
*         wait
//CRIANDO O ARQUIVO RMK
n_arq=1
n_inter=1
ARQ="LINK"+ALLTRIM(STR(n_arq))+".RMK"
SET PRINTER TO &ARQ
SET PRINT ON
SET CONS OFF
n=1
do while n<=TOTALPRG
? stuff(nome_ar[n],len(nome_ar[n])-3,4,"")+".OBJ  :  "+nome_ar[n]
? "         Clipper "+nome_ar[n]+" /m"
n++
n_inter++
      if n_inter=100
          SET PRINTER TO
          n_arq++
          ARQ="LINK"+ALLTRIM(STR(n_arq))+".RMK"
          SET PRINTER TO &ARQ
          n_inter=1
      endif
enddo
SET PRINTER TO

//CRIANDO O ARQUIVO RMK.LNK

SET PRINTER TO "RMK.LNK"

n=1

*? "file "+stuff(nome_ar[n],len(nome_ar[n])-3,4,"")
linhainici=1
linhatotal=1
do while n<=TOTALPRG
? "file "+stuff(nome_ar[n],len(nome_ar[n])-3,4,"")
/*
   do while linhatotal<=10
   ?? ","+stuff(nome_ar[n],len(nome_ar[n])-3,4,"")
   linhatotal++

     if n>=TOTALPRG
         SET PRINTER TO
         SET PRINT OFF
         SET CONS ON
         ?"Fim da Tarefa"
         return
     endif
   n++
   enddo
*/
n++
*linhatotal=1
enddo

SET PRINTER TO
SET PRINT OFF
SET CONS ON
?"Fim da Tarefa"



