Mercurial > forge
view admin/split_docstrings @ 12678:e4374feb2e3f octave-forge
[nan-tb] fix bug when file open fails; address several compiler warnings
author | schloegl |
---|---|
date | Thu, 20 Aug 2015 09:01:53 +0000 |
parents | 3933841dc7f8 |
children |
line wrap: on
line source
#!/bin/sh file=$1 cat <<EOF | octave -q fid = fopen("$file","rt"); text = char(fread(fid,Inf,'uchar')); fclose(fid); section = [find(text == char(31))]; line = find(text == "\n"); section(length(section)+1) = line(length(line)) + 1; for idx=1:length(section)-1 lineend = min(line(line>section(idx))); name = text(section(idx)+1:lineend-1); body = text(lineend+1:section(idx+1)-1); fid = fopen(name',"wt"); fwrite(fid, body, 'uchar'); fclose(fid); end