Minishell 1.0
42 School Minishell Project - A simple shell implementation
Yüklüyor...
Arıyor...
Eşleşme Yok
executor_heredoc.c Dosya Referansı

Heredoc implementasyonu (fork tabanlı). Ayrıntılar...

#include "../../include/minishell.h"
#include <signal.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
executor_heredoc.c için içerme bağımlılık grafiği:

Bu dosyanın kaynak koduna git.

Fonksiyonlar

static char * heredoc_read_line (void)
 Heredoc için bir satır oku (readline yerine read kullanır).
static void heredoc_child (t_shell *shell, t_redir *redir, int write_fd)
 Heredoc satırlarını oku ve pipe'a yaz (child process).
int redir_heredoc (t_shell *shell, t_redir *redir)
 Heredoc redirection uygula (fork tabanlı).

Ayrıntılı tanımlama

Heredoc implementasyonu (fork tabanlı).

Heredoc okuma child process'te yapılır. readline yerine write+read kullanılır (cooked mode, SIG_DFL çalışır). Ctrl-C → child SIG_DFL ile ölür, parent terminali düzeltir.

executor_heredoc.c dosyasında tanımlanmıştır.

Fonksiyon Dokümantasyonu

◆ heredoc_read_line()

char * heredoc_read_line ( void )
static

Heredoc için bir satır oku (readline yerine read kullanır).

Döndürdüğü değer
char* Okunan satır (malloc), EOF: NULL

Cooked mode'da read() Enter'a kadar bekler, tüm satırı döner. SIG_DFL bu modda doğru çalışır (readline override etmez).

executor_heredoc.c dosyasının 36 numaralı satırında tanımlanmıştır.

Referans veren heredoc_child().

Bu fonksiyon için çağırılma şeması:

◆ heredoc_child()

void heredoc_child ( t_shell * shell,
t_redir * redir,
int write_fd )
static

Heredoc satırlarını oku ve pipe'a yaz (child process).

executor_heredoc.c dosyasının 62 numaralı satırında tanımlanmıştır.

Referanslar expand_heredoc_line(), s_redir::file, ft_strcmp(), heredoc_read_line(), s_redir::quoted ve write_heredoc_line().

Referans veren redir_heredoc().

Bu fonksiyon için çağırılma şeması:
Bu fonksiyon için çağırılma şeması:

◆ redir_heredoc()

int redir_heredoc ( t_shell * shell,
t_redir * redir )

Heredoc redirection uygula (fork tabanlı).

Parametreler
shellShell structure
redirRedirection yapısı
Döndürdüğü değer
int başarı: fd, hata/iptal: -1

Child process heredoc'u okur (write+read, readline değil). Ctrl-C: child ölür (SIG_DFL), parent terminali düzeltir.

executor_heredoc.c dosyasının 109 numaralı satırında tanımlanmıştır.

Referanslar create_heredoc_pipe(), s_shell::exit_status, s_redir::file, heredoc_child(), setup_signals() ve shell_exit().

Referans veren apply_redir().

Bu fonksiyon için çağırılma şeması:
Bu fonksiyon için çağırılma şeması: