Nový ovladač Steam Controller jde do prodeje 4. května. Cena je 99 eur.
Greg Kroah-Hartman začal používat AI asistenta pojmenovaného gkh_clanker_t1000. V commitech se objevuje "Assisted-by: gkh_clanker_t1000". Na social.kernel.org publikoval jeho fotografii. Jedná se o Framework Desktop s AMD Ryzen AI Max a lokální LLM.
Ubuntu 26.10 bude Stonking Stingray (úžasný rejnok).
Webový prohlížeč Dillo (Wikipedie) byl vydán ve verzi 3.3.0. S experimentální podporou FLTK 1.4. S příkazem dilloc pro ovládání prohlížeče z příkazové řádky. Vývoj prohlížeče se přesunul z GitHubu na vlastní doménu dillo-browser.org (Git).
Byl publikován přehled dění a novinek z vývoje Asahi Linuxu, tj. Linuxu pro Apple Silicon. Vývojáři v přehledu vypíchli vylepšenou instalaci, podporu senzoru okolního světla, úsporu energie, opravy Bluetooth nebo zlepšení audia. Vývoj lze podpořit na Open Collective a GitHub Sponsors.
raylib (Wikipedie), tj. multiplatformní open-source knihovna pro vývoj grafických aplikací a her, byla vydána ve verzi 6.0.
Nové verze AI modelů. Společnost OpenAI představila GPT‑5.5. Společnost DeepSeek představila DeepSeek V4.
Nová čísla časopisů od nakladatelství Raspberry Pi zdarma ke čtení: Raspberry Pi Official Magazine 164 (pdf) a Hello World 29 (pdf).
Bylo oznámeno, že webový prohlížeč Opera GX zaměřený na hráče počítačových her je už také na Flathubu and Snapcraftu.
Akcionáři americké mediální společnosti Warner Bros. Discovery dnes schválili převzetí firmy konkurentem Paramount Skydance za zhruba 110 miliard dolarů (téměř 2,3 bilionu Kč). Firmy se na spojení dohodly v únoru. O část společnosti Warner Bros. Discovery dříve usilovala rovněž streamovací platforma Netflix, se svou nabídkou však neuspěla. Transakci ještě budou schvalovat regulační orgány, a to nejen ve Spojených státech, ale také
… více »|v C. Kod nize funguje jako rourapro prikazy bez parametru, ale premyslim, jak to udelat, aby roura fungovala obecne, tj. zpracovavala by jako argumenty shellovske prikazy i s jejich pripadnymi parametry. Kod nize spousti shellovsky prikaz
prikaz1 | prikaz2 dvajako
./pipe prikaz1 prikaz 2a ja bych chtel aby to fungovalo napriklad jako:
./pipe prikaz1 -abcde prikaz2 -a -b -cNapadaji me jenom same drsne zpusoby jak to vyresit, pomoci ruzneho parsovani, ale tim by se kod stal prilis robustni
int main(int argc,char **argv) {
int fd[2];
pipe(fd);
pid_t childpid;
pid_t pid = fork();
if (childpid == -1)
{
perror("Error forking...");
exit(1);
}
if (pid == -1)
return -1;
if (pid == 0)
{
close(fd[1]); //close write to pipe, in child
dup2(fd[0], STDIN_FILENO); // Replace stdin with the read end of the pipe
close(fd[0]); // Don't need another copy of the pipe read end hanging about
execlp(argv[2],argv[2],argv[3],NULL);
}
else
{
close(fd[0]); //close read from pipe, in parent
dup2(fd[1], STDOUT_FILENO); // Replace stdout with the write end of the pipe
close(fd[1]); // Don't need another copy of the pipe write end hanging about
execlp(argv[1],argv[1],NULL);
}
return EXIT_SUCCESS;
}
Řešení dotazu:
./pipe command1 -s -tisicem param etru %DELIMITER% command2 -s -jinym --tisicem par ametru
cat test a druhý xargs file, nedokážete určit, kde to správně rozdělit (záměrně jsem vybral taková jména, kde každé slovo je zároveň i jméno existujícího programu).
Nejjednodušší řešení je to zauvozovkovat, tedy aby se ten program i s parametry předával jako jeden parametr, a místo execlp použít system:
./pipe "prikaz1 -abcde" "prikaz2 -a -b -c"
@Vysledny kod vypada takto:
int main(int argc,char *argv[]) {
if (argc < 2) {
printf("Programme must be run with with arguments and using pipe shell symbol as a delimiter!\n"
"For example: ./pipe ls -la @ grep -v .c\n");
exit(1);
}
int count;
int fd[2];
char command1[50];
char command2[50];
char arguments1[50];
char arguments2[50];
strcpy(command1, argv[1]);
strcpy(arguments1, " ");
strcpy(arguments2, " ");
count = 2;
for (; count < argc; count++) {
if (strcmp(argv[count], "@") == 0) {
break;
}
strcat(arguments1, argv[count]);
strcat(arguments1, " ");
}
arguments1[strlen(arguments1)-1] = '\0'; //removing ending space
strcat(command1, arguments1);
strcpy(command2, argv[count+1]);
count += 2;
for ( ; count < argc; count++) {
strcat(arguments2, argv[count]);
strcat(arguments2, " ");
}
arguments1[strlen(arguments2)-1] = '\0';
strcat(command2, arguments2);
pipe(fd);
pid_t pid = fork();
if (pid == -1)
return -1;
if (pid == 0) {
close(fd[1]); //close write to pipe, in child
dup2(fd[0], STDIN_FILENO); // Replace stdin with the read end of the pipe
close(fd[0]); // Don't need another copy of the pipe read end hanging about
system(command2);
}
else {
close(fd[0]); //close read from pipe, in parent
dup2(fd[1], STDOUT_FILENO); // Replace stdout with the write end of the pipe
close(fd[1]); // Don't need another copy of the pipe write end hanging about;
system(command1);
}
return EXIT_SUCCESS;
}
mkfifo()?
fopen: No such file or directoryDOsavadni kod:
int main(int argc,char *argv[]) {
if (argc < 2) {
printf("Programme must be run with with arguments and using pipe shell symbol as a delimiter!\n"
"For example: ./pipe ls -la @ grep -v .c\n");
exit(1);
}
int count, fw, fr;
char command1[50];
char command2[50];
char arguments1[50];
char arguments2[50];
strcpy(command1, argv[1]);
strcpy(arguments1, " ");
strcpy(arguments2, " ");
count = 2;
for (; count < argc; count++) {
if (strcmp(argv[count], "@") == 0) {
break;
}
strcat(arguments1, argv[count]);
strcat(arguments1, " ");
}
arguments1[strlen(arguments1)-1] = '\0'; //removing ending space
strcat(command1, arguments1);
strcpy(command2, argv[count+1]);
count += 2;
for ( ; count < argc; count++) {
strcat(arguments2, argv[count]);
strcat(arguments2, " ");
}
arguments1[strlen(arguments2)-1] = '\0';
strcat(command2, arguments2);
mkfifo(FIFO_FILE, S_IFIFO|0666);
pid_t pid = fork();
if (pid == -1)
return -1;
if (pid == 0) {
//close(fifo); //close write to pipe, in child
//dup2(fifo, STDIN_FILENO); // Replace stdin with the read end of the pipe
//close(fifo); // Don't need another copy of the pipe read end hanging about
if(fr = fopen(FIFO_FILE, "r") == NULL) {
perror("fopen");
exit(1);
}
dup2(fr, STDIN_FILENO);
close(fr);
system(command2);
}
else {
//close(fifo); //close read from pipe, in parent
//dup2(fifo, STDOUT_FILENO); // Replace stdout with the write end of the pipe
//close(fifo); // Don't need another copy of the pipe write end hanging about;
if(fw = fopen(FIFO_FILE, "w") == NULL) {
perror("fopen");
exit(1);
}
dup2(fw, STDOUT_FILENO);
close(fw);
system(command1);
}
return EXIT_SUCCESS;
}
Tiskni
Sdílej: