comparison src/file-io.cc @ 3301:02866242d3ae

[project @ 1999-10-20 04:10:46 by jwe]
author jwe
date Wed, 20 Oct 1999 04:10:53 +0000
parents 7d80b56e0dc8
children 6923abb04e16
comparison
equal deleted inserted replaced
3300:cfbe664b5ebf 3301:02866242d3ae
1203 1203
1204 return retval; 1204 return retval;
1205 } 1205 }
1206 1206
1207 DEFUN (popen, args, , 1207 DEFUN (popen, args, ,
1208 "FILENUM = popen (FILENAME, MODE)\n\ 1208 "-*- texinfo -*-\n\
1209 \n\ 1209 @deftypefn {Built-in Function} {fid =} popen (@var{command}, @var{mode})\n\
1210 start a process and create a pipe. Valid values for mode are:\n\ 1210 Start a process and create a pipe. The name of the command to run is\n\
1211 \n\ 1211 given by @var{command}. The file identifier corresponding to the input\n\
1212 \"r\" : connect stdout of process to pipe\n\ 1212 or output stream of the process is returned in @var{fid}. The argument\n\
1213 \"w\" : connect stdin of process to pipe") 1213 @var{mode} may be\n\
1214 \n\
1215 @table @code\n\
1216 @item \"r\"\n\
1217 The pipe will be connected to the standard output of the process, and\n\
1218 open for reading.\n\
1219 \n\
1220 @item \"w\"\n\
1221 The pipe will be connected to the standard input of the process, and\n\
1222 open for writing.\n\
1223 @end table\n\
1224 \n\
1225 For example,\n\
1226 \n\
1227 @example\n\
1228 @group\n\
1229 fid = popen (\"ls -ltr / | tail -3\", \"r\");\n\
1230 while (isstr (s = fgets (fid)))\n\
1231 fputs (stdout, s);\n\
1232 endwhile\n\
1233 @print{} drwxr-xr-x 33 root root 3072 Feb 15 13:28 etc\n\
1234 @print{} drwxr-xr-x 3 root root 1024 Feb 15 13:28 lib\n\
1235 @print{} drwxrwxrwt 15 root root 2048 Feb 17 14:53 tmp\n\
1236 @end group\n\
1237 @end example\n\
1238 @end deftypefn")
1214 { 1239 {
1215 octave_value retval = -1.0; 1240 octave_value retval = -1.0;
1216 1241
1217 int nargin = args.length (); 1242 int nargin = args.length ();
1218 1243
1252 1277
1253 return retval; 1278 return retval;
1254 } 1279 }
1255 1280
1256 DEFUN (pclose, args, , 1281 DEFUN (pclose, args, ,
1257 "pclose (FILENUM)\n\ 1282 "-*- texifno -*-\n\
1258 \n\ 1283 @deftypefn {Built-in Function} {} pclose (@var{fid})\n\
1259 Close a pipe and terminate the associated process") 1284 Close a file identifier that was opened by @code{popen}. You may also\n\
1285 use @code{fclose} for the same purpose.\n\
1286 @end deftypefn")
1260 { 1287 {
1261 double retval = -1.0; 1288 double retval = -1.0;
1262 1289
1263 int nargin = args.length (); 1290 int nargin = args.length ();
1264 1291
1327 1354
1328 return retval; 1355 return retval;
1329 } 1356 }
1330 1357
1331 DEFUN (umask, args, , 1358 DEFUN (umask, args, ,
1332 "umask (MASK)\n\ 1359 "-*- texinfo -*-\n\
1333 \n\ 1360 @deftypefn {Built-in Function} {} umask (@var{mask})\n\
1334 Change the file permission mask for file creation for the current\n\ 1361 Set the permission mask for file creation. The parameter @var{mask}\n\
1335 process. MASK is an integer, interpreted as an octal number. If\n\ 1362 is an integer, interpreted as an octal number. If successful,\n\
1336 successful, returns the previous value of the mask (as an integer to\n\ 1363 returns the previous value of the mask (as an integer to be\n\
1337 be interpreted as an octal number); otherwise an error message is\n\ 1364 interpreted as an octal number); otherwise an error message is printed.\n\
1338 printed.") 1365 @end deftypefn")
1339 { 1366 {
1340 octave_value_list retval; 1367 octave_value_list retval;
1341 1368
1342 int status = 0; 1369 int status = 0;
1343 1370