1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.36
4: Copyright (C) 1989-2025 Dr. BERTRAND Joël
5:
6: This file is part of RPL/2.
7:
8: RPL/2 is free software; you can redistribute it and/or modify it
9: under the terms of the CeCILL V2 License as published by the french
10: CEA, CNRS and INRIA.
11:
12: RPL/2 is distributed in the hope that it will be useful, but WITHOUT
13: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License
15: for more details.
16:
17: You should have received a copy of the CeCILL License
18: along with RPL/2. If not, write to info@cecill.info.
19: ================================================================================
20: */
21:
22:
23: #include "rpl-conv.h"
24:
25:
26: /*
27: ================================================================================
28: Fonction 'workdir'
29: ================================================================================
30: Entrées :
31: --------------------------------------------------------------------------------
32: Sorties :
33: --------------------------------------------------------------------------------
34: Effets de bord : néant
35: ================================================================================
36: */
37:
38: void
39: instruction_workdir(struct_processus *s_etat_processus)
40: {
41: struct_objet *s_objet_argument;
42:
43: (*s_etat_processus).erreur_execution = d_ex;
44:
45: if ((*s_etat_processus).affichage_arguments == 'Y')
46: {
47: printf("\n WORKDIR ");
48:
49: if ((*s_etat_processus).langue == 'F')
50: {
51: printf("(changement du répertoire de travail)\n\n");
52: }
53: else
54: {
55: printf("(change directory)\n\n");
56: }
57:
58: printf(" 1: %s\n", d_CHN);
59:
60: return;
61: }
62: else if ((*s_etat_processus).test_instruction == 'Y')
63: {
64: (*s_etat_processus).nombre_arguments = -1;
65: return;
66: }
67:
68: if (test_cfsf(s_etat_processus, 31) == d_vrai)
69: {
70: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
71: {
72: return;
73: }
74: }
75:
76: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
77: &s_objet_argument) == d_erreur)
78: {
79: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
80: return;
81: }
82:
83: if ((*s_objet_argument).type == CHN)
84: {
85: if (chdir((unsigned char *) (*s_objet_argument).objet) != 0)
86: {
87: (*s_etat_processus).erreur_execution =
88: d_ex_erreur_acces_fichier;
89: return;
90: }
91: }
92: else
93: {
94: liberation(s_etat_processus, s_objet_argument);
95:
96: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
97: return;
98: }
99:
100: liberation(s_etat_processus, s_objet_argument);
101:
102: return;
103: }
104:
105: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>