1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: filedelete.e
|
---|
4 | *
|
---|
5 | * .e wrapper routine to access the NEPMD library DLL.
|
---|
6 | * include of nepmdlib.e
|
---|
7 | *
|
---|
8 | * Copyright (c) Netlabs EPM Distribution Project 2002
|
---|
9 | *
|
---|
10 | * $Id: filedelete.e 2417 2011-05-15 23:32:51Z aschn $
|
---|
11 | *
|
---|
12 | * ===========================================================================
|
---|
13 | *
|
---|
14 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
15 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
16 | * GNU General Public License as published by the Free Software
|
---|
17 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
18 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
20 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | ****************************************************************************/
|
---|
24 |
|
---|
25 | /*
|
---|
26 | @@NepmdFileDelete@PROTOTYPE
|
---|
27 | rc = NepmdFileDelete( Filename);
|
---|
28 |
|
---|
29 | @@NepmdFileDelete@CATEGORY@FILE
|
---|
30 |
|
---|
31 | @@NepmdFileDelete@SYNTAX
|
---|
32 | This function deletes a file.
|
---|
33 |
|
---|
34 | @@NepmdFileDelete@PARM@Filename
|
---|
35 | This parameter specifies the name of the file to be deleted.
|
---|
36 |
|
---|
37 | @@NepmdFileDelete@RETURNS
|
---|
38 | *NepmdFileDelete* returns an OS/2 error code or zero for no error.
|
---|
39 |
|
---|
40 | @@NepmdFileDelete@REMARKS
|
---|
41 | *NepmdFileDelete* replaces the function *erasetemp* of *stdprocs.e*.
|
---|
42 |
|
---|
43 | For downwards compatibility the old function is still provided,
|
---|
44 | but calls *NepmdFileDelete*.
|
---|
45 |
|
---|
46 | @@NepmdFileDelete@TESTCASE
|
---|
47 | You can test this function from the *EPM* commandline by
|
---|
48 | executing:
|
---|
49 | .sl
|
---|
50 | - *NepmdFileDelete* [.IDPNL_EFUNC_NEPMDFILEDELETE_PARM_FILENAME filename]
|
---|
51 | - or
|
---|
52 | - *FileDelete* [.IDPNL_EFUNC_NEPMDFILEDELETE_PARM_FILENAME filename]
|
---|
53 |
|
---|
54 | Executing this command will
|
---|
55 | delete the specified file
|
---|
56 | and display the result within the status area.
|
---|
57 |
|
---|
58 | _*Example:*_
|
---|
59 | .fo off
|
---|
60 | FileDelete d:\myscript.txt
|
---|
61 | .fo on
|
---|
62 |
|
---|
63 | @@
|
---|
64 | */
|
---|
65 |
|
---|
66 |
|
---|
67 | /* ------------------------------------------------------------- */
|
---|
68 | /* allow editor command to call function */
|
---|
69 | /* ------------------------------------------------------------- */
|
---|
70 | compile if NEPMD_LIB_TEST
|
---|
71 |
|
---|
72 | defc NepmdFileDelete, FileDelete =
|
---|
73 |
|
---|
74 | Filename = arg( 1);
|
---|
75 | if (Filename = '') then
|
---|
76 | sayerror 'error: no filename specified.';
|
---|
77 | return;
|
---|
78 | endif
|
---|
79 |
|
---|
80 | rc = NepmdFileDelete( Filename);
|
---|
81 | if (rc = 0) then
|
---|
82 | StrResult = 'been deleted';
|
---|
83 | else
|
---|
84 | StrResult = 'not been deleted, rc='rc;
|
---|
85 | endif
|
---|
86 |
|
---|
87 | sayerror 'file "'Filename'" has' StrResult;
|
---|
88 |
|
---|
89 | return;
|
---|
90 |
|
---|
91 | compile endif
|
---|
92 |
|
---|
93 | /* ------------------------------------------------------------- */
|
---|
94 | /* procedure: NepmdFileDelete */
|
---|
95 | /* ------------------------------------------------------------- */
|
---|
96 | /* .e Syntax: */
|
---|
97 | /* rc = NepmdFileDelete( filename); v */
|
---|
98 | /* ------------------------------------------------------------- */
|
---|
99 | /* C prototype: */
|
---|
100 | /* APIRET EXPENTRY NepmdFileDelete( PSZ pszFilename); */
|
---|
101 | /* */
|
---|
102 | /* ------------------------------------------------------------- */
|
---|
103 |
|
---|
104 | defproc NepmdFileDelete( Filename) =
|
---|
105 |
|
---|
106 | /* prepare parameters for C routine */
|
---|
107 | Filename = Filename''atoi( 0);
|
---|
108 |
|
---|
109 | /* call C routine */
|
---|
110 | LibFile = helperNepmdGetlibfile();
|
---|
111 | rc = dynalink32( LibFile,
|
---|
112 | "NepmdFileDelete",
|
---|
113 | address( Filename));
|
---|
114 |
|
---|
115 | helperNepmdCheckliberror( LibFile, rc);
|
---|
116 |
|
---|
117 | return rc;
|
---|
118 |
|
---|