fortrangoingonforty/fortsh / 3132484

Browse files

bind c_fputs for writing to popen'd pipes

Authored by espadonne
SHA
3132484cccb98e99437b678c479f80427bd2bcd2
Parents
3ab40b8
Tree
419ae57

1 changed file

StatusFile+-
M src/system/interface.f90 10 1
src/system/interface.f90modified
@@ -450,7 +450,16 @@ module system_interface
450450
       type(c_ptr), value :: stream
451451
       type(c_ptr) :: c_fgets
452452
     end function
453
-    
453
+
454
+    ! Write a null-terminated string to a stream (shift phase Sprint 5:
455
+    ! used to pipe text into clipboard tools like pbcopy via popen("w")).
456
+    function c_fputs(s, stream) bind(C, name="fputs")
457
+      import :: c_ptr, c_int
458
+      type(c_ptr), value :: s
459
+      type(c_ptr), value :: stream
460
+      integer(c_int) :: c_fputs
461
+    end function
462
+
454463
     subroutine c_exit(status) bind(C, name="exit")
455464
       import :: c_int
456465
       integer(c_int), value :: status